瀏覽代碼

Merge branch 'master' into his/tzmh

# Conflicts:
#	src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java
#	src/main/java/com/diagbot/entity/MedCrisisInfo.java
#	src/main/java/com/diagbot/mapper/MedCrisisInfoMapper.java
#	src/main/java/com/diagbot/service/BehospitalInfoService.java
#	src/main/java/com/diagbot/service/MedCrisisInfoService.java
#	src/main/java/com/diagbot/service/impl/MedCrisisInfoServiceImpl.java
#	src/main/resources/mapper/MedCrisisInfoMapper.xml
lantone 5 年之前
父節點
當前提交
fa6a86fe95
共有 47 個文件被更改,包括 2148 次插入414 次删除
  1. 3 0
      doc/005.20200528v1.2.x/qc_init.sql
  2. 5 0
      doc/006.20200602数据导入/qc_init.sql
  3. 34 0
      doc/006.20200604v1.3.1/qc_initv1.3.1.sql
  4. 3 0
      doc/007.20200608v1.2.3/qc_initv1.2.3.sql
  5. 4 0
      src/main/java/com/diagbot/client/AuthServiceClient.java
  6. 7 0
      src/main/java/com/diagbot/client/hystrix/AuthServiceHystrix.java
  7. 5 0
      src/main/java/com/diagbot/config/ResourceServerConfigurer.java
  8. 36 0
      src/main/java/com/diagbot/dto/DeptEntryNumDTO.java
  9. 31 0
      src/main/java/com/diagbot/dto/EntryNumDTO.java
  10. 37 0
      src/main/java/com/diagbot/dto/HomePageNumDTO.java
  11. 4 4
      src/main/java/com/diagbot/dto/NumDTO.java
  12. 1 2
      src/main/java/com/diagbot/dto/QcCasesEntryHospitalDTO.java
  13. 29 62
      src/main/java/com/diagbot/entity/MedRecordType.java
  14. 5 0
      src/main/java/com/diagbot/entity/MedicalRecord.java
  15. 8 120
      src/main/java/com/diagbot/entity/QcCasesEntry.java
  16. 4 10
      src/main/java/com/diagbot/facade/AlgorithmFacade.java
  17. 33 17
      src/main/java/com/diagbot/facade/BehospitalInfoFacade.java
  18. 100 31
      src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java
  19. 149 31
      src/main/java/com/diagbot/facade/ConsoleFacade.java
  20. 535 0
      src/main/java/com/diagbot/facade/DataImportFacade.java
  21. 23 25
      src/main/java/com/diagbot/facade/QcresultInfoFacade.java
  22. 11 2
      src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java
  23. 22 6
      src/main/java/com/diagbot/mapper/QcresultInfoMapper.java
  24. 11 2
      src/main/java/com/diagbot/service/BehospitalInfoService.java
  25. 1 1
      src/main/java/com/diagbot/service/MedCrisisInfoService.java
  26. 22 6
      src/main/java/com/diagbot/service/QcresultInfoService.java
  27. 16 4
      src/main/java/com/diagbot/service/impl/BehospitalInfoServiceImpl.java
  28. 28 6
      src/main/java/com/diagbot/service/impl/QcresultInfoServiceImpl.java
  29. 2 0
      src/main/java/com/diagbot/task/TASK_CX.java
  30. 42 0
      src/main/java/com/diagbot/vo/DataImportVO.java
  31. 10 0
      src/main/java/com/diagbot/vo/FilterPageVO.java
  32. 2 0
      src/main/java/com/diagbot/vo/FilterVO.java
  33. 1 3
      src/main/java/com/diagbot/vo/QcCasesEntryHospitalVO.java
  34. 8 1
      src/main/java/com/diagbot/vo/TaskVO.java
  35. 14 9
      src/main/java/com/diagbot/web/ConsoleByDeptController.java
  36. 43 8
      src/main/java/com/diagbot/web/ConsoleController.java
  37. 99 0
      src/main/java/com/diagbot/web/DataImportController.java
  38. 4 0
      src/main/resources/application-dev.yml
  39. 4 0
      src/main/resources/application-local.yml
  40. 4 0
      src/main/resources/application-pre.yml
  41. 4 0
      src/main/resources/application-pro.yml
  42. 4 0
      src/main/resources/application-test.yml
  43. 475 41
      src/main/resources/mapper/BehospitalInfoMapper.xml
  44. 5 0
      src/main/resources/mapper/MedRecordTypeMapper.xml
  45. 5 1
      src/main/resources/mapper/QcCasesEntryHospitalMapper.xml
  46. 253 20
      src/main/resources/mapper/QcresultInfoMapper.xml
  47. 2 2
      src/test/java/com/diagbot/CodeGeneration.java

+ 3 - 0
doc/005.20200528v1.2.x/qc_init.sql

@@ -1054,3 +1054,6 @@ alter table med_medical_record add COLUMN `status` TINYINT(4) NOT NULL DEFAULT '
 
 alter table med_home_diagnose_info MODIFY COLUMN `diagnose_order_no` INT(11) NOT NULL COMMENT '诊断序号';
 alter table med_home_operation_info MODIFY COLUMN `operation_order_no` INT(11) NOT NULL COMMENT '手术序号';
+
+alter table med_home_page MODIFY COLUMN  `again_behospital_plan` varchar(10) DEFAULT NULL COMMENT '三十一天内再住院计划';
+update sys_dictionary_info set val = '三十一天内再住院计划' where name = 'againBehospitalPlan';

+ 5 - 0
doc/006.20200602数据导入/qc_init.sql

