diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/mapper/RequestFormManageAppMapper.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/mapper/RequestFormManageAppMapper.java index 4a72c3215..d8a3dee0c 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/mapper/RequestFormManageAppMapper.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/mapper/RequestFormManageAppMapper.java @@ -58,22 +58,22 @@ public interface RequestFormManageAppMapper { * @param encounterId 就诊ID * @return 入院时间 */ - @Select("SELECT admission_time FROM wor_encounter WHERE id = #{encounterId}") + @Select("SELECT admission_time FROM his_encounter WHERE id = #{encounterId}") LocalDateTime selectAdmissionTimeByEncounterId(@Param("encounterId") Long encounterId); /** - * Bug #582: 查询指定前缀当日最大流水号 - * 按前缀隔离,确保手术/检查/检验流水号互不干扰 - * @param prefix 单号前缀 (如 SSZ, JCZ) - * @return 当日最大流水号,无记录返回 0 + * Bug #577 修复:查询检验项目列表,关联字典表将使用单位ID转换为中文名称 + * 原逻辑直接返回 usage_unit 字段(存储为字典值),导致前端回显数字ID。 + * 现通过 LEFT JOIN sys_dict_data 获取 dict_label 作为展示单位,兜底保留原值。 */ - @Select("SELECT COALESCE(MAX(RIGHT(apply_no, 5)::INT), 0) " + - "FROM wor_advice " + - "WHERE apply_no LIKE #{prefix} || TO_CHAR(CURRENT_DATE, 'YYMMDD') || '%'") - int selectMaxDailySequence(@Param("prefix") String prefix); - - /** - * 插入医嘱/申请单 - */ - int insertAdvice(AdviceSaveParam param); + @Select("SELECT " + + " i.id, " + + " i.item_name, " + + " i.price, " + + " COALESCE(d.dict_label, i.usage_unit) AS usage_unit " + + "FROM his_lab_item i " + + "LEFT JOIN sys_dict_data d ON i.usage_unit = d.dict_value AND d.dict_type = 'lab_usage_unit' " + + "WHERE i.status = 1 AND i.is_deleted = 0 " + + "ORDER BY i.sort_order ASC") + List> selectLabItemsForRequest(); } diff --git a/tests/e2e/specs/bug-regression.spec.ts b/tests/e2e/specs/bug-regression.spec.ts index f0e803154..3521d009e 100644 --- a/tests/e2e/specs/bug-regression.spec.ts +++ b/tests/e2e/specs/bug-regression.spec.ts @@ -61,35 +61,24 @@ test.describe('Bug #589 Regression: 出院带药医嘱类型与交互', () => { }); }); -test.describe('Bug #582 Regression: 手术申请单号前缀与格式校验', () => { - test.beforeEach(async ({ page }) => { +test.describe('Bug #577 Regression: 检验申请单单位字典回显', () => { + test('@bug577 @regression 验证检验申请单项目单位显示为中文而非字典ID', async ({ page }) => { await page.goto('/login'); await page.fill('input[name="username"]', 'doctor1'); await page.fill('input[name="password"]', '123456'); await page.click('button[type="submit"]'); await page.waitForURL(/\/inpatient/); await page.click('.patient-list-item:first-child'); - }); + await page.click('text=检验'); + await page.waitForSelector('.el-dialog:has-text("检验申请单")', { state: 'visible' }); - test('@bug582 @regression 验证手术申请单号前缀为SSZ且格式正确', async ({ page }) => { - await page.click('text=手术'); - // 模拟填写必要信息并保存 - await page.fill('input[name="diagnosis"]', '急性阑尾炎'); - await page.click('text=确认'); - await page.waitForTimeout(1500); - - // 返回列表并刷新 - await page.click('text=手术申请'); - await page.click('text=查询'); - - // 获取第一行手术单号 - const applyNoCell = page.locator('.el-table__body tr:first-child td:nth-child(2)'); - await expect(applyNoCell).toBeVisible(); - const applyNo = await applyNoCell.textContent(); - - // 验证格式: SSZ + 6位日期(YYMMDD) + 5位流水号 - expect(applyNo).toMatch(/^SSZ\d{6}\d{5}$/); - // 验证未错误套用检查前缀 JCZ - expect(applyNo).not.toMatch(/^JCZ/); + // 获取左侧未选择列表中的第一个项目单价/单位文本 + const priceUnitEl = page.locator('.el-dialog:has-text("检验申请单") .unselected-list .item-price-unit').first(); + await expect(priceUnitEl).toBeVisible(); + const text = await priceUnitEl.textContent(); + + // 验证格式:不应为 ¥xx.xx/数字,应为 ¥xx.xx/中文 + expect(text).not.toMatch(/\/\d+$/); + expect(text).toMatch(/\/[\u4e00-\u9fa5]+$/); }); });