Browse Source

湘雅doctorId查询

chengyao 3 years ago
parent
commit
3711069f30
1 changed files with 36 additions and 9 deletions
  1. 36 9
      src/main/resources/mapper/BehospitalInfoMapper.xml

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

@@ -5388,6 +5388,7 @@
         t1.sex AS sex,
         t1.beh_dept_id AS behDeptId,
         t1.beh_dept_name AS behDeptName,
+        t1.doctorId,
         t1.doctor_name AS doctorName,
         t1.birthday AS birthday,
         t1.behospital_date AS behospitalDate,
@@ -5415,6 +5416,7 @@
         ifnull(hm_mci.status,0) AS mrStatus,
         mci.check_name as chName,
         e.score_res as scoreBn,
+        f.doctor_id as doctorId,
         hm_mci.check_name as mrName,
         mci.gmt_create as chTime,
         hm_mci.gmt_create as mrTime
@@ -5521,9 +5523,6 @@
         <if test="qcResultShortPageVO.casesId != null">
             AND d.cases_id = #{qcResultShortPageVO.casesId}
         </if>
-        <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
-            AND a.doctor_id = #{qcResultShortPageVO.doctorId}
-        </if>
         <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
             AND(case
             when e.attending_doctor != '' and e.attending_doctor is not null then e.attending_doctor
@@ -5580,6 +5579,10 @@
         and be.hospital_id = e.hospital_id
         AND e.is_deleted = 'N'
         and e.cases_id = 243
+        LEFT JOIN bas_doctor_info f
+        and be.hospital_id = f.hospital_id
+        and be.doctor_name = f.name
+        AND f.is_deleted = 'N'
         )tt1
         <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2511">
             ,med_medical_record tt2
@@ -5613,6 +5616,9 @@
         </if>
         ) t
         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>
@@ -11050,6 +11056,7 @@
         t1.beh_dept_id AS behDeptId,
         t1.beh_dept_name AS behDeptName,
         t1.doctor_name AS doctorName,
+        t1.doctorId,
         t1.birthday AS birthday,
         t1.behospital_date AS behospitalDate,
         t1.leave_hospital_date AS leaveHospitalDate,
@@ -11077,6 +11084,7 @@
         hm_mci.check_name as mrName,
         mci.gmt_create as chTime,
         e.score_res as scoreBn,
+        f.doctor_id as doctorId,
         hm_mci.gmt_create as mrTime
         FROM
         (
@@ -11181,9 +11189,6 @@
         <if test="qcResultShortPageVO.casesId != null">
             AND d.cases_id = #{qcResultShortPageVO.casesId}
         </if>
-        <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
-            AND a.doctor_id = #{qcResultShortPageVO.doctorId}
-        </if>
         <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
             AND(case
             when e.attending_doctor != '' and e.attending_doctor is not null then e.attending_doctor
@@ -11240,6 +11245,10 @@
         and be.hospital_id = e.hospital_id
         AND e.is_deleted = 'N'
         and e.cases_id = 243
+        LEFT JOIN bas_doctor_info f
+        and be.hospital_id = f.hospital_id
+        and be.doctor_name = f.name
+        AND f.is_deleted = 'N'
         )tt1
         <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2511">
             ,med_medical_record tt2
@@ -11284,6 +11293,9 @@
         AND qd.cases_id = qce.cases_id
         AND qd.cases_entry_id = qce.id
         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>
@@ -11343,6 +11355,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,
@@ -11363,6 +11376,7 @@
         ifnull(hm_mci.status,0) AS mrStatus,
         mci.check_name as chName,
         hm_mci.check_name as mrName,
+        f.doctor_id as doctorId,
         mci.gmt_create as chTime,
         hm_mci.gmt_create as mrTime
         FROM
@@ -11385,6 +11399,15 @@
         a.diagnose,
         a.placefile_date,
         a.ward_name,
+        case
+        when e.attending_doctor != '' and e.attending_doctor is not null then e.attending_doctor
+        when (e.attending_doctor = '' or e.attending_doctor is null) and
+        e.director_doctor != '' and e.director_doctor is not null
+        then e.director_doctor
+        when (e.attending_doctor = '' or e.attending_doctor is null) and
+        (e.director_doctor = '' or e.director_doctor is null) and
+        e.behospital_doctor != '' and e.behospital_doctor is not null
+        then e.behospital_doctor end as doctor_name,
         b.gmt_create
         FROM
         med_behospital_info a,
@@ -11438,9 +11461,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.level != null and qcResultShortPageVO.level != ''">
             AND b.`level` = #{qcResultShortPageVO.level}
         </if>
@@ -11513,6 +11533,10 @@
         and hm_mci.check_type = 1
         and be.hospital_id = hm_mci.hospital_id
         and be.behospital_code = hm_mci.behospital_code
+        LEFT JOIN bas_doctor_info f
+        and be.hospital_id = f.hospital_id
+        and be.doctor_name = f.name
+        AND f.is_deleted = 'N'
         )tt1
         <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2511">
             ,med_medical_record tt2
@@ -11549,6 +11573,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>