|
@@ -44,15 +44,9 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.LinkedHashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -1654,13 +1648,18 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
Map<String, String> codeToInfoMap = new LinkedHashMap<>();
|
|
|
// 对codeList 和 codeToInfoMap进行赋值
|
|
|
setCodeData(outputInfo, codeList, codeToInfoMap);
|
|
|
-
|
|
|
+ AlgorithmDTO algorithmDTO = new AlgorithmDTO();
|
|
|
// 如果是1,说明已是终末质控,不再保存质控结果数据;如果是0,则保存质控结果数据
|
|
|
if ("0".equals(analyzeRunVO.getIsPlacefile())) {
|
|
|
- // 计算分值并保存结果至数据库
|
|
|
Map<String, Object> resMap = calScoreAndSave(outputInfo, codeList, codeToInfoMap, analyzeVO, queryVo.getBehospitalInfo().getIsPlacefile());
|
|
|
+ algorithmDTO = (AlgorithmDTO) resMap.get("algorithmDTO");
|
|
|
+ }else{
|
|
|
+ //终末质控不保存数据
|
|
|
+ Map<String, Object> resMap = calScore(outputInfo, codeList, codeToInfoMap, analyzeVO, queryVo.getBehospitalInfo().getIsPlacefile());
|
|
|
+ algorithmDTO = (AlgorithmDTO) resMap.get("algorithmDTO");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
// 返回缺陷提示信息
|
|
|
List<MsgDTO> msgDTOList = new ArrayList<>();
|
|
|
if (ListUtil.isNotEmpty(codeList)) {
|
|
@@ -1684,8 +1683,22 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
|
|
|
//返回参数组装
|
|
|
AnalyzeRunDTO analyzeRunDTO = new AnalyzeRunDTO();
|
|
|
- // analyzeRunDTO.setScoreRes(algorithmDTO.getScore());
|
|
|
- // analyzeRunDTO.setLevel(algorithmDTO.getLevel());
|
|
|
+ //缺陷总扣分
|
|
|
+ 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);
|
|
|
+
|
|
|
+ BigDecimal bigDecimal = new BigDecimal(0);
|
|
|
+ analyzeRunDTO.setScoreRes(algorithmDTO.getScore()==null ? bigDecimal:algorithmDTO.getScore());
|
|
|
+ analyzeRunDTO.setLevel(algorithmDTO.getLevel()==null?"":algorithmDTO.getLevel());
|
|
|
analyzeRunDTO.setMsgDTOList(msgDTOList);
|
|
|
return analyzeRunDTO;
|
|
|
}
|
|
@@ -1840,6 +1853,53 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 计算分值
|
|
|
+ *
|
|
|
+ * @param outputInfo 质控出参数据
|
|
|
+ * @param codeList 质控编码列表
|
|
|
+ * @param codeToInfoMap 质控编码对应的info信息
|
|
|
+ * @param analyzeVO 入参
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String, Object> calScore(OutputInfo outputInfo, List<String> codeList,
|
|
|
+ Map<String, String> codeToInfoMap, AnalyzeVO analyzeVO,
|
|
|
+ String isPlacefile) {
|
|
|
+ Long hospitalId = analyzeVO.getHospitalId();
|
|
|
+ List<QcResultAlgVO> qcResultAlgVOList = new ArrayList<>();
|
|
|
+ if (ListUtil.isNotEmpty(codeList)) {
|
|
|
+ // 根据质控结果获取质控条目
|
|
|
+ QcResultAlgQueryVO qcResultAlgQueryVO = new QcResultAlgQueryVO();
|
|
|
+ qcResultAlgQueryVO.setCodeList(codeList);
|
|
|
+ qcResultAlgQueryVO.setHospitalId(hospitalId);
|
|
|
+ qcResultAlgQueryVO.setIsPlacefile(isPlacefile);
|
|
|
+ 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(isPlacefile);
|
|
|
+ AlgorithmDTO algorithmDTO = algorithmFacade.getAlgorithmRes(algorithmVO);
|
|
|
+
|
|
|
+ // 返回结果信息
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("algorithmDTO", algorithmDTO);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 计算分值并保存结果至数据库
|