fix(#575): 退号流程兼容 CHECKED_IN(3) 状态 + 查询过滤修复

Bug #574 将签到状态从 BOOKED(1) 改为 CHECKED_IN(3) 后,
退号流程只检查 BOOKED(1) 导致已签到患者无法退号。

修复:
- OutpatientRegistrationAppServiceImpl: 退号检查兼容 BOOKED(1) 和 CHECKED_IN(3)
- OutpatientRegistrationAppServiceImpl: 退号统计改用 refreshPoolStats 统一刷新
- ScheduleSlotMapper.xml: 'checked' 查询过滤兼容 status=1 和 status=3
This commit is contained in:
2026-06-02 09:59:58 +08:00
parent b8463f4659
commit c3ecadcfe0
2 changed files with 9 additions and 10 deletions

View File

@@ -660,10 +660,12 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
return appointmentOrder.getId();
}
// 只有已预约(1)的号源能退号,对应签到后的 BOOKED 状态
// 已预约(1)或已签到(3)的号源能退号
ScheduleSlot slot = scheduleSlotMapper.selectById(slotId);
if (slot == null || !SlotStatus.BOOKED.getValue().equals(slot.getStatus())) {
log.warn("退号跳过:槽位非已预约状态, slotId={}, status={}", slotId,
if (slot == null ||
(!SlotStatus.BOOKED.getValue().equals(slot.getStatus()) &&
!SlotStatus.CHECKED_IN.getValue().equals(slot.getStatus()))) {
log.warn("退号跳过:槽位状态不允许退号, slotId={}, status={}", slotId,
slot != null ? slot.getStatus() : null);
return appointmentOrder.getId();
}
@@ -676,11 +678,8 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
Long poolId = scheduleSlotMapper.selectPoolIdBySlotId(slotId);
if (poolId != null) {
schedulePoolMapper.update(null,
new LambdaUpdateWrapper<SchedulePool>()
.setSql("booked_num = booked_num - 1, version = version + 1")
.set(SchedulePool::getUpdateTime, new Date())
.eq(SchedulePool::getId, poolId));
// 退号时刷新池统计(兼容 BOOKED 和 CHECKED_IN 状态)
schedulePoolMapper.refreshPoolStats(poolId, SlotStatus.BOOKED.getValue(), SlotStatus.LOCKED.getValue());
}
return appointmentOrder.getId();
} catch (Exception e) {

View File

@@ -340,8 +340,8 @@
OR d.is_stopped = FALSE
)
</when>
<when test="'checked'.equals(query.status) or '已取号'.equals(query.status)">
AND <include refid="slotStatusNormExpr" /> = 1
<when test="'checked'.equals(query.status) or '已取号'.equals(query.status) or '已签到'.equals(query.status)">
AND (<include refid="slotStatusNormExpr" /> = 1 OR <include refid="slotStatusNormExpr" /> = 3)
AND (
d.is_stopped IS NULL
OR d.is_stopped = FALSE