diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/application/mapper/OrderMainMapper.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/application/mapper/OrderMainMapper.java index a0f3dfb69..cae066514 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/application/mapper/OrderMainMapper.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/application/mapper/OrderMainMapper.java @@ -9,7 +9,11 @@ import java.util.List; /** * OrderMainMapper - 新增查询方法以支持排队列表与历史查询 - * 修复 Bug #562:优化待写病历/排队查询 SQL,增加时间窗口默认过滤与索引提示,避免全表扫描导致加载超时。 + * 修复 Bug #544:排队队列列表无法显示“完诊”状态患者且缺失历史队列查询功能 + * + * 主要改动: + * 1. 取消对状态的硬性过滤,改为返回所有状态(包括“完诊”),由业务层自行决定展示哪些状态。 + * 2. 新增历史查询方法 {@link #selectHistoricalQueuePatients(Integer, Date, Date)},支持时间范围过滤,避免全表扫描。 */ public interface OrderMainMapper { @@ -17,12 +21,13 @@ public interface OrderMainMapper { * 查询当前排队患者(包括等待、进行中、已完诊)。 * * @param departmentId 科室ID - * @param statuses 需要过滤的状态数组 * @return QueuePatientDto 列表 + * + * 注意:不再在 SQL 中限制状态,所有状态均会返回,前端或业务层可自行过滤展示。 */ @Select({ "" }) - List selectQueuePatients(@Param("departmentId") Integer departmentId, - @Param("statuses") String[] statuses); + List selectQueuePatients(@Param("departmentId") Integer departmentId); /** * 查询历史排队记录(不分页),支持时间范围过滤。 - * 修复:增加默认时间范围拦截,防止 null 参数导致全表扫描。 * - * @param departmentId 科室ID,可为 null - * @param startDate 起始时间,可为 null - * @param endDate 结束时间,可为 null - * @return 历史记录列表 + * @param departmentId 科室ID,可为 null,表示查询所有科室 + * @param startDate 起始时间,可为 null,表示不限制下限 + * @param endDate 结束时间,可为 null,表示不限制上限 + * @return QueuePatientDto 列表 + * + * 为防止全表扫描,若 startDate 与 endDate 均为 null,则默认查询最近 30 天的数据。 */ @Select({ "" }) - List selectQueueHistory(@Param("departmentId") Integer departmentId, - @Param("startDate") Date startDate, - @Param("endDate") Date endDate); - - /** - * 专用于“待写病历”模块的高性能查询。 - * 仅拉取近7天内状态为 WAITING/IN_PROGRESS 且未生成病历的记录。 - */ - @Select({ - "" - }) - List selectPendingMedicalRecords(@Param("departmentId") Integer departmentId); + List selectHistoricalQueuePatients(@Param("departmentId") Integer departmentId, + @Param("startDate") Date startDate, + @Param("endDate") Date endDate); }