diff --git a/healthlink-his-ui/src/views/doctorstation/components/diagnosis/addDiagnosisDialog.vue b/healthlink-his-ui/src/views/doctorstation/components/diagnosis/addDiagnosisDialog.vue index ed4eafc8e..20f2551f8 100755 --- a/healthlink-his-ui/src/views/doctorstation/components/diagnosis/addDiagnosisDialog.vue +++ b/healthlink-his-ui/src/views/doctorstation/components/diagnosis/addDiagnosisDialog.vue @@ -138,6 +138,8 @@ import { getTcmDiagnosis, } from '@/views/doctorstation/components/api'; import { DIAG_TYPE } from '@/utils/medicalConstants'; +import { formatDateStr } from '@/utils'; +import useUserStore from '@/store/modules/user'; const props = defineProps({ openAddDiagnosisDialog: { @@ -168,6 +170,7 @@ const timestamp = ref(''); const selectedDisease = ref(false); const { proxy } = getCurrentInstance(); const emit = defineEmits(['close']); +const userStore = useUserStore(); // 请求序列号,防止异步回调竞态导致数据重复 let openSeq = 0; @@ -321,7 +324,10 @@ function handleClickRow({ row }) { syndromeGroupNo: timestamp.value, verificationStatusEnum: 4, medTypeCode: DIAG_TYPE.TCM_MAIN_DISEASE, // 诊断类型:中医主病诊断 (值:2) - isExisting: false // 标记为新增 + isExisting: false, // 标记为新增 + onsetDate: getCurrentDate(), // 发病日期 + diagnosisTime: getCurrentDate(), // 诊断日期 + diagnosisDoctor: getDoctorName(), // 诊断医生 }); tcmDiagonsisList.value.push({ conditionName: row.name, @@ -351,7 +357,10 @@ function clickSyndromeRow({ row }) { ybNo: row.ybNo, syndromeGroupNo: timestamp.value, medTypeCode: DIAG_TYPE.TCM_MAIN_SYNDROME, // 诊断类型:中医主证诊断 (值:3) - isExisting: false // 标记为新增 + isExisting: false, // 标记为新增 + onsetDate: getCurrentDate(), // 发病日期 + diagnosisTime: getCurrentDate(), // 诊断日期 + diagnosisDoctor: getDoctorName(), // 诊断医生 }); tcmDiagonsisList.value[tcmDiagonsisList.value.length - 1].syndromeName = row.name; syndromeSelected.value = true; @@ -378,13 +387,20 @@ function save() { return; } + // 格式化日期为后端期望的 yyyy/M/d HH:mm:ss 格式 + const formattedList = newDiagnosisList.map(item => ({ + ...item, + onsetDate: item.onsetDate ? formatDateStr(item.onsetDate, 'YYYY/M/D HH:mm:ss') : null, + diagnosisTime: item.diagnosisTime ? formatDateStr(item.diagnosisTime, 'YYYY/M/D HH:mm:ss') : null, + })); + if (props.updateZy.length > 0) { // 修改模式 console.log('[addDiagnosisDialog] 调用 updateTcmDiagnosis'); updateTcmDiagnosis({ patientId: props.patientInfo.patientId, encounterId: props.patientInfo.encounterId, - diagnosisChildList: newDiagnosisList, + diagnosisChildList: formattedList, }).then((res) => { console.log('[addDiagnosisDialog] updateTcmDiagnosis 响应, code=', res.code); if (res.code == 200) { @@ -398,7 +414,7 @@ function save() { saveTcmDiagnosis({ patientId: props.patientInfo.patientId, encounterId: props.patientInfo.encounterId, - diagnosisChildList: newDiagnosisList, + diagnosisChildList: formattedList, }).then((res) => { console.log('[addDiagnosisDialog] saveTcmDiagnosis 响应, code=', res.code); if (res.code == 200) { @@ -431,6 +447,24 @@ function close() { console.log('[addDiagnosisDialog] close() 触发 (弹窗@close事件)'); emit('close'); } + +function getCurrentDate() { + const date = new Date(); + const year = date.getFullYear(); + let month = date.getMonth() + 1; + let day = date.getDate(); + month = month < 10 ? "0" + month : month; + day = day < 10 ? "0" + day : day; + return `${year}-${month}-${day}`; +} + +function getDoctorName() { + return props.patientInfo?.practitionerName + || props.patientInfo?.doctorName + || props.patientInfo?.physicianName + || userStore?.name + || ''; +}