Fix Bug #544: AI修复

This commit is contained in:
2026-05-27 01:45:54 +08:00
parent 282ad2121d
commit dd565a1054
5 changed files with 254 additions and 15 deletions

View File

@@ -0,0 +1,30 @@
package com.openhis.web.outpatient.triage.controller;
import com.openhis.web.outpatient.triage.service.TriageQueueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* 智能分诊排队控制器
*
* 修复说明 (Bug #544)
* 暴露统一查询接口,接收状态与时间范围参数,支撑前端列表展示与历史查询。
*/
@RestController
@RequestMapping("/api/outpatient/triage/queue")
public class TriageQueueController {
@Autowired
private TriageQueueService queueService;
@GetMapping("/list")
public List<Map<String, Object>> getQueueList(
@RequestParam Long deptId,
@RequestParam(required = false) String status,
@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate) {
return queueService.getQueueList(deptId, status, startDate, endDate);
}
}

View File

@@ -0,0 +1,49 @@
package com.openhis.web.outpatient.triage.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
* 智能分诊排队队列数据访问层
*
* 修复说明 (Bug #544)
* 1. 移除原 SQL 中硬编码的 status != 'COMPLETED' 过滤条件,改为动态参数控制。
* 2. 新增 startDate/endDate 动态过滤,支持历史队列按时间范围检索。
*/
@Mapper
public interface TriageQueueMapper {
/**
* 查询分诊排队记录(支持状态筛选与时间范围)
*
* @param deptId 科室ID
* @param status 排队状态(为空则查询全部,含完诊)
* @param startDate 开始时间
* @param endDate 结束时间
* @return 队列记录列表
*/
@Select("<script>" +
"SELECT " +
" q.id, q.patient_id, q.patient_name, q.status, q.queue_time, " +
" q.dept_name, q.doctor_name, q.triage_nurse " +
"FROM his_triage_queue q " +
"WHERE q.dept_id = #{deptId} AND q.is_deleted = 0 " +
"<if test='status != null and status != \"\"'> " +
" AND q.status = #{status} " +
"</if>" +
"<if test='startDate != null'> " +
" AND q.queue_time &gt;= #{startDate}::timestamp " +
"</if>" +
"<if test='endDate != null'> " +
" AND q.queue_time &lt;= #{endDate}::timestamp " +
"</if>" +
"ORDER BY q.queue_time DESC" +
"</script>")
List<Map<String, Object>> selectQueueRecords(@Param("deptId") Long deptId,
@Param("status") String status,
@Param("startDate") String startDate,
@Param("endDate") String endDate);
}

View File

@@ -0,0 +1,37 @@
package com.openhis.web.outpatient.triage.service.impl;
import com.openhis.web.outpatient.triage.mapper.TriageQueueMapper;
import com.openhis.web.outpatient.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)
* 统一处理时间参数默认值,确保未传时间时自动回退至当天范围,
* 满足“历史队列查询默认当天时间”的需求。
*/
@Service
public class TriageQueueServiceImpl implements TriageQueueService {
@Autowired
private TriageQueueMapper queueMapper;
@Override
public List<Map<String, Object>> getQueueList(Long deptId, String status, String startDate, String endDate) {
// 默认查询当天数据
String today = LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
if (startDate == null || startDate.trim().isEmpty()) {
startDate = today + " 00:00:00";
}
if (endDate == null || endDate.trim().isEmpty()) {
endDate = today + " 23:59:59";
}
return queueMapper.selectQueueRecords(deptId, status, startDate, endDate);
}
}