Fix Bug #411: 智能分诊排队:底部操作控制区"过滤栏"功能实现与PRD需求不符(误设为科室过滤)
将底部过滤栏从"就诊科室快速过滤栏"改为"诊室快速过滤栏": - UI文案:过滤栏标题、下拉框placeholder均改为诊室相关 - 数据源:移除 getLocationTree() 科室树API调用,改为从队列/候选池数据中动态提取诊室列表 - 过滤逻辑:改为按诊室名称(room字段)过滤,支持本科室下不同诊室快速切换 - 后端API调用不再依赖过滤栏选择,改用队列数据自身的organizationId Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -220,15 +220,15 @@
|
||||
|
||||
<!-- 底部控制面板 -->
|
||||
<div class="footer-section">
|
||||
<!-- 就诊科室快速过滤栏 -->
|
||||
<!-- 诊室快速过滤栏 -->
|
||||
<div class="filter-section">
|
||||
<div class="filter-label">
|
||||
③ 就诊科室快速过滤栏
|
||||
③ 诊室快速过滤栏
|
||||
</div>
|
||||
<div class="filter-select-wrapper">
|
||||
<el-select
|
||||
v-model="selectedDept"
|
||||
placeholder="请选择就诊科室"
|
||||
v-model="selectedClinicRoom"
|
||||
placeholder="请选择诊室"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@@ -239,10 +239,10 @@
|
||||
value="all"
|
||||
/>
|
||||
<el-option
|
||||
v-for="dept in departmentList"
|
||||
:key="dept.id"
|
||||
:label="dept.name"
|
||||
:value="dept.id"
|
||||
v-for="room in clinicRoomList"
|
||||
:key="room"
|
||||
:label="room"
|
||||
:value="room"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
@@ -648,7 +648,6 @@ import { Refresh } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {
|
||||
getCandidatePool,
|
||||
getLocationTree,
|
||||
getTriageQueueList,
|
||||
addToQueue,
|
||||
removeFromQueue,
|
||||
@@ -681,10 +680,10 @@ const selectedCandidates = ref([])
|
||||
// 显示选项
|
||||
const showOnlyWaiting = ref(false)
|
||||
|
||||
// 科室过滤(改为使用就诊科室)
|
||||
const selectedDept = ref('all')
|
||||
// 就诊科室列表
|
||||
const departmentList = ref([])
|
||||
// 诊室过滤(按诊室维度筛选)
|
||||
const selectedClinicRoom = ref('all')
|
||||
// 诊室列表(从数据中动态提取)
|
||||
const clinicRoomList = ref([])
|
||||
|
||||
// 修复【#397】:动态获取当前科室名称
|
||||
const currentDeptName = computed(() => {
|
||||
@@ -907,13 +906,11 @@ const mapFrontendStatusToBackend = (status) => {
|
||||
// 从数据库加载队列
|
||||
const loadQueueFromDb = async () => {
|
||||
try {
|
||||
// 如果选择了具体科室,就按科室加载;否则加载当前登录人科室(后端默认)
|
||||
const organizationId = selectedDept.value !== 'all' ? selectedDept.value : undefined
|
||||
// 只查询今天的患者
|
||||
// 使用当前登录人的科室
|
||||
const today = new Date()
|
||||
const todayStr = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`
|
||||
console.log('【心内科】loadQueueFromDb 开始:organizationId=', organizationId, 'date=', todayStr, 'selectedDept=', selectedDept.value)
|
||||
const res = await getTriageQueueList({ organizationId, date: todayStr }).catch((err) => {
|
||||
console.log('【心内科】loadQueueFromDb 开始:date=', todayStr)
|
||||
const res = await getTriageQueueList({ date: todayStr }).catch((err) => {
|
||||
console.error('【心内科】loadQueueFromDb 请求异常:', err)
|
||||
return { code: 500, msg: err?.message || '请求失败', data: null }
|
||||
})
|
||||
@@ -1141,6 +1138,8 @@ const loadDataFromApi = async () => {
|
||||
|
||||
// 同步当前呼叫(队列从 DB 加载后已同步;这里再兜底一次)
|
||||
syncCurrentCallFromQueue()
|
||||
// 提取诊室列表供过滤栏使用
|
||||
extractClinicRooms()
|
||||
console.log('【心内科】数据加载完成:候选池', originalCandidatePoolList.value.length, '条,队列', originalQueueList.value.length, '条')
|
||||
ElMessage.success('【心内科】已从门诊挂号接口加载数据')
|
||||
} catch (e) {
|
||||
@@ -1152,56 +1151,37 @@ const loadDataFromApi = async () => {
|
||||
totalSignedIn.value = originalCandidatePoolList.value.length
|
||||
totalInQueue.value = originalQueueList.value.length
|
||||
syncCurrentCallFromQueue()
|
||||
extractClinicRooms()
|
||||
}
|
||||
}
|
||||
|
||||
// 原始数据存储(用于过滤)
|
||||
const originalCandidatePoolList = ref(getInitialCandidatePoolList())
|
||||
|
||||
// 辅助函数:扁平化科室树形结构
|
||||
const flattenDepartmentTree = (tree, result = []) => {
|
||||
if (!Array.isArray(tree)) return result
|
||||
tree.forEach(node => {
|
||||
if (node.id && node.name) {
|
||||
result.push({ id: node.id, name: node.name })
|
||||
}
|
||||
if (node.children && Array.isArray(node.children)) {
|
||||
flattenDepartmentTree(node.children, result)
|
||||
// 提取诊室列表(从队列和候选池数据中动态获取)
|
||||
const extractClinicRooms = () => {
|
||||
const roomSet = new Set()
|
||||
// 从队列中提取
|
||||
originalQueueList.value.forEach(item => {
|
||||
if (item.room && item.room !== '-') {
|
||||
roomSet.add(item.room)
|
||||
}
|
||||
})
|
||||
return result
|
||||
// 从候选池中提取
|
||||
originalCandidatePoolList.value.forEach(item => {
|
||||
if (item.room && item.room !== '-') {
|
||||
roomSet.add(item.room)
|
||||
}
|
||||
|
||||
// 加载就诊科室列表
|
||||
const loadDepartmentList = async () => {
|
||||
try {
|
||||
const response = await getLocationTree()
|
||||
if (response && response.data) {
|
||||
// 扁平化树形结构
|
||||
departmentList.value = flattenDepartmentTree(response.data)
|
||||
console.log('【心内科】已加载就诊科室列表:', departmentList.value.length, '个科室')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('【心内科】加载就诊科室列表失败:', error)
|
||||
ElMessage.warning('加载就诊科室列表失败,使用默认数据')
|
||||
}
|
||||
}
|
||||
|
||||
// 获取选中科室的名称
|
||||
const getSelectedDeptName = () => {
|
||||
if (selectedDept.value === 'all') return null
|
||||
const dept = departmentList.value.find(d => d.id === selectedDept.value)
|
||||
return dept ? dept.name : null
|
||||
})
|
||||
clinicRoomList.value = Array.from(roomSet).sort()
|
||||
}
|
||||
|
||||
// 过滤后的智能候选池数据
|
||||
const filteredCandidatePoolList = computed(() => {
|
||||
if (selectedDept.value === 'all') {
|
||||
if (selectedClinicRoom.value === 'all') {
|
||||
return originalCandidatePoolList.value
|
||||
}
|
||||
const deptName = getSelectedDeptName()
|
||||
if (!deptName) return originalCandidatePoolList.value
|
||||
return originalCandidatePoolList.value.filter(item => item.room === deptName)
|
||||
return originalCandidatePoolList.value.filter(item => item.room === selectedClinicRoom.value)
|
||||
})
|
||||
|
||||
// 原始队列数据存储(用于过滤)
|
||||
@@ -1223,19 +1203,16 @@ const formatSecondsToMmSs = (totalSeconds) => {
|
||||
return `${mm}:${ss}`
|
||||
}
|
||||
|
||||
// 过滤后的智能队列数据(同时考虑科室过滤和状态过滤)
|
||||
// 过滤后的智能队列数据(同时考虑诊室过滤和状态过滤)
|
||||
const filteredQueueList = computed(() => {
|
||||
let filtered = originalQueueList.value
|
||||
|
||||
// 先过滤掉"已完成"状态的患者(无论什么情况都不显示)
|
||||
filtered = filtered.filter(item => item.status !== '已完成')
|
||||
|
||||
// 再按科室过滤
|
||||
if (selectedDept.value !== 'all') {
|
||||
const deptName = getSelectedDeptName()
|
||||
if (deptName) {
|
||||
filtered = filtered.filter(item => item.room === deptName)
|
||||
}
|
||||
// 再按诊室过滤
|
||||
if (selectedClinicRoom.value !== 'all') {
|
||||
filtered = filtered.filter(item => item.room === selectedClinicRoom.value)
|
||||
}
|
||||
|
||||
// 再按状态过滤(只显示等待)
|
||||
@@ -1747,9 +1724,9 @@ const handleNextPatient = async () => {
|
||||
reqData.organizationId = selectedQueueRow.value.organizationId
|
||||
} else {
|
||||
// 如果没有选中患者,使用查询条件(兼容旧逻辑)
|
||||
let orgId = selectedDept.value !== 'all' ? selectedDept.value : undefined
|
||||
// "全科"模式:优先用"当前叫号中/第一个等待"所在科室
|
||||
if (orgId == null) {
|
||||
// 全科模式:优先用"当前叫号中/第一个等待"所在科室
|
||||
let orgId = null
|
||||
{
|
||||
const calling = originalQueueList.value.find((i) => i.status === '叫号中')
|
||||
const waiting = originalQueueList.value.find((i) => i.status === '等待')
|
||||
console.log('【心内科】handleNextPatient 查找:叫号中=', calling?.patientName, '等待=', waiting?.patientName)
|
||||
@@ -1785,9 +1762,9 @@ const handleSkip = async () => {
|
||||
reqData.organizationId = selectedQueueRow.value.organizationId
|
||||
} else {
|
||||
// 如果没有选中患者,使用查询条件(兼容旧逻辑)
|
||||
let orgId = selectedDept.value !== 'all' ? selectedDept.value : undefined
|
||||
// “全科”模式:优先用“当前叫号中”所在科室
|
||||
if (orgId == null) {
|
||||
// 全科模式:优先用”当前叫号中”所在科室
|
||||
let orgId = null
|
||||
{
|
||||
const calling = originalQueueList.value.find((i) => i.status === '叫号中')
|
||||
orgId = calling?.organizationId
|
||||
}
|
||||
@@ -1819,9 +1796,9 @@ const handleComplete = async () => {
|
||||
reqData.organizationId = selectedQueueRow.value.organizationId
|
||||
} else {
|
||||
// 如果没有选中患者,使用查询条件(兼容旧逻辑)
|
||||
let orgId = selectedDept.value !== 'all' ? selectedDept.value : undefined
|
||||
// “全科”模式:优先用“当前叫号中”所在科室
|
||||
if (orgId == null) {
|
||||
// 全科模式:优先用”当前叫号中”所在科室
|
||||
let orgId = null
|
||||
{
|
||||
const calling = originalQueueList.value.find((i) => i.status === '叫号中')
|
||||
orgId = calling?.organizationId
|
||||
}
|
||||
@@ -1853,9 +1830,9 @@ const handleRequeue = async () => {
|
||||
reqData.organizationId = selectedQueueRow.value.organizationId
|
||||
} else {
|
||||
// 如果没有选中患者,使用查询条件(兼容旧逻辑)
|
||||
let orgId = selectedDept.value !== 'all' ? selectedDept.value : undefined
|
||||
// “全科”模式:优先用“当前叫号中”所在科室
|
||||
if (orgId == null) {
|
||||
// 全科模式:优先用”当前叫号中”所在科室
|
||||
let orgId = null
|
||||
{
|
||||
const calling = originalQueueList.value.find((i) => i.status === '叫号中')
|
||||
orgId = calling?.organizationId
|
||||
}
|
||||
@@ -2121,8 +2098,6 @@ const handleTestRule = () => {
|
||||
|
||||
// 组件挂载
|
||||
onMounted(() => {
|
||||
// 加载就诊科室列表
|
||||
loadDepartmentList()
|
||||
// 初始化:优先从后端加载,失败则回退本地假数据
|
||||
loadDataFromApi()
|
||||
startWaitingTimer()
|
||||
|
||||
Reference in New Issue
Block a user