Explorar el Código

获取上级静态知识

zhaops hace 4 años
padre
commit
3b408dcf3d

+ 19 - 1
src/main/java/com/diagbot/client/CdssCoreClient.java

@@ -14,6 +14,7 @@ import com.diagbot.vo.PushPlanVO;
 import com.diagbot.vo.PushVO;
 import com.diagbot.vo.RetrievalVO;
 import com.diagbot.vo.StaticKnowledgeIndexVO;
+import com.diagbot.vo.StaticKnowledgeNameVO;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -76,6 +77,23 @@ public interface CdssCoreClient {
      */
     @PostMapping("/retrieval/getConceptNames")
     RespDTO<List<String>> getConceptNames(@Valid @RequestBody ConceptVO conceptVO);
-}
 
+    /**
+     * 取上级静态知识
+     *
+     * @param staticKnowledgeNameVO
+     * @return
+     */
+    @PostMapping("/staticKnowledge/getSuperName")
+    RespDTO<StaticKnowledgeNameVO> getSuperName(@Valid @RequestBody StaticKnowledgeNameVO staticKnowledgeNameVO);
+
+    /**
+     * 取上级静态知识(批量)
+     *
+     * @param staticKnowledgeNameVO
+     * @return
+     */
+    @PostMapping("/staticKnowledge/getSuperNameBatch")
+    RespDTO<List<StaticKnowledgeNameVO>> getSuperNameBatch(@Valid @RequestBody List<StaticKnowledgeNameVO> staticKnowledgeNameVO);
+}
 

+ 25 - 0
src/main/java/com/diagbot/client/hystrix/CdssCoreHystrix.java

@@ -14,6 +14,7 @@ import com.diagbot.vo.PushPlanVO;
 import com.diagbot.vo.PushVO;
 import com.diagbot.vo.RetrievalVO;
 import com.diagbot.vo.StaticKnowledgeIndexVO;
+import com.diagbot.vo.StaticKnowledgeNameVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -98,4 +99,28 @@ public class CdssCoreHystrix implements CdssCoreClient {
         log.error("【hystrix】调用{}异常", "getConceptNames");
         return null;
     }
+
+    /**
+     * 取上级静态知识
+     *
+     * @param staticKnowledgeNameVO
+     * @return
+     */
+    @Override
+    public RespDTO<StaticKnowledgeNameVO> getSuperName(@Valid @RequestBody StaticKnowledgeNameVO staticKnowledgeNameVO) {
+        log.error("【hystrix】调用{}异常", "getSuperName");
+        return null;
+    }
+
+    /**
+     * 取上级静态知识(批量)
+     *
+     * @param staticKnowledgeNameVO
+     * @return
+     */
+    @Override
+    public RespDTO<List<StaticKnowledgeNameVO>> getSuperNameBatch(@Valid @RequestBody List<StaticKnowledgeNameVO> staticKnowledgeNameVO) {
+        log.error("【hystrix】调用{}异常", "getSuperNameBatch");
+        return null;
+    }
 }

+ 22 - 0
src/main/java/com/diagbot/entity/ConceptInfo.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
 
 import java.io.Serializable;
 import java.util.Date;
