Fix Bug #544: AI修复

This commit is contained in:
2026-05-27 08:41:09 +08:00
parent ad33518a7b
commit aea5ad38bc
3 changed files with 113 additions and 72 deletions

View File

@@ -1,32 +1,47 @@
package com.openhis.application.service.impl;
import com.openhis.application.domain.dto.QueuePatientDto;
import com.openhis.application.mapper.TriageQueueMapper;
import com.openhis.application.mapper.QueueMapper;
import com.openhis.application.service.TriageQueueService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.Date;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;
/**
* 分诊队列业务实现
* 智能分诊排队业务实现
*
* 修复 Bug #544
* - 透传 status 参数,不再在服务层拦截“完诊”状态
* - 支持按时间范围查询历史队列
* 1. 移除原 SQL 中硬编码的 status != 'COMPLETED' 过滤条件,确保“完诊”患者可正常展示。
* 2. 增加 startTime/endTime 参数支持,实现历史队列按时间范围检索,默认查询当天。
*/
@Service
public class TriageQueueServiceImpl implements TriageQueueService {
private final TriageQueueMapper queueMapper;
private static final Logger logger = LoggerFactory.getLogger(TriageQueueServiceImpl.class);
public TriageQueueServiceImpl(TriageQueueMapper queueMapper) {
this.queueMapper = queueMapper;
}
@Autowired
private QueueMapper queueMapper;
@Override
public List<QueuePatientDto> getQueueList(Long deptId, String status, Date startDate, Date endDate) {
// 直接调用 Mapper移除原代码中类似 if ("COMPLETED".equals(status)) return Collections.emptyList(); 的拦截逻辑
return queueMapper.selectQueueList(deptId, status, startDate, endDate);
public List<QueuePatientDto> getQueueList(Long deptId, String status, String startTimeStr, String endTimeStr) {
// 默认查询当天时间范围
LocalDateTime startTime = StringUtils.hasText(startTimeStr)
? LocalDateTime.parse(startTimeStr.replace(" ", "T"))
: LocalDate.now().atStartOfDay();
LocalDateTime endTime = StringUtils.hasText(endTimeStr)
? LocalDateTime.parse(endTimeStr.replace(" ", "T"))
: LocalDate.now().atTime(LocalTime.MAX);
logger.debug("查询分诊队列: deptId={}, status={}, startTime={}, endTime={}", deptId, status, startTime, endTime);
// 调用 Mapper 执行查询,不再拦截特定状态
return queueMapper.selectQueuePatients(deptId, status, startTime, endTime);
}
}