瀏覽代碼

病案首页合格率报表

chengyao 4 年之前
父節點
當前提交
f090de653a
共有 2 個文件被更改,包括 146 次插入52 次删除
  1. 0 5
      src/main/java/com/diagbot/facade/FilterFacade.java
  2. 146 47
      src/main/resources/mapper/BehospitalInfoMapper.xml

+ 0 - 5
src/main/java/com/diagbot/facade/FilterFacade.java

@@ -403,11 +403,6 @@ public class FilterFacade {
         String userId = SysUserUtils.getCurrentPrincipleID();
         qcResultPageVO.setHospitalId(hospitalId);
         qcResultPageVO.setUserId(Long.valueOf(userId));
-        if (StringUtils.isEmpty(qcResultPageVO.getDoctorId())) {
-            qcResultPageVO.setDoctorName("");
-        }
-        /*long interval = qcResultShortPageVO.getEndDate().getTime() + 1000;
-        qcResultShortPageVO.setEndDate(new Date(Long.valueOf(interval)));*/
     }
 
 

+ 146 - 47
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -4684,13 +4684,16 @@
 
     <!-- 条目缺陷质控评分页-科室(内页)-->
     <select id="qcResultShortByDeptPage" resultType="com.diagbot.dto.QcResultShortDTO">
