diff --git a/src/views/user/User.vue b/src/views/user/User.vue index 0050f7a..348b799 100644 --- a/src/views/user/User.vue +++ b/src/views/user/User.vue @@ -250,6 +250,57 @@ const deleteByIdsUser = () => { ElMessage.info('取消删除'); }); } + +// 获取用户病历信息 +const getUserRecord = async (id) => { + try { + const response = await axiosInstance.get(`/user/${id}/record`); + console.log(response.data); + if (response.data) { + console.log(response.data); + const medicalRecordInfo = response.data; + showMedicalRecordInfo(medicalRecordInfo); + } else { + ElMessage.error('没有病历信息可供显示'); + } + } catch (error) { + const errorMessage = error.response && error.response.data ? error.response.data.message : error.message; + ElMessage.error(errorMessage); + } +}; +const showMedicalRecordInfo = (record) => { + if (!record) { + console.error('No record provided'); + return; + } + + // 格式化信息字符串 + const info = ` + 体检信息:
+ 体检ID:${record.checkupId}
+ 主档案ID:${record.id}
+ 体重状态:${record.weightStatus}
+ 血型:${record.bloodType}
+ 慢性病:${record.chronicDiseases || '无'}
+ 身高:${record.height} cm
+ 体重:${record.weight} kg
+ 心率:${record.heartRate} 次/分钟
+ 体温:${record.temperature} °C
+ 血氧饱和度:${record.oxygenSaturation}%
+ 血压:${record.bloodPressure}
+ 血糖水平:${record.glucoseLevel} mmol/L
+ 脉搏:${record.pulse} 次/分钟
+ 体检日期:${record.checkupDate}
+ `; + + // 显示信息 + ElMessageBox.alert(info, '病历信息', { + confirmButtonText: '确定', + dangerouslyUseHTMLString: true, // 允许HTML字符串 + // 不需要 callback,因为弹窗会自动关闭 + }); +}; + const getUserTreatment = async (id) => { try { const response = await axiosInstance.get(`/user/${id}/treatment`); @@ -312,7 +363,8 @@ const showTreatmentInfo = (info) => {