From 435852a09d214a06a1dc86d95a17278f093619ed Mon Sep 17 00:00:00 2001 From: lik Date: Wed, 7 Oct 2026 14:55:37 +0800 Subject: [PATCH] tmp --- pages/order/orderEdit.js | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/pages/order/orderEdit.js b/pages/order/orderEdit.js index 2bcb927..5be4462 100644 --- a/pages/order/orderEdit.js +++ b/pages/order/orderEdit.js @@ -148,29 +148,33 @@ Page({ } const order = res.data.record this.profileId = order.healthProfileId || null - // 患者信息取自订单快照(作为无关联档案时的回退) + // 患者信息取自订单快照(作为无关联档案时的回退),字段与 schema 一一对应 const p = order.patient || {} this.patientInfo = { name: p.name || '', mobile: p.mobile || '', - sex: p.sex || '', birth: p.birth || '', + weight: p.weight || 0, + height: p.height || 0, idnumber: p.idnumber || '' } + if (p.sex) { + this.patientInfo.sex = p.sex + } const sexLabel = p.sex === 'male' ? '男' : (p.sex === 'female' ? '女' : '') const age = calcAge(p.birth) this.setData({ // 有关联档案时交由 patient-info 按 ID 加载(不读缓存,以档案最新数据为准) profileId: order.healthProfileId || '', + // 无关联档案时用订单 patient 快照兜底展示姓名/性别/年龄/电话; + // 血型、身高、体重、备注不属于 escort_record(schema 无 health 块), + // 有关联档案时由 patient-info 按 profileId 加载后经 onProfileLoaded 回填, + // 故这里不再读 order.health(该块恒为空,属死代码) profileSummary: { name: p.name || '', mobile: p.mobile || '', sexLabel, - ageText: age ? `${age}岁` : '', - bloodType: (order.health && order.health.bloodType) || '', - height: (order.health && order.health.height) || '', - weight: (order.health && order.health.weight) || '', - remark: (order.health && order.health.remark) || '' + ageText: age ? `${age}岁` : '' }, form: { hospital: { @@ -217,19 +221,26 @@ Page({ onProfileLoaded(e) { const profile = e.detail.profile || {} const p = profile.profile || {} + const h = profile.health || {} + // 订单 patient 快照:与 escort_record schema 的 patient 字段一一对应。 + // sex 是 male/female 枚举,空串会校验失败,为空时不写该字段 this.patientInfo = { name: p.name || '', mobile: p.mobile || '', - sex: p.sex || '', birth: p.birth || '', + weight: h.weight || 0, + height: h.height || 0, idnumber: p.idnumber || '' } + if (p.sex) { + this.patientInfo.sex = p.sex + } this.setData({ profileSummary: { - bloodType: (profile.health && profile.health.bloodType) || '', - height: (profile.health && profile.health.height) || '', - weight: (profile.health && profile.health.weight) || '', - remark: (profile.health && profile.health.remark) || '' + bloodType: h.bloodType || '', + height: h.height || '', + weight: h.weight || '', + remark: h.remark || '' } }) },