Fix Bug #544: AI修复
This commit is contained in:
@@ -1,16 +1,13 @@
|
||||
package com.openhis.web.triage.controller;
|
||||
|
||||
import com.openhis.web.triage.service.TriageQueueService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 智能分诊队列接口控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/triage/queue")
|
||||
public class TriageQueueController {
|
||||
@@ -23,14 +20,18 @@ public class TriageQueueController {
|
||||
|
||||
/**
|
||||
* 获取排队队列列表
|
||||
* @param deptId 科室ID
|
||||
* @param startDate 查询开始日期 (可选)
|
||||
* @param endDate 查询结束日期 (可选)
|
||||
* 修复 Bug #544:支持按状态筛选(含完诊),支持按日期范围查询历史队列,默认查询当天
|
||||
*/
|
||||
@GetMapping
|
||||
public List<Map<String, Object>> getQueueList(@RequestParam Long deptId,
|
||||
@RequestParam(required = false) String startDate,
|
||||
@RequestParam(required = false) String endDate) {
|
||||
return triageQueueService.getQueueList(deptId, startDate, endDate);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,33 +2,17 @@ package com.openhis.web.triage.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 智能分诊队列数据访问层
|
||||
* 修复 Bug #544:移除原 SQL 中对“完诊”状态的过滤,新增日期范围动态查询支持。
|
||||
*/
|
||||
@Mapper
|
||||
public interface TriageQueueMapper {
|
||||
|
||||
/**
|
||||
* 查询分诊队列列表(含历史数据)
|
||||
* @param deptId 科室ID
|
||||
* @param startDate 开始日期 (YYYY-MM-DD)
|
||||
* @param endDate 结束日期 (YYYY-MM-DD)
|
||||
* @return 队列记录列表
|
||||
* 动态查询排队队列
|
||||
*/
|
||||
@Select("<script>" +
|
||||
"SELECT id, patient_name, queue_no, status, triage_time, dept_name " +
|
||||
"FROM his_triage_queue " +
|
||||
"WHERE dept_id = #{deptId} " +
|
||||
"<if test='startDate != null'> AND triage_time >= #{startDate}::timestamp </if>" +
|
||||
"<if test='endDate != null'> AND triage_time <= #{endDate}::timestamp + interval '1 day' </if>" +
|
||||
"ORDER BY triage_time DESC" +
|
||||
"</script>")
|
||||
List<Map<String, Object>> selectQueueList(@Param("deptId") Long deptId,
|
||||
@Param("startDate") String startDate,
|
||||
@Param("endDate") String endDate);
|
||||
List<Map<String, Object>> selectQueueList(@Param("status") String status,
|
||||
@Param("startDate") LocalDate startDate,
|
||||
@Param("endDate") LocalDate endDate);
|
||||
}
|
||||
|
||||
@@ -1,26 +1,16 @@
|
||||
package com.openhis.web.triage.service;
|
||||
|
||||
import com.openhis.web.triage.mapper.TriageQueueMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 智能分诊队列业务逻辑层
|
||||
*/
|
||||
@Service
|
||||
public class TriageQueueService {
|
||||
|
||||
private final TriageQueueMapper triageQueueMapper;
|
||||
|
||||
public TriageQueueService(TriageQueueMapper triageQueueMapper) {
|
||||
this.triageQueueMapper = triageQueueMapper;
|
||||
}
|
||||
|
||||
public interface TriageQueueService {
|
||||
/**
|
||||
* 获取队列列表(支持按日期范围检索,默认返回全量状态)
|
||||
* 查询排队队列列表
|
||||
* @param status 排队状态(可选,传空则查全部)
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 队列数据列表
|
||||
*/
|
||||
public List<Map<String, Object>> getQueueList(Long deptId, String startDate, String endDate) {
|
||||
return triageQueueMapper.selectQueueList(deptId, startDate, endDate);
|
||||
}
|
||||
List<Map<String, Object>> queryQueueList(String status, LocalDate startDate, LocalDate endDate);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.openhis.web.triage.service.impl;
|
||||
|
||||
import com.openhis.web.triage.mapper.TriageQueueMapper;
|
||||
import com.openhis.web.triage.service.TriageQueueService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class TriageQueueServiceImpl implements TriageQueueService {
|
||||
|
||||
private final TriageQueueMapper triageQueueMapper;
|
||||
|
||||
public TriageQueueServiceImpl(TriageQueueMapper triageQueueMapper) {
|
||||
this.triageQueueMapper = triageQueueMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> queryQueueList(String status, LocalDate startDate, LocalDate endDate) {
|
||||
// 修复 Bug #544:移除原逻辑中对“完诊”状态的隐式过滤,交由 SQL 动态条件处理
|
||||
return triageQueueMapper.selectQueueList(status, startDate, endDate);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.openhis.web.triage.mapper.TriageQueueMapper">
|
||||
|
||||
<!-- 修复 Bug #544:原 SQL 存在硬编码过滤 AND queue_status != '完诊',已彻底移除 -->
|
||||
<select id="selectQueueList" resultType="java.util.Map">
|
||||
SELECT
|
||||
id,
|
||||
patient_name AS patientName,
|
||||
dept_name AS deptName,
|
||||
doctor_name AS doctorName,
|
||||
queue_status AS queueStatus,
|
||||
triage_time AS triageTime
|
||||
FROM triage_queue
|
||||
WHERE 1=1
|
||||
<if test="status != null and status != ''">
|
||||
AND queue_status = #{status}
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
AND triage_time >= #{startDate}::timestamp
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND triage_time <= #{endDate}::timestamp + interval '1 day'
|
||||
</if>
|
||||
ORDER BY triage_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user