|
@@ -2,15 +2,24 @@ package com.diagbot.facade;
|
|
|
|
|
|
import com.diagbot.client.CdssCoreClient;
|
|
|
import com.diagbot.dto.IndicationDTO;
|
|
|
+import com.diagbot.dto.PushBaseCoreDTO;
|
|
|
+import com.diagbot.dto.PushCoreDTO;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.RespDTOUtil;
|
|
|
import com.diagbot.vo.IndicationPushVO;
|
|
|
import com.diagbot.vo.PushVO;
|
|
|
import com.diagbot.vo.SearchData;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
/**
|
|
|
* @Description:
|
|
|
* @Author:zhaops
|
|
@@ -22,17 +31,86 @@ public class PushFacade {
|
|
|
private AssembleFacade assembleFacade;
|
|
|
@Autowired
|
|
|
private CdssCoreClient cdssCoreClient;
|
|
|
+ @Autowired
|
|
|
+ private LisConfigFacade lisConfigFacade;
|
|
|
+ @Autowired
|
|
|
+ private PacsConfigFacade pacsConfigFacade;
|
|
|
+ @Autowired
|
|
|
+ private DiseaseConfigFacade diseaseConfigFacade;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
- * 基础推理
|
|
|
+ * 基础推理-症状、查体、化验、辅检、诊断
|
|
|
*
|
|
|
* @param pushVO
|
|
|
*/
|
|
|
- public void push(PushVO pushVO) {
|
|
|
+ public PushCoreDTO push(PushVO pushVO) {
|
|
|
SearchData searchData = new SearchData();
|
|
|
BeanUtil.copyProperties(pushVO, searchData);
|
|
|
searchData = assembleFacade.assembleData(searchData);
|
|
|
BeanUtil.copyProperties(searchData, pushVO);
|
|
|
+ RespDTO<PushCoreDTO> resp = cdssCoreClient.push(pushVO);
|
|
|
+ RespDTOUtil.respNGDealCover(resp, "远程调用推理接口失败");
|
|
|
+ PushCoreDTO data = resp.data;
|
|
|
+ //TODO 外部名称映射
|
|
|
+ if (ListUtil.isNotEmpty(data.getLis())) {
|
|
|
+ List<PushBaseCoreDTO> retLis = data.getLis();
|
|
|
+ List<String> uniqueNameList = retLis.stream()
|
|
|
+ .map(i -> i.getName())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ Map<String, Map<String, Long>> uniqueNameMap
|
|
|
+ = lisConfigFacade.getUniqueNameConfigMap(pushVO.getHospitalId(), null, uniqueNameList);
|
|
|
+ if (uniqueNameMap != null && uniqueNameMap.size() > 0) {
|
|
|
+ retLis.forEach(item -> {
|
|
|
+ if (uniqueNameMap.get(item.getName()) != null) {
|
|
|
+ item.setHisNameList(new ArrayList<>(uniqueNameMap.get(item.getName()).keySet()));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ data.setLis(retLis);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ListUtil.isNotEmpty(data.getPacs())) {
|
|
|
+ List<PushBaseCoreDTO> retPacs = data.getPacs();
|
|
|
+ List<String> uniqueNameList = retPacs.stream()
|
|
|
+ .map(i -> i.getName())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ Map<String, Map<String, Long>> uniqueNameMap
|
|
|
+ = pacsConfigFacade.getUniqueNameConfigMap(pushVO.getHospitalId(), null, uniqueNameList);
|
|
|
+ if (uniqueNameMap != null && uniqueNameMap.size() > 0) {
|
|
|
+ retPacs.forEach(item -> {
|
|
|
+ if (uniqueNameMap.get(item.getName()) != null) {
|
|
|
+ item.setHisNameList(new ArrayList<>(uniqueNameMap.get(item.getName()).keySet()));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ data.setPacs(retPacs);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (data.getDis() != null && data.getDis().size() > 0) {
|
|
|
+ Map<String, List<PushBaseCoreDTO>> retMap = data.getDis();
|
|
|
+ List<String> uniqueNameList = Lists.newLinkedList();
|
|
|
+ for (Map.Entry<String, List<PushBaseCoreDTO>> entry : retMap.entrySet()) {
|
|
|
+ if (ListUtil.isNotEmpty(entry.getValue())) {
|
|
|
+ uniqueNameList.addAll(entry.getValue().stream()
|
|
|
+ .map(i -> i.getName())
|
|
|
+ .collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ListUtil.isNotEmpty(uniqueNameList)) {
|
|
|
+ Map<String, Map<String, Long>> uniqueNameMap
|
|
|
+ = diseaseConfigFacade.getUniqueNameConfigMap(pushVO.getHospitalId(), null, uniqueNameList);
|
|
|
+ for (Map.Entry<String, List<PushBaseCoreDTO>> entry : retMap.entrySet()) {
|
|
|
+ if (uniqueNameMap != null && uniqueNameMap.size() > 0) {
|
|
|
+ entry.getValue().forEach(item -> {
|
|
|
+ if (uniqueNameMap.get(item.getName()) != null) {
|
|
|
+ item.setHisNameList(new ArrayList<>(uniqueNameMap.get(item.getName()).keySet()));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ data.setDis(retMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return data;
|
|
|
}
|
|
|
|
|
|
/**
|