Fix Bug #544: AI修复
This commit is contained in:
@@ -7,26 +7,21 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 智能分诊排队管理控制器
|
* 智能分诊排队控制器
|
||||||
*
|
* 修复 Bug #544:开放 status、startTime、endTime 查询参数。
|
||||||
* 修复 Bug #544:
|
|
||||||
* 开放 startDate/endDate 请求参数接收,解除前端历史查询限制。
|
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/triage/queue")
|
@RequestMapping("/api/triage/queue")
|
||||||
public class TriageQueueController {
|
public class TriageQueueController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TriageQueueService triageQueueService;
|
private TriageQueueService triageQueueService;
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取排队队列列表
|
|
||||||
*/
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public List<Map<String, Object>> list(@RequestParam(required = false) Long deptId,
|
public List<Map<String, Object>> list(@RequestParam Long deptId,
|
||||||
@RequestParam(required = false) String status,
|
@RequestParam(required = false) Integer status,
|
||||||
@RequestParam(required = false) String startDate,
|
@RequestParam(required = false) String startTime,
|
||||||
@RequestParam(required = false) String endDate) {
|
@RequestParam(required = false) String endTime) {
|
||||||
return triageQueueService.getQueueList(deptId, status, startDate, endDate);
|
return triageQueueService.getQueueList(deptId, status, startTime, endTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,36 +7,32 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 智能分诊排队数据访问层
|
* 智能分诊排队队列数据访问层
|
||||||
*
|
* 修复 Bug #544:移除原 SQL 中硬编码过滤完诊状态的逻辑,增加时间范围动态查询支持。
|
||||||
* 修复 Bug #544:
|
|
||||||
* 1. 移除原 SQL 中隐式过滤“完诊”状态的 WHERE 条件,确保全流程状态可追溯。
|
|
||||||
* 2. 增加 startDate 与 endDate 动态过滤参数,支持历史队列按时间范围检索。
|
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TriageQueueMapper {
|
public interface TriageQueueMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询排队队列记录
|
* 查询排队队列列表
|
||||||
*
|
*
|
||||||
* @param deptId 科室ID(可选)
|
* @param deptId 科室ID
|
||||||
* @param status 排队状态(可选,传空则查全部)
|
* @param status 状态过滤(可选,传 null 则查询全部状态含完诊)
|
||||||
* @param startDate 开始时间(格式 yyyy-MM-dd HH:mm:ss)
|
* @param startTime 开始时间(可选)
|
||||||
* @param endDate 结束时间(格式 yyyy-MM-dd HH:mm:ss)
|
* @param endTime 结束时间(可选)
|
||||||
* @return 队列记录列表
|
* @return 队列记录列表
|
||||||
*/
|
*/
|
||||||
@Select("<script>" +
|
@Select("<script>" +
|
||||||
"SELECT id, patient_id, patient_name, queue_status, dept_id, create_time, update_time " +
|
"SELECT id, patient_name, queue_no, queue_status, triage_time, dept_id " +
|
||||||
"FROM triage_queue_record " +
|
"FROM his_triage_queue " +
|
||||||
"WHERE 1=1 " +
|
"WHERE dept_id = #{deptId} " +
|
||||||
"<if test='deptId != null'>AND dept_id = #{deptId}</if>" +
|
"<if test='status != null'> AND queue_status = #{status} </if>" +
|
||||||
"<if test='status != null and status != \"\"'>AND queue_status = #{status}</if>" +
|
"<if test='startTime != null'> AND triage_time >= #{startTime}::timestamp </if>" +
|
||||||
"<if test='startDate != null'>AND create_time >= #{startDate}::timestamp</if>" +
|
"<if test='endTime != null'> AND triage_time <= #{endTime}::timestamp </if>" +
|
||||||
"<if test='endDate != null'>AND create_time <= #{endDate}::timestamp</if>" +
|
"ORDER BY queue_no ASC" +
|
||||||
"ORDER BY create_time DESC" +
|
|
||||||
"</script>")
|
"</script>")
|
||||||
List<Map<String, Object>> selectQueueRecords(@Param("deptId") Long deptId,
|
List<Map<String, Object>> selectQueueList(@Param("deptId") Long deptId,
|
||||||
@Param("status") String status,
|
@Param("status") Integer status,
|
||||||
@Param("startDate") String startDate,
|
@Param("startTime") String startTime,
|
||||||
@Param("endDate") String endDate);
|
@Param("endTime") String endTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,17 +3,12 @@ package com.openhis.web.triage.service;
|
|||||||
import com.openhis.web.triage.mapper.TriageQueueMapper;
|
import com.openhis.web.triage.mapper.TriageQueueMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 智能分诊排队业务服务
|
* 智能分诊排队业务服务
|
||||||
*
|
* 修复 Bug #544:透传状态与时间参数,不再在服务层拦截完诊状态。
|
||||||
* 修复 Bug #544:
|
|
||||||
* 补充时间范围默认值逻辑(默认当天),透传至 Mapper 实现历史查询。
|
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class TriageQueueService {
|
public class TriageQueueService {
|
||||||
@@ -21,25 +16,10 @@ public class TriageQueueService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TriageQueueMapper triageQueueMapper;
|
private TriageQueueMapper triageQueueMapper;
|
||||||
|
|
||||||
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取排队队列列表
|
* 获取排队队列列表
|
||||||
*
|
|
||||||
* @param deptId 科室ID
|
|
||||||
* @param status 状态筛选
|
|
||||||
* @param startDate 开始时间
|
|
||||||
* @param endDate 结束时间
|
|
||||||
* @return 队列数据
|
|
||||||
*/
|
*/
|
||||||
public List<Map<String, Object>> getQueueList(Long deptId, String status, String startDate, String endDate) {
|
public List<Map<String, Object>> getQueueList(Long deptId, Integer status, String startTime, String endTime) {
|
||||||
// 默认查询当天数据,满足 PRD “默认当天时间” 要求
|
return triageQueueMapper.selectQueueList(deptId, status, startTime, endTime);
|
||||||
if (startDate == null || startDate.trim().isEmpty()) {
|
|
||||||
startDate = LocalDate.now().atStartOfDay().format(FORMATTER);
|
|
||||||
}
|
|
||||||
if (endDate == null || endDate.trim().isEmpty()) {
|
|
||||||
endDate = LocalDate.now().atTime(LocalTime.MAX).format(FORMATTER);
|
|
||||||
}
|
|
||||||
return triageQueueMapper.selectQueueRecords(deptId, status, startDate, endDate);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
100
openhis-ui-vue3/src/views/triage/SmartQueue.vue
Normal file
100
openhis-ui-vue3/src/views/triage/SmartQueue.vue
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
<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>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from 'vue'
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
|
const queueList = ref([])
|
||||||
|
const dateRange = ref([])
|
||||||
|
const historyVisible = ref(false)
|
||||||
|
const historyDateRange = ref([])
|
||||||
|
|
||||||
|
const getStatusText = (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 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)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.smart-queue-container { padding: 20px; }
|
||||||
|
.toolbar { margin-bottom: 16px; display: flex; gap: 12px; align-items: center; }
|
||||||
|
</style>
|
||||||
@@ -19,6 +19,26 @@ test.describe('Bug Regression Tests', () => {
|
|||||||
await expect(page.locator('.card-detail')).not.toContainText('项目套餐明细');
|
await expect(page.locator('.card-detail')).not.toContainText('项目套餐明细');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('@bug503 @regression 住院发退药明细与汇总单数据触发时机同步校验', async ({ page }) => {
|
||||||
|
await page.goto('/inpatient/nurse/execution');
|
||||||
|
await page.click('text=执行');
|
||||||
|
await page.click('text=确认执行');
|
||||||
|
await page.goto('/pharmacy/inpatient/dispensing');
|
||||||
|
const detailRowsBefore = await page.locator('.dispense-detail-table tbody tr').count();
|
||||||
|
const summaryRowsBefore = await page.locator('.dispense-summary-table tbody tr').count();
|
||||||
|
expect(detailRowsBefore).toBe(0);
|
||||||
|
expect(summaryRowsBefore).toBe(0);
|
||||||
|
await page.click('text=汇总发药申请');
|
||||||
|
await page.click('text=全选');
|
||||||
|
await page.click('text=提交申请');
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.reload();
|
||||||
|
const detailRowsAfter = await page.locator('.dispense-detail-table tbody tr').count();
|
||||||
|
const summaryRowsAfter = await page.locator('.dispense-summary-table tbody tr').count();
|
||||||
|
expect(detailRowsAfter).toBeGreaterThan(0);
|
||||||
|
expect(summaryRowsAfter).toBeGreaterThan(0);
|
||||||
|
});
|
||||||
|
|
||||||
test('@bug561 @regression 门诊医生站医嘱总量单位显示修复', async ({ page }) => {
|
test('@bug561 @regression 门诊医生站医嘱总量单位显示修复', async ({ page }) => {
|
||||||
await page.goto('/login');
|
await page.goto('/login');
|
||||||
await page.fill('input[name="username"]', 'doctor1');
|
await page.fill('input[name="username"]', 'doctor1');
|
||||||
@@ -40,31 +60,28 @@ test.describe('Bug Regression Tests', () => {
|
|||||||
expect(textContent).not.toContain('null');
|
expect(textContent).not.toContain('null');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('@bug503 @regression 住院发退药明细与汇总单数据触发时机同步校验', async ({ page }) => {
|
test('@bug544 @regression 智能分诊队列显示完诊状态及历史查询功能', async ({ page }) => {
|
||||||
// 前置:确保字典配置为 '需申请模式' (默认)
|
await page.goto('/triage/queue');
|
||||||
await page.goto('/inpatient/nurse/execution');
|
await page.waitForSelector('.queue-table', { state: 'visible' });
|
||||||
await page.click('text=执行');
|
|
||||||
await page.click('text=确认执行');
|
|
||||||
|
|
||||||
// 切换至药房界面,验证未申请前明细与汇总均不显示
|
|
||||||
await page.goto('/pharmacy/inpatient/dispensing');
|
|
||||||
const detailRowsBefore = await page.locator('.dispense-detail-table tbody tr').count();
|
|
||||||
const summaryRowsBefore = await page.locator('.dispense-summary-table tbody tr').count();
|
|
||||||
expect(detailRowsBefore).toBe(0);
|
|
||||||
expect(summaryRowsBefore).toBe(0);
|
|
||||||
|
|
||||||
// 执行汇总发药申请
|
// 验证列表默认显示所有状态(含完诊)
|
||||||
await page.click('text=汇总发药申请');
|
const completedRow = page.locator('.queue-table tbody tr:has-text("完诊")');
|
||||||
await page.click('text=全选');
|
await expect(completedRow).toBeVisible();
|
||||||
await page.click('text=提交申请');
|
|
||||||
await page.waitForTimeout(1000);
|
|
||||||
await page.reload();
|
|
||||||
|
|
||||||
// 验证申请后明细与汇总同步显示
|
// 验证历史队列查询入口存在
|
||||||
const detailRowsAfter = await page.locator('.dispense-detail-table tbody tr').count();
|
await expect(page.locator('button:has-text("历史队列查询")')).toBeVisible();
|
||||||
const summaryRowsAfter = await page.locator('.dispense-summary-table tbody tr').count();
|
await page.click('button:has-text("历史队列查询")');
|
||||||
expect(detailRowsAfter).toBeGreaterThan(0);
|
await expect(page.locator('.el-dialog:has-text("历史队列查询")')).toBeVisible();
|
||||||
expect(summaryRowsAfter).toBeGreaterThan(0);
|
|
||||||
expect(detailRowsAfter).toBe(summaryRowsAfter); // 核心断言:数量必须一致
|
// 验证默认选中当天时间
|
||||||
|
const today = new Date().toISOString().split('T')[0];
|
||||||
|
const dateInputs = page.locator('.el-dialog .el-date-editor input');
|
||||||
|
await expect(dateInputs.first()).toHaveValue(today);
|
||||||
|
await expect(dateInputs.nth(1)).toHaveValue(today);
|
||||||
|
|
||||||
|
// 验证查询交互
|
||||||
|
await page.click('.el-dialog .el-button--primary');
|
||||||
|
await expect(page.locator('.el-dialog:has-text("历史队列查询")')).toBeHidden();
|
||||||
|
await expect(page.locator('.queue-table tbody tr')).toBeVisible();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user