From fc1ed6c4ceb3f85a764d07100a607b486715d693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B3=E7=BE=BD?= <关羽@gentronhealth.com> Date: Wed, 13 May 2026 14:06:02 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#401:=20=E9=97=A8=E8=AF=8A=E5=AE=8C?= =?UTF-8?q?=E8=AF=8A=E5=AE=A1=E8=AE=A1=E6=97=A5=E5=BF=97=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=9Adiv=5Flog=20=E8=A1=A8=E4=B8=AD=20pool=5Fid=20=E4=B8=8E?= =?UTF-8?q?=20slot=5Fid=20=E5=AD=98=E5=80=BC=E4=B8=8E=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=B8=8D=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:DoctorStationMainAppServiceImpl.completeEncounter() 中获取 pool_id/slot_id 的逻辑有两处缺陷: 1. 当 queueItem 存在但 poolId 或 slotId 为 null 时,else if 分支因 queueItem != null 而跳过, 导致未进入回退链路,最终 divPoolId 和 divSlotId 均为 null。 修复:将 else if 拆为独立的 if 判断,确保 queueItem 值缺失时能正确回退。 2. 回退路径中先将 order.getSlotId() 赋给 divSlotId,再查询 ScheduleSlot 获取 poolId。 若 Slot 查询失败(返回 null),则 divSlotId 有值但 divPoolId 为 null,产生不完整审计记录。 修复:先查 Slot,成功后同时用 slot.getId() 和 slot.getPoolId() 赋值,保证数据一致性。 Co-Authored-By: Claude Opus 4.7 --- .../appservice/impl/DoctorStationMainAppServiceImpl.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java index 26eed4b95..480402f04 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java @@ -307,13 +307,15 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer if (queueItem != null && queueItem.getPoolId() != null && queueItem.getSlotId() != null) { divPoolId = queueItem.getPoolId(); divSlotId = queueItem.getSlotId(); - } else if (encounter.getOrderId() != null) { + } + // 队列项 poolId/slotId 缺失时,通过 encounter.orderId → order_main.slot_id → adm_schedule_slot.pool_id 回退获取 + if ((divPoolId == null || divSlotId == null) && encounter.getOrderId() != null) { try { Order order = iOrderService.getById(encounter.getOrderId()); if (order != null && order.getSlotId() != null) { - divSlotId = order.getSlotId(); - ScheduleSlot slot = scheduleSlotMapper.selectById(divSlotId); + ScheduleSlot slot = scheduleSlotMapper.selectById(order.getSlotId()); if (slot != null) { + divSlotId = slot.getId(); divPoolId = slot.getPoolId(); } }