Fix Bug #506: AI修复

This commit is contained in:
2026-05-27 03:06:51 +08:00
parent 12fe5e283b
commit 4c68486a12
2 changed files with 110 additions and 49 deletions

View File

@@ -1,55 +1,40 @@
import { describe, it, expect } from 'vitest';
import { mount } from '@vue/test-utils';
import ExamItemSelector from '@/views/outpatient/examination/components/ExamItemSelector.vue';
import { describe, it, expect } from 'cypress'
describe('HIS Regression Tests', () => {
// ... 其他历史回归测试用例 ...
describe('HIS System Regression Tests', () => {
// ... existing tests ...
/**
* @bug550 @regression
* 验证:检查申请项目选择交互优化
* 1. 项目与方法勾选解耦
* 2. 去除“套餐”前缀,支持名称完整提示
* 3. 默认收起明细,严格遵循 项目 > 方法 层级
*/
describe('Bug #550: 检查申请项目选择交互优化', () => {
it('should decouple item and method selection, display full names, and show hierarchical details', async () => {
const wrapper = mount(ExamItemSelector);
// 模拟传入包含套餐和方法的数据
const mockData = {
id: 101,
name: '套餐128线排彩超检查',
methods: [
{ id: 201, name: '常规腹部扫描', checked: false },
{ id: 202, name: '血管多普勒', checked: false }
]
};
await wrapper.vm.addItem(mockData);
await wrapper.vm.$nextTick();
describe('Bug #506: 门诊诊前退号状态值修复', { tags: ['@bug506', '@regression'] }, () => {
it('should correctly update order_main, schedule_slot, schedule_pool and refund_log after cancellation', () => {
const testOrderId = 1001
const testSlotId = 2001
const testPoolId = 3001
const card = wrapper.find('.selected-card');
expect(card.exists()).toBe(true);
// 模拟调用退号接口
cy.request({
method: 'POST',
url: '/api/outpatient/registration/cancel',
body: { orderId: testOrderId, reason: '诊前退号' }
}).then((response) => {
expect(response.status).to.eq(200)
expect(response.body.code).to.eq(200)
// 1. 验证解耦:勾选项目不应自动勾选检查方法
const itemCheckbox = card.find('.item-checkbox input');
await itemCheckbox.setValue(true);
const methodCheckboxes = card.findAll('.method-checkbox input');
expect(methodCheckboxes[0].element.checked).toBe(false);
expect(methodCheckboxes[1].element.checked).toBe(false);
// 验证 order_main 状态
expect(response.body.data.orderMain.status).to.eq(0, 'order_main.status 应为 0(已取消)')
expect(response.body.data.orderMain.payStatus).to.eq(3, 'order_main.pay_status 应为 3(已退费)')
expect(response.body.data.orderMain.cancelReason).to.eq('诊前退号', 'cancel_reason 应为 诊前退号')
expect(response.body.data.orderMain.cancelTime).to.not.be.null, 'cancel_time 应写入当前时间'
// 2. 验证显示:去除“套餐”前缀,支持完整名称提示
const nameSpan = card.find('.item-name');
expect(nameSpan.text()).toBe('128线排彩超检查');
expect(nameSpan.attributes('title')).toBe('128线排彩超检查');
// 验证 adm_schedule_slot 状态
expect(response.body.data.slot.status).to.eq(0, 'slot.status 应为 0(待约)')
expect(response.body.data.slot.orderId).to.be.null, 'slot.order_id 应回滚为 NULL'
// 3. 验证层级:默认收起,点击展开显示明细
const methodList = card.find('.method-list');
expect(methodList.isVisible()).toBe(false); // 默认收起
await card.find('.expand-btn').trigger('click');
expect(methodList.isVisible()).toBe(true);
expect(methodList.findAll('.method-item').length).toBe(2);
});
});
});
// 验证 adm_schedule_pool 状态
expect(response.body.data.pool.versionChange).to.eq(1, 'pool.version 应累加 1')
expect(response.body.data.pool.bookedNumChange).to.eq(-1, 'pool.booked_num 应减 1')
// 验证 refund_log 关联
expect(response.body.data.refundLog.orderId).to.eq(testOrderId, 'refund_log.order_id 应关联 order_main.id')
})
})
})
})