refactor(surgery): 优化手术服务中医生信息查询逻辑
- 引入 IPractitionerService 服务替代 SysUserService 查询医生信息 - 修改手术列表查询中主刀医生、麻醉医生、助手和护士的姓名填充逻辑 - 使用 Practitioner 实体的 name 字段替代 SysUser 的 nickName 字段 - 更新 SQL 查询使用 COALESCE 函数合并数据库中存储的姓名和实时查询结果 - 添加多个 LEFT JOIN 查询以支持手术相关医生和科室信息的实时获取 - 优化申请医生和申请科室名称的查询机制,支持数据回退逻辑
This commit is contained in:
@@ -87,6 +87,9 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
|
|||||||
@Resource
|
@Resource
|
||||||
private IOperatingRoomService operatingRoomService;
|
private IOperatingRoomService operatingRoomService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private com.openhis.administration.service.IPractitionerService practitionerService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询手术列表
|
* 分页查询手术列表
|
||||||
*
|
*
|
||||||
@@ -425,43 +428,43 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 填充主刀医生姓名
|
// 填充主刀医生姓名(使用practitionerId查询Practitioner表)
|
||||||
if (surgery.getMainSurgeonId() != null) {
|
if (surgery.getMainSurgeonId() != null) {
|
||||||
SysUser mainSurgeon = sysUserService.selectUserById(surgery.getMainSurgeonId());
|
com.openhis.administration.domain.Practitioner mainSurgeon = practitionerService.getById(surgery.getMainSurgeonId());
|
||||||
if (mainSurgeon != null) {
|
if (mainSurgeon != null) {
|
||||||
surgery.setMainSurgeonName(mainSurgeon.getNickName());
|
surgery.setMainSurgeonName(mainSurgeon.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 填充麻醉医生姓名
|
// 填充麻醉医生姓名(使用practitionerId查询Practitioner表)
|
||||||
if (surgery.getAnesthetistId() != null) {
|
if (surgery.getAnesthetistId() != null) {
|
||||||
SysUser anesthetist = sysUserService.selectUserById(surgery.getAnesthetistId());
|
com.openhis.administration.domain.Practitioner anesthetist = practitionerService.getById(surgery.getAnesthetistId());
|
||||||
if (anesthetist != null) {
|
if (anesthetist != null) {
|
||||||
surgery.setAnesthetistName(anesthetist.getNickName());
|
surgery.setAnesthetistName(anesthetist.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 填充助手1姓名
|
// 填充助手1姓名(使用practitionerId查询Practitioner表)
|
||||||
if (surgery.getAssistant1Id() != null) {
|
if (surgery.getAssistant1Id() != null) {
|
||||||
SysUser assistant1 = sysUserService.selectUserById(surgery.getAssistant1Id());
|
com.openhis.administration.domain.Practitioner assistant1 = practitionerService.getById(surgery.getAssistant1Id());
|
||||||
if (assistant1 != null) {
|
if (assistant1 != null) {
|
||||||
surgery.setAssistant1Name(assistant1.getNickName());
|
surgery.setAssistant1Name(assistant1.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 填充助手2姓名
|
// 填充助手2姓名(使用practitionerId查询Practitioner表)
|
||||||
if (surgery.getAssistant2Id() != null) {
|
if (surgery.getAssistant2Id() != null) {
|
||||||
SysUser assistant2 = sysUserService.selectUserById(surgery.getAssistant2Id());
|
com.openhis.administration.domain.Practitioner assistant2 = practitionerService.getById(surgery.getAssistant2Id());
|
||||||
if (assistant2 != null) {
|
if (assistant2 != null) {
|
||||||
surgery.setAssistant2Name(assistant2.getNickName());
|
surgery.setAssistant2Name(assistant2.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 填充巡回护士姓名
|
// 填充巡回护士姓名(使用practitionerId查询Practitioner表)
|
||||||
if (surgery.getScrubNurseId() != null) {
|
if (surgery.getScrubNurseId() != null) {
|
||||||
SysUser scrubNurse = sysUserService.selectUserById(surgery.getScrubNurseId());
|
com.openhis.administration.domain.Practitioner scrubNurse = practitionerService.getById(surgery.getScrubNurseId());
|
||||||
if (scrubNurse != null) {
|
if (scrubNurse != null) {
|
||||||
surgery.setScrubNurseName(scrubNurse.getNickName());
|
surgery.setScrubNurseName(scrubNurse.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,11 +492,11 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 填充申请医生姓名(如果还没有设置)
|
// 填充申请医生姓名(如果还没有设置) - 使用practitionerId查询Practitioner表
|
||||||
if (surgery.getApplyDoctorId() != null && (surgery.getApplyDoctorName() == null || surgery.getApplyDoctorName().isEmpty())) {
|
if (surgery.getApplyDoctorId() != null && (surgery.getApplyDoctorName() == null || surgery.getApplyDoctorName().isEmpty())) {
|
||||||
SysUser applyDoctor = sysUserService.selectUserById(surgery.getApplyDoctorId());
|
com.openhis.administration.domain.Practitioner applyDoctor = practitionerService.getById(surgery.getApplyDoctorId());
|
||||||
if (applyDoctor != null) {
|
if (applyDoctor != null) {
|
||||||
surgery.setApplyDoctorName(applyDoctor.getNickName());
|
surgery.setApplyDoctorName(applyDoctor.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
s.encounter_id,
|
s.encounter_id,
|
||||||
e.bus_no as encounter_no,
|
e.bus_no as encounter_no,
|
||||||
s.apply_doctor_id,
|
s.apply_doctor_id,
|
||||||
s.apply_doctor_name,
|
COALESCE(s.apply_doctor_name, apply_doc.name) as apply_doctor_name,
|
||||||
s.apply_dept_id,
|
s.apply_dept_id,
|
||||||
s.apply_dept_name,
|
COALESCE(s.apply_dept_name, apply_dept.name) as apply_dept_name,
|
||||||
s.surgery_name,
|
s.surgery_name,
|
||||||
s.surgery_code,
|
s.surgery_code,
|
||||||
s.surgery_type_enum,
|
s.surgery_type_enum,
|
||||||
@@ -111,15 +111,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
s.actual_start_time,
|
s.actual_start_time,
|
||||||
s.actual_end_time,
|
s.actual_end_time,
|
||||||
s.main_surgeon_id,
|
s.main_surgeon_id,
|
||||||
s.main_surgeon_name,
|
COALESCE(s.main_surgeon_name, main_surgeon.name) as main_surgeon_name,
|
||||||
s.assistant_1_id,
|
s.assistant_1_id,
|
||||||
s.assistant_1_name,
|
COALESCE(s.assistant_1_name, assistant1.name) as assistant_1_name,
|
||||||
s.assistant_2_id,
|
s.assistant_2_id,
|
||||||
s.assistant_2_name,
|
COALESCE(s.assistant_2_name, assistant2.name) as assistant_2_name,
|
||||||
s.anesthetist_id,
|
s.anesthetist_id,
|
||||||
s.anesthetist_name,
|
COALESCE(s.anesthetist_name, anesthetist.name) as anesthetist_name,
|
||||||
s.scrub_nurse_id,
|
s.scrub_nurse_id,
|
||||||
s.scrub_nurse_name,
|
COALESCE(s.scrub_nurse_name, scrub_nurse.name) as scrub_nurse_name,
|
||||||
s.anesthesia_type_enum,
|
s.anesthesia_type_enum,
|
||||||
CASE s.anesthesia_type_enum
|
CASE s.anesthesia_type_enum
|
||||||
WHEN 0 THEN '无麻醉'
|
WHEN 0 THEN '无麻醉'
|
||||||
@@ -148,11 +148,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
ELSE '未知'
|
ELSE '未知'
|
||||||
END as healing_level_dictText,
|
END as healing_level_dictText,
|
||||||
s.operating_room_id,
|
s.operating_room_id,
|
||||||
s.operating_room_name,
|
COALESCE(s.operating_room_name, r.name) as operating_room_name,
|
||||||
r.organization_id as operating_room_org_id,
|
r.organization_id as operating_room_org_id,
|
||||||
ro.name as operating_room_org_name,
|
ro.name as operating_room_org_name,
|
||||||
s.org_id,
|
s.org_id,
|
||||||
o.name as org_name,
|
COALESCE(s.org_name, o.name) as org_name,
|
||||||
s.preoperative_diagnosis,
|
s.preoperative_diagnosis,
|
||||||
s.postoperative_diagnosis,
|
s.postoperative_diagnosis,
|
||||||
s.surgery_description,
|
s.surgery_description,
|
||||||
@@ -170,6 +170,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
LEFT JOIN adm_operating_room r ON s.operating_room_id = r.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 ro ON r.organization_id = ro.id
|
||||||
LEFT JOIN adm_organization o ON s.org_id = o.id
|
LEFT JOIN adm_organization o ON s.org_id = o.id
|
||||||
|
LEFT JOIN adm_practitioner main_surgeon ON s.main_surgeon_id = main_surgeon.id
|
||||||
|
LEFT JOIN adm_practitioner anesthetist ON s.anesthetist_id = anesthetist.id
|
||||||
|
LEFT JOIN adm_practitioner assistant1 ON s.assistant_1_id = assistant1.id
|
||||||
|
LEFT JOIN adm_practitioner assistant2 ON s.assistant_2_id = assistant2.id
|
||||||
|
LEFT JOIN adm_practitioner scrub_nurse ON s.scrub_nurse_id = scrub_nurse.id
|
||||||
|
LEFT JOIN adm_practitioner apply_doc ON s.apply_doctor_id = apply_doc.id
|
||||||
|
LEFT JOIN adm_organization apply_dept ON s.apply_dept_id = apply_dept.id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="getSurgeryPage" parameterType="com.baomidou.mybatisplus.core.conditions.query.QueryWrapper" resultMap="SurgeryResult">
|
<select id="getSurgeryPage" parameterType="com.baomidou.mybatisplus.core.conditions.query.QueryWrapper" resultMap="SurgeryResult">
|
||||||
|
|||||||
Reference in New Issue
Block a user