Bladeren bron

Merge branch 'dev/20201021_1.4.7' into debug

chengyao 4 jaren geleden
bovenliggende
commit
eedfdf3cca

+ 26 - 0
doc/024.20200923v1.4.6/qc_initv1.4.6.sql

@@ -0,0 +1,26 @@
+use `qc`;
+UPDATE `sys_user_pageset` SET  `order_no` = 0  WHERE user_id = -1 and name = '病历等级';
+UPDATE `sys_user_pageset` SET  `order_no` = 1  WHERE user_id = -1 and name = '病历得分';
+INSERT INTO `qc`.`sys_user_pageset`(`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `user_id`, `page_type`, `name`, `val`, `status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 1, '病案首页得分', 'scoreBn', 0, 2, NULL);
+UPDATE `sys_user_pageset` SET  `order_no` = 3  WHERE user_id = -1 and name = '病人住院序号';
+UPDATE `sys_user_pageset` SET  `order_no` = 4  WHERE user_id = -1 and name = '病案首页核查状态';
+UPDATE `sys_user_pageset` SET  `order_no` = 5  WHERE user_id = -1 and name = '病案首页核查人';
+UPDATE `sys_user_pageset` SET  `order_no` = 6  WHERE user_id = -1 and name = '病案首页核查时间';
+UPDATE `sys_user_pageset` SET  `order_no` = 7  WHERE user_id = -1 and name = '病历核查状态';
+UPDATE `sys_user_pageset` SET  `order_no` = 8  WHERE user_id = -1 and name = '病历核查人';
+UPDATE `sys_user_pageset` SET  `order_no` = 9  WHERE user_id = -1 and name = '病历核查时间';
+UPDATE `sys_user_pageset` SET  `order_no` = 10  WHERE user_id = -1 and name = '病案号';
+UPDATE `sys_user_pageset` SET  `order_no` = 11  WHERE user_id = -1 and name = '病人姓名';
+UPDATE `sys_user_pageset` SET  `order_no` = 12  WHERE user_id = -1 and name = '性别';
+UPDATE `sys_user_pageset` SET  `order_no` = 13  WHERE user_id = -1 and name = '年龄';
+UPDATE `sys_user_pageset` SET  `order_no` = 14  WHERE user_id = -1 and name = '床号';
+UPDATE `sys_user_pageset` SET  `order_no` = 15  WHERE user_id = -1 and name = '入院日期';
+UPDATE `sys_user_pageset` SET  `order_no` = 16  WHERE user_id = -1 and name = '出院日期';
+UPDATE `sys_user_pageset` SET  `order_no` = 17  WHERE user_id = -1 and name = '归档日期';
+UPDATE `sys_user_pageset` SET  `order_no` = 18  WHERE user_id = -1 and name = '主诊断';
+UPDATE `sys_user_pageset` SET  `order_no` = 19  WHERE user_id = -1 and name = '住院医生';
+UPDATE `sys_user_pageset` SET  `order_no` = 20  WHERE user_id = -1 and name = '主管医生';
+UPDATE `sys_user_pageset` SET  `order_no` = 21  WHERE user_id = -1 and name = '主任医生';
+UPDATE `sys_user_pageset` SET  `order_no` = 22  WHERE user_id = -1 and name = '科室';
+UPDATE `sys_user_pageset` SET  `order_no` = 23  WHERE user_id = -1 and name = '评分时间';
+

+ 2 - 0
doc/025.20201021v1.4.7/qc_initv1.4.7.sql

@@ -0,0 +1,2 @@
+use `qc`;
+INSERT INTO `qc`.`sys_dictionary_info`( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 3, 'anaesthesiaDoctor', '麻醉医师', 2, 0, '病案首页手术信息');

+ 8 - 2
src/main/java/com/diagbot/facade/ConsoleExportFacade.java

