Fix Bug #544: AI修复
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.openhis.application.service.impl;
|
||||
|
||||
import com.openhis.application.mapper.TriageQueueMapper;
|
||||
import com.openhis.application.domain.entity.TriageQueue;
|
||||
import com.openhis.application.service.TriageQueueService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class TriageQueueServiceImpl implements TriageQueueService {
|
||||
|
||||
private final TriageQueueMapper triageQueueMapper;
|
||||
|
||||
public TriageQueueServiceImpl(TriageQueueMapper triageQueueMapper) {
|
||||
this.triageQueueMapper = triageQueueMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分诊队列列表
|
||||
* 修复 Bug #544:移除原有对 status 的硬编码过滤,支持查询全量状态(含完诊);
|
||||
* 增加按日期范围查询能力,默认查询当天。
|
||||
*/
|
||||
@Override
|
||||
public List<TriageQueue> queryQueueList(Long deptId, LocalDate queryDate) {
|
||||
// 若前端未传日期,默认当天
|
||||
LocalDate targetDate = (queryDate != null) ? queryDate : LocalDate.now();
|
||||
LocalDateTime startOfDay = LocalDateTime.of(targetDate, LocalTime.MIN);
|
||||
LocalDateTime endOfDay = LocalDateTime.of(targetDate, LocalTime.MAX);
|
||||
|
||||
return triageQueueMapper.selectQueueByDeptAndDate(deptId, startOfDay, endOfDay);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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.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
|
||||
<where>
|
||||
<if test="deptId != null">
|
||||
AND dept_id = #{deptId}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
AND queue_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
AND queue_time <= #{endTime}
|
||||
</if>
|
||||
AND del_flag = 0
|
||||
</where>
|
||||
ORDER BY queue_time ASC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,100 +1,83 @@
|
||||
<template>
|
||||
<div class="smart-queue-container">
|
||||
<div class="toolbar">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
@change="handleDateChange"
|
||||
/>
|
||||
<el-button type="primary" @click="openHistoryDialog">历史队列查询</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :data="queueList" border class="queue-table">
|
||||
<el-table-column prop="patient_name" label="患者姓名" />
|
||||
<el-table-column prop="queue_no" label="排队号" />
|
||||
<el-table-column prop="queue_status" label="状态">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.queue_status === 3 ? 'success' : 'warning'">
|
||||
{{ getStatusText(row.queue_status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="triage_time" label="分诊时间" />
|
||||
</el-table>
|
||||
|
||||
<el-dialog v-model="historyVisible" title="历史队列查询" width="600px">
|
||||
<el-date-picker
|
||||
v-model="historyDateRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
<template #footer>
|
||||
<el-button @click="historyVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="queryHistory">查询</el-button>
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="header-actions">
|
||||
<span class="title">智能分诊排队管理 - {{ deptName }}</span>
|
||||
<div class="filters">
|
||||
<!-- 修复 Bug #544:新增历史队列查询入口,默认绑定当天 -->
|
||||
<el-date-picker
|
||||
v-model="queryDate"
|
||||
type="date"
|
||||
placeholder="选择查询日期"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
data-testid="queue-date-picker"
|
||||
@change="fetchQueueData"
|
||||
/>
|
||||
<el-button type="primary" @click="fetchQueueData" data-testid="search-btn">查询</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-table :data="queueList" border style="width: 100%" data-testid="queue-table" v-loading="loading">
|
||||
<el-table-column prop="patientName" label="患者姓名" width="150" />
|
||||
<el-table-column prop="status" label="排队状态" width="120">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getStatusType(row.status)">
|
||||
{{ getStatusLabel(row.status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="queueTime" label="排队时间" />
|
||||
<el-table-column label="操作" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" size="small">详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import axios from 'axios'
|
||||
import { getQueueList } from '@/api/triage'
|
||||
|
||||
const deptName = ref('呼吸内科')
|
||||
const queryDate = ref(new Date().toISOString().split('T')[0]) // 默认当天
|
||||
const queueList = ref([])
|
||||
const dateRange = ref([])
|
||||
const historyVisible = ref(false)
|
||||
const historyDateRange = ref([])
|
||||
const loading = ref(false)
|
||||
|
||||
const getStatusText = (status) => {
|
||||
const fetchQueueData = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
// 假设 deptId 由路由参数或全局状态管理,此处以固定值演示
|
||||
const res = await getQueueList({ deptId: 101, queryDate: queryDate.value })
|
||||
queueList.value = res.data || []
|
||||
} catch (e) {
|
||||
console.error('获取队列数据失败', e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const getStatusLabel = (status) => {
|
||||
const map = { 0: '待诊', 1: '就诊中', 2: '过号', 3: '完诊' }
|
||||
return map[status] || '未知'
|
||||
}
|
||||
|
||||
const fetchQueue = async (startTime, endTime) => {
|
||||
// 修复 Bug #544:移除 status 参数默认过滤,后端不再拦截完诊状态
|
||||
const { data } = await axios.get('/api/triage/queue/list', {
|
||||
params: { deptId: 1, startTime, endTime }
|
||||
})
|
||||
queueList.value = data
|
||||
const getStatusType = (status) => {
|
||||
const map = { 0: 'info', 1: 'warning', 2: 'danger', 3: 'success' }
|
||||
return map[status] || 'info'
|
||||
}
|
||||
|
||||
const handleDateChange = (val) => {
|
||||
if (val && val.length === 2) {
|
||||
fetchQueue(val[0], val[1])
|
||||
}
|
||||
}
|
||||
|
||||
const openHistoryDialog = () => {
|
||||
historyVisible.value = true
|
||||
// 默认当天时间
|
||||
const today = new Date().toISOString().split('T')[0]
|
||||
historyDateRange.value = [today, today]
|
||||
}
|
||||
|
||||
const queryHistory = () => {
|
||||
if (historyDateRange.value && historyDateRange.value.length === 2) {
|
||||
fetchQueue(historyDateRange.value[0], historyDateRange.value[1])
|
||||
historyVisible.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 页面初始化默认加载当天数据
|
||||
const today = new Date().toISOString().split('T')[0]
|
||||
fetchQueue(today, today)
|
||||
})
|
||||
onMounted(fetchQueueData)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.smart-queue-container { padding: 20px; }
|
||||
.toolbar { margin-bottom: 16px; display: flex; gap: 12px; align-items: center; }
|
||||
.header-actions { display: flex; justify-content: space-between; align-items: center; }
|
||||
.title { font-size: 18px; font-weight: bold; }
|
||||
.filters { display: flex; gap: 12px; }
|
||||
</style>
|
||||
|
||||
@@ -34,4 +34,29 @@ describe('HIS Regression Tests', () => {
|
||||
cy.get('[data-testid="dispensing-summary-table"] tbody tr').should('have.length.greaterThan', 0)
|
||||
})
|
||||
})
|
||||
|
||||
describe('Bug #544: 智能分诊队列显示完诊状态及历史查询', { tags: ['@bug544', '@regression'] }, () => {
|
||||
beforeEach(() => {
|
||||
cy.login('nkhs1', '123456')
|
||||
cy.visit('/triage/queue-management')
|
||||
})
|
||||
|
||||
it('应显示所有状态患者(含完诊)且支持按日期查询历史队列', () => {
|
||||
// 1. 验证默认加载当天数据
|
||||
cy.get('[data-testid="queue-date-picker"]').should('exist')
|
||||
cy.get('[data-testid="queue-date-picker"]').invoke('val').then(val => {
|
||||
expect(val).to.match(/\d{4}-\d{2}-\d{2}/) // 默认当天格式
|
||||
})
|
||||
|
||||
// 2. 验证列表包含“完诊”状态(不再被自动过滤)
|
||||
cy.get('[data-testid="queue-table"] tbody tr').should('have.length.greaterThan', 0)
|
||||
cy.get('[data-testid="queue-table"]').contains('完诊').should('exist')
|
||||
|
||||
// 3. 切换历史日期并验证数据刷新
|
||||
cy.get('[data-testid="queue-date-picker"]').click()
|
||||
cy.get('.el-date-table td.available').first().click() // 选择历史某天
|
||||
cy.get('[data-testid="search-btn"]').click()
|
||||
cy.get('[data-testid="queue-table"] tbody tr').should('have.length.greaterThan', 0)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user