From f439b1ffc0002b0497237cca9df12aba4f835e25 Mon Sep 17 00:00:00 2001 From: wangjian963 <15215920+aprilry@user.noreply.gitee.com> Date: Thu, 9 Apr 2026 10:56:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=97=A8=E8=AF=8A=E6=8C=82=E5=8F=B7):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=80=E5=8F=B7=E6=97=B6=E6=9C=AA=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E7=A7=BB=E9=99=A4=E5=88=86=E8=AF=8A=E9=98=9F=E5=88=97?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复退号操作未同步移除分诊队列记录导致已退号患者仍在排队的问题 同步移除分诊队列和候选池排除记录 修复SQL查询字段命名不一致问题 --- .../OutpatientRegistrationAppServiceImpl.java | 50 +++++++++++++++++++ .../OutpatientRegistrationAppMapper.xml | 4 +- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java index 8be9cc0c..0852a29b 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java @@ -108,6 +108,9 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra @Resource IOrderService orderService; + @Resource + com.openhis.triageandqueuemanage.service.TriageQueueItemService triageQueueItemService; + @Resource ScheduleSlotMapper scheduleSlotMapper; @@ -324,6 +327,9 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra // 如果本次门诊挂号来自预约签到,同步把预约订单与号源槽位状态改为已退号 if (result != null && result.getCode() == 200) { syncAppointmentReturnStatus(byId, cancelRegPaymentDto.getReason()); + + // 同步移除分诊队列中的记录 + removeTriageQueueItem(byId.getId()); } // 记录退号日志 @@ -779,4 +785,48 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra } } + /** + * 移除分诊队列中的记录 + * 退号时同步移除患者队列记录,避免已退号患者仍在排队 + * + * @param encounterId 就诊ID + */ + private void removeTriageQueueItem(Long encounterId) { + if (encounterId == null) { + return; + } + // 1. 移除分诊队列中的记录(必须成功,否则回滚事务) + com.openhis.triageandqueuemanage.domain.TriageQueueItem queueItem = triageQueueItemService.getOne( + new LambdaQueryWrapper() + .eq(com.openhis.triageandqueuemanage.domain.TriageQueueItem::getEncounterId, encounterId) + .eq(com.openhis.triageandqueuemanage.domain.TriageQueueItem::getDeleteFlag, "0") + ); + + if (queueItem != null) { + // 逻辑删除队列项 + queueItem.setDeleteFlag("1"); + queueItem.setUpdateTime(LocalDateTime.now()); + triageQueueItemService.updateById(queueItem); + log.info("退号成功,已移除分诊队列记录,encounterId={}, queueItemId={}", encounterId, queueItem.getId()); + } + + // 2. 移除候选池排除记录(非必须,即使失败也不影响主流程) + try { + TriageCandidateExclusion exclusion = triageCandidateExclusionService.getOne( + new LambdaQueryWrapper() + .eq(TriageCandidateExclusion::getEncounterId, encounterId) + .eq(TriageCandidateExclusion::getDeleteFlag, "0") + ); + if (exclusion != null) { + exclusion.setDeleteFlag("1"); + exclusion.setUpdateTime(LocalDateTime.now()); + triageCandidateExclusionService.updateById(exclusion); + log.info("已移除候选池排除记录,encounterId={}", encounterId); + } + } catch (Exception e) { + // 候选池排除记录移除失败不影响主流程,仅记录日志 + log.warn("移除候选池排除记录失败,encounterId={}", encounterId, e); + } + } + } diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml index be71ec4d..2f5fa0e8 100644 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml @@ -84,7 +84,7 @@ T8.gender_enum AS gender_enum, T8.id_card AS id_card, T1.status_enum AS status_enum, - T1.create_time AS "registerTime", + T1.create_time AS register_time, T10.total_price, T11."name" AS account_name, T12."name" AS enterer_name, @@ -178,7 +178,7 @@ AND T10.context_enum = #{register} ) AS T9 ${ew.customSqlSegment} - ORDER BY T9.registerTime DESC + ORDER BY T9.register_time DESC