Fix Bug #547: 根因+修复方案摘要
This commit is contained in:
@@ -1864,6 +1864,21 @@ function handleTemporaryMedicalRefresh() {
|
|||||||
function handleQuoteBilling() {
|
function handleQuoteBilling() {
|
||||||
// 重新拉取计费药品数据
|
// 重新拉取计费药品数据
|
||||||
if (temporaryPatientInfo.value.visitId) {
|
if (temporaryPatientInfo.value.visitId) {
|
||||||
|
// 🔧 修复 Bug #445: 在清空之前提取已提交项目的复合匹配键
|
||||||
|
// 原因:后续的 ID 匹配过滤依赖 temporaryAdvices,但 temporaryAdvices 会被先清空
|
||||||
|
// 新医嘱没有 requestId/chargeItemId,需用名称+规格+数量的复合键匹配
|
||||||
|
const submittedKeys = new Set(
|
||||||
|
(temporaryAdvices.value || [])
|
||||||
|
.map(a => {
|
||||||
|
const om = a.originalMedicine || {}
|
||||||
|
const name = om.medicineName || om.adviceName || a.adviceName || ''
|
||||||
|
const spec = om.specification || om.volume || ''
|
||||||
|
const qty = om.quantity ?? 0
|
||||||
|
return `${name}|||${spec}|||${qty}`
|
||||||
|
})
|
||||||
|
.filter(k => k !== '|||0')
|
||||||
|
)
|
||||||
|
|
||||||
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
|
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
|
||||||
getPrescriptionList(temporaryPatientInfo.value.visitId, 6, temporaryPatientInfo.value.operCode).then((res) => {
|
getPrescriptionList(temporaryPatientInfo.value.visitId, 6, temporaryPatientInfo.value.operCode).then((res) => {
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
@@ -1997,28 +2012,58 @@ function handleQuoteBilling() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目,避免"引用计费"后已提交项目重新出现在"待生成"列表
|
// 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目,避免"引用计费"后已提交项目重新出现在"待生成"列表
|
||||||
// 原因:后端返回的计费数据中,已生成医嘱的项目可能没有 requestId 字段
|
// 使用清空前提取的 submittedKeys(名称|||规格|||数量复合键)进行匹配
|
||||||
// 方案:用 chargeItemId/requestId/id 与已有的 temporaryAdvices 做匹配,排除已生成项目
|
if (submittedKeys.size > 0) {
|
||||||
if (temporaryAdvices.value.length > 0) {
|
|
||||||
const existingAdviceIds = new Set()
|
|
||||||
temporaryAdvices.value.forEach(a => {
|
|
||||||
const om = a.originalMedicine || {}
|
|
||||||
if (om.requestId) existingAdviceIds.add(String(om.requestId))
|
|
||||||
if (om.chargeItemId) existingAdviceIds.add(String(om.chargeItemId))
|
|
||||||
if (om.id) existingAdviceIds.add(String(om.id))
|
|
||||||
})
|
|
||||||
if (existingAdviceIds.size > 0) {
|
|
||||||
temporaryBillingMedicines.value = temporaryBillingMedicines.value.filter(m => {
|
temporaryBillingMedicines.value = temporaryBillingMedicines.value.filter(m => {
|
||||||
const mRequestId = m.requestId != null ? String(m.requestId) : null
|
const key = `${m.medicineName || ''}|||${m.specification || ''}|||${m.quantity ?? 0}`
|
||||||
const mChargeItemId = m.chargeItemId != null ? String(m.chargeItemId) : null
|
return !submittedKeys.has(key)
|
||||||
const mId = m.id != null ? String(m.id) : null
|
|
||||||
if (mRequestId && existingAdviceIds.has(mRequestId)) return false
|
|
||||||
if (mChargeItemId && existingAdviceIds.has(mChargeItemId)) return false
|
|
||||||
if (mId && existingAdviceIds.has(mId)) return false
|
|
||||||
return true
|
|
||||||
})
|
})
|
||||||
|
// 同步更新 temporaryAdvices,保持两份数据一致
|
||||||
|
temporaryAdvices.value = temporaryBillingMedicines.value.map((medicine, index) => {
|
||||||
|
const specMatch = medicine.specification ? medicine.specification.match(/(\d+)(\D+)/) : null
|
||||||
|
const specValue = specMatch ? parseInt(specMatch[1]) : 1
|
||||||
|
const specUnit = specMatch ? specMatch[2] : 'ml'
|
||||||
|
const dosage = specValue * (medicine.quantity || 1)
|
||||||
|
let usageCode = 'iv'
|
||||||
|
let usageLabel = '静脉注射'
|
||||||
|
try {
|
||||||
|
const jsonContent = medicine.contentJson || medicine.content_json;
|
||||||
|
if (jsonContent) {
|
||||||
|
const contentData = JSON.parse(jsonContent);
|
||||||
|
if (contentData.methodCode) {
|
||||||
|
usageCode = contentData.methodCode;
|
||||||
|
usageLabel = getUsageLabel(contentData.methodCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
if (!usageCode || usageCode === 'iv') {
|
||||||
|
if (medicine.medicineName && medicine.medicineName.includes('注射液')) {
|
||||||
|
usageCode = 'iv'; usageLabel = '静脉注射';
|
||||||
|
} else if (medicine.medicineName && medicine.medicineName.includes('片')) {
|
||||||
|
usageCode = 'po'; usageLabel = '口服';
|
||||||
|
} else if (medicine.medicineName && medicine.medicineName.includes('胶囊')) {
|
||||||
|
usageCode = 'po'; usageLabel = '口服';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: index + 1,
|
||||||
|
adviceName: medicine.medicineName || '',
|
||||||
|
dosage,
|
||||||
|
unit: specUnit,
|
||||||
|
usage: usageCode,
|
||||||
|
usageLabel,
|
||||||
|
frequency: '临时',
|
||||||
|
executeTime: new Date().toLocaleString('zh-CN'),
|
||||||
|
originalMedicine: {
|
||||||
|
...medicine,
|
||||||
|
medicineName: medicine.medicineName,
|
||||||
|
specification: medicine.specification,
|
||||||
|
quantity: medicine.quantity,
|
||||||
|
encounterId: temporaryPatientInfo.value.visitId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
temporaryMedicalLoading.value = false // 🔧 新增:加载完成
|
temporaryMedicalLoading.value = false // 🔧 新增:加载完成
|
||||||
ElMessage.success('已成功引用最新计费药品信息!')
|
ElMessage.success('已成功引用最新计费药品信息!')
|
||||||
|
|||||||
Reference in New Issue
Block a user