Fix Bug #544: AI修复

This commit is contained in:
2026-05-27 02:46:26 +08:00
parent 20ec3e30fc
commit bf1438dbbe
5 changed files with 170 additions and 82 deletions

View File

@@ -7,26 +7,21 @@ import java.util.List;
import java.util.Map;
/**
* 智能分诊排队管理控制器
*
* 修复 Bug #544
* 开放 startDate/endDate 请求参数接收,解除前端历史查询限制。
* 智能分诊排队控制器
* 修复 Bug #544开放 status、startTime、endTime 查询参数。
*/
@RestController
@RequestMapping("/triage/queue")
@RequestMapping("/api/triage/queue")
public class TriageQueueController {
@Autowired
private TriageQueueService triageQueueService;
/**
* 获取排队队列列表
*/
@GetMapping("/list")
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 triageQueueService.getQueueList(deptId, status, startDate, endDate);
public List<Map<String, Object>> list(@RequestParam Long deptId,
@RequestParam(required = false) Integer status,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime) {
return triageQueueService.getQueueList(deptId, status, startTime, endTime);
}
}

View File

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

View File

@@ -3,17 +3,12 @@ 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;
/**
* 智能分诊排队业务服务
*
* 修复 Bug #544
* 补充时间范围默认值逻辑(默认当天),透传至 Mapper 实现历史查询。
* 修复 Bug #544透传状态与时间参数不再在服务层拦截完诊状态。
*/
@Service
public class TriageQueueService {
@@ -21,25 +16,10 @@ public class TriageQueueService {
@Autowired
private TriageQueueMapper triageQueueMapper;
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
/**
* 获取排队队列列表
*
* @param deptId 科室ID
* @param status 状态筛选
* @param startDate 开始时间
* @param endDate 结束时间
* @return 队列数据
*/
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);
public List<Map<String, Object>> getQueueList(Long deptId, Integer status, String startTime, String endTime) {
return triageQueueMapper.selectQueueList(deptId, status, startTime, endTime);
}
}