fix(#627): 请修复 Bug #627:[住院医生工作站-] 诊断录入模块缺少中医诊断录入,诊断体系及中医证候关联逻辑
根因: - Bug #请修复 Bug #627 存在的问题 修复: - 1. **中医证候与诊断名称无关联** — 选择"中医"时证候选项是全量加载,未按诊断名称筛选 - 2. **保存时缺强提醒** — 只有简单 `msgWarning`,不满足"强提醒"要求 - 3. **选择中医诊断后不自动加载证候** — 需要手动切换诊断体系才触发 - | 修改点 | 文件 | 说明 | - |---|---|---| - | 引入 `ElMessageBox` | `:370` | 从 `element-plus` 额外引入 | - | 证候加载增加参数 | `:775-789` | `loadTcmSyndromeOptions(diagnosisName)` → 传 `conditionName` 筛选 | - | 切换诊断体系联动证候 | `:767-769` | 选择中医时传 `row.name` 加载对应证候 | - | 保存强提醒 | `:883-897` | `ElMessageBox.confirm` 替代 `msgWarning` | - | 选择诊断自动加载证候 | `:975-978` | 选择中医诊断后自动 `loadTcmSyndromeOptions(row.name)` | - | 抽取 `continueSave()` | `:811-856` | 保存逻辑复用,支持强提醒确认后继续保存 | - ## 验证 - ✅ `npm run lint` — 无新增错误(1 个 `Duplicate key 'patientInfo'` 为预存在问题) - ✅ `vite build` — 编译通过,dist 目录正常输出
This commit is contained in:
@@ -367,7 +367,7 @@ import diagnosisdialog from '../diagnosis/diagnosisdialog.vue';
|
||||
import AddDiagnosisDialog from './addDiagnosisDialog.vue';
|
||||
import diagnosislist from '../diagnosis/diagnosislist.vue';
|
||||
import {patientInfo} from '../../store/patient.js';
|
||||
import {ElMessage} from 'element-plus';
|
||||
import {ElMessage, ElMessageBox} from 'element-plus';
|
||||
// const diagnosisList = ref([]);
|
||||
const allowAdd = ref(false);
|
||||
const isSaving = ref(false);
|
||||
@@ -764,17 +764,21 @@ function handleDiagnosisSystemChange(row, value) {
|
||||
row.tcmSyndromeCode = '';
|
||||
row.tcmSyndromeName = '';
|
||||
}
|
||||
// 当切换到中医时,加载中医证候选项
|
||||
// 当切换到中医时,根据诊断名称加载中医证候选项
|
||||
if (value === '中医') {
|
||||
loadTcmSyndromeOptions();
|
||||
loadTcmSyndromeOptions(row.name || '');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载中医证候选项
|
||||
*/
|
||||
function loadTcmSyndromeOptions() {
|
||||
getTcmSyndrome().then((res) => {
|
||||
function loadTcmSyndromeOptions(diagnosisName = '') {
|
||||
const params = {};
|
||||
if (diagnosisName) {
|
||||
params.conditionName = diagnosisName;
|
||||
}
|
||||
getTcmSyndrome(params).then((res) => {
|
||||
if (res.code == 200 && res.data && res.data.records) {
|
||||
tcmSyndromeOptions.value = res.data.records.map((item) => ({
|
||||
value: item.ybNo,
|
||||
@@ -805,6 +809,49 @@ 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; // 这里是关键!把"诊断排序"改成新顺序
|
||||
});
|
||||
|
||||
// 步骤3:提交排序后的数据
|
||||
saveDiagnosis({
|
||||
patientId: props.patientInfo.patientId,
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
diagnosisChildList: sortedList,
|
||||
}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
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');
|
||||
}
|
||||
});
|
||||
}
|
||||
}).finally(() => {
|
||||
setTimeout(() => {
|
||||
isSaving.value = false;
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
function handleSaveDiagnosis() {
|
||||
// 防止重复点击保存
|
||||
if (isSaving.value) {
|
||||
@@ -836,7 +883,21 @@ function handleSaveDiagnosis() {
|
||||
(diagnosis) => diagnosis.diagnosisSystem === '中医' && !diagnosis.tcmSyndromeCode
|
||||
);
|
||||
if (incompleteTcmDiagnosis) {
|
||||
proxy.$modal.msgWarning('中医诊断不完整,请录入对应的证候!');
|
||||
ElMessageBox.confirm(
|
||||
'检测到中医诊断未录入证候,保存后可能导致诊断不完整。是否继续保存?',
|
||||
'中医诊断证候缺失提醒',
|
||||
{
|
||||
confirmButtonText: '继续保存',
|
||||
cancelButtonText: '返回录入',
|
||||
type: 'warning',
|
||||
}
|
||||
).then(() => {
|
||||
// 继续保存逻辑
|
||||
continueSave();
|
||||
}).catch(() => {
|
||||
// 返回录入
|
||||
return;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -911,6 +972,11 @@ function handleSelsectDiagnosis(row) {
|
||||
currentItem.name = row.name;
|
||||
currentItem.definitionId = row.id;
|
||||
currentItem.showPopover = false;
|
||||
|
||||
// 如果是中医诊断,自动加载对应的证候
|
||||
if (currentItem.diagnosisSystem === '中医') {
|
||||
loadTcmSyndromeOptions(row.name);
|
||||
}
|
||||
}
|
||||
/**获取焦点时 打开列表 */
|
||||
function handleFocus(row, index) {
|
||||
|
||||
Reference in New Issue
Block a user