Fix Bug #544: AI修复
This commit is contained in:
@@ -1,19 +1,25 @@
|
||||
package com.openhis.application.service.impl;
|
||||
|
||||
import com.openhis.application.domain.entity.QueueInfo;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.openhis.application.domain.dto.QueueQueryDto;
|
||||
import com.openhis.application.domain.entity.QueueRecord;
|
||||
import com.openhis.application.mapper.QueueMapper;
|
||||
import com.openhis.application.service.QueueService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能分诊排队服务实现
|
||||
*
|
||||
* 智能分诊排队业务实现
|
||||
*
|
||||
* 修复 Bug #544:
|
||||
* - 当前排队列表现在会显示 “完诊” 状态的患者;
|
||||
* - 新增历史排队查询接口供前端使用。
|
||||
* 1. 移除原逻辑中对“完诊”(COMPLETED) 状态的硬编码过滤,确保全流程轨迹可追溯。
|
||||
* 2. 增加时间范围查询支持,默认查询当天数据,支持历史队列检索。
|
||||
*/
|
||||
@Service
|
||||
public class QueueServiceImpl implements QueueService {
|
||||
@@ -25,12 +31,19 @@ public class QueueServiceImpl implements QueueService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QueueInfo> getCurrentQueue(Long departmentId) {
|
||||
return queueMapper.selectCurrentQueue(departmentId);
|
||||
}
|
||||
@Transactional(readOnly = true)
|
||||
public PageInfo<QueueRecord> getQueueList(QueueQueryDto queryDto) {
|
||||
// 修复 Bug #544:默认查询当天,若前端未传时间则自动填充当日 00:00:00 ~ 23:59:59
|
||||
if (queryDto.getStartDate() == null) {
|
||||
queryDto.setStartDate(LocalDateTime.of(LocalDate.now(), LocalTime.MIN));
|
||||
}
|
||||
if (queryDto.getEndDate() == null) {
|
||||
queryDto.setEndDate(LocalDateTime.of(LocalDate.now(), LocalTime.MAX));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QueueInfo> getHistoryQueue(Long departmentId, Date startTime, Date endTime) {
|
||||
return queueMapper.selectHistoryQueue(departmentId, startTime, endTime);
|
||||
// 移除原 WHERE status != 'COMPLETED' 过滤逻辑,交由前端按需筛选或全量展示
|
||||
PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize());
|
||||
List<QueueRecord> list = queueMapper.selectQueueList(queryDto);
|
||||
return new PageInfo<>(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,83 +1,122 @@
|
||||
<template>
|
||||
<div class="smart-queue-container">
|
||||
<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-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 class="query-bar" shadow="never">
|
||||
<el-form :inline="true" :model="queryParams" class="demo-form-inline">
|
||||
<el-form-item label="日期范围">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
value-format="YYYY-MM-DD"
|
||||
@change="handleDateChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="患者姓名">
|
||||
<el-input v-model="queryParams.patientName" placeholder="请输入姓名" clearable style="width: 180px;" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleQuery">查询</el-button>
|
||||
<el-button @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-table :data="tableData" border style="width: 100%; margin-top: 16px;" v-loading="loading">
|
||||
<el-table-column prop="queueNo" label="排队号" width="100" align="center" />
|
||||
<el-table-column prop="patientName" label="患者姓名" width="120" align="center" />
|
||||
<el-table-column prop="status" label="状态" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getStatusType(row.status)">{{ row.statusName }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="triageTime" label="分诊时间" width="180" align="center" />
|
||||
<el-table-column prop="deptName" label="科室" align="center" />
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
v-model:current-page="queryParams.pageNum"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
:total="total"
|
||||
layout="total, prev, pager, next"
|
||||
@current-change="handleQuery"
|
||||
style="margin-top: 16px; justify-content: flex-end;"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { getQueueList } from '@/api/triage'
|
||||
|
||||
const deptName = ref('呼吸内科')
|
||||
const queryDate = ref(new Date().toISOString().split('T')[0]) // 默认当天
|
||||
const queueList = ref([])
|
||||
const queryParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
patientName: '',
|
||||
startDate: '',
|
||||
endDate: ''
|
||||
})
|
||||
const dateRange = ref([])
|
||||
const tableData = ref([])
|
||||
const total = ref(0)
|
||||
const loading = ref(false)
|
||||
|
||||
const handleDateChange = (val) => {
|
||||
if (val && val.length === 2) {
|
||||
queryParams.startDate = val[0] + ' 00:00:00'
|
||||
queryParams.endDate = val[1] + ' 23:59:59'
|
||||
} else {
|
||||
queryParams.startDate = ''
|
||||
queryParams.endDate = ''
|
||||
}
|
||||
}
|
||||
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNum = 1
|
||||
fetchQueueData()
|
||||
}
|
||||
|
||||
const resetQuery = () => {
|
||||
queryParams.patientName = ''
|
||||
dateRange.value = []
|
||||
queryParams.startDate = ''
|
||||
queryParams.endDate = ''
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
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)
|
||||
const res = await getQueueList(queryParams)
|
||||
tableData.value = res.rows
|
||||
total.value = res.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const getStatusLabel = (status) => {
|
||||
const map = { 0: '待诊', 1: '就诊中', 2: '过号', 3: '完诊' }
|
||||
return map[status] || '未知'
|
||||
}
|
||||
|
||||
const getStatusType = (status) => {
|
||||
const map = { 0: 'info', 1: 'warning', 2: 'danger', 3: 'success' }
|
||||
const map = { 'WAITING': 'warning', 'IN_PROGRESS': 'primary', 'COMPLETED': 'success' }
|
||||
return map[status] || 'info'
|
||||
}
|
||||
|
||||
onMounted(fetchQueueData)
|
||||
onMounted(() => {
|
||||
// 默认查询当天,满足“默认当天时间”需求
|
||||
const today = new Date().toISOString().split('T')[0]
|
||||
dateRange.value = [today, today]
|
||||
handleDateChange(dateRange.value)
|
||||
fetchQueueData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.smart-queue-container { padding: 20px; }
|
||||
.header-actions { display: flex; justify-content: space-between; align-items: center; }
|
||||
.title { font-size: 18px; font-weight: bold; }
|
||||
.filters { display: flex; gap: 12px; }
|
||||
.smart-queue-container {
|
||||
padding: 16px;
|
||||
background: #f5f7fa;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.query-bar {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -58,10 +58,44 @@ describe('Bug #550: 检查申请项目选择交互优化', () => {
|
||||
cy.get('.selected-card .card-body .method-row').should('have.length.greaterThan', 0);
|
||||
|
||||
// 验证已删除“项目套餐明细”冗余标签
|
||||
cy.get('.selected-card .card-body').should('not.contain', '项目套餐明细');
|
||||
|
||||
// 验证方法可独立勾选/取消
|
||||
cy.get('.selected-card .card-body .method-row').first().find('input[type="checkbox"]').click();
|
||||
cy.get('.selected-card .card-body .method-row').first().find('input[type="checkbox"]').should('be.checked');
|
||||
});
|
||||
});
|
||||
|
||||
// @bug544 @regression
|
||||
describe('Bug #544: 智能分诊队列显示完诊状态及历史查询', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/triage/smart-queue');
|
||||
cy.intercept('GET', '/api/triage/queue/list*', {
|
||||
statusCode: 200,
|
||||
body: {
|
||||
rows: [
|
||||
{ queueNo: 'A001', patientName: '张三', status: 'WAITING', statusName: '候诊', triageTime: '2026-05-26 09:00:00', deptName: '呼吸内科' },
|
||||
{ queueNo: 'A002', patientName: '李四', status: 'COMPLETED', statusName: '完诊', triageTime: '2026-05-26 08:30:00', deptName: '呼吸内科' }
|
||||
],
|
||||
total: 2
|
||||
}
|
||||
}).as('getQueueList');
|
||||
});
|
||||
|
||||
it('1. 列表应显示“完诊”状态患者,无状态过滤拦截', () => {
|
||||
cy.wait('@getQueueList');
|
||||
cy.get('.el-table__body-wrapper').contains('李四').should('be.visible');
|
||||
cy.get('.el-table__body-wrapper').contains('完诊').should('be.visible');
|
||||
cy.get('.el-tag--success').should('contain', '完诊');
|
||||
});
|
||||
|
||||
it('2. 支持历史队列查询(日期范围选择器默认当天)', () => {
|
||||
cy.get('.el-date-editor').should('be.visible');
|
||||
cy.contains('查询').click();
|
||||
cy.wait('@getQueueList');
|
||||
cy.get('.el-table__body-wrapper').should('be.visible');
|
||||
|
||||
// 验证切换历史日期后重新请求
|
||||
cy.get('.el-date-editor').click();
|
||||
cy.get('.el-picker-panel__content').contains('25').click();
|
||||
cy.get('.el-picker-panel__content').contains('26').click();
|
||||
cy.contains('查询').click();
|
||||
cy.wait('@getQueueList');
|
||||
cy.get('.el-table__body-wrapper').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user