|
@@ -46,6 +46,7 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -156,6 +157,9 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
MedTransferRecordFacade medTransferRecordFacade;
|
|
|
@Autowired
|
|
|
MedNurseFacade medNurseFacade;
|
|
|
+ @Autowired
|
|
|
+ SysHospitalSetFacade sysHospitalSetFacade;
|
|
|
+
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -974,7 +978,6 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
analyzeVO.setHospitalId(hospitalId);
|
|
|
|
|
|
// 处理公共数据
|
|
|
-
|
|
|
QueryVo queryVo = dealCommonData(hospitalId, analyzeVO);
|
|
|
queryVo.setUseCrfCache(analyzeVO.isUseCrfCache());
|
|
|
// 调用质控接口
|
|
@@ -1566,23 +1569,57 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
/**
|
|
|
* 评分api
|
|
|
*
|
|
|
- * @param analyzeApiVO
|
|
|
+ * @param analyzeRunVO
|
|
|
* @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());
|
|
|
- getDetailVO.setNeedGroup(analyzeApiVO.getNeedGroup());
|
|
|
- return getByBehospitalCodeApi(getDetailVO);
|
|
|
+ public AnalyzeRunDTO analyzeApi(AnalyzeRunVO analyzeRunVO) {
|
|
|
+ List<MsgDTO> msgDTOList = this.getMsgByBehospitalCode(analyzeRunVO);
|
|
|
+ //返回参数组装
|
|
|
+ AnalyzeRunDTO analyzeRunDTO = new AnalyzeRunDTO();
|
|
|
+
|
|
|
+ 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);
|
|
|
+ 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")) {
|
|
|
+ //百分制
|
|
|
+ reNum = "1";
|
|
|
+ }
|
|
|
+ if(null != qcresultInfo){
|
|
|
+ analyzeRunDTO.setLevel(qcresultInfo.getLevel()==null?"":qcresultInfo.getLevel());
|
|
|
+ analyzeRunDTO.setScoreRes(qcresultInfo.getScoreRes() ==null ? bigDecimal : qcresultInfo.getScoreRes());
|
|
|
+ if("1".equals(reNum)) {
|
|
|
+ bigDecimal = resPr.subtract(analyzeRunDTO.getScoreRes());
|
|
|
+ }else if("0".equals(reNum)){
|
|
|
+ bigDecimal = res.subtract(analyzeRunDTO.getScoreRes().multiply(new BigDecimal(120))
|
|
|
+ .divide(new BigDecimal(100), 1, RoundingMode.HALF_UP));
|
|
|
+ }
|
|
|
+ //缺陷总数
|
|
|
+ Long num = msgDTOList
|
|
|
+ .stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .count();
|
|
|
+ analyzeRunDTO.setNum(num);
|
|
|
+ analyzeRunDTO.setNumScore(bigDecimal);
|
|
|
+ analyzeRunDTO.setMsgDTOList(msgDTOList);
|
|
|
+ }
|
|
|
+ return analyzeRunDTO;
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 获取明细api
|
|
|
*
|
|
@@ -1668,31 +1705,62 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
public AnalyzeRunDTO analyzeRun(AnalyzeRunVO analyzeRunVO) {
|
|
|
- List<MsgDTO> msgDTOList = this.getMsgByBehospitalCode(analyzeRunVO);
|
|
|
+ Long modeId = analyzeRunVO.getModeId();
|
|
|
+ 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) {
|
|
|
+ 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);
|
|
|
+
|
|
|
+ // 如果是1,说明已是终末质控,不再保存质控结果数据;如果是0,则保存质控结果数据
|
|
|
+ if ("0".equals(analyzeRunVO.getIsPlacefile())) {
|
|
|
+ // 计算分值并保存结果至数据库
|
|
|
+ Map<String, Object> resMap = calScoreAndSave(outputInfo, codeList, codeToInfoMap, analyzeVO, queryVo.getBehospitalInfo().getIsPlacefile());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 返回缺陷提示信息
|
|
|
+ List<MsgDTO> msgDTOList = new ArrayList<>();
|
|
|
+ if (ListUtil.isNotEmpty(codeList)) {
|
|
|
+ AnalyzeCodeVO analyzeCodeVO = new AnalyzeCodeVO();
|
|
|
+ analyzeCodeVO.setCodeList(codeList);
|
|
|
+ analyzeCodeVO.setHospitalId(hospitalId);
|
|
|
+ analyzeCodeVO.setModeId(modeId);
|
|
|
+ // 获取缺陷条目信息
|
|
|
+ msgDTOList = getMsgByEntryCode(analyzeCodeVO);
|
|
|
+ // 设置info信息
|
|
|
+ if (codeToInfoMap != null && !codeToInfoMap.isEmpty()) {
|
|
|
+ for (MsgDTO msgDTO : msgDTOList) {
|
|
|
+ String info = codeToInfoMap.get(msgDTO.getCode());
|
|
|
+ if (StringUtil.isNotBlank(info)) {
|
|
|
+ msgDTO.setInfo(info);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//返回参数组装
|
|
|
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());
|
|
|
- }
|
|
|
+ // analyzeRunDTO.setScoreRes(algorithmDTO.getScore());
|
|
|
+ // analyzeRunDTO.setLevel(algorithmDTO.getLevel());
|
|
|
analyzeRunDTO.setMsgDTOList(msgDTOList);
|
|
|
return analyzeRunDTO;
|
|
|
}
|