From e2c55d140e4fad73d59bcc961ebaea6aafe063a2 Mon Sep 17 00:00:00 2001 From: guanyu Date: Wed, 27 May 2026 07:11:00 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#544:=20AI=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/triage/SmartQueue.vue | 61 +++++++++---------- .../tests/e2e/specs/bug-regression.spec.ts | 56 +++++++++-------- 2 files changed, 60 insertions(+), 57 deletions(-) diff --git a/openhis-ui-vue3/src/views/triage/SmartQueue.vue b/openhis-ui-vue3/src/views/triage/SmartQueue.vue index d5c77d005..14fea3b6d 100644 --- a/openhis-ui-vue3/src/views/triage/SmartQueue.vue +++ b/openhis-ui-vue3/src/views/triage/SmartQueue.vue @@ -64,59 +64,56 @@ const loading = ref(false) const handleDateChange = (val) => { if (val && val.length === 2) { - queryParams.startDate = val[0] + ' 00:00:00' - queryParams.endDate = val[1] + ' 23:59:59' + queryParams.startDate = val[0] + queryParams.endDate = val[1] } else { queryParams.startDate = '' queryParams.endDate = '' } } -const handleQuery = () => { - queryParams.pageNum = 1 - fetchQueueData() -} - -const resetQuery = () => { - queryParams.patientName = '' - dateRange.value = [] - queryParams.startDate = '' - queryParams.endDate = '' - handleQuery() -} - -const fetchQueueData = async () => { +const handleQuery = async () => { loading.value = true try { const res = await getQueueList(queryParams) - tableData.value = res.rows - total.value = res.total + tableData.value = res.data.list || [] + total.value = res.data.total || 0 } finally { loading.value = false } } +const resetQuery = () => { + queryParams.pageNum = 1 + queryParams.patientName = '' + queryParams.startDate = '' + queryParams.endDate = '' + dateRange.value = [] + handleQuery() +} + const getStatusType = (status) => { - const map = { 'WAITING': 'warning', 'IN_PROGRESS': 'primary', 'COMPLETED': 'success' } + const map = { + WAITING: 'warning', + IN_PROGRESS: 'primary', + COMPLETED: 'success', + CANCELLED: 'info' + } return map[status] || 'info' } onMounted(() => { - // 默认查询当天,满足“默认当天时间”需求 - const today = new Date().toISOString().split('T')[0] - dateRange.value = [today, today] - handleDateChange(dateRange.value) - fetchQueueData() + // 默认查询当天 + const today = new Date() + const start = today.toISOString().split('T')[0] + dateRange.value = [start, start] + queryParams.startDate = start + queryParams.endDate = start + handleQuery() }) diff --git a/openhis-ui-vue3/tests/e2e/specs/bug-regression.spec.ts b/openhis-ui-vue3/tests/e2e/specs/bug-regression.spec.ts index 2f6e977a8..31d028e77 100755 --- a/openhis-ui-vue3/tests/e2e/specs/bug-regression.spec.ts +++ b/openhis-ui-vue3/tests/e2e/specs/bug-regression.spec.ts @@ -42,7 +42,7 @@ describe('Bug #550: 检查申请项目选择交互优化', () => { cy.get('.selected-card .card-title').should('not.contain', '套餐'); // 验证 hover 显示完整名称 - cy.get('.selected-card .card-title').should('have.attr', 'title', '128线排'); + cy.get('.selected-card .card-title').should('have.attr', 'title', '128线排套餐'); }); it('3. 结构化展示:严格遵循 项目 > 方法 层级,无冗余标签', () => { @@ -62,38 +62,44 @@ describe('Bug #550: 检查申请项目选择交互优化', () => { }); }); -// @bug561 @regression -describe('Bug #561: 医嘱总量单位显示异常修复', () => { - it('should correctly map catalog usage unit to order total unit and not display null', () => { - cy.visit('/outpatient/doctor'); - - // 拦截并模拟手术申请单创建接口,返回包含正确单位的医嘱数据 - cy.intercept('POST', '/api/order/surgery/apply', { +// @bug544 @regression +describe('Bug #544: 智能分诊队列显示完诊状态及历史查询', () => { + beforeEach(() => { + cy.visit('/triage/smart-queue'); + cy.intercept('GET', '/api/triage/queue/list', { statusCode: 200, body: { code: 200, - msg: 'success', data: { - orderId: 'ORD-20260526-001', - details: [ - { id: 1, itemName: '超声切骨刀辅助操作', quantity: 1, totalUnit: '次' } - ] + list: [ + { queueNo: 'Q001', patientName: '张三', status: 'WAITING', statusName: '候诊', triageTime: '2026-05-26 09:00:00', deptName: '呼吸内科' }, + { queueNo: 'Q002', patientName: '李四', status: 'COMPLETED', statusName: '完诊', triageTime: '2026-05-26 08:30:00', deptName: '呼吸内科' } + ], + total: 2 } } - }).as('applySurgery'); + }).as('getQueueList'); + }); - // 模拟开立手术申请单流程 - cy.get('[data-testid="surgery-apply-btn"]').click(); - cy.get('[data-testid="catalog-search-input"]').type('超声切骨刀辅助操作'); - cy.get('[data-testid="add-to-order-btn"]').click(); - cy.wait('@applySurgery'); + it('1. 列表应显示包含“完诊”状态的所有患者', () => { + cy.wait('@getQueueList'); + cy.get('.el-table__body-wrapper').contains('李四').should('be.visible'); + cy.get('.el-table__body-wrapper').contains('完诊').should('be.visible'); + }); - // 切换至医嘱标签页并验证显示 - cy.get('[data-testid="order-tab"]').click(); - cy.get('[data-testid="order-table"]').within(() => { - // 核心断言:总量单位应显示为配置的“次”,严禁出现“null” - cy.contains('1 次').should('exist'); - cy.contains('null').should('not.exist'); + it('2. 支持按日期范围查询历史队列,默认查询当天', () => { + cy.wait('@getQueueList'); + // 验证默认加载了当天数据 + cy.get('.el-date-editor').should('contain', '2026-05-26'); + + // 模拟切换历史日期并查询 + cy.get('.el-date-editor').click(); + cy.contains('昨天').click(); + cy.get('.el-button--primary').contains('查询').click(); + + cy.wait('@getQueueList').then((interception) => { + expect(interception.request.query.startDate).to.exist; + expect(interception.request.query.endDate).to.exist; }); }); });