-        SELECT DISTINCT
+        SELECT t.*
+        FROM
+        (SELECT DISTINCT
         t1.hospital_id AS hospitalId,
         t1.behospital_code AS behospitalCode,
         t1.bed_code AS bedCode,
         t1.LEVEL AS LEVEL,
         t1.grade_type AS gradeType,
         t1.score_res AS scoreRes,
+        t1.scoreBn,
         t1.NAME AS NAME,
         t1.sex AS sex,
         t1.beh_dept_id AS behDeptId,
@@ -4709,8 +4712,27 @@
         t1.diagnose,
         t1.ward_name AS wardName,
         CONCAT( ifnull(t2.age,''),ifnull(t2.age_unit,'') )as age,
-        t3.score_res as scoreBn,
-        t1.file_code AS fileCode
+        t1.file_code AS fileCode,
+        t1.checkStatus,
+        t1.mrStatus,
+        t1.chName,
+        t1.mrName,
+        t1.chTime,
+        t1.mrTime
+        FROM
+        (
+        SELECT DISTINCT
+        tt1.*
+        FROM
+        (SELECT
+        be.*,
+        ifnull(mci.status,0) AS checkStatus,
+        ifnull(hm_mci.status,0) AS mrStatus,
+        mci.check_name as chName,
+        e.score_res as scoreBn,
+        hm_mci.check_name as mrName,
+        mci.gmt_create as chTime,
+        hm_mci.gmt_create as mrTime
         FROM
         (
         SELECT DISTINCT
@@ -4759,15 +4781,12 @@
         AND c.cases_id = d.cases_id
         AND c.cases_entry_id = d.id
         AND a.qc_type_id != 0
+        <if test="qcResultShortPageVO.userId!=null">
+            AND e.user_id = #{qcResultShortPageVO.userId}
+        </if>
         <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
             and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
         </if>
-        <if test="qcResultShortPageVO.diagnose != null and qcResultShortPageVO.diagnose != ''">
-            and a.diagnose LIKE CONCAT( '%', #{qcResultShortPageVO.diagnose}, '%' )
-        </if>
-        <if test="qcResultShortPageVO.userId != null and qcResultShortPageVO.userId != ''">
-            AND e.user_id = #{qcResultShortPageVO.userId}
-        </if>
         <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
             AND a.hospital_id = #{qcResultShortPageVO.hospitalId}
         </if>
@@ -4787,21 +4806,11 @@
                 <![CDATA[ AND a.leave_hospital_date <= #{qcResultShortPageVO.endDate}]]>
             </if>
         </if>
-        <if test="qcResultShortPageVO.deptName != null and qcResultShortPageVO.deptName != ''">
-            AND a.beh_dept_name = #{qcResultShortPageVO.deptName}
-        </if>
-        <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
-            AND a.doctor_name = #{qcResultShortPageVO.doctorName}
-        </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}, '%' ))
+        <if test="qcResultShortPageVO.diagnose != null and qcResultShortPageVO.diagnose != ''">
+            AND a.diagnose LIKE CONCAT( '%', #{qcResultShortPageVO.diagnose}, '%' )
         </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}, '%' ))
+        <if test="qcResultShortPageVO.deptName != null and qcResultShortPageVO.deptName != ''">
+            AND a.beh_dept_name LIKE CONCAT( '%', #{qcResultShortPageVO.deptName}, '%' )
         </if>
         <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
             AND b.`level` = #{qcResultShortPageVO.level}
@@ -4813,25 +4822,118 @@
             AND a.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
         </if>
         <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
-            AND d.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.casesEntryName}, '%' )
+            AND d.NAME = #{qcResultShortPageVO.casesEntryName}
         </if>
-        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId != ''">
+        <if test="qcResultShortPageVO.casesEntryId != null ">
             AND d.id = #{qcResultShortPageVO.casesEntryId}
         </if>
+        <if test="qcResultShortPageVO.casesName != null and qcResultShortPageVO.casesName != ''">
+            AND d.cases_name = #{qcResultShortPageVO.casesName}
+        </if>
+        <if test="qcResultShortPageVO.casesId != null">
+            AND d.cases_id = #{qcResultShortPageVO.casesId}
+        </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}, '%' ))
+        </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}, '%' ))
+        </if>
         <if test="qcResultShortPageVO.isReject != null">
             AND c.is_reject = #{qcResultShortPageVO.isReject}
         </if>
         <if test="qcResultShortPageVO.ruleType != null">
             AND d.rule_type = #{qcResultShortPageVO.ruleType}
         </if>
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2495">
+            AND TIMESTAMPDIFF(
+            DAY,
+            DATE( a.behospital_date ),
+            DATE( a.leave_hospital_date ))> 30
+        </if>
+        <if test="qcResultShortPageVO.beHosGT31Days != null and qcResultShortPageVO.beHosGT31Days==1">
+            AND TIMESTAMPDIFF(
+            DAY,
+            DATE( a.behospital_date ),
+            DATE( a.leave_hospital_date ))> 31
+        </if>
+        )be
+        left join med_check_info mci
+        on mci.is_deleted = 'N'
+        and mci.check_type = 0
+        and be.hospital_id = mci.hospital_id
+        and be.behospital_code = mci.behospital_code
+        left join med_check_info hm_mci
+        on hm_mci.is_deleted = 'N'
+        and hm_mci.check_type = 1
+        and be.hospital_id = hm_mci.hospital_id
+        and be.behospital_code = hm_mci.behospital_code
+        LEFT JOIN med_qcresult_cases e
+        on  be.behospital_code = e.behospital_code
+        and be.hospital_id = e.hospital_id
+        AND e.is_deleted = 'N'
+        and e.cases_id = 243
+        )tt1
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2511">
+            ,med_medical_record tt2
+            WHERE
+            tt2.is_deleted = 'N'
+            AND tt1.hospital_id = tt2.hospital_id
+            AND tt1.behospital_code = tt2.behospital_code
+            AND tt2.mode_id = 30
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2419">
+            ,med_crisis_info tt2
+            WHERE
+            tt2.is_deleted = 'N'
+            AND tt1.hospital_id = tt2.hospital_id
+            AND tt1.behospital_code = tt2.behospital_code
+        </if>
         ) t1
