From 01c5b62024473cb87888b6d77ca1d72bb76732c7 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 1/3] =?UTF-8?q?Fix=20Bug=20#401:=20=E9=97=A8=E8=AF=8A?= =?UTF-8?q?=E5=AE=8C=E8=AF=8A=E5=AE=A1=E8=AE=A1=E6=97=A5=E5=BF=97=E9=94=99?= =?UTF-8?q?=E8=AF=AF=EF=BC=9Adiv=5Flog=20=E8=A1=A8=E4=B8=AD=20pool=5Fid=20?= =?UTF-8?q?=E4=B8=8E=20slot=5Fid=20=E5=AD=98=E5=80=BC=E4=B8=8E=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=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 | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 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 844daa744..e0c3945b8 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 @@ -274,27 +274,8 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer return R.fail("非就诊中患者不能完诊"); } - // 2. 获取 pool_id 和 slot_id:从 encounter → order_main → adm_schedule_slot 链路获取 - // 确保 div_log 中的值与排班主表一致,不依赖 triage_queue_item(队列项可能不存在或值错误) + // 2. 查找队列项(限定当天,避免复诊患者匹配到历史队列记录) Integer tenantId = SecurityUtils.getLoginUser().getTenantId(); - Long divPoolId = null; - Long divSlotId = null; - if (encounter.getOrderId() != null) { - try { - Order order = iOrderService.getById(encounter.getOrderId()); - if (order != null && order.getSlotId() != null) { - divSlotId = order.getSlotId(); - ScheduleSlot slot = scheduleSlotMapper.selectById(divSlotId); - if (slot != null) { - divPoolId = slot.getPoolId(); - } - } - } catch (Exception e) { - log.warn("获取完诊div_log的pool_id/slot_id失败,encounterId={}", encounterId, e); - } - } - - // 3. 查找队列项(限定当天,避免复诊患者匹配到历史队列记录) TriageQueueItem queueItem = triageQueueItemService.getOne( new LambdaQueryWrapper() .eq(TriageQueueItem::getTenantId, tenantId) @@ -319,6 +300,28 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer } } + // 3. 获取 pool_id 和 slot_id:优先使用 triage_queue_item(挂号时录入的号源信息,为权威来源) + // 队列项不存在或值缺失时,回退使用 encounter → order_main → adm_schedule_slot 链路 + Long divPoolId = null; + Long divSlotId = null; + if (queueItem != null && queueItem.getPoolId() != null && queueItem.getSlotId() != null) { + divPoolId = queueItem.getPoolId(); + divSlotId = queueItem.getSlotId(); + } else if (encounter.getOrderId() != null) { + try { + Order order = iOrderService.getById(encounter.getOrderId()); + if (order != null && order.getSlotId() != null) { + divSlotId = order.getSlotId(); + ScheduleSlot slot = scheduleSlotMapper.selectById(divSlotId); + if (slot != null) { + divPoolId = slot.getPoolId(); + } + } + } catch (Exception e) { + log.warn("回退获取完诊div_log的pool_id/slot_id失败,encounterId={}", encounterId, e); + } + } + // 如果队列项存在且未完成,更新队列状态为已完成 // 使用排除法而非白名单:只要不是"已完成"就可以完诊,覆盖跳过、等待等非标准流转状态 if (queueItem != null && From 84499d4ec172e4e4b004cecb16508f3320b801dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B3=E7=BE=BD?= <关羽@gentronhealth.com> Date: Wed, 13 May 2026 10:36:54 +0800 Subject: [PATCH 2/3] =?UTF-8?q?Fix=20Bug=20#400:=20=E9=97=A8=E8=AF=8A?= =?UTF-8?q?=E5=8C=BB=E7=94=9F=E7=AB=99=E7=82=B9=E5=87=BB=E3=80=90=E5=AE=8C?= =?UTF-8?q?=E8=AF=8A=E3=80=91=E5=90=8E=EF=BC=8Ctriage=5Fqueue=5Fitem=20?= =?UTF-8?q?=E8=A1=A8=20status=20=E5=AD=97=E6=AE=B5=E6=9C=AA=E6=8C=89?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E6=9B=B4=E6=96=B0=E4=B8=BA=2030?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:完诊时使用 triageQueueItemService.updateById(queueItem) 更新队列状态, 依赖 MyBatis Plus 的实体级更新策略,可能因字段级更新策略导致 status 字段未实际写入数据库。 修复策略:改用 LambdaUpdateWrapper 直接生成 UPDATE SQL,明确指定 SET status=30, 绕过实体级更新策略,确保 status 字段必定写入数据库。同时增加更新失败日志。 Co-Authored-By: Claude Opus 4.7 --- .../impl/DoctorStationMainAppServiceImpl.java | 11 ++++++++--- 1 file changed, 8 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 e0c3945b8..26eed4b95 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 @@ -327,9 +327,14 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer 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); + // 使用 LambdaUpdateWrapper 直接更新,确保 status 字段必定写入数据库 + boolean queueUpdate = triageQueueItemService.update(new LambdaUpdateWrapper() + .eq(TriageQueueItem::getId, queueItem.getId()) + .set(TriageQueueItem::getStatus, TriageQueueStatus.COMPLETED.getValue()) + .set(TriageQueueItem::getUpdateTime, nowLocal)); + if (!queueUpdate) { + log.error("完诊:triage_queue_item 状态更新失败,queueItemId={}", queueItem.getId()); + } } else if (queueItem == null) { log.error("完诊:未找到任何 triage_queue_item 记录,encounterId={}, tenantId={}", encounterId, tenantId); From bfddf87b2cbdd99f2e2ab1a9b21644a1a2bea7e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B3=E7=BE=BD?= <关羽@gentronhealth.com> Date: Wed, 13 May 2026 10:42:21 +0800 Subject: [PATCH 3/3] =?UTF-8?q?Fix=20Bug=20#496:=20=E3=80=90=E4=BD=8F?= =?UTF-8?q?=E9=99=A2=E5=8C=BB=E7=94=9F=E5=B7=A5=E4=BD=9C=E7=AB=99-?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E7=94=B3=E8=AF=B7=E3=80=91=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=88=97=E8=A1=A8=E5=AD=97=E6=AE=B5=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E4=B8=8D=E8=A7=84=E8=8C=83=E5=8F=8A=E5=8D=95=E5=8F=B7?= =?UTF-8?q?=E7=94=9F=E6=88=90=E8=A7=84=E5=88=99=E4=B8=8D=E7=AC=A6=E5=90=88?= =?UTF-8?q?=E5=8C=BB=E7=96=97=E8=A1=8C=E4=B8=9A=E6=A0=87=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 前端 examineApplication.vue:列表表头和详情弹窗中"处方号"改为"申请单号" 2. 后端 RequestFormManageAppServiceImpl:检查申请单单号生成规则由 PAR+流水号 改为 JCZ+yyMMdd+5位顺序号(如:JCZ26051300001),其他类型申请单保持原有PAR规则不变 Co-Authored-By: Claude Opus 4.7 --- .../impl/RequestFormManageAppServiceImpl.java | 11 +++++++++-- .../components/applicationShow/examineApplication.vue | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java index 1ad8ec3c6..667cd1695 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java @@ -31,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; +import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Map; @@ -91,8 +92,14 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer return R.fail("无待签发的医嘱,该申请单不可编辑"); } } else { - // 诊疗处方号 - prescriptionNo = assignSeqUtil.getSeq(AssignSeqEnum.ACTIVITY_PSYCHOTROPIC_NO.getPrefix(), 8); + // 诊疗处方号 - 按申请单类型生成不同规则的单号 + if (ActivityDefCategory.TEST.getCode().equals(typeCode)) { + // 检查申请单:JC(检查)+ Z(住院标识)+ yyMMdd(日期)+ 5位顺序号 + String dateStr = new SimpleDateFormat("yyMMdd").format(new Date()); + prescriptionNo = "JCZ" + dateStr + assignSeqUtil.getSeq("JCZ_" + dateStr, 5); + } else { + prescriptionNo = assignSeqUtil.getSeq(AssignSeqEnum.ACTIVITY_PSYCHOTROPIC_NO.getPrefix(), 8); + } } // 当前时间 diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue index 1bfbc95e0..aad3aeb97 100755 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue @@ -79,7 +79,7 @@ - +