fix(mobile): 修复患者详情数据提取 - 兼容多种API返回格式
This commit is contained in:
@@ -83,16 +83,28 @@ onMounted(async () => {
|
|||||||
const id = route.params.id
|
const id = route.params.id
|
||||||
const encounterId = route.query.encounterId
|
const encounterId = route.query.encounterId
|
||||||
try {
|
try {
|
||||||
const [pRes, oRes, vRes, aRes] = await Promise.allSettled([
|
const pRes = await nursingApi.getPatientInfo(id)
|
||||||
nursingApi.getPatientInfo(id),
|
if (pRes?.code === 200 && pRes.data) {
|
||||||
encounterId ? nursingApi.getOrders(encounterId) : Promise.resolve({ data: [] }),
|
const d = pRes.data
|
||||||
nursingApi.getVitalSigns(id),
|
patient.value = {
|
||||||
encounterId ? nursingApi.getAssessments(encounterId) : Promise.resolve({ data: [] })
|
patientName: d.patientName || d.name || d.patient?.name || '',
|
||||||
])
|
bedNo: d.bedNo || d.locationName || d.patient?.bedNo || '',
|
||||||
if (pRes.status === 'fulfilled') patient.value = pRes.value?.data || {}
|
gender: d.gender || d.patient?.gender || '',
|
||||||
if (oRes.status === 'fulfilled') orders.value = oRes.value?.data?.records || oRes.value?.data || []
|
age: d.age || d.patient?.age || '',
|
||||||
if (vRes.status === 'fulfilled') vitals.value = vRes.value?.data?.records || vRes.value?.data || []
|
primaryDiagnosisName: d.primaryDiagnosisName || d.diagnosis || d.patient?.diagnosis || '',
|
||||||
if (aRes.status === 'fulfilled') assessments.value = aRes.value?.data?.records || aRes.value?.data || []
|
encounterId: d.encounterId || encounterId || ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (encounterId) {
|
||||||
|
const [oRes, vRes, aRes] = await Promise.allSettled([
|
||||||
|
nursingApi.getOrders(encounterId),
|
||||||
|
nursingApi.getVitalSigns(id),
|
||||||
|
nursingApi.getAssessments(encounterId)
|
||||||
|
])
|
||||||
|
if (oRes.status === 'fulfilled') orders.value = oRes.value?.data?.records || oRes.value?.data || []
|
||||||
|
if (vRes.status === 'fulfilled') vitals.value = vRes.value?.data?.records || vRes.value?.data || []
|
||||||
|
if (aRes.status === 'fulfilled') assessments.value = aRes.value?.data?.records || aRes.value?.data || []
|
||||||
|
}
|
||||||
} catch (e) { console.error('加载失败:', e) }
|
} catch (e) { console.error('加载失败:', e) }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user