ソースを参照

Merge remote-tracking branch 'origin/master' into his/qq

lantone 5 年 前
コミット
f2388806ac
30 ファイル変更546 行追加216 行削除
  1. 7 5
      doc/001.20200417第一版本/qc_init.sql
  2. 4 2
      src/main/java/com/diagbot/dto/AverageStatisticsDTO.java
  3. 6 0
      src/main/java/com/diagbot/dto/MsgDTO.java
  4. 30 0
      src/main/java/com/diagbot/dto/QcCasesEntryPagedataDTO.java
  5. 73 0
      src/main/java/com/diagbot/entity/QcCasesEntryPagedata.java
  6. 10 7
      src/main/java/com/diagbot/facade/AlgorithmFacade.java
  7. 51 45
      src/main/java/com/diagbot/facade/BehospitalInfoFacade.java
  8. 94 72
      src/main/java/com/diagbot/facade/ConsoleFacade.java
  9. 0 3
      src/main/java/com/diagbot/facade/QcCasesEntryHospitalFacade.java
  10. 13 0
      src/main/java/com/diagbot/facade/QcCasesEntryPagedataFacade.java
  11. 12 8
      src/main/java/com/diagbot/facade/QcModeFacade.java
  12. 16 0
      src/main/java/com/diagbot/mapper/QcCasesEntryPagedataMapper.java
  13. 4 6
      src/main/java/com/diagbot/mapper/QcresultInfoMapper.java
  14. 16 0
      src/main/java/com/diagbot/service/QcCasesEntryPagedataService.java
  15. 4 6
      src/main/java/com/diagbot/service/QcresultInfoService.java
  16. 20 0
      src/main/java/com/diagbot/service/impl/QcCasesEntryPagedataServiceImpl.java
  17. 4 6
      src/main/java/com/diagbot/service/impl/QcresultInfoServiceImpl.java
  18. 71 12
      src/main/java/com/diagbot/util/BigDecimalUtil.java
  19. 9 5
      src/main/java/com/diagbot/vo/BehospitalPageVO.java
  20. 23 0
      src/main/java/com/diagbot/vo/QcresultFilterVO.java
  21. 5 0
      src/main/java/com/diagbot/web/BehospitalInfoController.java
  22. 2 0
      src/main/java/com/diagbot/web/QcCasesController.java
  23. 2 0
      src/main/java/com/diagbot/web/QcCasesEntryHospitalController.java
  24. 1 0
      src/main/java/com/diagbot/web/QcModeController.java
  25. 10 6
      src/main/resources/mapper/BehospitalInfoMapper.xml
  26. 6 2
      src/main/resources/mapper/HomePageMapper.xml
  27. 11 8
      src/main/resources/mapper/MedicalRecordMapper.xml
  28. 15 21
      src/main/resources/mapper/QcCasesEntryMapper.xml
  29. 19 0
      src/main/resources/mapper/QcCasesEntryPagedataMapper.xml
  30. 8 2
      src/main/resources/mapper/QcresultInfoMapper.xml

+ 7 - 5
doc/001.20200417第一版本/qc_init.sql

@@ -13,7 +13,7 @@ Target Server Type    : MYSQL
 Target Server Version : 50725
 File Encoding         : 65001
 
-Date: 2020-04-17 09:14:26
+Date: 2020-04-17 13:49:32
 */
 
 SET FOREIGN_KEY_CHECKS=0;
