// 妇保/儿保 5 种特殊患者专案注册表(单一数据源) // category: maternal=妇保科 / child=儿保科 // entryLabel: 入口(门诊记录页选专案)按钮名 // label: 列表页/详情页标题 // columns: 列表页列定义 { label, prop, type } // type 取值:text(默认) | sex | date | closeStatus export const ARCHIVE_TYPES = [ { key: "pregnancy", category: "maternal", entryLabel: "早孕关爱", label: "孕妇随访", subTypeLabel: "孕妇随访", route: "/filing/pregnancy", detailRoute: "/filing/maternalDetail", columns: [ { label: "姓名", prop: "patname" }, { label: "出生日期", prop: "birthday", type: "date" }, { label: "身份证号", prop: "idcardno" }, { label: "联系电话", prop: "telcode" }, { label: "诊断日期", prop: "diagnosisDate", type: "date" }, { label: "建档日期", prop: "createTime", type: "date" }, { label: "诊断", prop: "diagname" }, { label: "妊娠情况", prop: "pregnancyStatus" }, { label: "主治医生", prop: "attendingDoctor" }, { label: "经管医生", prop: "managingDoctor" }, { label: "结案状态", prop: "closeStatus", type: "closeStatus" }, { label: "登记人员", prop: "registrant" }, ], }, { key: "menopause", category: "maternal", entryLabel: "围绝经期MHI", label: "围绝经期MHI", subTypeLabel: "围绝经期MHI", route: "/filing/menopause", detailRoute: "/filing/maternalDetail", columns: [ { label: "姓名", prop: "patname" }, { label: "出生日期", prop: "birthday", type: "date" }, { label: "身份证号", prop: "idcardno" }, { label: "联系电话", prop: "telcode" }, { label: "诊断日期", prop: "diagnosisDate", type: "date" }, { label: "建档日期", prop: "createTime", type: "date" }, { label: "诊断", prop: "diagname" }, { label: "随访周期(次数)", prop: "followupCycles" }, { label: "主治医生", prop: "attendingDoctor" }, { label: "经管医生", prop: "managingDoctor" }, { label: "结案状态", prop: "closeStatus", type: "closeStatus" }, { label: "登记人员", prop: "registrant" }, ], }, { key: "highRisk", category: "child", entryLabel: "高危儿专案", label: "高危儿专案", subTypeLabel: "高危儿专案管理", route: "/filing/highRisk", detailRoute: "/filing/childDetail", columns: [ { label: "儿童姓名", prop: "patname" }, { label: "家长姓名", prop: "parentInfo.parentName" }, { label: "拟随访日期", prop: "followupDate", type: "date" }, { label: "联系电话", prop: "telcode" }, { label: "诊断日期", prop: "diagnosisDate", type: "date" }, { label: "建档日期", prop: "createTime", type: "date" }, { label: "出生孕周", prop: "gestationalWeek" }, { label: "性别", prop: "sex", type: "sex" }, { label: "出生日期", prop: "birthday", type: "date" }, { label: "出生体重", prop: "birthWeight" }, { label: "高危儿分类", prop: "highRiskCategory" }, { label: "高危儿名称", prop: "highRiskName" }, { label: "登记人员", prop: "registrant" }, ], }, { key: "nutrition", category: "child", entryLabel: "营养性疾病", label: "营养性疾病", subTypeLabel: "营养性疾病专案管理", route: "/filing/nutrition", detailRoute: "/filing/childDetail", columns: [ { label: "儿童姓名", prop: "patname" }, { label: "家长姓名", prop: "parentInfo.parentName" }, { label: "出生日期", prop: "birthday", type: "date" }, { label: "联系电话", prop: "telcode" }, { label: "诊断日期", prop: "diagnosisDate", type: "date" }, { label: "建档日期", prop: "createTime", type: "date" }, { label: "出生孕周", prop: "gestationalWeek" }, { label: "性别", prop: "sex", type: "sex" }, { label: "出生体重", prop: "birthWeight" }, { label: "营养性疾病名称", prop: "nutritionName" }, { label: "登记人员", prop: "registrant" }, ], }, { key: "learning", category: "child", entryLabel: "学习困难", label: "学习困难", subTypeLabel: "学习困难专案管理", route: "/filing/learning", detailRoute: "/filing/childDetail", columns: [ { label: "儿童姓名", prop: "patname" }, { label: "家长姓名", prop: "parentInfo.parentName" }, { label: "出生日期", prop: "birthday", type: "date" }, { label: "联系电话", prop: "telcode" }, { label: "诊断日期", prop: "diagnosisDate", type: "date" }, { label: "建档日期", prop: "createTime", type: "date" }, { label: "性别", prop: "sex", type: "sex" }, { label: "预约情况", prop: "appointmentStatus" }, ], }, ]; export function getTypeByKey(key) { return ARCHIVE_TYPES.find((t) => t.key === key); } // 读取 localStorage 档案列表 export function loadArchives() { try { return JSON.parse(localStorage.getItem("patientArchives") || "[]"); } catch (e) { return []; } } export function saveArchives(list) { localStorage.setItem("patientArchives", JSON.stringify(list)); } // 由一条患者记录(门诊/住院/独立录入)生成某专案的档案草稿 export function buildArchiveRecord(patient, typeKey, sourcePage) { const type = getTypeByKey(typeKey); const now = new Date().toISOString().replace("T", " ").substring(0, 19); const patid = patient.patid || patient.id || "sa_" + Date.now(); return { id: "arc_" + Date.now() + "_" + Math.random().toString(36).substr(2, 6), patientId: patid, patid: patid, patname: patient.patname || patient.name || "", sex: patient.sex, age: patient.age, telcode: patient.telcode || patient.phone || "", deptname: patient.deptname || "", diagname: patient.diagname || "", outhospno: patient.outhospno || "", inhospno: patient.inhospno || "", bedNo: patient.bedNo || "", drname: patient.drname || "", nurseName: patient.nurseName || "", starttime: patient.starttime || patient.admitdate || "", mainCategory: type.category, mainCategoryLabel: type.category === "child" ? "儿保科建档" : "妇保科建档", subType: type.key, subTypeLabel: type.subTypeLabel, archiveForm: { doctorName: "" }, parentInfo: {}, sourcePage: sourcePage || "outpatient", status: "active", closeStatus: 0, // 列表页新增字段 idcardno: patient.idcardno || "", birthday: patient.birthday || patient.goday || "", birthWeight: "", gestationalWeek: "", diagnosisDate: patient.diagnosisDate || patient.admitdate || "", attendingDoctor: patient.drname || "", managingDoctor: "", registrant: localStorage.getItem("YongHuXM") || "", pregnancyStatus: "", followupCycles: "", highRiskCategory: "", highRiskName: "", nutritionName: "", appointmentStatus: "", followupDate: "", createTime: now, updateTime: now, }; }