@@ -0,0 +1,5 @@
+use `qc`;
+
+INSERT INTO `qc_mode` (`id`, `name`, `order_no`, `parent_id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `remark`) VALUES ('56', '日常病程录', '210', '37', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', NULL);
+
+delete from sys_dictionary_info where group_type = 0 and is_deleted = 'Y';

+ 34 - 0
doc/006.20200604v1.3.1/qc_initv1.3.1.sql

@@ -0,0 +1,34 @@
+use `qc`;
+
+-- alter table qc_cases_entry add COLUMN `rule_type` TINYINT(4) DEFAULT '0' COMMENT '规则类型(0:无,1:空项,2:错误)' after `name`;
+-- INSERT INTO `sys_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('286', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '12', '日常病程录', '56', '1', '286', '所属模块');
+-- INSERT INTO `sys_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('287', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '14', '无', '0', '1', '1', '质控错误类型');
+-- INSERT INTO `sys_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('288', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '14', '空项', '1', '1', '2', '质控错误类型');
+-- INSERT INTO `sys_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('289', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '14', '错误', '2', '1', '3', '质控错误类型');
+
+-- 已经在四个环境执行过并且已经和技术服务部同步
+-- ALTER TABLE `med_medical_record` ADD INDEX `idx_hos_becode` ( `hospital_id`, `behospital_code` ) USING BTREE;
+-- ALTER TABLE `med_medical_record` ADD INDEX `idx_mode_id` ( `mode_id` ) USING BTREE;
+
+-- ALTER TABLE `med_qcresult_detail` ADD INDEX `idx_cases_entry_id` (`cases_entry_id`) USING BTREE;
+-- ALTER TABLE `med_qcresult_detail` ADD INDEX `idx_cases_id` (`cases_id`) USING BTREE;
+--
+-- ALTER TABLE `qc_cases_entry_hospital` ADD INDEX `idx_cases_entry_id` (`cases_entry_id`) USING BTREE;
+-- ALTER TABLE `qc_cases_entry_hospital` ADD INDEX `idx_is_reject` (`is_reject`) USING BTREE;
+
+ALTER TABLE `med_behospital_info` ADD INDEX `idx_leave_hospital_date` (`leave_hospital_date`) USING BTREE;
+ALTER TABLE `qc_cases_entry_hospital` ADD INDEX `idx_hospital_id` (`hospital_id`) USING BTREE;
+
+
+ALTER TABLE `med_record_type` ADD `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除' AFTER `remark`;
+ALTER TABLE `med_record_type` ADD `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间' AFTER `is_deleted`;
+ALTER TABLE `med_record_type` ADD `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改' AFTER `gmt_create`;
+ALTER TABLE `med_record_type` ADD `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值' AFTER `gmt_modified`;
+ALTER TABLE `med_record_type` ADD `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改' AFTER `creator`;
+
+
+INSERT INTO `qc_mode` (`id`, `name`, `order_no`, `parent_id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `remark`) VALUES ('56', '日常病程录', '210', '37', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', NULL);
+
+delete from sys_dictionary_info where group_type = 0 and is_deleted = 'Y';
+
+ALTER TABLE `qc_cases_entry_hospital` MODIFY COLUMN  `is_reject` int(3) NOT NULL DEFAULT '0' COMMENT '单项否决(1-单项否决 0-非)' AFTER `is_used`;

+ 3 - 0
doc/007.20200608v1.2.3/qc_initv1.2.3.sql

@@ -0,0 +1,3 @@
+use `qc`;
+
+UPDATE `sys_task_cron` SET `id`='-1', `is_deleted`='N', `gmt_create`='1970-01-01 12:00:00', `gmt_modified`='1970-01-01 12:00:00', `creator`='0', `modifier`='0', `cron_code`='TASK_CX', `cron`='0 0 4 * * ?', `param`='1', `is_used`='1', `remark`='每天早上自动评分当天外的未评分的数据、同时强制质控出院日期推前四天的数据' WHERE (`id`='-1');

+ 4 - 0
src/main/java/com/diagbot/client/AuthServiceClient.java

@@ -5,6 +5,7 @@ import com.diagbot.dto.AnalyzeDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.JWT;
 import com.diagbot.vo.AnalyzeVO;
+import com.diagbot.vo.DataImportVO;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.security.oauth2.common.OAuth2AccessToken;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -32,6 +33,9 @@ public interface AuthServiceClient {
 
     @PostMapping(value = "/qc/behospitalInfo/analyze_rpc")
     RespDTO<AnalyzeDTO> analyze_rpc(@RequestBody AnalyzeVO analyzeVO);
+
+    @PostMapping(value = "/qc/dataimport/import")
+    RespDTO<Boolean> dataimport(@RequestBody DataImportVO dataImportVO);
 }
 
 

+ 7 - 0
src/main/java/com/diagbot/client/hystrix/AuthServiceHystrix.java

@@ -6,6 +6,7 @@ import com.diagbot.dto.AnalyzeDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.JWT;
 import com.diagbot.vo.AnalyzeVO;
+import com.diagbot.vo.DataImportVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.security.oauth2.common.OAuth2AccessToken;
 import org.springframework.stereotype.Component;
@@ -41,4 +42,10 @@ public class AuthServiceHystrix implements AuthServiceClient {
         log.error("【hystrix】调用{}异常", "analyze_rpc");
         return null;
     }
+
+    @Override
+    public RespDTO<Boolean> dataimport(DataImportVO dataImportVO) {
+        log.error("【hystrix】调用{}异常", "dataimport");
+        return null;
+    }
 }

+ 5 - 0
src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -78,7 +78,12 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/behospitalInfo/exportExcel").permitAll()
                 .antMatchers("/qc/behospitalInfo/exportQcresult").permitAll()
                 .antMatchers("/qc/behospitalInfo/exportQcresultByDept").permitAll()
+                .antMatchers("/console/entryRejectPercent").permitAll()
                 .antMatchers("/qc/abnormal/getQcAnnormalMode").permitAll()
+                .antMatchers("/console/qcResultLevelPercent").permitAll()
+                .antMatchers("/qc/dataimport/import").permitAll()
+                .antMatchers("/qc/dataimport/dataimportPrepare").permitAll()
+                .antMatchers("/qc/dataimport/test").permitAll()
                 .antMatchers("/**").authenticated();
 //                .antMatchers("/**").permitAll();
     }

+ 36 - 0
src/main/java/com/diagbot/dto/DeptEntryNumDTO.java

@@ -0,0 +1,36 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/6/5 14:26
+ */
+@Getter
+@Setter
+public class DeptEntryNumDTO {
+    private Long id;
+    /**
+     * 条目名称
+     */
+    private String name;
+    private Long casesId;
+    /**
+     * 模块名称
+     */
+    private String casesName;
+    private String deptId;
+    /**
+     * 科室名称
+     */
+    private String deptName;
+    private Integer totleNum = 0;
+    private Integer num = 0;
+    private Double percent = 0.00d;
+    private String percentStr = "0.00%";
+    private Double score = 0d;
+    private Integer isReject;
+    private Integer ruleType;
+}

+ 31 - 0
src/main/java/com/diagbot/dto/EntryNumDTO.java

@@ -0,0 +1,31 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/6/5 13:20
+ */
+@Getter
+@Setter
+public class EntryNumDTO {
+    private Long id;
+    /**
+     * 条目名称
+     */
+    private String name;
+    private Long casesId;
+    /**
+     * 模块名称
+     */
+    private String casesName;
+    private Integer totleNum = 0;
+    private Integer num = 0;
+    private Double percent = 0.00d;
+    private String percentStr = "0.00%";
+    private Double score = 0d;
+    private Integer isReject;
+    private Integer ruleType;
+}

+ 37 - 0
src/main/java/com/diagbot/dto/HomePageNumDTO.java

@@ -0,0 +1,37 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/6/5 17:32
+ */
+@Getter
+@Setter
+public class HomePageNumDTO {
+    private String deptId;
+    private String deptName;
+    private String doctorId;
+    private String doctorName;
+    private Integer entryNum = 0;
+    private Integer mrNum = 0;
+    private Double totleValue = 0d;
+    private Double averageValue = 0d;
+    private Integer firstLevelNum = 0;
+    private Integer secondLevelNum = 0;
+    private Double firstLevelPercent = 0.00d;
+    private Double secondLevelPercent = 0.00d;
+    private String firstLevelPercentStr = "0.00%";
+    private String secondLevelPercentStr = "0.00%";
+    private String deptClassId;
+    private String deptClass;
+    private Integer emptyNum = 0;
+    private Integer errorNum = 0;
+    private Integer entryTotleNum = 0;
+    private Double emptyPercent = 0.00d;
+    private Double errorPercent = 0.00d;
+    private String emptyPercentStr = "0.00%";
+    private String errorPercentStr = "0.00%";
+}

+ 4 - 4
src/main/java/com/diagbot/dto/NumDTO.java

@@ -13,8 +13,8 @@ import lombok.Setter;
 public class NumDTO {
     private String id;
     private String name;
-    private Integer totleNum;
-    private Integer num;
-    private Double percent;
-    private String percentStr;
+    private Integer totleNum = 0;
+    private Integer num = 0;
+    private Double percent = 0.00d;
+    private String percentStr = "0.00%";
 }

+ 1 - 2
src/main/java/com/diagbot/dto/QcCasesEntryHospitalDTO.java

@@ -3,8 +3,6 @@ package com.diagbot.dto;
 import lombok.Getter;
 import lombok.Setter;
 
-import java.math.BigDecimal;
-
 /**
  * @author wangfeng
  * @Description:
@@ -21,4 +19,5 @@ public class QcCasesEntryHospitalDTO {
     private Double score;
     private Integer isReject;
     private Integer isUsed;
+    private Integer ruleType;
 }

+ 29 - 62
src/main/java/com/diagbot/entity/MedRecordType.java

@@ -2,8 +2,11 @@ package com.diagbot.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Getter;
+import lombok.Setter;
 
 import java.io.Serializable;
+import java.util.Date;
 
 /**
  * <p>
@@ -13,6 +16,8 @@ import java.io.Serializable;
  * @author gaodm
  * @since 2020-04-13
  */
+@Getter
+@Setter
 public class MedRecordType implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -50,66 +55,28 @@ public class MedRecordType implements Serializable {
 
     private String remark;
 
-    public String getTypeId() {
-        return typeId;
-    }
-
-    public void setTypeId(String typeId) {
-        this.typeId = typeId;
-    }
-    public Long getHospitalId() {
-        return hospitalId;
-    }
-
-    public void setHospitalId(Long hospitalId) {
-        this.hospitalId = hospitalId;
-    }
-    public String getTypeName() {
-        return typeName;
-    }
-
-    public void setTypeName(String typeName) {
-        this.typeName = typeName;
-    }
-    public String getParentTypeId() {
-        return parentTypeId;
-    }
-
-    public void setParentTypeId(String parentTypeId) {
-        this.parentTypeId = parentTypeId;
-    }
-    public String getObjName() {
-        return objName;
-    }
-
-    public void setObjName(String objName) {
-        this.objName = objName;
-    }
-    public String getSpell() {
-        return spell;
-    }
-
-    public void setSpell(String spell) {
-        this.spell = spell;
-    }
-    public String getRemark() {
-        return remark;
-    }
-
-    public void setRemark(String remark) {
-        this.remark = remark;
-    }
-
-    @Override
-    public String toString() {
-        return "MedRecordType{" +
-            "typeId=" + typeId +
-            ", hospitalId=" + hospitalId +
-            ", typeName=" + typeName +
-            ", parentTypeId=" + parentTypeId +
-            ", objName=" + objName +
-            ", spell=" + spell +
-            ", remark=" + remark +
-        "}";
-    }
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
 }

+ 5 - 0
src/main/java/com/diagbot/entity/MedicalRecord.java

@@ -60,6 +60,11 @@ public class MedicalRecord implements Serializable {
      */
     private String recTitle;
 
+    /**
+     * 模板处理状态(0:未处理,1:已处理)
+     */
+    private Integer status;
+
     /**
      * 是否删除,N:未删除,Y:删除
      */

+ 8 - 120
src/main/java/com/diagbot/entity/QcCasesEntry.java

@@ -2,7 +2,8 @@ package com.diagbot.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
+import lombok.Data;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -14,6 +15,7 @@ import java.util.Date;
  * @author wangfeng
  * @since 2020-04-13
  */
+@Data
 public class QcCasesEntry implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -43,6 +45,11 @@ public class QcCasesEntry implements Serializable {
      */
     private String name;
 
+    /**
+     * 规则类型(0:无,1:空项,2:错误)
+     */
+    private Integer ruleType;
+
     private String precond;
 
     /**
@@ -79,123 +86,4 @@ public class QcCasesEntry implements Serializable {
      * 修改人,如果为0则表示纪录未修改
      */
     private String modifier;
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-    public Long getCasesId() {
-        return casesId;
-    }
-
-    public void setCasesId(Long casesId) {
-        this.casesId = casesId;
-    }
-    public String getCasesName() {
-        return casesName;
-    }
-
-    public void setCasesName(String casesName) {
-        this.casesName = casesName;
-    }
-    public Long getModeId() {
-        return modeId;
-    }
-
-    public void setModeId(Long modeId) {
-        this.modeId = modeId;
-    }
-    public String getCode() {
-        return code;
-    }
-
-    public void setCode(String code) {
-        this.code = code;
-    }
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-    public String getPrecond() {
-        return precond;
-    }
-
-    public void setPrecond(String precond) {
-        this.precond = precond;
-    }
-    public Integer getOrderNo() {
-        return orderNo;
-    }
-
-    public void setOrderNo(Integer orderNo) {
-        this.orderNo = orderNo;
-    }
-    public String getRemark() {
-        return remark;
-    }
-
-    public void setRemark(String remark) {
-        this.remark = remark;
-    }
-    public String getIsDeleted() {
-        return isDeleted;
-    }
-
-    public void setIsDeleted(String isDeleted) {
-        this.isDeleted = isDeleted;
-    }
-    public Date getGmtCreate() {
-        return gmtCreate;
-    }
-
-    public void setGmtCreate(Date gmtCreate) {
-        this.gmtCreate = gmtCreate;
-    }
-    public Date getGmtModified() {
-        return gmtModified;
-    }
-
-    public void setGmtModified(Date gmtModified) {
-        this.gmtModified = gmtModified;
-    }
-    public String getCreator() {
-        return creator;
-    }
-
-    public void setCreator(String creator) {
-        this.creator = creator;
-    }
-    public String getModifier() {
-        return modifier;
-    }
-
-    public void setModifier(String modifier) {
-        this.modifier = modifier;
-    }
-
-    @Override
-    public String toString() {
-        return "QcCasesEntry{" +
-            "id=" + id +
-            ", casesId=" + casesId +
-            ", casesName=" + casesName +
-            ", modeId=" + modeId +
-            ", code=" + code +
-            ", name=" + name +
-            ", precond=" + precond +
-            ", orderNo=" + orderNo +
-            ", remark=" + remark +
-            ", isDeleted=" + isDeleted +
-            ", gmtCreate=" + gmtCreate +
-            ", gmtModified=" + gmtModified +
-            ", creator=" + creator +
-            ", modifier=" + modifier +
-        "}";
-    }
 }

+ 4 - 10
src/main/java/com/diagbot/facade/AlgorithmFacade.java

@@ -56,14 +56,8 @@ public class AlgorithmFacade {
         dataDeal(algorithmVO);
 
         BigDecimal res = BigDecimal.ZERO;
-        //计算得分
-        if (algorithmVO.getHospitalId().equals(1L)) {
-            //长兴医院的情况下
-            res = getScoreForCx(algorithmVO);
-        } else {
-            //非长兴医院的情况下
-            res = cal(algorithmVO);
-        }
+        //统一为长兴的算法
+        res = getScoreForCx(algorithmVO);
         return res;
     }
 
@@ -241,8 +235,8 @@ public class AlgorithmFacade {
      */
     private BigDecimal cal(AlgorithmVO algorithmVO) {
         BigDecimal res = new BigDecimal(100);
-        if (algorithmVO.getHospitalId().equals(1L)
-                && algorithmVO.getIsHomePage().equals(true)) {
+        //统一为长兴的算法
+        if (algorithmVO.getIsHomePage().equals(true)) {
             res = new BigDecimal(20);
         }
         //模块总分

+ 33 - 17
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -289,6 +289,19 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
             medrecVoList.add(medrecVo);
         }
 
+        // 会诊记录
+        addDataWithKey("会诊", recMap, medrecVoList,
+                Arrays.asList("会诊记录", "会诊结果单", "会诊申请单"));
+
+        // 手术
+        addDataWithKey("手术", recMap, medrecVoList,
+                Arrays.asList("术后首次病程及谈话记录", "手术记录",
+                        "术前讨论、术前小结", "手术知情同意书", "手术安全核查表"));
+
+        // 转科
+        addDataWithKey("转科", recMap, medrecVoList,
+                Arrays.asList("转入记录", "转出记录"));
+
         addData("入院记录", recMap, medrecVoList);
         addData("病危通知书", recMap, medrecVoList);
         addData("阶段小结", recMap, medrecVoList);
@@ -304,23 +317,11 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         addData("疑难病例讨论记录", recMap, medrecVoList);
         addData("输血后效果评价", recMap, medrecVoList);
         addData("病理检验送检单", recMap, medrecVoList);
+        addData("日常病程录", recMap, medrecVoList);
 
         addDataWithInnerKey("知情同意书", recMap, medrecVoList);
         addDataWithInnerKey("谈话告知书", recMap, medrecVoList);
 
-        // 会诊记录
-        addDataWithKey("会诊", recMap, medrecVoList,
-                Arrays.asList("会诊记录", "会诊结果单", "会诊申请单"));
-
-        // 手术
-        addDataWithKey("手术", recMap, medrecVoList,
-                Arrays.asList("术后首次病程及谈话记录", "手术记录",
-                        "术前讨论、术前小结", "手术知情同意书", "手术安全核查表"));
-
-        // 转科
-        addDataWithKey("转科", recMap, medrecVoList,
-                Arrays.asList("转入记录", "转出记录"));
-
         // 医嘱
         if (ListUtil.isNotEmpty(doctorAdviceList)) {
             addDataWithKeyConvert("医嘱信息", doctorAdviceList, medrecVoList,
@@ -402,12 +403,20 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("behospital_code", analyzeVO.getBehospitalCode())
                 .eq("hospital_id", hospitalId)
-                .in("mode_id", Arrays.asList(53, 54))
+                .in("mode_id", Arrays.asList(53, 54, 16))
                 .orderByAsc("rec_date")
         );
         List<MedicalRecordDTO> medicalRecordDTOList = BeanUtil.listCopyTo(recordList, MedicalRecordDTO.class);
         Map<Long, List<MedicalRecordDTO>> recordMap = EntityUtil.makeEntityListMap(medicalRecordDTOList, "modeId");
-        pageMap.put("知情同意书", recordMap.get(53L));
+        List<MedicalRecordDTO> recordDTOList = new ArrayList<>();
+        if (recordMap.get(53L) != null) {
+            recordDTOList.addAll(recordMap.get(53L)); // 知情同意书
+        }
+        if (recordMap.get(16L) != null) {
+            recordDTOList.addAll(recordMap.get(16L)); // 手术知情同意书
+        }
+        // 知情同意书 = 【知情同意书】 + 【手术知情同意书】
+        pageMap.put("知情同意书", recordDTOList);
         pageMap.put("谈话告知书", recordMap.get(54L));
 
         String pageData = JSON.toJSONString(pageMap);
@@ -697,11 +706,18 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
     public void execute(TaskVO taskVO, String param) {
         // 处理医院信息
         dealTaskVO(param, taskVO);
-        // 处理时间过滤
+        // 类型过滤(1:出院时间比当前时间早4天前的病历(例如:长兴病历))
         if (taskVO.getType() != null && taskVO.getType() == 1) {
-            Date date = DateUtil.addDay(DateUtil.now(), -3);
+            Date date = DateUtil.addDay(DateUtil.now(), -4);
             taskVO.setLeaveDate(date);
         }
+        // 近3天不含当天的病历强制评分更新
+        if (taskVO != null && ListUtil.isNotEmpty(taskVO.getIndividuation()) && taskVO.getIndividuation().contains(1)) {
+            // 4天前最早时间
+            taskVO.setStartLeaveDate(DateUtil.getFirstTimeOfDay(DateUtil.addDay(DateUtil.now(), -4)));
+            // 昨天最迟时间
+            taskVO.setEndLeaveDate(DateUtil.getLastTimeOfDay(DateUtil.addDay(DateUtil.now(), -1)));
+        }
         List<BehospitalInfo> behospitalInfoList = getNoGrade(taskVO);
         for (BehospitalInfo bean : behospitalInfoList) {
             AnalyzeVO analyzeVO = new AnalyzeVO();

+ 100 - 31
src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java

@@ -1,9 +1,10 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.CaseAndDeptNumDTO;
 import com.diagbot.dto.DeptBaseDTO;
+import com.diagbot.dto.DeptEntryNumDTO;
 import com.diagbot.dto.DeptNumDTO;
+import com.diagbot.dto.HomePageNumDTO;
 import com.diagbot.dto.LevelStatisticsDTO;
 import com.diagbot.dto.NumDTO;
 import com.diagbot.util.BeanUtil;
@@ -489,7 +490,7 @@ public class ConsoleByDeptFacade {
      * @param filterPageByDeptVO
      * @return
      */
-    public IPage<CaseAndDeptNumDTO> entryCountGroupByEntryAndDeptPage(FilterPageByDeptVO filterPageByDeptVO) {
+    public IPage<DeptEntryNumDTO> entryCountGroupByEntryAndDeptPage(FilterPageByDeptVO filterPageByDeptVO) {
         if (StringUtil.isBlank(filterPageByDeptVO.getDeptName())) {
             List<DeptBaseDTO> deptList = this.getDept();
             //默认取第一个科室
@@ -497,8 +498,11 @@ public class ConsoleByDeptFacade {
                 filterPageByDeptVO.setDeptName(deptList.get(0).getDeptName());
             }
         }
+        if (filterPageByDeptVO.getDeptName().equals(filterPageByDeptVO.getDoctorName())) {
+            filterPageByDeptVO.setDoctorName("");
+        }
         filterPageByDeptVOSet(filterPageByDeptVO);
-        IPage<CaseAndDeptNumDTO> page = qcresultInfoFacade.entryCountGroupByEntryAndDeptPage(filterPageByDeptVO);
+        IPage<DeptEntryNumDTO> page = qcresultInfoFacade.entryCountGroupByEntryAndDeptPage(filterPageByDeptVO);
         return page;
     }
 
@@ -527,7 +531,7 @@ public class ConsoleByDeptFacade {
      * @param filterPageByDeptVO
      * @return
      */
-    public IPage<DeptNumDTO> entryGroupByEntryAndDeptInnerPage(FilterPageByDeptVO filterPageByDeptVO) {
+    public IPage<DeptEntryNumDTO> entryGroupByEntryAndDeptInnerPage(FilterPageByDeptVO filterPageByDeptVO) {
         if (StringUtil.isBlank(filterPageByDeptVO.getDeptName())) {
             List<DeptBaseDTO> deptList = this.getDept();
             //默认取第一个科室
@@ -536,7 +540,7 @@ public class ConsoleByDeptFacade {
             }
         }
         filterPageByDeptVOSet(filterPageByDeptVO);
-        IPage<DeptNumDTO> page = qcresultInfoFacade.entryGroupByEntryAndDeptInnerPage(filterPageByDeptVO);
+        IPage<DeptEntryNumDTO> page = qcresultInfoFacade.entryGroupByEntryAndDeptInnerPage(filterPageByDeptVO);
         return page;
     }
 
@@ -572,7 +576,7 @@ public class ConsoleByDeptFacade {
      * @param filterOrderByDeptVO
      * @return
      */
-    public List<LevelStatisticsDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO) {
+    public List<HomePageNumDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO) {
         List<DeptBaseDTO> deptList = getDept();
         if (ListUtil.isEmpty(deptList)) {
             return null;
@@ -588,7 +592,15 @@ public class ConsoleByDeptFacade {
         filterOrderByDeptVO.setEndDate(endDate);
         filterOrderByDeptVO.setHospitalId(hosptialId);
         filterOrderByDeptVO.setUserId(Long.valueOf(userId));
-        List<LevelStatisticsDTO> records = behospitalInfoFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO);
+        List<HomePageNumDTO> records = behospitalInfoFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO);
+        //没有医生过滤时增加全科室数据
+        if (StringUtil.isBlank(filterOrderByDeptVO.getName())
+                || filterOrderByDeptVO.getName().equals(filterOrderByDeptVO.getDeptName())) {
+            HomePageNumDTO item = getGlobleRecord(records, filterOrderByDeptVO.getDeptName());
+            if (item != null) {
+                records.add(0, item);
+            }
+        }
         return records;
     }
 
@@ -598,8 +610,8 @@ public class ConsoleByDeptFacade {
      * @param filterOrderByDeptVO
      * @return
      */
-    public List<LevelStatisticsDTO> homePageLevelByDeptLimit(FilterOrderByDeptVO filterOrderByDeptVO) {
-        DecimalFormat df = new DecimalFormat("#0.00");
+    public List<HomePageNumDTO> homePageLevelByDeptLimit(FilterOrderByDeptVO filterOrderByDeptVO) {
+
         List<DeptBaseDTO> deptList = getDept();
         if (ListUtil.isEmpty(deptList)) {
             return null;
@@ -618,62 +630,119 @@ public class ConsoleByDeptFacade {
         if (filterOrderByDeptVO.getLimitCount() == null || filterOrderByDeptVO.getLimitCount().equals(0)) {
             filterOrderByDeptVO.setLimitCount(10);
         }
-        List<LevelStatisticsDTO> records = behospitalInfoFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO);
-        //增加全科室
-        LevelStatisticsDTO item = new LevelStatisticsDTO();
+        List<HomePageNumDTO> records = behospitalInfoFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO);
+        HomePageNumDTO item = getGlobleRecord(records, filterOrderByDeptVO.getDeptName());
+        if (item != null) {
+            records.add(0, item);
+        }
+
+        records = records
+                .stream()
+                .limit(filterOrderByDeptVO.getLimitCount())
+                .collect(Collectors.toList());
+
+        return records;
+    }
+
+    /**
+     * 获取某个科室全科室数据
+     *
+     * @param records
+     * @param deptName
+     * @return
+     */
+    public HomePageNumDTO getGlobleRecord(List<HomePageNumDTO> records, String deptName) {
+        DecimalFormat df = new DecimalFormat("#0.00");
+        HomePageNumDTO item = new HomePageNumDTO();
+        //总病历数
         Integer mrNum = records
                 .stream()
-                .map(LevelStatisticsDTO::getMrNum)
+                .map(HomePageNumDTO::getMrNum)
                 .reduce(0, Integer::sum);
         if (mrNum == null || mrNum == 0) {
-            return Lists.newLinkedList();
+            return null;
         }
+        //总缺陷数
         Integer entryNum = records
                 .stream()
-                .map(LevelStatisticsDTO::getEntryNum)
+                .map(HomePageNumDTO::getEntryNum)
                 .reduce(0, Integer::sum);
-        Double totleFee = records
+        //总分
+        Double totleValue = records
                 .stream()
                 .map(i -> BigDecimal.valueOf(i.getTotleValue()))
                 .reduce(BigDecimal.ZERO, BigDecimal::add)
                 .doubleValue();
-        Double averageFee = BigDecimal.valueOf(totleFee)
+        //平均分
+        Double averageValue = BigDecimal.valueOf(totleValue)
                 .divide(BigDecimal.valueOf(mrNum), 2, RoundingMode.HALF_UP)
                 .doubleValue();
+        //合格病历总数
         Integer firstLevelNum = records
                 .stream()
-                .map(LevelStatisticsDTO::getFirstLevelNum)
+                .map(HomePageNumDTO::getFirstLevelNum)
                 .reduce(0, Integer::sum);
+        //合格病历占比
         Double firstLevelPercent = BigDecimal.valueOf(firstLevelNum)
                 .divide(BigDecimal.valueOf(mrNum), 4, RoundingMode.HALF_UP)
                 .doubleValue();
         String firstLevelPercentStr
                 = df.format(BigDecimal.valueOf(firstLevelPercent).multiply(BigDecimal.valueOf(100))) + "%";
-        Integer secondLevelNum = mrNum - firstLevelNum;
+        //不合格病历数
+        Integer secondLevelNum = records
+                .stream()
+                .map(HomePageNumDTO::getSecondLevelNum)
+                .reduce(0, Integer::sum);
+        //不合格病历占比
         Double secondLevelPercent = BigDecimal.valueOf(secondLevelNum)
                 .divide(BigDecimal.valueOf(mrNum), 4, RoundingMode.HALF_UP)
                 .doubleValue();
         String secondLevelPercentStr
                 = df.format(BigDecimal.valueOf(secondLevelPercent).multiply(BigDecimal.valueOf(100))) + "%";
-        item.setDoctorName(filterOrderByDeptVO.getDeptName());
+        //条目缺陷总数(模块下条目*病历数)
+        Integer entryTotleNum = records
+                .stream()
+                .map(HomePageNumDTO::getEntryTotleNum)
+                .reduce(0, Integer::sum);
+        //空项总数
+        Integer emptyNum = records
+                .stream()
+                .map(HomePageNumDTO::getEmptyNum)
+                .reduce(0, Integer::sum);
+        Double emptyPercent = BigDecimal.valueOf(entryTotleNum - emptyNum)
+                .divide(BigDecimal.valueOf(entryTotleNum), 4, RoundingMode.HALF_UP)
+                .doubleValue();
+        String emptyPercentStr
+                = df.format(BigDecimal.valueOf(emptyPercent).multiply(BigDecimal.valueOf(100))) + "%";
+        //错误项总数
+        Integer errorNum = records
+                .stream()
+                .map(HomePageNumDTO::getErrorNum)
+                .reduce(0, Integer::sum);
+        Double errorPercent = BigDecimal.valueOf(entryTotleNum - errorNum)
+                .divide(BigDecimal.valueOf(entryTotleNum), 4, RoundingMode.HALF_UP)
+                .doubleValue();
+        String errorPercentStr
+                = df.format(BigDecimal.valueOf(errorPercent).multiply(BigDecimal.valueOf(100))) + "%";
+
+        item.setDoctorName(deptName);
         item.setEntryNum(entryNum);
         item.setMrNum(mrNum);
-        item.setTotleValue(totleFee);
-        item.setAverageValue(averageFee);
+        item.setTotleValue(totleValue);
+        item.setAverageValue(averageValue);
         item.setFirstLevelNum(firstLevelNum);
         item.setFirstLevelPercent(firstLevelPercent);
         item.setFirstLevelPercentStr(firstLevelPercentStr);
         item.setSecondLevelNum(secondLevelNum);
         item.setSecondLevelPercent(secondLevelPercent);
         item.setSecondLevelPercentStr(secondLevelPercentStr);
-
-        records.add(0, item);
-
-        records = records
-                .stream()
-                .limit(filterOrderByDeptVO.getLimitCount())
-                .collect(Collectors.toList());
-
-        return records;
+        item.setEntryTotleNum(entryTotleNum);
+        item.setEmptyNum(emptyNum);
+        item.setEmptyPercent(emptyPercent);
+        item.setEmptyPercentStr(emptyPercentStr);
+        item.setErrorNum(errorNum);
+        item.setErrorPercent(errorPercent);
+        item.setErrorPercentStr(errorPercentStr);
+        return item;
     }
 }

+ 149 - 31
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -5,7 +5,9 @@ import com.diagbot.aggregate.AverageStatisticsAggregate;
 import com.diagbot.aggregate.MrStatisticsAggregate;
 import com.diagbot.aggregate.ResultStatisticsAggregate;
 import com.diagbot.dto.AverageStatisticsDTO;
-import com.diagbot.dto.CaseNumDTO;
+import com.diagbot.dto.DeptNumDTO;
+import com.diagbot.dto.EntryNumDTO;
+import com.diagbot.dto.HomePageNumDTO;
 import com.diagbot.dto.LevelStatisticsDTO;
 import com.diagbot.dto.NumDTO;
 import com.diagbot.dto.QcResultPercentDTO;
@@ -13,6 +15,7 @@ import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.FilterOrderVO;
 import com.diagbot.vo.FilterPageByAverageVO;
@@ -294,6 +297,51 @@ public class ConsoleFacade {
         return retMap;
     }
 
+    /**
+     * 单项否决缺陷占比
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<EntryNumDTO> entryRejectPercent(FilterVO filterVO) {
+        List<EntryNumDTO> retList = Lists.newLinkedList();
+        filterVOSet(filterVO);
+        Integer limitCount = filterVO.getLimitCount();
+        List<EntryNumDTO> numDTOList = qcresultInfoFacade.entryRejectPercent(filterVO);
+        if (ListUtil.isNotEmpty(numDTOList)) {
+            if (numDTOList.size() <= limitCount) {
+                retList = numDTOList;
+            } else {
+                retList = numDTOList.subList(0, limitCount);
+            }
+        }
+        return retList;
+    }
+
+    /**
+     * 各科室甲/乙/丙级病历占比
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<DeptNumDTO> qcResultLevelPercent(FilterVO filterVO) {
+        if (StringUtil.isBlank(filterVO.getLevel())) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "请输入病历等级");
+        }
+        List<DeptNumDTO> retList = Lists.newLinkedList();
+        filterVOSet(filterVO);
+        Integer limitCount = filterVO.getLimitCount();
+        List<DeptNumDTO> numDTOList = qcresultInfoFacade.qcResultLevelPercent(filterVO);
+        if (ListUtil.isNotEmpty(numDTOList)) {
+            if (numDTOList.size() <= limitCount) {
+                retList = numDTOList;
+            } else {
+                retList = numDTOList.subList(0, limitCount);
+            }
+        }
+        return retList;
+    }
+
     /**
      * 各科室缺陷占比
      *
@@ -312,11 +360,13 @@ public class ConsoleFacade {
 
     private void filterVOSet(FilterVO filterVO) {
         String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
         String startDate = filterFacade.getStartDateStr(filterVO.getType(), null);
         String endDate = filterFacade.getEndDateStr(filterVO.getType(), null);
         filterVO.setStartDate(startDate);
         filterVO.setEndDate(endDate);
         filterVO.setHospitalId(hospitalId);
+        filterVO.setUserId(Long.valueOf(userId));
         if (filterVO.getLimitCount() == null || filterVO.getLimitCount().equals(0)) {
             filterVO.setLimitCount(10);
         }
@@ -415,9 +465,12 @@ public class ConsoleFacade {
      * @param filterPageVO
      * @return
      */
-    public IPage<CaseNumDTO> entryCountGroupByEntryPage(FilterPageVO filterPageVO) {
+    public IPage<EntryNumDTO> entryCountGroupByEntryPage(FilterPageVO filterPageVO) {
         filterPageVOSet(filterPageVO);
-        IPage<CaseNumDTO> page = qcresultInfoFacade.entryCountGroupByEntryPage(filterPageVO);
+        if (filterPageVO.getDeptName().equals("全院")) {
+            filterPageVO.setDeptName("");
+        }
+        IPage<EntryNumDTO> page = qcresultInfoFacade.entryCountGroupByEntryPage(filterPageVO);
         return page;
     }
 
@@ -487,9 +540,9 @@ public class ConsoleFacade {
      * @param filterPageVO
      * @return
      */
-    public IPage<NumDTO> entryGroupByEntryInnerPage(FilterPageVO filterPageVO) {
+    public IPage<EntryNumDTO> entryGroupByEntryInnerPage(FilterPageVO filterPageVO) {
         filterPageVOSet(filterPageVO);
-        IPage<NumDTO> page = qcresultInfoFacade.entryGroupByEntryInnerPage(filterPageVO);
+        IPage<EntryNumDTO> page = qcresultInfoFacade.entryGroupByEntryInnerPage(filterPageVO);
         return page;
     }
     //endregion-----------------------分页接口结束-------------------------------
@@ -524,7 +577,7 @@ public class ConsoleFacade {
         filterOrderVO.setStartDate(startDate);
         filterOrderVO.setEndDate(endDate);
         filterOrderVO.setHospitalId(hosptialId);
-        List<LevelStatisticsDTO> records = behospitalInfoFacade.levelStatisticsByDeptClass(filterOrderVO);
+        List<LevelStatisticsDTO> records = behospitalInfoFacade.levelStatisticsByDeptClass2(filterOrderVO);
         return records;
     }
 
@@ -534,14 +587,21 @@ public class ConsoleFacade {
      * @param filterOrderVO
      * @return
      */
-    public List<LevelStatisticsDTO> homePageLevelStatistics(FilterOrderVO filterOrderVO) {
+    public List<HomePageNumDTO> homePageLevelStatistics(FilterOrderVO filterOrderVO) {
         String hosptialId = SysUserUtils.getCurrentHospitalID();
         String startDate = filterFacade.getStartDateStr(filterOrderVO.getType(), null);
         String endDate = filterFacade.getEndDateStr(filterOrderVO.getType(), null);
         filterOrderVO.setStartDate(startDate);
         filterOrderVO.setEndDate(endDate);
         filterOrderVO.setHospitalId(hosptialId);
-        List<LevelStatisticsDTO> records = behospitalInfoFacade.homePageLevelStatistics(filterOrderVO);
+        List<HomePageNumDTO> records = behospitalInfoFacade.homePageLevelStatistics(filterOrderVO);
+        //没有科室过滤时增加全院数据
+        if (StringUtil.isBlank(filterOrderVO.getName()) || filterOrderVO.getName().equals("全院")) {
+            HomePageNumDTO item = getGlobleRecord(records);
+            if (item != null) {
+                records.add(0, item);
+            }
+        }
         return records;
     }
 
@@ -551,8 +611,8 @@ public class ConsoleFacade {
      * @param filterOrderVO
      * @return
      */
-    public List<LevelStatisticsDTO> homePageLevelLimit(FilterOrderVO filterOrderVO) {
-        DecimalFormat df = new DecimalFormat("#0.00");
+    public List<HomePageNumDTO> homePageLevelLimit(FilterOrderVO filterOrderVO) {
+
         String hosptialId = SysUserUtils.getCurrentHospitalID();
         String startDate = filterFacade.getStartDateStr(filterOrderVO.getType(), null);
         String endDate = filterFacade.getEndDateStr(filterOrderVO.getType(), null);
@@ -562,63 +622,121 @@ public class ConsoleFacade {
         if (filterOrderVO.getLimitCount() == null || filterOrderVO.getLimitCount().equals(0)) {
             filterOrderVO.setLimitCount(10);
         }
-        List<LevelStatisticsDTO> records = behospitalInfoFacade.homePageLevelStatistics(filterOrderVO);
+        List<HomePageNumDTO> records = behospitalInfoFacade.homePageLevelStatistics(filterOrderVO);
+        HomePageNumDTO item = getGlobleRecord(records);
+        if (item != null) {
+            records.add(0, item);
+        }
+        records = records
+                .stream()
+                .limit(filterOrderVO.getLimitCount())
+                .collect(Collectors.toList());
+        return records;
+    }
+
+    /**
+     * 增加全院记录
+     *
+     * @param records
+     * @return
+     */
+    public HomePageNumDTO getGlobleRecord(List<HomePageNumDTO> records) {
+        DecimalFormat df = new DecimalFormat("#0.00");
+        HomePageNumDTO item = new HomePageNumDTO();
+
+        if (ListUtil.isEmpty(records)) {
+            return null;
+        }
 
-        //增加全院
-        LevelStatisticsDTO item = new LevelStatisticsDTO();
+        //总病历数
         Integer mrNum = records
                 .stream()
-                .map(LevelStatisticsDTO::getMrNum)
+                .map(HomePageNumDTO::getMrNum)
                 .reduce(0, Integer::sum);
         if (mrNum == null || mrNum == 0) {
-            return Lists.newLinkedList();
+            return null;
         }
+        //总缺陷数
         Integer entryNum = records
                 .stream()
-                .map(LevelStatisticsDTO::getEntryNum)
+                .map(HomePageNumDTO::getEntryNum)
                 .reduce(0, Integer::sum);
-        Double totleFee = records
+        //总分
+        Double totleValue = records
                 .stream()
                 .map(i -> BigDecimal.valueOf(i.getTotleValue()))
                 .reduce(BigDecimal.ZERO, BigDecimal::add)
                 .doubleValue();
-        Double averageFee = BigDecimal.valueOf(totleFee)
+        //平均分
+        Double averageValue = BigDecimal.valueOf(totleValue)
                 .divide(BigDecimal.valueOf(mrNum), 2, RoundingMode.HALF_UP)
                 .doubleValue();
+        //合格病历总数
         Integer firstLevelNum = records
                 .stream()
-                .map(LevelStatisticsDTO::getFirstLevelNum)
+                .map(HomePageNumDTO::getFirstLevelNum)
                 .reduce(0, Integer::sum);
+        //合格病历占比
         Double firstLevelPercent = BigDecimal.valueOf(firstLevelNum)
                 .divide(BigDecimal.valueOf(mrNum), 4, RoundingMode.HALF_UP)
                 .doubleValue();
         String firstLevelPercentStr
                 = df.format(BigDecimal.valueOf(firstLevelPercent).multiply(BigDecimal.valueOf(100))) + "%";
-        Integer secondLevelNum = mrNum - firstLevelNum;
+        //不合格病历数
+        Integer secondLevelNum = records
+                .stream()
+                .map(HomePageNumDTO::getSecondLevelNum)
+                .reduce(0, Integer::sum);
+        //不合格病历占比
         Double secondLevelPercent = BigDecimal.valueOf(secondLevelNum)
                 .divide(BigDecimal.valueOf(mrNum), 4, RoundingMode.HALF_UP)
                 .doubleValue();
         String secondLevelPercentStr
                 = df.format(BigDecimal.valueOf(secondLevelPercent).multiply(BigDecimal.valueOf(100))) + "%";
+        //条目缺陷总数(模块下条目*病历数)
+        Integer entryTotleNum = records
+                .stream()
+                .map(HomePageNumDTO::getEntryTotleNum)
+                .reduce(0, Integer::sum);
+        //空项总数
+        Integer emptyNum = records
+                .stream()
+                .map(HomePageNumDTO::getEmptyNum)
+                .reduce(0, Integer::sum);
+        Double emptyPercent = BigDecimal.valueOf(entryTotleNum - emptyNum)
+                .divide(BigDecimal.valueOf(entryTotleNum), 4, RoundingMode.HALF_UP)
+                .doubleValue();
+        String emptyPercentStr
+                = df.format(BigDecimal.valueOf(emptyPercent).multiply(BigDecimal.valueOf(100))) + "%";
+        //错误项总数
+        Integer errorNum = records
+                .stream()
+                .map(HomePageNumDTO::getErrorNum)
+                .reduce(0, Integer::sum);
+        Double errorPercent = BigDecimal.valueOf(entryTotleNum - errorNum)
+                .divide(BigDecimal.valueOf(entryTotleNum), 4, RoundingMode.HALF_UP)
+                .doubleValue();
+        String errorPercentStr
+                = df.format(BigDecimal.valueOf(errorPercent).multiply(BigDecimal.valueOf(100))) + "%";
+
         item.setDeptName("全院");
         item.setEntryNum(entryNum);
         item.setMrNum(mrNum);
-        item.setTotleValue(totleFee);
-        item.setAverageValue(averageFee);
+        item.setTotleValue(totleValue);
+        item.setAverageValue(averageValue);
         item.setFirstLevelNum(firstLevelNum);
         item.setFirstLevelPercent(firstLevelPercent);
         item.setFirstLevelPercentStr(firstLevelPercentStr);
         item.setSecondLevelNum(secondLevelNum);
         item.setSecondLevelPercent(secondLevelPercent);
         item.setSecondLevelPercentStr(secondLevelPercentStr);
-
-        records.add(0, item);
-
-        records = records
-                .stream()
-                .limit(filterOrderVO.getLimitCount())
-                .collect(Collectors.toList());
-
-        return records;
+        item.setEntryTotleNum(entryTotleNum);
+        item.setEmptyNum(emptyNum);
+        item.setEmptyPercent(emptyPercent);
+        item.setEmptyPercentStr(emptyPercentStr);
+        item.setErrorNum(errorNum);
+        item.setErrorPercent(errorPercent);
+        item.setErrorPercentStr(errorPercentStr);
+        return item;
     }
 }

+ 535 - 0
src/main/java/com/diagbot/facade/DataImportFacade.java

@@ -0,0 +1,535 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.client.AuthServiceClient;
+import com.diagbot.entity.BehospitalInfo;
+import com.diagbot.entity.DoctorAdvice;
+import com.diagbot.entity.HomeDiagnoseInfo;
+import com.diagbot.entity.HomeOperationInfo;
+import com.diagbot.entity.HomePage;
+import com.diagbot.entity.MedCrisisInfo;
+import com.diagbot.entity.MedicalRecord;
+import com.diagbot.entity.MedicalRecordContent;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.BehospitalInfoService;
+import com.diagbot.service.DoctorAdviceService;
+import com.diagbot.service.HomeDiagnoseInfoService;
+import com.diagbot.service.HomeOperationInfoService;
+import com.diagbot.service.HomePageService;
+import com.diagbot.service.MedCrisisInfoService;
+import com.diagbot.service.MedicalRecordContentService;
+import com.diagbot.service.MedicalRecordService;
+import com.diagbot.util.EncrypDES;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.DataImportVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2018/11/23 11:37
+ */
+@Component
+public class DataImportFacade {
+
+    @Autowired
+    @Qualifier("behospitalInfoServiceImpl")
+    BehospitalInfoService behospitalInfoService;
+    @Autowired
+    @Qualifier("medCrisisInfoServiceImpl")
+    MedCrisisInfoService medCrisisInfoService;
+    @Autowired
+    @Qualifier("doctorAdviceServiceImpl")
+    DoctorAdviceService doctorAdviceService;
+    @Autowired
+    @Qualifier("homeDiagnoseInfoServiceImpl")
+    HomeDiagnoseInfoService homeDiagnoseInfoService;
+    @Autowired
+    @Qualifier("homePageServiceImpl")
+    HomePageService homePageService;
+    @Autowired
+    @Qualifier("homeOperationInfoServiceImpl")
+    HomeOperationInfoService homeOperationInfoService;
+    @Autowired
+    @Qualifier("medicalRecordServiceImpl")
+    MedicalRecordService medicalRecordService;
+    @Autowired
+    @Qualifier("medicalRecordContentServiceImpl")
+    MedicalRecordContentService medicalRecordContentService;
+    @Autowired
+    AuthServiceClient authServiceClient;
+    @Value("${encrypt.enable}")
+    Boolean encryptFlag;
+
+    /**
+     * 数据导入
+     *
+     * @param dataImportVO
+     * @return
+     */
+    public Boolean dataImportFacade(DataImportVO dataImportVO) {
+        Long hospitalId = dataImportVO.getHospitalId();
+        // 病历信息导入
+        List<BehospitalInfo> behospitalInfoList = dataImportVO.getBehospitalInfoList();
+        if (ListUtil.isNotEmpty(behospitalInfoList)) {
+            List<String> behospitalCodeList = behospitalInfoList.stream().map(r -> r.getBehospitalCode()).collect(Collectors.toList());
+            if (ListUtil.isNotEmpty(behospitalCodeList)) {
+                // 先删除
+                behospitalInfoService.remove(new QueryWrapper<BehospitalInfo>()
+                        .eq("hospital_id", hospitalId)
+                        .in("behospital_code", behospitalCodeList)
+                );
+                // 加密
+                for (BehospitalInfo behospitalInfo : behospitalInfoList) {
+                    // 姓名
+                    if (StringUtil.isNotBlank(behospitalInfo.getName())) {
+                        behospitalInfo.setName(behospitalInfo.getName().substring(0, 1) + "**");
+                    }
+                }
+                behospitalInfoService.saveBatch(behospitalInfoList);
+            }
+        }
+
+        // 危急值信息
+        List<MedCrisisInfo> medCrisisInfoList = dataImportVO.getMedCrisisInfoList();
+        if (ListUtil.isNotEmpty(medCrisisInfoList)) {
+            List<String> recIdList = medCrisisInfoList.stream().map(r -> r.getRecId()).collect(Collectors.toList());
+            if (ListUtil.isNotEmpty(recIdList)) {
+                // 先删除
+                medCrisisInfoService.remove(new QueryWrapper<MedCrisisInfo>()
+                        .eq("hospital_id", hospitalId)
+                        .in("rec_id", recIdList)
+                );
+                medCrisisInfoService.saveBatch(medCrisisInfoList);
+            }
+        }
+
+        // 病人医嘱
+        List<DoctorAdvice> doctorAdviceList = dataImportVO.getDoctorAdviceList();
+        if (ListUtil.isNotEmpty(doctorAdviceList)) {
+            List<String> doctorAdviceIdList = doctorAdviceList.stream().map(r -> r.getDoctorAdviceId()).collect(Collectors.toList());
+            if (ListUtil.isNotEmpty(doctorAdviceIdList)) {
+                // 先删除
+                doctorAdviceService.remove(new QueryWrapper<DoctorAdvice>()
+                        .eq("hospital_id", hospitalId)
+                        .in("doctor_advice_id", doctorAdviceIdList)
+                );
+                doctorAdviceService.saveBatch(doctorAdviceList);
+            }
+        }
+
+        // 病案首页诊断
+        List<HomeDiagnoseInfo> homeDiagnoseInfoList = dataImportVO.getHomeDiagnoseInfoList();
+        if (ListUtil.isNotEmpty(homeDiagnoseInfoList)) {
+            StringBuffer sb = new StringBuffer();
+            sb.append(" ( ");
+            for (int i = 0; i < homeDiagnoseInfoList.size(); i++) {
+                HomeDiagnoseInfo s = homeDiagnoseInfoList.get(i);
+                if (i == 0) {
+                    sb.append(" (home_page_id = '" + s.getHomePageId() + "'"
+                            + " and diagnose_order_no = '" + s.getDiagnoseOrderNo() + "'"
+                            + ") " );
+                } else {
+                    sb.append(" or ( home_page_id = '" + s.getHomePageId() + "'"
+                            + " and diagnose_order_no = '" + s.getDiagnoseOrderNo() + "'"
+                            + ") " );
+                }
+            }
+            sb.append(")");
+
+            // 先删除
+            homeDiagnoseInfoService.remove(new QueryWrapper<HomeDiagnoseInfo>()
+                    .eq("hospital_id", hospitalId)
+                    .apply(sb.toString())
+            );
+            homeDiagnoseInfoService.saveBatch(homeDiagnoseInfoList);
+        }
+
+        // 病案首页
+        List<HomePage> homePageList = dataImportVO.getHomePageList();
+        if (ListUtil.isNotEmpty(homePageList)) {
+            List<String> homePageIdList = homePageList.stream().map(r -> r.getHomePageId()).collect(Collectors.toList());
+            if (ListUtil.isNotEmpty(homePageIdList)) {
+                // 先删除
+                homePageService.remove(new QueryWrapper<HomePage>()
+                        .eq("hospital_id", hospitalId)
+                        .in("home_page_id", homePageIdList)
+                );
+                // 加密
+                for (HomePage homePage : dataImportVO.getHomePageList()) {
+                    // 姓名
+                    if (StringUtil.isNotBlank(homePage.getName())) {
+                        homePage.setName(homePage.getName().substring(0, 1) + "**");
+                    }
+                    // 身份证
+                    if (StringUtil.isNotBlank(homePage.getIdentityCardNo())) {
+                        homePage.setIdentityCardNo(homePage.getIdentityCardNo().substring(0, 1) + "*****************");
+                    }
+                    // 现住址电话
+                    if (StringUtil.isNotBlank(homePage.getCurPhone())) {
+                        homePage.setCurPhone(homePage.getCurPhone().substring(0, 1) + "**");
+                    }
+                    // 工作单位电话
+                    if (StringUtil.isNotBlank(homePage.getWorkPhone())) {
+                        homePage.setWorkPhone(homePage.getWorkPhone().substring(0, 1) + "**");
+                    }
+                    // 联系人姓名
+                    if (StringUtil.isNotBlank(homePage.getContactName())) {
+                        homePage.setContactName(homePage.getContactName().substring(0, 1) + "**");
+                    }
+                    // 联系人电话
+                    if (StringUtil.isNotBlank(homePage.getContactPhone())) {
+                        homePage.setContactPhone(homePage.getContactPhone().substring(0, 1) + "**");
+                    }
+                }
+                homePageService.saveBatch(homePageList);
+            }
+        }
+
+        // 病案首页手术信息
+        List<HomeOperationInfo> homeOperationInfoList = dataImportVO.getHomeOperationInfoList();
+        if (ListUtil.isNotEmpty(homeOperationInfoList)) {
+            StringBuffer sb = new StringBuffer();
+            sb.append(" ( ");
+            for (int i = 0; i < homeOperationInfoList.size(); i++) {
+                HomeOperationInfo s = homeOperationInfoList.get(i);
+                if (i == 0) {
+                    sb.append(" (home_page_id = '" + s.getHomePageId() + "'"
+                            + " and operation_order_no = '" + s.getOperationOrderNo() + "'"
+                            + ") " );
+                } else {
+                    sb.append(" or ( home_page_id = '" + s.getHomePageId() + "'"
+                            + " and operation_order_no = '" + s.getOperationOrderNo() + "'"
+                            + ") " );
+                }
+            }
+            sb.append(")");
+            // 先删除
+            homeOperationInfoService.remove(new QueryWrapper<HomeOperationInfo>()
+                    .eq("hospital_id", hospitalId)
+                    .apply(sb.toString())
+            );
+            homeOperationInfoService.saveBatch(homeOperationInfoList);
+        }
+
+        // 文书信息
+        List<MedicalRecord> medicalRecordList = dataImportVO.getMedicalRecordList();
+        if (ListUtil.isNotEmpty(medicalRecordList)) {
+            List<String> recIdList = medicalRecordList.stream().map(r -> r.getRecId()).collect(Collectors.toList());
+            if (ListUtil.isNotEmpty(recIdList)) {
+                // 先删除
+                medicalRecordService.remove(new QueryWrapper<MedicalRecord>()
+                        .eq("hospital_id", hospitalId)
+                        .in("rec_id", recIdList)
+                );
+                medicalRecordService.saveBatch(medicalRecordList);
+            }
+        }
+
+        // 文书明细信息
+        List<MedicalRecordContent> medicalRecordContentList = dataImportVO.getMedicalRecordContentList();
+        if (ListUtil.isNotEmpty(medicalRecordContentList)) {
+            List<String> recIdList = medicalRecordContentList.stream().map(r -> r.getRecId()).collect(Collectors.toList());
+            if (ListUtil.isNotEmpty(recIdList)) {
+                // 先删除
+                medicalRecordContentService.remove(new QueryWrapper<MedicalRecordContent>()
+                        .eq("hospital_id", hospitalId)
+                        .in("rec_id", recIdList));
+
+                // 加密数据
+                if (encryptFlag) {
+                    String recId = "";
+                    try {
+                        EncrypDES encrypDES = new EncrypDES();
+                        for (MedicalRecordContent medicalRecordContent : medicalRecordContentList) {
+                            recId = medicalRecordContent.getRecId();
+                            if (StringUtil.isNotBlank(medicalRecordContent.getXmlText())) {
+                                medicalRecordContent.setXmlText(encrypDES.encrytor(medicalRecordContent.getXmlText()));
+                            }
+                        }
+                    } catch (Exception e) {
+                        throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "加密xml错误!recId=【" + recId + "】");
+                    }
+                }
+                medicalRecordContentService.saveBatch(medicalRecordContentList, 100);
+            }
+        }
+        return true;
+    }
+
+
+    /**
+     * 数据导入【效率低,备用】
+     *
+     * @param dataImportVO
+     * @return
+     */
+    public Boolean dataImportPrepareFacade(DataImportVO dataImportVO) {
+        Long hospitalId = dataImportVO.getHospitalId();
+        // 病历信息导入
+        List<BehospitalInfo> behospitalInfoList = dataImportVO.getBehospitalInfoList();
+        if (ListUtil.isNotEmpty(behospitalInfoList)) {
+            behospitalInfoList.forEach(s -> {
+                QueryWrapper<BehospitalInfo> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("behospital_code", s.getBehospitalCode());
+                queryWrapper.eq("hospital_id", s.getHospitalId());
+                queryWrapper.eq("is_deleted", IsDeleteEnum.N);
+                // 姓名加密
+                if (StringUtil.isNotBlank(s.getName())) {
+                    s.setName(s.getName().substring(0, 1) + "**");
+                }
+                int count = behospitalInfoService.count(queryWrapper);
+                if (count > 0) {
+                    behospitalInfoService.update(s, queryWrapper);
+                } else {
+                    behospitalInfoService.save(s);
+                }
+            });
+        }
+
+        // 危急值信息
+        List<MedCrisisInfo> medCrisisInfoList = dataImportVO.getMedCrisisInfoList();
+        if (ListUtil.isNotEmpty(medCrisisInfoList)) {
+            medCrisisInfoList.forEach(s -> {
+                QueryWrapper<MedCrisisInfo> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("rec_id", s.getRecId());
+                queryWrapper.eq("hospital_id", s.getHospitalId());
+                queryWrapper.eq("behospital_code", s.getBehospitalCode());
+                queryWrapper.eq("rec_type", s.getRecType());
+                int count = medCrisisInfoService.count(queryWrapper);
+                if (count > 0) {
+                    medCrisisInfoService.update(s, queryWrapper);
+                } else {
+                    medCrisisInfoService.save(s);
+                }
+            });
+        }
+
+        // 病人医嘱
+        List<DoctorAdvice> doctorAdviceList = dataImportVO.getDoctorAdviceList();
+        if (ListUtil.isNotEmpty(doctorAdviceList)) {
+            doctorAdviceList.forEach(s -> {
+                QueryWrapper<DoctorAdvice> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("doctor_advice_id", s.getDoctorAdviceId());
+                queryWrapper.eq("hospital_id", s.getHospitalId());
+                queryWrapper.eq("is_deleted",IsDeleteEnum.N);
+                int count = doctorAdviceService.count(queryWrapper);
+                if (count > 0) {
+                    doctorAdviceService.update(s, queryWrapper);
+                } else {
+                    doctorAdviceService.save(s);
+                }
+            });
+        }
+
+        // 病案首页诊断
+        List<HomeDiagnoseInfo> homeDiagnoseInfoList = dataImportVO.getHomeDiagnoseInfoList();
+        if (ListUtil.isNotEmpty(homeDiagnoseInfoList)) {
+            homeDiagnoseInfoList.forEach(s -> {
+                QueryWrapper<HomeDiagnoseInfo> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("home_page_id", s.getHomePageId());
+                queryWrapper.eq("hospital_id", s.getHospitalId());
+                queryWrapper.eq("diagnose_order_no", s.getDiagnoseOrderNo());
+                int count = homeDiagnoseInfoService.count(queryWrapper);
+                if (count > 0) {
+                    homeDiagnoseInfoService.update(s, queryWrapper);
+                } else {
+                    homeDiagnoseInfoService.save(s);
+                }
+            });
+        }
+
+        // 病案首页
+        List<HomePage> homePageList = dataImportVO.getHomePageList();
+        if (ListUtil.isNotEmpty(homePageList)) {
+            homePageList.stream().forEach(s -> {
+                // 姓名
+                if (StringUtil.isNotBlank(s.getName())) {
+                    s.setName(s.getName().substring(0, 1) + "**");
+                }
+                // 身份证
+                if (StringUtil.isNotBlank(s.getIdentityCardNo())) {
+                    s.setIdentityCardNo(s.getIdentityCardNo().substring(0, 1) + "*****************");
+                }
+                // 现住址电话
+                if (StringUtil.isNotBlank(s.getCurPhone())) {
+                    s.setCurPhone(s.getCurPhone().substring(0, 1) + "**");
+                }
+                // 工作单位电话
+                if (StringUtil.isNotBlank(s.getWorkPhone())) {
+                    s.setWorkPhone(s.getWorkPhone().substring(0, 1) + "**");
+                }
+                // 联系人姓名
+                if (StringUtil.isNotBlank(s.getContactName())) {
+                    s.setContactName(s.getContactName().substring(0, 1) + "**");
+                }
+                // 联系人电话
+                if (StringUtil.isNotBlank(s.getContactPhone())) {
+                    s.setContactPhone(s.getContactPhone().substring(0, 1) + "**");
+                }
+
+                QueryWrapper<HomePage> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("home_page_id", s.getHomePageId());
+                queryWrapper.eq("hospital_id", s.getHospitalId());
+                queryWrapper.eq("behospital_code", s.getBehospitalCode());
+                queryWrapper.eq("is_deleted",IsDeleteEnum.N);
+                int count = homePageService.count(queryWrapper);
+                if (count > 0) {
+                    homePageService.update(s, queryWrapper);
+                } else {
+                    homePageService.save(s);
+                }
+            });
+        }
+
+        // 病案首页手术信息
+        List<HomeOperationInfo> homeOperationInfoList = dataImportVO.getHomeOperationInfoList();
+        if (ListUtil.isNotEmpty(homeOperationInfoList)) {
+            homeOperationInfoList.forEach(s -> {
+                if(s.getHomePageId()!=null && !"".equals(s.getOperationOrderNo())) {
+                    QueryWrapper<HomeOperationInfo> queryWrapper = new QueryWrapper<>();
+                    queryWrapper.eq("home_page_id", s.getHomePageId());
+                    queryWrapper.eq("hospital_id", s.getHospitalId());
+                    queryWrapper.eq("operation_order_no", s.getOperationOrderNo());
+                    int count = homeOperationInfoService.count(queryWrapper);
+                    if (count > 0) {
+                        homeOperationInfoService.update(s, queryWrapper);
+                    } else {
+                        homeOperationInfoService.save(s);
+                    }
+                }
+            });
+        }
+
+        // 文书信息
+        List<MedicalRecord> medicalRecordList = dataImportVO.getMedicalRecordList();
+        if (ListUtil.isNotEmpty(medicalRecordList)) {
+            medicalRecordList.forEach(s -> {
+                QueryWrapper<MedicalRecord> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("rec_id", s.getRecId());
+                queryWrapper.eq("hospital_id", s.getHospitalId());
+                queryWrapper.eq("is_deleted",IsDeleteEnum.N);
+                int count = medicalRecordService.count(queryWrapper);
+                if (count > 0) {
+                    medicalRecordService.update(s, queryWrapper);
+                } else {
+                    medicalRecordService.save(s);
+                }
+            });
+        }
+
+        // 文书明细信息
+        List<MedicalRecordContent> medicalRecordContentList = dataImportVO.getMedicalRecordContentList();
+        if (ListUtil.isNotEmpty(medicalRecordContentList)) {
+            // 加密数据
+            if (encryptFlag) {
+                String recId = "";
+                try {
+                    EncrypDES encrypDES = new EncrypDES();
+                    for (MedicalRecordContent s : medicalRecordContentList) {
+                        recId = s.getRecId();
+                        if (StringUtil.isNotBlank(s.getXmlText())) {
+                            s.setXmlText(encrypDES.encrytor(s.getXmlText()));
+                        }
+                        QueryWrapper<MedicalRecordContent> queryWrapper = new QueryWrapper<>();
+                        queryWrapper.eq("rec_id", s.getRecId());
+                        queryWrapper.eq("hospital_id", s.getHospitalId());
+                        queryWrapper.eq("is_deleted",IsDeleteEnum.N);
+                        int count = medicalRecordContentService.count(queryWrapper);
+                        if (count > 0) {
+                            medicalRecordContentService.update(s, queryWrapper);
+                        } else {
+                            medicalRecordContentService.save(s);
+                        }
+                    }
+                } catch (Exception e) {
+                    throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "加密xml错误!recId=【" + recId + "】");
+                }
+            }
+        }
+        return true;
+    }
+
+
+    /**
+     * 模拟测试数据
+     *
+     * @return
+     */
+    public Boolean test() {
+        int size = 5;
+        Long hospitalId = 8L;
+        int random = (int)(Math.random() * 100);
+
+        DataImportVO dataImportVO = new DataImportVO();
+        dataImportVO.setHospitalId(hospitalId);
+
+        // // 病历信息
+        // List<BehospitalInfo> behospitalInfoList = behospitalInfoService.list(new QueryWrapper<BehospitalInfo>()
+        //         .ne("hospital_id", hospitalId)
+        //         .last(" limit " + size)
+        // );
+        // behospitalInfoList.forEach(r -> { r.setHospitalId(hospitalId); r.setBehospitalCode(r.getBehospitalCode() + random); });
+        // dataImportVO.setBehospitalInfoList(behospitalInfoList);
+        //
+        // // 医嘱信息
+        // List<DoctorAdvice> doctorAdviceList = doctorAdviceService.list(new QueryWrapper<DoctorAdvice>()
+        //         .ne("hospital_id", hospitalId)
+        //         .last(" limit " + size)
+        // );
+        // doctorAdviceList.forEach(r -> {r.setHospitalId(hospitalId); r.setBehospitalCode(r.getBehospitalCode() + random);});
+        // dataImportVO.setDoctorAdviceList(doctorAdviceList);
+        //
+        // // 病案首页诊断
+        // List<HomeDiagnoseInfo> homeDiagnoseInfoList = homeDiagnoseInfoService.list(new QueryWrapper<HomeDiagnoseInfo>()
+        //         .ne("hospital_id", hospitalId)
+        //         .last(" limit " + size)
+        // );
+        // homeDiagnoseInfoList.forEach(r -> {r.setHospitalId(hospitalId); r.setHomePageId(r.getHomePageId() + random);});
+        // dataImportVO.setHomeDiagnoseInfoList(homeDiagnoseInfoList);
+        //
+        // // 病案首页
+        // List<HomePage> homePageList = homePageService.list(new QueryWrapper<HomePage>()
+        //         .ne("hospital_id", hospitalId)
+        //         .last(" limit " + size)
+        // );
+        // homePageList.forEach(r -> {r.setHospitalId(hospitalId); r.setBehospitalCode(r.getBehospitalCode() + random);});
+        // dataImportVO.setHomePageList(homePageList);
+
+        // // 病案首页手术信息
+        // List<HomeOperationInfo> homeOperationInfoList = homeOperationInfoService.list(new QueryWrapper<HomeOperationInfo>()
+        //         .eq("hospital_id", hospitalId)
+        //         .last(" limit " + size)
+        // );
+        // homeOperationInfoList.forEach(r -> {r.setHospitalId(hospitalId); r.setHomePageId(r.getHomePageId() );});
+        // dataImportVO.setHomeOperationInfoList(homeOperationInfoList);
+        //
+        // // 文书信息
+        // List<MedicalRecord> medicalRecordList = medicalRecordService.list(new QueryWrapper<MedicalRecord>()
+        //         .ne("hospital_id", hospitalId)
+        //         .last(" limit " + size)
+        // );
+        // medicalRecordList.forEach(r -> {r.setHospitalId(hospitalId); r.setBehospitalCode(r.getBehospitalCode() + random);});
+        // dataImportVO.setMedicalRecordList(medicalRecordList);
+
+        // // 文书明细信息
+        // List<MedicalRecordContent> medicalRecordContentList = medicalRecordContentService.list(new QueryWrapper<MedicalRecordContent>()
+        //         .ne("hospital_id", hospitalId)
+        //         .last(" limit " + size)
+        // );
+        // medicalRecordContentList.forEach(r -> {r.setHospitalId(hospitalId); r.setRecId(r.getRecId() + random);});
+        // dataImportVO.setMedicalRecordContentList(medicalRecordContentList);
+
+        authServiceClient.dataimport(dataImportVO);
+        return true;
+    }
+}

+ 23 - 25
src/main/java/com/diagbot/facade/QcresultInfoFacade.java

@@ -254,32 +254,30 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                 break;
         }
 
-        //长兴的数据
-        if (algorithmVO.getHospitalId().equals(1L)) {
-            //质控模块评分数据
-            //逻辑删除数据
-            medQcresultCasesService.update(new UpdateWrapper<MedQcresultCases>()
-                    .eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("hospital_id", analyzeVO.getHospitalId())
-                    .eq("behospital_code", analyzeVO.getBehospitalCode())
-                    .set("is_deleted", IsDeleteEnum.Y.getKey())
-                    .set("modifier", useId)
-                    .set("gmt_modified", now));
-            //批量插入新的数据
-            List<MedQcresultCases> medQcresultCasesList = new ArrayList<>();
-            List<MedQcresultCasesVO> medQcresultCasesVOList = algorithmVO.getMedQcresultCasesVOList();
-            if (ListUtil.isNotEmpty(medQcresultCasesVOList)) {
-                for (MedQcresultCasesVO medQcresultCasesVO : medQcresultCasesVOList) {
-                    MedQcresultCases medQcresultCases = new MedQcresultCases();
-                    BeanUtil.copyProperties(medQcresultCasesVO, medQcresultCases);
-                    medQcresultCases.setGmtCreate(now);
-                    medQcresultCases.setCreator(useId.toString());
-                    medQcresultCases.setGmtModified(now);
-                    medQcresultCases.setModifier(useId.toString());
-                    medQcresultCasesList.add(medQcresultCases);
-                }
-                medQcresultCasesService.saveBatch(medQcresultCasesList);
+        //质控模块评分数据
+        //统一为长兴的算法
+        //逻辑删除数据
+        medQcresultCasesService.update(new UpdateWrapper<MedQcresultCases>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", analyzeVO.getHospitalId())
+                .eq("behospital_code", analyzeVO.getBehospitalCode())
+                .set("is_deleted", IsDeleteEnum.Y.getKey())
+                .set("modifier", useId)
+                .set("gmt_modified", now));
+        //批量插入新的数据
+        List<MedQcresultCases> medQcresultCasesList = new ArrayList<>();
+        List<MedQcresultCasesVO> medQcresultCasesVOList = algorithmVO.getMedQcresultCasesVOList();
+        if (ListUtil.isNotEmpty(medQcresultCasesVOList)) {
+            for (MedQcresultCasesVO medQcresultCasesVO : medQcresultCasesVOList) {
+                MedQcresultCases medQcresultCases = new MedQcresultCases();
+                BeanUtil.copyProperties(medQcresultCasesVO, medQcresultCases);
+                medQcresultCases.setGmtCreate(now);
+                medQcresultCases.setCreator(useId.toString());
+                medQcresultCases.setGmtModified(now);
+                medQcresultCases.setModifier(useId.toString());
+                medQcresultCasesList.add(medQcresultCases);
             }
+            medQcresultCasesService.saveBatch(medQcresultCasesList);
         }
         return now;
     }

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

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.BehospitalInfoDTO;
 import com.diagbot.dto.DeptNumDTO;
 import com.diagbot.dto.ExportExcelDTO;
+import com.diagbot.dto.HomePageNumDTO;
 import com.diagbot.dto.LevelStatisticsDTO;
 import com.diagbot.dto.MsgDTO;
 import com.diagbot.dto.NumDTO;
@@ -147,7 +148,7 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      * @param filterOrderVO
      * @return
      */
-    public List<LevelStatisticsDTO> homePageLevelStatistics(FilterOrderVO filterOrderVO);
+    public List<HomePageNumDTO> homePageLevelStatistics(FilterOrderVO filterOrderVO);
 
     /**
      * 各科室缺陷占比(主任医生)
@@ -163,7 +164,7 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      * @param filterOrderByDeptVO
      * @return
      */
-    public List<LevelStatisticsDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO);
+    public List<HomePageNumDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO);
 
     /**
      * 科室缺陷占比-科室(分页)
@@ -181,6 +182,14 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public List<LevelStatisticsDTO> levelStatisticsByDeptClass(FilterOrderVO filterOrderVO);
 
+    /**
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(上级科室允许为空)
+     *
+     * @param filterOrderVO
+     * @return
+     */
+    public List<LevelStatisticsDTO> levelStatisticsByDeptClass2(FilterOrderVO filterOrderVO);
+
 
     List<ExportExcelDTO> exportExcel();
 

+ 22 - 6
src/main/java/com/diagbot/mapper/QcresultInfoMapper.java

@@ -3,9 +3,9 @@ package com.diagbot.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.AverageStatisticsDTO;
-import com.diagbot.dto.CaseAndDeptNumDTO;
-import com.diagbot.dto.CaseNumDTO;
+import com.diagbot.dto.DeptEntryNumDTO;
 import com.diagbot.dto.DeptNumDTO;
+import com.diagbot.dto.EntryNumDTO;
 import com.diagbot.dto.NumDTO;
 import com.diagbot.dto.QcResultPercentDTO;
 import com.diagbot.entity.QcresultInfo;
@@ -114,7 +114,7 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
      * @param filterPageVO
      * @return
      */
-    public IPage<CaseNumDTO> entryCountGroupByEntryPage(@Param("filterPageVO") FilterPageVO filterPageVO);
+    public IPage<EntryNumDTO> entryCountGroupByEntryPage(@Param("filterPageVO") FilterPageVO filterPageVO);
 
     /**
      * 各科室质控平均分(分页)
@@ -146,14 +146,14 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
      * @param filterPageByDeptVO
      * @return
      */
-    public IPage<CaseAndDeptNumDTO> entryCountGroupByEntryAndDeptPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
+    public IPage<DeptEntryNumDTO> entryCountGroupByEntryAndDeptPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
 
     /**
      * 条目缺陷占比(内页)
      *
      * @return
      */
-    public IPage<NumDTO> entryGroupByEntryInnerPage(@Param("filterPageVO") FilterPageVO filterPageVO);
+    public IPage<EntryNumDTO> entryGroupByEntryInnerPage(@Param("filterPageVO") FilterPageVO filterPageVO);
 
     /**
      * 条目缺陷占比-科室(内页)
@@ -161,7 +161,7 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
      * @param filterPageByDeptVO
      * @return
      */
-    public IPage<DeptNumDTO> entryGroupByEntryAndDeptInnerPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
+    public IPage<DeptEntryNumDTO> entryGroupByEntryAndDeptInnerPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
 
     /**
      * 各科室质控平均分(首页)-根据内外科系统统计
@@ -170,4 +170,20 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
      * @return
      */
     public List<AverageStatisticsDTO> getAverageScoreByDeptClass(FilterVO filterVO);
+
+    /**
+     * 单项否决缺陷占比
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<EntryNumDTO> entryRejectPercent(FilterVO filterVO);
+
+    /**
+     * 各科室甲/乙/丙级病历占比
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<DeptNumDTO> qcResultLevelPercent(FilterVO filterVO);
 }

+ 11 - 2
src/main/java/com/diagbot/service/BehospitalInfoService.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.dto.BehospitalInfoDTO;
 import com.diagbot.dto.DeptNumDTO;
 import com.diagbot.dto.ExportExcelDTO;
+import com.diagbot.dto.HomePageNumDTO;
 import com.diagbot.dto.LevelStatisticsDTO;
 import com.diagbot.dto.MsgDTO;
 import com.diagbot.dto.NumDTO;
@@ -148,7 +149,7 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      * @param filterOrderVO
      * @return
      */
-    public List<LevelStatisticsDTO> homePageLevelStatistics(FilterOrderVO filterOrderVO);
+    public List<HomePageNumDTO> homePageLevelStatistics(FilterOrderVO filterOrderVO);
 
     /**
      * 各科室缺陷占比(主任医生)
@@ -164,7 +165,7 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      * @param filterOrderByDeptVO
      * @return
      */
-    public List<LevelStatisticsDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO);
+    public List<HomePageNumDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO);
 
     /**
      * 缺陷明细-科室(分页)
@@ -182,6 +183,14 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      */
     public List<LevelStatisticsDTO> levelStatisticsByDeptClass(FilterOrderVO filterOrderVO);
 
+    /**
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(上级科室允许为空)
+     *
+     * @param filterOrderVO
+     * @return
+     */
+    public List<LevelStatisticsDTO> levelStatisticsByDeptClass2(FilterOrderVO filterOrderVO);
+
     List<ExportExcelDTO> exportExcel();
 
     /**

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

@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * </p>
  *
  * @author zhoutg
- * @since 2020-05-28
+ * @since 2020-06-02
  */
 public interface MedCrisisInfoService extends IService<MedCrisisInfo> {
 

+ 22 - 6
src/main/java/com/diagbot/service/QcresultInfoService.java

@@ -3,9 +3,9 @@ package com.diagbot.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.dto.AverageStatisticsDTO;
-import com.diagbot.dto.CaseAndDeptNumDTO;
-import com.diagbot.dto.CaseNumDTO;
+import com.diagbot.dto.DeptEntryNumDTO;
 import com.diagbot.dto.DeptNumDTO;
+import com.diagbot.dto.EntryNumDTO;
 import com.diagbot.dto.NumDTO;
 import com.diagbot.dto.QcResultPercentDTO;
 import com.diagbot.entity.QcresultInfo;
@@ -115,7 +115,7 @@ public interface QcresultInfoService extends IService<QcresultInfo> {
      * @param filterPageVO
      * @return
      */
-    public IPage<CaseNumDTO> entryCountGroupByEntryPage(@Param("filterPageVO") FilterPageVO filterPageVO);
+    public IPage<EntryNumDTO> entryCountGroupByEntryPage(@Param("filterPageVO") FilterPageVO filterPageVO);
 
     /**
      * 各科室质控平均分(分页)
@@ -147,14 +147,14 @@ public interface QcresultInfoService extends IService<QcresultInfo> {
      * @param filterPageByDeptVO
      * @return
      */
-    public IPage<CaseAndDeptNumDTO> entryCountGroupByEntryAndDeptPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
+    public IPage<DeptEntryNumDTO> entryCountGroupByEntryAndDeptPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
 
     /**
      * 条目缺陷占比(内页)
      *
      * @return
      */
-    public IPage<NumDTO> entryGroupByEntryInnerPage(@Param("filterPageVO") FilterPageVO filterPageVO);
+    public IPage<EntryNumDTO> entryGroupByEntryInnerPage(@Param("filterPageVO") FilterPageVO filterPageVO);
 
     /**
      * 条目缺陷占比-科室(内页)
@@ -162,7 +162,7 @@ public interface QcresultInfoService extends IService<QcresultInfo> {
      * @param filterPageByDeptVO
      * @return
      */
-    public IPage<DeptNumDTO> entryGroupByEntryAndDeptInnerPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
+    public IPage<DeptEntryNumDTO> entryGroupByEntryAndDeptInnerPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
 
     /**
      * 各科室质控平均分(首页)-根据内外科系统统计
@@ -171,4 +171,20 @@ public interface QcresultInfoService extends IService<QcresultInfo> {
      * @return
      */
     public List<AverageStatisticsDTO> getAverageScoreByDeptClass(FilterVO filterVO);
+
+    /**
+     * 单项否决缺陷占比
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<EntryNumDTO> entryRejectPercent(FilterVO filterVO);
+
+    /**
+     * 各科室甲/乙/丙级病历占比
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<DeptNumDTO> qcResultLevelPercent(FilterVO filterVO);
 }

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

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.dto.BehospitalInfoDTO;
 import com.diagbot.dto.DeptNumDTO;
 import com.diagbot.dto.ExportExcelDTO;
+import com.diagbot.dto.HomePageNumDTO;
 import com.diagbot.dto.LevelStatisticsDTO;
 import com.diagbot.dto.MsgDTO;
 import com.diagbot.dto.NumDTO;
@@ -198,7 +199,7 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
      * @return
      */
     @Override
-    public List<LevelStatisticsDTO> homePageLevelStatistics(FilterOrderVO filterOrderVO) {
+    public List<HomePageNumDTO> homePageLevelStatistics(FilterOrderVO filterOrderVO) {
         return baseMapper.homePageLevelStatistics(filterOrderVO);
     }
 
@@ -220,7 +221,7 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
      * @return
      */
     @Override
-    public List<LevelStatisticsDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO) {
+    public List<HomePageNumDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO) {
         return baseMapper.homePageLevelStatisticsByDept(filterOrderByDeptVO);
     }
 
@@ -245,8 +246,19 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
         return baseMapper.levelStatisticsByDeptClass(filterOrderVO);
     }
 
+    /**
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(上级科室允许为空)
+     *
+     * @param filterOrderVO
+     * @return
+     */
+    @Override
+    public List<LevelStatisticsDTO> levelStatisticsByDeptClass2(FilterOrderVO filterOrderVO) {
+        return baseMapper.levelStatisticsByDeptClass2(filterOrderVO);
+    }
+
     @Override
-    public List<ExportExcelDTO> exportExcel(){
+    public List<ExportExcelDTO> exportExcel() {
         return baseMapper.exportExcel();
     }
 
@@ -266,7 +278,7 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
      * @param exportQcresultVO
      * @return
      */
-    public List<ExportExcelDTO> exportQcresultByDept(ExportQcresultVO exportQcresultVO){
+    public List<ExportExcelDTO> exportQcresultByDept(ExportQcresultVO exportQcresultVO) {
         return baseMapper.exportQcresultByDept(exportQcresultVO);
     }
 

+ 28 - 6
src/main/java/com/diagbot/service/impl/QcresultInfoServiceImpl.java

@@ -3,9 +3,9 @@ package com.diagbot.service.impl;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.dto.AverageStatisticsDTO;
-import com.diagbot.dto.CaseAndDeptNumDTO;
-import com.diagbot.dto.CaseNumDTO;
+import com.diagbot.dto.DeptEntryNumDTO;
 import com.diagbot.dto.DeptNumDTO;
+import com.diagbot.dto.EntryNumDTO;
 import com.diagbot.dto.NumDTO;
 import com.diagbot.dto.QcResultPercentDTO;
 import com.diagbot.entity.QcresultInfo;
@@ -150,7 +150,7 @@ public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, Qcr
      * @return
      */
     @Override
-    public IPage<CaseNumDTO> entryCountGroupByEntryPage(@Param("filterPageVO") FilterPageVO filterPageVO) {
+    public IPage<EntryNumDTO> entryCountGroupByEntryPage(@Param("filterPageVO") FilterPageVO filterPageVO) {
         return baseMapper.entryCountGroupByEntryPage(filterPageVO);
     }
 
@@ -194,7 +194,7 @@ public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, Qcr
      * @return
      */
     @Override
-    public IPage<CaseAndDeptNumDTO> entryCountGroupByEntryAndDeptPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO) {
+    public IPage<DeptEntryNumDTO> entryCountGroupByEntryAndDeptPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO) {
         return baseMapper.entryCountGroupByEntryAndDeptPage(filterPageByDeptVO);
     }
 
@@ -204,7 +204,7 @@ public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, Qcr
      * @return
      */
     @Override
-    public IPage<NumDTO> entryGroupByEntryInnerPage(@Param("filterPageVO") FilterPageVO filterPageVO) {
+    public IPage<EntryNumDTO> entryGroupByEntryInnerPage(@Param("filterPageVO") FilterPageVO filterPageVO) {
         return baseMapper.entryGroupByEntryInnerPage(filterPageVO);
     }
 
@@ -215,7 +215,7 @@ public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, Qcr
      * @return
      */
     @Override
-    public IPage<DeptNumDTO> entryGroupByEntryAndDeptInnerPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO) {
+    public IPage<DeptEntryNumDTO> entryGroupByEntryAndDeptInnerPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO) {
         return baseMapper.entryGroupByEntryAndDeptInnerPage(filterPageByDeptVO);
     }
 
@@ -229,4 +229,26 @@ public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, Qcr
     public List<AverageStatisticsDTO> getAverageScoreByDeptClass(FilterVO filterVO) {
         return baseMapper.getAverageScoreByDeptClass(filterVO);
     }
+
+    /**
+     * 单项否决缺陷占比
+     *
+     * @param filterVO
+     * @return
+     */
+    @Override
+    public List<EntryNumDTO> entryRejectPercent(FilterVO filterVO) {
+        return baseMapper.entryRejectPercent(filterVO);
+    }
+
+    /**
+     * 各科室甲/乙/丙级病历占比
+     *
+     * @param filterVO
+     * @return
+     */
+    @Override
+    public List<DeptNumDTO> qcResultLevelPercent(FilterVO filterVO) {
+        return baseMapper.qcResultLevelPercent(filterVO);
+    }
 }

+ 2 - 0
src/main/java/com/diagbot/task/TASK_CX.java

@@ -18,6 +18,7 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
 import org.springframework.scheduling.support.CronTrigger;
 
 import java.time.LocalDateTime;
+import java.util.Arrays;
 import java.util.Date;
 
 /**
@@ -54,6 +55,7 @@ public class TASK_CX implements SchedulingConfigurer {
                     log.info("执行动态定时任务: " + LocalDateTime.now().toLocalTime());
                     TaskVO taskVO = new TaskVO();
                     taskVO.setType(1); // 类型过滤(1:出院时间比当前时间早3天前的病历(例如:长兴病历))
+                    taskVO.setIndividuation(Arrays.asList(1)); //个性化需求【1:近3天不含当天的病历强制评分更新】
                     behospitalInfoFacade.execute(taskVO, param);
                 }
             }

+ 42 - 0
src/main/java/com/diagbot/vo/DataImportVO.java

@@ -0,0 +1,42 @@
+package com.diagbot.vo;
+
+import com.diagbot.entity.BehospitalInfo;
+import com.diagbot.entity.DoctorAdvice;
+import com.diagbot.entity.HomeDiagnoseInfo;
+import com.diagbot.entity.HomeOperationInfo;
+import com.diagbot.entity.HomePage;
+import com.diagbot.entity.MedCrisisInfo;
+import com.diagbot.entity.MedicalRecord;
+import com.diagbot.entity.MedicalRecordContent;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2020/4/14 9:53
+ */
+@Data
+public class DataImportVO {
+    // 医院ID
+    @NotNull(message = "医院ID不能为空")
+    private Long hospitalId;
+    // 病历信息
+    private List<BehospitalInfo> behospitalInfoList;
+    // 危急值信息
+    private List<MedCrisisInfo> medCrisisInfoList;
+    // 病人医嘱
+    private List<DoctorAdvice> doctorAdviceList;
+    // 病案首页诊断
+    private List<HomeDiagnoseInfo> homeDiagnoseInfoList;
+    // 病案首页
+    private List<HomePage> homePageList;
+    // 病案首页手术信息
+    private List<HomeOperationInfo> homeOperationInfoList;
+    // 文书信息
+    private List<MedicalRecord> medicalRecordList;
+    // 文书明细信息
+    private List<MedicalRecordContent> medicalRecordContentList;
+}

+ 10 - 0
src/main/java/com/diagbot/vo/FilterPageVO.java

@@ -60,4 +60,14 @@ public class FilterPageVO extends Page {
      * 模块名称
      */
     private String casesName;
+
+    /**
+     * 单项否决
+     */
+    private Integer isReject;
+
+    /**
+     * 规则类型(0:无,1:空项,2:错误)
+     */
+    private Integer ruleType;
 }

+ 2 - 0
src/main/java/com/diagbot/vo/FilterVO.java

@@ -47,4 +47,6 @@ public class FilterVO {
      * 科室分类
      */
     private String deptClass;
+
+    private String level;
 }

+ 1 - 3
src/main/java/com/diagbot/vo/QcCasesEntryHospitalVO.java

@@ -1,14 +1,11 @@
 package com.diagbot.vo;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.diagbot.enums.SysTypeEnum;
 import com.diagbot.util.SysUserUtils;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 
-import javax.validation.constraints.NotNull;
-
 /**
  * @author wangfeng
  * @Description:
@@ -24,4 +21,5 @@ public class QcCasesEntryHospitalVO extends Page {
     private String name;
     private Integer isReject;
     private Integer isUsed;
+    private Integer ruleType;
 }

+ 8 - 1
src/main/java/com/diagbot/vo/TaskVO.java

@@ -22,5 +22,12 @@ public class TaskVO {
     private List<Long> hosptialIdList;
     // 筛选病历数据:0:未评分的病历,推荐使用;1:全部病历,谨慎使用
     private Integer filterFlag = 0;
-
+    // 个性化需求【1:近3天不含当天的病历强制评分更新】
+    private List<Integer> individuation;
+    // 出院时间过滤
+    @ApiModelProperty(hidden = true)
+    private Date startLeaveDate;
+    // 出院时间过滤
+    @ApiModelProperty(hidden = true)
+    private Date endLeaveDate;
 }

+ 14 - 9
src/main/java/com/diagbot/web/ConsoleByDeptController.java

@@ -2,9 +2,10 @@ package com.diagbot.web;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
-import com.diagbot.dto.CaseAndDeptNumDTO;
 import com.diagbot.dto.DeptBaseDTO;
+import com.diagbot.dto.DeptEntryNumDTO;
 import com.diagbot.dto.DeptNumDTO;
+import com.diagbot.dto.HomePageNumDTO;
 import com.diagbot.dto.LevelStatisticsDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.ConsoleByDeptFacade;
@@ -89,7 +90,7 @@ public class ConsoleByDeptController {
                     "desc: 排序(降序) <br>")
     @PostMapping("/homePageLevelByDeptLimit")
     @SysLogger("homePageLevelByDeptLimit")
-    public RespDTO<List<LevelStatisticsDTO>> homePageLevelByDeptLimit(@RequestBody @Valid FilterOrderByDeptVO filterOrderByDeptVO) {
+    public RespDTO<List<HomePageNumDTO>> homePageLevelByDeptLimit(@RequestBody @Valid FilterOrderByDeptVO filterOrderByDeptVO) {
         return RespDTO.onSuc(consoleByDeptFacade.homePageLevelByDeptLimit(filterOrderByDeptVO));
     }
     //endregion -----------------------首页接口结束------------------------------
@@ -120,11 +121,13 @@ public class ConsoleByDeptController {
                     "name: 缺陷名称<br>" +
                     "deptName: 科室名称(必填)<br>" +
                     "casesId: 模块id:243=病案首页 <br>" +
-                    "casesName: 模块名称<br>")
+                    "casesName: 模块名称<br>"+
+                    "isReject: 单项否决 1-否决,0-非<br>" +
+                    "ruleType: 规则类型 0:无,1:空项,2:错误<br>")
     @PostMapping("/entryCountGroupByEntryAndDeptPage")
     @SysLogger("entryCountGroupByEntryAndDeptPage")
-    public RespDTO<IPage<CaseAndDeptNumDTO>> entryCountGroupByEntryAndDeptPage(@RequestBody @Valid FilterPageByDeptVO filterPageByDeptVO) {
-        IPage<CaseAndDeptNumDTO> data = consoleByDeptFacade.entryCountGroupByEntryAndDeptPage(filterPageByDeptVO);
+    public RespDTO<IPage<DeptEntryNumDTO>> entryCountGroupByEntryAndDeptPage(@RequestBody @Valid FilterPageByDeptVO filterPageByDeptVO) {
+        IPage<DeptEntryNumDTO> data = consoleByDeptFacade.entryCountGroupByEntryAndDeptPage(filterPageByDeptVO);
         return RespDTO.onSuc(data);
     }
 
@@ -150,11 +153,13 @@ public class ConsoleByDeptController {
     @ApiOperation(value = "条目缺陷占比-内页(分页)-内页[by:zhaops]",
             notes = "type: 统计维度 1-本月,2-本年(必填)<br>" +
                     "name: 缺陷名称<br>" +
-                    "deptName: 科室名称(必填)<br>")
+                    "deptName: 科室名称(必填)<br>" +
+                    "isReject: 单项否决 1-否决,0-非<br>" +
+                    "casesName: 模块名称<br>")
     @PostMapping("/entryGroupByEntryAndDeptInnerPage")
     @SysLogger("entryGroupByEntryAndDeptInnerPage")
-    public RespDTO<IPage<DeptNumDTO>> entryGroupByEntryAndDeptInnerPage(@RequestBody @Valid FilterPageByDeptVO filterPageByDeptVO) {
-        IPage<DeptNumDTO> data = consoleByDeptFacade.entryGroupByEntryAndDeptInnerPage(filterPageByDeptVO);
+    public RespDTO<IPage<DeptEntryNumDTO>> entryGroupByEntryAndDeptInnerPage(@RequestBody @Valid FilterPageByDeptVO filterPageByDeptVO) {
+        IPage<DeptEntryNumDTO> data = consoleByDeptFacade.entryGroupByEntryAndDeptInnerPage(filterPageByDeptVO);
         return RespDTO.onSuc(data);
     }
 
@@ -192,7 +197,7 @@ public class ConsoleByDeptController {
                     "desc: 排序(降序) <br>")
     @PostMapping("/homePageLevelStatisticsByDept")
     @SysLogger("homePageLevelStatisticsByDept")
-    public RespDTO<List<LevelStatisticsDTO>> homePageLevelStatisticsByDept(@RequestBody @Valid FilterOrderByDeptVO filterOrderByDeptVO) {
+    public RespDTO<List<HomePageNumDTO>> homePageLevelStatisticsByDept(@RequestBody @Valid FilterOrderByDeptVO filterOrderByDeptVO) {
         return RespDTO.onSuc(consoleByDeptFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO));
     }
 

+ 43 - 8
src/main/java/com/diagbot/web/ConsoleController.java

@@ -3,7 +3,9 @@ package com.diagbot.web;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.AverageStatisticsDTO;
-import com.diagbot.dto.CaseNumDTO;
+import com.diagbot.dto.DeptNumDTO;
+import com.diagbot.dto.EntryNumDTO;
+import com.diagbot.dto.HomePageNumDTO;
 import com.diagbot.dto.LevelStatisticsDTO;
 import com.diagbot.dto.NumDTO;
 import com.diagbot.dto.RespDTO;
@@ -123,7 +125,7 @@ public class ConsoleController {
      */
     @ApiOperation(value = "各科室质控平均分(首页)-根据内外科系统统计[by:zhaops]",
             notes = "type: 统计维度 1-本月,2-本年(必填)<br>" +
-                    "deptClass: 科室分类:内科/外科,全部不传 <br>" )
+                    "deptClass: 科室分类:内科/外科,全部不传 <br>")
     @PostMapping("/getAverageScoreByDeptClass")
     @SysLogger("getAverageScoreByDeptClass")
     public RespDTO<Map<String, Object>> getAverageScoreByDeptClass(@RequestBody @Valid FilterVO filterVO) {
@@ -193,13 +195,44 @@ public class ConsoleController {
      * @return
      */
     @ApiOperation(value = "条目缺陷占比(首页)[by:zhaops]",
-            notes = "type: 统计维度 1-本月,2-本年(必填)<br>")
+            notes = "type: 统计维度 1-本月,2-本年(必填)<br>" +
+                    "isReject: 单项否决 1-否决,0-非<br>" +
+                    "casesName: 模块名称<br>")
     @PostMapping("/entryCountGroupByEntry")
     @SysLogger("entryCountGroupByEntry")
     public RespDTO<Map<String, Object>> entryCountGroupByEntry(@RequestBody @Valid FilterVO filterVO) {
         return RespDTO.onSuc(consoleFacade.entryCountGroupByEntry(filterVO));
     }
 
+    /**
+     * 单项否决缺陷占比
+     *
+     * @param filterVO
+     * @return
+     */
+    @ApiOperation(value = "单项否决缺陷占比(首页)[by:zhaops]",
+            notes = "type: 统计维度 1-本月,2-本年(必填)<br>")
+    @PostMapping("/entryRejectPercent")
+    @SysLogger("entryRejectPercent")
+    public RespDTO<List<EntryNumDTO>> entryRejectPercent(@RequestBody @Valid FilterVO filterVO) {
+        return RespDTO.onSuc(consoleFacade.entryRejectPercent(filterVO));
+    }
+
+    /**
+     * 单项否决缺陷占比
+     *
+     * @param filterVO
+     * @return
+     */
+    @ApiOperation(value = "各科室甲/乙/丙级病历占比(首页)[by:zhaops]",
+            notes = "type: 统计维度 1-本月,2-本年(必填)<br>" +
+                    "level: 病历等级 甲、乙、丙(必填)<br>")
+    @PostMapping("/qcResultLevelPercent")
+    @SysLogger("qcResultLevelPercent")
+    public RespDTO<List<DeptNumDTO>> qcResultLevelPercent(@RequestBody @Valid FilterVO filterVO) {
+        return RespDTO.onSuc(consoleFacade.qcResultLevelPercent(filterVO));
+    }
+
     /**
      * 各科室缺陷占比
      *
@@ -241,10 +274,12 @@ public class ConsoleController {
             notes = "type: 统计维度 1-本月,2-本年(必填)<br>" +
                     "deptName: 科室名称 <br>" +
                     "casesId: 模块id:243=病案首页 <br>" +
-                    "casesName: 模块名称 <br>")
+                    "casesName: 模块名称 <br>" +
+                    "isReject: 单项否决 1-否决,0-非<br>" +
+                    "ruleType: 规则类型 0:无,1:空项,2:错误<br>")
     @PostMapping("/entryCountGroupByEntryPage")
     @SysLogger("entryCountGroupByEntryPage")
-    public RespDTO<IPage<CaseNumDTO>> entryCountGroupByEntryPage(@RequestBody @Valid FilterPageVO filterPageVO) {
+    public RespDTO<IPage<EntryNumDTO>> entryCountGroupByEntryPage(@RequestBody @Valid FilterPageVO filterPageVO) {
         return RespDTO.onSuc(consoleFacade.entryCountGroupByEntryPage(filterPageVO));
     }
 
@@ -330,7 +365,7 @@ public class ConsoleController {
             notes = "type: 统计维度 1-本月,2-本年(必填)<br>")
     @PostMapping("/entryGroupByEntryInnerPage")
     @SysLogger("entryGroupByEntryInnerPage")
-    public RespDTO<IPage<NumDTO>> entryGroupByEntryInnerPage(@RequestBody @Valid FilterPageVO filterPageVO) {
+    public RespDTO<IPage<EntryNumDTO>> entryGroupByEntryInnerPage(@RequestBody @Valid FilterPageVO filterPageVO) {
         return RespDTO.onSuc(consoleFacade.entryGroupByEntryInnerPage(filterPageVO));
     }
     //endregion-----------------------分页接口结束-------------------------------
@@ -386,7 +421,7 @@ public class ConsoleController {
                     "desc: 排序(降序) <br>")
     @PostMapping("/homePageLevelStatistics")
     @SysLogger("homePageLevelStatistics")
-    public RespDTO<List<LevelStatisticsDTO>> homePageLevelStatistics(@RequestBody @Valid FilterOrderVO filterOrderVO) {
+    public RespDTO<List<HomePageNumDTO>> homePageLevelStatistics(@RequestBody @Valid FilterOrderVO filterOrderVO) {
         return RespDTO.onSuc(consoleFacade.homePageLevelStatistics(filterOrderVO));
     }
 
@@ -404,7 +439,7 @@ public class ConsoleController {
                     "desc: 排序(降序) <br>")
     @PostMapping("/homePageLevelLimit")
     @SysLogger("homePageLevelLimit")
-    public RespDTO<List<LevelStatisticsDTO>> homePageLevelLimit(@RequestBody @Valid FilterOrderVO filterOrderVO) {
+    public RespDTO<List<HomePageNumDTO>> homePageLevelLimit(@RequestBody @Valid FilterOrderVO filterOrderVO) {
         return RespDTO.onSuc(consoleFacade.homePageLevelLimit(filterOrderVO));
     }
 }

+ 99 - 0
src/main/java/com/diagbot/web/DataImportController.java

@@ -0,0 +1,99 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.DataImportFacade;
+import com.diagbot.vo.DataImportVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+
+/**
+ * <p>
+ * 数据导入 前端控制器
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-04-27
+ */
+@RestController
+@RequestMapping("/qc/dataimport")
+@SuppressWarnings("unchecked")
+@Api(value = "数据导入API", tags = { "数据导入API" })
+public class DataImportController {
+
+    @Autowired
+    DataImportFacade dataImportFacade;
+
+    @ApiOperation(value = "导入数据【全部删除,全部新增,效率高】[by:zhoutg]",
+            notes = "// 医院ID\n" +
+                    " Long hospitalId;\n" +
+                    "// 病历信息\n" +
+                    "List<BehospitalInfo> behospitalInfoList;\n" +
+                    "// 危急值信息\n" +
+                    "List<MedCrisisInfo> medCrisisInfoList;\n" +
+                    "// 病人医嘱\n" +
+                    "List<DoctorAdvice> doctorAdviceList;\n" +
+                    "// 病案首页诊断\n" +
+                    "List<HomeDiagnoseInfo> homeDiagnoseInfoList;\n" +
+                    "// 病案首页\n" +
+                    "List<HomePage> homePageList;\n" +
+                    "// 病案首页手术信息\n" +
+                    "List<HomeOperationInfo> homeOperationInfoList;\n" +
+                    "// 文书信息\n" +
+                    "List<MedicalRecord> medicalRecordList;\n" +
+                    "// 文书明细信息\n" +
+                    "List<MedicalRecordContent> medicalRecordContentList;")
+    @PostMapping("/import")
+    @SysLogger("import")
+    @Transactional
+    public RespDTO<Boolean> dataimport(@RequestBody @Valid DataImportVO dataImportVO) {
+        Boolean data = dataImportFacade.dataImportFacade(dataImportVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "导入数据【更新数据,单条执行,效率低,备用】[by:zhoutg]",
+            notes = "// 医院ID\n" +
+                    " Long hospitalId;\n" +
+                    "// 病历信息\n" +
+                    "List<BehospitalInfo> behospitalInfoList;\n" +
+                    "// 危急值信息\n" +
+                    "List<MedCrisisInfo> medCrisisInfoList;\n" +
+                    "// 病人医嘱\n" +
+                    "List<DoctorAdvice> doctorAdviceList;\n" +
+                    "// 病案首页诊断\n" +
+                    "List<HomeDiagnoseInfo> homeDiagnoseInfoList;\n" +
+                    "// 病案首页\n" +
+                    "List<HomePage> homePageList;\n" +
+                    "// 病案首页手术信息\n" +
+                    "List<HomeOperationInfo> homeOperationInfoList;\n" +
+                    "// 文书信息\n" +
+                    "List<MedicalRecord> medicalRecordList;\n" +
+                    "// 文书明细信息\n" +
+                    "List<MedicalRecordContent> medicalRecordContentList;")
+    @PostMapping("/dataimportPrepare")
+    @SysLogger("dataimportPrepare")
+    @Transactional
+    public RespDTO<Boolean> dataimportPrepare(@RequestBody @Valid DataImportVO dataImportVO) {
+        Boolean data = dataImportFacade.dataImportPrepareFacade(dataImportVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "模拟测试数据[by:zhoutg]",
+            notes = "")
+    @PostMapping("/test")
+    @SysLogger("test")
+    @Transactional
+    public RespDTO<Boolean> test() {
+        Boolean data = dataImportFacade.test();
+        return RespDTO.onSuc(data);
+    }
+
+}

+ 4 - 0
src/main/resources/application-dev.yml

@@ -121,6 +121,10 @@ spring:
         min-idle: 0 # 连接池中的最小空闲连接
     timeout: 20000 # 连接超时时间(毫秒)
 
+  servlet:
+    multipart:
+      max-request-size: 2048MB
+
 #mybatis
 mybatis-plus:
   mapper-locations: classpath:/mapper/*Mapper.xml

+ 4 - 0
src/main/resources/application-local.yml

@@ -121,6 +121,10 @@ spring:
         min-idle: 0 # 连接池中的最小空闲连接
     timeout: 20000 # 连接超时时间(毫秒)
 
+  servlet:
+    multipart:
+      max-request-size: 2048MB
+
 #mybatis
 mybatis-plus:
   mapper-locations: classpath:/mapper/*Mapper.xml

+ 4 - 0
src/main/resources/application-pre.yml

@@ -121,6 +121,10 @@ spring:
         min-idle: 0 # 连接池中的最小空闲连接
     timeout: 20000 # 连接超时时间(毫秒)
 
+  servlet:
+    multipart:
+      max-request-size: 2048MB
+
 #mybatis
 mybatis-plus:
   mapper-locations: classpath:/mapper/*Mapper.xml

+ 4 - 0
src/main/resources/application-pro.yml

@@ -121,6 +121,10 @@ spring:
         min-idle: 0 # 连接池中的最小空闲连接
     timeout: 20000 # 连接超时时间(毫秒)
 
+  servlet:
+    multipart:
+      max-request-size: 2048MB
+
 #mybatis
 mybatis-plus:
   mapper-locations: classpath:/mapper/*Mapper.xml

+ 4 - 0
src/main/resources/application-test.yml

@@ -121,6 +121,10 @@ spring:
         min-idle: 0 # 连接池中的最小空闲连接
     timeout: 20000 # 连接超时时间(毫秒)
 
+  servlet:
+    multipart:
+      max-request-size: 2048MB
+
 #mybatis
 mybatis-plus:
   mapper-locations: classpath:/mapper/*Mapper.xml

+ 475 - 41
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -92,6 +92,7 @@
             and t.is_placefile = #{isPlacefile}
         </if>
         and t.qc_type_id != 0
+        and t.is_placefile = 1
     </select>
 
     <select id="getMsg" resultType="com.diagbot.dto.MsgDTO">
@@ -200,6 +201,7 @@
         select * from med_behospital_info a
         where a.is_deleted = 'N'
         and a.qc_type_id != 0
+        and a.is_placefile = 1
         <if test="filterFlag != null and filterFlag == 0">
             and
             not EXISTS (
@@ -222,6 +224,25 @@
                 #{item}
             </foreach>
         </if>
+        <if test="individuation != null and individuation.contains(1)">
+            union
+            select * from med_behospital_info b
+            where b.is_deleted = 'N'
+            and b.qc_type_id != 0
+            and b.is_placefile = 1
+            <if test="startLeaveDate != null">
+                <![CDATA[ and b.leave_hospital_date >= #{startLeaveDate}]]>
+            </if>
+            <if test="endLeaveDate != null">
+                <![CDATA[ and b.leave_hospital_date <= #{endLeaveDate}]]>
+            </if>
+            <if test="hosptialIdList != null and hosptialIdList.size > 0 ">
+                and b.hospital_id in
+                <foreach collection="hosptialIdList" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </if>
     </select>
 
     <!--质控评分(科室)分页-->
@@ -295,6 +316,7 @@
             and t.is_placefile = #{isPlacefile}
         </if>
         and t.qc_type_id != 0
+        and t.is_placefile = 1
     </select>
 
     <!--质控评分(个人)分页-->
@@ -365,6 +387,7 @@
             and t.is_placefile = #{isPlacefile}
         </if>
         and t.qc_type_id != 0
+        and t.is_placefile = 1
     </select>
 
     <!-- 出院总人数统计-全院-首页 -->
@@ -401,7 +424,10 @@
         AND a.behospital_code = b.behospital_code
         AND a.is_placefile = '1'
         -- AND ( b.age IS NULL OR b.age = '-' OR b.age = '' )
-        <![CDATA[AND ( b.newborn_month IS NOT NULL OR b.newborn_month <> '' OR b.newborn_day IS NOT NULL OR b.newborn_day <> '' )]]>
+        AND (
+        ( IFNULL( b.newborn_day, '' ) != '' AND b.newborn_day != '0' )
+        OR ( IFNULL( b.newborn_month, '' )!= '' AND b.newborn_month != '0' )
+        )
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
@@ -1185,9 +1211,225 @@
         </if>
     </select>
 
+    <!-- 各科室缺陷占比(组合)-全院-根据内外科系统统计(上级科室允许为空) -->
+    <select id="levelStatisticsByDeptClass2" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
+        SELECT
+        t1.deptId,
+        t1.deptName,
+        t1.deptClassId,
+        t1.deptClass,
+        t2.entryNum,
+        t1.mrNum,
+        t1.totleValue,
+        t1.averageValue,
+        t1.firstLevelNum,
+        t1.secondLevelNum,
+        t1.thirdLevelNum,
+        t1.firstLevelPercent,
+        t1.secondLevelPercent,
+        t1.thirdLevelPercent,
+        t1.firstLevelPercentStr,
+        t1.secondLevelPercentStr,
+        t1.thirdLevelPercentStr
+        FROM
+        (
+        SELECT
+        tt1.deptId,
+        tt1.deptName,
+        e.dept_id AS deptClassId,
+        e.dept_name AS deptClass,
+        count( DISTINCT tt1.behospitalCode ) AS mrNum,
+        ROUND( sum( CAST( tt1.score AS DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
+        ROUND( sum( CAST( tt1.score AS DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
+        COUNT( DISTINCT CASE WHEN tt1.`level` = '甲' THEN tt1.behospitalCode END ) AS firstLevelNum,
+        COUNT( DISTINCT CASE WHEN tt1.`level` = '乙' THEN tt1.behospitalCode END ) AS secondLevelNum,
+        COUNT( DISTINCT CASE WHEN tt1.`level` = '丙' THEN tt1.behospitalCode END ) AS thirdLevelNum,
+        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '甲' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode ), 4 ) AS firstLevelPercent,
+        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '乙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode ), 4 ) AS secondLevelPercent,
+        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '丙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode ), 4 ) AS thirdLevelPercent,
+        concat(
+        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '甲' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode )* 100, 2 ),
+        '%'
+        ) AS firstLevelPercentStr,
+        concat(
+        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '乙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode )* 100, 2 ),
+        '%'
+        ) AS secondLevelPercentStr,
+        concat(
+        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '丙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode )* 100, 2 ),
+        '%'
+        ) AS thirdLevelPercentStr
+        FROM
+        (
+        SELECT
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        d.parent_dept_id AS parentDeptId,
+        a.hospital_id AS hospitalId,
+        a.behospital_code AS behospitalCode,
+        c.score_res AS score,
+        c.LEVEL
+        FROM
+        med_behospital_info a,
+        med_qcresult_info c,
+        bas_dept_info d
+        WHERE
+        a.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.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.beh_dept_id = d.dept_id
+        AND a.is_placefile = '1'
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+        <if test="level != null and level != ''">
+            and c.level = #{level}
+        </if>
+        <if test="name != null and name != ''">
+            and a.beh_dept_name like CONCAT('%',#{name},'%')
+        </if>
+        ) tt1
+        LEFT JOIN bas_dept_info e ON tt1.parentDeptId = e.dept_id
+        AND e.is_deleted = 'N'
+        AND tt1.hospitalId = e.hospital_id
+        <if test="deptClass != null and deptClass != ''">
+            WHERE e.dept_name = #{deptClass}
+        </if>
+        GROUP BY
+        tt1.deptId,
+        tt1.deptName,
+        e.dept_id,
+        e.dept_name
+        ) t1,
+        (
+        SELECT
+        tt2.deptId,
+        tt2.deptName,
+        g.dept_id AS deptClassId,
+        g.dept_name AS deptClass,
+        count( * ) AS entryNum
+        FROM
+        (
+        SELECT
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        f.parent_dept_id AS parentDeptId,
+        a.hospital_id AS hospitalId,
+        a.behospital_code AS behospitalCode
+        FROM
+        med_behospital_info a,
+        med_qcresult_info c,
+        med_qcresult_detail d,
+        qc_cases_entry e,
+        bas_dept_info f
+        WHERE
+        a.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND e.is_deleted = 'N'
+        AND f.is_deleted = 'N'
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = d.hospital_id
+        AND a.hospital_id = f.hospital_id
+        AND a.behospital_code = c.behospital_code
+        AND a.behospital_code = d.behospital_code
+        AND d.cases_id = e.cases_id
+        AND d.cases_entry_id = e.id
+        AND a.beh_dept_id = f.dept_id
+        AND a.is_placefile = '1'
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+        <if test="level != null and level != ''">
+            and c.level = #{level}
+        </if>
+        <if test="name != null and name != ''">
+            and a.beh_dept_name like CONCAT('%',#{name},'%')
+        </if>
+        ) tt2
+        LEFT JOIN bas_dept_info g ON tt2.parentDeptId = g.dept_id
+        AND g.is_deleted = 'N'
+        AND tt2.hospitalId = g.hospital_id
+        <if test="deptClass != null and deptClass != ''">
+            WHERE g.dept_name = #{deptClass}
+        </if>
+        GROUP BY
+        tt2.deptId,
+        tt2.deptName,
+        g.dept_id,
+        g.dept_name
+        ) t2
+        WHERE
+        t1.deptId = t2.deptId
+        AND t1.deptName = t2.deptName
+        <if test="asc != null and asc !=''">
+            order by
+            <choose>
+                <when test='asc=="deptId"'>deptId asc</when>
+                <when test='asc=="deptName"'>deptName asc</when>
+                <when test='asc=="deptClassId"'>deptClassId asc</when>
+                <when test='asc=="deptClass"'>deptClass asc</when>
+                <when test='asc=="entryNum"'>entryNum asc</when>
+                <when test='asc=="mrNum"'>mrNum asc</when>
+                <when test='asc=="totleValue"'>totleValue asc</when>
+                <when test='asc=="averageValue"'>averageValue asc</when>
+                <when test='asc=="firstLevelNum"'>firstLevelNum asc</when>
+                <when test='asc=="secondLevelNum"'>secondLevelNum asc</when>
+                <when test='asc=="thirdLevelNum"'>thirdLevelNum asc</when>
+                <when test='asc=="firstLevelPercent"'>firstLevelPercent asc</when>
+                <when test='asc=="secondLevelPercent"'>secondLevelPercent asc</when>
+                <when test='asc=="thirdLevelPercent"'>thirdLevelPercent asc</when>
+                <when test='asc=="firstLevelPercentStr"'>firstLevelPercent asc</when>
+                <when test='asc=="secondLevelPercentStr"'>secondLevelPercent asc</when>
+                <when test='asc=="thirdLevelPercentStr"'>thirdLevelPercent asc</when>
+                <otherwise>deptName asc</otherwise>
+            </choose>
+        </if>
+        <if test="desc != null and desc!=''">
+            order by
+            <choose>
+                <when test='desc=="deptId"'>deptId desc</when>
+                <when test='desc=="deptName"'>deptName desc</when>
+                <when test='desc=="deptClassId"'>deptClassId desc</when>
+                <when test='desc=="deptClass"'>deptClass desc</when>
+                <when test='desc=="entryNum"'>entryNum desc</when>
+                <when test='desc=="mrNum"'>mrNum desc</when>
+                <when test='desc=="totleValue"'>totleValue desc</when>
+                <when test='desc=="averageValue"'>averageValue desc</when>
+                <when test='desc=="firstLevelNum"'>firstLevelNum desc</when>
+                <when test='desc=="secondLevelNum"'>secondLevelNum desc</when>
+                <when test='desc=="thirdLevelNum"'>thirdLevelNum desc</when>
+                <when test='desc=="firstLevelPercent"'>firstLevelPercent desc</when>
+                <when test='desc=="secondLevelPercent"'>secondLevelPercent desc</when>
+                <when test='desc=="thirdLevelPercent"'>thirdLevelPercent desc</when>
+                <when test='desc=="firstLevelPercentStr"'>firstLevelPercent desc</when>
+                <when test='desc=="secondLevelPercentStr"'>secondLevelPercent desc</when>
+                <when test='desc=="thirdLevelPercentStr"'>thirdLevelPercent desc</when>
+                <otherwise>deptName desc</otherwise>
+            </choose>
+        </if>
+    </select>
+
     <!-- 病案首页合格率占比 -全院-->
     <select id="homePageLevelStatistics" parameterType="com.diagbot.vo.FilterOrderVO"
-            resultType="com.diagbot.dto.LevelStatisticsDTO">
+            resultType="com.diagbot.dto.HomePageNumDTO">
         SELECT
         t1.deptId,
         t1.deptName,
@@ -1200,29 +1442,32 @@
         t1.firstLevelPercent,
         t1.secondLevelPercent,
         t1.firstLevelPercentStr,
-        t1.secondLevelPercentStr
+        t1.secondLevelPercentStr,
+        t3.emptyNum,
+        t3.errorNum,
+        t3.entryTotleNum,
+        t3.emptyPercent,
+        t3.errorPercent,
+        t3.emptyPercentStr,
+        t3.errorPercentStr
         FROM
         (
         SELECT
         a.beh_dept_id AS deptId,
         a.beh_dept_name AS deptName,
-        count( DISTINCT c.id ) AS mrNum,
-        ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
-        ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
+        count( DISTINCT a.behospital_code ) AS mrNum,
+        ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
+        ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
         COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END ) AS firstLevelNum,
         COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END ) AS secondLevelNum,
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4
-        ) AS firstLevelPercent,
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id ),
-        4 ) AS secondLevelPercent,
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS firstLevelPercent,
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
         concat(
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )*
-        100, 2 ),
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
         '%'
         ) AS firstLevelPercentStr,
         concat(
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )*
-        100, 2 ),
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
         '%'
         ) AS secondLevelPercentStr
         FROM
@@ -1298,10 +1543,80 @@
         GROUP BY
         a.beh_dept_id,
         a.beh_dept_name
-        ) t2
+        ) t2,(
+        SELECT
+        h1.deptId,
+        h1.deptName,
+        h1.emptyNum,
+        h1.errorNum,
+        h1.mrNum,
+        h2.entryNum,
+        h1.mrNum * h2.entryNum AS entryTotleNum,
+        ROUND( ( h1.mrNum * h2.entryNum  - h1.emptyNum ) / ( h1.mrNum * h2.entryNum ), 4 ) AS emptyPercent,
+        ROUND( ( h1.mrNum * h2.entryNum  - h1.errorNum ) / ( h1.mrNum * h2.entryNum ), 4 ) AS errorPercent,
+        CONCAT( ROUND( ( h1.mrNum * h2.entryNum - h1.emptyNum ) / ( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS emptyPercentStr,
+        CONCAT( ROUND( ( h1.mrNum * h2.entryNum - h1.errorNum ) / ( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS errorPercentStr
+        FROM
+        (
+        SELECT
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        sum( d.rule_type = 1 ) AS emptyNum,
+        sum( d.rule_type = 2 ) AS errorNum,
+        count( DISTINCT a.behospital_code ) AS mrNum
+        FROM
+        med_behospital_info a,
+        med_qcresult_cases 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 b.cases_id = c.cases_id
+        AND c.cases_id = d.cases_id
+        AND c.cases_entry_id = d.id
+        AND a.is_placefile = '1'
+        AND d.cases_id = 243
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+        <if test="level != null and level != ''">
+            and b.level = #{level}
+        </if>
+        <if test="name != null and name != ''">
+            and a.beh_dept_name like CONCAT('%',#{name},'%')
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        a.beh_dept_name
+        ) h1,(
+        SELECT
+        count(*) AS entryNum
+        FROM
+        qc_cases_entry
+        WHERE
+        is_deleted = 'N'
+        AND cases_id = 243
+        ) h2
+        ) t3
         WHERE
         t1.deptId = t2.deptId
+        AND t1.deptId = t3.deptId
         AND t1.deptName = t2.deptName
+        AND t1.deptName = t3.deptName
         <if test="asc != null and asc !=''">
             order by
             <choose>
@@ -1317,6 +1632,13 @@
                 <when test='asc=="secondLevelPercent"'>secondLevelPercent asc</when>
                 <when test='asc=="firstLevelPercentStr"'>firstLevelPercent asc</when>
                 <when test='asc=="secondLevelPercentStr"'>secondLevelPercent asc</when>
+                <when test='asc=="emptyNum"'>emptyNum asc</when>
+                <when test='asc=="errorNum"'>errorNum asc</when>
+                <when test='asc=="entryTotleNum"'>entryTotleNum asc</when>
+                <when test='asc=="emptyPercent"'>emptyPercent asc</when>
+                <when test='asc=="errorPercent"'>errorPercent asc</when>
+                <when test='asc=="emptyPercentStr"'>emptyPercent asc</when>
+                <when test='asc=="errorPercentStr"'>errorPercent asc</when>
                 <otherwise>deptName asc</otherwise>
             </choose>
         </if>
@@ -1335,6 +1657,13 @@
                 <when test='desc=="secondLevelPercent"'>secondLevelPercent desc</when>
                 <when test='desc=="firstLevelPercentStr"'>firstLevelPercent desc</when>
                 <when test='desc=="secondLevelPercentStr"'>secondLevelPercent desc</when>
+                <when test='desc=="emptyNum"'>emptyNum desc</when>
+                <when test='desc=="errorNum"'>errorNum desc</when>
+                <when test='desc=="entryTotleNum"'>entryTotleNum desc</when>
+                <when test='desc=="emptyPercent"'>emptyPercent desc</when>
+                <when test='desc=="errorPercent"'>errorPercent desc</when>
+                <when test='desc=="emptyPercentStr"'>emptyPercent desc</when>
+                <when test='desc=="errorPercentStr"'>errorPercent desc</when>
                 <otherwise>deptName desc</otherwise>
             </choose>
         </if>
@@ -1529,7 +1858,7 @@
 
     <!-- 病案首页合格率占比-科室 -->
     <select id="homePageLevelStatisticsByDept" parameterType="com.diagbot.vo.FilterOrderByDeptVO"
-            resultType="com.diagbot.dto.LevelStatisticsDTO">
+            resultType="com.diagbot.dto.HomePageNumDTO">
         SELECT
         t1.doctorId,
         t1.doctorName,
@@ -1542,29 +1871,32 @@
         t1.firstLevelPercent,
         t1.secondLevelPercent,
         t1.firstLevelPercentStr,
-        t1.secondLevelPercentStr
+        t1.secondLevelPercentStr,
+        t3.emptyNum,
+        t3.errorNum,
+        t3.entryTotleNum,
+        t3.emptyPercent,
+        t3.errorPercent,
+        t3.emptyPercentStr,
+        t3.errorPercentStr
         FROM
         (
         SELECT
-        a.doctor_id AS doctorId,
-        a.doctor_name AS doctorName,
-        count( DISTINCT c.id ) AS mrNum,
-        ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
-        ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
+        CASE WHEN a.doctor_id is NULL OR a.doctor_id ='' THEN '未知' ELSE a.doctor_id END AS doctorId,
+        CASE WHEN a.doctor_name is NULL OR a.doctor_name ='' THEN '未知' ELSE a.doctor_name END AS doctorName,
+        count( DISTINCT a.behospital_code ) AS mrNum,
+        ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
+        ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
         COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END ) AS firstLevelNum,
         COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END ) AS secondLevelNum,
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4
-        ) AS firstLevelPercent,
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id ),
-        4 ) AS secondLevelPercent,
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS firstLevelPercent,
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
         concat(
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )*
-        100, 2 ),
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
         '%'
         ) AS firstLevelPercentStr,
         concat(
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )*
-        100, 2 ),
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
         '%'
         ) AS secondLevelPercentStr
         FROM
@@ -1594,7 +1926,12 @@
             and c.level = #{level}
         </if>
         <if test="name != null and name != ''">
-            and a.doctor_name like CONCAT('%',#{name},'%')
+            <if test="name == '未知'">
+                and (a.doctor_name is null or a.doctor_name='')
+            </if>
+            <if test="name != '未知'">
+                and a.doctor_name like CONCAT('%',#{name},'%')
+            </if>
         </if>
         <if test="userId!=null and userId !=''">
             AND f.user_id = #{userId}
@@ -1608,8 +1945,8 @@
         ) t1,
         (
         SELECT
-        a.doctor_id AS doctorId,
-        a.doctor_name AS doctorName,
+        CASE WHEN a.doctor_id is NULL OR a.doctor_id ='' THEN '未知' ELSE a.doctor_id END AS doctorId,
+        CASE WHEN a.doctor_name is NULL OR a.doctor_name ='' THEN '未知' ELSE a.doctor_name END AS doctorName,
         count( * ) AS entryNum
         FROM
         med_behospital_info a,
@@ -1647,7 +1984,12 @@
             and c.level = #{level}
         </if>
         <if test="name != null and name != ''">
-            and a.doctor_name like CONCAT('%',#{name},'%')
+            <if test="name == '未知'">
+                and (a.doctor_name is null or a.doctor_name='')
+            </if>
+            <if test="name != '未知'">
+                and a.doctor_name like CONCAT('%',#{name},'%')
+            </if>
         </if>
         <if test="userId!=null and userId !=''">
             AND f.user_id = #{userId}
@@ -1658,10 +2000,94 @@
         GROUP BY
         a.doctor_id,
         a.doctor_name
-        ) t2
+        ) t2,(
+        SELECT
+        h1.doctorId,
+        h1.doctorName,
+        h1.emptyNum,
+        h1.errorNum,
+        h1.mrNum,
+        h2.entryNum,
+        h1.mrNum * h2.entryNum AS entryTotleNum,
+        ROUND( ( h1.mrNum * h2.entryNum - h1.emptyNum ) / ( h1.mrNum * h2.entryNum ), 4 ) AS emptyPercent,
+        ROUND( ( h1.mrNum * h2.entryNum - h1.errorNum ) / ( h1.mrNum * h2.entryNum ), 4 ) AS errorPercent,
+        CONCAT( ROUND( ( h1.mrNum * h2.entryNum - h1.emptyNum ) / ( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS emptyPercentStr,
+        CONCAT( ROUND( ( h1.mrNum * h2.entryNum - h1.errorNum ) / ( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS errorPercentStr
+        FROM
+        (
+        SELECT
+        CASE WHEN a.doctor_id is NULL OR a.doctor_id ='' THEN '未知' ELSE a.doctor_id END AS doctorId,
+        CASE WHEN a.doctor_name is NULL OR a.doctor_name ='' THEN '未知' ELSE a.doctor_name END AS doctorName,
+        sum( d.rule_type = 1 ) AS emptyNum,
+        sum( d.rule_type = 2 ) AS errorNum,
+        count( DISTINCT a.behospital_code ) AS mrNum
+        FROM
+        med_behospital_info a,
+        med_qcresult_cases b,
+        med_qcresult_detail c,
+        qc_cases_entry d,
+        sys_user_dept e
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND e.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = e.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND b.cases_id = c.cases_id
+        AND c.cases_id = d.cases_id
+        AND c.cases_entry_id = d.id
+        AND a.is_placefile = '1'
+        AND d.cases_id = 243
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+        <if test="level != null and level != ''">
+            and b.level = #{level}
+        </if>
+        <if test="name != null and name != ''">
+            <if test="name == '未知'">
+                and (a.doctor_name is null or a.doctor_name='')
+            </if>
+            <if test="name != '未知'">
+                and a.doctor_name like CONCAT('%',#{name},'%')
+            </if>
+        </if>
+        <if test="userId!=null and userId !=''">
+            AND e.user_id = #{userId}
+        </if>
+        <if test="deptName!=null and deptName !=''">
+            AND a.beh_dept_name = #{deptName}
+        </if>
+        GROUP BY
+        a.doctor_id,
+        a.doctor_name
+        ) h1,(
+        SELECT
+        count(*) AS entryNum
+        FROM
+        qc_cases_entry
+        WHERE
+        is_deleted = 'N'
+        AND cases_id = 243
+        ) h2
+        ) t3
         WHERE
         t1.doctorId = t2.doctorId
+        AND t1.doctorId = t3.doctorId
         AND t1.doctorName = t2.doctorName
+        AND t1.doctorName = t3.doctorName
         <if test="asc != null and asc !=''">
             order by
             <choose>
@@ -1673,13 +2099,17 @@
                 <when test='asc=="averageValue"'>averageValue asc</when>
                 <when test='asc=="firstLevelNum"'>firstLevelNum asc</when>
                 <when test='asc=="secondLevelNum"'>secondLevelNum asc</when>
-                <when test='asc=="thirdLevelNum"'>thirdLevelNum asc</when>
                 <when test='asc=="firstLevelPercent"'>firstLevelPercent asc</when>
                 <when test='asc=="secondLevelPercent"'>secondLevelPercent asc</when>
-                <when test='asc=="thirdLevelPercent"'>thirdLevelPercent asc</when>
                 <when test='asc=="firstLevelPercentStr"'>firstLevelPercent asc</when>
                 <when test='asc=="secondLevelPercentStr"'>secondLevelPercent asc</when>
-                <when test='asc=="thirdLevelPercentStr"'>thirdLevelPercent asc</when>
+                <when test='asc=="emptyNum"'>emptyNum asc</when>
+                <when test='asc=="errorNum"'>errorNum asc</when>
+                <when test='asc=="entryTotleNum"'>entryTotleNum asc</when>
+                <when test='asc=="emptyPercent"'>emptyPercent asc</when>
+                <when test='asc=="errorPercent"'>errorPercent asc</when>
+                <when test='asc=="emptyPercentStr"'>emptyPercent asc</when>
+                <when test='asc=="errorPercentStr"'>errorPercent asc</when>
                 <otherwise>doctorName asc</otherwise>
             </choose>
         </if>
@@ -1694,13 +2124,17 @@
                 <when test='desc=="averageValue"'>averageValue desc</when>
                 <when test='desc=="firstLevelNum"'>firstLevelNum desc</when>
                 <when test='desc=="secondLevelNum"'>secondLevelNum desc</when>
-                <when test='desc=="thirdLevelNum"'>thirdLevelNum desc</when>
                 <when test='desc=="firstLevelPercent"'>firstLevelPercent desc</when>
                 <when test='desc=="secondLevelPercent"'>secondLevelPercent desc</when>
-                <when test='desc=="thirdLevelPercent"'>thirdLevelPercent desc</when>
                 <when test='desc=="firstLevelPercentStr"'>firstLevelPercent desc</when>
                 <when test='desc=="secondLevelPercentStr"'>secondLevelPercent desc</when>
-                <when test='desc=="thirdLevelPercentStr"'>thirdLevelPercent desc</when>
+                <when test='desc=="emptyNum"'>emptyNum desc</when>
+                <when test='desc=="errorNum"'>errorNum desc</when>
+                <when test='desc=="entryTotleNum"'>entryTotleNum desc</when>
+                <when test='desc=="emptyPercent"'>emptyPercent desc</when>
+                <when test='desc=="errorPercent"'>errorPercent desc</when>
+                <when test='desc=="emptyPercentStr"'>emptyPercent desc</when>
+                <when test='desc=="errorPercentStr"'>errorPercent desc</when>
                 <otherwise>doctorName desc</otherwise>
             </choose>
         </if>

+ 5 - 0
src/main/resources/mapper/MedRecordTypeMapper.xml

@@ -11,6 +11,11 @@
         <result column="obj_name" property="objName" />
         <result column="spell" property="spell" />
         <result column="remark" property="remark" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
     </resultMap>
 
     <update id="updateBatchByKey">

+ 5 - 1
src/main/resources/mapper/QcCasesEntryHospitalMapper.xml

@@ -28,7 +28,8 @@
         b.msg As msg,
         b.score as score,
         b.is_reject As isReject,
-        b.is_used AS isUsed
+        b.is_used AS isUsed,
+        a.rule_type
         from
         qc_cases_entry a
         join qc_cases_entry_hospital b
@@ -50,6 +51,9 @@
         <if test="isUsed != null ">
             AND b.is_used =#{isUsed}
         </if>
+        <if test="ruleType != null">
+            AND a.rule_type = #{ruleType}
+        </if>
         ORDER BY a.cases_id,a.order_no DESC
     </select>
     <select id="findQcCasesEntryAll" resultType="com.diagbot.dto.QcCasesEntryFindDTO">

+ 253 - 20
src/main/resources/mapper/QcresultInfoMapper.xml

@@ -115,6 +115,44 @@
         a.beh_dept_name
     </select>
 
+    <!-- 各科室甲/乙/丙级病历占比 -->
+    <select id="qcResultLevelPercent" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.DeptNumDTO">
+        SELECT
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        <if test="level != null and level != ''">
+            sum( c.`level` = #{level} ) AS num,
+            ROUND( sum( c.`level` = #{level} )/ count(*), 4 ) AS percent,
+            concat( ROUND( sum( c.`level` = #{level} )/ count(*)* 100, 2 ), '%' ) AS percentStr,
+        </if>
+        count(*) AS totleNum
+        FROM
+        med_behospital_info a,
+        med_qcresult_info c
+        WHERE
+        a.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND a.hospital_id = c.hospital_id
+        AND a.behospital_code = c.behospital_code
+        AND a.is_placefile = '1'
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        a.beh_dept_name
+        ORDER  BY
+        percent DESC,
+        a.beh_dept_name ASC
+    </select>
+
     <!-- 按模块统计质控缺陷数 -->
     <select id="entryCountGroupByCase" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
         SELECT
@@ -229,13 +267,18 @@
     </select>
 
     <!-- 条目缺陷占比(内页) -->
-    <select id="entryGroupByEntryInnerPage" resultType="com.diagbot.dto.NumDTO">
+    <select id="entryGroupByEntryInnerPage" resultType="com.diagbot.dto.EntryNumDTO">
         SELECT t.*
         FROM
         (SELECT
+        t1.id AS id,
         t1.NAME AS NAME,
+        t1.casesId AS casesId,
+        t1.casesName AS casesName,
         t1.num AS num,
         t2.mrNum AS totleNum,
+        t1.score AS score,
+        t1.isReject AS isReject,
         Round( t1.num / t2.mrNum, 4 ) AS percent,
         CONCAT( Round( t1.num / t2.mrNum * 100, 2 ), '%' ) AS percentStr
         FROM
@@ -243,23 +286,31 @@
         SELECT
         e.id,
         e.NAME,
-        count(*) AS num
+        e.cases_id AS casesId,
+        e.cases_name AS casesName,
+        count(*) AS num,
+        f.score,
+        d.is_reject AS isReject
         FROM
         med_behospital_info a,
         med_qcresult_info c,
         med_qcresult_detail d,
-        qc_cases_entry e
+        qc_cases_entry e,
+        qc_cases_entry_hospital f
         WHERE
         a.is_deleted = 'N'
         AND c.is_deleted = 'N'
         AND d.is_deleted = 'N'
         AND e.is_deleted = 'N'
+        AND f.is_deleted = 'N'
         AND a.hospital_id = c.hospital_id
         AND a.hospital_id = d.hospital_id
+        AND a.hospital_id = f.hospital_id
         AND a.behospital_code = c.behospital_code
         AND a.behospital_code = d.behospital_code
         AND d.cases_id = e.cases_id
         AND d.cases_entry_id = e.id
+        AND e.id = f.cases_entry_id
         AND a.is_placefile = '1'
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
@@ -274,9 +325,20 @@
         <if test="filterPageVO.name != null and filterPageVO.name != ''">
             AND e.name like CONCAT('%', #{filterPageVO.name},'%')
         </if>
+        <if test="filterPageVO.casesName != null and filterPageVO.casesName != ''">
+            AND e.cases_name = #{filterPageVO.casesName}
+        </if>
+        <if test="filterPageVO.isReject != null">
+            AND d.is_reject = #{filterPageVO.isReject}
+        </if>
         GROUP BY
         e.id,
-        e.NAME
+        e.NAME,
+        <if test="filterPageVO.isReject == null">
+            d.is_reject,
+        </if>
+        e.cases_id,
+        e.cases_name
         ) t1,
         (
         SELECT
@@ -304,6 +366,94 @@
         )t
     </select>
 
+    <!-- 单项否决缺陷占比(首页) -->
+    <select id="entryRejectPercent" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.EntryNumDTO">
+        SELECT
+        t1.id AS id,
+        t1.NAME AS NAME,
+        t1.casesId AS casesId,
+        t1.casesName AS casesName,
+        t1.num AS num,
+        t2.mrNum AS totleNum,
+        t1.score AS score,
+        t1.isReject AS isReject,
+        Round( t1.num / t2.mrNum, 4 ) AS percent,
+        CONCAT( Round( t1.num / t2.mrNum * 100, 2 ), '%' ) AS percentStr
+        FROM
+        (
+        SELECT
+        e.id,
+        e.NAME,
+        e.cases_id AS casesId,
+        e.cases_name AS casesName,
+        count(*) AS num,
+        f.score,
+        d.is_reject AS isReject
+        FROM
+        med_behospital_info a,
+        med_qcresult_info c,
+        med_qcresult_detail d,
+        qc_cases_entry e,
+        qc_cases_entry_hospital f
+        WHERE
+        a.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND e.is_deleted = 'N'
+        AND f.is_deleted = 'N'
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = d.hospital_id
+        AND a.hospital_id = f.hospital_id
+        AND a.behospital_code = c.behospital_code
+        AND a.behospital_code = d.behospital_code
+        AND d.cases_id = e.cases_id
+        AND d.cases_entry_id = e.id
+        AND e.id = f.cases_entry_id
+        AND a.is_placefile = '1'
+        AND d.is_reject = 1
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+        GROUP BY
+        e.id,
+        e.NAME,
+        e.cases_id,
+        e.cases_name
+        ) t1,
+        (
+        SELECT
+        count(*) AS mrNum
+        FROM
+        med_behospital_info a,
+        med_qcresult_info c
+        WHERE
+        a.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND a.hospital_id = c.hospital_id
+        AND a.behospital_code = c.behospital_code
+        AND a.is_placefile = '1'
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+        ) t2
+        ORDER BY
+        percent DESC
+    </select>
+
     <!-- 各科室质控平均分(首页) -->
     <select id="getAverageScore" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.AverageStatisticsDTO">
         SELECT
@@ -577,15 +727,22 @@
     </select>
 
     <!-- 条目缺陷占比-科室(内页) -->
-    <select id="entryGroupByEntryAndDeptInnerPage" resultType="com.diagbot.dto.DeptNumDTO">
-        SELECT t.*
+    <select id="entryGroupByEntryAndDeptInnerPage" resultType="com.diagbot.dto.DeptEntryNumDTO">
+        SELECT
+        t.*
         FROM
-        (SELECT
+        (
+        SELECT
         t1.deptId AS deptId,
         t1.deptName AS deptName,
+        t1.id AS id,
         t1.NAME AS NAME,
+        t1.casesId AS casesId,
+        t1.casesName AS casesName,
         t1.num AS num,
         t2.mrNum AS totleNum,
+        t1.score AS score,
+        t1.isReject AS isReject,
         Round( t1.num / t2.mrNum, 4 ) AS percent,
         CONCAT( Round( t1.num / t2.mrNum * 100, 2 ), '%' ) AS percentStr
         FROM
@@ -595,26 +752,34 @@
         e.NAME,
         a.beh_dept_id AS deptId,
         a.beh_dept_name AS deptName,
-        count(*) AS num
+        e.cases_id AS casesId,
+        e.cases_name AS casesName,
+        count(*) AS num,
+        g.score,
+        d.is_reject AS isReject
         FROM
         med_behospital_info a,
         med_qcresult_info c,
         med_qcresult_detail d,
         qc_cases_entry e,
-        sys_user_dept f
+        sys_user_dept f,
+        qc_cases_entry_hospital g
         WHERE
         a.is_deleted = 'N'
         AND c.is_deleted = 'N'
         AND d.is_deleted = 'N'
         AND e.is_deleted = 'N'
         AND f.is_deleted = 'N'
+        AND g.is_deleted = 'N'
         AND a.hospital_id = c.hospital_id
         AND a.hospital_id = d.hospital_id
         AND a.hospital_id = f.hospital_id
+        AND a.hospital_id = g.hospital_id
         AND a.behospital_code = c.behospital_code
         AND a.behospital_code = d.behospital_code
         AND d.cases_id = e.cases_id
         AND d.cases_entry_id = e.id
+        AND e.id = g.cases_entry_id
         AND a.beh_dept_id = f.dept_id
         AND a.is_placefile = '1'
         <![CDATA[AND a.qc_type_id <>0 ]]>
@@ -636,11 +801,22 @@
         <if test="filterPageByDeptVO.name != null and filterPageByDeptVO.name != ''">
             AND e.name like CONCAT('%', #{filterPageByDeptVO.name},'%')
         </if>
+        <if test="filterPageByDeptVO.casesName != null and filterPageByDeptVO.casesName != ''">
+            AND e.cases_name = #{filterPageByDeptVO.casesName}
+        </if>
+        <if test="filterPageByDeptVO.isReject != null">
+            AND d.is_reject = #{filterPageByDeptVO.isReject}
+        </if>
         GROUP BY
         e.id,
         e.NAME,
         a.beh_dept_id,
-        a.beh_dept_name
+        a.beh_dept_name,
+        <if test="filterPageByDeptVO.isReject == null">
+             d.is_reject,
+        </if>
+        e.cases_id,
+        e.cases_name
         ) t1,
         (
         SELECT
@@ -661,7 +837,6 @@
         AND a.beh_dept_id = f.dept_id
         AND a.is_placefile = '1'
         <![CDATA[AND a.qc_type_id <>0 ]]>
-        <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="filterPageByDeptVO.userId!=null">
             AND f.user_id = #{filterPageByDeptVO.userId}
         </if>
@@ -807,7 +982,7 @@
     </select>
 
     <!-- 缺陷详情(分页) -->
-    <select id="entryCountGroupByEntryPage"  resultType="com.diagbot.dto.CaseNumDTO">
+    <select id="entryCountGroupByEntryPage"  resultType="com.diagbot.dto.EntryNumDTO">
         SELECT t.*
         FROM
         (SELECT
@@ -815,6 +990,8 @@
         t1.NAME,
         t1.casesId,
         t1.casesName,
+        t1.ruleType,
+        t1.isReject,
         count(*) AS num,
         t2.totleNum,
         ROUND( count(*) /t2.totleNum , 4 ) AS percent,
@@ -825,7 +1002,9 @@
         e.id AS id,
         e.NAME AS NAME,
         e.cases_id as casesId,
-        e.cases_name as casesName
+        e.cases_name as casesName,
+        e.rule_type as ruleType,
+        d.is_reject as isReject
         FROM
         med_behospital_info a,
         <if test="filterPageVO.casesId != null and filterPageVO.casesId ==243">
@@ -835,14 +1014,17 @@
             med_qcresult_info c,
         </if>
         med_qcresult_detail d,
-        qc_cases_entry e
+        qc_cases_entry e,
+        qc_cases_entry_hospital f
         WHERE
         a.is_deleted = 'N'
         AND c.is_deleted = 'N'
         AND d.is_deleted = 'N'
         and e.is_deleted='N'
+        and f.is_deleted='N'
         AND a.hospital_id = c.hospital_id
         and a.hospital_id = d.hospital_id
+        and a.hospital_id = f.hospital_id
         AND a.behospital_code = c.behospital_code
         AND a.behospital_code = d.behospital_code
         AND a.is_placefile = '1'
@@ -851,6 +1033,7 @@
         </if>
         AND d.cases_id = e.cases_id
         AND d.cases_entry_id = e.id
+        and e.id = f.cases_entry_id
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="filterPageVO.casesId != null and filterPageVO.casesId != 0">
             AND d.cases_id = #{filterPageVO.casesId}
@@ -873,6 +1056,12 @@
         <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
             AND a.beh_dept_name like CONCAT('%', #{filterPageVO.deptName},'%')
         </if>
+        <if test="filterPageVO.ruleType != null">
+            AND e.rule_type = #{filterPageVO.ruleType}
+        </if>
+        <if test="filterPageVO.isReject != null">
+            AND d.is_reject = #{filterPageVO.isReject}
+        </if>
         ) t1,(
         SELECT
         count(*) AS totleNum
@@ -885,14 +1074,17 @@
             med_qcresult_info c,
         </if>
         med_qcresult_detail d,
-        qc_cases_entry e
+        qc_cases_entry e,
+        qc_cases_entry_hospital f
         WHERE
         a.is_deleted = 'N'
         AND c.is_deleted = 'N'
         AND d.is_deleted = 'N'
         and e.is_deleted='N'
+        and f.is_deleted='N'
         AND a.hospital_id = c.hospital_id
         and a.hospital_id = d.hospital_id
+        and a.hospital_id = f.hospital_id
         AND a.behospital_code = c.behospital_code
         AND a.behospital_code = d.behospital_code
         AND a.is_placefile = '1'
@@ -901,6 +1093,7 @@
         </if>
         AND d.cases_id = e.cases_id
         AND d.cases_entry_id = e.id
+        and e.id = f.cases_entry_id
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="filterPageVO.casesId != null and filterPageVO.casesId != 0">
             AND d.cases_id = #{filterPageVO.casesId}
@@ -923,6 +1116,12 @@
         <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
             AND a.beh_dept_name like CONCAT('%', #{filterPageVO.deptName},'%')
         </if>
+        <if test="filterPageVO.ruleType != null">
+            AND e.rule_type = #{filterPageVO.ruleType}
+        </if>
+        <if test="filterPageVO.isReject != null">
+            AND d.is_reject = #{filterPageVO.isReject}
+        </if>
         ) t2
         GROUP BY
         t1.id,
@@ -1156,7 +1355,7 @@
     </select>
 
     <!-- 缺陷详情-科室(分页) -->
-    <select id="entryCountGroupByEntryAndDeptPage"  resultType="com.diagbot.dto.CaseAndDeptNumDTO">
+    <select id="entryCountGroupByEntryAndDeptPage"  resultType="com.diagbot.dto.DeptEntryNumDTO">
         SELECT
         t.*
         FROM
@@ -1166,6 +1365,8 @@
         t1.NAME,
         t1.casesId,
         t1.casesName,
+        t1.ruleType,
+        t1.isReject,
         t1.deptId,
         t1.deptName,
         count(*) AS num,
@@ -1179,6 +1380,8 @@
         e.NAME,
         e.cases_id as casesId,
         e.cases_name as casesName,
+        e.rule_type as ruleType,
+        d.is_reject as isReject,
         a.beh_dept_id AS deptId,
         a.beh_dept_name AS deptName
         FROM
@@ -1191,16 +1394,19 @@
         </if>
         med_qcresult_detail d,
         qc_cases_entry e,
-        sys_user_dept f
+        sys_user_dept f,
+        qc_cases_entry_hospital g
         WHERE
         a.is_deleted = 'N'
         AND c.is_deleted = 'N'
         AND d.is_deleted = 'N'
         AND e.is_deleted = 'N'
         AND f.is_deleted = 'N'
+        AND g.is_deleted = 'N'
         AND a.hospital_id = c.hospital_id
         AND a.hospital_id = d.hospital_id
         AND a.hospital_id = f.hospital_id
+        AND a.hospital_id = g.hospital_id
         AND a.behospital_code = c.behospital_code
         AND a.behospital_code = d.behospital_code
         AND a.is_placefile = '1'
@@ -1209,6 +1415,7 @@
         </if>
         AND d.cases_id = e.cases_id
         AND d.cases_entry_id = e.id
+        AND g.cases_entry_id = e.id
         AND a.beh_dept_id = f.dept_id
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="filterPageByDeptVO.casesId != null and filterPageByDeptVO.casesId != 0">
@@ -1236,7 +1443,18 @@
             AND a.beh_dept_name like CONCAT('%', #{filterPageByDeptVO.deptName},'%')
         </if>
         <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
-            AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName},'%')
+            <if test="filterPageByDeptVO.doctorName=='未知'">
+                AND (a.doctor_name is null OR a.doctor_name='')
+            </if>
+            <if test="filterPageByDeptVO.doctorName!='未知'">
+                AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName},'%')
+            </if>
+        </if>
+        <if test="filterPageByDeptVO.ruleType != null ">
+            AND e.rule_type = #{filterPageByDeptVO.ruleType}
+        </if>
+        <if test="filterPageByDeptVO.isReject != null ">
+            AND d.is_reject = #{filterPageByDeptVO.isReject}
         </if>
         ) t1,(
         SELECT
@@ -1251,16 +1469,19 @@
         </if>
         med_qcresult_detail d,
         qc_cases_entry e,
-        sys_user_dept f
+        sys_user_dept f,
+        qc_cases_entry_hospital g
         WHERE
         a.is_deleted = 'N'
         AND c.is_deleted = 'N'
         AND d.is_deleted = 'N'
         AND e.is_deleted = 'N'
         AND f.is_deleted = 'N'
+        AND g.is_deleted = 'N'
         AND a.hospital_id = c.hospital_id
         AND a.hospital_id = d.hospital_id
         AND a.hospital_id = f.hospital_id
+        AND a.hospital_id = g.hospital_id
         AND a.behospital_code = c.behospital_code
         AND a.behospital_code = d.behospital_code
         AND a.is_placefile = '1'
@@ -1269,6 +1490,7 @@
         </if>
         AND d.cases_id = e.cases_id
         AND d.cases_entry_id = e.id
+        AND g.cases_entry_id = e.id
         AND a.beh_dept_id = f.dept_id
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="filterPageByDeptVO.casesId != null and filterPageByDeptVO.casesId != 0">
@@ -1296,7 +1518,18 @@
             AND a.beh_dept_name like CONCAT('%', #{filterPageByDeptVO.deptName},'%')
         </if>
         <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
-        AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName},'%')
+            <if test="filterPageByDeptVO.doctorName=='未知'">
+                AND (a.doctor_name is null OR a.doctor_name='')
+            </if>
+            <if test="filterPageByDeptVO.doctorName!='未知'">
+                AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName},'%')
+            </if>
+        </if>
+        <if test="filterPageByDeptVO.ruleType != null ">
+            AND e.rule_type = #{filterPageByDeptVO.ruleType}
+        </if>
+        <if test="filterPageByDeptVO.isReject != null">
+            AND d.is_reject = #{filterPageByDeptVO.isReject}
         </if>
         ) t2
         GROUP BY

+ 2 - 2
src/test/java/com/diagbot/CodeGeneration.java

@@ -33,7 +33,7 @@ public class CodeGeneration {
         gc.setEnableCache(false);// XML 二级缓存
         gc.setBaseResultMap(true);// XML ResultMap
         gc.setBaseColumnList(false);// XML columList
-        gc.setAuthor("gaodm");// 作者
+        gc.setAuthor("zhoutg");// 作者
 
         // 自定义文件命名,注意 %s 会自动填充表实体属性!
         gc.setControllerName("%sController");
@@ -56,7 +56,7 @@ public class CodeGeneration {
         StrategyConfig strategy = new StrategyConfig();
 //        strategy.setTablePrefix(new String[] { "med_" });// 此处可以修改为您的表前缀
         strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
-        strategy.setInclude(new String[] { "med_qcresult_detail","med_behospital_info"}); // 需要生成的表
+        strategy.setInclude(new String[] { "med_crisis_info"}); // 需要生成的表
 
         strategy.setSuperServiceClass(null);
         strategy.setSuperServiceImplClass(null);