Fix Bug #544: AI修复
This commit is contained in:
@@ -1,37 +1,30 @@
|
||||
package com.openhis.web.triage.controller;
|
||||
|
||||
import com.openhis.web.triage.service.TriageQueueService;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 智能分诊队列控制器
|
||||
*
|
||||
* 修复 Bug #544:
|
||||
* 暴露 `/list` 接口,接收 `status`、`startDate`、`endDate` 参数,
|
||||
* 解除原接口对“完诊”状态的隐式拦截。
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/triage/queue")
|
||||
public class TriageQueueController {
|
||||
|
||||
private final TriageQueueService triageQueueService;
|
||||
@Autowired
|
||||
private TriageQueueService queueService;
|
||||
|
||||
public TriageQueueController(TriageQueueService triageQueueService) {
|
||||
this.triageQueueService = triageQueueService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取排队队列列表
|
||||
* 修复 Bug #544:支持按状态筛选(含完诊),支持按日期范围查询历史队列,默认查询当天
|
||||
*/
|
||||
@GetMapping
|
||||
public List<Map<String, Object>> getQueueList(
|
||||
@RequestParam(required = false) String status,
|
||||
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate startDate,
|
||||
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate endDate) {
|
||||
|
||||
// 默认查询当天数据
|
||||
if (startDate == null) startDate = LocalDate.now();
|
||||
if (endDate == null) endDate = LocalDate.now();
|
||||
|
||||
return triageQueueService.queryQueueList(status, startDate, endDate);
|
||||
@GetMapping("/list")
|
||||
public List<Map<String, Object>> list(@RequestParam String deptCode,
|
||||
@RequestParam(required = false) String status,
|
||||
@RequestParam(required = false) String startDate,
|
||||
@RequestParam(required = false) String endDate) {
|
||||
return queueService.getQueueList(deptCode, status, startDate, endDate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,41 +7,39 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 智能分诊排队数据访问层
|
||||
* 智能分诊排队队列数据访问层
|
||||
*
|
||||
* 修复 Bug #544:
|
||||
* - 移除原 SQL 中硬编码的 status != 'COMPLETED' 过滤条件,改为支持按状态动态筛选。
|
||||
* - 新增 startDate/endDate 参数,支持按时间范围检索历史队列。
|
||||
* 1. 移除原 SQL 中硬编码的 `AND queue_status != '3'` 过滤条件,改为动态参数传入。
|
||||
* 2. 新增 `startTime` 与 `endTime` 动态过滤,支持历史队列按时间范围检索。
|
||||
*/
|
||||
@Mapper
|
||||
public interface TriageQueueMapper {
|
||||
|
||||
/**
|
||||
* 查询排队队列列表(含历史)
|
||||
*
|
||||
* @param deptId 科室ID
|
||||
* @param status 排队状态(可选,为空则查全部)
|
||||
* @param startDate 开始时间(格式 YYYY-MM-DD)
|
||||
* @param endDate 结束时间(格式 YYYY-MM-DD)
|
||||
* @return 队列记录列表
|
||||
* 查询分诊队列列表
|
||||
* @param deptCode 科室编码
|
||||
* @param status 状态筛选(可选,传空则查全部)
|
||||
* @param startTime 开始时间(格式:yyyy-MM-dd HH:mm:ss)
|
||||
* @param endTime 结束时间(格式:yyyy-MM-dd HH:mm:ss)
|
||||
*/
|
||||
@Select("<script>" +
|
||||
"SELECT id, patient_id, patient_name, status, queue_time, dept_id " +
|
||||
"FROM his_triage_queue " +
|
||||
"WHERE dept_id = #{deptId} " +
|
||||
"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 status = #{status} " +
|
||||
" AND queue_status = #{status} " +
|
||||
"</if>" +
|
||||
"<if test='startDate != null'>" +
|
||||
" AND queue_time >= #{startDate}::timestamp " +
|
||||
"<if test='startTime != null'>" +
|
||||
" AND create_time >= #{startTime} " +
|
||||
"</if>" +
|
||||
"<if test='endDate != null'>" +
|
||||
" AND queue_time <= (#{endDate} || ' 23:59:59')::timestamp " +
|
||||
"<if test='endTime != null'>" +
|
||||
" AND create_time <= #{endTime} " +
|
||||
"</if>" +
|
||||
"ORDER BY queue_time DESC" +
|
||||
"ORDER BY create_time DESC" +
|
||||
"</script>")
|
||||
List<Map<String, Object>> selectQueueList(@Param("deptId") Long deptId,
|
||||
List<Map<String, Object>> selectQueueList(@Param("deptCode") String deptCode,
|
||||
@Param("status") String status,
|
||||
@Param("startDate") String startDate,
|
||||
@Param("endDate") String endDate);
|
||||
@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime);
|
||||
}
|
||||
|
||||
@@ -2,26 +2,36 @@ package com.openhis.web.triage.service.impl;
|
||||
|
||||
import com.openhis.web.triage.mapper.TriageQueueMapper;
|
||||
import com.openhis.web.triage.service.TriageQueueService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 智能分诊排队业务实现
|
||||
*
|
||||
* 修复 Bug #544:透传日期范围参数至 Mapper,支持历史队列按时间检索。
|
||||
* 修复 Bug #544:
|
||||
* 补充默认时间范围逻辑(默认当天 00:00:00 ~ 23:59:59),
|
||||
* 确保前端未传参时仍返回当日完整队列(含完诊)。
|
||||
*/
|
||||
@Service
|
||||
public class TriageQueueServiceImpl implements TriageQueueService {
|
||||
|
||||
private final TriageQueueMapper triageQueueMapper;
|
||||
|
||||
public TriageQueueServiceImpl(TriageQueueMapper triageQueueMapper) {
|
||||
this.triageQueueMapper = triageQueueMapper;
|
||||
}
|
||||
@Autowired
|
||||
private TriageQueueMapper queueMapper;
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getQueueList(Long deptId, String status, String startDate, String endDate) {
|
||||
return triageQueueMapper.selectQueueList(deptId, status, startDate, endDate);
|
||||
public List<Map<String, Object>> getQueueList(String deptCode, String status, String startDate, String endDate) {
|
||||
// 默认查询当天数据,满足“默认当天时间”需求
|
||||
String start = (startDate != null && !startDate.isEmpty())
|
||||
? startDate + " 00:00:00"
|
||||
: LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE) + " 00:00:00";
|
||||
String end = (endDate != null && !endDate.isEmpty())
|
||||
? endDate + " 23:59:59"
|
||||
: LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE) + " 23:59:59";
|
||||
|
||||
return queueMapper.selectQueueList(deptCode, status, start, end);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user