Fix Bug #544: AI修复

This commit is contained in:
2026-05-27 02:24:43 +08:00
parent 8ea1b4f067
commit 8c738cc78a
5 changed files with 195 additions and 152 deletions

View File

@@ -2,33 +2,39 @@
<div class="triage-queue-container">
<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 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"
class="date-range-picker"
/>
<!-- 状态筛选包含完诊 -->
<el-select v-model="statusFilter" placeholder="状态筛选" clearable class="status-filter">
<el-option label="全部" value="" />
<el-option label="待分诊" value="0" />
<el-option label="排队中" value="1" />
<el-option label="就诊中" value="2" />
<el-option label="完诊" value="3" />
<el-option label="过号" value="4" />
</el-select>
<el-button type="primary" @click="fetchQueueData">查询</el-button>
</div>
</template>
<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">
<el-table :data="queueList" class="queue-table" v-loading="loading" border>
<el-table-column prop="patientName" label="患者姓名" min-width="120" />
<el-table-column prop="queueStatus" label="状态" width="100" align="center">
<template #default="{ row }">
<el-tag :type="getStatusType(row.status)">{{ row.status }}</el-tag>
<el-tag :type="getStatusType(row.queueStatus)">{{ getStatusLabel(row.queueStatus) }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="queueTime" label="排队时间" />
<el-table-column prop="createTime" label="排队时间" min-width="180" />
</el-table>
</el-card>
</div>
@@ -36,45 +42,49 @@
<script setup>
import { ref, onMounted } from 'vue'
import { getQueueList } from '@/api/triage/queue'
import { ElMessage } from 'element-plus'
import request from '@/utils/request'
const deptName = ref('呼吸内科')
const deptId = ref(1)
const queueList = ref([])
const deptCode = 'nkhs1' // 示例科室,实际应从路由或全局状态获取
const dateRange = ref([])
const statusFilter = ref('')
const queueList = ref([])
const loading = ref(false)
// 默认当天时间
const initDefaultDate = () => {
const today = new Date()
const start = today.toISOString().split('T')[0]
dateRange.value = [start, start]
}
const getStatusType = (status) => {
const map = { WAITING: 'warning', IN_PROGRESS: 'primary', COMPLETED: 'success' }
return map[status] || 'info'
}
const handleQuery = async () => {
const fetchQueueData = async () => {
loading.value = true
try {
const [startDate, endDate] = dateRange.value || []
// 不传 status 或传 null后端将查询全部状态含完诊
const res = await getQueueList({
deptId: deptId.value,
status: null,
startDate: startDate || null,
endDate: endDate || null
})
const params = {
deptCode,
status: statusFilter.value,
startDate: dateRange.value?.[0] || '',
endDate: dateRange.value?.[1] || ''
}
const res = await request.get('/api/triage/queue/list', { params })
queueList.value = res.data || []
} catch (e) {
ElMessage.error('获取队列数据失败')
} finally {
loading.value = false
}
}
const getStatusLabel = (status) => {
const map = { '0': '待分诊', '1': '排队中', '2': '就诊中', '3': '完诊', '4': '过号' }
return map[status] || '未知'
}
const getStatusType = (status) => {
const map = { '0': 'info', '1': 'warning', '2': 'primary', '3': 'success', '4': 'danger' }
return map[status] || 'info'
}
onMounted(() => {
initDefaultDate()
handleQuery()
fetchQueueData()
})
</script>
<style scoped>
.triage-queue-container { padding: 16px; }
.header-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
</style>