@@ -322,7 +322,7 @@ public class ConsoleExportFacade {
     }
 
     /**
-     * 病案首页不合格数
+     * 病案首页不合格/合格
      *
      * @param qcResultShortPageVO
      * @return
@@ -349,7 +349,13 @@ public class ConsoleExportFacade {
         qcResultShortPageVO.setSize(Long.MAX_VALUE);
         qcResultShortPageVO.setSearchCount(false);
         List<ExportExcelDTO> records = behospitalInfoFacade.badLevelPagePageExport(qcResultShortPageVO);
-        String fileName = "病案首页不合格数病历详情页.xls";
+        String fileName = null;
+        if("不合格数".equals(qcResultShortPageVO.getTitleName())){
+             fileName = "病案首页不合格数病历详情页.xls";
+        }else{
+             fileName = "病案首页合格数病历详情页.xls";
+        }
+
         ExcelUtils.exportExcelUser(records, null, "sheet1", ExportExcelDTO.class, fileName, response);
     }
 

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

@@ -1175,7 +1175,7 @@ public class ConsoleFacade {
     }
 
     /**
-     * 不合格数病历号(内页)
+     * 不合格/合格数病历号(内页)
      *
      * @param qcResultPageVO
      * @return

+ 2 - 2
src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java

@@ -352,7 +352,7 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
     public IPage<QcResultShortDTO> unModifyMRPage(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
 
     /**
-     * 不合格数病历号(内页)
+     * 不合格/合格数病历号(内页)
      *
      * @param qcResultPageVO
      * @return
@@ -371,7 +371,7 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
 
 
     /**
-     * 病案首页不合格数病历详情页导出
+     * 病案首页不合格/合格数病历详情页导出
      *
      * @param qcResultShortPageVO
      * @return

+ 1 - 1
src/main/java/com/diagbot/service/BehospitalInfoService.java

@@ -346,7 +346,7 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
     public List<ExportExcelDTO> unModifyMRPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
 
     /**
-     * 病案首页不合格数病历详情页导出
+     * 病案首页不合格/合格数病历详情页导出
      *
      * @param qcResultShortPageVO
      * @return

+ 2 - 2
src/main/java/com/diagbot/service/impl/BehospitalInfoServiceImpl.java

@@ -585,7 +585,7 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
     }
 
     /**
-     * 不合格数病历号(内页)
+     * 不合格/合格数病历号(内页)
      *
      * @param qcResultPageVO
      * @return
@@ -607,7 +607,7 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
     }
 
     /**
-     * 病案首页不合格数病历详情页导出
+     * 病案首页不合格/合格数病历详情页导出
      *
      * @param qcResultShortPageVO
      * @return

+ 17 - 0
src/main/java/com/diagbot/vo/Drug.java

@@ -0,0 +1,17 @@
+package com.diagbot.vo;
+
+import com.diagbot.biz.push.entity.Item;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/9/7 20:09
+ */
+@Getter
+@Setter
+public class Drug extends Item {
+    // 剂型
+    private String form;
+}

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

