Fix Bug #544: AI修复
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
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.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 智能分诊排队记录数据库操作 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface TriageQueueMapper {
|
||||
|
||||
/**
|
||||
* Bug #544 Fix: 修复队列列表过滤完诊状态及缺失历史查询问题
|
||||
* 根因:原 SQL 硬编码 status IN (1,2,3) 导致完诊(4)被过滤;且无时间范围参数
|
||||
* 修复:
|
||||
* 1. 移除状态硬编码,改为动态 <if test='status != null'> 条件,支持全状态查询
|
||||
* 2. 增加 startDate/endDate 动态过滤,支持历史队列追溯
|
||||
* 3. 默认按排队时间倒序,符合护士站操作习惯
|
||||
*/
|
||||
@Select("<script>" +
|
||||
"SELECT id, patient_id, patient_name, status, queue_time, dept_id, dept_name, create_time " +
|
||||
"FROM triage_queue_record " +
|
||||
"WHERE dept_id = #{deptId} " +
|
||||
"<if test='status != null'> AND status = #{status} </if>" +
|
||||
"<if test='startDate != null'> AND create_time >= #{startDate} </if>" +
|
||||
"<if test='endDate != null'> AND create_time <= #{endDate} </if>" +
|
||||
"ORDER BY queue_time DESC" +
|
||||
"</script>")
|
||||
List<Map<String, Object>> selectQueueRecords(@Param("deptId") Long deptId,
|
||||
@Param("status") Integer status,
|
||||
@Param("startDate") String startDate,
|
||||
@Param("endDate") String endDate);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.openhis.web.triage.service;
|
||||
|
||||
import com.openhis.web.triage.mapper.TriageQueueMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bug #544 Fix: 默认时间范围设为当天,支持历史查询
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getQueueRecords(Long deptId, Integer status, String startDate, String endDate) {
|
||||
// 默认查询当天数据,满足 Expected Behavior 2
|
||||
String start = startDate != null ? startDate : LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE) + " 00:00:00";
|
||||
String end = endDate != null ? endDate : LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE) + " 23:59:59";
|
||||
return triageQueueMapper.selectQueueRecords(deptId, status, start, end);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user