+import java.util.Objects;
 
 /**
  * <p>
@@ -180,4 +181,25 @@ public class ConceptInfo implements Serializable {
                 ", status=" + status +
                 "}";
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o)
+            return true;
+        if (o == null || getClass() != o.getClass())
+            return false;
+        ConceptInfo conceptInfo = (ConceptInfo) o;
+        return Objects.equals(id, conceptInfo.id)
+                && Objects.equals(isDeleted, conceptInfo.isDeleted)
+                && Objects.equals(name, conceptInfo.name)
+                && Objects.equals(type, conceptInfo.type)
+                && Objects.equals(clinicalPathwayName, conceptInfo.clinicalPathwayName)
+                && Objects.equals(noticeName, conceptInfo.noticeName)
+                && Objects.equals(status, conceptInfo.status);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, isDeleted, name, type, clinicalPathwayName, noticeName, status);
+    }
 }

+ 91 - 1
src/main/java/com/diagbot/facade/ConceptInfoFacade.java

@@ -35,6 +35,7 @@ import com.diagbot.vo.HasStaticKnowledgeVO;
 import com.diagbot.vo.IdVO;
 import com.diagbot.vo.StaticKnowledgeHISVO;
 import com.diagbot.vo.StaticKnowledgeIndexVO;
+import com.diagbot.vo.StaticKnowledgeNameVO;
 import com.diagbot.vo.StaticKnowledgeVO;
 import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -255,7 +256,39 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
         ConceptInfo conceptInfo = this.getOne(conceptInfoQueryWrapper, false);
 
         if (conceptInfo == null) {
-            throw new CommonException(CommonErrorCode.IS_EXISTS, "缺少静态信息");
+            StaticKnowledgeNameVO superName = new StaticKnowledgeNameVO();
+            if (typeName.equals("实验室检查名称")) {
+                StaticKnowledgeNameVO staticKnowledgeNameVO = new StaticKnowledgeNameVO();
+                staticKnowledgeNameVO.setName(staticKnowledgeVO.getName());
+                staticKnowledgeNameVO.setType(staticKnowledgeVO.getType());
+                RespDTO<StaticKnowledgeNameVO> respDTO = cdssCoreClient.getSuperName(staticKnowledgeNameVO);
+                if (RespDTOUtil.respIsOK(respDTO)) {
+                    superName = respDTO.data;
+                }
+            } else if (typeName.equals("辅助检查名称")) {
+                StaticKnowledgeNameVO staticKnowledgeNameVO = new StaticKnowledgeNameVO();
+                staticKnowledgeNameVO.setName(staticKnowledgeVO.getName());
+                staticKnowledgeNameVO.setType(6);
+                RespDTO<StaticKnowledgeNameVO> respDTO = cdssCoreClient.getSuperName(staticKnowledgeNameVO);
+                if (RespDTOUtil.respIsOK(respDTO)) {
+                    superName = respDTO.data;
+                }
+            } else {
+                throw new CommonException(CommonErrorCode.IS_EXISTS, "缺少静态信息");
+            }
+            typeName = dicStaticTypeValNameMap.get(superName.getType().toString());
+            typeName = convertTypeName(typeName, 1, dicList);
+
+            conceptInfoQueryWrapper = new QueryWrapper<>();
+            conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("name", superName.getName())
+                    .eq("status", StatusEnum.Enable.getKey())
+                    .eq("type", typeName);
+            conceptInfo = this.getOne(conceptInfoQueryWrapper, false);
+
+            if (conceptInfo == null) {
+                throw new CommonException(CommonErrorCode.IS_EXISTS, "缺少静态信息");
+            }
         }
 
         BeanUtil.copyProperties(conceptInfo, staticKnowledgeDTO);
@@ -373,6 +406,63 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
                 .in("type", typeNames);
         List<ConceptInfo> conceptInfoList = this.list(conceptInfoQueryWrapper);
 
+        List<String> existUniqueNameList = Lists.newLinkedList();
+
+        if (ListUtil.isNotEmpty(conceptInfoList)) {
+            existUniqueNameList.addAll(conceptInfoList
+                    .stream()
+                    .map(i -> i.getName())
+                    .collect(Collectors.toList()));
+        }
+
+        //获取上级静态知识
+        List<String> notExistUniqueNameList = Lists.newLinkedList();
+        uniqueNameList.forEach(name -> {
+            if (!existUniqueNameList.contains(name)) {
+                notExistUniqueNameList.add(name);
+            }
+        });
+
+        if (ListUtil.isNotEmpty(notExistUniqueNameList)) {
+            List<StaticKnowledgeNameVO> paramNames = Lists.newLinkedList();
+            List<StaticKnowledgeNameVO> superNames = Lists.newLinkedList();
+            for (String name : notExistUniqueNameList) {
+                StaticKnowledgeNameVO paramName = new StaticKnowledgeNameVO();
+                paramName.setName(name);
+                if (staticKnowledgeHISVO.getType().equals(5)) {
+                    paramName.setType(6);
+                } else {
+                    paramName.setType(staticKnowledgeHISVO.getType());
+                }
+                paramNames.add(paramName);
+            }
+            RespDTO<List<StaticKnowledgeNameVO>> respDTO = cdssCoreClient.getSuperNameBatch(paramNames);
+            if (RespDTOUtil.respIsOK(respDTO)) {
+                superNames = respDTO.data;
+            }
+            if (ListUtil.isNotEmpty(superNames)) {
+                List<String> superNameList = superNames.stream().map(i -> i.getName()).distinct().collect(Collectors.toList());
+                List<Integer> superTypes = superNames.stream().map(i -> i.getType()).distinct().collect(Collectors.toList());
+                List<String> superTypeNames = Lists.newLinkedList();
+                for (Integer type : superTypes) {
+                    String typeName = dicStaticTypeValNameMap.get(type.toString());
+                    typeName = convertTypeName(typeName, 1, dicList);
+                    superTypeNames.add(typeName);
+                }
+                conceptInfoQueryWrapper = new QueryWrapper<>();
+                conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .in("name", superNameList)
+                        .eq("status", StatusEnum.Enable.getKey())
+                        .in("type", superTypeNames);
+                List<ConceptInfo> superConceptInfoList = this.list(conceptInfoQueryWrapper);
+                if (ListUtil.isNotEmpty(superConceptInfoList)) {
+                    conceptInfoList.addAll(superConceptInfoList);
+                }
+            }
+        }
+
+        conceptInfoList = conceptInfoList.stream().distinct().collect(Collectors.toList());
+
         if (ListUtil.isEmpty(conceptInfoList)) {
             return retList;
         }

+ 20 - 0
src/main/java/com/diagbot/vo/StaticKnowledgeNameVO.java

@@ -0,0 +1,20 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/1/4 14:15
+ */
+@Getter
+@Setter
+public class StaticKnowledgeNameVO {
+    @NotNull(message = "请输入术语名称")
+    private String name;
+    @NotNull(message = "请输入术语类型")
+    private Integer type;
+}