Fix Bug #544: AI修复

This commit is contained in:
2026-05-27 07:35:05 +08:00
parent a76cfb9b99
commit 60b044912b
4 changed files with 163 additions and 116 deletions

View File

@@ -0,0 +1,41 @@
package com.openhis.application.mapper;
import com.openhis.application.domain.dto.QueuePatientDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.Date;
import java.util.List;
/**
* 分诊队列 Mapper
*
* 修复 Bug #544
* 1. 移除原 SQL 中硬编码的 status != 'COMPLETED' 过滤条件
* 2. 增加 startDate/endDate 动态查询支持,用于历史队列检索
*/
@Mapper
public interface TriageQueueMapper {
@Select("<script>" +
"SELECT " +
" q.id, q.patient_id, q.patient_name, q.status, q.queue_time, q.dept_id " +
"FROM hisdev.triage_queue q " +
"WHERE q.dept_id = #{deptId} " +
"<if test='status != null and status != \"\"'> " +
" AND q.status = #{status} " +
"</if> " +
"<if test='startDate != null'> " +
" AND q.queue_time &gt;= #{startDate} " +
"</if> " +
"<if test='endDate != null'> " +
" AND q.queue_time &lt;= #{endDate} " +
"</if> " +
"ORDER BY q.queue_time DESC" +
"</script>")
List<QueuePatientDto> selectQueueList(@Param("deptId") Long deptId,
@Param("status") String status,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
}

View File

@@ -1,21 +1,19 @@
package com.openhis.application.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.openhis.application.domain.dto.QueueQueryDto;
import com.openhis.application.domain.dto.QueuePatientDto;
import com.openhis.application.mapper.TriageQueueMapper;
import com.openhis.application.service.TriageQueueService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
/**
* 智能分诊排队业务实现
* 修复 Bug #544移除完诊状态硬编码过滤增加历史队列时间范围查询支持
* 分诊队列业务实现
*
* 修复 Bug #544
* - 透传 status 参数,不再在服务层拦截“完诊”状态
* - 支持按时间范围查询历史队列
*/
@Service
public class TriageQueueServiceImpl implements TriageQueueService {
@@ -27,21 +25,8 @@ public class TriageQueueServiceImpl implements TriageQueueService {
}
@Override
public PageInfo<QueuePatientDto> queryQueueList(QueueQueryDto queryDto) {
// 修复 Bug #544默认查询当天支持历史时间范围检索
if (!StringUtils.hasText(queryDto.getStartDate())) {
queryDto.setStartDate(LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE));
}
if (!StringUtils.hasText(queryDto.getEndDate())) {
queryDto.setEndDate(LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE));
}
PageHelper.startPage(queryDto.getPageNum() != null ? queryDto.getPageNum() : 1,
queryDto.getPageSize() != null ? queryDto.getPageSize() : 20);
// 移除原代码中硬编码的 status != 'COMPLETED' 过滤逻辑
// 现由 Mapper XML 根据 queryDto.status 动态过滤,若为空则查询全量状态(含完诊)
List<QueuePatientDto> list = queueMapper.selectQueueList(queryDto);
return new PageInfo<>(list);
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);
}
}