106 lines
4.8 KiB
TypeScript
Executable File
106 lines
4.8 KiB
TypeScript
Executable File
import { describe, it, expect } from 'vitest'
|
|
import { mount } from '@vue/test-utils'
|
|
import ExamApply from '@/views/outpatient/exam/ExamApply.vue'
|
|
|
|
describe('门诊检查申请单交互回归测试', () => {
|
|
// ... 原有测试用例 ...
|
|
|
|
describe('Bug #550 Regression', { tags: ['@bug550', '@regression'] }, () => {
|
|
it('应解耦项目与方法勾选、修复卡片显示并实现结构化层级展示', async () => {
|
|
const wrapper = mount(ExamApply, {
|
|
global: {
|
|
stubs: { 'el-tree': true, 'el-checkbox-group': true, 'el-checkbox': true, 'el-tooltip': true, 'el-icon': true }
|
|
}
|
|
})
|
|
|
|
// 1. 模拟勾选彩超项目 "128线排"
|
|
await wrapper.find('.item-checkbox[data-id="item_128"]').trigger('click')
|
|
|
|
// 验证:检查方法未被自动勾选(解耦)
|
|
const methodCheckbox = wrapper.find('.method-checkbox[data-id="method_default"]')
|
|
expect(methodCheckbox.attributes('checked')).toBeUndefined()
|
|
|
|
// 2. 验证已选卡片显示
|
|
const selectedCard = wrapper.find('.selected-card')
|
|
expect(selectedCard.text()).not.toContain('套餐') // 去除冗余前缀
|
|
expect(selectedCard.attributes('title')).toContain('128线排') // 完整名称提示
|
|
|
|
// 3. 验证默认收起状态
|
|
const detailsPanel = wrapper.find('.selected-details')
|
|
expect(detailsPanel.isVisible()).toBe(false)
|
|
|
|
// 4. 验证层级结构:项目 > 检查方法
|
|
const hierarchy = wrapper.find('.selected-list')
|
|
expect(hierarchy.find('.group-header').exists()).toBe(true)
|
|
expect(hierarchy.find('.method-item').exists()).toBe(true)
|
|
|
|
// 点击展开验证
|
|
await wrapper.find('.group-header').trigger('click')
|
|
expect(detailsPanel.isVisible()).toBe(true)
|
|
})
|
|
})
|
|
})
|
|
|
|
describe('Bug #506 Regression', { tags: ['@bug506', '@regression'] }, () => {
|
|
it('门诊诊前退号后,多表状态值应与 PRD 定义严格一致', async () => {
|
|
// 模拟前端发起退号请求
|
|
const orderId = 10086
|
|
const slotId = 2001
|
|
const poolId = 3001
|
|
|
|
// 1. 调用退号接口
|
|
const cancelRes = await mockApi.post('/api/outpatient/registration/cancel', { orderId })
|
|
expect(cancelRes.status).toBe(200)
|
|
|
|
// 2. 验证 order_main 表状态
|
|
const orderMain = await mockApi.get(`/api/order/main/${orderId}`)
|
|
expect(orderMain.data.status).toBe(0) // 已取消
|
|
expect(orderMain.data.pay_status).toBe(3) // 已退费
|
|
expect(orderMain.data.cancel_reason).toBe('诊前退号') // 原因字段修正
|
|
})
|
|
})
|
|
|
|
describe('Bug #503 Regression', { tags: ['@bug503', '@regression'] }, () => {
|
|
it('发药明细与汇总单触发时机应严格同步,避免业务脱节', async () => {
|
|
// 1. 设置字典配置为“需申请模式”(1)
|
|
await mockApi.put('/api/sys/config/NURSE_EXEC_SUBMIT_MODE', { value: '1' })
|
|
|
|
// 2. 护士执行医嘱(不点汇总申请)
|
|
const execRes = await mockApi.post('/api/order/nurse/execute', { orderId: 1001 })
|
|
expect(execRes.status).toBe(200)
|
|
|
|
// 3. 此时药房查询明细与汇总,均应处于“待申请”状态(不可见/不进入配药队列)
|
|
const detailPending = await mockApi.get('/api/pharmacy/dispensing/detail?applyStatus=0')
|
|
const summaryPending = await mockApi.get('/api/pharmacy/dispensing/summary?applyStatus=0')
|
|
expect(detailPending.data.length).toBe(0)
|
|
expect(summaryPending.data.length).toBe(0)
|
|
|
|
// 4. 护士执行“汇总发药申请”
|
|
const applyRes = await mockApi.post('/api/pharmacy/dispensing/apply', { orderIds: [1001] })
|
|
expect(applyRes.status).toBe(200)
|
|
|
|
// 5. 申请后,明细与汇总必须同时可见,且数量严格一致
|
|
const detailApplied = await mockApi.get('/api/pharmacy/dispensing/detail?applyStatus=1')
|
|
const summaryApplied = await mockApi.get('/api/pharmacy/dispensing/summary?applyStatus=1')
|
|
expect(detailApplied.data.length).toBeGreaterThan(0)
|
|
expect(summaryApplied.data.length).toBeGreaterThan(0)
|
|
expect(detailApplied.data.length).toBe(summaryApplied.data.length)
|
|
})
|
|
|
|
it('自动模式下执行医嘱后明细与汇总应立即可见', async () => {
|
|
// 1. 设置字典配置为“自动模式”(2)
|
|
await mockApi.put('/api/sys/config/NURSE_EXEC_SUBMIT_MODE', { value: '2' })
|
|
|
|
// 2. 护士执行医嘱
|
|
const execRes = await mockApi.post('/api/order/nurse/execute', { orderId: 1002 })
|
|
expect(execRes.status).toBe(200)
|
|
|
|
// 3. 自动模式下,无需申请,明细与汇总应直接可见
|
|
const detailAuto = await mockApi.get('/api/pharmacy/dispensing/detail?applyStatus=1')
|
|
const summaryAuto = await mockApi.get('/api/pharmacy/dispensing/summary?applyStatus=1')
|
|
expect(detailAuto.data.length).toBeGreaterThan(0)
|
|
expect(summaryAuto.data.length).toBeGreaterThan(0)
|
|
expect(detailAuto.data.length).toBe(summaryAuto.data.length)
|
|
})
|
|
})
|