|
@@ -38,7 +38,6 @@ import com.diagbot.vo.TaskVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
|
-import org.apache.commons.collections4.ListUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.ss.formula.functions.T;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -271,6 +270,49 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 仅获取缺陷总揽提示信息
|
|
|
+ *
|
|
|
+ * @param analyzeRunVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<MsgDTO> getMsgByBehospitalCode(AnalyzeRunVO analyzeRunVO) {
|
|
|
+ Long hospitalId = Long.parseLong(SysUserUtils.getCurrentHospitalID());
|
|
|
+ // 获取病历信息
|
|
|
+ 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, "该病历不存在或已删除!");
|
|
|
+ }
|
|
|
+ // 获取质控条目
|
|
|
+ AnalyzeVO analyzeVO = new AnalyzeVO();
|
|
|
+ BeanUtil.copyProperties(analyzeRunVO, analyzeVO);
|
|
|
+ List<QcCasesEntryDTO> qcCasesEntryDTOList = qcCasesEntryFacade.getQcCasesEntry(analyzeVO);
|
|
|
+ if (ListUtil.isEmpty(qcCasesEntryDTOList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "该病历无关联的质控条目!");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<MsgDTO> msgDTOList = getMsg(analyzeVO);
|
|
|
+ if (ListUtil.isNotEmpty(msgDTOList)) {
|
|
|
+ // 从qc_question_info的cases_entry_ids获取
|
|
|
+ Map<String, Object> paramMap = new HashMap<>();
|
|
|
+ paramMap.put("hospitalId", hospitalId);
|
|
|
+ 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()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return msgDTOList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 处理数据(公共方法)
|
|
|
*
|
|
@@ -1627,62 +1669,10 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
public AnalyzeRunDTO analyzeRun(AnalyzeRunVO analyzeRunVO) {
|
|
|
- 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());
|
|
|
- }
|
|
|
+ List<MsgDTO> msgDTOList = this.getMsgByBehospitalCode(analyzeRunVO);
|
|
|
+ if(ListUtil.isEmpty(msgDTOList)){
|
|
|
+ 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);
|
|
|
- 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)) {
|
|
|
- AnalyzeCodeVO analyzeCodeVO = new AnalyzeCodeVO();
|
|
|
- analyzeCodeVO.setCodeList(codeList);
|
|
|
- analyzeCodeVO.setHospitalId(hospitalId);
|
|
|
- //analyzeCodeVO.setModeId(analyzeRunVO.getModeId());
|
|
|
-
|
|
|
- // 获取缺陷条目信息
|
|
|
- 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();
|
|
|
//缺陷总扣分
|
|
@@ -1697,10 +1687,16 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
.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());
|
|
|
+ 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.setMsgDTOList(msgDTOList);
|
|
|
return analyzeRunDTO;
|
|
|
}
|