-        LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
-        AND t1.behospital_code = t2.behospital_code
-        AND t2.is_deleted = 'N'
-        LEFT JOIN med_qcresult_cases t3 on  t1.behospital_code = t3.behospital_code
-        and t1.hospital_id = t3.hospital_id
-        AND t3.is_deleted = 'N'
-        and t3.cases_id = 243
+        <if test="qcResultShortPageVO.casesEntryId == null or (qcResultShortPageVO.casesEntryId!=2594  and qcResultShortPageVO.casesEntryId!=2973 and qcResultShortPageVO.casesEntryId!=2930)">
+            LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
+            AND t1.behospital_code = t2.behospital_code
+            AND t2.is_deleted = 'N'
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null and( qcResultShortPageVO.casesEntryId==2594  or qcResultShortPageVO.casesEntryId==2973 or qcResultShortPageVO.casesEntryId==2930)">
+            , med_home_page t2
+            , med_home_operation_info t3
+            WHERE t1.hospital_id = t2.hospital_id
+            AND t1.behospital_code = t2.behospital_code
+            AND t2.home_page_id = t3.home_page_id
+            AND t2.is_deleted = 'N'
+            AND t3.is_deleted = 'N'
+        </if>
+        ) t
+        where 1=1
+        <if test="qcResultShortPageVO.checkStatus != null">
+            AND t.checkStatus = #{qcResultShortPageVO.checkStatus}
+        </if>
+        <if test="qcResultShortPageVO.mrStatus != null">
+            AND t.mrStatus = #{qcResultShortPageVO.mrStatus}
+        </if>
+        <if test="qcResultShortPageVO.chName != null and qcResultShortPageVO.chName!=''">
+            AND t.chName like concat('%', #{qcResultShortPageVO.chName}, '%')
+        </if>
+        <if test="qcResultShortPageVO.mrName != null and qcResultShortPageVO.mrName!=''">
+            AND t.mrName like concat('%', #{qcResultShortPageVO.mrName}, '%')
+        </if>
+        <if test="qcResultShortPageVO.chTimeStart != null ">
+            <![CDATA[ AND t.chTime >= #{qcResultShortPageVO.chTimeStart}]]>
+        </if>
+        <if test="qcResultShortPageVO.chTimeEnd != null ">
+            <![CDATA[ AND t.chTime <= #{qcResultShortPageVO.chTimeEnd}]]>
+        </if>
+        <if test="qcResultShortPageVO.mrTimeStart != null ">
+            <![CDATA[ AND t.mrTime >= #{qcResultShortPageVO.mrTimeStart}]]>
+        </if>
+        <if test="qcResultShortPageVO.mrTimeEnd != null ">
+            <![CDATA[ AND t.mrTime <= #{qcResultShortPageVO.mrTimeEnd}]]>
+        </if>
     </select>
 
     <update id="updateBatchByKey">
@@ -10595,6 +10697,9 @@
         <if test="isPlacefile != null and isPlacefile != ''">
             and a.is_placefile = #{isPlacefile}
         </if>
+        <if test="doctorName != null and doctorName != ''">
+            and a.doctor_name = #{doctorName}
+        </if>
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
@@ -10628,11 +10733,6 @@
             OR a.beh_doctor_id LIKE CONCAT( '%', #{doctorId}, '%' )
             OR a.director_doctor_id LIKE CONCAT( '%', #{doctorId}, '%' ))
         </if>
-        <if test="doctorName != null and doctorName != ''">
-            AND (a.doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
-            OR a.beh_doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
-            OR a.director_doctor_name LIKE CONCAT( '%', #{doctorName}, '%' ))
-        </if>
         )be
         left join med_check_info mci
         on mci.is_deleted = 'N'
@@ -10699,6 +10799,9 @@
         <if test="deptName != null and deptName != ''">
             and a.beh_dept_name = #{deptName}
         </if>
+        <if test="doctorName != null and doctorName != ''">
+            and a.doctor_name = #{doctorName}
+        </if>
         <if test="deptClass != null and deptClass != ''">
             and a.beh_dept_id = #{deptClass}
         </if>
@@ -10733,16 +10836,6 @@
         <if test="patName != null and patName != ''">
             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}, '%' ))
-        </if>
-        <if test="doctorName != null and doctorName != ''">
-            AND (a.doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
-            OR a.beh_doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
-            OR a.director_doctor_name LIKE CONCAT( '%', #{doctorName}, '%' ))
-        </if>
         GROUP BY
         a.doctor_id,
         a.doctor_name
@@ -12067,6 +12160,9 @@
                 AND c.`level`='合格'
             </if>
         </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>
@@ -12297,6 +12393,9 @@
         <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>