From 6a0db01308fe83d6c4b3d5cdfbf6359b745edef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B3=E7=BE=BD?= <关羽@gentronhealth.com> Date: Thu, 14 May 2026 00:10:53 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#443:=20=E6=89=8B=E6=9C=AF=E8=AE=A1?= =?UTF-8?q?=E8=B4=B9=EF=BC=9A=E7=82=B9=E5=87=BB"=E7=AD=BE=E5=8F=91"?= =?UTF-8?q?=E8=80=97=E6=9D=90=E6=97=B6=E5=BC=82=E5=B8=B8=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **根因分析**: 前端 handleSave 签发时,仅从 contentJson 解析数据后发送,缺少 encounterId、patientId、locationId 等关键字段。这些字段在 API 响应顶层(不在 contentJson 中),导致后端签发时字段为空。 **修复方案**: - 前端:在 handleSave 的 saveList 映射中补充 encounterId、patientId、locationId(对应 positionId)、adviceType 等顶层关键字段 - 后端:handDevice 中 locationId 为空时,优先查询已有 DeviceRequest 的 performLocation 作为回退,避免覆盖为默认科室 --- .../impl/DoctorStationAdviceAppServiceImpl.java | 17 ++++++++++++++--- .../bargain/component/prescriptionlist.vue | 8 ++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java index 5c9ab5d49..f50c30307 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java @@ -1539,11 +1539,22 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp deviceRequest.setRequesterId(adviceSaveDto.getPractitionerId()); // 开方医生 deviceRequest.setOrgId(adviceSaveDto.getFounderOrgId());// 开方人科室 deviceRequest.setReqAuthoredTime(curDate); // 请求开始时间 - // 发放耗材房(若前端未传locationId,使用登录用户的科室作为默认值) + // 发放耗材房(若前端未传locationId,优先沿用已有DeviceRequest的performLocation,否则使用登录用户科室) Long locId = adviceSaveDto.getLocationId(); if (locId == null) { - locId = SecurityUtils.getLoginUser().getOrgId(); - log.info("耗材locationId为空,使用登录用户科室作为默认值: locationId={}", locId); + // 尝试从已有DeviceRequest获取原始的performLocation + if (adviceSaveDto.getRequestId() != null) { + DeviceRequest existingDevice = iDeviceRequestService.getById(adviceSaveDto.getRequestId()); + if (existingDevice != null && existingDevice.getPerformLocation() != null) { + locId = existingDevice.getPerformLocation(); + log.info("耗材locationId为空,使用已有DeviceRequest的performLocation: locationId={}", locId); + } + } + // 如果已有记录也没有performLocation,则使用登录用户科室作为兜底 + if (locId == null) { + locId = SecurityUtils.getLoginUser().getOrgId(); + log.info("耗材locationId为空且无已有记录,使用登录用户科室作为默认值: locationId={}", locId); + } } deviceRequest.setPerformLocation(locId); deviceRequest.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id diff --git a/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/prescriptionlist.vue b/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/prescriptionlist.vue index 5fcfe6cc1..709e4303c 100755 --- a/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/prescriptionlist.vue +++ b/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/prescriptionlist.vue @@ -1036,6 +1036,14 @@ function handleSave() { requestId: item.requestId, dbOpType: '1', groupId: item.groupId, + // 🔧 Bug #443: 补充顶层关键字段(这些不在 contentJson 中,需从 API 响应顶层提取) + encounterId: item.encounterId, + patientId: item.patientId, + locationId: item.positionId, + adviceType: item.adviceType, + adviceTableName: item.adviceTableName, + adviceDefinitionId: item.adviceDefinitionId, + chargeItemId: item.chargeItemId, }; }); savePrescriptionSign({