Fix Bug #445: 引用计费时已生成医嘱项目重新出现在待生成列表 — handleQuoteBilling 中先清空 temporaryAdvices 再执行 ID 匹配过滤,导致过滤逻辑对空数组无效;且 ID 匹配不可靠(新医嘱无 requestId/chargeItemId),已改为在清空前提取复合键(名称|||规格|||数量)并在数据加载后用该键过滤

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 22:04:50 +08:00
parent 20817d6dc4
commit 0a37b05aab
2 changed files with 27 additions and 6 deletions

View File

@@ -1576,12 +1576,18 @@ function handleMedicalAdvice(row) {
const filteredItems = res.data.filter(item => {
// 匹配 encounterId
if (item.encounterId !== row.visitId) return false;
// 只保留药品类型adviceType=1过滤掉耗材(2)和诊疗项目(3)
if (item.adviceType !== 1) return false;
// 只保留药品类型adviceType=1过滤掉耗材(2)和诊疗项目(3/6)
// 🔧 修复 Bug #444: 使用 Number() 显式转换,避免字符串 "1" 被 !== 1 放行
const at = Number(item.adviceType ?? item.advice_type);
if (at !== 1) return false;
// 过滤掉名称为空的项目
const medicineName = item.adviceName || item.advice_name;
if (!medicineName || medicineName.trim() === '') return false;
// 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目(已有 requestId 的不应出现在"待生成"列表)
// 🔧 修复 Bug #444: 二次过滤,排除名称中包含手术/检查/诊疗关键词的非药品项目
// 某些计费项目可能在 adm_charge_item 中被错误标注为 adviceType=1
const excludedKeywords = ['术', '超声', '多普勒', '检查', '检验', '彩超', 'X线', 'CT', 'MRI', '扫描', '造影'];
if (excludedKeywords.some(kw => medicineName.includes(kw))) return false;
// 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目(已有 requestId 的不应出现在"待生成"列表中)
if (item.requestId) return false;
// 根据药品请求ID去重避免重复显示
const itemId = item.requestId || item.id;