Bläddra i källkod

Merge remote-tracking branch 'origin/master' into innerDevelop

zhaops 4 år sedan
förälder
incheckning
99a853dbba

+ 17 - 0
src/main/java/com/diagbot/dto/PacsDTO.java

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/10/15 14:26
+ */
+@Getter
+@Setter
+public class PacsDTO {
+    private String name;
+    //词性 5:辅检项目,7:辅检子项
+    private Integer type;
+}

+ 20 - 0
src/main/java/com/diagbot/entity/BaseNodeInfo.java

@@ -0,0 +1,20 @@
+package com.diagbot.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.data.neo4j.annotation.QueryResult;
+
+import java.util.Set;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/10/15 11:15
+ */
+@Getter
+@Setter
+@QueryResult
+public class BaseNodeInfo {
+    private Set<String> labels;
+    private String name;
+}

+ 23 - 0
src/main/java/com/diagbot/entity/node/PacsSubName.java

@@ -15,6 +15,20 @@ import java.util.Set;
 @NodeEntity(label = "辅助检查子项目名称")
 public class PacsSubName extends BaseNode  {
 
+	@Relationship(type = "辅助检查子项目名称禁忌性别", direction = Relationship.OUTGOING)
+	private Gender gender;
+
+	@Relationship(type = "辅助检查子项目名称禁忌临床表现", direction = Relationship.OUTGOING)
+	private Set<ClinicalFinding> clinicalfindings = new HashSet<>();
+
+	@Relationship(type = "辅助检查子项目名称禁忌体征", direction = Relationship.OUTGOING)
+	private Set<Vital> vitals = new HashSet<>();
+
+	@Relationship(type = "辅助检查子项目名称禁忌实验室检查", direction = Relationship.OUTGOING)
+	private Set<Lis> lis = new HashSet<>();
+
+	@Relationship(type = "辅助检查子项目名称禁忌辅助检查名称描述", direction = Relationship.OUTGOING)
+	private Set<PacsDescribe> pacsdescribes = new HashSet<>();
 
 	@Relationship(type = "辅助检查子项目名称禁忌药物过敏原", direction = Relationship.OUTGOING)
 	private Set<MedAllergen> medallergens = new HashSet<>();
@@ -22,9 +36,18 @@ public class PacsSubName extends BaseNode  {
 	@Relationship(type = "辅助检查子项目名称禁忌禁忌人群", direction = Relationship.OUTGOING)
 	private Set<Group> groups = new HashSet<>();
 
+	@Relationship(type = "辅助检查子项目名称禁忌服用药品", direction = Relationship.OUTGOING)
+	private Set<OralMedicine> oralmedicines = new HashSet<>();
+
 	@Relationship(type = "辅助检查子项目名称禁忌疾病", direction = Relationship.OUTGOING)
 	private Set<Disease> diseases = new HashSet<>();
 
+	@Relationship(type = "辅助检查子项目名称禁忌过敏原", direction = Relationship.OUTGOING)
+	private Set<Allergen> allergens = new HashSet<>();
+
+	@Relationship(type = "辅助检查子项目名称禁忌禁忌医疗器械及物品", direction = Relationship.OUTGOING)
+	private Set<ConflictDevice> conflictdevices = new HashSet<>();
+
 	@Relationship(type = "辅助检查名称包含辅助检查子项目名称", direction = Relationship.INCOMING)
 	private Set<Pacs> pacss = new HashSet<>();
 

+ 2 - 1
src/main/java/com/diagbot/enums/StaticTypeEnum.java

@@ -16,7 +16,8 @@ public enum StaticTypeEnum implements KeyedNamed {
     LISSET(3, Constants.lissetname),
     LIS(4, Constants.lisname),
     PACS(5, Constants.pacsname),
-    OPT(6, Constants.yibaoopname);
+    OPT(6, Constants.yibaoopname),
+    PACSSUBNAME(7, Constants.pacssubname);
 
     @Setter
     private int key;

+ 2 - 1
src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -1,5 +1,6 @@
 package com.diagbot.facade;
 
+import com.diagbot.entity.BaseNodeInfo;
 import com.diagbot.entity.node.Dept;
 import com.diagbot.entity.node.LisName;
 import com.diagbot.entity.node.LisSet;
@@ -82,7 +83,7 @@ public class ConceptFacade {
                 }
                 break;
             case 3:
-                List<PacsName> pacsNameList = pacsNameRepository.findByNameIn(conceptVO.getNames());
+                List<BaseNodeInfo> pacsNameList = pacsNameRepository.findByNameInIgnoreLabel(conceptVO.getNames());
                 if (ListUtil.isNotEmpty(pacsNameList)) {
                     retList = pacsNameList.stream()
                             .map(i -> i.getName())

+ 37 - 26
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -51,6 +51,8 @@ public class NeoFacade {
     @Autowired
     PacsNameRepository pacsNameRepository;
     @Autowired
+    PacsSubNameRepository pacsSubNameRepository;
+    @Autowired
     LisNameRepository lisNameRepository;
     @Autowired
     LisSetRepository lisSetRepository;
@@ -225,6 +227,22 @@ public class NeoFacade {
         Integer sex = pushVO.getSex();
         List<NeoPushDTO> neoPushDTOS = new ArrayList<>();
         List<String> allDis = Lists.newArrayList();
+        //如果化验有特异性就直接推送疾病
+        List<Lis> lises = null;
+        LisPushVo lisPushVo = pushVO.getLisPushVo();
+        if(lisPushVo != null){
+            lises = lisPushVo.getLises();
+        }
+        if(ListUtil.isNotEmpty(lises)){
+            List<String> lis_dis = lises.parallelStream()
+                    .map(x -> nodeRepository.getDisByLis_Special(x.getUniqueName(), x.getDetailName()))
+                    .flatMap(List::stream).collect(Collectors.toList());
+            filterAndSort(neoPushDTOS,lis_dis);
+            if(ListUtil.isNotEmpty(neoPushDTOS)){
+                return neoPushDTOS;
+            }
+        }
+
         // 如果没有诊断名称,则通过其它信息推送诊断
         ChiefPushVo chiefPushVo = pushVO.getChiefPushVo();
         PresentPushVo presentPushVo = pushVO.getPresentPushVo();
@@ -246,19 +264,18 @@ public class NeoFacade {
         List<String> allDis_bySymptom = getDisBySymptom(symptoms,age,sex);
         allDis.addAll(allDis_bySymptom);
         //化验推出的疾病
-        LisPushVo lisPushVo = pushVO.getLisPushVo();
-        if(lisPushVo != null){
-            List<Lis> lises = lisPushVo.getLises();
+
             if(ListUtil.isNotEmpty(lises)){
-                List<YiBaoDiseaseName> collect = lises.parallelStream()
-                        .map(x -> nodeRepository.getDisByLis(x.getUniqueName(), x.getDetailName())).collect(Collectors.toList());
-                List<String> lis_dis = lises.parallelStream()
+                /*List<String> lis_dis = lises.parallelStream()
                         .map(x -> nodeRepository.getDisByLis(x.getUniqueName(), x.getDetailName()))
                         .filter(z->z!=null && NeoUtil.matchBasic(z,sex,age)).map(z->z.getName())
-                        .collect(Collectors.toList());
+                        .collect(Collectors.toList());*/
+                List<String> lis_dis = lises.parallelStream()
+                        .map(x -> nodeRepository.getDisByLis(x.getUniqueName(), x.getDetailName()))
+                        .flatMap(List::stream).collect(Collectors.toList());
                 allDis.addAll(lis_dis);
             }
-        }
+
         //辅检推出的疾病
         PacsPushVo pacsPushVo = pushVO.getPacsPushVo();
         if(pacsPushVo !=null){
@@ -269,31 +286,22 @@ public class NeoFacade {
                 allDis.addAll(allDis_byPacsResult);
             }
         }
+        filterAndSort(neoPushDTOS, allDis);
+
+        return neoPushDTOS;
+    }
 
+    private void filterAndSort(List<NeoPushDTO> neoPushDTOS, List<String> allDis) {
         //推送出的所有疾病进行性别和年龄的过滤
         Map<Long,List<String>> numberDiseasesMap = disCountSort(allDis);
         //根据发病率排序
         Map<String, Double> disdistributionCache = self.getDisdistributionCache();
-        /*numberDiseasesMap.forEach((x,y)->{
-            y.forEach(z ->{
-                if(disdistributionCache.containsKey(z)){
-                    disdistributionCache.put(z,disdistributionCache.get(z));
-                }else {
-                    disdistributionCache.put(z,0.0);
-                }
-            });
-        });*/
         Map<Long,Map<String,Double>> disPack = new LinkedHashMap<>();
         numberDiseasesMap.forEach((x,y)->{
             Map<String, Double> collect = y.stream()
                     .collect(Collectors.toMap(v -> v, v -> disdistributionCache.get(v) != null?disdistributionCache.get(v):0.0, (e1, e2) -> e2));
             disPack.put(x,collect);
         });
-        /*numberDiseasesMap.forEach((x,y)->{
-            Map<String,Double> dis_dbt = new HashMap<>();
-            y.forEach(dis -> dis_dbt.put(dis,disdistributionCache.get(dis)));
-            disPack.put(x,dis_dbt);
-        });*/
         disPack.forEach((x,y)->{
             Map<String, Double> collect = y.entrySet().stream()
                     .sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
@@ -307,8 +315,6 @@ public class NeoFacade {
                 neoPushDTOS.add(neoPushDTO);
             });
         });
-
-        return neoPushDTOS;
     }
 
     public List<String> getDisBySymptom(List<String> symptoms,Double age,Integer sex){
@@ -322,6 +328,7 @@ public class NeoFacade {
         }
 
     public List<String> getDisByPacsResult(List<String> pacsResult,Double age,Integer sex){
+
         List<PacsResult> byNameIn = pacsResultRepository.findByNameIn(pacsResult);
         List<String> allDis = byNameIn.stream()
                 .map(z -> z.getDisease().stream().filter(o -> NeoUtil.matchBasic(o,sex,age)).map(y -> y.getName()).collect(Collectors.toList())).flatMap(List::stream)
@@ -339,10 +346,11 @@ public class NeoFacade {
      */
     public List<String> pushDisBySymptom(SymptomNameRepository symptomNameRepository,List<String> symptoms,Double age,Integer sex){
         List<String> allDis = Lists.newArrayList();
-        List<Symptom> byNameIn = symptomNameRepository.findByNameIn(symptoms);
+        /*List<Symptom> byNameIn = symptomNameRepository.findByNameIn(symptoms);
         allDis = byNameIn.parallelStream()
                 .map(z -> z.getDisease().stream().filter(o -> NeoUtil.matchBasic(o,sex,age)).map(y -> y.getName()).collect(Collectors.toList())).flatMap(List::stream)
-                .collect(Collectors.toList());
+                .collect(Collectors.toList());*/
+        allDis = symptomNameRepository.getDisBySymptoms(symptoms);
         return allDis;
     }
 
@@ -589,6 +597,9 @@ public class NeoFacade {
         PacsNameNode pacsNode = new PacsNameNode();
         List<BillNeoDTO> billNeoDTOs = pacsNode.getPacsBill(pacsterm, pacsNameRepository);
 
+        PacsSubNameNode pacsSubNode = new PacsSubNameNode();
+        billNeoDTOs.addAll(pacsSubNode.getSubPacsBill(pacsterm, pacsSubNameRepository));
+
         return billNeoDTOs;
     }
 

+ 21 - 6
src/main/java/com/diagbot/facade/RetrievalFacade.java

@@ -6,10 +6,10 @@ import com.diagbot.dto.LisDetailDTO;
 import com.diagbot.dto.OperationInfoDTO;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
+import com.diagbot.entity.BaseNodeInfo;
 import com.diagbot.entity.node.LisName;
 import com.diagbot.entity.node.LisSet;
 import com.diagbot.entity.node.Medicine;
-import com.diagbot.entity.node.PacsName;
 import com.diagbot.entity.node.YiBaoDiseaseName;
 import com.diagbot.entity.node.YiBaoOperationName;
 import com.diagbot.enums.StaticTypeEnum;
@@ -24,6 +24,7 @@ import com.diagbot.repository.MedicineNode;
 import com.diagbot.repository.MedicineRepository;
 import com.diagbot.repository.PacsNameNode;
 import com.diagbot.repository.PacsNameRepository;
+import com.diagbot.repository.PacsSubNameRepository;
 import com.diagbot.repository.TransfusionRemindRepository;
 import com.diagbot.repository.YiBaoDiseaseNode;
 import com.diagbot.repository.YiBaoDiseaseRepository;
@@ -60,6 +61,9 @@ public class RetrievalFacade {
     @Autowired
     PacsNameRepository pacsRepository;
 
+    @Autowired
+    PacsSubNameRepository pacsSubNameRepository;
+
     @Autowired
     MedicineRepository medicineRepository;
 
@@ -144,7 +148,7 @@ public class RetrievalFacade {
     public List<String> getPACSs(String info) {
 
         PacsNameNode pacsNode = new PacsNameNode();
-        List<String> pacslist = pacsNode.getPACSNameList(info, pacsRepository, baseNodeRepository);
+        List<String> pacslist = pacsNode.getPACSNameAndPACSSubNameList(info, pacsRepository);
 
         return pacslist;
     }
@@ -291,14 +295,25 @@ public class RetrievalFacade {
             lisRetList.add(staticDTO);
         }
         //TODO 检查
-        List<PacsName> pacsList = pacsRepository.staticKnowledgeIndex(staticKnowledgeIndexVO.getHasInfo(), inputStr, inputStr, 100);
+        //List<PacsName> pacsList = pacsRepository.staticKnowledgeIndex(staticKnowledgeIndexVO.getHasInfo(), inputStr, inputStr, 100);
+        List<BaseNodeInfo> pacsList = pacsRepository.staticKnowledgeIndexIgnoreLabel(staticKnowledgeIndexVO.getHasInfo(), inputStr, inputStr, 100);
 
         List<StaticKnowledgeIndexDTO> pacsRetList = Lists.newLinkedList();
-        for (PacsName pacs : pacsList) {
+        for (BaseNodeInfo pacs : pacsList) {
             StaticKnowledgeIndexDTO staticDTO = new StaticKnowledgeIndexDTO();
             staticDTO.setName(pacs.getName());
-            staticDTO.setType(StaticTypeEnum.PACS.getKey());
-            staticDTO.setTypeName(StaticTypeEnum.PACS.getName());
+            if (pacs.getLabels() != null && pacs.getLabels().size() > 0) {
+                if (pacs.getLabels().contains(StaticTypeEnum.PACS.getName())) {
+                    staticDTO.setType(StaticTypeEnum.PACS.getKey());
+                    staticDTO.setTypeName(StaticTypeEnum.PACS.getName());
+                } else if (pacs.getLabels().contains(StaticTypeEnum.PACSSUBNAME.getName())) {
+                    staticDTO.setType(StaticTypeEnum.PACSSUBNAME.getKey());
+                    staticDTO.setTypeName(StaticTypeEnum.PACSSUBNAME.getName());
+                }
+            } else {
+                staticDTO.setType(StaticTypeEnum.PACS.getKey());
+                staticDTO.setTypeName(StaticTypeEnum.PACS.getName());
+            }
             pacsRetList.add(staticDTO);
         }
 

+ 1 - 0
src/main/java/com/diagbot/facade/TestFacade.java

@@ -93,6 +93,7 @@ public class TestFacade {
                         indicationPushVO.setLisOrder(lisDetailOrder);
                         break;
                     case "辅助检查名称":
+                    case "辅助检查子项目名称":
                         List<Pacs> pacsOrder = new ArrayList<>();
                         Pacs pacsBean = new Pacs();
                         pacsBean.setName(bean.getStandName());

+ 6 - 2
src/main/java/com/diagbot/repository/BaseNodeRepository.java

@@ -42,8 +42,12 @@ public interface BaseNodeRepository extends Neo4jRepository<BaseNode, Long> {
     List<String> getSymptomClass();
 
     //化验查疾病
-    @Query("match(d:医保疾病名称)-[r1]->(l:化验套餐名称{name:{lisBig}})-[r:化验套餐名称相关化验细项及结果]->(lr:化验细项及结果{name:{subres}}),(d)-[r2]->(lr) return d")
-    YiBaoDiseaseName getDisByLis(@Param("lisBig") String lisBig,@Param("subres") String subres);
+    @Query("match(d:医保疾病名称)-[r1]->(l:化验套餐名称{name:{lisBig}})-[r:化验套餐名称相关化验细项及结果]->(lr:化验细项及结果{name:{subres}}),(d)-[r2]->(lr) return d.name")
+    List<String> getDisByLis(@Param("lisBig") String lisBig,@Param("subres") String subres);
+
+    //化验查疾病(有特异性)
+    @Query("match(d:医保疾病名称)-[r1]->(l:化验套餐名称{name:{lisBig}})-[r:化验套餐名称相关化验细项及结果]->(lr:化验细项及结果{name:{subres}}),(d)-[r2]->(lr) where lr.特异性=1 return d.name")
+    List<String> getDisByLis_Special(@Param("lisBig") String lisBig,@Param("subres") String subres);
 
     @Query("match(d:医保疾病名称)-[r:医保疾病名称相关性别]->(h) return DISTINCT d.name+'&'+h.name")
     List<String> getDisSexClass();

+ 20 - 3
src/main/java/com/diagbot/repository/PacsNameNode.java

@@ -1,8 +1,8 @@
 package com.diagbot.repository;
 
-import ch.qos.logback.core.util.StringCollectionUtil;
 import com.diagbot.dto.BillNeoDTO;
 import com.diagbot.dto.PacsBillNeoDTO;
+import com.diagbot.entity.BaseNodeInfo;
 import com.diagbot.entity.node.Allergen;
 import com.diagbot.entity.node.ClinicalFinding;
 import com.diagbot.entity.node.ConflictDevice;
@@ -15,7 +15,6 @@ import com.diagbot.entity.node.OralMedicine;
 import com.diagbot.entity.node.PacsDescribe;
 import com.diagbot.entity.node.PacsName;
 import com.diagbot.entity.node.Vital;
-import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.NeoUtil;
 
@@ -23,6 +22,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 public class PacsNameNode {
 
@@ -196,7 +196,7 @@ public class PacsNameNode {
     /**
      * 获取辅检名称列表
      */
-    public List<String> getPACSNameList(String name, PacsNameRepository pacsRepository, BaseNodeRepository baseNodeRepository) {
+    public List<String> getPACSNameList(String name, PacsNameRepository pacsRepository) {
         String pacsname;
 
         List<String> pacslist = new ArrayList<>();
@@ -216,6 +216,23 @@ public class PacsNameNode {
 
         return pacslist;
     }
+
+    /**
+     * 获取辅检名称列表
+     */
+    public List<String> getPACSNameAndPACSSubNameList(String name, PacsNameRepository pacsRepository) {
+
+        List<String> pacslist = new ArrayList<>();
+        List<BaseNodeInfo> pacslt = pacsRepository.indexIgnoreLabel(name, name, 100);
+
+        if (ListUtil.isNotEmpty(pacslt) && pacslt.size() > 100) {
+            pacslt = pacslt.subList(0, 100);
+        }
+
+        pacslist = pacslt.stream().map(i -> i.getName()).collect(Collectors.toList());
+
+        return pacslist;
+    }
 }
 
 

+ 43 - 0
src/main/java/com/diagbot/repository/PacsNameRepository.java

@@ -1,5 +1,6 @@
 package com.diagbot.repository;
 
+import com.diagbot.entity.BaseNodeInfo;
 import com.diagbot.entity.node.PacsName;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
@@ -49,4 +50,46 @@ public interface PacsNameRepository extends Neo4jRepository<PacsName, Long> {
             "WITH n SKIP 0 LIMIT $size\n" +
             "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
     List<PacsName> index(@Param("name") String name, @Param("pycode") String pycode, @Param("size") Integer size);
+
+    //检索不区分辅助检查名称和辅助检查子项目名称
+    @Query("MATCH (n) WHERE any(label in labels(n) WHERE label in ['辅助检查名称', '辅助检查子项目名称'])\n" +
+            "AND toLower(n.`name`) = toLower($name) \n" +
+            "OR toLower(n.`拼音编码`) = toLower($pycode)  \n" +
+            "RETURN labels(n) as labels,n.name as name\n" +
+            "union\n" +
+            "MATCH (n) WHERE any(label in labels(n) WHERE label in ['辅助检查名称', '辅助检查子项目名称'])\n" +
+            "AND toLower(n.`name`) starts with toLower($name) \n" +
+            "OR toLower(n.`拼音编码`) starts with toLower($pycode)  \n" +
+            "WITH n SKIP 0 LIMIT $size\n" +
+            "RETURN labels(n) as labels,n.name as name\n" +
+            "union\n" +
+            "MATCH (n) WHERE any(label in labels(n) WHERE label in ['辅助检查名称', '辅助检查子项目名称'])\n" +
+            "AND toLower(n.`name`) CONTAINS toLower($name) \n" +
+            "OR toLower(n.`拼音编码`) CONTAINS toLower($pycode)  \n" +
+            "WITH n SKIP 0 LIMIT $size\n" +
+            "RETURN labels(n) as labels,n.name as name\n")
+    List<BaseNodeInfo> indexIgnoreLabel(@Param("name") String name, @Param("pycode") String pycode, @Param("size") Integer size);
+
+    @Query("MATCH (n) WHERE any(label in labels(n) WHERE label in ['辅助检查名称', '辅助检查子项目名称'])\n" +
+            "n.`静态知识标识` = $isKL \n" +
+            "AND (toLower(n.`name`) = toLower($name)  OR  toLower(n.`拼音编码`) = toLower($pycode))\n" +
+            "RETURN labels(n) as labels,n.name as name\n" +
+            "UNION\n" +
+            "MATCH (n) WHERE any(label in labels(n) WHERE label in ['辅助检查名称', '辅助检查子项目名称'])\n" +
+            "n.`静态知识标识` = $isKL \n" +
+            "AND (toLower(n.`name`) STARTS WITH toLower($name) OR toLower(n.`拼音编码`) STARTS WITH toLower($pycode))\n" +
+            "WITH n SKIP 0 LIMIT $size\n" +
+            "RETURN labels(n) as labels,n.name as name\n" +
+            "UNION \n" +
+            "MATCH (n) WHERE any(label in labels(n) WHERE label in ['辅助检查名称', '辅助检查子项目名称'])\n" +
+            "n.`静态知识标识` = $isKL  \n" +
+            "AND (toLower(n.`name`) CONTAINS toLower($name) OR toLower(n.`拼音编码`) CONTAINS toLower($pycode))  \n" +
+            "WITH n SKIP 0 LIMIT $size\n" +
+            "RETURN labels(n) as labels,n.name as name\n")
+    List<BaseNodeInfo> staticKnowledgeIndexIgnoreLabel(@Param("isKL") Integer isKL, @Param("name") String name, @Param("pycode") String pycode, @Param("size") Integer size);
+
+    @Query("MATCH (n) WHERE any(label in labels(n) WHERE label in ['辅助检查名称', '辅助检查子项目名称'])\n" +
+            "and n.`name` IN  $names  \n" +
+            "RETURN labels(n) as labels,n.name as name\n")
+    List<BaseNodeInfo> findByNameInIgnoreLabel(@Param("names") List<String> names);
 }

+ 110 - 19
src/main/java/com/diagbot/repository/PacsSubNameNode.java

@@ -3,6 +3,7 @@ package com.diagbot.repository;
 import com.diagbot.dto.BillNeoDTO;
 import com.diagbot.dto.PacsBillNeoDTO;
 import com.diagbot.entity.node.*;
+import com.diagbot.util.ListUtil;
 import com.diagbot.util.NeoUtil;
 
 import java.util.ArrayList;
@@ -18,6 +19,64 @@ public class PacsSubNameNode {
         NodeInfo nodeInfo;
 
 
+        Gender gender = pacs.getGender();
+        if (gender != null) {
+            nodeInfo = new NodeInfo();
+            nodeInfo.setName(gender.getName());
+            nodeInfo.setTypeval(Constants.gender);
+            pacsBillNeoDTO.setGender(NeoUtil.updateNodeInfo(nodeInfo));
+        }
+
+
+        Set<ClinicalFinding> clinicalfindings = pacs.getClinicalfindings();
+        for (ClinicalFinding clinicalfinding : clinicalfindings) {
+            nodeInfo = new NodeInfo();
+            nodeInfo.setName(clinicalfinding.getName());
+            nodeInfo.setMinval(NeoUtil.DoubletoBigDecimal(clinicalfinding.getMinval()));
+            nodeInfo.setMaxval(NeoUtil.DoubletoBigDecimal(clinicalfinding.getMaxval()));
+            nodeInfo.setUnit(clinicalfinding.getUnit());
+            nodeInfo.setRange(clinicalfinding.getRange());
+            nodeInfo.setTypeval(Constants.clinicalfinding);
+            pacsBillNeoDTO.getClinicfindings().add(NeoUtil.updateNodeInfo(nodeInfo));
+        }
+
+
+        Set<Vital> vitals = pacs.getVitals();
+        for (Vital vital : vitals) {
+            nodeInfo = new NodeInfo();
+            String name = vital.getName();
+            nodeInfo.setName(name);
+            nodeInfo.setMinval(NeoUtil.DoubletoBigDecimal(vital.getMinval()));
+            nodeInfo.setMaxval(NeoUtil.DoubletoBigDecimal(vital.getMaxval()));
+            nodeInfo.setUnit(vital.getUnit());
+            nodeInfo.setRange(vital.getRange());
+            nodeInfo.setTypeval(Constants.vital);
+            pacsBillNeoDTO.getVitals().add(NeoUtil.updateNodeInfo(nodeInfo));
+        }
+
+
+        Set<Lis> liss = pacs.getLis();
+        for (Lis lis : liss) {
+            nodeInfo = new NodeInfo();
+            nodeInfo.setName(lis.getName());
+            nodeInfo.setMinval(NeoUtil.DoubletoBigDecimal(lis.getMinval()));
+            nodeInfo.setMaxval(NeoUtil.DoubletoBigDecimal(lis.getMaxval()));
+            nodeInfo.setUnit(lis.getUnit());
+            nodeInfo.setRange(lis.getRange());
+            nodeInfo.setTypeval(Constants.lis);
+            pacsBillNeoDTO.getLis().add(NeoUtil.updateNodeInfo(nodeInfo));
+        }
+
+
+        Set<PacsDescribe> conflict_pacsdesc = pacs.getPacsdescribes();
+        for (PacsDescribe pacsdesc : conflict_pacsdesc) {
+            nodeInfo = new NodeInfo();
+            nodeInfo.setName(pacsdesc.getName());
+            nodeInfo.setTypeval(Constants.pacsdesc);
+            pacsBillNeoDTO.getPacsDesc().add(NeoUtil.updateNodeInfo(nodeInfo));
+        }
+
+
         Set<Group> groups = pacs.getGroups();
         for (Group group : groups) {
             nodeInfo = new NodeInfo();
@@ -27,6 +86,15 @@ public class PacsSubNameNode {
         }
 
 
+        Set<OralMedicine> conflict_medicines = pacs.getOralmedicines();
+        for (OralMedicine conflict_medicine : conflict_medicines) {
+            nodeInfo = new NodeInfo();
+            nodeInfo.setName(conflict_medicine.getName());
+            nodeInfo.setTypeval(Constants.yaoping);
+            pacsBillNeoDTO.getOralmeds().add(NeoUtil.updateNodeInfo(nodeInfo));
+        }
+
+
         Set<Disease> diseases = pacs.getDiseases();
         for (Disease disease : diseases) {
             nodeInfo = new NodeInfo();
@@ -40,8 +108,26 @@ public class PacsSubNameNode {
         for (MedAllergen medAllergen : medAllergens) {
             nodeInfo = new NodeInfo();
             nodeInfo.setName(medAllergen.getName());
-            nodeInfo.setTypeval(Constants.medallergen);
-            pacsBillNeoDTO.getOperations().add(NeoUtil.updateNodeInfo(nodeInfo));
+            nodeInfo.setTypeval(NeoUtil.getMedType(medAllergen.getName()));
+            pacsBillNeoDTO.getAllergicmeds().add(NeoUtil.updateNodeInfo(nodeInfo));
+        }
+
+
+        Set<Allergen> allergens = pacs.getAllergens();
+        for (Allergen allergen : allergens) {
+            nodeInfo = new NodeInfo();
+            nodeInfo.setName(allergen.getName());
+            nodeInfo.setTypeval(Constants.yaoping); // 过敏原归类成药物过敏原,与模型提取匹配
+            pacsBillNeoDTO.getAllergicmeds().add(NeoUtil.updateNodeInfo(nodeInfo));
+        }
+
+
+        Set<ConflictDevice> conflictDevices = pacs.getConflictdevices();
+        for (ConflictDevice conflictDevice : conflictDevices) {
+            nodeInfo = new NodeInfo();
+            nodeInfo.setName(conflictDevice.getName());
+            nodeInfo.setTypeval(Constants.conflictdevice);
+            pacsBillNeoDTO.getMeddevice().add(NeoUtil.updateNodeInfo(nodeInfo));
         }
 
 
@@ -50,9 +136,9 @@ public class PacsSubNameNode {
 
 
     /**
-     * 处理辅检开单合理性
+     * 处理辅检子项目开单合理性
      */
-    public List<BillNeoDTO> getPacsBill(Map<String, String> pacsterm, PacsSubNameRepository pacsRepository) {
+    public List<BillNeoDTO> getSubPacsBill(List<Map<String, String>> pacslist, PacsSubNameRepository pacsSubRepository) {
         List<BillNeoDTO> billNeoDTOs = new ArrayList<>();
         BillNeoDTO billNeoDTO;
 
@@ -61,23 +147,25 @@ public class PacsSubNameNode {
         List<PacsSubName> pacslt;
         String pacsname;
 
-        for (String term : pacsterm.keySet()) {
-            billNeoDTO = new BillNeoDTO();
-            pacsname = pacsterm.get(term);
-            billNeoDTO.setName(term);
-            billNeoDTO.setStandname(pacsname);
+        for (Map<String, String> pacsterm : pacslist) {
+            for (String term : pacsterm.keySet()) {
+                billNeoDTO = new BillNeoDTO();
+                pacsname = pacsterm.get(term);
+                billNeoDTO.setName(term);
+                billNeoDTO.setStandname(pacsname);
 
-            pacsBillNeoDTO = new PacsBillNeoDTO();
+                pacsBillNeoDTO = new PacsBillNeoDTO();
 
-            pacslt = pacsRepository.findByNameIs(pacsname);
+                pacslt = pacsSubRepository.findByNameIs(pacsname);
 
-            if (pacslt != null && pacslt.size()>0) {
-                pacsBillNeoDTO = PacstoPACSDTO(pacslt.get(0));
-            }
+                if (pacslt != null && pacslt.size() > 0) {
+                    pacsBillNeoDTO = PacstoPACSDTO(pacslt.get(0));
+                }
 
-            billNeoDTO.setPacsBillNeoDTO(pacsBillNeoDTO);
+                billNeoDTO.setPacsBillNeoDTO(pacsBillNeoDTO);
 
-            billNeoDTOs.add(billNeoDTO);
+                billNeoDTOs.add(billNeoDTO);
+            }
         }
 
         return billNeoDTOs;
@@ -92,16 +180,19 @@ public class PacsSubNameNode {
 
         List<String> pacslist = new ArrayList<>();
 
-        List<PacsSubName> pacslt = pacsRepository.findByNameContaining(name);
+        List<PacsSubName> pacssublt = pacsRepository.index(name, name, 100);
+
+        if (ListUtil.isNotEmpty(pacssublt) && pacssublt.size() > 100) {
+            pacssublt = pacssublt.subList(0, 100);
+        }
 
-        for (PacsSubName pacs : pacslt) {
+        for (PacsSubName pacs : pacssublt) {
             pacsname = pacs.getName();
             if (!pacslist.contains(pacsname)) {
                 pacslist.add(pacsname);
             }
         }
 
-
         return pacslist;
     }
 }

+ 19 - 0
src/main/java/com/diagbot/repository/PacsSubNameRepository.java

@@ -1,7 +1,9 @@
 package com.diagbot.repository;
 
 import com.diagbot.entity.node.PacsSubName;
+import org.springframework.data.neo4j.annotation.Query;
 import org.springframework.data.neo4j.repository.Neo4jRepository;
+import org.springframework.data.repository.query.Param;
 
 import java.util.List;
 
@@ -11,5 +13,22 @@ public interface PacsSubNameRepository extends Neo4jRepository<PacsSubName, Long
     List<PacsSubName> findByNameIs(String name);
 
     List<PacsSubName> findByNameContaining(String name);
+
+    List<PacsSubName> findByNameIn(List<String> names);
+
+    @Query("MATCH (n:`辅助检查子项目名称`) WHERE toLower(n.`name`) = toLower($name) \n" +
+            "OR toLower(n.`拼音编码`) = toLower($pycode)  \n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n" +
+            "union\n" +
+            "MATCH (n:`辅助检查子项目名称`) WHERE toLower(n.`name`) starts with toLower($name) \n" +
+            "OR toLower(n.`拼音编码`) starts with toLower($pycode)  \n" +
+            "WITH n SKIP 0 LIMIT $size\n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n" +
+            "union\n" +
+            "MATCH (n:`辅助检查子项目名称`) WHERE toLower(n.`name`) CONTAINS toLower($name) \n" +
+            "OR toLower(n.`拼音编码`) CONTAINS toLower($pycode)  \n" +
+            "WITH n SKIP 0 LIMIT $size\n" +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    List<PacsSubName> index(@Param("name") String name, @Param("pycode") String pycode, @Param("size") Integer size);
 }
 

+ 5 - 0
src/main/java/com/diagbot/repository/SymptomNameRepository.java

@@ -1,7 +1,9 @@
 package com.diagbot.repository;
 
 import com.diagbot.entity.node.Symptom;
+import org.springframework.data.neo4j.annotation.Query;
 import org.springframework.data.neo4j.repository.Neo4jRepository;
+import org.springframework.data.repository.query.Param;
 
 import java.util.List;
 
@@ -13,5 +15,8 @@ public interface SymptomNameRepository extends Neo4jRepository<Symptom, Long> {
     List<Symptom> findByNameIn(List<String> names);
 
     List<Symptom> findByNameContaining(String name);
+
+    @Query("match(d:医保疾病名称)-[r:医保疾病名称相关症状]->(s:症状) where s.name in {py} return d.name")
+    List<String> getDisBySymptoms(@Param("py")List<String> symptoms);
 }
 

+ 1 - 1
src/main/resources/application-test.yml

@@ -106,7 +106,7 @@ spring:
 
 neo4j:
   data:
-    URI: http://192.168.3.150:7480
+    URI: http://192.168.2.234:7480
     username: neo4j
     password: root