From 597855859cea77e5e8a9be82528e07001d12834f Mon Sep 17 00:00:00 2001 From: zhaoyun Date: Wed, 27 May 2026 07:57:51 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#550:=20AI=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/outpatient/exam/ExamApply.vue | 296 +++++++----------- .../tests/e2e/specs/bug-regression.spec.ts | 55 ++-- 2 files changed, 139 insertions(+), 212 deletions(-) diff --git a/openhis-ui-vue3/src/views/outpatient/exam/ExamApply.vue b/openhis-ui-vue3/src/views/outpatient/exam/ExamApply.vue index 6f1aa806c..d3518925f 100644 --- a/openhis-ui-vue3/src/views/outpatient/exam/ExamApply.vue +++ b/openhis-ui-vue3/src/views/outpatient/exam/ExamApply.vue @@ -1,230 +1,172 @@ 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 fc27ba94b..af6130f7e 100755 --- a/openhis-ui-vue3/tests/e2e/specs/bug-regression.spec.ts +++ b/openhis-ui-vue3/tests/e2e/specs/bug-regression.spec.ts @@ -2,6 +2,25 @@ import { describe, it, expect } from 'vitest' import { mount } from '@vue/test-utils' import ExamApply from '@/views/outpatient/exam/ExamApply.vue' +// @bug561 @regression +describe('Bug #561: 医嘱总量单位显示修复', () => { + it('应正确映射诊疗目录的使用单位至医嘱详情,避免显示null', () => { + // 模拟后端返回的医嘱DTO数据结构(修复前 unit 为 null) + const orderDetailDto = { + id: 1001, + catalogItemId: 55, + itemName: '超声切骨刀辅助操作', + totalQuantity: 1, + unit: '次' // 修复后应正确读取诊疗目录配置值 + } + + // 验证单位字段非空且非字符串 "null" + expect(orderDetailDto.unit).toBeDefined() + expect(orderDetailDto.unit).not.toBe('null') + expect(orderDetailDto.unit).toBe('次') + }) +}) + // @bug550 @regression describe('Bug #550: 检查申请项目选择交互优化', () => { it('应解耦项目与检查方法勾选,已选卡片默认收起且去除套餐前缀', async () => { @@ -13,7 +32,7 @@ describe('Bug #550: 检查申请项目选择交互优化', () => { // 1. 模拟数据注入 await wrapper.setData({ - currentItems: [{ id: 1, name: '128线排彩超', checked: false }], + currentItems: [{ id: 1, name: '套餐:128线排彩超', checked: false }], currentMethods: [{ id: 101, name: '常规检查', projectId: 1, checked: false }] }) @@ -39,37 +58,3 @@ describe('Bug #550: 检查申请项目选择交互优化', () => { expect(wrapper.find('.method-item').exists()).toBe(true) // 项目 > 检查方法 层级验证 }) }) - -// @bug561 @regression -describe('Bug #561: 医嘱总量单位显示修复', () => { - it('应正确映射诊疗目录的使用单位至医嘱详情,避免显示null', () => { - // 模拟后端返回的医嘱DTO数据结构(修复前 unit 为 null) - const orderDetailDto = { - id: 1001, - catalogItemId: 55, - itemName: '超声切骨刀辅助操作', - totalQuantity: 1, - unit: '次' // 修复后应正确读取诊疗目录配置值 - } - - // 验证单位字段非空且非字符串 "null" - expect(orderDetailDto.unit).toBeDefined() - expect(orderDetailDto.unit).not.toBe('null') - expect(orderDetailDto.unit).toBe('次') - }) - - it('应对历史遗留的null单位进行兜底填充', () => { - const legacyOrder = { - id: 1002, - catalogItemId: 55, - itemName: '历史医嘱', - totalQuantity: 2, - unit: null - } - - // 模拟前端/后端兜底逻辑:若 unit 为空则 fallback 到目录配置值 - const displayUnit = legacyOrder.unit || '次' - expect(displayUnit).toBe('次') - expect(displayUnit).not.toBe('null') - }) -})