|
@@ -1563,36 +1563,24 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
BeanUtil.copyProperties(analyzeRunVO, analyzeVO);
|
|
|
Long hospitalId = analyzeVO.getHospitalId();
|
|
|
// 获取病历信息
|
|
|
- BehospitalInfo behospitalInfo = this.getOne(new QueryWrapper<BehospitalInfo>()
|
|
|
- .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("hospital_id", analyzeRunVO.getHospitalId())
|
|
|
- .eq("behospital_code", analyzeRunVO.getBehospitalCode()), false
|
|
|
- );
|
|
|
- if (null == behospitalInfo) {
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该病历不存在或已删除!");
|
|
|
- }
|
|
|
+ BehospitalInfo behospitalInfo = this.getOne(new QueryWrapper<BehospitalInfo>().eq("is_deleted", IsDeleteEnum.N.getKey()).eq("hospital_id", analyzeRunVO.getHospitalId()).eq("behospital_code", analyzeRunVO.getBehospitalCode()), false);
|
|
|
+ if (null == behospitalInfo) throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该病历不存在或已删除!");
|
|
|
+
|
|
|
// 处理公共数据
|
|
|
QueryVo queryVo = dealCommonData(hospitalId, analyzeVO);
|
|
|
// 调用质控接口
|
|
|
Response<OutputInfo> response = qcServiceClient.extract(queryVo);
|
|
|
if (response == null || response.getData() == null) {
|
|
|
- if (null == response) {
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR, "远程质控接口没有返回数据!【" + analyzeVO.getBehospitalCode() + "】");
|
|
|
- } else {
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,
|
|
|
- "远程质控接口没有返回数据!【" + analyzeVO.getBehospitalCode() + "】错误原因:" + response.getMsg());
|
|
|
- }
|
|
|
+ if (null == response) throw new CommonException(CommonErrorCode.RPC_ERROR, "远程质控接口没有返回数据!【" + analyzeVO.getBehospitalCode() + "】");
|
|
|
+ else throw new CommonException(CommonErrorCode.RPC_ERROR,"远程质控接口没有返回数据!【" + analyzeVO.getBehospitalCode() + "】错误原因:" + response.getMsg());
|
|
|
}
|
|
|
+
|
|
|
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<String> codeList = new ArrayList<>(); // 质控编码列表
|
|
|
+ Map<String, String> codeToInfoMap = new LinkedHashMap<>(); // code和info的映射map
|
|
|
+ setCodeData(outputInfo, codeList, codeToInfoMap); // 对codeList 和 codeToInfoMap进行赋值
|
|
|
AlgorithmDTO algorithmDTO = new AlgorithmDTO();
|
|
|
- // 如果是1,说明已是终末质控,不再保存质控结果数据;如果是0,则保存质控结果数据
|
|
|
- if ("0".equals(analyzeRunVO.getIsPlacefile())) {
|
|
|
+ if ("0".equals(analyzeRunVO.getIsPlacefile())) { // 如果是1,说明已是终末质控,不再保存质控结果数据;如果是0,则保存质控结果数据
|
|
|
Map<String, Object> resMap = calScoreAndSave(outputInfo, codeList, codeToInfoMap, analyzeVO, queryVo.getBehospitalInfo().getIsPlacefile());
|
|
|
algorithmDTO = (AlgorithmDTO) resMap.get("algorithmDTO");
|
|
|
}else{
|
|
@@ -1602,17 +1590,13 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
}
|
|
|
|
|
|
List<MsgDTO> msgDTOList = getMsg(analyzeVO);
|
|
|
- if (ListUtil.isNotEmpty(msgDTOList)) {
|
|
|
- // 从qc_question_info的cases_entry_ids获取
|
|
|
+ if (ListUtil.isNotEmpty(msgDTOList)) { // 从qc_question_info的cases_entry_ids获取
|
|
|
Map<String, Object> paramMap = new HashMap<>();
|
|
|
paramMap.put("hospitalId", analyzeRunVO.getHospitalId());
|
|
|
paramMap.put("casesEntryIds", msgDTOList.stream().map(r -> r.getCasesEntryId()).collect(Collectors.toList()));
|
|
|
Map<Long, List<QuestionEntryDTO>> quesEntryMap = qcQuestionFacade.getByCaseEntryIdsFac(paramMap);
|
|
|
for (MsgDTO msgDTO : msgDTOList) {
|
|
|
- if (quesEntryMap.get(msgDTO.getCasesEntryId()) != null) {
|
|
|
- msgDTO.setPageKeyList(quesEntryMap.get(msgDTO.getCasesEntryId())
|
|
|
- .stream().map(r -> r.getId()).collect(Collectors.toList()));
|
|
|
- }
|
|
|
+ if (quesEntryMap.get(msgDTO.getCasesEntryId()) != null) msgDTO.setPageKeyList(quesEntryMap.get(msgDTO.getCasesEntryId()).stream().map(r -> r.getId()).collect(Collectors.toList()));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1621,42 +1605,27 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
BigDecimal res = new BigDecimal(120);
|
|
|
BigDecimal resPr = new BigDecimal(100);
|
|
|
String reNum = "0";
|
|
|
- SysHospitalSet sysHospitalSet
|
|
|
- = sysHospitalSetFacade.getOne(new QueryWrapper<SysHospitalSet>()
|
|
|
- .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("hospital_id", analyzeRunVO.getHospitalId())
|
|
|
- , false);
|
|
|
- if (null != sysHospitalSet && sysHospitalSet.getValue().equals("1")) {
|
|
|
- //百分制
|
|
|
+ SysHospitalSet sysHospitalSet = sysHospitalSetFacade.getOne(new QueryWrapper<SysHospitalSet>().eq("is_deleted", IsDeleteEnum.N.getKey()).eq("hospital_id", analyzeRunVO.getHospitalId()), false);
|
|
|
+ if (null != sysHospitalSet && sysHospitalSet.getValue().equals("1")) { //百分制
|
|
|
reNum = "1";
|
|
|
}
|
|
|
QcResultApiDTO qcResultApiDTO = new QcResultApiDTO();
|
|
|
if(StringUtils.isNotEmpty(algorithmDTO.getLevel()) && algorithmDTO.getScore()!=null && msgDTOList != null){
|
|
|
- if("1".equals(reNum)) {
|
|
|
- bigDecimal = resPr.subtract(algorithmDTO.getScore());
|
|
|
- }else if("0".equals(reNum)){
|
|
|
- bigDecimal = res.subtract(algorithmDTO.getScore().multiply(new BigDecimal(120))
|
|
|
- .divide(new BigDecimal(100), 1, RoundingMode.HALF_UP));
|
|
|
- }
|
|
|
-
|
|
|
- //缺陷总数
|
|
|
- Long num = msgDTOList
|
|
|
- .stream()
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .count();
|
|
|
- qcResultApiDTO.setScoreRes(algorithmDTO.getScore());
|
|
|
- qcResultApiDTO.setLevel(algorithmDTO.getLevel());
|
|
|
- qcResultApiDTO.setNum(num);
|
|
|
- qcResultApiDTO.setNumScore(bigDecimal);
|
|
|
- resMapData.put("result", qcResultApiDTO);
|
|
|
- List<MsgApiDTO> msgApiDTOList = BeanUtil.listCopyTo(msgDTOList, MsgApiDTO.class);
|
|
|
- if (analyzeRunVO.getNeedGroup() == 0) {
|
|
|
- resMapData.put("details", msgApiDTOList);
|
|
|
- } else {
|
|
|
- Map<String, List<MsgApiDTO>> msgMap = EntityUtil.makeEntityListMap(msgApiDTOList, "modelName");
|
|
|
- resMapData.put("details", msgMap);
|
|
|
- }
|
|
|
- };
|
|
|
+ if("1".equals(reNum)) bigDecimal = resPr.subtract(algorithmDTO.getScore());
|
|
|
+ else if("0".equals(reNum)) bigDecimal = res.subtract(algorithmDTO.getScore().multiply(new BigDecimal(120)).divide(new BigDecimal(100), 1, RoundingMode.HALF_UP));
|
|
|
+ //缺陷总数
|
|
|
+ Long num = msgDTOList.stream().filter(Objects::nonNull).count();
|
|
|
+ qcResultApiDTO.setScoreRes(algorithmDTO.getScore());
|
|
|
+ qcResultApiDTO.setLevel(algorithmDTO.getLevel());
|
|
|
+ qcResultApiDTO.setNum(num);
|
|
|
+ qcResultApiDTO.setNumScore(bigDecimal);
|
|
|
+ resMapData.put("result", qcResultApiDTO);
|
|
|
+ List<MsgApiDTO> msgApiDTOList = BeanUtil.listCopyTo(msgDTOList, MsgApiDTO.class);
|
|
|
+ if (analyzeRunVO.getNeedGroup() == 0) resMapData.put("details", msgApiDTOList);
|
|
|
+ else resMapData.put("details", EntityUtil.makeEntityListMap(msgApiDTOList, "modelName"));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
return resMapData;
|
|
|
}
|
|
|
|