diff --git a/openhis-ui-vue3/src/views/surgicalschedule/index.vue b/openhis-ui-vue3/src/views/surgicalschedule/index.vue index a65cd2cdf..1f1a37cd0 100755 --- a/openhis-ui-vue3/src/views/surgicalschedule/index.vue +++ b/openhis-ui-vue3/src/views/surgicalschedule/index.vue @@ -1552,6 +1552,8 @@ function handleMedicalAdvice(row) { // 过滤掉名称为空的项目 const medicineName = item.adviceName || item.advice_name; if (!medicineName || medicineName.trim() === '') return false; + // 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目(已有 requestId 的不应出现在"待生成"列表) + if (item.requestId) return false; // 根据药品请求ID去重,避免重复显示 const itemId = item.requestId || item.id; if (itemId && seenIds.has(itemId)) return false; @@ -1739,15 +1741,27 @@ function handleTemporaryMedicalSubmit(data) { } }) - // 同步更新计费药品列表:移除已生成医嘱的项目,避免数据重复显示 - const submittedIds = new Set( - (data.temporaryAdvices || []).map(a => a.originalMedicine?.requestId || a.originalMedicine?.chargeItemId).filter(Boolean) + // 🔧 修复 Bug #445: 使用稳定的字段组合匹配已提交项目,而不是依赖可能为空的 requestId/chargeItemId + // 构建已提交项目的匹配键集合(药品名称 + 规格 + 数量) + const submittedKeys = new Set( + (data.temporaryAdvices || []) + .map(a => { + const om = a.originalMedicine || {} + const name = om.medicineName || om.adviceName || om.advice_name || a.adviceName || '' + const spec = om.specification || om.volume || '' + const qty = om.quantity || 0 + return `${name}|||${spec}|||${qty}` + }) + .filter(k => k !== '|||0') // 过滤掉空项 ) - if (submittedIds.size > 0) { - temporaryBillingMedicines.value = (data.billingMedicines || []).filter( - m => !submittedIds.has(m.requestId || m.chargeItemId) - ) + + if (submittedKeys.size > 0) { + temporaryBillingMedicines.value = (temporaryBillingMedicines.value || []).filter(m => { + const key = `${m.medicineName || ''}|||${m.specification || ''}|||${m.quantity || 0}` + return !submittedKeys.has(key) + }) } else { + // 如果没有任何匹配键,清空待生成列表(所有项目都已提交) temporaryBillingMedicines.value = [] } @@ -1807,7 +1821,8 @@ function handleQuoteBilling() { temporaryBillingMedicines.value = [] temporaryAdvices.value = [] - // 只保留药品类型(adviceType=1),过滤掉耗材(2)和诊疗项目(3) + // 🔧 修复 Bug #445: 只保留药品类型(adviceType=1),过滤掉耗材(2)和诊疗项目(3) + // 同时过滤掉已有 requestId 的项目(已生成医嘱的不需要再次显示在"待生成"列表中) const filteredItems = res.data.filter(item => { // 匹配 encounterId if (item.encounterId !== temporaryPatientInfo.value.visitId) return false; @@ -1815,7 +1830,10 @@ function handleQuoteBilling() { if (item.adviceType !== 1) return false; // 过滤掉名称为空的项目 const medicineName = item.adviceName || item.advice_name; - return medicineName && medicineName.trim() !== ''; + if (!medicineName || medicineName.trim() === '') return false; + // 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目(已有 requestId) + if (item.requestId) return false; + return true; }) // 🔧 修复:限制返回数量,最多显示前100条,避免数据过多导致页面卡死 const maxItems = 100