Fix Bug #444: 引用计费时"已引用计费药品"列表显示非药品项目 — handleQuoteBilling 过滤逻辑缺少 Number() 类型转换和 snake_case 回退,且缺少关键词二次过滤,导致手术/检查/诊疗等非药品项目出现在列表中;已统一与 handleMedicalAdvice 的过滤逻辑

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 23:03:27 +08:00
parent 0a37b05aab
commit 1ddf8a2ccd

View File

@@ -1861,16 +1861,22 @@ function handleQuoteBilling() {
temporaryBillingMedicines.value = [] temporaryBillingMedicines.value = []
temporaryAdvices.value = [] temporaryAdvices.value = []
// 🔧 修复 Bug #445: 只保留药品类型adviceType=1过滤掉耗材(2)和诊疗项目(3) // 🔧 修复 Bug #444: 统一过滤逻辑,与 handleMedicalAdvice 保持一致
// 同时过滤掉已有 requestId 的项目(已生成医嘱的不需要再次显示在"待生成"列表中) // 1. 使用 Number() + snake_case 回退,避免类型转换导致过滤失效
// 2. 增加关键词二次过滤,排除手术/检查/诊疗等非药品项目
const filteredItems = res.data.filter(item => { const filteredItems = res.data.filter(item => {
// 匹配 encounterId // 匹配 encounterId
if (item.encounterId !== temporaryPatientInfo.value.visitId) return false; if (item.encounterId !== temporaryPatientInfo.value.visitId) return false;
// 只保留药品类型adviceType=1过滤掉耗材(2)和诊疗项目(3) // 只保留药品类型adviceType=1过滤掉耗材(2)和诊疗项目(3/6)
if (item.adviceType !== 1) return false; // 🔧 修复 Bug #444: 使用 Number() 显式转换,增加 snake_case 回退
const at = Number(item.adviceType ?? item.advice_type);
if (at !== 1) return false;
// 过滤掉名称为空的项目 // 过滤掉名称为空的项目
const medicineName = item.adviceName || item.advice_name; const medicineName = item.adviceName || item.advice_name;
if (!medicineName || medicineName.trim() === '') return false; if (!medicineName || medicineName.trim() === '') return false;
// 🔧 修复 Bug #444: 二次过滤,排除名称中包含手术/检查/诊疗关键词的非药品项目
const excludedKeywords = ['术', '超声', '多普勒', '检查', '检验', '彩超', 'X线', 'CT', 'MRI', '扫描', '造影'];
if (excludedKeywords.some(kw => medicineName.includes(kw))) return false;
// 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目(已有 requestId // 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目(已有 requestId
if (item.requestId) return false; if (item.requestId) return false;
return true; return true;