Fix Bug #544: AI修复
This commit is contained in:
@@ -2,18 +2,46 @@ package com.openhis.web.triage.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 智能分诊排队数据访问层
|
||||
*
|
||||
* 修复 Bug #544:
|
||||
* - 移除原 SQL 中硬编码的 status != 'COMPLETED' 过滤条件,改为支持按状态动态筛选。
|
||||
* - 新增 startDate/endDate 参数,支持按时间范围检索历史队列。
|
||||
*/
|
||||
@Mapper
|
||||
public interface TriageQueueMapper {
|
||||
|
||||
/**
|
||||
* 动态查询排队队列
|
||||
* 修复 Bug #544:移除状态硬编码过滤,支持全状态及时间范围查询
|
||||
* 查询排队队列列表(含历史)
|
||||
*
|
||||
* @param deptId 科室ID
|
||||
* @param status 排队状态(可选,为空则查全部)
|
||||
* @param startDate 开始时间(格式 YYYY-MM-DD)
|
||||
* @param endDate 结束时间(格式 YYYY-MM-DD)
|
||||
* @return 队列记录列表
|
||||
*/
|
||||
List<Map<String, Object>> selectQueueList(@Param("status") String status,
|
||||
@Param("startDate") LocalDate startDate,
|
||||
@Param("endDate") LocalDate endDate);
|
||||
@Select("<script>" +
|
||||
"SELECT id, patient_id, patient_name, status, queue_time, dept_id " +
|
||||
"FROM his_triage_queue " +
|
||||
"WHERE dept_id = #{deptId} " +
|
||||
"<if test='status != null and status != \"\"'>" +
|
||||
" AND status = #{status} " +
|
||||
"</if>" +
|
||||
"<if test='startDate != null'>" +
|
||||
" AND queue_time >= #{startDate}::timestamp " +
|
||||
"</if>" +
|
||||
"<if test='endDate != null'>" +
|
||||
" AND queue_time <= (#{endDate} || ' 23:59:59')::timestamp " +
|
||||
"</if>" +
|
||||
"ORDER BY queue_time DESC" +
|
||||
"</script>")
|
||||
List<Map<String, Object>> selectQueueList(@Param("deptId") Long deptId,
|
||||
@Param("status") String status,
|
||||
@Param("startDate") String startDate,
|
||||
@Param("endDate") String endDate);
|
||||
}
|
||||
|
||||
@@ -3,11 +3,14 @@ package com.openhis.web.triage.service.impl;
|
||||
import com.openhis.web.triage.mapper.TriageQueueMapper;
|
||||
import com.openhis.web.triage.service.TriageQueueService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 智能分诊排队业务实现
|
||||
*
|
||||
* 修复 Bug #544:透传日期范围参数至 Mapper,支持历史队列按时间检索。
|
||||
*/
|
||||
@Service
|
||||
public class TriageQueueServiceImpl implements TriageQueueService {
|
||||
|
||||
@@ -18,8 +21,7 @@ public class TriageQueueServiceImpl implements TriageQueueService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> queryQueueList(String status, LocalDate startDate, LocalDate endDate) {
|
||||
// 修复 Bug #544:移除原逻辑中对“完诊”状态的隐式过滤,交由 SQL 动态条件处理
|
||||
return triageQueueMapper.selectQueueList(status, startDate, endDate);
|
||||
public List<Map<String, Object>> getQueueList(Long deptId, String status, String startDate, String endDate) {
|
||||
return triageQueueMapper.selectQueueList(deptId, status, startDate, endDate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,127 +1,90 @@
|
||||
<template>
|
||||
<div class="triage-queue-container">
|
||||
<el-card class="box-card">
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>智能分诊排队管理 - {{ deptName }}</span>
|
||||
<div class="header-actions">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
data-cy="date-range-picker"
|
||||
style="width: 240px; margin-right: 10px;"
|
||||
/>
|
||||
<el-button type="primary" @click="handleQuery" data-cy="history-query-btn">历史队列查询</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Bug #544 Fix: 增加状态筛选与历史时间范围查询 -->
|
||||
<el-form :inline="true" :model="queryParams" class="search-form">
|
||||
<el-form-item label="状态筛选" class="status-filter">
|
||||
<el-select v-model="queryParams.status" placeholder="全部状态" clearable @change="handleSearch">
|
||||
<el-option label="待分诊" :value="1" />
|
||||
<el-option label="待就诊" :value="2" />
|
||||
<el-option label="就诊中" :value="3" />
|
||||
<el-option label="完诊" :value="4" />
|
||||
<el-option label="过号" :value="5" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间范围">
|
||||
<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"
|
||||
class="date-range-picker"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleSearch">查询</el-button>
|
||||
<el-button @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table :data="tableData" border style="width: 100%" v-loading="loading" class="queue-table">
|
||||
<el-table-column prop="patientName" label="患者姓名" width="120" />
|
||||
<el-table-column prop="queueTime" label="排队时间" width="160" />
|
||||
<el-table-column prop="status" label="状态" width="100">
|
||||
<el-table :data="queueList" row-key="id" data-cy="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>
|
||||
<el-tag :type="getStatusType(row.status)">{{ row.status }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deptName" label="科室" width="120" />
|
||||
<el-table-column prop="queueTime" label="排队时间" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { getQueueRecordsApi } from '@/api/triage/queue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { getQueueList } from '@/api/triage/queue'
|
||||
|
||||
const loading = ref(false)
|
||||
const tableData = ref([])
|
||||
const deptName = ref('呼吸内科')
|
||||
const deptId = ref(1)
|
||||
const queueList = ref([])
|
||||
const dateRange = ref([])
|
||||
const queryParams = reactive({
|
||||
deptId: 101,
|
||||
status: null,
|
||||
startDate: null,
|
||||
endDate: null
|
||||
})
|
||||
const loading = ref(false)
|
||||
|
||||
// Bug #544 Fix: 初始化默认当天时间
|
||||
const initDateRange = () => {
|
||||
const today = new Date().toISOString().split('T')[0]
|
||||
dateRange.value = [today, today]
|
||||
queryParams.startDate = today
|
||||
queryParams.endDate = today
|
||||
}
|
||||
|
||||
const getStatusLabel = (status) => {
|
||||
const map = { 1: '待分诊', 2: '待就诊', 3: '就诊中', 4: '完诊', 5: '过号' }
|
||||
return map[status] || '未知'
|
||||
// 默认当天时间
|
||||
const initDefaultDate = () => {
|
||||
const today = new Date()
|
||||
const start = today.toISOString().split('T')[0]
|
||||
dateRange.value = [start, start]
|
||||
}
|
||||
|
||||
const getStatusType = (status) => {
|
||||
const map = { 1: 'info', 2: 'warning', 3: 'primary', 4: 'success', 5: 'danger' }
|
||||
const map = { WAITING: 'warning', IN_PROGRESS: 'primary', COMPLETED: 'success' }
|
||||
return map[status] || 'info'
|
||||
}
|
||||
|
||||
const fetchData = async () => {
|
||||
const handleQuery = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
tableData.value = await getQueueRecordsApi(queryParams)
|
||||
const [startDate, endDate] = dateRange.value || []
|
||||
const res = await getQueueList({
|
||||
deptId: deptId.value,
|
||||
startDate,
|
||||
endDate
|
||||
})
|
||||
queueList.value = res.data || []
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleSearch = () => {
|
||||
fetchData()
|
||||
}
|
||||
|
||||
const handleDateChange = (val) => {
|
||||
if (val && val.length === 2) {
|
||||
queryParams.startDate = val[0]
|
||||
queryParams.endDate = val[1]
|
||||
} else {
|
||||
queryParams.startDate = null
|
||||
queryParams.endDate = null
|
||||
}
|
||||
}
|
||||
|
||||
const resetQuery = () => {
|
||||
queryParams.status = null
|
||||
initDateRange()
|
||||
fetchData()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
initDateRange()
|
||||
fetchData()
|
||||
initDefaultDate()
|
||||
handleQuery()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.triage-queue-container { padding: 20px; }
|
||||
.card-header { display: flex; align-items: center; justify-content: space-between; }
|
||||
.search-form { margin-bottom: 20px; }
|
||||
.queue-table { margin-top: 10px; }
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.header-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user