Bladeren bron

多病历页面doctorId查询

chengyao 3 jaren geleden
bovenliggende
commit
820b2fa738
1 gewijzigde bestanden met toevoegingen van 37 en 9 verwijderingen
  1. 37 9
      src/main/resources/mapper/BehospitalInfoMapper.xml

+ 37 - 9
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -12616,6 +12616,7 @@
         t1.score_res AS scoreRes,
         t1.scoreBn,
         t1.doctorName,
+        t1.doctorId,
         t1.NAME AS NAME,
         t1.sex AS sex,
         t1.beh_dept_id AS behDeptId,
@@ -12642,6 +12643,7 @@
         b.grade_type,
         b.score_res,
         b.gmt_create,
+        f.doctor_id as doctorId,
         ifnull(mci.status,0) AS checkStatus,
         ifnull(hm_mci.status,0) AS mrStatus,
         mci.check_name as chName,
@@ -12700,9 +12702,6 @@
         <if test="qcResultPageVO.isPlacefile != null and qcResultPageVO.isPlacefile != ''">
             and a.is_placefile = #{qcResultPageVO.isPlacefile}
         </if>
-        <if test="qcResultPageVO.doctorId != null and qcResultPageVO.doctorId != ''">
-            AND a.doctor_id = #{qcResultPageVO.doctorId}
-        </if>
         <if test="qcResultPageVO.hospitalId != null and qcResultPageVO.hospitalId != ''">
             AND a.hospital_id = #{qcResultPageVO.hospitalId}
         </if>
@@ -12774,6 +12773,10 @@
         on  b.is_deleted = 'N'
         AND be.hospital_id = b.hospital_id
         AND be.behospital_code = b.behospital_code
+        LEFT JOIN bas_doctor_info f
+        on be.hospital_id = f.hospital_id
+        and be.doctorName = f.name
+        AND f.is_deleted = 'N'
         where
         1=1
         <if test="qcResultPageVO.level != null and qcResultPageVO.level != ''">
@@ -12786,6 +12789,9 @@
         ) t
         where
         1=1
+        <if test="qcResultPageVO.doctorId != null and qcResultPageVO.doctorId != ''">
+            AND t.doctorId = #{qcResultPageVO.doctorId}
+        </if>
         <if test="qcResultPageVO.checkStatus != null">
             AND t.checkStatus = #{qcResultPageVO.checkStatus}
         </if>
@@ -13712,6 +13718,7 @@
         t.behDeptId,
         t.behDeptName,
         t.hospitalId,
+        t.doctorId,
         t.checkStatus,
         t.mrStatus,
         t.chName,
@@ -13738,6 +13745,7 @@
         t1.placefile_date AS placefileDate,
         t1.gmt_create AS gradeTime,
         t1.diagnose,
+        t1.doctorId,
         t1.ward_name AS wardName,
         t2.age,
         t1.file_code AS fileCode,
@@ -13754,6 +13762,7 @@
         b.grade_type,
         b.score_res,
         b.gmt_create,
+        f.doctor_id as doctorId,
         ifnull(mci.status,0) AS checkStatus,
         ifnull(hm_mci.status,0) AS mrStatus,
         mci.check_name as chName,
@@ -13841,9 +13850,6 @@
         <if test="qcResultShortPageVO.deptId != null and qcResultShortPageVO.deptId != ''">
             AND a.beh_dept_id = #{qcResultShortPageVO.deptId}
         </if>
-        <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
-            AND a.doctor_id = #{qcResultShortPageVO.doctorId}
-        </if>
         <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
             AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
         </if>
@@ -13890,6 +13896,10 @@
         left join qc_cases_entry d
         on  d.is_deleted = 'N'
         AND be.cases_id = d.cases_id
+        LEFT JOIN bas_doctor_info f
+        on be.hospital_id = f.hospital_id
+        and be.doctor_name = f.name
+        AND f.is_deleted = 'N'
         <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
             AND d.NAME = #{qcResultShortPageVO.casesEntryName}
         </if>
@@ -13918,6 +13928,9 @@
             AND qd.cases_entry_id = qce.id
         </if>
         where 1=1
+        <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
+            AND t.doctorId = #{qcResultShortPageVO.doctorId}
+        </if>
         <if test="qcResultShortPageVO.checkStatus != null">
             AND t.checkStatus = #{qcResultShortPageVO.checkStatus}
         </if>
@@ -13965,6 +13978,7 @@
         t1.`level`,
         t1.checkStatus,
         t1.mrStatus,
+        t1.doctorId,
         t1.chName,
         t1.mrName,
         t1.chTime,
@@ -13976,6 +13990,7 @@
         b.score_res,
         b.`level`,
         b.gmt_create,
+        f.doctor_id as doctorId,
         ifnull(mci.status,0) AS checkStatus,
         ifnull(hm_mci.status,0) AS mrStatus,
         mci.check_name as chName,
@@ -13988,6 +14003,15 @@
         a.beh_dept_id,
         a.beh_dept_name,
         a.hospital_id,
+        case
+        when b.attending_doctor != '' and b.attending_doctor is not null then b.attending_doctor
+        when (b.attending_doctor = '' or b.attending_doctor is null) and
+        b.director_doctor != '' and b.director_doctor is not null
+        then b.director_doctor
+        when (b.attending_doctor = '' or b.attending_doctor is null) and
+        (b.director_doctor = '' or b.director_doctor is null) and
+        b.behospital_doctor != '' and b.behospital_doctor is not null
+        then b.behospital_doctor end as doctor_name,
         a.behospital_code
         FROM
         med_behospital_info a,
@@ -14042,9 +14066,6 @@
         <if test="qcResultShortPageVO.deptId != null and qcResultShortPageVO.deptId != ''">
             AND a.beh_dept_id = #{qcResultShortPageVO.deptId}
         </if>
-        <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
-            AND a.doctor_id = #{qcResultShortPageVO.doctorId}
-        </if>
         <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
             AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
         </if>
@@ -14094,6 +14115,10 @@
         on  b.is_deleted = 'N'
         AND be.hospital_id = b.hospital_id
         AND be.behospital_code = b.behospital_code
+        LEFT JOIN bas_doctor_info f
+        on be.hospital_id = f.hospital_id
+        and be.doctor_name = f.name
+        AND f.is_deleted = 'N'
         ) t1
         LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
         AND t1.behospital_code = t2.behospital_code
@@ -14103,6 +14128,9 @@
         AND t.hospitalId = qi.hospital_id
         AND t.behospitalCode = qi.behospital_code
         where 1=1
+        <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
+            AND t.doctorId = #{qcResultShortPageVO.doctorId}
+        </if>
         <if test="qcResultShortPageVO.checkStatus != null">
             AND t.checkStatus = #{qcResultShortPageVO.checkStatus}
         </if>