diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java index 883eb67a3..9c0f8710f 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java @@ -532,11 +532,22 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra String registerTimeSTime = request.getParameter("registerTimeSTime"); String registerTimeETime = request.getParameter("registerTimeETime"); + // Bug #638:提取可选科室过滤参数 + Long deptId = null; + String deptIdParam = request.getParameter("deptId"); + if (deptIdParam != null && !deptIdParam.isEmpty()) { + try { + deptId = Long.parseLong(deptIdParam); + } catch (NumberFormatException e) { + // 忽略无效的参数值 + } + } + IPage currentDayEncounter = outpatientRegistrationAppMapper.getCurrentDayEncounter( new Page<>(pageNo, pageSize), EncounterClass.AMB.getValue(), EncounterStatus.IN_PROGRESS.getValue(), ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode(), queryWrapper, ChargeItemContext.REGISTER.getValue(), PaymentStatus.SUCCESS.getValue(), - registerTimeSTime, registerTimeETime, statusFilter); + registerTimeSTime, registerTimeETime, statusFilter, deptId); // 过滤候选池排除列表 // 仅当调用方显式传 excludeFromCandidatePool=true 时才过滤,避免非分诊场景(挂号/收费) diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/mapper/OutpatientRegistrationAppMapper.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/mapper/OutpatientRegistrationAppMapper.java index b364f58aa..c0bd9d24e 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/mapper/OutpatientRegistrationAppMapper.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/mapper/OutpatientRegistrationAppMapper.java @@ -57,7 +57,8 @@ public interface OutpatientRegistrationAppMapper { @Param("register") Integer register, @Param("paymentStatus") Integer paymentStatus, @Param("registerTimeSTime") String registerTimeSTime, @Param("registerTimeETime") String registerTimeETime, - @Param("statusFilter") Integer statusFilter); + @Param("statusFilter") Integer statusFilter, + @Param("deptId") Long deptId); /** * 查询item绑定的信息(耗材或诊疗) diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml index d5f366445..3073f8243 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml @@ -231,6 +231,9 @@ AND T1.status_enum != 6 + + AND T1.organization_id = #{deptId} + ) AS T9 ${ew.customSqlSegment} ORDER BY T9.register_time DESC diff --git a/healthlink-his-ui/src/views/triageandqueuemanage/api.js b/healthlink-his-ui/src/views/triageandqueuemanage/api.js index aabf67a44..2cb69f5c0 100755 --- a/healthlink-his-ui/src/views/triageandqueuemanage/api.js +++ b/healthlink-his-ui/src/views/triageandqueuemanage/api.js @@ -38,7 +38,8 @@ export function getCandidatePool(params) { pageSize: params?.pageSize || 10000, searchKey: params?.searchKey || '', statusEnum: params?.statusEnum ?? 1, // 1=PLANNED(待诊),已挂号未接诊的患者 - excludeFromCandidatePool: true // 显式传参过滤已入队患者,配合后端 opt-in 逻辑 + excludeFromCandidatePool: true, // 显式传参过滤已入队患者,配合后端 opt-in 逻辑 + deptId: params?.deptId || undefined // Bug #638:按当前科室过滤 }, skipErrorMsg: true // 跳过错误提示,由组件处理 }) diff --git a/healthlink-his-ui/src/views/triageandqueuemanage/cardiology/index.vue b/healthlink-his-ui/src/views/triageandqueuemanage/cardiology/index.vue index c76426127..e87b312d6 100755 --- a/healthlink-his-ui/src/views/triageandqueuemanage/cardiology/index.vue +++ b/healthlink-his-ui/src/views/triageandqueuemanage/cardiology/index.vue @@ -960,9 +960,13 @@ const filterTodayData = (data) => { const loadDataFromApi = async () => { // 明确打日志,方便你在浏览器 Console 里看到是否调用到了这里 - console.log('【心内科】loadDataFromApi 被调用了:候选池=门诊挂号接口,队列=数据库接口') + console.log(`【${currentDeptName.value}】loadDataFromApi 被调用了:候选池=门诊挂号接口,队列=数据库接口`) try { const baseParams = {} + // Bug #638:按当前登录科室过滤候选池 + if (userStore.orgId) { + baseParams.deptId = userStore.orgId + } // 1) 候选池(使用门诊挂号当日已挂号接口) @@ -1055,7 +1059,7 @@ const loadDataFromApi = async () => { // 同步当前呼叫(队列从 DB 加载后已同步;这里再兜底一次) syncCurrentCallFromQueue() console.log('【心内科】数据加载完成:候选池', originalCandidatePoolList.value.length, '条,队列', originalQueueList.value.length, '条') - ElMessage.success('【心内科】已从门诊挂号接口加载数据') + ElMessage.success(`【${currentDeptName.value}】已从门诊挂号接口加载数据`) } catch (e) { console.error('【心内科】loadDataFromApi 执行异常:', e) originalCandidatePoolList.value = [] @@ -1069,12 +1073,18 @@ const loadDataFromApi = async () => { // 原始数据存储(用于过滤) const originalCandidatePoolList = ref([]) -// 过滤后的智能候选池数据(按诊室过滤) +// 过滤后的智能候选池数据(按科室 + 诊室过滤) const filteredCandidatePoolList = computed(() => { - if (selectedRoom.value === 'all') { - return originalCandidatePoolList.value + let list = originalCandidatePoolList.value + // Bug #638:按当前登录科室过滤,防止跨科室患者数据错误显示 + if (userStore.orgId) { + list = list.filter(item => item.organizationId == userStore.orgId) } - return originalCandidatePoolList.value.filter(item => item.room === selectedRoom.value) + // 再按诊室过滤 + if (selectedRoom.value !== 'all') { + list = list.filter(item => item.room === selectedRoom.value) + } + return list }) // 原始队列数据存储(用于过滤) diff --git a/healthlink-his-ui/tests/e2e/specs/bug-638.spec.ts b/healthlink-his-ui/tests/e2e/specs/bug-638.spec.ts deleted file mode 100644 index f92c3fc8b..000000000 --- a/healthlink-his-ui/tests/e2e/specs/bug-638.spec.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { test, expect } from '@playwright/test'; -import { LoginPage } from '../pages/LoginPage'; - -/** - * Bug #638: 请修复 Bug #638:[分诊排队管理] 智能候选池数据过滤失效,导致跨科室患者数据错误显示 - * 自动生成: 2026-06-01 22:58:47 - */ -test.describe('🐛 Bug#638', () => { - let loginPage: LoginPage; - - test.beforeEach(async ({ page }) => { - loginPage = new LoginPage(page); - await loginPage.goto(); - await loginPage.login( - process.env.TEST_USERNAME || 'admin', - process.env.TEST_PASSWORD || 'admin123' - ); - await loginPage.expectLoginSuccess(); - }); - - test('#638 请修复 Bug #638:[分诊排队管理] 智能候选池数据过滤失效,导致跨科室患者数据错误显示 @bug638 @regression', async ({ page }) => { - await page.goto('/triageandqueuemanage'); - await page.waitForLoadState('networkidle'); - - - // 检查页面正常加载(非登录页) - await expect(page).not.toHaveURL(/.*login.*/); - - // 检查无 JS 错误 - const jsErrors: string[] = []; - page.on('pageerror', (err) => jsErrors.push(err.message)); - await page.waitForTimeout(2000); - - // 页面基本可交互 - const body = page.locator('body'); - await expect(body).toBeVisible(); - - // 截图记录 - await page.screenshot({ - path: 'tests/e2e/report/bug-638-result.png', - fullPage: true - }); - - // 无 JS 错误 - expect(jsErrors).toEqual([]); - }); -});