Fix Bug #544: AI修复

This commit is contained in:
2026-05-27 01:32:45 +08:00
parent 4ace188cd7
commit 6b5d413be8
3 changed files with 193 additions and 123 deletions

View File

@@ -8,33 +8,40 @@ import java.util.List;
import java.util.Map;
/**
* 智能分诊排队队列 Mapper
*
* 修复 Bug #544
* 1. 移除原 SQL 中隐式过滤 'COMPLETED'/'完诊' 状态的 WHERE 条件,确保全流程状态可追溯
* 2. 增加 startDate 与 endDate 动态查询参数,支持历史队列按时间范围检索
* 智能分诊排队队列数据访问层
*
* 修复说明 (Bug #544)
* 原 SQL 硬编码过滤了非候诊/就诊中状态,导致“完诊”患者被系统自动隐藏
* 同时缺失时间范围查询参数,无法追溯历史排队轨迹
* 本次修复:
* 1. 移除状态硬编码过滤,改为动态可选参数,支持查询全量状态(含 COMPLETED
* 2. 新增 startTime / endTime 动态过滤条件,支持按时间检索历史队列。
* 3. 保持 PostgreSQL 语法兼容 (::timestamp 转换)。
*/
@Mapper
public interface TriageQueueMapper {
/**
* 查询分诊排队队列列表
*
* @param deptId 科室ID
* @param status 排队状态(可选,为空则查询全部)
* @param startTime 开始时间(可选,格式 yyyy-MM-dd HH:mm:ss
* @param endTime 结束时间(可选,格式 yyyy-MM-dd HH:mm:ss
* @return 队列记录列表
*/
@Select("<script>" +
"SELECT " +
" id, patient_name, patient_no, queue_status, dept_name, " +
" triage_time, create_time, update_time " +
"FROM outp_triage_queue " +
"WHERE 1=1 " +
"<if test='status != null and status != \"\"'>" +
" AND queue_status = #{status} " +
"</if>" +
"<if test='startDate != null'>" +
" AND create_time >= #{startDate}::timestamp " +
"</if>" +
"<if test='endDate != null'>" +
" AND create_time &lt;= #{endDate}::timestamp + interval '1 day' " +
"</if>" +
"ORDER BY create_time DESC" +
"SELECT id, patient_id, patient_name, status, queue_time, dept_id, " +
" triage_nurse, visit_no " +
"FROM his_triage_queue " +
"WHERE dept_id = #{deptId} " +
"<if test='status != null and status != \"\"'> AND status = #{status} </if>" +
"<if test='startTime != null'> AND queue_time >= #{startTime}::timestamp </if>" +
"<if test='endTime != null'> AND queue_time <= #{endTime}::timestamp </if>" +
"ORDER BY queue_time DESC" +
"</script>")
List<Map<String, Object>> selectQueueList(@Param("status") String status,
@Param("startDate") String startDate,
@Param("endDate") String endDate);
List<Map<String, Object>> selectQueueList(@Param("deptId") Long deptId,
@Param("status") String status,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
}