fix(门诊挂号): 修复退号时未同步移除分诊队列的问题
修复退号操作未同步移除分诊队列记录导致已退号患者仍在排队的问题 同步移除分诊队列和候选池排除记录 修复SQL查询字段命名不一致问题
This commit is contained in:
@@ -108,6 +108,9 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
|
|||||||
@Resource
|
@Resource
|
||||||
IOrderService orderService;
|
IOrderService orderService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
com.openhis.triageandqueuemanage.service.TriageQueueItemService triageQueueItemService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
ScheduleSlotMapper scheduleSlotMapper;
|
ScheduleSlotMapper scheduleSlotMapper;
|
||||||
|
|
||||||
@@ -324,6 +327,9 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
|
|||||||
// 如果本次门诊挂号来自预约签到,同步把预约订单与号源槽位状态改为已退号
|
// 如果本次门诊挂号来自预约签到,同步把预约订单与号源槽位状态改为已退号
|
||||||
if (result != null && result.getCode() == 200) {
|
if (result != null && result.getCode() == 200) {
|
||||||
syncAppointmentReturnStatus(byId, cancelRegPaymentDto.getReason());
|
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<com.openhis.triageandqueuemanage.domain.TriageQueueItem>()
|
||||||
|
.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<TriageCandidateExclusion>()
|
||||||
|
.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
T8.gender_enum AS gender_enum,
|
T8.gender_enum AS gender_enum,
|
||||||
T8.id_card AS id_card,
|
T8.id_card AS id_card,
|
||||||
T1.status_enum AS status_enum,
|
T1.status_enum AS status_enum,
|
||||||
T1.create_time AS "registerTime",
|
T1.create_time AS register_time,
|
||||||
T10.total_price,
|
T10.total_price,
|
||||||
T11."name" AS account_name,
|
T11."name" AS account_name,
|
||||||
T12."name" AS enterer_name,
|
T12."name" AS enterer_name,
|
||||||
@@ -178,7 +178,7 @@
|
|||||||
AND T10.context_enum = #{register}
|
AND T10.context_enum = #{register}
|
||||||
) AS T9
|
) AS T9
|
||||||
${ew.customSqlSegment}
|
${ew.customSqlSegment}
|
||||||
ORDER BY T9.registerTime DESC
|
ORDER BY T9.register_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getTmpActivityList" resultType="com.openhis.web.personalization.dto.ActivityDeviceDto">
|
<select id="getTmpActivityList" resultType="com.openhis.web.personalization.dto.ActivityDeviceDto">
|
||||||
|
|||||||
Reference in New Issue
Block a user