From 4084f2ffa8bc4e8217584ab01f68923a900a321e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B3=E7=BE=BD?= <关羽@gentronhealth.com> Date: Thu, 14 May 2026 11:30:57 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#480:=20[=E4=BD=8F=E9=99=A2?= =?UTF-8?q?=E6=8A=A4=E5=A3=AB=E7=AB=99-=E5=8C=BB=E5=98=B1=E6=89=A7?= =?UTF-8?q?=E8=A1=8C]=20=E9=9D=9E=E8=80=97=E6=9D=90=E7=B1=BB=E5=8C=BB?= =?UTF-8?q?=E5=98=B1=E6=89=A7=E8=A1=8C=E6=8A=A5"=E8=80=97=E6=9D=90?= =?UTF-8?q?=E5=BA=93=E5=AD=98"=E9=94=99=E8=AF=AF=E4=B8=94=E5=85=A8?= =?UTF-8?q?=E9=80=89=E9=80=BB=E8=BE=91=E8=81=94=E5=8A=A8=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因分析: 1. lotNumberMatch 调用传入了所有在科患者的 encounterId(来自 patientInfoList), 而非仅选中医嘱对应的 encounterId。若其他患者存在 PREPARATION 状态的耗材发放记录 但无匹配库存,API 返回"发耗材单生成失败,请检查耗材库存"错误 2. handleExecute 缺少 .catch() 处理器,API 调用失败时 UI 状态不一致, 导致列表刷新后全选联动异常 修复策略: - lotNumberMatch 仅传入选中医嘱对应的 encounterId(去重过滤),避免无关患者耗材记录干扰 - 新增空选择校验,未选中医嘱时提示用户而非直接调接口 - 为 handleExecute 添加 .catch() 处理器,API 失败时给出友好提示 - lotNumberMatch 增加 .then() 检查返回码,确保 error 被正确捕获 Co-Authored-By: Claude Opus 4.7 --- .../components/prescriptionList.vue | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/openhis-ui-vue3/src/views/inpatientNurse/medicalOrderExecution/components/prescriptionList.vue b/openhis-ui-vue3/src/views/inpatientNurse/medicalOrderExecution/components/prescriptionList.vue index eb46516bd..646a03252 100755 --- a/openhis-ui-vue3/src/views/inpatientNurse/medicalOrderExecution/components/prescriptionList.vue +++ b/openhis-ui-vue3/src/views/inpatientNurse/medicalOrderExecution/components/prescriptionList.vue @@ -459,10 +459,15 @@ function handleGetPrescription(skipAutoSelectAll = false) { // 执行 function handleExecute() { let list = getSelectRows(); + if (list.length === 0) { + proxy.$modal.msgWarning('请选择需要执行的医嘱'); + return; + } let encounterIds = patientInfoList.value.map((i) => i.encounterId).join(','); list = list.map((item) => { return { requestId: item.requestId, + encounterId: item.encounterId, accountId: item.accountId, adviceTable: item.adviceTable, executeTimes: item.executeTimes, @@ -473,14 +478,23 @@ function handleExecute() { if (res.code == 200) { // 仅当选中医嘱中包含诊疗类医嘱(可能绑定耗材)时,才调用耗材批号匹配 // adviceTable 取值为 med_medication_request(药品)或 wor_service_request(诊疗/耗材) - // 原代码用 includes('device') 判断有误,两个表名均不含 "device" 字符串 const hasServiceRequest = list.some((item) => String(item.adviceTable || '') === 'wor_service_request', ); if (hasServiceRequest) { - lotNumberMatch({ encounterIdList: encounterIds }, { skipErrorMsg: true }).catch((error) => { - console.warn('lotNumberMatch failed after adviceExecute:', error); - }); + // 仅传入选中医嘱对应的 encounterId,避免其他患者的耗材记录干扰 + const selectedEncounterIds = [...new Set(list.map((item) => item.encounterId).filter(Boolean))]; + if (selectedEncounterIds.length > 0) { + lotNumberMatch({ encounterIdList: selectedEncounterIds }, { skipErrorMsg: true }) + .then((matchRes) => { + if (matchRes && matchRes.code !== 200) { + console.warn('lotNumberMatch returned error:', matchRes.msg); + } + }) + .catch((error) => { + console.warn('lotNumberMatch failed after adviceExecute:', error); + }); + } } // 刷新列表(不自动全选,保持用户操作前的选择状态) handleGetPrescription(true); @@ -488,6 +502,9 @@ function handleExecute() { } else { proxy.$modal.msgError(res.msg || '医嘱执行失败'); } + }).catch((error) => { + console.error('医嘱执行接口调用失败:', error); + proxy.$modal.msgError('医嘱执行失败,请稍后重试'); }); }