Fix Bug #401: 门诊完诊审计日志错误:div_log 表中 pool_id 与 slot_id 存值与设计规范不符
调整完诊时 div_log 的 pool_id/slot_id 获取优先级:优先使用 triage_queue_item (挂号时录入的号源信息,为权威来源),队列项不存在或值缺失时回退使用 encounter → order → slot → pool 链路 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -274,27 +274,8 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
|||||||
return R.fail("非就诊中患者不能完诊");
|
return R.fail("非就诊中患者不能完诊");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取 pool_id 和 slot_id:从 encounter → order_main → adm_schedule_slot 链路获取
|
// 2. 查找队列项(限定当天,避免复诊患者匹配到历史队列记录)
|
||||||
// 确保 div_log 中的值与排班主表一致,不依赖 triage_queue_item(队列项可能不存在或值错误)
|
|
||||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
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(
|
TriageQueueItem queueItem = triageQueueItemService.getOne(
|
||||||
new LambdaQueryWrapper<TriageQueueItem>()
|
new LambdaQueryWrapper<TriageQueueItem>()
|
||||||
.eq(TriageQueueItem::getTenantId, tenantId)
|
.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 &&
|
if (queueItem != null &&
|
||||||
|
|||||||
Reference in New Issue
Block a user