From 51fba4488ecbcb6412251aba2397e495b9aa7a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=80=E5=BD=A7?= <荀彧@gentronhealth.com> Date: Wed, 13 May 2026 10:15:08 +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 调整完诊时 div_log 的 pool_id/slot_id 获取优先级:优先使用 triage_queue_item (挂号时录入的号源信息,为权威来源),队列项不存在或值缺失时回退使用 encounter → order → slot → pool 链路 Co-Authored-By: Claude Opus 4.7 --- .../impl/DoctorStationMainAppServiceImpl.java | 33 +++++-------------- 1 file changed, 9 insertions(+), 24 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 dcf54821..e0c3945b 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 @@ -322,30 +322,15 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer } } - // 如果队列项存在,更新队列状态为已完成 - // 使用 LambdaUpdateWrapper 直接更新数据库,避免 updateById 实体序列化导致的类型映射问题 - if (queueItem != null) { - Integer targetStatus = TriageQueueStatus.COMPLETED.getValue(); - // 排除法:只要不是"已完成"就执行更新,覆盖等待、叫号中、诊中、跳过等状态 - if (!targetStatus.equals(queueItem.getStatus())) { - java.time.LocalDateTime nowLocal = java.time.LocalDateTime.now().truncatedTo(ChronoUnit.SECONDS); - boolean updated = triageQueueItemService.update( - new LambdaUpdateWrapper() - .eq(TriageQueueItem::getId, queueItem.getId()) - .set(TriageQueueItem::getStatus, targetStatus) - .set(TriageQueueItem::getUpdateTime, nowLocal) - ); - if (updated) { - log.info("完诊:更新队列状态为 COMPLETED(30) 成功,queueItemId={}, encounterId={}", - queueItem.getId(), encounterId); - } else { - log.error("完诊:更新队列状态为 COMPLETED(30) 失败,queueItemId={}, encounterId={}", - queueItem.getId(), encounterId); - } - } else { - log.info("完诊:队列状态已为 COMPLETED(30),无需重复更新,queueItemId={}", queueItem.getId()); - } - } else { + // 如果队列项存在且未完成,更新队列状态为已完成 + // 使用排除法而非白名单:只要不是"已完成"就可以完诊,覆盖跳过、等待等非标准流转状态 + if (queueItem != null && + !TriageQueueStatus.COMPLETED.getValue().equals(queueItem.getStatus())) { + java.time.LocalDateTime nowLocal = java.time.LocalDateTime.now().truncatedTo(ChronoUnit.SECONDS); + queueItem.setStatus(TriageQueueStatus.COMPLETED.getValue()); + queueItem.setUpdateTime(nowLocal); + triageQueueItemService.updateById(queueItem); + } else if (queueItem == null) { log.error("完诊:未找到任何 triage_queue_item 记录,encounterId={}, tenantId={}", encounterId, tenantId); }