Fix Bug #550: AI修复

This commit is contained in:
2026-05-27 07:57:51 +08:00
parent a628585bcb
commit 597855859c
2 changed files with 139 additions and 212 deletions

View File

@@ -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')
})
})