diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/diagnosis/diagnosis.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/diagnosis/diagnosis.vue
index 062d459ab..a214bd65d 100755
--- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/diagnosis/diagnosis.vue
+++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/diagnosis/diagnosis.vue
@@ -905,19 +905,22 @@ function handleChange(value) {
* 选择诊断并赋值到列表
*/
function handleSelsectDiagnosis(row) {
- console.log(row);
- form.value.diagnosisList[rowIndex.value].ybNo = row.ybNo;
- form.value.diagnosisList[rowIndex.value].name = row.name;
- form.value.diagnosisList[rowIndex.value].definitionId = row.id;
+ const currentItem = form.value.diagnosisList[rowIndex.value];
+ currentItem.ybNo = row.ybNo;
+ currentItem.name = row.name;
+ currentItem.definitionId = row.id;
+ currentItem.showPopover = false;
}
/**获取焦点时 打开列表 */
function handleFocus(row, index) {
rowIndex.value = index;
row.showPopover = true;
}
-/**失去焦点时 关闭列表 */
+/**失去焦点时 延迟关闭列表(避免点击列表项时过早关闭) */
function handleBlur(row) {
- row.showPopover = false;
+ setTimeout(() => {
+ row.showPopover = false;
+ }, 200);
}
function handleNodeClick(data) {
diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/diagnosis/index.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/diagnosis/index.vue
index 993f1c750..3375e5b13 100755
--- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/diagnosis/index.vue
+++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/diagnosis/index.vue
@@ -141,6 +141,7 @@
handleSelectDiagnosis(row, scope.row, scope.$index)"
/>
@@ -300,11 +301,14 @@ import { ArrowDown, Delete, Download, Upload } from '@element-plus/icons-vue'
import WesternMedicineDialog from './westernMedicineDialog.vue'
import ChineseMedicineDialog from './chineseMedicineDialog.vue'
import Diagnosislist from './diagnosislist.vue'
+import useUserStore from '@/store/modules/user'
import {
saveDiagnosis,
delEncounterDiagnosis,
getEncounterDiagnosis,
getTcmSyndrome,
+ saveTcmDiagnosis,
+ getTcmDiagnosis,
} from '../api'
const { proxy } = getCurrentInstance()
@@ -390,16 +394,12 @@ function handleDiagnosisSystemChange(row) {
}
function handleDiagnosisNameClick(row, index) {
- if (row.diagnosisSystem === '中医') {
- row.showPopover = false
- return
- }
diagnoseData.value.forEach((item, idx) => {
if (idx !== index) {
item.showPopover = false
}
})
- row.showPopover = true
+ row.showPopover = !row.showPopover
}
function handleSelectDiagnosis(diagRow, rowData) {
@@ -509,6 +509,8 @@ async function handleSaveDiagnosis() {
return
}
+ const userStore = useUserStore()
+
for (let i = 0; i < diagnoseData.value.length; i++) {
const item = diagnoseData.value[i]
if (!item.name) {
@@ -523,36 +525,63 @@ async function handleSaveDiagnosis() {
saveLoading.value = true
try {
- const diagnosisList = diagnoseData.value.map((item, index) => ({
- conditionId: item.conditionId || '',
- ybNo: item.ybNo || '',
- name: item.name,
- definitionId: item.definitionId || '',
- classification: item.classification || '主诊断',
- diagnosisSystem: item.diagnosisSystem || '西医',
- tcmSyndromeCode: item.tcmSyndromeCode || '',
- tcmSyndromeName: item.tcmSyndromeName || '',
- admissionCondition: item.admissionCondition || '',
- outcome: item.outcome || '',
- outcomeDate: item.outcomeDate || '',
- diagnosisDoctor: item.diagnosisDoctor || '',
- diagnosisTime: item.diagnosisTime || getCurrentDate(),
- diagSrtNo: index + 1,
- }))
+ // 分离西医和中医诊断
+ const westernList = []
+ const tcmList = []
- const saveData = {
- patientId: props.patientInfo?.patientId || '',
- encounterId: props.patientInfo?.encounterId || '',
- diagnosisList: diagnosisList,
+ diagnoseData.value.forEach((item, index) => {
+ if (item.diagnosisSystem === '中医') {
+ tcmList.push(item)
+ } else {
+ westernList.push({
+ conditionId: item.conditionId || '',
+ ybNo: item.ybNo || '',
+ name: item.name,
+ definitionId: item.definitionId || '',
+ classification: item.classification || '主诊断',
+ diagnosisSystem: '西医',
+ admissionCondition: item.admissionCondition || '',
+ outcome: item.outcome || '',
+ outcomeDate: item.outcomeDate || '',
+ diagnosisDoctor: item.diagnosisDoctor || '',
+ diagnosisTime: item.diagnosisTime || getCurrentDate(),
+ diagSrtNo: index + 1,
+ })
+ }
+ })
+
+ // 保存西医诊断
+ if (westernList.length > 0) {
+ const westernData = {
+ patientId: props.patientInfo?.patientId || '',
+ encounterId: props.patientInfo?.encounterId || '',
+ diagnosisChildList: westernList,
+ }
+ await saveDiagnosis(westernData)
}
- const res = await saveDiagnosis(saveData)
- if (res.code === 200) {
- ElMessage.success('诊断保存成功')
- loadDiagnosisData()
- } else {
- ElMessage.error(res.msg || '保存失败')
+ // 保存中医诊断(通过中医专用接口)
+ if (tcmList.length > 0) {
+ const syndromeGroupNo = String(Date.now())
+ const tcmSaveList = []
+ tcmList.forEach((item) => {
+ tcmSaveList.push({
+ definitionId: item.definitionId || '',
+ ybNo: item.ybNo,
+ syndromeGroupNo: syndromeGroupNo,
+ verificationStatusEnum: item.verificationStatusEnum || 4,
+ medTypeCode: item.medTypeCode || undefined,
+ })
+ })
+ await saveTcmDiagnosis({
+ patientId: props.patientInfo?.patientId || '',
+ encounterId: props.patientInfo?.encounterId || '',
+ diagnosisChildList: tcmSaveList,
+ })
}
+
+ ElMessage.success('诊断保存成功')
+ loadDiagnosisData()
} catch (error) {
ElMessage.error('保存失败,请重试')
} finally {
@@ -562,20 +591,70 @@ async function handleSaveDiagnosis() {
function loadDiagnosisData() {
if (!props.patientInfo?.encounterId) return
- getEncounterDiagnosis(props.patientInfo.encounterId).then((res) => {
- if (res.data) {
- const westernDiagnoses = (res.data || []).filter(item => item.typeName !== '中医诊断')
- diagnoseData.value = westernDiagnoses.map((item, index) => ({
- ...item,
- diagnosisSystem: item.diagnosisSystem || '西医',
- classification: item.classification || '主诊断',
- tcmSyndromeCode: item.tcmSyndromeCode || '',
- tcmSyndromeName: item.tcmSyndromeName || '',
- showPopover: false,
- showSyndromePopover: false,
- diagSrtNo: index + 1,
- }))
+
+ const userStore = useUserStore()
+
+ // 并行加载西医诊断和中医诊断
+ const westernPromise = getEncounterDiagnosis(props.patientInfo.encounterId)
+ const tcmPromise = getTcmDiagnosis({ encounterId: props.patientInfo.encounterId })
+
+ Promise.all([westernPromise, tcmPromise]).then(([westernRes, tcmRes]) => {
+ const allDiagnoses = []
+
+ // 西医诊断
+ if (westernRes && westernRes.data) {
+ westernRes.data.forEach((item) => {
+ allDiagnoses.push({
+ ...item,
+ diagnosisSystem: '西医',
+ classification: item.classification || '主诊断',
+ tcmSyndromeCode: '',
+ tcmSyndromeName: '',
+ showPopover: false,
+ showSyndromePopover: false,
+ })
+ })
}
+
+ // 中医诊断(从 getTcmDiagnosis 获取)
+ if (tcmRes && tcmRes.code === 200 && tcmRes.data) {
+ const illnesses = tcmRes.data.illness || []
+ const symptoms = tcmRes.data.symptom || []
+ illnesses.forEach((item, index) => {
+ allDiagnoses.push({
+ name: item.name,
+ ybNo: item.ybNo,
+ definitionId: item.illnessDefinitionId || item.definitionId || '',
+ medTypeCode: item.medTypeCode || undefined,
+ verificationStatusEnum: item.verificationStatusEnum || 4,
+ diagnosisSystem: '中医',
+ classification: '主诊断',
+ tcmSyndromeCode: symptoms[index]?.ybNo || '',
+ tcmSyndromeName: symptoms[index]?.name || '',
+ syndromeGroupNo: item.syndromeGroupNo || '',
+ conditionId: item.conditionId || '',
+ diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
+ diagnosisTime: item.diagnosisTime || new Date().toLocaleString('zh-CN'),
+ showPopover: false,
+ showSyndromePopover: false,
+ _isTcm: true,
+ })
+ })
+ }
+
+ // 按 diagSrtNo 排序
+ allDiagnoses.sort((a, b) => {
+ const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999
+ const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999
+ return aNo - bNo
+ })
+
+ // 重新编号
+ allDiagnoses.forEach((item, index) => {
+ item.diagSrtNo = index + 1
+ })
+
+ diagnoseData.value = allDiagnoses
})
}