@@ -29,6 +29,12 @@ public class QcResultPageVO extends Page {
      * 病人姓名
      */
     private String patName;
+
+    /**
+     * title名称
+     */
+    private String titleName;
+
     /**
      * 条目名称
      */

+ 7 - 1
src/main/java/com/diagbot/vo/QcResultShortPageVO.java

@@ -32,6 +32,12 @@ public class QcResultShortPageVO extends Page {
      * 条目名称
      */
     private String casesEntryName;
+
+    /**
+     * title名称
+     */
+    private String titleName;
+
     /**
      * 条目id
      */
@@ -126,4 +132,4 @@ public class QcResultShortPageVO extends Page {
      * 改善标志(1:病案首页改善病历,2:病案首页改善至合格病历,3:病案首页改善至满分病历)
      */
     private Integer improveType;
-}
+}

+ 10 - 4
src/main/java/com/diagbot/vo/SearchData.java

@@ -3,6 +3,7 @@ package com.diagbot.vo;
 import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.biz.push.entity.Pacs;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -22,9 +23,14 @@ public class SearchData extends HospitalBaseVO {
      */
     private Integer length = 10;
     /**
-     * 年龄
+     * 年龄文本数据
      */
-    private Integer age;
+    private String age;
+    /**
+     * 年龄数字数据
+     */
+    @ApiModelProperty(hidden = true)
+    private Double ageNum;
     /**
      * 性别(1:男,2:女,3:通用)
      */
@@ -120,7 +126,7 @@ public class SearchData extends HospitalBaseVO {
     /**
      * 药品
      */
-    private List<Item> drug = new ArrayList<>();
+    private List<Drug> drug = new ArrayList<>();
     /**
      * 手术及操作
      */
@@ -144,7 +150,7 @@ public class SearchData extends HospitalBaseVO {
     /**
      * 当前药品开单项
      */
-    private List<Item> drugOrder = new ArrayList<>();
+    private List<Drug> drugOrder = new ArrayList<>();
     /**
      * 当前手术开单项
      */

+ 2 - 1
src/main/java/com/diagbot/web/ConsoleController.java

@@ -447,10 +447,11 @@ public class ConsoleController {
      * @param qcResultPageVO
      * @return
      */
-    @ApiOperation(value = "病案首页不合格数病历详情(内页)[by:cy]",
+    @ApiOperation(value = "病案首页不合格/合格数病历详情(内页)[by:cy]",
             notes = "behospitalCode: 病历号<br>" +
                     "patName: 病人姓名 <br>" +
                     "casesEntryName: 条目名称 <br>" +
+                    "titleName: 标题名称 <br>" +
                     "casesEntryId: 条目id <br>" +
                     "behDeptName:科室名称 <br>" +
                     "doctorId:医生工号 <br>" +

+ 2 - 2
src/main/java/com/diagbot/web/ConsoleExportController.java

@@ -336,12 +336,12 @@ public class ConsoleExportController {
     }
 
     /**
-     * 病案首页不合格数病历详情页导出
+     * 病案首页不合格/合格数病历详情页导出
      *
      * @param qcResultShortPageVO
      * @return
      */
-    @ApiOperation(value = "病案首页不合格数病历详情页导出[by:cy]",
+    @ApiOperation(value = "病案首页不合格/合格数病历详情页导出[by:cy]",
             notes = "behospitalCode: 病历号<br>" +
                     "patName: 病人姓名 <br>" +
                     "behDeptName:科室名称 <br>" +

+ 168 - 63
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -6800,7 +6800,7 @@
         d.NAME
     </select>
 
-    <!-- 不合格数病历号(内页)-->
+    <!-- 不合格/合格数病历号(内页)-->
     <select id="badLevelPage" resultType="com.diagbot.dto.QcResultShortDTO">
         SELECT t.*
         FROM
@@ -6840,6 +6840,10 @@
         FROM
         (SELECT
         be.*,
+        b.LEVEL,
+        b.grade_type,
+        b.score_res,
+        b.gmt_create,
         ifnull(mci.status,0) AS checkStatus,
         ifnull(hm_mci.status,0) AS mrStatus,
         mci.check_name as chName,
@@ -6853,9 +6857,6 @@
         a.behospital_code,
         a.bed_code,
         a.file_code,
-        b.LEVEL,
-        b.grade_type,
-        b.score_res,
         e.score_res as scoreBn,
         a.NAME,
         a.sex,
@@ -6872,23 +6873,25 @@
         a.director_doctor_name,
         a.diagnose,
         a.placefile_date,
-        a.ward_name,
-        b.gmt_create
+        a.ward_name
         FROM
         med_behospital_info a,
-        med_qcresult_info b,
         med_qcresult_cases e
         WHERE
         a.is_deleted = 'N'
-        AND b.is_deleted = 'N'
         AND e.is_deleted = 'N'
-        AND a.hospital_id = b.hospital_id
         AND a.hospital_id = e.hospital_id
-        AND a.behospital_code = b.behospital_code
         AND a.behospital_code = e.behospital_code
         AND a.qc_type_id != 0
-        AND e.`level`='不合格'
-        AND e.cases_id= 243
+        AND e.cases_id = 243
+        <if test="qcResultPageVO.titleName != null ">
+            <if test="qcResultPageVO.titleName == '不合格数'">
+                AND e.`level`='不合格'
+            </if>
+            <if test="qcResultPageVO.titleName == '合格数'">
+                AND e.`level`='合格'
+            </if>
+        </if>
         <if test="qcResultPageVO.isPlacefile != null and qcResultPageVO.isPlacefile != ''">
             and a.is_placefile = #{qcResultPageVO.isPlacefile}
         </if>
@@ -6914,9 +6917,7 @@
         <if test="qcResultPageVO.behDeptName != null and qcResultPageVO.behDeptName != ''">
             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>
@@ -6944,12 +6945,100 @@
         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_info b
+        on  b.is_deleted = 'N'
+        AND be.hospital_id = b.hospital_id
+        AND be.behospital_code = b.behospital_code
+        where
+        1=1
+        <if test="qcResultPageVO.level != null and qcResultPageVO.level != ''">
+            AND b.`level` = #{qcResultPageVO.level}
+        </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'
-        ) t
-        where 1=1
+        ) t,
+        (
+        SELECT
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName
+        FROM
+        med_behospital_info a,
+        med_qcresult_cases c,
+        med_qcresult_detail d,
+        qc_cases_entry e
+        WHERE
+        a.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND e.is_deleted = 'N'
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = d.hospital_id
+        AND a.behospital_code = c.behospital_code
+        AND a.behospital_code = d.behospital_code
+        AND c.cases_id = d.cases_id
+        AND d.cases_id = e.cases_id
+        AND d.cases_entry_id = e.id
+        AND d.cases_id = 243
+        AND a.qc_type_id != 0
+        <if test="qcResultPageVO.titleName != null ">
+            <if test="qcResultPageVO.titleName == '不合格数'">
+                AND c.`level`='不合格'
+            </if>
+            <if test="qcResultPageVO.titleName == '合格数'">
+                AND c.`level`='合格'
+            </if>
+        </if>
+        <if test="qcResultPageVO.isPlacefile != null and qcResultPageVO.isPlacefile != ''">
+            and a.is_placefile = #{qcResultPageVO.isPlacefile}
+        </if>
+        <if test="qcResultPageVO.hospitalId != null and qcResultPageVO.hospitalId != ''">
+            AND a.hospital_id = #{qcResultPageVO.hospitalId}
+        </if>
+        <if test="qcResultPageVO.isPlacefile != null and qcResultPageVO.isPlacefile == 0">
+            <if test="qcResultPageVO.startDate != null ">
+                <![CDATA[ AND a.behospital_date >= #{qcResultPageVO.startDate}]]>
+            </if>
+            <if test="qcResultPageVO.endDate != null ">
+                <![CDATA[ AND a.behospital_date <= #{qcResultPageVO.endDate}]]>
+            </if>
+        </if>
+        <if test="qcResultPageVO.isPlacefile != null and qcResultPageVO.isPlacefile == 1">
+            <if test="qcResultPageVO.startDate != null ">
+                <![CDATA[ AND a.leave_hospital_date >= #{qcResultPageVO.startDate}]]>
+            </if>
+            <if test="qcResultPageVO.endDate != null">
+                <![CDATA[ AND a.leave_hospital_date <= #{qcResultPageVO.endDate}]]>
+            </if>
+        </if>
+        <if test="qcResultPageVO.behDeptName != null and qcResultPageVO.behDeptName != ''">
+            AND a.beh_dept_name = #{qcResultPageVO.behDeptName}
+        </if>
+
+        <if test="qcResultPageVO.behospitalCode != null and qcResultPageVO.behospitalCode != ''">
+            AND a.behospital_code LIKE CONCAT( '%', #{qcResultPageVO.behospitalCode}, '%' )
+        </if>
+        <if test="qcResultPageVO.patName != null and qcResultPageVO.patName != ''">
+            AND a.NAME LIKE CONCAT( '%', #{qcResultPageVO.patName}, '%' )
+        </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}, '%' )
+            OR a.director_doctor_id LIKE CONCAT( '%', #{qcResultPageVO.doctorId}, '%' ))
+        </if>
+        <if test="qcResultPageVO.doctorName != null and qcResultPageVO.doctorName != ''">
+            AND (a.doctor_name LIKE CONCAT( '%', #{qcResultPageVO.doctorName}, '%' )
+            OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultPageVO.doctorName}, '%' )
+            OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultPageVO.doctorName}, '%' ))
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        a.beh_dept_name
+        ) t2
+        where
+        t.behDeptId = t2.deptId
+        AND t.behDeptName = t2.deptName
         <if test="qcResultPageVO.checkStatus != null">
             AND t.checkStatus = #{qcResultPageVO.checkStatus}
         </if>
@@ -7170,7 +7259,7 @@
         </if>
     </select>
 
-    <!-- 病案首页不合格数病历详情页导出-->
+    <!-- 病案首页不合格/合格数病历详情页导出-->
     <select id="badLevelPagePageExport" resultMap="ExportExcelMap">
         SELECT
         f1.behDeptId,
@@ -7249,6 +7338,10 @@
         FROM
         (SELECT
         be.*,
+        b.LEVEL,
+        b.grade_type,
+        b.score_res,
+        b.gmt_create,
         ifnull(mci.status,0) AS checkStatus,
         ifnull(hm_mci.status,0) AS mrStatus,
         mci.check_name as chName,
@@ -7262,10 +7355,8 @@
         a.behospital_code,
         a.bed_code,
         a.file_code,
-        b.LEVEL,
-        b.grade_type,
-        b.score_res,
         c.score_res as scoreBn,
+        c.cases_id,
         a.NAME,
         a.sex,
         a.beh_dept_id,
@@ -7281,25 +7372,25 @@
         a.director_doctor_name,
         a.diagnose,
         a.placefile_date,
-        a.ward_name,
-        b.gmt_create
+        a.ward_name
         FROM
         med_behospital_info a,
-        med_qcresult_info b,
-        med_qcresult_cases c,
-        qc_cases_entry d
+        med_qcresult_cases c
         WHERE
         a.is_deleted = 'N'
-        AND b.is_deleted = 'N'
         AND c.is_deleted = 'N'
-        AND d.is_deleted = 'N'
-        AND a.hospital_id = b.hospital_id
         AND a.hospital_id = c.hospital_id
-        AND a.behospital_code = b.behospital_code
         AND a.behospital_code = c.behospital_code
-        AND c.cases_id = d.cases_id
         AND a.qc_type_id != 0
-        AND c.`level`='不合格'
+        AND c.cases_id = 243
+        <if test="qcResultShortPageVO.titleName != null ">
+            <if test="qcResultShortPageVO.titleName == '不合格数'">
+                AND c.`level`='不合格'
+            </if>
+            <if test="qcResultShortPageVO.titleName == '合格数'">
+                AND c.`level`='合格'
+            </if>
+        </if>
         <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
             and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
         </if>
@@ -7325,9 +7416,6 @@
         <if test="qcResultShortPageVO.behDeptName != null and qcResultShortPageVO.behDeptName != ''">
             AND a.beh_dept_name = #{qcResultShortPageVO.behDeptName}
         </if>
-        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
-            AND b.`level` = #{qcResultShortPageVO.level}
-        </if>
         <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
             AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
         </if>
@@ -7344,18 +7432,6 @@
             OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
             OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
         </if>
-        <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
-            AND d.NAME = #{qcResultShortPageVO.casesEntryName}
-        </if>
-        <if test="qcResultShortPageVO.casesEntryId != null ">
-            AND d.id = #{qcResultShortPageVO.casesEntryId}
-        </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>
         )be
         left join med_check_info mci
         on mci.is_deleted = 'N'
@@ -7367,6 +7443,25 @@
         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_info b
+        on  b.is_deleted = 'N'
+        AND be.hospital_id = b.hospital_id
+        AND be.behospital_code = b.behospital_code
+        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
+            AND b.`level` = #{qcResultPageVO.level}
+        </if>
+        left join qc_cases_entry d
+        on  d.is_deleted = 'N'
+        AND be.cases_id = d.cases_id
+                <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
+                    AND d.NAME = #{qcResultShortPageVO.casesEntryName}
+                </if>
+                <if test="qcResultShortPageVO.casesEntryId != null ">
+                    AND d.id = #{qcResultShortPageVO.casesEntryId}
+                </if>
+                <if test="qcResultShortPageVO.ruleType != null">
+                    AND d.rule_type = #{qcResultShortPageVO.ruleType}
+                </if>
         ) t1
         LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
         AND t1.behospital_code = t2.behospital_code
@@ -7455,6 +7550,10 @@
         FROM
         (SELECT
         be.*,
+        b.grade_type,
+        b.score_res,
+        b.gmt_create,
+        b.LEVEL,
         ifnull(mci.status,0) AS checkStatus,
         ifnull(hm_mci.status,0) AS mrStatus,
         mci.check_name as chName,
@@ -7468,9 +7567,6 @@
         a.behospital_code,
         a.bed_code,
         a.file_code,
-        b.LEVEL,
-        b.grade_type,
-        b.score_res,
         a.NAME,
         a.sex,
         a.beh_dept_id,
@@ -7486,24 +7582,32 @@
         a.director_doctor_name,
         a.diagnose,
         a.placefile_date,
-        a.ward_name,
-        b.gmt_create
+        a.ward_name
         FROM
         med_behospital_info a,
-        med_qcresult_info b,
+        med_qcresult_detail k,
         med_qcresult_cases c,
         qc_cases_entry d
         WHERE
         a.is_deleted = 'N'
-        AND b.is_deleted = 'N'
         AND c.is_deleted = 'N'
         AND d.is_deleted = 'N'
-        AND a.hospital_id = b.hospital_id
         AND a.hospital_id = c.hospital_id
-        AND a.behospital_code = b.behospital_code
         AND a.behospital_code = c.behospital_code
         AND c.cases_id = d.cases_id
-        AND c.`level`='不合格'
+        AND a.hospital_id = k.hospital_id
+        AND a.behospital_code = k.behospital_code
+        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.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
             and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
@@ -7530,9 +7634,6 @@
         <if test="qcResultShortPageVO.behDeptName != null and qcResultShortPageVO.behDeptName != ''">
             AND a.beh_dept_name = #{qcResultShortPageVO.behDeptName}
         </if>
-        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
-            AND b.`level` = #{qcResultShortPageVO.level}
-        </if>
         <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
             AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
         </if>
@@ -7555,9 +7656,6 @@
         <if test="qcResultShortPageVO.casesEntryId != null ">
             AND d.id = #{qcResultShortPageVO.casesEntryId}
         </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>
@@ -7572,6 +7670,13 @@
         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_info b
+        on  b.is_deleted = 'N'
+        AND be.hospital_id = b.hospital_id
+        AND be.behospital_code = b.behospital_code
+        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
+            AND b.`level` = #{qcResultPageVO.level}
+        </if>
         ) t1
         LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
         AND t1.behospital_code = t2.behospital_code