@@ -177,9 +177,10 @@ CREATE TABLE `med_behospital_info` (
   `behospital_code` varchar(16) NOT NULL COMMENT '病人住院ID',
   `hospital_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '医院ID',
   `name` varchar(32) NOT NULL COMMENT '姓名',
-  `sex` varchar(2) DEFAULT NULL COMMENT '性别',
+  `sex` varchar(2) DEFAULT NULL COMMENT '性别(男,女)',
   `birthday` datetime DEFAULT NULL COMMENT '出生日期',
   `file_code` varchar(16) DEFAULT NULL COMMENT '档案号',
+  `qc_type_id` bigint(20) DEFAULT '1' COMMENT '质控类型',
   `ward_code` varchar(16) DEFAULT NULL COMMENT '病区编码',
   `ward_name` varchar(32) DEFAULT NULL COMMENT '病区名称',
   `beh_dept_id` varchar(16) NOT NULL COMMENT '住院科室ID',
@@ -436,6 +437,7 @@ CREATE TABLE `med_medical_record` (
   `behospital_code` varchar(50) DEFAULT NULL COMMENT '病人住院ID',
   `org_code` varchar(20) DEFAULT NULL COMMENT '组织机构代码',
   `rec_type_id` varchar(100) DEFAULT NULL COMMENT '病历类别编号',
+  `mode_id` bigint(20) DEFAULT NULL COMMENT '模块id',
   `rec_date` varchar(50) DEFAULT NULL COMMENT '病历日期',
   `rec_title` varchar(128) DEFAULT NULL COMMENT '病历标题',
   `is_deleted` char(3) DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
@@ -484,7 +486,7 @@ CREATE TABLE `med_qcresult_detail` (
   `modifier` varchar(60) DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
   `remark` varchar(255) DEFAULT NULL COMMENT '备注',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=29445 DEFAULT CHARSET=utf8 COMMENT='质控评分明细信息\r\n每次评分增加一条信息,前面所有评分is_deleted全部设置为Y';
+) ENGINE=InnoDB AUTO_INCREMENT=32130 DEFAULT CHARSET=utf8 COMMENT='质控评分明细信息\r\n每次评分增加一条信息,前面所有评分is_deleted全部设置为Y';
 
 -- ----------------------------
 -- Table structure for med_qcresult_info
@@ -506,7 +508,7 @@ CREATE TABLE `med_qcresult_info` (
   `modifier` varchar(60) DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
   `remark` varchar(255) DEFAULT NULL COMMENT '备注',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=234 DEFAULT CHARSET=utf8 COMMENT='质控评分主表信息\r\n每次评分增加一条信息,前面所有评分is_deleted全部设置为Y';
+) ENGINE=InnoDB AUTO_INCREMENT=253 DEFAULT CHARSET=utf8 COMMENT='质控评分主表信息\r\n每次评分增加一条信息,前面所有评分is_deleted全部设置为Y';
 
 -- ----------------------------
 -- Table structure for med_record_type
@@ -617,7 +619,7 @@ CREATE TABLE `qc_mode` (
   `modifier` varchar(60) DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
   `remark` varchar(255) DEFAULT NULL COMMENT '备注',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8 COMMENT='病历';
+) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8 COMMENT='病历';
 
 -- ----------------------------
 -- Table structure for qc_model_hospital

+ 4 - 2
src/main/java/com/diagbot/dto/AverageStatisticsDTO.java

@@ -11,7 +11,9 @@ import lombok.Setter;
 @Getter
 @Setter
 public class AverageStatisticsDTO {
-    private Long deptId;
+    private String deptId;
     private String deptName;
+    private Integer num;
     private Double averageValue;
-}
+    private Double totleValue;
+}

+ 6 - 0
src/main/java/com/diagbot/dto/MsgDTO.java

@@ -4,6 +4,8 @@ import lombok.Getter;
 import lombok.Setter;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @Description:
@@ -19,6 +21,8 @@ public class MsgDTO {
     private BigDecimal score;
     //提示信息
     private String msg;
+    //标准提示信息
+    private String standardMsg;
     //单项否决
     private String isReject;
     //模块名称
@@ -31,4 +35,6 @@ public class MsgDTO {
     private BigDecimal casesScore;
     // 条目ID
     private Long casesEntryId;
+    // 条目id对应页面数据的key值
+    private List<String> pageKeyList = new ArrayList<>();
 }

+ 30 - 0
src/main/java/com/diagbot/dto/QcCasesEntryPagedataDTO.java

@@ -0,0 +1,30 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 质控条目对应页面数据映射表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-04-20
+ */
+@Data
+public class QcCasesEntryPagedataDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 质控条目id
+     */
+    private Long casesEntryId;
+
+    /**
+     * 页面数据对应的key
+     */
+    private String pageKey;
+}
+

+ 73 - 0
src/main/java/com/diagbot/entity/QcCasesEntryPagedata.java

@@ -0,0 +1,73 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 质控条目对应页面数据映射表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-04-20
+ */
+@Data
+public class QcCasesEntryPagedata implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 质控条目id
+     */
+    private Long casesEntryId;
+
+    /**
+     * 医院ID
+     */
+    private Long hospitalId;
+
+    /**
+     * 页面数据对应的key
+     */
+    private String pageKey;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+}

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

@@ -49,16 +49,16 @@ public class AlgorithmFacade {
     private String getLevel(BigDecimal score) {
         String level = "甲";
         //得分>90分为甲级
-        if (BigDecimalUtil.compareTo(score, new BigDecimal(90)) == 3) {
+        if (BigDecimalUtil.gt(score, new BigDecimal(90))) {
             level = "甲";
         }
         //得分≤90分且得分>80分为乙级
-        if (BigDecimalUtil.compareTo(score, new BigDecimal(90)) == 5
-                && BigDecimalUtil.compareTo(score, new BigDecimal(80)) == 4) {
+        if (BigDecimalUtil.le(score, new BigDecimal(90))
+                && BigDecimalUtil.gt(score, new BigDecimal(80))) {
             level = "乙";
         }
         //得分≤80分为丙级
-        if (BigDecimalUtil.compareTo(score, new BigDecimal(80)) == 5) {
+        if (BigDecimalUtil.le(score, new BigDecimal(80))) {
             level = "丙";
         }
 
@@ -168,13 +168,13 @@ public class AlgorithmFacade {
             //结果先减去单票否决计分总和
             res = res.subtract(rejectScore);
             //结果小于0按0计算
-            if (BigDecimalUtil.compareTo(res, BigDecimal.ZERO) == 1) {
+            if (BigDecimalUtil.lt(res, BigDecimal.ZERO)) {
                 return BigDecimal.ZERO;
             } else {
                 //模块计分
                 for (Map.Entry<Long, BigDecimal> casesScore : casesScoreMap.entrySet()) {
                     BigDecimal allSccore = casesMap.get(casesScore.getKey());
-                    if (BigDecimalUtil.compareTo(allSccore, casesScore.getValue()) == 5) {
+                    if (BigDecimalUtil.le(allSccore, casesScore.getValue())) {
                         //模块标准分小于等于模块减分总和就用模块标准分
                         res = res.subtract(allSccore);
                     } else {
@@ -184,7 +184,7 @@ public class AlgorithmFacade {
                 }
             }
             //结果小于0按0计算
-            if (BigDecimalUtil.compareTo(res, BigDecimal.ZERO) == 1) {
+            if (BigDecimalUtil.lt(res, BigDecimal.ZERO)) {
                 res = BigDecimal.ZERO;
             }
         }
@@ -204,5 +204,8 @@ public class AlgorithmFacade {
         System.out.println("60:" + algorithmFacade.getLevel(new BigDecimal(60)));
         System.out.println("0:" + algorithmFacade.getLevel(new BigDecimal(0)));
 
+        if (BigDecimalUtil.lt(new BigDecimal(-1), BigDecimal.ZERO)) {
+            System.out.println(BigDecimal.ZERO);
+        }
     }
 }

+ 51 - 45
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -21,6 +21,7 @@ import com.diagbot.entity.DoctorAdvice;
 import com.diagbot.entity.HomeDiagnoseInfo;
 import com.diagbot.entity.HomeOperationInfo;
 import com.diagbot.entity.HomePage;
+import com.diagbot.entity.QcCasesEntryPagedata;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
@@ -45,7 +46,6 @@ import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -86,17 +86,37 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
     QcModeFacade qcModeFacade;
     @Autowired
     AuthServiceClient authServiceClient;
+    @Autowired
+    QcCasesEntryPagedataFacade qcCasesEntryPagedataFacade;
 
     public IPage<BehospitalInfoDTO> pageFac(BehospitalPageVO behospitalPageVO) {
-
-        behospitalPageVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
-        IPage<BehospitalInfoDTO> res = getPage(behospitalPageVO);
-        List<BehospitalInfoDTO> behospitalInfoDTOList = res.getRecords();
-        for (BehospitalInfoDTO behospitalInfo : behospitalInfoDTOList) {
-            if (behospitalInfo != null && behospitalInfo.getBirthday() != null) {
-                behospitalInfo.setAge(getAge(behospitalInfo.getBirthday()));
+        //入参验证
+        //入院时间
+        if (null != behospitalPageVO && null != behospitalPageVO.getBehosDateStart()) {
+            behospitalPageVO.setBehosDateStart(DateUtil.getFirstTimeOfDay(behospitalPageVO.getBehosDateStart()));
+        }
+        if (null != behospitalPageVO && null != behospitalPageVO.getBehosDateEnd()) {
+            behospitalPageVO.setBehosDateEnd(DateUtil.getLastTimeOfDay(behospitalPageVO.getBehosDateEnd()));
+        }
+        if (null != behospitalPageVO && null != behospitalPageVO.getBehosDateStart() && null != behospitalPageVO.getBehosDateEnd()) {
+            if (DateUtil.after(behospitalPageVO.getBehosDateStart(), behospitalPageVO.getBehosDateEnd())) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "入院时间的开始时间必须大于结束时间!");
             }
         }
+        //出院时间
+        if (null != behospitalPageVO && null != behospitalPageVO.getLeaveHosDateStart()) {
+            behospitalPageVO.setLeaveHosDateStart(DateUtil.getFirstTimeOfDay(behospitalPageVO.getLeaveHosDateStart()));
+        }
+        if (null != behospitalPageVO && null != behospitalPageVO.getLeaveHosDateEnd()) {
+            behospitalPageVO.setLeaveHosDateEnd(DateUtil.getLastTimeOfDay(behospitalPageVO.getLeaveHosDateEnd()));
+        }
+        if (null != behospitalPageVO && null != behospitalPageVO.getLeaveHosDateStart() && null != behospitalPageVO.getLeaveHosDateEnd()) {
+            if (DateUtil.after(behospitalPageVO.getLeaveHosDateStart(), behospitalPageVO.getLeaveHosDateEnd())) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "出院时间的开始时间必须大于结束时间!");
+            }
+        }
+        behospitalPageVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+        IPage<BehospitalInfoDTO> res = getPage(behospitalPageVO);
         return res;
     }
 
@@ -140,6 +160,22 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
             AnalyzeVO analyzeVO = new AnalyzeVO();
             BeanUtil.copyProperties(getDetailVO, analyzeVO);
             List<MsgDTO> msgDTOList = getMsg(analyzeVO);
+            List<Long> caseEntryId = msgDTOList.stream().map(r -> r.getCasesEntryId()).collect(Collectors.toList());
+            if (ListUtil.isNotEmpty(caseEntryId)) {
+                List<QcCasesEntryPagedata> qcCasesEntryPagedataList = qcCasesEntryPagedataFacade.list(new QueryWrapper<QcCasesEntryPagedata>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("hospital_id", hospitalId)
+                        .in("cases_entry_id", caseEntryId)
+                );
+                Map<Long, List<QcCasesEntryPagedata>> pageKey = EntityUtil.makeEntityListMap(qcCasesEntryPagedataList, "casesEntryId");
+                for (MsgDTO msgDTO : msgDTOList) {
+                    List<QcCasesEntryPagedata> pagedata = pageKey.get(msgDTO.getCasesEntryId());
+                    if (ListUtil.isNotEmpty(pagedata)) {
+                        msgDTO.setPageKeyList(pagedata.stream().map(r -> r.getPageKey()).collect(Collectors.toList()));
+                    }
+                }
+            }
+
             Map<String, List<MsgDTO>> msgMap = EntityUtil.makeEntityListMap(msgDTOList, "modelName");
             res.put("msg", msgMap);
         }
@@ -155,6 +191,9 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         analyzeVO.setHospitalId(hospitalId);
         // 获取质控条目
         List<QcCasesEntryDTO> qcCasesEntryDTOList = qcCasesEntryFacade.getQcCasesEntry(analyzeVO);
+        if(ListUtil.isEmpty(qcCasesEntryDTOList)){
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, "该病历找不到质控条目!");
+        }
 
         // 获取病历所有数据
         Map<String, Map<String, String>> dicMap = sysDictionaryFacade.getDictionaryWithKey(); // 获取字典信息
@@ -215,9 +254,12 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         addData("死亡记录", recMap, medrecVoList);
         addData("危急值记录", recMap, medrecVoList);
         addData("出院小结", recMap, medrecVoList);
+        addData("疑难病例讨论记录", recMap, medrecVoList);
+        addData("输血后效果评价", recMap, medrecVoList);
+        addData("病理检验送检单", recMap, medrecVoList);
 
         // 会诊记录
-        addDataWithKey("会诊记录", recMap, medrecVoList,
+        addDataWithKey("会诊", recMap, medrecVoList,
                 Arrays.asList("会诊记录", "会诊结果单", "会诊申请单"));
 
         // 手术
@@ -491,42 +533,6 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
     }
 
 
-    /**
-     * 通过日期计算年龄
-     *
-     * @param birthDay
-     * @return
-     */
-    public int getAge(Date birthDay) {
-        Calendar cal = Calendar.getInstance();
-        if (cal.before(birthDay)) { //出生日期晚于当前时间,无法计算
-            return 0;
-            //            throw new IllegalArgumentException(
-            //                    "The birthDay is before Now.It's unbelievable!");
-        }
-        int yearNow = cal.get(Calendar.YEAR);  //当前年份
-        int monthNow = cal.get(Calendar.MONTH);  //当前月份
-        int dayOfMonthNow = cal.get(Calendar.DAY_OF_MONTH); //当前日期
-        cal.setTime(birthDay);
-        int yearBirth = cal.get(Calendar.YEAR);
-        int monthBirth = cal.get(Calendar.MONTH);
-        int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH);
-        int age = yearNow - yearBirth;   //计算整岁数
-        if (monthNow <= monthBirth) {
-            if (monthNow == monthBirth) {
-                if (dayOfMonthNow < dayOfMonthBirth) {
-                    age--;//当前日期在生日之前,年龄减一
-                }
-            } else {
-                age--;//当前月份在生日之前,年龄减一
-            }
-        }
-        if (age < 0) {
-            return 0;
-        }
-        return age;
-    }
-
     /**
      * 执行未评分的病历
      */

+ 94 - 72
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -4,13 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.dto.AverageStatisticsDTO;
 import com.diagbot.dto.ResultDetailDTO;
 import com.diagbot.entity.BehospitalInfo;
-import com.diagbot.entity.QcresultInfo;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.FilterVO;
+import com.diagbot.vo.QcresultFilterVO;
 import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -18,11 +18,9 @@ import org.springframework.stereotype.Component;
 import java.math.BigDecimal;
 import java.text.DecimalFormat;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.stream.Collectors;
 
 /**
  * @Description:
@@ -46,17 +44,7 @@ public class ConsoleFacade {
      * @return
      */
     public Map<String, Object> mrStatistics(FilterVO filterVO) {
-        Map<String, Object> retMap = new HashMap<>();
-        retMap.put("本月病历数", 0);
-        retMap.put("本月质控数-人工", 0);
-        retMap.put("本月质控数-机器", 0);
-        retMap.put("本月甲级病历-人工", 0);
-        retMap.put("本月甲级病历-机器", 0);
-        retMap.put("本月乙级病历-人工", 0);
-        retMap.put("本月乙级病历-机器", 0);
-        retMap.put("本月不合格病历-人工", 0);
-        retMap.put("本月不合格病历-机器", 0);
-
+        Map<String, Object> retMap = new LinkedHashMap<>();
         String hospitalId = SysUserUtils.getCurrentHospitalID();
         String startDate = getStartDateStr(filterVO.getType());
         filterVO.setStartDate(startDate);
@@ -66,56 +54,88 @@ public class ConsoleFacade {
         behospitalInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("hospital_id", hospitalId)
                 .ge("leave_hospital_date", startDate);
-        List<BehospitalInfo> behospitalInfoList = behospitalInfoFacade.list(behospitalInfoQueryWrapper);
-        if (ListUtil.isNotEmpty(behospitalInfoList)) {
-            //本月病历数
-            retMap.put("本月病历数", behospitalInfoList.size());
+        int behospitalInfoCount = behospitalInfoFacade.count(behospitalInfoQueryWrapper);
+        //病历数
+        if (filterVO.getType().equals(1)) {
+            retMap.put("本月病历数", behospitalInfoCount);
+        } else if (filterVO.getType().equals(2)) {
+            retMap.put("本年病历数", behospitalInfoCount);
         }
 
-        List<QcresultInfo> qcresultInfoList = qcresultInfoFacade.getQcresultSelectively(filterVO);
-        if (ListUtil.isNotEmpty(qcresultInfoList)) {
-            retMap.put("本月质控数-人工", qcresultInfoList
-                    .stream()
-                    .filter(i -> i.getGradeType().equals(2))
-                    .collect(Collectors.toList())
-                    .size());
-            retMap.put("本月质控数-机器", qcresultInfoList
-                    .stream()
-                    .filter(i -> i.getGradeType().equals(1))
-                    .collect(Collectors.toList())
-                    .size());
-            retMap.put("本月甲级病历-人工", qcresultInfoList
-                    .stream()
-                    .filter(i -> i.getGradeType().equals(2) && i.getLevel().equals("甲"))
-                    .collect(Collectors.toList())
-                    .size());
-            retMap.put("本月甲级病历-机器", qcresultInfoList
-                    .stream()
-                    .filter(i -> i.getGradeType().equals(1) && i.getLevel().equals("甲"))
-                    .collect(Collectors.toList())
-                    .size());
-            retMap.put("本月乙级病历-人工", qcresultInfoList
-                    .stream()
-                    .filter(i -> i.getGradeType().equals(2) && i.getLevel().equals("乙"))
-                    .collect(Collectors.toList())
-                    .size());
-            retMap.put("本月乙级病历-机器", qcresultInfoList
-                    .stream()
-                    .filter(i -> i.getGradeType().equals(1) && i.getLevel().equals("乙"))
-                    .collect(Collectors.toList())
-                    .size());
-            retMap.put("本月不合格病历-人工", qcresultInfoList
-                    .stream()
-                    .filter(i -> i.getGradeType().equals(2) && i.getLevel().equals("丙"))
-                    .collect(Collectors.toList())
-                    .size());
-            retMap.put("本月不合格病历-机器", qcresultInfoList
-                    .stream()
-                    .filter(i -> i.getGradeType().equals(1) && i.getLevel().equals("丙"))
-                    .collect(Collectors.toList())
-                    .size());
+        QcresultFilterVO qcresultFilterVO = new QcresultFilterVO();
+        BeanUtil.copyProperties(filterVO, qcresultFilterVO);
+        //本月质控数-人工
+        qcresultFilterVO.setGradeType(2);
+        qcresultFilterVO.setLevel("");
+        int qcresultByGradeType2Count = qcresultInfoFacade.getQcresultSelectively(qcresultFilterVO);
+        if (qcresultFilterVO.getType().equals(1)) {
+            retMap.put("本月质控数-人工", qcresultByGradeType2Count);
+        } else if (qcresultFilterVO.getType().equals(2)) {
+            retMap.put("本年质控数-人工", qcresultByGradeType2Count);
+        }
+        //本月质控数-机器
+        qcresultFilterVO.setGradeType(1);
+        qcresultFilterVO.setLevel("");
+        int qcresultByGradeType1Count = qcresultInfoFacade.getQcresultSelectively(qcresultFilterVO);
+        if (qcresultFilterVO.getType().equals(1)) {
+            retMap.put("本月质控数-机器", qcresultByGradeType1Count);
+        } else if (qcresultFilterVO.getType().equals(2)) {
+            retMap.put("本年质控数-机器", qcresultByGradeType1Count);
+        }
+        //本月甲级病历-人工
+        qcresultFilterVO.setGradeType(2);
+        qcresultFilterVO.setLevel("甲");
+        int qcresultByGradeType2AndLevel1Count = qcresultInfoFacade.getQcresultSelectively(qcresultFilterVO);
+        if (qcresultFilterVO.getType().equals(1)) {
+            retMap.put("本月甲级病历-人工", qcresultByGradeType2AndLevel1Count);
+        } else if (qcresultFilterVO.getType().equals(2)) {
+            retMap.put("本年甲级病历-人工", qcresultByGradeType2AndLevel1Count);
+        }
+        //本月甲级病历-机器
+        qcresultFilterVO.setGradeType(1);
+        qcresultFilterVO.setLevel("甲");
+        int qcresultByGradeType1AndLevel1Count = qcresultInfoFacade.getQcresultSelectively(qcresultFilterVO);
+        if (qcresultFilterVO.getType().equals(1)) {
+            retMap.put("本月甲级病历-机器", qcresultByGradeType1AndLevel1Count);
+        } else if (qcresultFilterVO.getType().equals(2)) {
+            retMap.put("本年甲级病历-机器", qcresultByGradeType1AndLevel1Count);
+        }
+        //本月乙级病历-人工
+        qcresultFilterVO.setGradeType(2);
+        qcresultFilterVO.setLevel("乙");
+        int qcresultByGradeType2AndLevel2Count = qcresultInfoFacade.getQcresultSelectively(qcresultFilterVO);
+        if (qcresultFilterVO.getType().equals(1)) {
+            retMap.put("本月乙级病历-人工", qcresultByGradeType2AndLevel2Count);
+        } else if (qcresultFilterVO.getType().equals(2)) {
+            retMap.put("本年乙级病历-人工", qcresultByGradeType2AndLevel2Count);
+        }
+        //本月乙级病历-机器
+        qcresultFilterVO.setGradeType(1);
+        qcresultFilterVO.setLevel("乙");
+        int qcresultByGradeType1AndLevel2Count = qcresultInfoFacade.getQcresultSelectively(qcresultFilterVO);
+        if (qcresultFilterVO.getType().equals(1)) {
+            retMap.put("本月乙级病历-机器", qcresultByGradeType1AndLevel2Count);
+        } else if (qcresultFilterVO.getType().equals(2)) {
+            retMap.put("本年乙级病历-机器", qcresultByGradeType1AndLevel2Count);
+        }
+        //本月乙级病历-人工
+        qcresultFilterVO.setGradeType(2);
+        qcresultFilterVO.setLevel("丙");
+        int qcresultByGradeType2AndLevel3Count = qcresultInfoFacade.getQcresultSelectively(qcresultFilterVO);
+        if (qcresultFilterVO.getType().equals(1)) {
+            retMap.put("本月不合格病历-人工", qcresultByGradeType2AndLevel3Count);
+        } else if (qcresultFilterVO.getType().equals(2)) {
+            retMap.put("本年不合格病历-人工", qcresultByGradeType2AndLevel3Count);
+        }
+        //本月乙级病历-机器
+        qcresultFilterVO.setGradeType(1);
+        qcresultFilterVO.setLevel("丙");
+        int qcresultByGradeType1AndLevel3Count = qcresultInfoFacade.getQcresultSelectively(qcresultFilterVO);
+        if (filterVO.getType().equals(1)) {
+            retMap.put("本月不合格病历-机器", qcresultByGradeType1AndLevel3Count);
+        } else if (filterVO.getType().equals(2)) {
+            retMap.put("本年不合格病历-机器", qcresultByGradeType1AndLevel3Count);
         }
-
         return retMap;
     }
 
@@ -139,7 +159,7 @@ public class ConsoleFacade {
         List<ResultDetailDTO> results = behospitalInfoFacade.resultStatistics(filterVO);
         if (ListUtil.isNotEmpty(results)) {
             results.forEach(result -> {
-                DecimalFormat df = new DecimalFormat("#.00");
+                DecimalFormat df = new DecimalFormat("#0.00");
                 String percentStr
                         = df.format(BigDecimal.valueOf(result.getPercent()).multiply(BigDecimal.valueOf(100))) + "%";
                 result.setPercentStr(percentStr);
@@ -163,19 +183,16 @@ public class ConsoleFacade {
                         retResults.add(result);
                     } else {
                         num += result.getNum();
-
                     }
                 }
                 ResultDetailDTO retResult = new ResultDetailDTO();
                 retResult.setName("其他");
                 retResult.setNum(num);
-                retResult.setPercent(BigDecimal.valueOf(1)
-                        .min(BigDecimal.valueOf(rate))
-                        .doubleValue());
+                retResult.setPercent(BigDecimal.valueOf(1).subtract(BigDecimal.valueOf(rate)).doubleValue());
                 retResults.add(retResult);
             }
             retResults.forEach(result -> {
-                DecimalFormat df = new DecimalFormat("#.00");
+                DecimalFormat df = new DecimalFormat("#0.00");
                 String percentStr
                         = df.format(BigDecimal.valueOf(result.getPercent()).multiply(BigDecimal.valueOf(100))) + "%";
                 result.setPercentStr(percentStr);
@@ -259,22 +276,27 @@ public class ConsoleFacade {
             retAverageList = BeanUtil.listCopyTo(averageList, AverageStatisticsDTO.class);
         } else {
             Double averageValue = 0d;
+            Double totleValue = 0d;
             Integer num = 0;
             for (AverageStatisticsDTO averageStatisticsDTO : averageList) {
                 if (retAverageList.size() < limitCount - 1) {
                     retAverageList.add(averageStatisticsDTO);
                 } else {
-                    averageValue = BigDecimal
-                            .valueOf(averageValue)
-                            .add(BigDecimal.valueOf(averageStatisticsDTO.getAverageValue()))
+                    totleValue = BigDecimal
+                            .valueOf(totleValue)
+                            .add(BigDecimal.valueOf(averageStatisticsDTO.getTotleValue()))
                             .doubleValue();
-                    num++;
+                    num += averageStatisticsDTO.getNum();
                 }
             }
-            averageValue = BigDecimal.valueOf(averageValue).divide(BigDecimal.valueOf(num)).doubleValue();
+            averageValue = BigDecimal.valueOf(totleValue)
+                    .divide(BigDecimal.valueOf(num), 2)
+                    .doubleValue();
             AverageStatisticsDTO retAverageStatistics = new AverageStatisticsDTO();
             retAverageStatistics.setDeptName("其他");
+            retAverageStatistics.setNum(num);
             retAverageStatistics.setAverageValue(averageValue);
+            retAverageStatistics.setTotleValue(totleValue);
             retAverageList.add(retAverageStatistics);
         }
         return retAverageList;

+ 0 - 3
src/main/java/com/diagbot/facade/QcCasesEntryHospitalFacade.java

@@ -10,12 +10,9 @@ import com.diagbot.entity.QcCasesEntryHospital;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
-import com.diagbot.service.QcCasesEntryHospitalService;
 import com.diagbot.service.impl.QcCasesEntryHospitalServiceImpl;
 import com.diagbot.util.DateUtil;
-import com.diagbot.util.StringUtil;
 import com.diagbot.util.SysUserUtils;
-import com.diagbot.util.UserUtils;
 import com.diagbot.vo.QcCasesEntryFindVO;
 import com.diagbot.vo.QcCasesEntryHospitalVO;
 import com.diagbot.vo.QcCasesEntryUpdataVO;

+ 13 - 0
src/main/java/com/diagbot/facade/QcCasesEntryPagedataFacade.java

@@ -0,0 +1,13 @@
+package com.diagbot.facade;
+
+import com.diagbot.service.impl.QcCasesEntryPagedataServiceImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/4/13 20:20
+ */
+@Component
+public class QcCasesEntryPagedataFacade extends QcCasesEntryPagedataServiceImpl {
+}

+ 12 - 8
src/main/java/com/diagbot/facade/QcModeFacade.java

@@ -7,9 +7,9 @@ import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.service.impl.QcModeServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ListUtil;
 import org.springframework.stereotype.Component;
 
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -27,23 +27,27 @@ public class QcModeFacade extends QcModeServiceImpl {
                 .orderByAsc("parent_id", "order_no")
         );
 
-        Iterator<QcMode> iterator = qcModeList.iterator();
-        while (iterator.hasNext()) {
-            QcMode qcMode = iterator.next();
-            if (!pageData.containsKey(qcMode.getName()) && !"病程信息".equals(qcMode.getName())) {
-                iterator.remove();
+        for (int i = 0; i < qcModeList.size(); i++) {
+            String key = qcModeList.get(i).getName();
+            if (!pageData.containsKey(qcModeList.get(i).getName()) && !"病程信息".equals(key)) {
+                qcModeList.remove(i--);
             }
         }
-
         Map<Long, List<QcMode>> map = EntityUtil.makeEntityListMap(qcModeList, "parentId");
+
         // 获取根节点
         List<QcMode> root = map.get(-1L);
         List<QcModeDTO> res = BeanUtil.listCopyTo(root, QcModeDTO.class);
 
-        for (QcModeDTO qcModeDTO : res) {
+        for (int i = 0; i < res.size(); i++) {
+            QcModeDTO qcModeDTO = res.get(i);
             if (map.containsKey(qcModeDTO.getId())) {
                 qcModeDTO.setSonMode(BeanUtil.listCopyTo(map.get(qcModeDTO.getId()), QcModeDTO.class));
             }
+            // 如果病程信息下无内容,则删除
+            if ("病程信息".equals(qcModeDTO.getName()) && ListUtil.isEmpty(qcModeDTO.getSonMode())) {
+                res.remove(i--);
+            }
         }
         return res;
     }

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

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.QcCasesEntryPagedata;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 质控条目对应页面数据映射表 Mapper 接口
+ * </p>
+ *
+ * @author gaodm
+ * @since 2020-04-20
+ */
+public interface QcCasesEntryPagedataMapper extends BaseMapper<QcCasesEntryPagedata> {
+
+}

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

@@ -1,10 +1,8 @@
 package com.diagbot.mapper;
 
-import com.diagbot.entity.QcresultInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.diagbot.vo.FilterVO;
-
-import java.util.List;
+import com.diagbot.entity.QcresultInfo;
+import com.diagbot.vo.QcresultFilterVO;
 
 /**
  * <p>
@@ -20,8 +18,8 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
     /**
      * 筛选质控记录
      *
-     * @param filterVO
+     * @param qcresultFilterVO
      * @return
      */
-    public List<QcresultInfo> getQcresultSelectively(FilterVO filterVO);
+    public int getQcresultSelectively(QcresultFilterVO qcresultFilterVO);
 }

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.QcCasesEntryPagedata;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 质控条目对应页面数据映射表 服务类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2020-04-20
+ */
+public interface QcCasesEntryPagedataService extends IService<QcCasesEntryPagedata> {
+
+}

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

@@ -1,10 +1,8 @@
 package com.diagbot.service;
 
-import com.diagbot.entity.QcresultInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.diagbot.vo.FilterVO;
-
-import java.util.List;
+import com.diagbot.entity.QcresultInfo;
+import com.diagbot.vo.QcresultFilterVO;
 
 /**
  * <p>
@@ -20,8 +18,8 @@ public interface QcresultInfoService extends IService<QcresultInfo> {
     /**
      * 筛选质控记录
      *
-     * @param filterVO
+     * @param qcresultFilterVO
      * @return
      */
-    public List<QcresultInfo> getQcresultSelectively(FilterVO filterVO);
+    public int getQcresultSelectively(QcresultFilterVO qcresultFilterVO);
 }

+ 20 - 0
src/main/java/com/diagbot/service/impl/QcCasesEntryPagedataServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.QcCasesEntryPagedata;
+import com.diagbot.mapper.QcCasesEntryPagedataMapper;
+import com.diagbot.service.QcCasesEntryPagedataService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 质控条目对应页面数据映射表 服务实现类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2020-04-20
+ */
+@Service
+public class QcCasesEntryPagedataServiceImpl extends ServiceImpl<QcCasesEntryPagedataMapper, QcCasesEntryPagedata> implements QcCasesEntryPagedataService {
+
+}

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

@@ -4,11 +4,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.entity.QcresultInfo;
 import com.diagbot.mapper.QcresultInfoMapper;
 import com.diagbot.service.QcresultInfoService;
-import com.diagbot.vo.FilterVO;
+import com.diagbot.vo.QcresultFilterVO;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
-
 /**
  * <p>
  * 质控评分结果信息
@@ -24,11 +22,11 @@ public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, Qcr
     /**
      * 筛选质控记录
      *
-     * @param filterVO
+     * @param qcresultFilterVO
      * @return
      */
     @Override
-    public List<QcresultInfo> getQcresultSelectively(FilterVO filterVO) {
-        return baseMapper.getQcresultSelectively(filterVO);
+    public int getQcresultSelectively(QcresultFilterVO qcresultFilterVO) {
+        return baseMapper.getQcresultSelectively(qcresultFilterVO);
     }
 }

+ 71 - 12
src/main/java/com/diagbot/util/BigDecimalUtil.java

@@ -1,6 +1,7 @@
 package com.diagbot.util;
 
 import java.math.BigDecimal;
+import java.text.DecimalFormat;
 
 /**
  * @Description: 大数工具类
@@ -30,32 +31,90 @@ public class BigDecimalUtil {
         );
     }
 
-    public static Integer compareTo(BigDecimal a, BigDecimal b) {
-        Integer res = 1;
+    //a小于b
+    public static Boolean lt(BigDecimal a, BigDecimal b) {
+        Boolean res = false;
         if (a.compareTo(b) == -1) {
-            res = 1;
-            //System.out.println("a小于b");
+            res = true;
         }
+        return res;
+
+    }
 
+    //a等于b
+    public static Boolean eq(BigDecimal a, BigDecimal b) {
+        Boolean res = false;
         if (a.compareTo(b) == 0) {
-            res = 2;
-            //System.out.println("a等于b");
+            res = true;
         }
+        return res;
+
+    }
 
+    //a大于b
+    public static Boolean gt(BigDecimal a, BigDecimal b) {
+        Boolean res = false;
         if (a.compareTo(b) == 1) {
-            res = 3;
-            //System.out.println("a大于b");
+            res = true;
         }
+        return res;
+
+    }
 
+    //a大于等于b
+    public static Boolean ge(BigDecimal a, BigDecimal b) {
+        Boolean res = false;
         if (a.compareTo(b) > -1) {
-            res = 4;
-            //System.out.println("a大于等于b");
+            res = true;
         }
+        return res;
 
+    }
+
+    //a小于等于b
+    public static Boolean le(BigDecimal a, BigDecimal b) {
+        Boolean res = false;
         if (a.compareTo(b) < 1) {
-            res = 5;
-            //System.out.println("a小于等于b");
+            res = true;
         }
         return res;
+
+    }
+
+    public static void main(String[] args) {
+        DecimalFormat df = new DecimalFormat("#.00");
+        DecimalFormat df2 = new DecimalFormat("#0.00");
+        BigDecimal a = new BigDecimal(0.55);
+        BigDecimal b = new BigDecimal(11.55);
+        System.out.println(df.format(a));
+        System.out.println(df2.format(a));
+        System.out.println(df.format(b));
+        System.out.println(df2.format(b));
+
+        System.out.println("====a小于b====");
+        System.out.println(lt(new BigDecimal(1.1), new BigDecimal(1)) == false);
+        System.out.println(lt(new BigDecimal(1), new BigDecimal(1)) == false);
+        System.out.println(lt(new BigDecimal(0.9), new BigDecimal(1)) == true);
+
+        System.out.println("====a等于b====");
+        System.out.println(eq(new BigDecimal(1.1), new BigDecimal(1)) == false);
+        System.out.println(eq(new BigDecimal(1), new BigDecimal(1)) == true);
+        System.out.println(eq(new BigDecimal(0.9), new BigDecimal(1)) == false);
+
+        System.out.println("====a大于b====");
+        System.out.println(gt(new BigDecimal(1.1), new BigDecimal(1)) == true);
+        System.out.println(gt(new BigDecimal(1), new BigDecimal(1)) == false);
+        System.out.println(gt(new BigDecimal(0.9), new BigDecimal(1)) == false);
+
+        System.out.println("====a大于等于b====");
+        System.out.println(ge(new BigDecimal(1.1), new BigDecimal(1)) == true);
+        System.out.println(ge(new BigDecimal(1), new BigDecimal(1)) == true);
+        System.out.println(ge(new BigDecimal(0.9), new BigDecimal(1)) == false);
+
+        System.out.println("====a小于等于b====");
+        System.out.println(le(new BigDecimal(1.1), new BigDecimal(1)) == false);
+        System.out.println(le(new BigDecimal(1), new BigDecimal(1)) == true);
+        System.out.println(le(new BigDecimal(0.9), new BigDecimal(1)) == true);
+
     }
 }

+ 9 - 5
src/main/java/com/diagbot/vo/BehospitalPageVO.java

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.Date;
 
 /**
  * <p>
@@ -43,23 +44,26 @@ public class BehospitalPageVO extends Page implements Serializable {
     /**
      * 入院时间开始时间
      */
-    private String behosDateStart;
-
+    private Date behosDateStart;
 
     /**
      * 入院时间结束时间
      */
-    private String behosDateEnd;
+    private Date behosDateEnd;
 
     /**
      * 出院时间开始时间
      */
-    private String leaveHosDateStart;
+    private Date leaveHosDateStart;
 
     /**
      * 出院时间结束时间
      */
-    private String leaveHosDateEnd;
+    private Date leaveHosDateEnd;
 
+    /**
+     * 等级
+     */
+    private String level;
 
 }

+ 23 - 0
src/main/java/com/diagbot/vo/QcresultFilterVO.java

@@ -0,0 +1,23 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/17 16:21
+ */
+@Getter
+@Setter
+public class QcresultFilterVO extends FilterVO {
+    /**
+     * 等级
+     */
+    private String level;
+
+    /**
+     * 评分类型
+     */
+    private Integer gradeType;
+}

+ 5 - 0
src/main/java/com/diagbot/web/BehospitalInfoController.java

@@ -19,6 +19,7 @@ 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 springfox.documentation.annotations.ApiIgnore;
 
 import java.util.Map;
 
@@ -78,6 +79,7 @@ public class BehospitalInfoController {
     @PostMapping("/analyze_rpc")
     @SysLogger("analyze_rpc")
     @Transactional
+    @ApiIgnore
     public RespDTO<AnalyzeDTO> analyze_rpc(@RequestBody AnalyzeVO analyzeVO) {
         return RespDTO.onSuc(behospitalInfoFacade.analyze(analyzeVO));
     }
@@ -86,6 +88,7 @@ public class BehospitalInfoController {
             notes = "")
     @PostMapping("/addCase")
     @SysLogger("addCase")
+    @Transactional
     public RespDTO<AnalyzeDTO> addCase(@RequestBody QcresultVO qcresultVO){
         qcresultVO.setType(1);
         return RespDTO.onSuc(qcresultInfoFacade.changeQcResult(qcresultVO));
@@ -96,6 +99,7 @@ public class BehospitalInfoController {
                     "id:明细id,必填<br>")
     @PostMapping("/delCase")
     @SysLogger("delCase")
+    @Transactional
     public RespDTO<AnalyzeDTO> delCase(@RequestBody QcresultVO qcresultVO){
         qcresultVO.setType(2);
         return RespDTO.onSuc(qcresultInfoFacade.changeQcResult(qcresultVO));
@@ -105,6 +109,7 @@ public class BehospitalInfoController {
             notes = "")
     @PostMapping("/updCase")
     @SysLogger("updCase")
+    @Transactional
     public RespDTO<AnalyzeDTO> updCase(@RequestBody QcresultVO qcresultVO){
         qcresultVO.setType(3);
         return RespDTO.onSuc(qcresultInfoFacade.changeQcResult(qcresultVO));

+ 2 - 0
src/main/java/com/diagbot/web/QcCasesController.java

@@ -9,6 +9,7 @@ import com.diagbot.vo.QcCasesSaveVO;
 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;
@@ -46,6 +47,7 @@ public class QcCasesController {
             notes = "")
     @PostMapping("/saveQcCases")
     @SysLogger("saveQcCases")
+    @Transactional
     public RespDTO<Boolean> saveQcCases(@RequestBody QcCasesSaveListVO qcCasesSaveVOList) {
         return RespDTO.onSuc(qcCasesFacade.saveQcCases(qcCasesSaveVOList));
     }

+ 2 - 0
src/main/java/com/diagbot/web/QcCasesEntryHospitalController.java

@@ -14,6 +14,7 @@ import com.diagbot.vo.QcCasesEntryUpdataVO;
 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;
@@ -52,6 +53,7 @@ public class QcCasesEntryHospitalController {
                     "isReject:单项否决 1-单项否决 0-非</br>isUsed:是否启用 0-未启用 1-启用")
     @PostMapping("/updataQcCasesEntry")
     @SysLogger("updataQcCasesEntry")
+    @Transactional
     public RespDTO<Boolean> updataQcCasesEntry(@RequestBody @Valid QcCasesEntryUpdataVO qcCasesEntryUpdataVO) {
         return RespDTO.onSuc(qcCasesEntryHospitalFacade.updataQcCasesEntrys(qcCasesEntryUpdataVO));
     }

+ 1 - 0
src/main/java/com/diagbot/web/QcModeController.java

@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/qc/mode")
 @Api(value = "菜单相关API", tags = { "菜单相关API" })
 @SuppressWarnings("unchecked")
+@Deprecated
 public class QcModeController {
 
 //    @Autowired

+ 10 - 6
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -32,8 +32,11 @@
     </resultMap>
 
     <select id="getPage" resultType="com.diagbot.dto.BehospitalInfoDTO">
-        select a.*, b.level, b.grade_type, b.score_res, b.gmt_create as grade_time from med_behospital_info a LEFT JOIN med_qcresult_info b
+        select a.*, b.level, b.grade_type, b.score_res, b.gmt_create as grade_time, c.age from med_behospital_info a
+        LEFT JOIN med_qcresult_info b
         on a.behospital_code = b.behospital_code and b.is_deleted = 'N'
+        left join med_home_page c
+        on a.behospital_code = c.behospital_code and c.is_deleted = 'N'
         where a.is_deleted = 'N'
         <if test="name != null and name != ''">
             and a.name like CONCAT('%',#{name},'%')
@@ -47,22 +50,23 @@
         <if test="behospitalCode != null and behospitalCode != ''">
             and a.behospitalCode like CONCAT('%',#{behospitalCode},'%')
         </if>
-        <if test="behosDateStart != null and behosDateStart != ''">
+        <if test="behosDateStart != null">
             <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
         </if>
-        <if test="behosDateEnd != null and behosDateEnd != ''">
+        <if test="behosDateEnd != null">
             <![CDATA[ and a.behospital_date <= #{behosDateEnd}]]>
         </if>
-        <if test="leaveHosDateStart != null and leaveHosDateStart != ''">
+        <if test="leaveHosDateStart != null">
             <![CDATA[ and a.leave_hospital_date >= #{leaveHosDateStart}]]>
         </if>
-        <if test="leaveHosDateEnd != null and leaveHosDateEnd != ''">
+        <if test="leaveHosDateEnd != null">
             <![CDATA[ and a.leave_hospital_date <= #{leaveHosDateEnd}]]>
         </if>
     </select>
 
     <select id="getMsg" resultType="com.diagbot.dto.MsgDTO">
-        SELECT b.`name` model_name,c.score,c.msg,c.cases_entry_id,c.is_reject,c.id id, a.cases_id cases_id, d.score cases_score,b.id model_id
+        SELECT b.`name` model_name,c.score,c.msg,c.cases_entry_id,c.is_reject,c.id id,
+        a.cases_id cases_id, d.score cases_score,b.id model_id, a.name standard_msg
         FROM `qc_cases_entry` a, qc_mode b, med_qcresult_detail c, qc_cases_hospital d
         where a.is_deleted = 'N' and b.is_deleted = 'N' and c.is_deleted = 'N' and d.is_deleted = 'N'
         and a.id = c.cases_entry_id

+ 6 - 2
src/main/resources/mapper/HomePageMapper.xml

@@ -143,7 +143,9 @@
         SELECT
         a.beh_dept_id as deptId,
         a.beh_dept_name as deptName,
-        round( sum( b.behospital_day_num )/ count(*), 2 ) AS averageValue
+        count(*) AS num,
+        round( sum( b.behospital_day_num )/ count(*), 2 ) AS averageValue,
+        round( sum( b.behospital_day_num ), 2 ) AS totleValue
         FROM
         med_behospital_info a,
         med_home_page b
@@ -170,7 +172,9 @@
         SELECT
         a.beh_dept_id as deptId,
         a.beh_dept_name as deptName,
-        round( sum( b.total_fee )/ count(*), 2 ) AS averageValue
+        count(*) AS num,
+        round( sum( b.total_fee )/ count(*), 2 ) AS averageValue,
+        round( sum( b.total_fee ), 2 ) AS totleValue
         FROM
         med_behospital_info a,
         med_home_page b

+ 11 - 8
src/main/resources/mapper/MedicalRecordMapper.xml

@@ -19,14 +19,17 @@
     </resultMap>
 
     <select id="getRecordContent"  resultType="com.diagbot.dto.RecordContentDTO">
-        select t.*,c.content_blob, c.content_text from (
-            SELECT a.rec_id, a.rec_title, b.stand_model_name FROM `med_medical_record` a, qc_model_hospital b
-            where a.is_deleted = 'N'  and a.rec_title = b.hospital_model_name
-            and a.hospital_id = #{hospitalId}
-            and b.hospital_id = #{hospitalId}
-            and a.behospital_code = #{behospitalCode}
-            and b.stand_model_name is not null) t, med_medical_record_content c
-        where t.rec_id = c.rec_id and c.is_deleted = 'N'
+        select t1.rec_id, t1.rec_title, t2.name stand_model_name, t3.content_text
+        from med_medical_record t1, qc_mode t2, med_medical_record_content t3
+        where
+             t1.is_deleted = 'N'
+        and t2.is_deleted = 'N'
+        and t3.is_deleted = 'N'
+        and t1.mode_id = t2.id
+        and t1.hospital_id = t3.hospital_id
+        and t1.rec_id = t3.rec_id
+        and t1.hospital_id = #{hospitalId}
+        and t1.behospital_code = #{behospitalCode}
     </select>
 
 </mapper>

+ 15 - 21
src/main/resources/mapper/QcCasesEntryMapper.xml

@@ -22,30 +22,24 @@
 
     <select id="getQcCasesEntry" parameterType="com.diagbot.vo.AnalyzeVO" resultType="com.diagbot.dto.QcCasesEntryDTO">
         SELECT DISTINCT
-            t7.`code`,t7.mode_id, t6.msg
+        t4.`code`,
+        t4.mode_id,
+        t3.msg
         FROM
-            med_medical_record t1,
-            qc_model_hospital t2,
-            med_record_type t3,
-            qc_type_doc t4,
-            qc_type_cases_entry t5,
-            qc_cases_entry_hospital t6,
-            qc_cases_entry t7
+        med_behospital_info t1,
+        qc_type_cases_entry t2,
+        qc_cases_entry_hospital t3,
+        qc_cases_entry t4
         WHERE
-            t1.hospital_id = t2.hospital_id
-        AND t2.stand_model_name = '入院记录'
-        AND t2.hospital_model_name = t1.rec_title
-        AND t3.type_name = t2.hospital_model_name
-        AND t3.hospital_id = t4.hospital_id
-        AND t3.type_id = t4.hospital_type_id
+        t1.qc_type_id = t2.type_id
+        AND t2.case_entry_id = t3.cases_entry_id
+        AND t1.hospital_id = t3.hospital_id
+        AND t3.cases_entry_id = t4.id
+        AND t3.is_used = 1
+        AND t1.is_deleted = 'N'
+        AND t2.is_deleted = 'N'
+        AND t3.is_deleted = 'N'
         AND t4.is_deleted = 'N'
-        AND t5.is_deleted = 'N'
-        AND t6.is_deleted = 'N'
-        AND t7.is_deleted = 'N'
-        AND t4.type_id = t5.type_id
-        AND t5.case_entry_id = t6.cases_entry_id
-        AND t6.cases_entry_id = t7.id
-        AND t6.is_used = 1
         <if test="hospitalId != null and hospitalId != ''">
             AND t1.hospital_id = #{hospitalId}
         </if>

+ 19 - 0
src/main/resources/mapper/QcCasesEntryPagedataMapper.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.QcCasesEntryPagedataMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.QcCasesEntryPagedata">
+        <id column="id" property="id" />
+        <result column="cases_entry_id" property="casesEntryId" />
+        <result column="hospital_id" property="hospitalId" />
+        <result column="page_key" property="pageKey" />
+        <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>
+
+</mapper>

+ 8 - 2
src/main/resources/mapper/QcresultInfoMapper.xml

@@ -19,9 +19,9 @@
     </resultMap>
 
     <!-- 缺陷排行列表 -->
-    <select id="getQcresultSelectively"  parameterType="com.diagbot.vo.FilterVO" resultMap="BaseResultMap">
+    <select id="getQcresultSelectively"  parameterType="com.diagbot.vo.QcresultFilterVO" resultType="int">
         SELECT
-        b.*
+        count(*)
         FROM
         med_behospital_info a,
         med_qcresult_info b
@@ -36,6 +36,12 @@
         <if test="startDate != null and startDate != ''">
             <![CDATA[ and a.leave_hospital_date >= #{startDate}]]>
         </if>
+        <if test="gradeType != null and gradeType != ''">
+            AND b.grade_type = #{gradeType}
+        </if>
+        <if test="level != null and level != ''">
+            AND b.level = #{level}
+        </if>
     </select>
 
 </mapper>