diff --git a/openhis-ui-vue3/src/views/doctorstation/index.vue b/openhis-ui-vue3/src/views/doctorstation/index.vue index 6a505c4f..3ee7cb9e 100644 --- a/openhis-ui-vue3/src/views/doctorstation/index.vue +++ b/openhis-ui-vue3/src/views/doctorstation/index.vue @@ -313,16 +313,6 @@ function checkPatientHistory(patient) { return; } - // // 如果当前就诊已经有明确的初复诊标识,则使用该标识 - // if (patient.visitType) { - // visitType.value = patient.visitType; - // // 如果是已完诊的记录,禁用修改 - // if (patient.statusEnum && patient.statusEnum !== 2) { // 假设2是就诊中状态 - // visitTypeDisabled.value = true; - // } - // return; - // } - // 查询患者历史就诊记录 const params = { patientId: patient.patientId, @@ -332,14 +322,17 @@ function checkPatientHistory(patient) { getEmrHistoryList(params).then(res => { if (res.code === 200) { const records = res.data?.records || []; - // 如果有历史记录,则为复诊 - if (res.data && res.data.total > 0) { + // 过滤掉当前正在进行的就诊记录(排除相同encounterId的记录) + const historyRecords = records.filter(record => record.encounterId !== patient.encounterId); + + // 如果有历史记录(排除当前就诊),则为复诊 + if (historyRecords.length > 0) { visitType.value = 'FOLLOW_UP'; // 计算最早一次病历创建时间作为初诊日期 - const earliest = records.reduce((min, cur) => { + const earliest = historyRecords.reduce((min, cur) => { const ct = new Date(cur.createTime).getTime(); return ct < min ? ct : min; - }, new Date(records[0].createTime).getTime()); + }, new Date(historyRecords[0].createTime).getTime()); // 使用统一格式化 firstVisitDate.value = formatDate(earliest); } else { @@ -429,9 +422,9 @@ function handleCardClick(item, index) { // 已完诊的记录禁用修改 visitTypeDisabled.value = item.statusEnum !== 2; // 如果有初诊日期也从数据库获取 - if (item.firstVisitDate) { - firstVisitDate.value = item.firstVisitDate; - } + // if (item.firstVisitDate) { + // firstVisitDate.value = item.firstVisitDate; + // } } else { // 对于没有初复诊记录的患者,才使用原有的判断逻辑 checkPatientHistory(item);