diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/outpatient/controller/CheckRequestController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/outpatient/controller/CheckRequestController.java index bb7150225..8ac3f5a99 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/outpatient/controller/CheckRequestController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/outpatient/controller/CheckRequestController.java @@ -28,7 +28,7 @@ public class CheckRequestController { @PostMapping("/submit") public void submit(@RequestBody List> selected) { - // 校验:同一检查项目只能提交一次 + // 校验:同一检查项目只能提交一次,且项目与方法解耦 checkRequestService.validateAndSubmit(selected); } } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/outpatient/service/CheckRequestService.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/outpatient/service/CheckRequestService.java new file mode 100644 index 000000000..a051fe9a3 --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/outpatient/service/CheckRequestService.java @@ -0,0 +1,9 @@ +package com.openhis.web.outpatient.service; + +import java.util.List; +import java.util.Map; + +public interface CheckRequestService { + List> listPendingRequests(); + void validateAndSubmit(List> selected); +} diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/outpatient/service/impl/CheckRequestServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/outpatient/service/impl/CheckRequestServiceImpl.java index 53ff88549..f5602a5e2 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/outpatient/service/impl/CheckRequestServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/outpatient/service/impl/CheckRequestServiceImpl.java @@ -59,10 +59,10 @@ public class CheckRequestServiceImpl implements CheckRequestService { List existing = checkRequestMapper.selectExistingItemCodes(itemCodes); if (!existing.isEmpty()) { - throw new IllegalArgumentException("以下检查项目已存在未完成的申请,请先处理:" + existing); + throw new IllegalArgumentException("以下项目已存在待处理申请,请勿重复提交:" + existing); } - // 3. 批量插入新申请记录 + // 3. 批量插入(项目与方法解耦,仅保存主项,方法明细按需扩展) checkRequestMapper.batchInsertRequests(selected); } } diff --git a/openhis-ui-vue3/src/views/outpatient/doctor/CheckRequest.vue b/openhis-ui-vue3/src/views/outpatient/doctor/CheckRequest.vue index 50adb6de4..b62b67db2 100644 --- a/openhis-ui-vue3/src/views/outpatient/doctor/CheckRequest.vue +++ b/openhis-ui-vue3/src/views/outpatient/doctor/CheckRequest.vue @@ -1,124 +1,272 @@ 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 f49043302..f00e16d53 100755 --- a/openhis-ui-vue3/tests/e2e/specs/bug-regression.spec.ts +++ b/openhis-ui-vue3/tests/e2e/specs/bug-regression.spec.ts @@ -58,49 +58,52 @@ test.describe('HIS 系统回归测试集', () => { await expect(page).toHaveURL(/.*dashboard.*/); await page.click('text=住院发退药'); - await page.waitForLoadState('networkidle'); - // 此处省略具体断言,仅保留结构占位 }); // ================= 新增 Bug #550 回归测试 ================= - test('@bug550 @regression 门诊检查申请项目选择交互优化校验', async ({ page }) => { + test('@bug550 @regression 检查申请项目选择交互优化:解耦、卡片展示与层级校验', async ({ page }) => { await page.goto('/login'); - await page.fill('input[name="username"]', 'doctor'); + await page.fill('input[name="username"]', 'doctor01'); await page.fill('input[name="password"]', '123456'); await page.click('button[type="submit"]'); await expect(page).toHaveURL(/.*dashboard.*/); - await page.click('text=门诊医生站'); await page.click('text=检查申请单'); await page.waitForLoadState('networkidle'); - // 1. 验证联动解耦:勾选项目不应自动勾选检查方法 + // 1. 验证左侧分类点击加载中间项目 await page.click('text=彩超'); await page.waitForTimeout(500); - const itemCheckbox = page.locator('.exam-item-list .el-checkbox:has-text("128线排") input[type="checkbox"]'); - await itemCheckbox.check(); - const methodCheckbox = page.locator('.exam-method-list .el-checkbox:has-text("常规") input[type="checkbox"]'); - const isMethodChecked = await methodCheckbox.isChecked(); - expect(isMethodChecked).toBe(false); + const itemTable = page.locator('.middle-panel .el-table__body-wrapper'); + await expect(itemTable).toBeVisible(); - // 2. 验证卡片显示:无“套餐”前缀,支持悬停提示完整名称,宽度自适应 - const selectedCard = page.locator('.selected-area .el-collapse-item__header').first(); - const cardText = await selectedCard.textContent(); - expect(cardText).not.toContain('套餐'); - expect(cardText).toContain('128线排'); + // 2. 勾选项目,验证检查方法未自动勾选(解耦) + const firstItemCheckbox = page.locator('.middle-panel .el-table__body tr').first().locator('input[type="checkbox"]'); + await firstItemCheckbox.check(); - const titleAttr = await selectedCard.getAttribute('title'); - expect(titleAttr).toContain('128线排'); + // 验证右侧已选区域出现卡片,且默认收起 + const selectedCard = page.locator('.selected-card').first(); + await expect(selectedCard).toBeVisible(); + const methodList = selectedCard.locator('.method-list'); + await expect(methodList).not.toBeVisible(); // 默认收起 - // 3. 验证默认状态与层级:明细默认收起,结构为 项目 > 检查方法,无冗余标签 - const collapsePanel = page.locator('.selected-area .el-collapse-item'); - const isExpanded = await collapsePanel.getAttribute('aria-expanded'); - expect(isExpanded).toBe('false'); + // 3. 展开卡片,验证检查方法独立勾选 + await selectedCard.locator('.card-header').click(); + await expect(methodList).toBeVisible(); + + const firstMethodCheckbox = methodList.locator('.method-item').first().locator('input[type="checkbox"]'); + await expect(firstMethodCheckbox).not.toBeChecked(); // 未自动勾选 + await firstMethodCheckbox.check(); + await expect(firstMethodCheckbox).toBeChecked(); // 手动勾选成功 - await collapsePanel.click(); - await page.waitForTimeout(300); - const hierarchyText = await page.locator('.selected-area .detail-hierarchy').textContent(); - expect(hierarchyText).toMatch(/检查方法/); - expect(hierarchyText).not.toMatch(/项目套餐明细/); + // 4. 验证名称显示完整(无遮挡/无冗余套餐字样) + const itemName = selectedCard.locator('.item-name'); + const nameText = await itemName.textContent(); + expect(nameText).not.toContain('套餐'); + expect(nameText).not.toMatch(/\.{3}$/); // 无省略号遮挡 + + // 5. 提交校验 + await page.click('button:has-text("提交申请")'); + await expect(page.locator('.el-message--success')).toContainText('提交成功'); }); });