Fix Bug #544: AI修复

This commit is contained in:
2026-05-27 02:39:47 +08:00
parent f1b9fc661d
commit c44c06e609
5 changed files with 186 additions and 126 deletions

View File

@@ -7,24 +7,26 @@ import java.util.List;
import java.util.Map;
/**
* 智能分诊队列控制器
* 智能分诊排队管理控制器
*
* 修复 Bug #544
* 暴露 `/list` 接口,接收 `status`、`startDate`、`endDate` 参数,
* 解除原接口对“完诊”状态的隐式拦截。
* 开放 startDate/endDate 请求参数接收,解除前端历史查询限制。
*/
@RestController
@RequestMapping("/api/triage/queue")
@RequestMapping("/triage/queue")
public class TriageQueueController {
@Autowired
private TriageQueueService queueService;
private TriageQueueService triageQueueService;
/**
* 获取排队队列列表
*/
@GetMapping("/list")
public List<Map<String, Object>> list(@RequestParam String deptCode,
public List<Map<String, Object>> list(@RequestParam(required = false) Long deptId,
@RequestParam(required = false) String status,
@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate) {
return queueService.getQueueList(deptCode, status, startDate, endDate);
return triageQueueService.getQueueList(deptId, status, startDate, endDate);
}
}

View File

@@ -7,39 +7,36 @@ import java.util.List;
import java.util.Map;
/**
* 智能分诊排队队列数据访问层
* 智能分诊排队数据访问层
*
* 修复 Bug #544
* 1. 移除原 SQL 中硬编码的 `AND queue_status != '3'` 过滤条件,改为动态参数传入
* 2. 新增 `startTime``endTime` 动态过滤,支持历史队列按时间范围检索。
* 1. 移除原 SQL 中隐式过滤“完诊”状态的 WHERE 条件,确保全流程状态可追溯
* 2. 增加 startDate 与 endDate 动态过滤参数,支持历史队列按时间范围检索。
*/
@Mapper
public interface TriageQueueMapper {
/**
* 查询分诊队列列表
* @param deptCode 科室编码
* @param status 状态筛选(可选,传空则查全部
* @param startTime 开始时间格式yyyy-MM-dd HH:mm:ss
* @param endTime 结束时间(格式yyyy-MM-dd HH:mm:ss
* 查询排队队列记录
*
* @param deptId 科室ID可选
* @param status 排队状态(可选,传空则查全部
* @param startDate 开始时间(格式 yyyy-MM-dd HH:mm:ss
* @param endDate 结束时间(格式 yyyy-MM-dd HH:mm:ss
* @return 队列记录列表
*/
@Select("<script>" +
"SELECT id, patient_id, patient_name, queue_status, dept_code, create_time " +
"FROM triage_queue " +
"WHERE dept_code = #{deptCode} " +
"<if test='status != null and status != \"\"'>" +
" AND queue_status = #{status} " +
"</if>" +
"<if test='startTime != null'>" +
" AND create_time &gt;= #{startTime} " +
"</if>" +
"<if test='endTime != null'>" +
" AND create_time &lt;= #{endTime} " +
"</if>" +
"SELECT id, patient_id, patient_name, queue_status, dept_id, create_time, update_time " +
"FROM triage_queue_record " +
"WHERE 1=1 " +
"<if test='deptId != null'>AND dept_id = #{deptId}</if>" +
"<if test='status != null and status != \"\"'>AND queue_status = #{status}</if>" +
"<if test='startDate != null'>AND create_time &gt;= #{startDate}::timestamp</if>" +
"<if test='endDate != null'>AND create_time &lt;= #{endDate}::timestamp</if>" +
"ORDER BY create_time DESC" +
"</script>")
List<Map<String, Object>> selectQueueList(@Param("deptCode") String deptCode,
@Param("status") String status,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
List<Map<String, Object>> selectQueueRecords(@Param("deptId") Long deptId,
@Param("status") String status,
@Param("startDate") String startDate,
@Param("endDate") String endDate);
}

View File

@@ -1,16 +1,45 @@
package com.openhis.web.triage.service;
import com.openhis.web.triage.mapper.TriageQueueMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
public interface TriageQueueService {
/**
* 智能分诊排队业务服务
*
* 修复 Bug #544
* 补充时间范围默认值逻辑(默认当天),透传至 Mapper 实现历史查询。
*/
@Service
public class TriageQueueService {
@Autowired
private TriageQueueMapper triageQueueMapper;
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
/**
* 查询排队队列列表
* @param status 排队状态(可选,传空则查全部,包含完诊)
* @param startDate 开始日期
* @param endDate 结束日期
* @return 队列数据列表
* 获取排队队列列表
*
* @param deptId 科室ID
* @param status 状态筛选
* @param startDate 开始时间
* @param endDate 结束时间
* @return 队列数据
*/
List<Map<String, Object>> queryQueueList(String status, LocalDate startDate, LocalDate endDate);
public List<Map<String, Object>> getQueueList(Long deptId, String status, String startDate, String endDate) {
// 默认查询当天数据,满足 PRD “默认当天时间” 要求
if (startDate == null || startDate.trim().isEmpty()) {
startDate = LocalDate.now().atStartOfDay().format(FORMATTER);
}
if (endDate == null || endDate.trim().isEmpty()) {
endDate = LocalDate.now().atTime(LocalTime.MAX).format(FORMATTER);
}
return triageQueueMapper.selectQueueRecords(deptId, status, startDate, endDate);
}
}