fix(#628): 请修复 Bug #628:[住院医生工作站-] 诊断录入模块缺少中医诊断录入,诊断体系及中医证候关联逻辑

根因:
- 诊断录入模块(`diagnosis.vue`)缺少中医诊断支持,包括诊断体系字段、中医证候字段和相关业务逻辑。

修复:
- 文件:** `src/views/inpatientDoctor/home/components/diagnosis/diagnosis.vue`
- 1. **新增诊断体系下拉框**(诊断类别列前)
- 选项:西医、中医
- 默认值:西医
- 2. **新增中医证候下拉框**(诊断医生列后)
- 仅当诊断体系选择"中医"时显示
- 选项取值于中医证候目录
- 3. **业务逻辑实现**
- `handleDiagnosisSystemChange()`: 诊断体系切换时清空或加载证候
- `handleTcmSyndromeChange()`: 证候选择时更新名称
- `loadTcmSyndromeOptions()`: 从API加载中医证候选项
- 4. **保存校验**
- 中医诊断必须录入证候
- 校验失败弹出提示:"中医诊断不完整,请录入对应的证候!"
- 5. **数据初始化**
- 新增诊断默认诊断体系为"西医"
- 加载已有诊断时确保`diagnosisSystem`字段存在
- 中医诊断数据正确映射证候信息
- ### 全链路验证
-  录入:诊断体系和中医证候下拉框正常显示
-  保存:校验逻辑正确,数据包含新字段
-  查询:加载数据时正确映射诊断体系和证候
-  编译:`npm run build:prod` 通过
- ### 注意事项
- 后端API需支持`diagnosisSystem`和`tcmSyndromeCode`字段的保存和查询
- 已有的`addDiagnosisDialog.vue`和`chineseMedicineDialog.vue`组件保持不变
This commit is contained in:
2026-05-31 00:59:56 +08:00
parent 492a93513d
commit 59e450310f

View File

@@ -94,7 +94,7 @@
>
保存诊断
</el-button>
<!-- <el-button type="primary" plain @click="handleAddTcmDiagonsis()"> 中医诊断 </el-button> -->
<el-button type="primary" plain @click="handleAddTcmDiagonsis()"> 中医诊断 </el-button>
<el-button
type="primary"
plain
@@ -142,6 +142,34 @@
</el-form-item>
</template>
</el-table-column>
<el-table-column
label="诊断体系"
align="center"
prop="diagnosisSystem"
width="120"
>
<template #default="scope">
<el-form-item
:prop="`diagnosisList.${scope.$index}.diagnosisSystem`"
>
<el-select
v-model="scope.row.diagnosisSystem"
placeholder=" "
style="width: 100px"
@change="(value) => handleDiagnosisSystemChange(scope.row, value)"
>
<el-option
label="西医"
value="西医"
/>
<el-option
label="中医"
value="中医"
/>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column
label="诊断类别"
align="center"
@@ -209,6 +237,35 @@
prop="diagnosisDoctor"
width="120"
/>
<el-table-column
label="中医证候"
align="center"
prop="tcmSyndromeName"
width="150"
>
<template #default="scope">
<template v-if="scope.row.diagnosisSystem === '中医'">
<el-select
v-model="scope.row.tcmSyndromeCode"
placeholder="请选择证候"
filterable
clearable
style="width: 130px"
@change="(value) => handleTcmSyndromeChange(scope.row, value)"
>
<el-option
v-for="item in tcmSyndromeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template v-else>
<span style="color: #c0c4cc;">-</span>
</template>
</template>
</el-table-column>
<el-table-column
label="诊断时间"
align="center"
@@ -298,6 +355,7 @@ import {
getEmrDetail,
getEncounterDiagnosis,
getTcmDiagnosis,
getTcmSyndrome,
isFoodDiseasesNew,
saveDiagnosis,
} from '../api';
@@ -315,6 +373,7 @@ const openDiagnosis = ref(false);
const openAddDiagnosisDialog = ref(false);
const diagnosisSearchkey = ref('');
const diagnosisOptions = ref([]);
const tcmSyndromeOptions = ref([]);
const rowIndex = ref();
const diagnosis = ref();
const orgOrUser = ref();
@@ -406,6 +465,10 @@ function getList() {
if (obj.diagSrtNo == null) {
obj.diagSrtNo = '1';
}
// 确保 diagnosisSystem 字段存在,默认为西医
if (!obj.diagnosisSystem) {
obj.diagnosisSystem = '西医';
}
return obj;
});
form.value.diagnosisList = datas;
@@ -421,9 +484,12 @@ function getList() {
diagnosisNetDatas.value = res.data.illness;
res.data.illness.forEach((item, index) => {
newList.push({
name: item.name + '-' + (res.data.symptom[index]?.name || ''),
name: item.name,
ybNo: item.ybNo,
medTypeCode: item.medTypeCode,
diagnosisSystem: '中医',
tcmSyndromeCode: res.data.symptom[index]?.ybNo || '',
tcmSyndromeName: res.data.symptom[index]?.name || '',
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
diagnosisTime: new Date().toLocaleString('zh-CN')
});
@@ -595,6 +661,7 @@ function addDiagnosisItem() {
name: undefined,
verificationStatusEnum: 4,
medTypeCode: undefined,
diagnosisSystem: '西医',
diagSrtNo: form.value.diagnosisList.length + 1,
iptDiseTypeCode: 2,
diagnosisDesc: '',
@@ -675,6 +742,44 @@ function handleMaindise(value, index) {
}
}
/**
* 诊断体系变化处理
*/
function handleDiagnosisSystemChange(row, value) {
// 当切换到西医时,清空中医证候
if (value === '西医') {
row.tcmSyndromeCode = '';
row.tcmSyndromeName = '';
}
// 当切换到中医时,加载中医证候选项
if (value === '中医') {
loadTcmSyndromeOptions();
}
}
/**
* 加载中医证候选项
*/
function loadTcmSyndromeOptions() {
getTcmSyndrome().then((res) => {
if (res.code == 200 && res.data && res.data.records) {
tcmSyndromeOptions.value = res.data.records.map((item) => ({
value: item.ybNo,
label: item.name,
}));
}
});
}
/**
* 中医证候变化处理
*/
function handleTcmSyndromeChange(row, value) {
// 找到对应的证候名称
const syndrome = tcmSyndromeOptions.value.find(item => item.value === value);
row.tcmSyndromeName = syndrome ? syndrome.label : '';
}
/**
* 保存诊断
*/
@@ -713,6 +818,15 @@ function handleSaveDiagnosis() {
return;
}
// 中医诊断完整性校验
const incompleteTcmDiagnosis = form.value.diagnosisList.find(
(diagnosis) => diagnosis.diagnosisSystem === '中医' && !diagnosis.tcmSyndromeCode
);
if (incompleteTcmDiagnosis) {
proxy.$modal.msgWarning('中医诊断不完整,请录入对应的证候!');
return;
}
// 设置保存标志避免触发watch监听器
isSaving.value = true;
@@ -817,6 +931,7 @@ function handleNodeClick(data) {
name: data.name,
verificationStatusEnum: 4,
medTypeCode: undefined,
diagnosisSystem: '西医',
diagSrtNo: form.value.diagnosisList.length + 1,
definitionId: data.definitionId,
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,