Fix Bug #544: fallback修复
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.openhis.application.controller;
|
||||
|
||||
import com.openhis.application.domain.entity.QueueInfo;
|
||||
import com.openhis.application.service.QueueService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能分诊排队接口
|
||||
*
|
||||
* 新增:
|
||||
* - /api/queue/current 返回当前排队(包括完诊);
|
||||
* - /api/queue/history 返回历史排队记录(完诊、已取消)。
|
||||
*
|
||||
* 修复 Bug #544。
|
||||
*/
|
||||
@RestController
|
||||
public class QueueController {
|
||||
|
||||
private final QueueService queueService;
|
||||
|
||||
public QueueController(QueueService queueService) {
|
||||
this.queueService = queueService;
|
||||
}
|
||||
|
||||
@GetMapping("/api/queue/current")
|
||||
public List<QueueInfo> getCurrentQueue(@RequestParam(required = false) Long departmentId) {
|
||||
return queueService.getCurrentQueue(departmentId);
|
||||
}
|
||||
|
||||
@GetMapping("/api/queue/history")
|
||||
public List<QueueInfo> getHistoryQueue(@RequestParam(required = false) Long departmentId,
|
||||
@RequestParam(required = false) Date startTime,
|
||||
@RequestParam(required = false) Date endTime) {
|
||||
return queueService.getHistoryQueue(departmentId, startTime, endTime);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.openhis.application.mapper;
|
||||
|
||||
import com.openhis.application.domain.entity.QueueInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能分诊排队队列数据访问层
|
||||
*
|
||||
* 修复 Bug #544:
|
||||
* 1. 在查询当前排队列表时,加入对 “完诊”(status = 'FINISHED') 状态患者的展示;
|
||||
* 2. 新增历史队列查询接口,用于查询已完成或已取消的排队记录。
|
||||
*/
|
||||
public interface QueueMapper {
|
||||
|
||||
/**
|
||||
* 查询当前排队列表(包括待诊、已诊、完诊)。
|
||||
*
|
||||
* @param departmentId 科室ID(可为空,表示查询全部)
|
||||
* @return 当前排队的患者列表
|
||||
*/
|
||||
@Select("<script>" +
|
||||
"SELECT q.* FROM adm_queue_info q " +
|
||||
"WHERE 1=1 " +
|
||||
"<if test='departmentId != null'> AND q.department_id = #{departmentId}</if> " +
|
||||
// 原来的实现只过滤 status IN ('WAIT','DIAGNOSE'),现在加入 'FINISHED'
|
||||
"AND q.status IN ('WAIT','DIAGNOSE','FINISHED') " +
|
||||
"ORDER BY q.queue_no ASC" +
|
||||
"</script>")
|
||||
List<QueueInfo> selectCurrentQueue(@Param("departmentId") Long departmentId);
|
||||
|
||||
/**
|
||||
* 查询历史排队记录(已完成或已取消)。
|
||||
*
|
||||
* @param departmentId 科室ID(可为空)
|
||||
* @param startTime 起始时间(可为空)
|
||||
* @param endTime 结束时间(可为空)
|
||||
* @return 符合条件的历史排队记录
|
||||
*/
|
||||
@Select("<script>" +
|
||||
"SELECT q.* FROM adm_queue_info q " +
|
||||
"WHERE q.status IN ('FINISHED','CANCELLED') " +
|
||||
"<if test='departmentId != null'> AND q.department_id = #{departmentId}</if> " +
|
||||
"<if test='startTime != null'> AND q.create_time >= #{startTime}</if> " +
|
||||
"<if test='endTime != null'> AND q.create_time <= #{endTime}</if> " +
|
||||
"ORDER BY q.create_time DESC" +
|
||||
"</script>")
|
||||
List<QueueInfo> selectHistoryQueue(@Param("departmentId") Long departmentId,
|
||||
@Param("startTime") java.util.Date startTime,
|
||||
@Param("endTime") java.util.Date endTime);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.openhis.application.service;
|
||||
|
||||
import com.openhis.application.domain.entity.QueueInfo;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能分诊排队业务接口
|
||||
*
|
||||
* 包含当前排队查询(已修复显示完诊)以及历史排队查询功能。
|
||||
*/
|
||||
public interface QueueService {
|
||||
|
||||
/**
|
||||
* 获取当前排队列表(包括 WAIT、DIAGNOSE、FINISHED)。
|
||||
*
|
||||
* @param departmentId 科室ID,可为空
|
||||
* @return 当前排队患者列表
|
||||
*/
|
||||
List<QueueInfo> getCurrentQueue(Long departmentId);
|
||||
|
||||
/**
|
||||
* 获取历史排队记录(已完成或已取消)。
|
||||
*
|
||||
* @param departmentId 科室ID,可为空
|
||||
* @param startTime 起始时间,可为空
|
||||
* @param endTime 结束时间,可为空
|
||||
* @return 符合条件的历史排队记录
|
||||
*/
|
||||
List<QueueInfo> getHistoryQueue(Long departmentId, Date startTime, Date endTime);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.openhis.application.service.impl;
|
||||
|
||||
import com.openhis.application.domain.entity.QueueInfo;
|
||||
import com.openhis.application.mapper.QueueMapper;
|
||||
import com.openhis.application.service.QueueService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能分诊排队服务实现
|
||||
*
|
||||
* 修复 Bug #544:
|
||||
* - 当前排队列表现在会显示 “完诊” 状态的患者;
|
||||
* - 新增历史排队查询接口供前端使用。
|
||||
*/
|
||||
@Service
|
||||
public class QueueServiceImpl implements QueueService {
|
||||
|
||||
private final QueueMapper queueMapper;
|
||||
|
||||
public QueueServiceImpl(QueueMapper queueMapper) {
|
||||
this.queueMapper = queueMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QueueInfo> getCurrentQueue(Long departmentId) {
|
||||
return queueMapper.selectCurrentQueue(departmentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QueueInfo> getHistoryQueue(Long departmentId, Date startTime, Date endTime) {
|
||||
return queueMapper.selectHistoryQueue(departmentId, startTime, endTime);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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.application.mapper.QueueMapper">
|
||||
|
||||
<!-- 查询当前排队(包括完诊) -->
|
||||
<select id="selectCurrentQueue" parameterType="map" resultType="com.openhis.application.domain.entity.QueueInfo">
|
||||
SELECT q.*
|
||||
FROM adm_queue_info q
|
||||
WHERE 1=1
|
||||
<if test="departmentId != null">
|
||||
AND q.department_id = #{departmentId}
|
||||
</if>
|
||||
AND q.status IN ('WAIT','DIAGNOSE','FINISHED')
|
||||
ORDER BY q.queue_no ASC
|
||||
</select>
|
||||
|
||||
<!-- 查询历史排队记录 -->
|
||||
<select id="selectHistoryQueue" parameterType="map" resultType="com.openhis.application.domain.entity.QueueInfo">
|
||||
SELECT q.*
|
||||
FROM adm_queue_info q
|
||||
WHERE q.status IN ('FINISHED','CANCELLED')
|
||||
<if test="departmentId != null">
|
||||
AND q.department_id = #{departmentId}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
AND q.create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
AND q.create_time <= #{endTime}
|
||||
</if>
|
||||
ORDER BY q.create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
73
openhis-ui-vue3/src/views/outpatient/doctor/QueueList.vue
Normal file
73
openhis-ui-vue3/src/views/outpatient/doctor/QueueList.vue
Normal file
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<div class="queue-list">
|
||||
<!-- 当前排队 -->
|
||||
<el-table :data="currentQueue" style="width: 100%">
|
||||
<el-table-column prop="queueNo" label="排号" width="80"/>
|
||||
<el-table-column prop="patientName" label="患者"/>
|
||||
<el-table-column prop="status" label="状态">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="statusTagType(row.status)">{{ statusLabel(row.status) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 历史排队 -->
|
||||
<el-divider>历史排队</el-divider>
|
||||
<el-table :data="historyQueue" style="width: 100%">
|
||||
<el-table-column prop="queueNo" label="排号" width="80"/>
|
||||
<el-table-column prop="patientName" label="患者"/>
|
||||
<el-table-column prop="status" label="状态">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="statusTagType(row.status)">{{ statusLabel(row.status) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="时间"/>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { useApi } from '@/utils/api';
|
||||
|
||||
const currentQueue = ref([]);
|
||||
const historyQueue = ref([]);
|
||||
|
||||
function statusLabel(status) {
|
||||
const map = {
|
||||
WAIT: '待诊',
|
||||
DIAGNOSE: '已诊',
|
||||
FINISHED: '完诊',
|
||||
CANCELLED: '已取消'
|
||||
};
|
||||
return map[status] || status;
|
||||
}
|
||||
|
||||
function statusTagType(status) {
|
||||
const map = {
|
||||
WAIT: 'info',
|
||||
DIAGNOSE: 'warning',
|
||||
FINISHED: 'success',
|
||||
CANCELLED: 'danger'
|
||||
};
|
||||
return map[status] || 'default';
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
// 当前排队(包含完诊)
|
||||
const curRes = await useApi().get('/api/queue/current');
|
||||
currentQueue.value = curRes.data;
|
||||
|
||||
// 历史排队
|
||||
const histRes = await useApi().get('/api/queue/history', {
|
||||
params: { startTime: '', endTime: '' }
|
||||
});
|
||||
historyQueue.value = histRes.data;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.queue-list {
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user