Ver código fonte

缺陷总览

chengyao 4 anos atrás
pai
commit
ca297118f8

+ 52 - 24
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -1571,31 +1571,59 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
      */
     public AnalyzeRunDTO analyzeApi(AnalyzeRunVO analyzeRunVO) {
         List<MsgDTO> msgDTOList = this.getMsgByBehospitalCode(analyzeRunVO);
-        //返回参数组装
-        AnalyzeRunDTO analyzeRunDTO = new AnalyzeRunDTO();
-        //缺陷总扣分
-        BigDecimal numScore = msgDTOList
-                .stream()
-                .map(MsgDTO::getScore)
-                .filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
-        //缺陷总数
-        Long num = msgDTOList
-                .stream()
-                .filter(Objects::nonNull)
-                .count();
-        analyzeRunDTO.setNum(num);
-        analyzeRunDTO.setNumScore(numScore);
-        QcresultInfo qcresultInfo = qcresultInfoFacade.getOne(new QueryWrapper<QcresultInfo>()
-                .eq("behospital_code", analyzeRunVO.getBehospitalCode())
-                .eq("hospital_id", analyzeRunVO.getHospitalId())
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .select("behospital_code", "level", "score_res"));
-        BigDecimal bigDecimal = new BigDecimal(0);
-        if(null != qcresultInfo){
-            analyzeRunDTO.setLevel(qcresultInfo.getLevel()==null?"":qcresultInfo.getLevel());
-            analyzeRunDTO.setScoreRes(qcresultInfo.getScoreRes() ==null ? bigDecimal : qcresultInfo.getScoreRes());
+        analyzeRunVO.setModeId(null);
+        AnalyzeVO analyzeVO = new AnalyzeVO();
+        BeanUtil.copyProperties(analyzeRunVO, analyzeVO);
+        Long hospitalId = analyzeVO.getHospitalId();
+        // 处理公共数据
+        QueryVo queryVo = dealCommonData(hospitalId, analyzeVO);
+        //  调用质控接口
+        Response<OutputInfo> response = qcServiceClient.extract(queryVo);
+        if (response == null || response.getData() == null) {
+              return null;
+        }
+        OutputInfo outputInfo = response.getData();
+        // 质控编码列表
+        List<String> codeList = new ArrayList<>();
+        // code和info的映射map
+        Map<String, String> codeToInfoMap = new LinkedHashMap<>();
+        // 对codeList 和 codeToInfoMap进行赋值
+        setCodeData(outputInfo, codeList, codeToInfoMap);
+        List<QcResultAlgVO> qcResultAlgVOList = new ArrayList<>();
+        if (ListUtil.isNotEmpty(codeList)) {
+            // 根据质控结果获取质控条目
+            QcResultAlgQueryVO qcResultAlgQueryVO = new QcResultAlgQueryVO();
+            qcResultAlgQueryVO.setCodeList(codeList);
+            qcResultAlgQueryVO.setHospitalId(hospitalId);
+            qcResultAlgQueryVO.setIsPlacefile(analyzeRunVO.getIsPlacefile());
+            qcResultAlgVOList = qcCasesEntryFacade.getQcResultAlgVO(qcResultAlgQueryVO);
+        }
+
+        // 对info赋值
+        for (QcResultAlgVO bean : qcResultAlgVOList) {
+            String info = codeToInfoMap.get(bean.getCode());
+            if (StringUtil.isNotBlank(info)) {
+                bean.setInfo(info);
+            }
+        }
+
+        // 评分
+        AlgorithmVO algorithmVO = new AlgorithmVO();
+        algorithmVO.setType(0);
+        algorithmVO.setQcResultAlgVOList(qcResultAlgVOList);
+        algorithmVO.setHospitalId(hospitalId);
+        algorithmVO.setBehospitalCode(analyzeVO.getBehospitalCode());
+        algorithmVO.setQcResultAlgVOList(qcResultAlgVOList);
+        algorithmVO.setIsPlacefile(analyzeRunVO.getIsPlacefile());
+        AlgorithmDTO algorithmDTO = algorithmFacade.getAlgorithmRes(algorithmVO);
+        AnalyzeRunDTO  analyzeRunDTO =  new AnalyzeRunDTO();
+        if(null != algorithmDTO){
+            analyzeRunDTO.setLevel(algorithmDTO.getLevel());
+            analyzeRunDTO.setScoreRes(algorithmDTO.getScore());
+        }
+        if(null != algorithmDTO){
+            analyzeRunDTO.setMsgDTOList(msgDTOList);
         }
-        analyzeRunDTO.setMsgDTOList(msgDTOList);
         return analyzeRunDTO;
     }