|
@@ -46,7 +46,6 @@ 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;
|
|
@@ -157,9 +156,6 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
MedTransferRecordFacade medTransferRecordFacade;
|
|
|
@Autowired
|
|
|
MedNurseFacade medNurseFacade;
|
|
|
- @Autowired
|
|
|
- SysHospitalSetFacade sysHospitalSetFacade;
|
|
|
-
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -274,6 +270,48 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 仅获取缺陷总揽提示信息
|
|
|
+ *
|
|
|
+ * @param analyzeRunVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<MsgDTO> getMsgByBehospitalCode(AnalyzeRunVO analyzeRunVO) {
|
|
|
+ // 获取病历信息
|
|
|
+ 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", 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()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return msgDTOList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 处理数据(公共方法)
|
|
|
*
|
|
@@ -912,14 +950,9 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
}
|
|
|
|
|
|
// 病案首页
|
|
|
- //义乌数据回来还要处理
|
|
|
- if(analyzeVO.getHospitalId()==5 && ListUtil.isNotEmpty(recMap.get("病案首页"))){
|
|
|
- addDataWithInnerKey("病案首页", recMap, medrecVoList);
|
|
|
- }else {
|
|
|
- if(homePage != null){
|
|
|
+ if (homePage != null) {
|
|
|
addDataWithFirstPage("病案首页", homePage, medrecVoList, dicMap,
|
|
|
homePageList, homeOperationInfoList);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
queryVo.setMedrec(medrecVoList);
|
|
@@ -941,6 +974,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
analyzeVO.setHospitalId(hospitalId);
|
|
|
|
|
|
// 处理公共数据
|
|
|
+
|
|
|
QueryVo queryVo = dealCommonData(hospitalId, analyzeVO);
|
|
|
queryVo.setUseCrfCache(analyzeVO.isUseCrfCache());
|
|
|
// 调用质控接口
|
|
@@ -1532,115 +1566,23 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
/**
|
|
|
* 评分api
|
|
|
*
|
|
|
- * @param analyzeRunVO
|
|
|
+ * @param analyzeApiVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, Object> analyzeApi(AnalyzeRunVO analyzeRunVO) {
|
|
|
- Map<String, Object> resMapData = new HashMap<>(); // 返回结果
|
|
|
+ public Map<String, Object> analyzeApi(AnalyzeApiVO analyzeApiVO) {
|
|
|
AnalyzeVO analyzeVO = new AnalyzeVO();
|
|
|
- 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, "该病历不存在或已删除!");
|
|
|
- }
|
|
|
- // 处理公共数据
|
|
|
- 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);
|
|
|
- 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 = getMsg(analyzeVO);
|
|
|
- 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()));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //返回参数组装
|
|
|
- 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";
|
|
|
- }
|
|
|
- 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);
|
|
|
- }
|
|
|
- };
|
|
|
- return resMapData;
|
|
|
+ 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);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 获取明细api
|
|
|
*
|
|
@@ -1726,62 +1668,31 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
public AnalyzeRunDTO analyzeRun(AnalyzeRunVO 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);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ List<MsgDTO> msgDTOList = this.getMsgByBehospitalCode(analyzeRunVO);
|
|
|
//返回参数组装
|
|
|
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);
|
|
|
+ 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;
|
|
|
}
|
|
@@ -1967,7 +1878,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
private void exportQcresultVOSet(ExportQcresultVO exportQcresultVO) {
|
|
|
//入参验证
|
|
|
long interval_7 = 7 * 24 * 60 * 60 * 1000;
|
|
|
- long interval_90 = 90 * 24 * 60 * 60 * 1000;
|
|
|
+ long interval_90 = 90 * 24 * 60 * 60 * 1000l;
|
|
|
//入院时间
|
|
|
if (null != exportQcresultVO && null != exportQcresultVO.getBehosDateStart() && null != exportQcresultVO.getBehosDateEnd()) {
|
|
|
Date startDate = exportQcresultVO.getBehosDateStart();
|