瀏覽代碼

不合格数病历号详情sql修改

chengyao 4 年之前
父節點
當前提交
01e38834a8
共有 1 個文件被更改,包括 33 次插入7 次删除
  1. 33 7
      src/main/resources/mapper/BehospitalInfoMapper.xml

+ 33 - 7
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -6726,7 +6726,10 @@
 
     <!-- 不合格数病历号(内页)-->
     <select id="badLevelPage" resultType="com.diagbot.dto.QcResultShortDTO">
-        SELECT t.*
+        SELECT f.*
+        from
+        (
+        SELECT DISTINCT t.*,e.score_res as scoreBn
         FROM
         (SELECT DISTINCT
         t1.hospital_id AS hospitalId,
@@ -6799,17 +6802,20 @@
         FROM
         med_behospital_info a,
         med_qcresult_info b,
-        med_qcresult_cases e
+        med_qcresult_detail c,
+        qc_cases_entry d
         WHERE
         a.is_deleted = 'N'
         AND b.is_deleted = 'N'
-        AND e.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
         AND a.hospital_id = b.hospital_id
-        AND a.hospital_id = e.hospital_id
+        AND a.hospital_id = c.hospital_id
         AND a.behospital_code = b.behospital_code
-        AND a.behospital_code = e.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND c.cases_id = d.cases_id
+        AND c.cases_entry_id = d.id
         AND a.qc_type_id != 0
-        AND e.`level`='不合格'
         <if test="qcResultPageVO.isPlacefile != null and qcResultPageVO.isPlacefile != ''">
             and a.is_placefile = #{qcResultPageVO.isPlacefile}
         </if>
@@ -6836,13 +6842,17 @@
             AND a.beh_dept_name = #{qcResultPageVO.behDeptName}
         </if>
         <if test="qcResultPageVO.level != null and qcResultPageVO.level != ''">
+            AND b.`level` = #{qcResultPageVO.level}
+        </if>
         <if test="qcResultPageVO.behospitalCode != null and qcResultPageVO.behospitalCode != ''">
             AND a.behospital_code LIKE CONCAT( '%', #{qcResultPageVO.behospitalCode}, '%' )
         </if>
-        </if>
         <if test="qcResultPageVO.patName != null and qcResultPageVO.patName != ''">
             AND a.NAME LIKE CONCAT( '%', #{qcResultPageVO.patName}, '%' )
         </if>
+        <if test="qcResultPageVO.casesEntryName != null and qcResultPageVO.casesEntryName != ''">
+            AND d.NAME = #{qcResultPageVO.casesEntryName}
+        </if>
         <if test="qcResultPageVO.doctorId != null and qcResultPageVO.doctorId != ''">
             AND (a.doctor_id LIKE CONCAT( '%', #{qcResultPageVO.doctorId}, '%' )
             OR a.beh_doctor_id LIKE CONCAT( '%', #{qcResultPageVO.doctorId}, '%' )
@@ -6853,6 +6863,15 @@
             OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultPageVO.doctorName}, '%' )
             OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultPageVO.doctorName}, '%' ))
         </if>
+        <if test="qcResultPageVO.casesEntryId != null ">
+            AND d.id = #{qcResultPageVO.casesEntryId}
+        </if>
+        <if test="qcResultPageVO.isReject != null">
+            AND c.is_reject = #{qcResultPageVO.isReject}
+        </if>
+        <if test="qcResultPageVO.ruleType != null">
+            AND d.rule_type = #{qcResultPageVO.ruleType}
+        </if>
         )be
         left join med_check_info mci
         on mci.is_deleted = 'N'
@@ -6869,6 +6888,13 @@
         AND t1.behospital_code = t2.behospital_code
         AND t2.is_deleted = 'N'
         ) t
+        LEFT JOIN med_qcresult_cases e ON t.hospital_id = e.hospital_id
+        AND t.behospital_code = e.behospital_code
+        AND e.is_deleted = 'N'
+        AND e.`level`='不合格'
+        AND e.cases_id = 243
+        )f
+
         where 1=1
         <if test="qcResultPageVO.checkStatus != null">
             AND t.checkStatus = #{qcResultPageVO.checkStatus}