瀏覽代碼

Merge remote-tracking branch 'origin/dev/20200702_1.3.7' into dev/20200702_1.3.7

wangfeng 5 年之前
父節點
當前提交
e71157656b

+ 17 - 14
src/main/java/com/diagbot/dto/QcResultShortDTO.java

@@ -32,29 +32,31 @@ public class QcResultShortDTO {
     private Double scoreRes;
     @Excel(name = "病人住院序号", width = 40, orderNum = "3")
     private String behospitalCode;
-    @Excel(name = "病案号", width = 30, orderNum = "4")
+    @Excel(name = "核查状态", width = 20, orderNum = "4",replace = { "已核查_1", "未核查_0", "_null" })
+    private Integer checkStatus;
+    @Excel(name = "病案号", width = 30, orderNum = "5")
     private String fileCode;
-    @Excel(name = "病人姓名", width = 30, orderNum = "5")
+    @Excel(name = "病人姓名", width = 30, orderNum = "6")
     private String name;
-    @Excel(name = "性别", width = 20, orderNum = "6")
+    @Excel(name = "性别", width = 20, orderNum = "7")
     private String sex;
-    @Excel(name = "年龄", width = 20, orderNum = "7")
+    @Excel(name = "年龄", width = 20, orderNum = "8")
     private String age;
-    @Excel(name = "床号", width = 30, orderNum = "8")
+    @Excel(name = "床号", width = 30, orderNum = "9")
     private String bedCode;
-    @Excel(name = "入院日期", format = "yyyy-MM-dd", width = 30, orderNum = "9")
+    @Excel(name = "入院日期", format = "yyyy-MM-dd", width = 30, orderNum = "10")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date behospitalDate;
-    @Excel(name = "出院日期", format = "yyyy-MM-dd", width = 30, orderNum = "10")
+    @Excel(name = "出院日期", format = "yyyy-MM-dd", width = 30, orderNum = "11")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date leaveHospitalDate;
-    @Excel(name = "归档日期", format = "yyyy-MM-dd", width = 30, orderNum = "11")
+    @Excel(name = "归档日期", format = "yyyy-MM-dd", width = 30, orderNum = "12")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date placefileDate;
-    @Excel(name = "主诊断", width = 60, orderNum = "12")
+    @Excel(name = "主诊断", width = 60, orderNum = "13")
     private String diagnose;
     private String behDoctorId;
-    @Excel(name = "住院医生", width = 30, orderNum = "13")
+    @Excel(name = "住院医生", width = 30, orderNum = "14")
     private String behDoctorName;
     /**
      * 主治医生id
@@ -63,10 +65,10 @@ public class QcResultShortDTO {
     /**
      * 主治医生姓名
      */
-    @Excel(name = "主管医生", width = 30, orderNum = "14")
+    @Excel(name = "主管医生", width = 30, orderNum = "15")
     private String doctorName;
     private String directorDoctorId;
-    @Excel(name = "主任医生", width = 30, orderNum = "15")
+    @Excel(name = "主任医生", width = 30, orderNum = "16")
     private String directorDoctorName;
     /**
      * 科室编码
@@ -75,9 +77,9 @@ public class QcResultShortDTO {
     /**
      * 科室名称
      */
-    @Excel(name = "科室", width = 70, orderNum = "16")
+    @Excel(name = "科室", width = 70, orderNum = "17")
     private String behDeptName;
-    @Excel(name = "评分时间", format = "yyyy-MM-dd", width = 30, orderNum = "17")
+    @Excel(name = "评分时间", format = "yyyy-MM-dd", width = 30, orderNum = "18")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date gradeTime;
 
@@ -91,4 +93,5 @@ public class QcResultShortDTO {
      * 病区名称
      */
     private String wardName;
+
 }

+ 1 - 1
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -816,7 +816,7 @@ public class ConsoleFacade {
         //完整率
         NumDTO full = new NumDTO();
         full.setName("完整率");
-        full.setNum(emptyNumDTO.getEmptyNum());
+        full.setNum(emptyNumDTO.getEntryTotleNum() - emptyNumDTO.getEmptyNum());
         full.setTotleNum(emptyNumDTO.getEntryTotleNum());
         full.setPercent(emptyNumDTO.getEmptyPercent());
         full.setPercentStr(emptyNumDTO.getEmptyPercentStr());

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

@@ -71,4 +71,9 @@ public class QcResultShortPageVO extends Page {
      * 离院人员类型(0/null:总人数,1:死亡人数,2:新生儿,3:手术病人数,4:非医嘱离院病人,5:31日再入院病人)
      */
     private Integer leaveHosType;
+
+    /**
+     * 核查状态(1:已核查,0:未核查)
+     */
+    private Integer checkStatus;
 }

+ 73 - 562
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -2758,7 +2758,9 @@
 
     <!-- 条目缺陷质控评分页(内页)-->
     <select id="qcResultShortPage" 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,
@@ -2783,12 +2785,17 @@
         t1.diagnose,
         t1.ward_name AS wardName,
         t2.age,
-        t1.file_code AS fileCode
+        t1.file_code AS fileCode,
+        t1.checkStatus
         FROM
         (
         SELECT DISTINCT
         tt1.*
         FROM
+        (SELECT
+        be.*,
+        mci.status AS checkStatus
+        FROM
         (
         SELECT DISTINCT
         a.hospital_id,
@@ -2882,7 +2889,12 @@
             DATE( a.behospital_date ),
             DATE( a.leave_hospital_date ))> 30
         </if>
-        ) tt1
+        )be
+        left join med_check_info mci
+        on mci.is_deleted='N'
+        and be.hospital_id=mci.hospital_id
+        and be.behospital_code=mci.behospital_code
+        )tt1
         <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2511">
             ,med_medical_record tt2
             WHERE
@@ -2913,6 +2925,11 @@
             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>
     </select>
 
     <!-- 条目缺陷质控评分页-科室(内页)-->
@@ -3502,22 +3519,24 @@
         FROM
         (
         SELECT
-        bc1.file_code,
-        bc1.diagnose,
-        bc1.behospitalCode,
-        bc1.behospitalDate,
-        bc1.leaveHospitalDate
+        r1.file_code,
+        r1.diagnose,
+        r1.behospital_code AS behospitalCode,
+        r1.behospital_date AS behospitalDate,
+        r1.leave_hospital_date AS leaveHospitalDate,
+        r2.behospital_code AS lastBehospitalCode,
+        r2.behospital_date AS lastBehospitalDate,
+        r2.leave_hospital_date AS lastLeaveHospitalDate,
+        TIMESTAMPDIFF( DAY, DATE( r2.leave_hospital_date ), DATE( r1.behospital_date ) ) AS diffDay
         FROM
         (
         SELECT
+        ( @rownum := @rownum + 1 ) AS rownum,
         t1.file_code,
         t1.diagnose,
-        t1.behospital_code AS behospitalCode,
-        t1.leave_hospital_date AS leaveHospitalDate,
-        t2.behospital_code AS lastBehospitalCode,
-        t2.behospital_date AS lastBehospitalDate,
-        t1.behospital_date AS behospitalDate,
-        t2.leave_hospital_date AS lastLeaveHospitalDate
+        t1.behospital_code,
+        t1.behospital_date,
+        t1.leave_hospital_date
         FROM
         (
         SELECT
@@ -3535,8 +3554,9 @@
         med_behospital_info a
         WHERE
         a.is_deleted = 'N'
-        AND a.is_placefile = '1'
+        AND a.is_placefile = 1
         AND a.qc_type_id != 0
+        AND IFNULL( a.diagnose, '' )!= ''
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
@@ -3546,7 +3566,6 @@
         <if test="endDate != null">
             <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
         </if>
-        AND IFNULL( a.diagnose, '' )!= ''
         GROUP BY
         a.file_code,
         a.diagnose
@@ -3574,75 +3593,16 @@
         tt1.diagnose,
         tt2.behospital_date DESC
         ) t1,
-        (
-        SELECT
-        tt1.file_code,
-        tt1.diagnose,
-        tt2.behospital_code,
-        tt2.behospital_date,
-        tt2.leave_hospital_date
-        FROM
-        (
-        SELECT
-        a.file_code,
-        a.diagnose
-        FROM
-        med_behospital_info a
-        WHERE
-        a.is_deleted = 'N'
-        AND a.is_placefile = 1
-        AND a.qc_type_id != 0
-        AND a.hospital_id = 1
-        AND IFNULL( a.diagnose, '' )!= ''
-        GROUP BY
-        a.file_code,
-        a.diagnose
-        HAVING
-        count(*)> 1
-        ) tt1,
-        med_behospital_info tt2
-        WHERE
-        tt2.is_deleted = 'N'
-        AND tt2.is_placefile = 1
-        AND tt2.qc_type_id != 0
-        AND tt1.file_code = tt2.file_code
-        AND tt1.diagnose = tt2.diagnose
-        <if test="hospitalId != null and hospitalId != ''">
-            AND tt2.hospital_id = #{hospitalId}
-        </if>
-        <if test="startDate != null">
-            <![CDATA[ AND tt2.leave_hospital_date >= DATE(#{startDate})]]>
-        </if>
-        <if test="endDate != null">
-            <![CDATA[AND tt2.leave_hospital_date < DATE(#{endDate})]]>
-        </if>
-        ORDER BY
-        tt1.file_code,
-        tt1.diagnose,
-        tt2.behospital_date DESC
-        ) t2
-        WHERE
-        t1.file_code = t2.file_code
-        AND t1.diagnose = t2.diagnose
-        AND t1.behospital_code != t2.behospital_code
-        AND ( TIMESTAMPDIFF( DAY, DATE( t2.leave_hospital_date ), DATE( t1.behospital_date )) BETWEEN 0 AND 31 )) bc1 UNION
-        SELECT
-        bc2.file_code,
-        bc2.diagnose,
-        bc2.lastBehospitalCode,
-        bc2.lastBehospitalDate,
-        bc2.lastLeaveHospitalDate
-        FROM
-        (
+        ( SELECT @rownum := 0 ) r
+        ) r1
+        LEFT JOIN (
         SELECT
-        t1.file_code,
-        t1.diagnose,
-        t1.behospital_code AS behospitalCode,
-        t1.leave_hospital_date AS leaveHospitalDate,
-        t2.behospital_code AS lastBehospitalCode,
-        t2.behospital_date AS lastBehospitalDate,
-        t1.behospital_date AS behospitalDate,
-        t2.leave_hospital_date AS lastLeaveHospitalDate
+        ( @INDEX := @INDEX + 1 ) AS rownum,
+        t2.file_code,
+        t2.diagnose,
+        t2.behospital_code,
+        t2.behospital_date,
+        t2.leave_hospital_date
         FROM
         (
         SELECT
@@ -3660,8 +3620,9 @@
         med_behospital_info a
         WHERE
         a.is_deleted = 'N'
-        AND a.is_placefile = '1'
+        AND a.is_placefile = 1
         AND a.qc_type_id != 0
+        AND IFNULL( a.diagnose, '' )!= ''
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
@@ -3671,7 +3632,6 @@
         <if test="endDate != null">
             <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
         </if>
-        AND IFNULL( a.diagnose, '' )!= ''
         GROUP BY
         a.file_code,
         a.diagnose
@@ -3698,60 +3658,17 @@
         tt1.file_code,
         tt1.diagnose,
         tt2.behospital_date DESC
-        ) t1,
-        (
-        SELECT
-        tt1.file_code,
-        tt1.diagnose,
-        tt2.behospital_code,
-        tt2.behospital_date,
-        tt2.leave_hospital_date
-        FROM
-        (
+        ) t2,(
         SELECT
-        a.file_code,
-        a.diagnose
-        FROM
-        med_behospital_info a
-        WHERE
-        a.is_deleted = 'N'
-        AND a.is_placefile = 1
-        AND a.qc_type_id != 0
-        AND a.hospital_id = 1
-        AND IFNULL( a.diagnose, '' )!= ''
-        GROUP BY
-        a.file_code,
-        a.diagnose
-        HAVING
-        count(*)> 1
-        ) tt1,
-        med_behospital_info tt2
-        WHERE
-        tt2.is_deleted = 'N'
-        AND tt2.is_placefile = 1
-        AND tt2.qc_type_id != 0
-        AND tt1.file_code = tt2.file_code
-        AND tt1.diagnose = tt2.diagnose
-        <if test="hospitalId != null and hospitalId != ''">
-            AND tt2.hospital_id = #{hospitalId}
-        </if>
-        <if test="startDate != null">
-            <![CDATA[ AND tt2.leave_hospital_date >= DATE(#{startDate})]]>
-        </if>
-        <if test="endDate != null">
-            <![CDATA[AND tt2.leave_hospital_date < DATE(#{endDate})]]>
-        </if>
-        ORDER BY
-        tt1.file_code,
-        tt1.diagnose,
-        tt2.behospital_date DESC
-        ) t2
-        WHERE
-        t1.file_code = t2.file_code
-        AND t1.diagnose = t2.diagnose
-        AND t1.behospital_code != t2.behospital_code
-        AND ( TIMESTAMPDIFF( DAY, DATE( t2.leave_hospital_date ), DATE( t1.behospital_date )) BETWEEN 0 AND 31 )) bc2
+        @INDEX := 0
+        ) r
+        ) r2 ON r1.file_code = r2.file_code
+        AND r1.rownum = r2.rownum - 1
         ) t
+        WHERE
+        t.diffDay IS NOT NULL
+        AND t.diffDay BETWEEN 0
+        AND 31
     </select>
 
     <!-- 病案首页质控病历数统计-全院(首页)-->
@@ -3871,10 +3788,14 @@
         t1.gmt_create AS gradeTime,
         t1.diagnose,
         t1.ward_name AS wardName,
+        t1.status AS checkStatus,
         t2.age,
         t2.file_code AS fileCode
         FROM
         (
+        SELECT be.*,mci.status
+        FROM
+        (
         SELECT DISTINCT
         tt1.*
         FROM
@@ -3960,431 +3881,21 @@
             AND tt2.mode_id = tt3.id
             AND tt3.`name` = '手术记录'
         </if>
-        <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==5">
-            ,(
-            SELECT
-            bc1.file_code,
-            bc1.diagnose,
-            bc1.behospitalCode,
-            bc1.behospitalDate,
-            bc1.leaveHospitalDate
-            FROM
-            (
-            SELECT
-            t1.file_code,
-            t1.diagnose,
-            t1.behospital_code AS behospitalCode,
-            t1.leave_hospital_date AS leaveHospitalDate,
-            t2.behospital_code AS lastBehospitalCode,
-            t2.behospital_date AS lastBehospitalDate,
-            t1.behospital_date AS behospitalDate,
-            t2.leave_hospital_date AS lastLeaveHospitalDate
-            FROM
-            (
-            SELECT
-            tt1.file_code,
-            tt1.diagnose,
-            tt2.behospital_code,
-            tt2.behospital_date,
-            tt2.leave_hospital_date
-            FROM
-            (
-            SELECT
-            a.file_code,
-            a.diagnose
-            FROM
-            med_behospital_info a
-            WHERE
-            a.is_deleted = 'N'
-            AND a.is_placefile = 1
-            AND a.qc_type_id != 0
-            AND IFNULL( a.diagnose, '' )!= ''
-            <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
-                AND a.hospital_id = #{qcResultShortPageVO.hospitalId}
-            </if>
-            <if test="qcResultShortPageVO.startDate != null">
-                <![CDATA[ AND a.leave_hospital_date >= DATE(#{qcResultShortPageVO.startDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.endDate != null ">
-                <![CDATA[AND a.leave_hospital_date < DATE(#{qcResultShortPageVO.endDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.behDeptName != null and qcResultShortPageVO.behDeptName != ''">
-                AND a.beh_dept_name = #{qcResultShortPageVO.behDeptName}
-            </if>
-            <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
-                AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
-            </if>
-            <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
-                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}, '%' ))
-            </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>
-            GROUP BY
-            a.file_code,
-            a.diagnose
-            HAVING
-            count(*)> 1
-            ) tt1,
-            med_behospital_info tt2
-            WHERE
-            tt2.is_deleted = 'N'
-            AND tt2.is_placefile = 1
-            AND tt2.qc_type_id != 0
-            AND tt1.file_code = tt2.file_code
-            AND tt1.diagnose = tt2.diagnose
-            <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
-                AND tt2.hospital_id = #{qcResultShortPageVO.hospitalId}
-            </if>
-            <if test="qcResultShortPageVO.startDate != null">
-                <![CDATA[ AND tt2.leave_hospital_date >= DATE(#{qcResultShortPageVO.startDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.endDate != null ">
-                <![CDATA[AND tt2.leave_hospital_date < DATE(#{qcResultShortPageVO.endDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.behDeptName != null and qcResultShortPageVO.behDeptName != ''">
-                AND tt2.beh_dept_name = #{qcResultShortPageVO.behDeptName}
-            </if>
-            <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
-                AND tt2.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
-            </if>
-            <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
-                AND tt2.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
-            </if>
-            <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
-                AND (tt2.doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
-                OR tt2.beh_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
-                OR tt2.director_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' ))
-            </if>
-            <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
-                AND (tt2.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-                OR tt2.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-                OR tt2.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
-            </if>
-            ORDER BY
-            tt1.file_code,
-            tt1.diagnose,
-            tt2.behospital_date DESC
-            ) t1,
-            (
-            SELECT
-            tt1.file_code,
-            tt1.diagnose,
-            tt2.behospital_code,
-            tt2.behospital_date,
-            tt2.leave_hospital_date
-            FROM
-            (
-            SELECT
-            a.file_code,
-            a.diagnose
-            FROM
-            med_behospital_info a
+        ) be
+        <if test="qcResultShortPageVO.checkStatus != null">
+            ,med_check_info mci
             WHERE
-            a.is_deleted = 'N'
-            AND a.is_placefile = 1
-            AND a.qc_type_id != 0
-            AND IFNULL( a.diagnose, '' )!= ''
-            <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
-                AND a.hospital_id = #{qcResultShortPageVO.hospitalId}
-            </if>
-            <if test="qcResultShortPageVO.startDate != null">
-                <![CDATA[ AND a.leave_hospital_date >= DATE(#{qcResultShortPageVO.startDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.endDate != null ">
-                <![CDATA[AND a.leave_hospital_date < DATE(#{qcResultShortPageVO.endDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.behDeptName != null and qcResultShortPageVO.behDeptName != ''">
-                AND a.beh_dept_name = #{qcResultShortPageVO.behDeptName}
-            </if>
-            <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
-                AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
-            </if>
-            <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
-                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}, '%' ))
-            </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>
-            GROUP BY
-            a.file_code,
-            a.diagnose
-            HAVING
-            count(*)> 1
-            ) tt1,
-            med_behospital_info tt2
-            WHERE
-            tt2.is_deleted = 'N'
-            AND tt2.is_placefile = 1
-            AND tt2.qc_type_id != 0
-            AND tt1.file_code = tt2.file_code
-            AND tt1.diagnose = tt2.diagnose
-            <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
-                AND tt2.hospital_id = #{qcResultShortPageVO.hospitalId}
-            </if>
-            <if test="qcResultShortPageVO.startDate != null">
-                <![CDATA[ AND tt2.leave_hospital_date >= DATE(#{qcResultShortPageVO.startDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.endDate != null ">
-                <![CDATA[AND tt2.leave_hospital_date < DATE(#{qcResultShortPageVO.endDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.behDeptName != null and qcResultShortPageVO.behDeptName != ''">
-                AND tt2.beh_dept_name = #{qcResultShortPageVO.behDeptName}
-            </if>
-            <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
-                AND tt2.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
-            </if>
-            <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
-                AND tt2.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
-            </if>
-            <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
-                AND (tt2.doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
-                OR tt2.beh_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
-                OR tt2.director_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' ))
-            </if>
-            <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
-                AND (tt2.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-                OR tt2.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-                OR tt2.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
-            </if>
-            ORDER BY
-            tt1.file_code,
-            tt1.diagnose,
-            tt2.behospital_date DESC
-            ) t2
-            WHERE
-            t1.file_code = t2.file_code
-            AND t1.diagnose = t2.diagnose
-            AND t1.behospital_code != t2.behospital_code
-            AND ( TIMESTAMPDIFF( DAY, DATE( t2.leave_hospital_date ), DATE( t1.behospital_date )) BETWEEN 0 AND 31 )) bc1 UNION
-            SELECT
-            bc2.file_code,
-            bc2.diagnose,
-            bc2.lastBehospitalCode,
-            bc2.lastBehospitalDate,
-            bc2.lastLeaveHospitalDate
-            FROM
-            (
-            SELECT
-            t1.file_code,
-            t1.diagnose,
-            t1.behospital_code AS behospitalCode,
-            t1.leave_hospital_date AS leaveHospitalDate,
-            t2.behospital_code AS lastBehospitalCode,
-            t2.behospital_date AS lastBehospitalDate,
-            t1.behospital_date AS behospitalDate,
-            t2.leave_hospital_date AS lastLeaveHospitalDate
-            FROM
-            (
-            SELECT
-            tt1.file_code,
-            tt1.diagnose,
-            tt2.behospital_code,
-            tt2.behospital_date,
-            tt2.leave_hospital_date
-            FROM
-            (
-            SELECT
-            a.file_code,
-            a.diagnose
-            FROM
-            med_behospital_info a
-            WHERE
-            a.is_deleted = 'N'
-            AND a.is_placefile = 1
-            AND a.qc_type_id != 0
-            AND IFNULL( a.diagnose, '' )!= ''
-            <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
-                AND a.hospital_id = #{qcResultShortPageVO.hospitalId}
-            </if>
-            <if test="qcResultShortPageVO.startDate != null">
-                <![CDATA[ AND a.leave_hospital_date >= DATE(#{qcResultShortPageVO.startDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.endDate != null ">
-                <![CDATA[AND a.leave_hospital_date < DATE(#{qcResultShortPageVO.endDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.behDeptName != null and qcResultShortPageVO.behDeptName != ''">
-                AND a.beh_dept_name = #{qcResultShortPageVO.behDeptName}
-            </if>
-            <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
-                AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
-            </if>
-            <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
-                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}, '%' ))
-            </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>
-            GROUP BY
-            a.file_code,
-            a.diagnose
-            HAVING
-            count(*)> 1
-            ) tt1,
-            med_behospital_info tt2
-            WHERE
-            tt2.is_deleted = 'N'
-            AND tt2.is_placefile = 1
-            AND tt2.qc_type_id != 0
-            AND tt1.file_code = tt2.file_code
-            AND tt1.diagnose = tt2.diagnose
-            <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
-                AND tt2.hospital_id = #{qcResultShortPageVO.hospitalId}
-            </if>
-            <if test="qcResultShortPageVO.startDate != null">
-                <![CDATA[ AND tt2.leave_hospital_date >= DATE(#{qcResultShortPageVO.startDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.endDate != null ">
-                <![CDATA[AND tt2.leave_hospital_date < DATE(#{qcResultShortPageVO.endDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.behDeptName != null and qcResultShortPageVO.behDeptName != ''">
-                AND tt2.beh_dept_name = #{qcResultShortPageVO.behDeptName}
-            </if>
-            <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
-                AND tt2.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
-            </if>
-            <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
-                AND tt2.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
-            </if>
-            <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
-                AND (tt2.doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
-                OR tt2.beh_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
-                OR tt2.director_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' ))
-            </if>
-            <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
-                AND (tt2.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-                OR tt2.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-                OR tt2.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
-            </if>
-            ORDER BY
-            tt1.file_code,
-            tt1.diagnose,
-            tt2.behospital_date DESC
-            ) t1,
-            (
-            SELECT
-            tt1.file_code,
-            tt1.diagnose,
-            tt2.behospital_code,
-            tt2.behospital_date,
-            tt2.leave_hospital_date
-            FROM
-            (
-            SELECT
-            a.file_code,
-            a.diagnose
-            FROM
-            med_behospital_info a
-            WHERE
-            a.is_deleted = 'N'
-            AND a.is_placefile = 1
-            AND a.qc_type_id != 0
-            AND IFNULL( a.diagnose, '' )!= ''
-            <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
-                AND a.hospital_id = #{qcResultShortPageVO.hospitalId}
-            </if>
-            <if test="qcResultShortPageVO.startDate != null">
-                <![CDATA[ AND a.leave_hospital_date >= DATE(#{qcResultShortPageVO.startDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.endDate != null ">
-                <![CDATA[AND a.leave_hospital_date < DATE(#{qcResultShortPageVO.endDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.behDeptName != null and qcResultShortPageVO.behDeptName != ''">
-                AND a.beh_dept_name = #{qcResultShortPageVO.behDeptName}
-            </if>
-            <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
-                AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
-            </if>
-            <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
-                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}, '%' ))
-            </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>
-            GROUP BY
-            a.file_code,
-            a.diagnose
-            HAVING
-            count(*)> 1
-            ) tt1,
-            med_behospital_info tt2
-            WHERE
-            tt2.is_deleted = 'N'
-            AND tt2.is_placefile = 1
-            AND tt2.qc_type_id != 0
-            AND tt1.file_code = tt2.file_code
-            AND tt1.diagnose = tt2.diagnose
-            <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
-                AND tt2.hospital_id = #{qcResultShortPageVO.hospitalId}
-            </if>
-            <if test="qcResultShortPageVO.startDate != null">
-                <![CDATA[ AND tt2.leave_hospital_date >= DATE(#{qcResultShortPageVO.startDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.endDate != null ">
-                <![CDATA[AND tt2.leave_hospital_date < DATE(#{qcResultShortPageVO.endDate})]]>
-            </if>
-            <if test="qcResultShortPageVO.behDeptName != null and qcResultShortPageVO.behDeptName != ''">
-                AND tt2.beh_dept_name = #{qcResultShortPageVO.behDeptName}
-            </if>
-            <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
-                AND tt2.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
-            </if>
-            <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
-                AND tt2.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
-            </if>
-            <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
-                AND (tt2.doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
-                OR tt2.beh_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
-                OR tt2.director_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' ))
-            </if>
-            <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
-                AND (tt2.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-                OR tt2.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-                OR tt2.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
-            </if>
-            ORDER BY
-            tt1.file_code,
-            tt1.diagnose,
-            tt2.behospital_date DESC
-            ) t2
-            WHERE
-            t1.file_code = t2.file_code
-            AND t1.diagnose = t2.diagnose
-            AND t1.behospital_code != t2.behospital_code
-            AND ( TIMESTAMPDIFF( DAY, DATE( t2.leave_hospital_date ), DATE( t1.behospital_date )) BETWEEN 0 AND 31 )) bc2
-            ) tt2
-            WHERE
-            tt1.behospital_code = tt2.behospitalCode
+            mci.is_deleted = 'N'
+            AND be.hospital_id = mci.hospital_id
+            AND be.behospital_code = mci.behospital_code
+            AND mci.status = #{qcResultShortPageVO.checkStatus}
         </if>
-        ) t1
+        <if test="qcResultShortPageVO.checkStatus == null">
+            LEFT JOIN med_check_info mci ON mci.is_deleted = 'N'
+            AND be.hospital_id = mci.hospital_id
+            AND be.behospital_code = mci.behospital_code
+        </if>
+        )t1
         <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==2">
             ,med_home_page t2
             WHERE
@@ -4412,7 +3923,7 @@
             AND t1.behospital_code = t2.behospital_code
             AND t2.leave_hospital_type = '非医嘱离院'
         </if>
-        <if test="qcResultShortPageVO.leaveHosType == null or qcResultShortPageVO.leaveHosType == 0 or qcResultShortPageVO.leaveHosType == 3 or qcResultShortPageVO.leaveHosType == 5">
+        <if test="qcResultShortPageVO.leaveHosType == null or qcResultShortPageVO.leaveHosType == 0 or qcResultShortPageVO.leaveHosType == 3">
             LEFT JOIN med_home_page t2 ON t2.is_deleted = 'N'
             AND t1.hospital_id = t2.hospital_id
             AND t1.behospital_code = t2.behospital_code