Browse Source

Merge branch 'master' into his/qq

# Conflicts:
#	src/main/java/com/diagbot/facade/BehospitalInfoFacade.java
lantone 5 years ago
parent
commit
d27a1e3930

+ 4 - 1
doc/001.20200417第一版本/qc_init.sql

@@ -424,7 +424,8 @@ CREATE TABLE `med_home_page` (
   `gmt_modified` datetime DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
   `creator` varchar(60) DEFAULT '0' COMMENT '创建人,0表示无创建人值',
   `modifier` varchar(60) DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
-  PRIMARY KEY (`home_page_id`,`hospital_id`)
+  PRIMARY KEY (`home_page_id`,`hospital_id`),
+  KEY `behospital_code` (`behospital_code`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 -- ----------------------------
@@ -457,6 +458,8 @@ CREATE TABLE `med_medical_record_content` (
   `hospital_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '医院ID',
   `content_blob` longblob COMMENT '文书内容(blob)',
   `content_text` longtext COMMENT '病历文本(文本)',
+  `html_text` longtext COMMENT 'html文本信息',
+  `xml_text` longtext COMMENT 'xml文本信息',
   `is_deleted` char(3) DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
   `gmt_create` datetime DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
   `gmt_modified` datetime DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',

+ 6 - 0
pom.xml

@@ -196,6 +196,12 @@
 			<scope>runtime</scope>
 		</dependency>
 
+        <dependency>
+            <groupId>io.github.lvyahui8</groupId>
+            <artifactId>spring-boot-data-aggregator-starter</artifactId>
+            <version>${aggregator.version}</version>
+        </dependency>
+
     </dependencies>
 
     <!-- 私有仓库 -->

+ 124 - 0
src/main/java/com/diagbot/aggregate/ResultStatisticsAggregate.java

@@ -0,0 +1,124 @@
+package com.diagbot.aggregate;
+
+import com.diagbot.dto.ResultDetailDTO;
+import com.diagbot.facade.BehospitalInfoFacade;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.vo.FilterVO;
+import com.google.common.collect.Lists;
+import io.github.lvyahui8.spring.annotation.DataConsumer;
+import io.github.lvyahui8.spring.annotation.DataProvider;
+import io.github.lvyahui8.spring.annotation.InvokeParameter;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.DecimalFormat;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/4/22 18:09
+ */
+@Component
+public class ResultStatisticsAggregate {
+    @Autowired
+    private BehospitalInfoFacade behospitalInfoFacade;
+
+    @DataProvider("setAllResult")
+    public Map<String, Object> setAllResult(
+            @InvokeParameter("filterVO") FilterVO filterVO,
+            @DataConsumer("getResult") List<ResultDetailDTO> results,
+            @DataConsumer("getResultDept") List<ResultDetailDTO> results2) {
+        Map<String, Object> retMap = new LinkedHashMap<>();
+        if (ListUtil.isNotEmpty(results)) {
+            retMap.put("缺陷排行列表", results);
+        }
+        if (ListUtil.isNotEmpty(results2)) {
+            retMap.put("各科室缺陷占比", results2);
+        }
+        return retMap;
+    }
+
+    @DataProvider("getResult")
+    public List<ResultDetailDTO> getResult(@InvokeParameter("filterVO") FilterVO filterVO) {
+        List<ResultDetailDTO> results = behospitalInfoFacade.resultStatistics2(filterVO);
+
+        if (ListUtil.isNotEmpty(results)) {
+            int totle = results
+                    .stream()
+                    .map(ResultDetailDTO::getNum)
+                    .reduce(0, Integer::sum);
+            List<ResultDetailDTO> retResutls = Lists.newLinkedList();
+            results.forEach(result -> {
+                Double percent = BigDecimal.valueOf(result.getNum())
+                        .divide(BigDecimal.valueOf(totle), 4, RoundingMode.HALF_UP)
+                        .doubleValue();
+                result.setPercent(percent);
+                DecimalFormat df = new DecimalFormat("#0.00");
+                String percentStr
+                        = df.format(BigDecimal.valueOf(result.getPercent()).multiply(BigDecimal.valueOf(100))) + "%";
+                result.setPercentStr(percentStr);
+                if (retResutls.size() < 10) {
+                    retResutls.add(result);
+                }
+
+            });
+            return retResutls;
+        }
+
+        return null;
+    }
+
+    @DataProvider("getResultDept")
+    public List<ResultDetailDTO> getResultDept(@InvokeParameter("filterVO") FilterVO filterVO) {
+        List<ResultDetailDTO> results2 = behospitalInfoFacade.resultStatisticsByDept2(filterVO);
+        if (ListUtil.isNotEmpty(results2)) {
+            int totle = results2
+                    .stream()
+                    .map(ResultDetailDTO::getNum)
+                    .reduce(0, Integer::sum);
+            results2.forEach(result -> {
+                Double percent = BigDecimal.valueOf(result.getNum())
+                        .divide(BigDecimal.valueOf(totle), 4, RoundingMode.HALF_UP)
+                        .doubleValue();
+                result.setPercent(percent);
+            });
+            List<ResultDetailDTO> retResults = Lists.newLinkedList();
+            if (results2.size() <= 6) {
+                retResults = BeanUtil.listCopyTo(results2, ResultDetailDTO.class);
+            } else {
+
+                Double rate = 0d;
+                Integer num = 0;
+                for (ResultDetailDTO result : results2) {
+                    if (retResults.size() < 5) {
+                        rate = BigDecimal.valueOf(rate)
+                                .add(BigDecimal.valueOf(Double.valueOf(result.getPercent())))
+                                .doubleValue();
+                        retResults.add(result);
+                    } else {
+                        num += result.getNum();
+                    }
+                }
+                ResultDetailDTO retResult = new ResultDetailDTO();
+                retResult.setName("其他");
+                retResult.setNum(num);
+                retResult.setPercent(BigDecimal.valueOf(1).subtract(BigDecimal.valueOf(rate)).doubleValue());
+                retResults.add(retResult);
+            }
+            retResults.forEach(result -> {
+                DecimalFormat df = new DecimalFormat("#0.00");
+                String percentStr
+                        = df.format(BigDecimal.valueOf(result.getPercent()).multiply(BigDecimal.valueOf(100))) + "%";
+                result.setPercentStr(percentStr);
+            });
+            return retResults;
+        }
+        return null;
+    }
+}

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

@@ -49,6 +49,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/behospitalInfo/execule").permitAll()
                 .antMatchers("/qc/behospitalInfo/analyze_rpc").permitAll()
                 .antMatchers("/qc/behospitalInfo/analyze").permitAll()
+                .antMatchers("/qc/behospitalInfo/analyze_api").permitAll()
                 .antMatchers("/**").authenticated();
 //                .antMatchers("/**").permitAll();
     }

+ 1 - 0
src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -92,6 +92,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/qc/behospitalInfo/execule", request)
                 || matchers("/qc/behospitalInfo/analyze_rpc", request)
                 || matchers("/qc/behospitalInfo/analyze", request)
+                || matchers("/qc/behospitalInfo/analyze_api", request)
                 || matchers("/", request)) {
             return true;
         }

+ 24 - 0
src/main/java/com/diagbot/dto/MsgApiDTO.java

@@ -0,0 +1,24 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2020/4/14 13:07
+ */
+@Getter
+@Setter
+public class MsgApiDTO {
+    //得分
+    private BigDecimal score;
+    //提示信息
+    private String msg;
+    //单项否决
+    private String isReject;
+    //模块名称
+    private String modelName;
+}

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

@@ -0,0 +1,31 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * <p>
+ * 质控评分结果信息
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-04-13
+ */
+@Data
+public class QcResultApiDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 等级
+     */
+    private String level;
+
+    /**
+     * 最后得分
+     */
+    private BigDecimal scoreRes;
+
+}

+ 9 - 0
src/main/java/com/diagbot/dto/RecordContentDTO.java

@@ -27,6 +27,15 @@ public class RecordContentDTO implements Serializable {
      */
     private String contentText;
 
+    /**
+     * html内容
+     */
+    private String htmlText;
+    /**
+     * xml内容
+     */
+    private String xmlText;
+
     /**
      * 加密信息
      */

+ 10 - 0
src/main/java/com/diagbot/entity/MedicalRecordContent.java

@@ -41,6 +41,16 @@ public class MedicalRecordContent implements Serializable {
      */
     private String contentText;
 
+    /**
+     * html文本信息
+     */
+    private String htmlText;
+
+    /**
+     * xml文本信息
+     */
+    private String xmlText;
+
     /**
      * 是否删除,N:未删除,Y:删除
      */

+ 70 - 13
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -9,10 +9,12 @@ import com.diagbot.dto.AlgorithmDTO;
 import com.diagbot.dto.AnalyzeDTO;
 import com.diagbot.dto.BehosDTO;
 import com.diagbot.dto.BehospitalInfoDTO;
+import com.diagbot.dto.MsgApiDTO;
 import com.diagbot.dto.MsgDTO;
 import com.diagbot.dto.OutputInfo;
 import com.diagbot.dto.QcCasesEntryDTO;
 import com.diagbot.dto.QcModeDTO;
+import com.diagbot.dto.QcResultApiDTO;
 import com.diagbot.dto.QcResultDTO;
 import com.diagbot.dto.RecordContentDTO;
 import com.diagbot.dto.Response;
@@ -27,7 +29,6 @@ import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.BehospitalInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
-import com.diagbot.util.DBConn;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.EncrypDES;
 import com.diagbot.util.EntityUtil;
@@ -35,6 +36,7 @@ import com.diagbot.util.ListUtil;
 import com.diagbot.util.MapUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.AlgorithmVO;
+import com.diagbot.vo.AnalyzeApiVO;
 import com.diagbot.vo.AnalyzeVO;
 import com.diagbot.vo.BehospitalPageVO;
 import com.diagbot.vo.GetDetailVO;
@@ -188,6 +190,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         return res;
     }
 
+
     public AnalyzeDTO analyze(AnalyzeVO analyzeVO) {
         Long hospitalId = analyzeVO.getHospitalId();
         if (!analyzeVO.getIsTask()) {
@@ -214,7 +217,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
                 EncrypDES encrypDES = new EncrypDES();
                 for (RecordContentDTO recordContentDTO : recordContentDTOList) {
                     recTitle = recordContentDTO.getRecTitle();
-                    recordContentDTO.setContentText(encrypDES.decryptor(recordContentDTO.getContentText()));
+                    recordContentDTO.setXmlText(encrypDES.decryptor(recordContentDTO.getXmlText()));
                 }
             } catch (Exception e) {
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
@@ -366,7 +369,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
             MedrecVo medrecVo = new MedrecVo();
             medrecVo.setTitle(key);
             Map<String, Object> content = new HashMap<>();
-            content.put("content", list.stream().map(r -> r.getContentText()).collect(Collectors.toList()));
+            content.put("content", list.stream().map(r -> r.getXmlText()).collect(Collectors.toList()));
             medrecVo.setContent(content);
             medrecVoList.add(medrecVo);
         }
@@ -389,7 +392,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         Boolean flag = false;
         for (String k : keyList) {
             if (ListUtil.isNotEmpty(recMap.get(k))) {
-                listMap.put(k, recMap.get(k).stream().map(r -> r.getContentText()).collect(Collectors.toList()));
+                listMap.put(k, recMap.get(k).stream().map(r -> r.getXmlText()).collect(Collectors.toList()));
                 flag = true;
             }
         }
@@ -425,7 +428,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
             Set<String> keyList = keyMap.keySet();
             for (String k : keyList) {
                 if (ListUtil.isNotEmpty(keyMap.get(k))) {
-                    listMap.put(k, keyMap.get(k).stream().map(r -> r.getContentText()).collect(Collectors.toList()));
+                    listMap.put(k, keyMap.get(k).stream().map(r -> r.getXmlText()).collect(Collectors.toList()));
                 }
             }
             content.put("content", listMap);
@@ -616,12 +619,66 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
 //            }
 //        }
     }
-    
-    @Autowired
-	private BehospitalInfoServiceImpl behospitalInfoServiceImpl;
-	
-	public void executeTZ() {
-		List<BehospitalInfo> behospitalInfoList=DBConn.getBehospitalInfo();
-		behospitalInfoServiceImpl.saveBatch(behospitalInfoList);
-	}
+
+
+    /**
+     * 评分api
+     *
+     * @param analyzeApiVO
+     * @return
+     */
+    public Map<String, Object> analyzeApi(AnalyzeApiVO analyzeApiVO) {
+        AnalyzeVO analyzeVO = new AnalyzeVO();
+        BeanUtil.copyProperties(analyzeApiVO, analyzeVO);
+        // 评分
+        analyze(analyzeVO);
+        // 获取结果
+        GetDetailVO getDetailVO = new GetDetailVO();
+        getDetailVO.setHospitalId(analyzeApiVO.getHospitalId());
+        getDetailVO.setBehospitalCode(analyzeApiVO.getBehospitalCode());
+        return getByBehospitalCodeApi(getDetailVO);
+    }
+
+
+    /**
+     * 获取明细api
+     *
+     * @param getDetailVO
+     * @return
+     */
+    public Map<String, Object> getByBehospitalCodeApi(GetDetailVO getDetailVO) {
+        Map<String, Object> res = new HashMap<>(); // 返回结果
+        Long hospitalId = getDetailVO.getHospitalId();
+        // 获取病历信息
+        BehospitalInfo behospitalInfo = this.getOne(new QueryWrapper<BehospitalInfo>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", getDetailVO.getHospitalId())
+                .eq("behospital_code", getDetailVO.getBehospitalCode()), false
+        );
+
+        BehosDTO behosDTO = new BehosDTO();
+        if (behospitalInfo == null) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该病历已删除!");
+        }
+        BeanUtil.copyProperties(behospitalInfo, behosDTO);
+
+        // 获取结果主表信息
+        QcResultDTO qcResultDTO = qcresultInfoFacade.getByBehospitalCode(getDetailVO);
+        if (qcResultDTO == null) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该病历未评分!");
+        }
+        QcResultApiDTO qcResultApiDTO = new QcResultApiDTO();
+        BeanUtil.copyProperties(qcResultDTO, qcResultApiDTO);
+        res.put("result", qcResultApiDTO);
+
+        // 获取提示信息
+        AnalyzeVO analyzeVO = new AnalyzeVO();
+        BeanUtil.copyProperties(getDetailVO, analyzeVO);
+        List<MsgDTO> msgDTOList = getMsg(analyzeVO);
+        List<MsgApiDTO> msgApiDTOList = BeanUtil.listCopyTo(msgDTOList, MsgApiDTO.class);
+        Map<String, List<MsgApiDTO>> msgMap = EntityUtil.makeEntityListMap(msgApiDTOList, "modelName");
+
+        res.put("details", msgMap);
+        return res;
+    }
 }

+ 60 - 46
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -2,9 +2,10 @@ package com.diagbot.facade;
 
 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.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.ListUtil;
@@ -12,12 +13,14 @@ import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.FilterVO;
 import com.diagbot.vo.QcresultFilterVO;
 import com.google.common.collect.Lists;
+import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.math.BigDecimal;
-import java.text.DecimalFormat;
+import java.math.RoundingMode;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -36,6 +39,8 @@ public class ConsoleFacade {
     private BehospitalInfoFacade behospitalInfoFacade;
     @Autowired
     private HomePageFacade homePageFacade;
+    @Autowired
+    private DataBeanAggregateQueryFacade dataBeanAggregateQueryFacade;
 
 
     /**
@@ -153,51 +158,60 @@ public class ConsoleFacade {
         String startDate = getStartDateStr(filterVO.getType());
         filterVO.setStartDate(startDate);
         filterVO.setHospitalId(hospitalId);
-        if (filterVO.getLimitCount() == null || filterVO.getLimitCount().equals(0)) {
+        /*if (filterVO.getLimitCount() == null || filterVO.getLimitCount().equals(0)) {
             filterVO.setLimitCount(10);
-        }
-        List<ResultDetailDTO> results = behospitalInfoFacade.resultStatistics(filterVO);
-        if (ListUtil.isNotEmpty(results)) {
-            results.forEach(result -> {
-                DecimalFormat df = new DecimalFormat("#0.00");
-                String percentStr
-                        = df.format(BigDecimal.valueOf(result.getPercent()).multiply(BigDecimal.valueOf(100))) + "%";
-                result.setPercentStr(percentStr);
-            });
-            retMap.put("缺陷排行列表", results);
-        }
-        List<ResultDetailDTO> results2 = behospitalInfoFacade.resultStatisticsByDept(filterVO);
-        if (ListUtil.isNotEmpty(results2)) {
-            List<ResultDetailDTO> retResults = Lists.newLinkedList();
-            if (results2.size() <= 6) {
-                retResults = BeanUtil.listCopyTo(results2, ResultDetailDTO.class);
-            } else {
+        }*/
+        //        List<ResultDetailDTO> results = behospitalInfoFacade.resultStatistics(filterVO);
+        //        if (ListUtil.isNotEmpty(results)) {
+        //            results.forEach(result -> {
+        //                DecimalFormat df = new DecimalFormat("#0.00");
+        //                String percentStr
+        //                        = df.format(BigDecimal.valueOf(result.getPercent()).multiply(BigDecimal.valueOf(100))) + "%";
+        //                result.setPercentStr(percentStr);
+        //            });
+        //            retMap.put("缺陷排行列表", results);
+        //        }
+        //        List<ResultDetailDTO> results2 = behospitalInfoFacade.resultStatisticsByDept(filterVO);
+        //        if (ListUtil.isNotEmpty(results2)) {
+        //            List<ResultDetailDTO> retResults = Lists.newLinkedList();
+        //            if (results2.size() <= 6) {
+        //                retResults = BeanUtil.listCopyTo(results2, ResultDetailDTO.class);
+        //            } else {
+        //
+        //                Double rate = 0d;
+        //                Integer num = 0;
+        //                for (ResultDetailDTO result : results2) {
+        //                    if (retResults.size() < 5) {
+        //                        rate = BigDecimal.valueOf(rate)
+        //                                .add(BigDecimal.valueOf(Double.valueOf(result.getPercent())))
+        //                                .doubleValue();
+        //                        retResults.add(result);
+        //                    } else {
+        //                        num += result.getNum();
+        //                    }
+        //                }
+        //                ResultDetailDTO retResult = new ResultDetailDTO();
+        //                retResult.setName("其他");
+        //                retResult.setNum(num);
+        //                retResult.setPercent(BigDecimal.valueOf(1).subtract(BigDecimal.valueOf(rate)).doubleValue());
+        //                retResults.add(retResult);
+        //            }
+        //            retResults.forEach(result -> {
+        //                DecimalFormat df = new DecimalFormat("#0.00");
+        //                String percentStr
+        //                        = df.format(BigDecimal.valueOf(result.getPercent()).multiply(BigDecimal.valueOf(100))) + "%";
+        //                result.setPercentStr(percentStr);
+        //            });
+        //            retMap.put("各科室缺陷占比", retResults);
+        //        }
 
-                Double rate = 0d;
-                Integer num = 0;
-                for (ResultDetailDTO result : results2) {
-                    if (retResults.size() < 5) {
-                        rate = BigDecimal.valueOf(rate)
-                                .add(BigDecimal.valueOf(Double.valueOf(result.getPercent())))
-                                .doubleValue();
-                        retResults.add(result);
-                    } else {
-                        num += result.getNum();
-                    }
-                }
-                ResultDetailDTO retResult = new ResultDetailDTO();
-                retResult.setName("其他");
-                retResult.setNum(num);
-                retResult.setPercent(BigDecimal.valueOf(1).subtract(BigDecimal.valueOf(rate)).doubleValue());
-                retResults.add(retResult);
-            }
-            retResults.forEach(result -> {
-                DecimalFormat df = new DecimalFormat("#0.00");
-                String percentStr
-                        = df.format(BigDecimal.valueOf(result.getPercent()).multiply(BigDecimal.valueOf(100))) + "%";
-                result.setPercentStr(percentStr);
-            });
-            retMap.put("各科室缺陷占比", retResults);
+        try {
+            Map<String, Object> invokeParams = new HashMap<>();
+            invokeParams.put("filterVO", filterVO);
+            retMap
+                    = dataBeanAggregateQueryFacade.get("setAllResult", invokeParams, Map.class);
+        } catch (Exception e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR);
         }
         return retMap;
     }
@@ -290,7 +304,7 @@ public class ConsoleFacade {
                 }
             }
             averageValue = BigDecimal.valueOf(totleValue)
-                    .divide(BigDecimal.valueOf(num), 2)
+                    .divide(BigDecimal.valueOf(num), 2, RoundingMode.HALF_UP)
                     .doubleValue();
             AverageStatisticsDTO retAverageStatistics = new AverageStatisticsDTO();
             retAverageStatistics.setDeptName("其他");

+ 25 - 1
src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java

@@ -42,6 +42,30 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public List<ResultDetailDTO> resultStatisticsByDept(FilterVO filterVO);
 
+    /**
+     * 缺陷排行列表统计-百分比未计算
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<ResultDetailDTO> resultStatistics2(FilterVO filterVO);
+
+    /**
+     * 各科室缺陷占比-百分比未计算
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<ResultDetailDTO> resultStatisticsByDept2(FilterVO filterVO);
+
+    /**
+     * 缺陷总数
+     *
+     * @param filterVO
+     * @return
+     */
+    public int getTotleResultNum(FilterVO filterVO);
+
 
     public List<BehospitalInfo> getNoGrade();
-}
+}

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

@@ -42,6 +42,30 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      */
     public List<ResultDetailDTO> resultStatisticsByDept(FilterVO filterVO);
 
+    /**
+     * 缺陷排行列表统计-百分比未计算
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<ResultDetailDTO> resultStatistics2(FilterVO filterVO);
+
+    /**
+     * 各科室缺陷占比-百分比未计算
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<ResultDetailDTO> resultStatisticsByDept2(FilterVO filterVO);
+
+    /**
+     * 缺陷总数
+     *
+     * @param filterVO
+     * @return
+     */
+    public int getTotleResultNum(FilterVO filterVO);
+
 
     public List<BehospitalInfo> getNoGrade();
 }

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

@@ -58,6 +58,39 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
         return baseMapper.resultStatisticsByDept(filterVO);
     }
 
+    /**
+     * 缺陷排行列表统计-百分比未计算
+     *
+     * @param filterVO
+     * @return
+     */
+    @Override
+    public List<ResultDetailDTO> resultStatistics2(FilterVO filterVO) {
+        return baseMapper.resultStatistics2(filterVO);
+    }
+
+    /**
+     * 各科室缺陷占比-百分比未计算
+     *
+     * @param filterVO
+     * @return
+     */
+    @Override
+    public List<ResultDetailDTO> resultStatisticsByDept2(FilterVO filterVO) {
+        return baseMapper.resultStatisticsByDept2(filterVO);
+    }
+
+    /**
+     * 缺陷总数
+     *
+     * @param filterVO
+     * @return
+     */
+    @Override
+    public int getTotleResultNum(FilterVO filterVO) {
+        return baseMapper.getTotleResultNum(filterVO);
+    }
+
     @Override
     public List<BehospitalInfo> getNoGrade() {
         return baseMapper.getNoGrade();

+ 18 - 0
src/main/java/com/diagbot/vo/AnalyzeApiVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @description:
+ * @author: zhoutg
+ * @time: 2020/4/13 18:31
+ */
+@Data
+public class AnalyzeApiVO {
+
+    private String behospitalCode; // 病历id
+    private Long hospitalId; //医院ID
+    @ApiModelProperty(hidden = true)
+    private Boolean isTask = true; // 使用hospitalId传入的值
+}

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

@@ -7,6 +7,7 @@ import com.diagbot.dto.BehospitalInfoDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.BehospitalInfoFacade;
 import com.diagbot.facade.QcresultInfoFacade;
+import com.diagbot.vo.AnalyzeApiVO;
 import com.diagbot.vo.AnalyzeVO;
 import com.diagbot.vo.BehospitalPageVO;
 import com.diagbot.vo.GetDetailVO;
@@ -84,6 +85,18 @@ public class BehospitalInfoController {
         return RespDTO.onSuc(behospitalInfoFacade.analyze(analyzeVO));
     }
 
+
+    @ApiOperation(value = "评分-对外api接口[by:zhoutg]",
+            notes = "")
+    @PostMapping("/analyze_api")
+    @SysLogger("analyze_api")
+    @Transactional
+//    @ApiIgnore
+    public RespDTO<Map<String, Object>> analyzeApi(@RequestBody AnalyzeApiVO analyzeApiVO) {
+        return RespDTO.onSuc(behospitalInfoFacade.analyzeApi(analyzeApiVO));
+    }
+
+
     @ApiOperation(value = "新增质控条目[by:zhoutg]",
             notes = "")
     @PostMapping("/addCase")

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

@@ -150,10 +150,15 @@ mybatis-plus:
     map-underscore-to-camel-case: true
     cache-enabled: false
 
+io.github.lvyahui8.spring:
+  base-packages: com.diagbot.aggregate
+  thread-number: 12
+
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
 qc.address: http://192.168.2.232:6009
 
+# 加解密开关
 encrypt:
   enable: true
 

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

@@ -150,10 +150,15 @@ mybatis-plus:
     map-underscore-to-camel-case: true
     cache-enabled: false
 
+io.github.lvyahui8.spring:
+  base-packages: com.diagbot.aggregate
+  thread-number: 12
+
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
 qc.address: http://192.168.2.232:6009
 
+# 加解密开关
 encrypt:
   enable: false
 

+ 6 - 1
src/main/resources/application-pre.yml

@@ -150,12 +150,17 @@ mybatis-plus:
     map-underscore-to-camel-case: true
     cache-enabled: false
 
+io.github.lvyahui8.spring:
+  base-packages: com.diagbot.aggregate
+  thread-number: 12
+
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
 qc.address: http://192.168.2.232:6009
 
+# 加解密开关
 encrypt:
-  enable: false
+  enable: true
 
 swagger:
   enable: true

+ 6 - 1
src/main/resources/application-pro.yml

@@ -150,12 +150,17 @@ mybatis-plus:
     map-underscore-to-camel-case: true
     cache-enabled: false
 
+io.github.lvyahui8.spring:
+  base-packages: com.diagbot.aggregate
+  thread-number: 12
+
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
 qc.address: http://192.168.2.232:6009
 
+# 加解密开关
 encrypt:
-  enable: false
+  enable: true
 
 swagger:
   enable: true

+ 6 - 1
src/main/resources/application-test.yml

@@ -150,12 +150,17 @@ mybatis-plus:
     map-underscore-to-camel-case: true
     cache-enabled: false
 
+io.github.lvyahui8.spring:
+  base-packages: com.diagbot.aggregate
+  thread-number: 12
+
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
 qc.address: http://192.168.2.232:6009
 
+# 加解密开关
 encrypt:
-  enable: false
+  enable: true
 
 swagger:
   enable: true

+ 87 - 0
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -210,6 +210,93 @@
         )
     </select>
 
+    <!-- 缺陷排行列表 -->
+    <select id="resultStatistics2"  parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.ResultDetailDTO">
+        SELECT
+        c.msg as name,
+        count(*) AS num
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c
+        WHERE
+        a.behospital_code = b.behospital_code
+        AND a.hospital_id = b.hospital_id
+        AND b.behospital_code = c.behospital_code
+        AND b.hospital_id = c.hospital_id
+        AND a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.behospital_date >= #{startDate}]]>
+        </if>
+        GROUP BY
+        c.msg
+        ORDER BY
+        count(*) DESC
+        <if test="limitCount != null and limitCount != ''">
+            limit 0,#{limitCount}
+        </if>
+    </select>
+
+    <!-- 各科室缺陷占比 -->
+    <select id="resultStatisticsByDept2"  parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.ResultDetailDTO">
+        SELECT
+        a.beh_dept_id,
+        a.beh_dept_name as name,
+        count(*) AS num
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c
+        WHERE
+        a.behospital_code = b.behospital_code
+        AND a.hospital_id = b.hospital_id
+        AND b.behospital_code = c.behospital_code
+        AND b.hospital_id = c.hospital_id
+        AND a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.behospital_date >= #{startDate}]]>
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        a.beh_dept_name
+        ORDER BY
+        count(*) DESC
+    </select>
+
+    <!-- 缺陷总数查询-->
+    <select id="getTotleResultNum"  parameterType="com.diagbot.vo.FilterVO" resultType="int">
+        SELECT
+        count(*) AS totle
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c
+        WHERE
+        a.behospital_code = b.behospital_code
+        AND a.hospital_id = b.hospital_id
+        AND b.behospital_code = c.behospital_code
+        AND b.hospital_id = c.hospital_id
+        AND a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.behospital_date >= #{startDate}]]>
+        </if>
+    </select>
+
 
     <select id="getNoGrade" resultMap="BaseResultMap">
          select * from med_behospital_info a

+ 1 - 1
src/main/resources/mapper/MedicalRecordMapper.xml

@@ -19,7 +19,7 @@
     </resultMap>
 
     <select id="getRecordContent"  resultType="com.diagbot.dto.RecordContentDTO">
-        select t1.rec_id, t1.rec_title, t2.name stand_model_name, t3.content_text
+        select t1.rec_id, t1.rec_title, t2.name stand_model_name, t3.content_text, t3.html_text, t3.xml_text
         from med_medical_record t1, qc_mode t2, med_medical_record_content t3
         where
              t1.is_deleted = 'N'

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

@@ -50,7 +50,7 @@
         <if test="isUsed != null ">
             AND b.is_used =#{isUsed}
         </if>
-        ORDER BY b.gmt_modified DESC
+        ORDER BY a.cases_id,a.order_no DESC
     </select>
     <select id="findQcCasesEntryAll" resultType="com.diagbot.dto.QcCasesEntryFindDTO">
         SELECT DISTINCT