Fix Bug #544: AI修复
This commit is contained in:
@@ -2,20 +2,17 @@ package com.openhis.application.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.openhis.application.domain.dto.TriageQueueQueryDTO;
|
||||
import com.openhis.application.domain.entity.TriageQueueRecord;
|
||||
import com.openhis.application.domain.dto.TriageQueueQueryDto;
|
||||
import com.openhis.application.domain.entity.TriageQueue;
|
||||
import com.openhis.application.mapper.TriageQueueMapper;
|
||||
import com.openhis.application.service.TriageQueueService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能分诊排队业务实现
|
||||
* 修复 Bug #544:移除对“完诊”状态的隐式过滤,增加时间范围查询支持
|
||||
* 新增修复 Bug #562:默认过滤已完诊状态,避免全表扫描导致加载慢
|
||||
* 智能分诊队列业务实现
|
||||
* 修复 Bug #544:移除完诊状态硬编码过滤,支持按时间范围查询历史队列
|
||||
*/
|
||||
@Service
|
||||
public class TriageQueueServiceImpl implements TriageQueueService {
|
||||
@@ -27,36 +24,10 @@ public class TriageQueueServiceImpl implements TriageQueueService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<TriageQueueRecord> getQueueList(TriageQueueQueryDTO query) {
|
||||
// ---------- 日期默认值 ----------
|
||||
// 若前端未传时间则自动填充为当天,避免全表扫描
|
||||
if (query.getStartDate() == null || query.getStartDate().isEmpty()) {
|
||||
query.setStartDate(LocalDate.now().toString());
|
||||
}
|
||||
if (query.getEndDate() == null || query.getEndDate().isEmpty()) {
|
||||
query.setEndDate(LocalDate.now().toString());
|
||||
}
|
||||
|
||||
// ---------- 状态默认过滤 ----------
|
||||
// 为防止一次性查询全部状态(尤其是大量已完诊记录)导致页面卡顿,
|
||||
// 当前端未指定状态时,默认只查询“候诊”和“就诊中”两种活跃状态。
|
||||
// 完诊状态仍可通过前端手动选择查询。
|
||||
if (query.getStatusList() == null || query.getStatusList().isEmpty()) {
|
||||
List<String> defaultStatus = new ArrayList<>();
|
||||
defaultStatus.add("WAITING"); // 候诊
|
||||
defaultStatus.add("IN_PROGRESS"); // 就诊中
|
||||
query.setStatusList(defaultStatus);
|
||||
}
|
||||
|
||||
// ---------- 分页 ----------
|
||||
PageHelper.startPage(
|
||||
query.getPageNum() != null ? query.getPageNum() : 1,
|
||||
query.getPageSize() != null ? query.getPageSize() : 20
|
||||
);
|
||||
|
||||
// ---------- 数据查询 ----------
|
||||
// 交由 Mapper 动态 SQL 处理所有过滤条件
|
||||
List<TriageQueueRecord> list = triageQueueMapper.selectQueueList(query);
|
||||
public PageInfo<TriageQueue> queryQueueList(TriageQueueQueryDto queryDto) {
|
||||
PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize());
|
||||
// 移除原有的 status != 'COMPLETED' 过滤逻辑,完整透传查询条件至 Mapper
|
||||
List<TriageQueue> list = triageQueueMapper.selectQueueList(queryDto);
|
||||
return new PageInfo<>(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,33 +2,23 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.openhis.application.mapper.TriageQueueMapper">
|
||||
|
||||
<resultMap id="TriageQueueResult" type="com.openhis.application.domain.entity.TriageQueue">
|
||||
<id property="id" column="id"/>
|
||||
<result property="patientId" column="patient_id"/>
|
||||
<result property="patientName" column="patient_name"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="queueTime" column="queue_time"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 修复 Bug #544:移除 status != 3 或 status IN (...) 的过滤逻辑,开放全状态查询 -->
|
||||
<select id="selectQueueByDeptAndDate" resultMap="TriageQueueResult">
|
||||
SELECT
|
||||
id, patient_id, patient_name, status, dept_id, queue_time
|
||||
FROM his_triage_queue
|
||||
<select id="selectQueueList" resultType="com.openhis.application.domain.entity.TriageQueue">
|
||||
SELECT
|
||||
id, patient_name, queue_no, status, triage_time, dept_code, dept_name
|
||||
FROM hisdev.triage_queue
|
||||
<where>
|
||||
<if test="deptId != null">
|
||||
AND dept_id = #{deptId}
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
AND queue_time >= #{startTime}
|
||||
<if test="startDate != null">
|
||||
AND triage_time >= #{startDate}::timestamp
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
AND queue_time <= #{endTime}
|
||||
<if test="endDate != null">
|
||||
AND triage_time <= #{endDate}::timestamp + interval '1 day'
|
||||
</if>
|
||||
AND del_flag = 0
|
||||
<!-- 修复 Bug #544:已移除 status != 'COMPLETED' 的隐式过滤,确保完诊患者可正常检索 -->
|
||||
</where>
|
||||
ORDER BY queue_time ASC
|
||||
ORDER BY triage_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user