Prechádzať zdrojové kódy

病案首页合格病历列表sql逻辑调整

chengyao 3 rokov pred
rodič
commit
99b5339506

+ 5 - 0
src/main/java/com/diagbot/vo/QcResultPageVO.java

@@ -78,6 +78,11 @@ public class QcResultPageVO extends Page {
      */
     private String deptClass;
 
+    /**
+     * 科室id
+     */
+    private String deptId;
+
     /**
      * 医生姓名
      */

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

@@ -5562,14 +5562,10 @@
             AND d.cases_id = #{qcResultShortPageVO.casesId}
         </if>
         <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
-            AND (a.doctor_id = #{qcResultShortPageVO.doctorId}
-            OR a.beh_doctor_id = #{qcResultShortPageVO.doctorId}
-            OR a.director_doctor_id = #{qcResultShortPageVO.doctorId})
+            AND a.doctor_id = #{qcResultShortPageVO.doctorId}
         </if>
         <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
-            AND (a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-            OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-            OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
+            AND a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
         </if>
         <if test="qcResultShortPageVO.isReject != null">
             AND c.is_reject = #{qcResultShortPageVO.isReject}
@@ -9658,14 +9654,10 @@
             AND a.beh_dept_id = #{qcResultShortPageVO.deptId}
         </if>
         <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
-            AND (a.doctor_id = #{qcResultShortPageVO.doctorId}
-            OR a.beh_doctor_id = #{qcResultShortPageVO.doctorId}
-            OR a.director_doctor_id = #{qcResultShortPageVO.doctorId})
+            AND a.doctor_id = #{qcResultShortPageVO.doctorId}
         </if>
         <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
-            AND (a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-            OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-            OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
+            AND a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
         </if>
         <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
             AND b.`level` = #{qcResultShortPageVO.level}
@@ -9963,14 +9955,10 @@
             AND d.cases_id = #{qcResultShortPageVO.casesId}
         </if>
         <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
-            AND (a.doctor_id = #{qcResultShortPageVO.doctorId}
-            OR a.beh_doctor_id = #{qcResultShortPageVO.doctorId}
-            OR a.director_doctor_id = #{qcResultShortPageVO.doctorId})
+            AND a.doctor_id = #{qcResultShortPageVO.doctorId}
         </if>
         <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
-            AND (a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-            OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-            OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
+            AND a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
         </if>
         <if test="qcResultShortPageVO.isReject != null">
             AND c.is_reject = #{qcResultShortPageVO.isReject}
@@ -11214,7 +11202,6 @@
 
     <!-- 不合格/合格数病历号(内页)科室-->
     <select id="getIsGoodLevelByDept" resultType="com.diagbot.dto.QcResultShortDeptDTO">
-        select m.*,t3.name as medoupName from(
         SELECT t.*
         FROM
         (SELECT DISTINCT
@@ -11227,6 +11214,7 @@
         t1.scoreBn,
         t1.NAME AS NAME,
         t1.sex AS sex,
+        t1.medoupName,
         t1.beh_dept_id AS behDeptId,
         t1.beh_dept_name AS behDeptName,
         t1.doctor_id AS doctorId,
@@ -11253,6 +11241,7 @@
         FROM
         (SELECT
         be.*,
+        t3.name as medoupName,
         b.LEVEL,
         b.grade_type,
         b.score_res,
@@ -11310,6 +11299,9 @@
         <if test="deptClass != null and deptClass != ''">
             and a.beh_dept_id = #{deptClass}
         </if>
+        <if test="deptId != null and deptId != ''">
+            and a.beh_dept_id = #{deptId}
+        </if>
         <if test="titleName != null and titleName != '' ">
             <if test="titleName == '不合格数'">
                 AND e.`level`='不合格'
@@ -11356,9 +11348,7 @@
             AND a.NAME LIKE CONCAT( '%', #{patName}, '%' )
         </if>
         <if test="doctorId != null and doctorId != ''">
-            AND (a.doctor_id LIKE CONCAT( '%', #{doctorId}, '%' )
-            OR a.beh_doctor_id LIKE CONCAT( '%', #{doctorId}, '%' )
-            OR a.director_doctor_id LIKE CONCAT( '%', #{doctorId}, '%' ))
+            AND a.doctor_id = #{doctorId}
         </if>
         )be
         left join med_check_info mci
@@ -11375,11 +11365,19 @@
         on  b.is_deleted = 'N'
         AND be.hospital_id = b.hospital_id
         AND be.behospital_code = b.behospital_code
+        LEFT JOIN bas_doctor_info t2 ON be.doctor_id = t2.doctor_id
+        and be.hospital_id = t2.hospital_id
+        AND t2.is_deleted = 'N'
+        LEFT JOIN sys_medoup t3 ON t2.group_id = t3.`code`
+        AND t3.is_deleted = 'N'
         where
         1=1
         <if test="level != null and level != ''">
             AND b.`level` = #{level}
         </if>
+        <if test="medoupName != null and medoupName != ''">
+            AND t3.name LIKE CONCAT( '%', #{medoupName}, '%' )
+        </if>
         ) t1
         LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
         AND t1.behospital_code = t2.behospital_code
@@ -11412,14 +11410,6 @@
         AND d.cases_entry_id = e.id
         AND d.cases_id = 243
         AND a.qc_type_id != 0
-        <!--        <if test="titleName != null ">-->
-        <!--            <if test="titleName == '不合格数'">-->
-        <!--                AND c.`level`='不合格'-->
-        <!--            </if>-->
-        <!--            <if test="titleName == '合格数'">-->
-        <!--                AND c.`level`='合格'-->
-        <!--            </if>-->
-        <!--        </if>-->
         <if test="userId!=null">
             AND b.user_id = #{userId}
         </if>
@@ -11429,9 +11419,15 @@
         <if test="doctorName != null and doctorName != ''">
             AND a.doctor_name like CONCAT('%', #{doctorName}, '%')
         </if>
+        <if test="doctorId != null and doctorId != ''">
+            AND a.doctor_id = #{doctorId}
+        </if>
         <if test="deptClass != null and deptClass != ''">
             and a.beh_dept_id = #{deptClass}
         </if>
+        <if test="deptId != null and deptId != ''">
+            and a.beh_dept_id = #{deptId}
+        </if>
         <if test="isPlacefile != null and isPlacefile != ''">
             and a.is_placefile = #{isPlacefile}
         </if>
@@ -11496,16 +11492,6 @@
         </if>
         <if test="mrTimeEnd != null ">
             <![CDATA[ AND t.mrTime <= #{mrTimeEnd}]]>
-        </if>)m LEFT JOIN bas_doctor_info t2 ON m.doctorId = t2.doctor_id
-        AND t2.is_deleted = 'N'
-        LEFT JOIN sys_medoup t3 ON t2.group_id = t3.`code`
-        AND t3.is_deleted = 'N'
-        where
-         <if test="hospitalId != null and hospitalId != ''">
-             t2.hospital_id = #{hospitalId}
-    </if>
-        <if test="medoupName != null and medoupName != ''">
-            AND t3.name = #{medoupName}
         </if>
     </select>
 
@@ -12813,9 +12799,6 @@
                 AND c.`level`='合格'
             </if>
         </if>
-        <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
-            AND a.doctor_name  like CONCAT('%', #{qcResultShortPageVO.doctorName}, '%')
-        </if>
         <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
             and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
         </if>
@@ -12847,6 +12830,9 @@
         <if test="qcResultShortPageVO.deptName != null and qcResultShortPageVO.deptName != ''">
             AND a.beh_dept_name LIKE CONCAT( '%', #{qcResultShortPageVO.deptName}, '%' )
         </if>
+        <if test="qcResultShortPageVO.deptId != null and qcResultShortPageVO.deptId != ''">
+            AND a.beh_dept_id = #{qcResultShortPageVO.deptId}
+        </if>
         <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
             AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
         </if>
@@ -12854,14 +12840,10 @@
             AND a.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
         </if>
         <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
-            AND (a.doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
-            OR a.beh_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
-            OR a.director_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' ))
+            AND a.doctor_id = #{qcResultShortPageVO.doctorId}
         </if>
         <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
-            AND (a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-            OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-            OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
+            AND a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
         </if>
         )be
         left join med_check_info mci
@@ -13047,21 +13029,10 @@
         AND c.cases_id = k.cases_id
         AND k.cases_id = d.cases_id
         AND k.cases_entry_id = d.id
-        <!--        <if test="qcResultShortPageVO.titleName != null ">-->
-        <!--            <if test="qcResultShortPageVO.titleName == '不合格数'">-->
-        <!--                AND c.`level`='不合格'-->
-        <!--            </if>-->
-        <!--            <if test="qcResultShortPageVO.titleName == '合格数'">-->
-        <!--                AND c.`level`='合格'-->
-        <!--            </if>-->
-        <!--        </if>-->
         AND a.qc_type_id != 0
         <if test="qcResultShortPageVO.userId!=null">
             AND b.user_id = #{qcResultShortPageVO.userId}
         </if>
-        <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
-            and a.doctor_name = #{qcResultShortPageVO.doctorName}
-        </if>
         <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
             and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
         </if>
@@ -13093,6 +13064,9 @@
         <if test="qcResultShortPageVO.deptName != null and qcResultShortPageVO.deptName != ''">
             AND a.beh_dept_name LIKE CONCAT( '%', #{qcResultShortPageVO.deptName}, '%' )
         </if>
+        <if test="qcResultShortPageVO.deptId != null and qcResultShortPageVO.deptId != ''">
+            AND a.beh_dept_id = #{qcResultShortPageVO.deptId}
+        </if>
         <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
             AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
         </if>
@@ -13103,14 +13077,10 @@
             AND d.NAME = #{qcResultShortPageVO.casesEntryName}
         </if>
         <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
-            AND (a.doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
-            OR a.beh_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
-            OR a.director_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' ))
+            AND a.doctor_id = #{qcResultShortPageVO.doctorId}
         </if>
         <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
-            AND (a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-            OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-            OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
+            AND a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
         </if>
         <if test="qcResultShortPageVO.casesEntryId != null ">
             AND d.id = #{qcResultShortPageVO.casesEntryId}