Forráskód Böngészése

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

zhaops 5 éve
szülő
commit
1273b1b567

+ 24 - 10
doc/013.20200706v1.3.7/qc_initv1.3.7.sql

@@ -104,8 +104,8 @@ INSERT INTO `sys_menu` VALUES ('15', 'N', '1970-01-01 12:00:00', '1970-01-01 12:
 INSERT INTO `sys_menu` VALUES ('16', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '异常数据监控', '-1', 'YH-YCSJJK', '1', '0', '10', '用户-异常数据监控');
 INSERT INTO `sys_menu` VALUES ('17', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '数据报表明细', '-1', 'YH-ZKK', '1', '1', '-8', '用户-质控科');
 INSERT INTO `sys_menu` VALUES ('18', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '数据报表明细(科室)', '-1', 'YH-KSZR', '1', '1', '-7', '用户-科室主任');
-INSERT INTO `sys_menu` VALUES ('19', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '各模块缺陷占比', '17', 'YH-ZKK-GMKQXZB_XQ', '1', '1', '2', '用户-质控科-各模块缺陷占比_详情');
-INSERT INTO `sys_menu` VALUES ('20', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '条目缺陷占比', '17', 'YH-ZKK-TMQXZB_XQ', '1', '1', '3', '用户-质控科-条目缺陷占比_详情');
+INSERT INTO `sys_menu` VALUES ('19', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '各模块缺陷占比', '17', 'YH-ZKK-GMKQXZB_XQ', '1', '1', '1', '用户-质控科-各模块缺陷占比_详情');
+INSERT INTO `sys_menu` VALUES ('20', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '条目缺陷占比', '17', 'YH-ZKK-TMQXZB_XQ', '1', '1', '2', '用户-质控科-条目缺陷占比_详情');
 INSERT INTO `sys_menu` VALUES ('21', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '科室平均住院天数', '17', 'YH-ZKK-KSPJZYTS_XQ', '1', '1', '4', '用户-质控科-科室平均住院天数_详情');
 INSERT INTO `sys_menu` VALUES ('22', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '科室平均住院花费', '17', 'YH-ZKK-KSPJZYHF_XQ', '1', '1', '5', '用户-质控科-科室平均住院花费_详情');
 INSERT INTO `sys_menu` VALUES ('23', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '各科室质控平均分', '17', 'YH-ZKK-GKSZKPJF_XQ', '1', '1', '6', '用户-质控科-各科室质控平均分_详情');
@@ -113,16 +113,21 @@ INSERT INTO `sys_menu` VALUES ('24', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:
 INSERT INTO `sys_menu` VALUES ('25', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '各科室甲级病历占比', '17', 'YH-ZKK-GKSJJBLZB_XQ', '1', '1', '8', '用户-质控科-各科室甲级病历占比_详情');
 INSERT INTO `sys_menu` VALUES ('26', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '各模块缺陷占比', '18', 'YH-KSZR-GMKQXZB_XQ', '1', '1', '2', '用户-科室主任-各模块缺陷占比_详情');
 INSERT INTO `sys_menu` VALUES ('27', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '条目缺陷占比', '18', 'YH-KSZR-TMQXZB_XQ', '1', '1', '3', '用户-科室主任-条目缺陷占比_详情');
-INSERT INTO `sys_menu` VALUES ('28', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '病案首页合格率占比', '17', 'YH-ZKK-BASYHGLZB_XQ', '1', '1', '1', '用户-质控科-病案首页合格率占比_详情');
+INSERT INTO `sys_menu` VALUES ('28', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '病案首页合格率占比', '17', 'YH-ZKK-BASYHGLZB_XQ', '1', '1', '0', '用户-质控科-病案首页合格率占比_详情');
 INSERT INTO `sys_menu` VALUES ('29', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '病案首页合格率占比', '18', 'YH-KSZR-BASYHGLZB_XQ', '1', '1', '1', '用户-科室主任-病案首页合格率占比_详情');
 INSERT INTO `sys_menu` VALUES ('30', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '科室缺陷占比', '18', 'YH-KSZR-KSQXZB_XQ', '1', '1', '4', '用户-科室主任-科室缺陷占比_详情');
 INSERT INTO `sys_menu` VALUES ('31', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '各科室缺陷占比', '17', 'YH-ZKK-GKSQXZB_XQ', '1', '1', '9', '用户-质控科-各科室缺陷占比_详情');
 INSERT INTO `sys_menu` VALUES ('32', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '质控类型维护', '2', 'YH-JCSJWH-ZKLXWH', '1', '0', '3', '用户-基础数据维护-质控类型维护');
 INSERT INTO `sys_menu` VALUES ('33', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '质控评分(医疗组)', '3', 'YH-BLZK-ZKPFYLZ', '1', '1', '4', '用户-病历质控-质控评分(医疗组)');
-INSERT INTO `sys_menu` VALUES ('34', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '关键条目缺陷占比', '17', 'YH-ZKK-GJTMQXZB', '1', '1', '10', '用户-质控科-关键条目缺陷占比');
+INSERT INTO `sys_menu` VALUES ('34', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '关键条目缺陷占比', '17', 'YH-ZKK-GJTMQXZB', '1', '1', '3', '用户-质控科-关键条目缺陷占比');
 INSERT INTO `sys_menu` VALUES ('35', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '出院人数统计', '17', 'YH-ZKK-CYRSTJ', '1', '1', '11', '用户-质控科-出院人数统计');
 INSERT INTO `sys_menu` VALUES ('36', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '质控核查统计', '17', 'YH-ZKK-ZKHCTJ', '1', '1', '12', '用户-质控科-质控核查统计');
 
+
+-- ----------------------------
+-- Table structure for sys_menu_permission
+-- ----------------------------
+
 -- ----------------------------
 -- Table structure for sys_menu_permission
 -- ----------------------------
@@ -216,9 +221,9 @@ INSERT INTO `sys_menu_permission` VALUES ('70', 'N', '1970-01-01 12:00:00', '197
 INSERT INTO `sys_menu_permission` VALUES ('71', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '33', '99', '用户-医疗组-修改质控条目');
 INSERT INTO `sys_menu_permission` VALUES ('72', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '34', '100', '数据报表明细-关键条目缺陷占比');
 INSERT INTO `sys_menu_permission` VALUES ('73', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '7', '101', '用户-质控评分-核查数据接口');
-INSERT INTO `sys_menu_permission` VALUES ('74', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '9', '101', '用户-质控评分(科室)-核查数据接口');
-INSERT INTO `sys_menu_permission` VALUES ('75', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '10', '101', '用户-质控评分(个人)-核查数据接口');
-INSERT INTO `sys_menu_permission` VALUES ('76', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '33', '101', '用户-医疗组-核查数据接口');
+INSERT INTO `sys_menu_permission` VALUES ('74', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '9', '105', '用户-质控评分(科室)-核查数据接口');
+INSERT INTO `sys_menu_permission` VALUES ('75', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '10', '104', '用户-质控评分(个人)-核查数据接口');
+INSERT INTO `sys_menu_permission` VALUES ('76', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '33', '106', '用户-医疗组-核查数据接口');
 INSERT INTO `sys_menu_permission` VALUES ('77', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '35', '102', '数据报表明细-出院人数统计');
 INSERT INTO `sys_menu_permission` VALUES ('78', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '36', '103', '数据报表明细-质控核查统计');
 
@@ -240,7 +245,7 @@ CREATE TABLE `sys_permission` (
   `descritpion` varchar(255) NOT NULL DEFAULT '' COMMENT '资源描述',
   `remark` varchar(255) DEFAULT NULL COMMENT '备注',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8 COMMENT='系统资源表';
+) ENGINE=InnoDB AUTO_INCREMENT=107 DEFAULT CHARSET=utf8 COMMENT='系统资源表';
 
 -- ----------------------------
 -- Records of sys_permission
@@ -348,7 +353,9 @@ INSERT INTO `sys_permission` VALUES ('100', 'N', '1970-01-01 12:00:00', '1970-01
 INSERT INTO `sys_permission` VALUES ('101', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '核查数据接口', 'FUNC000014', '/qc/medCheckInfo/addMedCheckInfo', 'ALL', '用户-核查数据接口', null);
 INSERT INTO `sys_permission` VALUES ('102', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '出院人数统计', 'FUNC000102', '/console/leaveHosMRPage', 'ALL', '数据报表明细-出院人数统计', null);
 INSERT INTO `sys_permission` VALUES ('103', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '质控核查统计', 'FUNC000103', '/console/qcCheckStatistics', 'ALL', '数据表白明细-质控核查统计', null);
-
+INSERT INTO `sys_permission` VALUES ('104', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '核查数据接口(个人)', 'FUNC000014', '/qc/medCheckInfo/addMedCheckInfo', 'ALL', '用户-核查数据接口', null);
+INSERT INTO `sys_permission` VALUES ('105', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '核查数据接口(科室)', 'FUNC000014', '/qc/medCheckInfo/addMedCheckInfo', 'ALL', '用户-核查数据接口', null);
+INSERT INTO `sys_permission` VALUES ('106', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '核查数据接口(医疗组)', 'FUNC000014', '/qc/medCheckInfo/addMedCheckInfo', 'ALL', '用户-核查数据接口', null);
 -- ----------------------------
 
 INSERT INTO `sys_role_menu`( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`)  VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '35', '用户-质控科-出院人数统计');
@@ -360,4 +367,11 @@ INSERT INTO `sys_role_menu`( `is_deleted`, `gmt_create`, `gmt_modified`, `creato
 INSERT INTO `sys_role_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`)  VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '101', null);
 INSERT INTO `sys_role_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', '101', null);
 INSERT INTO `sys_role_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`)  VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '102', '数据报表明细-出院人数统计');
-INSERT INTO `sys_role_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '103', '数据报表明细-质控核查统计');
+INSERT INTO `sys_role_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '103', '数据报表明细-质控核查统计');
+
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '104', NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', '104', NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '105', NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', '105', NULL);
+INSERT INTO `sys_role_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '106', NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', '106', NULL);

+ 9 - 9
src/main/java/com/diagbot/dto/HomePageImproveDTO.java

@@ -19,17 +19,17 @@ public class HomePageImproveDTO {
     /**
      * 科室
      */
-    @Excel(name = "科室", width = 70, orderNum = "1")
+    @Excel(name = "科室名称", width = 30, orderNum = "1")
     private String deptName;
     /**
      * 质控总数(总病历数)
      */
-    @Excel(name = "质控总数", width = 30, orderNum = "2")
+    @Excel(name = "质控总数", width = 10, orderNum = "2")
     private Integer mrNum = 0;
     /**
      * 核查数量
      */
-    @Excel(name = "核查数量", width = 30, orderNum = "3")
+    @Excel(name = "核查数量", width = 10, orderNum = "3")
     private Integer checkedNum = 0;
     /**
      * 核查占比
@@ -46,7 +46,7 @@ public class HomePageImproveDTO {
     /**
      * 已改善数量
      */
-    @Excel(name = "已改善数量", width = 30, orderNum = "4")
+    @Excel(name = "已改善数量", width = 10, orderNum = "4")
     private Integer improveNum = 0;
     /**
      * 改善率
@@ -55,12 +55,12 @@ public class HomePageImproveDTO {
     /**
      * 改善率(百分比)
      */
-    @Excel(name = "改善率", width = 30, orderNum = "5")
+    @Excel(name = "改善率", width = 10, orderNum = "5")
     private String improvePercentStr = "0.00%";
     /**
      * 改善至合格数量
      */
-    @Excel(name = "改善至合格数量", width = 30, orderNum = "6")
+    @Excel(name = "改善至合格数量", width = 15, orderNum = "6")
     private Integer improveToPassNum = 0;
     /**
      * 改善至合格率
@@ -69,12 +69,12 @@ public class HomePageImproveDTO {
     /**
      * 改善至合格率(百分比)
      */
-    @Excel(name = "改善至合格率", width = 30, orderNum = "7")
+    @Excel(name = "改善至合格率", width = 15, orderNum = "7")
     private String improveToPassPercentStr = "0.00%";
     /**
      * 改善至满分数量
      */
-    @Excel(name = "改善至满分数量", width = 30, orderNum = "8")
+    @Excel(name = "改善至满分数量", width = 15, orderNum = "8")
     private Integer improveToFullNum = 0;
     /**
      * 改善至满分率
@@ -83,6 +83,6 @@ public class HomePageImproveDTO {
     /**
      * 改善至满分率(百分比)
      */
-    @Excel(name = "改善至满分率", width = 30, orderNum = "9")
+    @Excel(name = "改善至满分率", width = 15, orderNum = "9")
     private String improveToFullPercentStr = "0.00%";
 }

+ 36 - 6
src/main/java/com/diagbot/facade/ConsoleExportFacade.java

@@ -8,15 +8,18 @@ import com.diagbot.dto.AverageStatisticsMonthDTO;
 import com.diagbot.dto.EntryNumDTO;
 import com.diagbot.dto.EntryNumGroupDTO;
 import com.diagbot.dto.EntryStatisticsDTO;
+import com.diagbot.dto.ExportExcelDTO;
 import com.diagbot.dto.HomePageImproveDTO;
 import com.diagbot.dto.HomePageNumDTO;
 import com.diagbot.dto.LevelStatisticsDTO;
 import com.diagbot.dto.LevelStatisticsTZDTO;
 import com.diagbot.dto.NumDTO;
 import com.diagbot.dto.QcResultPercentDTO;
-import com.diagbot.dto.QcResultShortDTO;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.ExcelUtils;
+import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.EntryStatisticsVO;
 import com.diagbot.vo.FilterOrderVO;
 import com.diagbot.vo.FilterPageByAverageVO;
@@ -26,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import javax.servlet.http.HttpServletResponse;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -39,7 +43,7 @@ public class ConsoleExportFacade {
     @Autowired
     private ConsoleFacade consoleFacade;
     @Autowired
-    private QcCasesFacade qcCasesFacade;
+    private BehospitalInfoFacade behospitalInfoFacade;
 
     /**
      * 病案首页合格率占比
@@ -202,12 +206,25 @@ public class ConsoleExportFacade {
      * @return
      */
     public void qcResultShortPageExport(HttpServletResponse response, QcResultShortPageVO qcResultShortPageVO) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        qcResultShortPageVO.setHospitalId(hospitalId);
+        Date startDate = qcResultShortPageVO.getStartDate();
+        Date endDate = qcResultShortPageVO.getEndDate();
+        //时间间隔7天
+        long interval = 7 * 24 * 60 * 60 * 1000;
+        if (endDate.getTime() < startDate.getTime()) {
+            throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+        }
+        if (endDate.getTime() - startDate.getTime() > interval) {
+            throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
+        }
+
         qcResultShortPageVO.setCurrent(1L);
         qcResultShortPageVO.setSize(Long.MAX_VALUE);
         qcResultShortPageVO.setSearchCount(false);
-        IPage<QcResultShortDTO> page = consoleFacade.qcResultShortPage(qcResultShortPageVO);
+        List<ExportExcelDTO> record = behospitalInfoFacade.qcResultShortPageExport(qcResultShortPageVO);
         String fileName = "缺陷详情质控评分页.xls";
-        ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", QcResultShortDTO.class, fileName, response, 12.8f);
+        ExcelUtils.exportExcel(record, null, "sheet1", ExportExcelDTO.class, fileName, response, 12.8f);
     }
 
     /**
@@ -217,12 +234,25 @@ public class ConsoleExportFacade {
      * @return
      */
     public void leaveHosMrPageExport(HttpServletResponse response, QcResultShortPageVO qcResultShortPageVO) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        qcResultShortPageVO.setHospitalId(hospitalId);
+        Date startDate = qcResultShortPageVO.getStartDate();
+        Date endDate = qcResultShortPageVO.getEndDate();
+        //时间间隔7天
+        long interval = 7 * 24 * 60 * 60 * 1000;
+        if (endDate.getTime() < startDate.getTime()) {
+            throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+        }
+        if (endDate.getTime() - startDate.getTime() > interval) {
+            throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
+        }
+
         qcResultShortPageVO.setCurrent(1L);
         qcResultShortPageVO.setSize(Long.MAX_VALUE);
         qcResultShortPageVO.setSearchCount(false);
-        IPage<QcResultShortDTO> page = consoleFacade.leaveHosMRPage(qcResultShortPageVO);
+        List<ExportExcelDTO> records = behospitalInfoFacade.leaveHosMRPageExport(qcResultShortPageVO);
         String fileName = "出院人数统计.xls";
-        ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", QcResultShortDTO.class, fileName, response, 12.8f);
+        ExcelUtils.exportExcelUser(records, null, "sheet1", ExportExcelDTO.class, fileName, response);
     }
 
     /**

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

@@ -937,7 +937,7 @@ public class ConsoleFacade {
                 .divide(BigDecimal.valueOf(homePageMRNum), 4, RoundingMode.HALF_UP)
                 .doubleValue();
         String improveToPassPercentStr
-                = df.format(BigDecimal.valueOf(improvePercent).multiply(BigDecimal.valueOf(100))) + "%";
+                = df.format(BigDecimal.valueOf(improveToPassPercent).multiply(BigDecimal.valueOf(100))) + "%";
         //改善至满分病历数
         Integer improveToFullNum = records
                 .stream()

+ 16 - 0
src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java

@@ -311,4 +311,20 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      * @return
      */
     public List<HomePageImproveDTO> qcCheckStatistics(FilterOrderVO filterOrderVO);
+
+    /**
+     * 离院病人质控评分详情页导出到excel
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public List<ExportExcelDTO> leaveHosMRPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
+
+    /**
+     * 条目缺陷质控评分详情页导出到excel
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public List<ExportExcelDTO> qcResultShortPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
 }

+ 16 - 0
src/main/java/com/diagbot/service/BehospitalInfoService.java

@@ -304,4 +304,20 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      * @return
      */
     public List<HomePageImproveDTO> qcCheckStatistics(FilterOrderVO filterOrderVO);
+
+    /**
+     * 离院病人质控评分详情页导出到excel
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public List<ExportExcelDTO> leaveHosMRPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
+
+    /**
+     * 条目缺陷质控评分详情页导出到excel
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public List<ExportExcelDTO> qcResultShortPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
 }

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

@@ -414,4 +414,26 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
     public List<HomePageImproveDTO> qcCheckStatistics(FilterOrderVO filterOrderVO) {
         return baseMapper.qcCheckStatistics(filterOrderVO);
     }
+
+    /**
+     * 离院病人质控评分详情页导出到excel
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    @Override
+    public List<ExportExcelDTO> leaveHosMRPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
+        return baseMapper.leaveHosMRPageExport(qcResultShortPageVO);
+    }
+
+    /**
+     * 条目缺陷质控评分详情页导出到excel
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    @Override
+    public List<ExportExcelDTO> qcResultShortPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
+        return baseMapper.qcResultShortPageExport(qcResultShortPageVO);
+    }
 }

+ 787 - 9
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -3794,7 +3794,7 @@
         t1.ward_name AS wardName,
         ifnull(t1.status,0) AS checkStatus,
         t2.age,
-        t2.file_code AS fileCode
+        t1.file_code AS fileCode
         FROM
         (
         SELECT be.*,mci.status
@@ -3806,7 +3806,7 @@
         (
         SELECT
         b.*,
-        c.LEVEL,
+        ifnull(c.LEVEL,'未评分') as LEVEL ,
         c.grade_type,
         c.score_res,
         c.gmt_create
@@ -3831,7 +3831,8 @@
         a.director_doctor_name,
         a.diagnose,
         a.placefile_date,
-        a.ward_name
+        a.ward_name,
+        a.file_code
         FROM
         med_behospital_info a
         WHERE
@@ -3870,9 +3871,6 @@
         LEFT JOIN med_qcresult_info c ON c.is_deleted = 'N'
         AND b.hospital_id = c.hospital_id
         AND b.behospital_code = c.behospital_code
-        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
-            AND c.`level` = #{qcResultShortPageVO.level}
-        </if>
         ) tt1
         <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==3">
             ,med_medical_record tt2,
@@ -3887,8 +3885,7 @@
         </if>
         ) be
         left join med_check_info mci
-        on
-        mci.is_deleted = 'N'
+        on mci.is_deleted = 'N'
         AND be.hospital_id = mci.hospital_id
         AND be.behospital_code = mci.behospital_code
         )t1
@@ -3929,6 +3926,9 @@
         <if test="qcResultShortPageVO.checkStatus != null">
             and t.checkStatus = #{qcResultShortPageVO.checkStatus}
         </if>
+        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
+            AND t.`level` = #{qcResultShortPageVO.level}
+        </if>
     </select>
 
     <!-- 病案首页改善率统计(首页)-->
@@ -3974,6 +3974,7 @@
         AND m1.behospital_code = m2.behospital_code
         AND m1.behospital_code = m3.behospital_code
         AND m1.behospital_code = m4.behospital_code
+        AND m3.gmt_create = m4.gmt_create
         AND m3.have_home_page = 1
         AND m4.cases_id = 243
         AND m1.is_placefile = '1'
@@ -4157,7 +4158,6 @@
         AND a.behospital_code = c.behospital_code
         AND a.qc_type_id != 0
         AND a.is_placefile = '1'
-        AND c.have_home_page = '1'
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
@@ -4206,8 +4206,11 @@
         AND m1.behospital_code = m2.behospital_code
         AND m1.behospital_code = m3.behospital_code
         AND m1.behospital_code = m4.behospital_code
+        AND m3.gmt_create = m4.gmt_create
         AND m3.have_home_page = 1
         AND m4.cases_id = 243
+        AND m1.is_placefile = '1'
+        AND m1.qc_type_id != 0
         <if test="hospitalId != null and hospitalId != ''">
             AND m1.hospital_id = #{hospitalId}
         </if>
@@ -4304,4 +4307,779 @@
             </choose>
         </if>
     </select>
+
+    <!-- 离院病人评分详情页导出-->
+    <select id="leaveHosMRPageExport" resultMap="ExportExcelMap">
+        SELECT
+        f1.behDeptId,
+        f1.behDeptName,
+        f1.behDoctorName,
+        f1.patName,
+        f1.behospitalCode,
+        f1.hospitalId,
+        f1.behospitalDate,
+        f1.leaveHospitalDate,
+        f1.score,
+        f2.avgScore,
+        f1.msg,
+        f1.caseName,
+        f1.checkStatus
+        FROM
+        (SELECT
+        CONCAT(
+        ( CASE WHEN t.directorDoctorName IS NOT NULL AND t.directorDoctorName != '' THEN concat( t.directorDoctorName,
+        '\n' ) ELSE '' END ),
+        t.doctorName
+        ) AS behDoctorName,
+        t.`name` AS patName,
+        t.behospitalCode AS behospitalCode,
+        t.behospitalDate AS behospitalDate,
+        t.leaveHospitalDate AS leaveHospitalDate,
+        qi.score_res AS score,
+        qd.msg AS msg,
+        qc.NAME AS caseName,
+        t.behDeptId,
+        t.behDeptName,
+        t.hospitalId,
+        t.checkStatus
+        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.NAME AS NAME,
+        t1.sex AS sex,
+        t1.beh_dept_id AS behDeptId,
+        t1.beh_dept_name AS behDeptName,
+        t1.doctor_id AS doctorId,
+        t1.doctor_name AS doctorName,
+        t1.beh_doctor_id AS behDoctorId,
+        t1.beh_doctor_name AS behDoctorName,
+        t1.director_doctor_id AS directorDoctorId,
+        t1.director_doctor_name AS directorDoctorName,
+        t1.birthday AS birthday,
+        t1.behospital_date AS behospitalDate,
+        t1.leave_hospital_date AS leaveHospitalDate,
+        t1.placefile_date AS placefileDate,
+        t1.gmt_create AS gradeTime,
+        t1.diagnose,
+        t1.ward_name AS wardName,
+        ifnull(t1.status,0) AS checkStatus,
+        t2.age,
+        t1.file_code AS fileCode
+        FROM
+        (
+        SELECT be.*,mci.status
+        FROM
+        (
+        SELECT DISTINCT
+        tt1.*
+        FROM
+        (
+        SELECT
+        b.*,
+        ifnull(c.LEVEL,'未评分') as LEVEL ,
+        c.grade_type,
+        c.score_res,
+        c.gmt_create
+        FROM
+        (
+        SELECT DISTINCT
+        a.hospital_id,
+        a.behospital_code,
+        a.bed_code,
+        a.NAME,
+        a.sex,
+        a.beh_dept_id,
+        a.beh_dept_name,
+        a.birthday,
+        a.behospital_date,
+        a.leave_hospital_date,
+        a.doctor_id,
+        a.doctor_name,
+        a.beh_doctor_id,
+        a.beh_doctor_name,
+        a.director_doctor_id,
+        a.director_doctor_name,
+        a.diagnose,
+        a.placefile_date,
+        a.ward_name,
+        a.file_code
+        FROM
+        med_behospital_info a
+        WHERE
+        a.is_deleted = 'N'
+        AND a.qc_type_id != 0
+        AND a.is_placefile = 1
+        <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 >= #{qcResultShortPageVO.startDate}]]>
+        </if>
+        <if test="qcResultShortPageVO.endDate != null ">
+            <![CDATA[ AND a.leave_hospital_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>
+        ) b
+        LEFT JOIN med_qcresult_info c ON c.is_deleted = 'N'
+        AND b.hospital_id = c.hospital_id
+        AND b.behospital_code = c.behospital_code
+        ) tt1
+        <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==3">
+            ,med_medical_record tt2,
+            qc_mode tt3
+            WHERE
+            tt2.is_deleted = 'N'
+            AND tt3.is_deleted = 'N'
+            AND tt1.hospital_id = tt2.hospital_id
+            AND tt1.behospital_code = tt2.behospital_code
+            AND tt2.mode_id = tt3.id
+            AND tt3.`name` = '手术记录'
+        </if>
+        ) 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
+        )t1
+        <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==2">
+            ,med_home_page t2
+            WHERE
+            t2.is_deleted = 'N'
+            AND t1.hospital_id = t2.hospital_id
+            AND t1.behospital_code = t2.behospital_code
+            AND (
+            ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' )
+            OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' )
+            )
+        </if>
+        <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==1">
+            ,med_home_page t2
+            WHERE
+            t2.is_deleted = 'N'
+            AND t1.hospital_id = t2.hospital_id
+            AND t1.behospital_code = t2.behospital_code
+            AND t2.return_to_type = '死亡'
+        </if>
+        <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==4">
+            ,med_home_page t2
+            WHERE
+            t2.is_deleted = 'N'
+            AND t1.hospital_id = t2.hospital_id
+            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">
+            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
+        </if>
+        )t
+        LEFT JOIN med_qcresult_info qi ON qi.is_deleted = 'N'
+        AND t.hospitalId = qi.hospital_id
+        AND t.behospitalCode = qi.behospital_code
+        LEFT JOIN med_qcresult_detail qd ON qd.is_deleted = 'N'
+        AND t.hospitalId = qd.hospital_id
+        AND t.behospitalCode = qd.behospital_code
+        LEFT JOIN qc_cases qc ON qc.is_deleted = 'N'
+        AND qd.cases_id = qc.id
+        where 1=1
+        <if test="qcResultShortPageVO.checkStatus != null">
+            and t.checkStatus = #{qcResultShortPageVO.checkStatus}
+        </if>
+        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
+            AND t.`level` = #{qcResultShortPageVO.level}
+        </if>)f1,(SELECT
+        ROUND( AVG( qi.score_res ), 2 ) AS avgScore,
+        t.behDeptId,
+        t.behDeptName
+        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.NAME AS NAME,
+        t1.sex AS sex,
+        t1.beh_dept_id AS behDeptId,
+        t1.beh_dept_name AS behDeptName,
+        t1.doctor_id AS doctorId,
+        t1.doctor_name AS doctorName,
+        t1.beh_doctor_id AS behDoctorId,
+        t1.beh_doctor_name AS behDoctorName,
+        t1.director_doctor_id AS directorDoctorId,
+        t1.director_doctor_name AS directorDoctorName,
+        t1.birthday AS birthday,
+        t1.behospital_date AS behospitalDate,
+        t1.leave_hospital_date AS leaveHospitalDate,
+        t1.placefile_date AS placefileDate,
+        t1.gmt_create AS gradeTime,
+        t1.diagnose,
+        t1.ward_name AS wardName,
+        ifnull(t1.status,0) AS checkStatus,
+        t2.age,
+        t1.file_code AS fileCode
+        FROM
+        (
+        SELECT be.*,mci.status
+        FROM
+        (
+        SELECT DISTINCT
+        tt1.*
+        FROM
+        (
+        SELECT
+        b.*,
+        ifnull(c.LEVEL,'未评分') as LEVEL ,
+        c.grade_type,
+        c.score_res,
+        c.gmt_create
+        FROM
+        (
+        SELECT DISTINCT
+        a.hospital_id,
+        a.behospital_code,
+        a.bed_code,
+        a.NAME,
+        a.sex,
+        a.beh_dept_id,
+        a.beh_dept_name,
+        a.birthday,
+        a.behospital_date,
+        a.leave_hospital_date,
+        a.doctor_id,
+        a.doctor_name,
+        a.beh_doctor_id,
+        a.beh_doctor_name,
+        a.director_doctor_id,
+        a.director_doctor_name,
+        a.diagnose,
+        a.placefile_date,
+        a.ward_name,
+        a.file_code
+        FROM
+        med_behospital_info a
+        WHERE
+        a.is_deleted = 'N'
+        AND a.qc_type_id != 0
+        AND a.is_placefile = 1
+        <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 >= #{qcResultShortPageVO.startDate}]]>
+        </if>
+        <if test="qcResultShortPageVO.endDate != null ">
+            <![CDATA[ AND a.leave_hospital_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>
+        ) b
+        LEFT JOIN med_qcresult_info c ON c.is_deleted = 'N'
+        AND b.hospital_id = c.hospital_id
+        AND b.behospital_code = c.behospital_code
+        ) tt1
+        <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==3">
+            ,med_medical_record tt2,
+            qc_mode tt3
+            WHERE
+            tt2.is_deleted = 'N'
+            AND tt3.is_deleted = 'N'
+            AND tt1.hospital_id = tt2.hospital_id
+            AND tt1.behospital_code = tt2.behospital_code
+            AND tt2.mode_id = tt3.id
+            AND tt3.`name` = '手术记录'
+        </if>
+        ) 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
+        )t1
+        <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==2">
+            ,med_home_page t2
+            WHERE
+            t2.is_deleted = 'N'
+            AND t1.hospital_id = t2.hospital_id
+            AND t1.behospital_code = t2.behospital_code
+            AND (
+            ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' )
+            OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' )
+            )
+        </if>
+        <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==1">
+            ,med_home_page t2
+            WHERE
+            t2.is_deleted = 'N'
+            AND t1.hospital_id = t2.hospital_id
+            AND t1.behospital_code = t2.behospital_code
+            AND t2.return_to_type = '死亡'
+        </if>
+        <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==4">
+            ,med_home_page t2
+            WHERE
+            t2.is_deleted = 'N'
+            AND t1.hospital_id = t2.hospital_id
+            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">
+            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
+        </if>
+        )t
+        LEFT JOIN med_qcresult_info qi ON qi.is_deleted = 'N'
+        AND t.hospitalId = qi.hospital_id
+        AND t.behospitalCode = qi.behospital_code
+        where 1=1
+        <if test="qcResultShortPageVO.checkStatus != null">
+            and t.checkStatus = #{qcResultShortPageVO.checkStatus}
+        </if>
+        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
+            AND t.`level` = #{qcResultShortPageVO.level}
+        </if>
+        GROUP BY
+        t.behDeptId,
+        t.behDeptName
+        )f2
+        WHERE
+        f1.behDeptId = f2.behDeptId
+        AND f1.behDeptName = f2.behDeptName
+    </select>
+
+    <!-- 条目缺陷评分详情页导出-->
+    <select id="qcResultShortPageExport" resultMap="ExportExcelMap">
+        SELECT
+        f1.behDeptId,
+        f1.behDeptName,
+        f1.behDoctorName,
+        f1.patName,
+        f1.behospitalCode,
+        f1.hospitalId,
+        f1.behospitalDate,
+        f1.leaveHospitalDate,
+        f1.score,
+        f2.avgScore,
+        f1.msg,
+        f1.caseName,
+        f1.checkStatus
+        FROM
+        (SELECT
+        CONCAT( ifnull( t.directorDoctorName, '' ), '\n', t.doctorName ) AS behDoctorName,
+        t.`name` AS patName,
+        t.behospitalCode AS behospitalCode,
+        t.behospitalDate AS behospitalDate,
+        t.leaveHospitalDate AS leaveHospitalDate,
+        qi.score_res AS score,
+        qd.msg AS msg,
+        qc.NAME AS caseName,
+        t.behDeptId,
+        t.behDeptName,
+        t.hospitalId,
+        t.checkStatus
+        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.NAME AS NAME,
+        t1.sex AS sex,
+        t1.beh_dept_id AS behDeptId,
+        t1.beh_dept_name AS behDeptName,
+        t1.doctor_id AS doctorId,
+        t1.doctor_name AS doctorName,
+        t1.beh_doctor_id AS behDoctorId,
+        t1.beh_doctor_name AS behDoctorName,
+        t1.director_doctor_id AS directorDoctorId,
+        t1.director_doctor_name AS directorDoctorName,
+        t1.birthday AS birthday,
+        t1.behospital_date AS behospitalDate,
+        t1.leave_hospital_date AS leaveHospitalDate,
+        t1.placefile_date AS placefileDate,
+        t1.gmt_create AS gradeTime,
+        t1.diagnose,
+        t1.ward_name AS wardName,
+        t2.age,
+        t1.file_code AS fileCode,
+        t1.checkStatus
+        FROM
+        (
+        SELECT DISTINCT
+        tt1.*
+        FROM
+        (SELECT
+        be.*,
+        ifnull(mci.status,0) AS checkStatus
+        FROM
+        (
+        SELECT DISTINCT
+        a.hospital_id,
+        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,
+        a.beh_dept_name,
+        a.birthday,
+        a.behospital_date,
+        a.leave_hospital_date,
+        a.doctor_id,
+        a.doctor_name,
+        a.beh_doctor_id,
+        a.beh_doctor_name,
+        a.director_doctor_id,
+        a.director_doctor_name,
+        a.diagnose,
+        a.placefile_date,
+        a.ward_name,
+        b.gmt_create
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail 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.cases_entry_id = d.id
+        AND a.qc_type_id != 0
+        AND a.is_placefile = 1
+        <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 >= #{qcResultShortPageVO.startDate}]]>
+        </if>
+        <if test="qcResultShortPageVO.endDate != null ">
+            <![CDATA[ AND a.leave_hospital_date <= #{qcResultShortPageVO.endDate}]]>
+        </if>
+        <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>
+        <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
+            AND a.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
+        </if>
+        <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
+            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}, '%' ))
+        </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.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>
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2495">
+            AND TIMESTAMPDIFF(
+            DAY,
+            DATE( a.behospital_date ),
+            DATE( a.leave_hospital_date ))> 30
+        </if>
+        )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
+            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
+        <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
+        LEFT JOIN med_qcresult_info qi ON qi.is_deleted = 'N'
+        AND t.hospitalId = qi.hospital_id
+        AND t.behospitalCode = qi.behospital_code
+        LEFT JOIN med_qcresult_detail qd ON qd.is_deleted = 'N'
+        AND t.hospitalId = qd.hospital_id
+        AND t.behospitalCode = qd.behospital_code
+        LEFT JOIN qc_cases qc ON qc.is_deleted = 'N'
+        AND qd.cases_id = qc.id
+        where 1=1
+        <if test="qcResultShortPageVO.checkStatus != null">
+            AND t.checkStatus = #{qcResultShortPageVO.checkStatus}
+        </if>
+        )f1,
+        (SELECT
+        ROUND( AVG( qi.score_res ), 2 ) AS avgScore,
+        t.behDeptId,
+        t.behDeptName
+        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.NAME AS NAME,
+        t1.sex AS sex,
+        t1.beh_dept_id AS behDeptId,
+        t1.beh_dept_name AS behDeptName,
+        t1.doctor_id AS doctorId,
+        t1.doctor_name AS doctorName,
+        t1.beh_doctor_id AS behDoctorId,
+        t1.beh_doctor_name AS behDoctorName,
+        t1.director_doctor_id AS directorDoctorId,
+        t1.director_doctor_name AS directorDoctorName,
+        t1.birthday AS birthday,
+        t1.behospital_date AS behospitalDate,
+        t1.leave_hospital_date AS leaveHospitalDate,
+        t1.placefile_date AS placefileDate,
+        t1.gmt_create AS gradeTime,
+        t1.diagnose,
+        t1.ward_name AS wardName,
+        t2.age,
+        t1.file_code AS fileCode,
+        t1.checkStatus
+        FROM
+        (
+        SELECT DISTINCT
+        tt1.*
+        FROM
+        (SELECT
+        be.*,
+        ifnull(mci.status,0) AS checkStatus
+        FROM
+        (
+        SELECT DISTINCT
+        a.hospital_id,
+        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,
+        a.beh_dept_name,
+        a.birthday,
+        a.behospital_date,
+        a.leave_hospital_date,
+        a.doctor_id,
+        a.doctor_name,
+        a.beh_doctor_id,
+        a.beh_doctor_name,
+        a.director_doctor_id,
+        a.director_doctor_name,
+        a.diagnose,
+        a.placefile_date,
+        a.ward_name,
+        b.gmt_create
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail 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.cases_entry_id = d.id
+        AND a.qc_type_id != 0
+        AND a.is_placefile = 1
+        <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 >= #{qcResultShortPageVO.startDate}]]>
+        </if>
+        <if test="qcResultShortPageVO.endDate != null ">
+            <![CDATA[ AND a.leave_hospital_date <= #{qcResultShortPageVO.endDate}]]>
+        </if>
+        <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>
+        <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
+            AND a.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
+        </if>
+        <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
+            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}, '%' ))
+        </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.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>
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2495">
+            AND TIMESTAMPDIFF(
+            DAY,
+            DATE( a.behospital_date ),
+            DATE( a.leave_hospital_date ))> 30
+        </if>
+        )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
+            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
+        <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
+        LEFT JOIN med_qcresult_info qi ON qi.is_deleted = 'N'
+        AND t.hospitalId = qi.hospital_id
+        AND t.behospitalCode = qi.behospital_code
+        where 1=1
+        <if test="qcResultShortPageVO.checkStatus != null">
+            AND t.checkStatus = #{qcResultShortPageVO.checkStatus}
+        </if>
+        )f2
+        WHERE
+        f1.behDeptId = f2.behDeptId
+        AND f1.behDeptName = f2.behDeptName
+    </select>
 </mapper>