fix(#573): 请修复 Bug #573:[一般] [门诊医生工作站-诊断] 确诊配置了“报卡类型”的疾病后,保存诊断未自动触发传染病报卡弹窗
根因: - 但后端其实已经准备好了:** - `getEncounterDiagnosis` 接口返回的每个诊断项包含了 `reportTypeCode`(报卡类型)和 `hasInfectiousReport`(是否已有报卡)字段 - 前端 `getList()` 获取数据后,这些字段已经挂载在 `form.value.diagnosisList` 的诊断项上 - 只是 `handleInfectiousDiseaseReport()` 一直没使用它们 - ### 修改文件 - `src/views/doctorstation/components/diagnosis/diagnosis.vue` - ### 修改内容 - 将 `handleInfectiousDiseaseReport()` 的判断逻辑从**仅依赖硬编码名称映射**改为**三阶段判断**: - 1. **精确名称匹配** — 优先匹配已有映射表中的疾病名(如"霍乱"→'0102') - 2. **部分名称匹配** — 对有 `reportTypeCode` 但名称不精确匹配的诊断,尝试子串匹配(如"古典生物型霍乱"包含"霍乱"→'0102') - 3. **`reportTypeCode` 兜底** — 配置了报卡类型但无法匹配任何已知疾病名,仍弹出弹窗(`diseaseCode = 'OTHER'`),让医生手动填写 - 同时保留原有规则: - 跳过已有已提交报卡的诊断(`hasInfectiousReport === 1`) 修复: - ### 问题分析
This commit is contained in:
@@ -919,13 +919,37 @@ function handleInfectiousDiseaseReport() {
|
||||
'手足口病': '0311',
|
||||
};
|
||||
|
||||
// 获取所有命中传染病映射的诊断,但跳过已有已提交报卡的诊断
|
||||
// 获取所有需要触发传染病报卡的诊断,但跳过已有已提交报卡的诊断
|
||||
// 判断依据:1) 硬编码名称匹配;2) 后端配置了 reportTypeCode(报卡类型)
|
||||
const infectiousDiagnoses = form.value.diagnosisList
|
||||
.map(d => ({
|
||||
diagnosis: d,
|
||||
diseaseCode: d.name && d.hasInfectiousReport !== 1 ? diseaseNameToCode[d.name] : null
|
||||
}))
|
||||
.filter(item => item.diseaseCode);
|
||||
.map(d => {
|
||||
// 跳过已有已提交报卡的诊断
|
||||
if (d.hasInfectiousReport === 1) return null;
|
||||
|
||||
let diseaseCode = null;
|
||||
|
||||
// 1. 尝试精确名称匹配
|
||||
if (d.name && diseaseNameToCode[d.name]) {
|
||||
diseaseCode = diseaseNameToCode[d.name];
|
||||
}
|
||||
// 2. 尝试部分名称匹配(如"古典生物型霍乱"包含"霍乱")
|
||||
else if (d.name && d.reportTypeCode) {
|
||||
const match = Object.entries(diseaseNameToCode).find(([name]) =>
|
||||
name && d.name.includes(name)
|
||||
);
|
||||
if (match) {
|
||||
diseaseCode = match[1];
|
||||
}
|
||||
}
|
||||
// 3. 配置了 reportTypeCode 但无名称匹配,仍触发弹窗(不预选疾病)
|
||||
else if (d.reportTypeCode) {
|
||||
diseaseCode = 'OTHER';
|
||||
}
|
||||
|
||||
if (!diseaseCode) return null;
|
||||
return { diagnosis: d, diseaseCode };
|
||||
})
|
||||
.filter(item => item !== null);
|
||||
|
||||
const allSelectedDiseases = infectiousDiagnoses.map(item => item.diseaseCode);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user