fix(#628): 请修复 Bug #628:[住院医生工作站-] 诊断录入模块缺少中医诊断录入,诊断体系及中医证候关联逻辑
根因: - `diagnosis.vue`(活跃组件)虽然已有「诊断体系」和「中医证候」的 UI 列,但存在以下关键缺陷: - 1. **保存逻辑缺陷**:`handleSaveDiagnosis()` 和 `continueSave()` 将所有诊断(含中医)都通过 `saveDiagnosis()` 西医接口保存,中医诊断数据丢失 - 2. **`saveTcmDiagnosis` 未导入**:API 函数未在组件中引入,无法调用中医保存接口 - 3. **诊断体系切换无清理**:切换中/西医时未清空诊断名称,导致数据混淆 修复: - Bug #628 诊断录入中医支持 - | 修改点 | 文件 | 说明 | - |---|---|---| - | 导入 `saveTcmDiagnosis` | `diagnosis.vue:363` | 添加中医诊断保存 API 导入 | - | 分离保存逻辑 | `diagnosis.vue:820-878` `continueSave()` | 按 `diagnosisSystem` 分离西医/中医,分别调用 `saveDiagnosis()` 和 `saveTcmDiagnosis()` | - | 分离保存逻辑 | `diagnosis.vue:891-987` `handleSaveDiagnosis()` | 同上,主保存函数也做相同分离 | - | 切换清理 | `diagnosis.vue:762-780` `handleDiagnosisSystemChange()` | 切换体系时清空诊断名称、编码、证候 | - ### 全链路验证 - | 环节 | 状态 | 说明 | - |---|---|---| - | 📤 录入 | ✅ | 诊断体系下拉框默认西医,中医证候条件显示 | - | 📥 查询 | ✅ | `getList()` 并行加载西医+中医诊断 | - | 📥 回显 | ✅ | 证候选项按诊断名称关联加载 | - | 校验 | ✅ | 中医诊断无证候时拦截保存,提示"中医诊断不完整,请录入对应的证候!" |
This commit is contained in:
@@ -360,6 +360,7 @@ import {
|
||||
getTcmSyndrome,
|
||||
isFoodDiseasesNew,
|
||||
saveDiagnosis,
|
||||
saveTcmDiagnosis,
|
||||
deleteTcmDiagnosis,
|
||||
} from '../api';
|
||||
|
||||
@@ -759,13 +760,19 @@ function handleMaindise(value, index) {
|
||||
* 诊断体系变化处理
|
||||
*/
|
||||
function handleDiagnosisSystemChange(row, value) {
|
||||
// 当切换到西医时,清空中医证候
|
||||
// 切换诊断体系时,清空诊断名称及相关字段,避免中西医数据混淆
|
||||
row.name = '';
|
||||
row.ybNo = '';
|
||||
row.definitionId = '';
|
||||
row.showPopover = false;
|
||||
|
||||
if (value === '西医') {
|
||||
row.tcmSyndromeCode = '';
|
||||
row.tcmSyndromeName = '';
|
||||
}
|
||||
// 当切换到中医时,根据诊断名称加载中医证候选项
|
||||
if (value === '中医') {
|
||||
row.tcmSyndromeCode = '';
|
||||
row.tcmSyndromeName = '';
|
||||
loadTcmSyndromeOptions(row.definitionId || '');
|
||||
}
|
||||
}
|
||||
@@ -811,41 +818,70 @@ function handleTcmSyndromeChange(row, value) {
|
||||
*/
|
||||
|
||||
function continueSave() {
|
||||
// 设置保存标志,避免触发watch监听器
|
||||
isSaving.value = true;
|
||||
|
||||
// 步骤1:深拷贝并按 diagSrtNo 排序
|
||||
const sortedList = [...form.value.diagnosisList].sort((a, b) => {
|
||||
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
|
||||
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
|
||||
return aNo - bNo;
|
||||
});
|
||||
|
||||
// 步骤2:重新分配连续的序号(从1开始)
|
||||
sortedList.forEach((item, index) => {
|
||||
item.diagSrtNo = index + 1; // 这里是关键!把"诊断排序"改成新顺序
|
||||
item.diagSrtNo = index + 1;
|
||||
});
|
||||
|
||||
// 步骤3:提交排序后的数据
|
||||
saveDiagnosis({
|
||||
patientId: props.patientInfo.patientId,
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
diagnosisChildList: sortedList,
|
||||
}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
const westernList = sortedList.filter(item => item.diagnosisSystem !== '中医');
|
||||
const tcmList = sortedList.filter(item => item.diagnosisSystem === '中医');
|
||||
|
||||
const savePromises = [];
|
||||
|
||||
if (westernList.length > 0) {
|
||||
savePromises.push(
|
||||
saveDiagnosis({
|
||||
patientId: props.patientInfo.patientId,
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
diagnosisChildList: westernList,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (tcmList.length > 0) {
|
||||
const syndromeGroupNo = String(Date.now());
|
||||
const tcmSaveList = tcmList.map((item) => ({
|
||||
definitionId: item.definitionId || '',
|
||||
ybNo: item.ybNo,
|
||||
syndromeGroupNo: item.syndromeGroupNo || syndromeGroupNo,
|
||||
verificationStatusEnum: item.verificationStatusEnum || 4,
|
||||
medTypeCode: item.medTypeCode || undefined,
|
||||
tcmSyndromeCode: item.tcmSyndromeCode || '',
|
||||
tcmSyndromeName: item.tcmSyndromeName || '',
|
||||
}));
|
||||
savePromises.push(
|
||||
saveTcmDiagnosis({
|
||||
patientId: props.patientInfo.patientId,
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
diagnosisChildList: tcmSaveList,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
Promise.all(savePromises).then((results) => {
|
||||
const allSuccess = results.every(res => res.code === 200 || res.code == 200);
|
||||
if (allSuccess) {
|
||||
emits('diagnosisSave', false);
|
||||
proxy.$modal.msgSuccess('诊断已保存');
|
||||
|
||||
// 保存成功后从服务器重新加载数据,确保前后端数据一致
|
||||
getList();
|
||||
|
||||
// 食源性疾病逻辑
|
||||
isFoodDiseasesNew({ encounterId: props.patientInfo.encounterId }).then((res2) => {
|
||||
if (res2.code === 20 && res2.data) {
|
||||
window.open(res2.data, '_blank');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
proxy.$modal.msgWarning('部分诊断保存失败');
|
||||
getList();
|
||||
}
|
||||
}).catch(() => {
|
||||
proxy.$modal.msgError('诊断保存失败,请重试');
|
||||
}).finally(() => {
|
||||
setTimeout(() => {
|
||||
isSaving.value = false;
|
||||
@@ -853,7 +889,6 @@ function continueSave() {
|
||||
});
|
||||
}
|
||||
function handleSaveDiagnosis() {
|
||||
// 防止重复点击保存
|
||||
if (isSaving.value) {
|
||||
return;
|
||||
}
|
||||
@@ -887,41 +922,71 @@ function handleSaveDiagnosis() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置保存标志,避免触发watch监听器
|
||||
isSaving.value = true;
|
||||
|
||||
// 步骤1:深拷贝并按 diagSrtNo 排序
|
||||
const sortedList = [...form.value.diagnosisList].sort((a, b) => {
|
||||
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
|
||||
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
|
||||
return aNo - bNo;
|
||||
});
|
||||
|
||||
// 步骤2:重新分配连续的序号(从1开始)
|
||||
sortedList.forEach((item, index) => {
|
||||
item.diagSrtNo = index + 1; // 这里是关键!把”诊断排序”改成新顺序
|
||||
item.diagSrtNo = index + 1;
|
||||
});
|
||||
|
||||
// 步骤3:提交排序后的数据
|
||||
saveDiagnosis({
|
||||
patientId: props.patientInfo.patientId,
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
diagnosisChildList: sortedList,
|
||||
}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
// 分离西医和中医诊断,分别调用对应接口保存
|
||||
const westernList = sortedList.filter(item => item.diagnosisSystem !== '中医');
|
||||
const tcmList = sortedList.filter(item => item.diagnosisSystem === '中医');
|
||||
|
||||
const savePromises = [];
|
||||
|
||||
if (westernList.length > 0) {
|
||||
savePromises.push(
|
||||
saveDiagnosis({
|
||||
patientId: props.patientInfo.patientId,
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
diagnosisChildList: westernList,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (tcmList.length > 0) {
|
||||
const syndromeGroupNo = String(Date.now());
|
||||
const tcmSaveList = tcmList.map((item) => ({
|
||||
definitionId: item.definitionId || '',
|
||||
ybNo: item.ybNo,
|
||||
syndromeGroupNo: item.syndromeGroupNo || syndromeGroupNo,
|
||||
verificationStatusEnum: item.verificationStatusEnum || 4,
|
||||
medTypeCode: item.medTypeCode || undefined,
|
||||
tcmSyndromeCode: item.tcmSyndromeCode || '',
|
||||
tcmSyndromeName: item.tcmSyndromeName || '',
|
||||
}));
|
||||
savePromises.push(
|
||||
saveTcmDiagnosis({
|
||||
patientId: props.patientInfo.patientId,
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
diagnosisChildList: tcmSaveList,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
Promise.all(savePromises).then((results) => {
|
||||
const allSuccess = results.every(res => res.code === 200 || res.code == 200);
|
||||
if (allSuccess) {
|
||||
emits('diagnosisSave', false);
|
||||
proxy.$modal.msgSuccess('诊断已保存');
|
||||
|
||||
// 保存成功后从服务器重新加载数据,确保前后端数据一致
|
||||
getList();
|
||||
|
||||
// 食源性疾病逻辑
|
||||
isFoodDiseasesNew({ encounterId: props.patientInfo.encounterId }).then((res2) => {
|
||||
if (res2.code === 20 && res2.data) {
|
||||
window.open(res2.data, '_blank');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
proxy.$modal.msgWarning('部分诊断保存失败');
|
||||
getList();
|
||||
}
|
||||
}).catch(() => {
|
||||
proxy.$modal.msgError('诊断保存失败,请重试');
|
||||
}).finally(() => {
|
||||
setTimeout(() => {
|
||||
isSaving.value = false;
|
||||
|
||||
Reference in New Issue
Block a user