This commit is contained in:
lik
2026-10-07 14:55:37 +08:00
parent 9c3e514560
commit 435852a09d
+23 -12
View File
@@ -148,29 +148,33 @@ Page({
} }
const order = res.data.record const order = res.data.record
this.profileId = order.healthProfileId || null this.profileId = order.healthProfileId || null
// 患者信息取自订单快照(作为无关联档案时的回退) // 患者信息取自订单快照(作为无关联档案时的回退),字段与 schema 一一对应
const p = order.patient || {} const p = order.patient || {}
this.patientInfo = { this.patientInfo = {
name: p.name || '', name: p.name || '',
mobile: p.mobile || '', mobile: p.mobile || '',
sex: p.sex || '',
birth: p.birth || '', birth: p.birth || '',
weight: p.weight || 0,
height: p.height || 0,
idnumber: p.idnumber || '' idnumber: p.idnumber || ''
} }
if (p.sex) {
this.patientInfo.sex = p.sex
}
const sexLabel = p.sex === 'male' ? '男' : (p.sex === 'female' ? '女' : '') const sexLabel = p.sex === 'male' ? '男' : (p.sex === 'female' ? '女' : '')
const age = calcAge(p.birth) const age = calcAge(p.birth)
this.setData({ this.setData({
// 有关联档案时交由 patient-info 按 ID 加载(不读缓存,以档案最新数据为准) // 有关联档案时交由 patient-info 按 ID 加载(不读缓存,以档案最新数据为准)
profileId: order.healthProfileId || '', profileId: order.healthProfileId || '',
// 无关联档案时用订单 patient 快照兜底展示姓名/性别/年龄/电话;
// 血型、身高、体重、备注不属于 escort_record(schema 无 health 块),
// 有关联档案时由 patient-info 按 profileId 加载后经 onProfileLoaded 回填,
// 故这里不再读 order.health(该块恒为空,属死代码)
profileSummary: { profileSummary: {
name: p.name || '', name: p.name || '',
mobile: p.mobile || '', mobile: p.mobile || '',
sexLabel, sexLabel,
ageText: age ? `${age}岁` : '', 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) || ''
}, },
form: { form: {
hospital: { hospital: {
@@ -217,19 +221,26 @@ Page({
onProfileLoaded(e) { onProfileLoaded(e) {
const profile = e.detail.profile || {} const profile = e.detail.profile || {}
const p = profile.profile || {} const p = profile.profile || {}
const h = profile.health || {}
// 订单 patient 快照:与 escort_record schema 的 patient 字段一一对应。
// sex 是 male/female 枚举,空串会校验失败,为空时不写该字段
this.patientInfo = { this.patientInfo = {
name: p.name || '', name: p.name || '',
mobile: p.mobile || '', mobile: p.mobile || '',
sex: p.sex || '',
birth: p.birth || '', birth: p.birth || '',
weight: h.weight || 0,
height: h.height || 0,
idnumber: p.idnumber || '' idnumber: p.idnumber || ''
} }
if (p.sex) {
this.patientInfo.sex = p.sex
}
this.setData({ this.setData({
profileSummary: { profileSummary: {
bloodType: (profile.health && profile.health.bloodType) || '', bloodType: h.bloodType || '',
height: (profile.health && profile.health.height) || '', height: h.height || '',
weight: (profile.health && profile.health.weight) || '', weight: h.weight || '',
remark: (profile.health && profile.health.remark) || '' remark: h.remark || ''
} }
}) })
}, },