fix(surgery): 解决手术申请中的数据绑定和字段映射问题

- 修复了手术申请组件中 userStore 初始化问题,确保 applyDoctorName 和 applyDeptName 正确赋值
- 添加了 surgeryApplication 组件的 saved 事件发射,用于通知父组件刷新医嘱列表
- 修复了手术项目选择变更时 surgeryName 的正确设置和空值处理
- 添加了手术名称和编码的验证逻辑,防止提交时出现空值错误
- 修复了手术排班页面中就诊卡号字段的属性映射(visitId 改为 patientCardNo)
- 在后端 DTO 中添加了 patientCardNo 字段支持
- 修复了数据库查询中就诊卡号的关联查询逻辑,通过患者标识表获取正确的就诊卡号
- 优化了手术医嘱的 contentJson 设置,确保手术名称和编码正确存储
This commit is contained in:
2026-04-02 17:54:07 +08:00
parent 09fdfa294a
commit b497eb853c
8 changed files with 132 additions and 9 deletions

View File

@@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="patientAge" column="patient_age" />
<result property="encounterId" column="encounter_id" />
<result property="encounterNo" column="encounter_no" />
<result property="patientCardNo" column="patient_card_no" />
<result property="applyDoctorId" column="apply_doctor_id" />
<result property="applyDoctorName" column="apply_doctor_name" />
<result property="applyDeptId" column="apply_dept_id" />
@@ -79,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
EXTRACT(YEAR FROM AGE(p.birth_date)) as patient_age,
s.encounter_id,
e.bus_no as encounter_no,
pi.identifier_no as patient_card_no,
s.apply_doctor_id,
COALESCE(s.apply_doctor_name, apply_doc.name) as apply_doctor_name,
s.apply_dept_id,
@@ -177,6 +179,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM cli_surgery s
LEFT JOIN adm_patient p ON s.patient_id = p.id
LEFT JOIN adm_encounter e ON s.encounter_id = e.id
LEFT JOIN (
SELECT patient_id, identifier_no
FROM (
SELECT patient_id, identifier_no,
ROW_NUMBER() OVER (PARTITION BY patient_id ORDER BY create_time ASC) AS rn
FROM adm_patient_identifier
WHERE delete_flag = '0'
AND identifier_no IS NOT NULL
AND identifier_no != ''
) t
WHERE rn = 1
) pi ON s.patient_id = pi.patient_id
LEFT JOIN adm_operating_room r ON s.operating_room_id = r.id
LEFT JOIN adm_organization ro ON r.organization_id = ro.id
LEFT JOIN adm_organization o ON s.org_id = o.id
@@ -248,6 +262,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
p.birth_date,
<!-- 就诊编号 -->
e.bus_no as encounter_no,
<!-- 就诊卡号 -->
pi.identifier_no as patient_card_no,
<!-- 字典文本使用CASE WHEN避免额外JOIN -->
CASE s.surgery_type_enum
WHEN 1 THEN '门诊手术'
@@ -302,6 +318,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 只JOIN必要的表患者和就诊 -->
LEFT JOIN adm_patient p ON s.patient_id = p.id
LEFT JOIN adm_encounter e ON s.encounter_id = e.id
<!-- 关联患者标识表获取就诊卡号 -->
LEFT JOIN (
SELECT patient_id, identifier_no
FROM (
SELECT patient_id, identifier_no,
ROW_NUMBER() OVER (PARTITION BY patient_id ORDER BY create_time ASC) AS rn
FROM adm_patient_identifier
WHERE delete_flag = '0'
AND identifier_no IS NOT NULL
AND identifier_no != ''
) t
WHERE rn = 1
) pi ON s.patient_id = pi.patient_id
<where>
s.delete_flag = '0'
<if test="ew.sqlSegment != null and ew.sqlSegment != ''">