Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/diagbot/facade/NeoFacade.java
zhoutg 4 years ago
parent
commit
b3cad1cd0b

+ 42 - 0
src/main/java/com/diagbot/entity/node/LisRemind.java

@@ -0,0 +1,42 @@
+package com.diagbot.entity.node;
+
+import com.diagbot.entity.node.base.BaseNode;
+import lombok.Getter;
+import lombok.Setter;
+import org.neo4j.ogm.annotation.NodeEntity;
+import org.neo4j.ogm.annotation.Property;
+import org.neo4j.ogm.annotation.Relationship;
+
+import java.util.HashSet;
+import java.util.Set;
+
+@Setter
+@Getter
+@NodeEntity(label = "化验提醒指标")
+public class LisRemind extends BaseNode  {
+
+	@Property(name = "单位")
+	private String unit;
+
+	@Property(name = "最小值")
+	private Double minval=0.0;
+
+	@Property(name = "最大值")
+	private Double maxval=0.0;
+
+	@Property(name = "范围")
+	private Integer range=0;
+
+	@Property(name = "结果")
+    private String result;
+
+	@Property(name = "实验室检查名称")
+	private String lisname;
+
+	@Relationship(type = "化验提醒指标相关医保疾病名称", direction = Relationship.OUTGOING)
+	private Set<YiBaoDiseaseName> disease = new HashSet<>();
+
+	@Relationship(type = "化验提醒指标相关药品通用名称", direction = Relationship.OUTGOING)
+	private Set<Medicine> medicines = new HashSet<>();
+
+}

+ 4 - 0
src/main/java/com/diagbot/entity/node/Medicine.java

@@ -18,4 +18,8 @@ public class Medicine extends BaseNode  {
 	@Relationship(type = "药品相关药品通用名称", direction = Relationship.INCOMING)
 	private Set<MedCodeName> medcodenames = new HashSet<>();
 
+	@Relationship(type = "化验提醒指标相关药品通用名称", direction = Relationship.INCOMING)
+	private Set<LisRemind> lisreminds = new HashSet<>();
+
+
 }

+ 2 - 0
src/main/java/com/diagbot/entity/node/YiBaoDiseaseName.java

@@ -45,4 +45,6 @@ public class YiBaoDiseaseName extends BaseNode  {
 	@Relationship(type = "实验室检查结果相关医保疾病名称", direction = Relationship.INCOMING)
 	private Set<LisResult> lisresults = new HashSet<>();
 
+	@Relationship(type = "化验提醒指标相关医保疾病名称", direction = Relationship.INCOMING)
+	private Set<LisRemind> lisreminds = new HashSet<>();
 }

+ 91 - 0
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -3,6 +3,9 @@ package com.diagbot.facade;
 import com.alibaba.fastjson.JSONArray;
 import com.diagbot.client.ChiefPresentSimilarityServiceClient;
 import com.diagbot.client.StandConvertServiceClient;
+import com.diagbot.dto.*;
+import com.diagbot.biz.push.entity.Lis;
+import com.diagbot.entity.node.*;
 import com.diagbot.dto.BillNeoDTO;
 import com.diagbot.dto.CriticalNeoDTO;
 import com.diagbot.dto.HighRiskNeoDTO;
@@ -46,6 +49,7 @@ import com.diagbot.vo.StandConvertCrfVO;
 import com.diagbot.vo.neoPushEntity.ChiefPushVo;
 import com.diagbot.vo.neoPushEntity.Diag;
 import com.diagbot.vo.neoPushEntity.PresentPushVo;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.beans.factory.annotation.Value;
@@ -80,6 +84,8 @@ public class NeoFacade {
     @Autowired
     LisSetRepository lisSetRepository;
     @Autowired
+    LisRemindRepository lisRemindRepository;
+    @Autowired
     YiBaoDiseaseRepository yiBaodiseaseRepository;
     @Autowired
     YiBaoOperationNameRepository yiBaoOperationRepository;
@@ -283,6 +289,91 @@ public class NeoFacade {
     }
 
 
+    /**
+     * 处理其它提醒
+     */
+    public List<OtherTipNeoDTO> getOtherRemind(List<Lis> lislist) {
+
+        Map<String, List<LisRemind>> lrmap = new HashMap<>();
+        List<OtherTipNeoDTO> otherTipNeoDTOS = new ArrayList<>();
+
+        try {
+            List<LisRemind> lisReminds = lisRemindRepository.findByNameContaining("");
+
+            String lisname, result, unit;
+            Double val;
+
+            for (LisRemind lisRemind : lisReminds) {
+                lisname = lisRemind.getLisname();
+                if (null == lrmap.get(lisname)) {
+                    lrmap.put(lisname, new ArrayList<>());
+                }
+                lrmap.get(lisname).add(lisRemind);
+            }
+
+            for (Lis lis : lislist) {
+                lisname = lis.getUniqueName();
+                if (null != lrmap.get(lisname)) {
+                    List<LisRemind> lrlist = lrmap.get(lisname);
+                    OtherTipNeoDTO otherTipNeoDTO = new OtherTipNeoDTO();
+                    BeanUtils.copyProperties(lis, otherTipNeoDTO);
+
+                    result = lis.getOtherValue();
+                    if (StringUtil.isBlank(result)) {
+                        val = lis.getValue();
+                        unit = lis.getUnits();
+                        for (LisRemind lisRemind : lrlist) {
+                            if (lisRemind.getRange() == 0 && /*lisRemind.getUnit().equals(unit) &&*/
+                                    (val <= lisRemind.getMaxval() && val >= lisRemind.getMinval())) {
+                                otherTipNeoDTO.setFactor(getReminds(lisRemind));
+                                otherTipNeoDTOS.add(otherTipNeoDTO);
+                            } else if (lisRemind.getRange() == 1 && /*lisRemind.getUnit().equals(unit) &&*/
+                                    (val > lisRemind.getMaxval() || val < lisRemind.getMinval())) {
+                                otherTipNeoDTO.setFactor(getReminds(lisRemind));
+                                otherTipNeoDTOS.add(otherTipNeoDTO);
+                            }
+                        }
+                    } else {
+                        for (LisRemind lisRemind : lrlist) {
+                            if (result.equals(lisRemind.getResult())) {
+                                otherTipNeoDTO.setFactor(getReminds(lisRemind));
+                                otherTipNeoDTOS.add(otherTipNeoDTO);
+                            }
+                        }
+                    }
+
+                }
+            }
+        }
+        catch (Exception ex) {
+            ex.printStackTrace();
+        }
+
+        return otherTipNeoDTOS;
+    }
+
+
+    public List<NodeNeoDTO> getReminds(LisRemind lisRemind) {
+        List<NodeNeoDTO> nodeNeoDTOS = new ArrayList<>();
+        NodeNeoDTO nodeNeoDTO;
+
+        for (YiBaoDiseaseName disease : lisRemind.getDisease()) {
+            nodeNeoDTO = new NodeNeoDTO();
+            nodeNeoDTO.setName(disease.getName());
+            nodeNeoDTO.setTermtype(Constants.zhenduan);
+            nodeNeoDTOS.add(nodeNeoDTO);
+        }
+
+        for (Medicine medicine : lisRemind.getMedicines()) {
+            nodeNeoDTO = new NodeNeoDTO();
+            nodeNeoDTO.setName(medicine.getName());
+            nodeNeoDTO.setTermtype(Constants.yaoping);
+            nodeNeoDTOS.add(nodeNeoDTO);
+        }
+
+        return nodeNeoDTOS;
+    }
+
     /**
      * 处理处方开单合理性
      */

+ 1 - 1
src/main/java/com/diagbot/facade/OtherTipFacade.java

@@ -33,7 +33,7 @@ public class OtherTipFacade {
      * @return
      */
     public void otherTipFac(IndicationPushVO indicationPushVO, WordCrfDTO wordCrfDTO, IndicationDTO res) {
-        List<OtherTipNeoDTO> otherTipNeoDTOList = new ArrayList<>();
+        List<OtherTipNeoDTO> otherTipNeoDTOList = neoFacade.getOtherRemind(wordCrfDTO.getLis());
         // 其他提示——化验
         // // TODO 测试数据开始
         // OtherTipNeoDTO otherTipNeoDTO = new OtherTipNeoDTO();

+ 1 - 40
src/main/java/com/diagbot/repository/BaseNodeRepository.java

@@ -14,46 +14,7 @@ public interface BaseNodeRepository extends Neo4jRepository<BaseNode, Long> {
     @Query("MATCH (n) RETURN DISTINCT(LABELS(n))")
     List<String> getLabels();
 
-    /*
-    @Query("MATCH (n) RETURN DISTINCT(KEYS(n))")
-    List<List<String>> getKeys();
-    */
-
     @Query("MATCH (c:药品解剖学类别)<-[r:药品相关药品解剖学类别]-(y:药品代码通用名)-[r1:药品相关药品通用名称]->(m:药品通用名称) " +
             " RETURN DISTINCT(m.name)+'::'+c.name")
     List<String> getMedClass();
-
-    /*
-    @Query("MATCH (m) DELETE m")
-    void removeNodes();
-
-    @Query("MATCH (m:PreMDC) DETACH DELETE m")
-    void removePreMDC();
-
-    @Query("MATCH (m:MDC) DETACH DELETE m")
-    void removeMDC();
-
-    @Query("MATCH (m:ADRG) DETACH DELETE m")
-    void removeADRG();
-
-    @Query("MATCH (i:ICD) DETACH DELETE i")
-    void removeICD();
-
-    @Query("MATCH (n{name:{name}})-[r]->(m) WHERE type(r)={rel} RETURN m")
-    List<BaseNode> getNodesbyName_Relation(@Param("name") String name, @Param("rel") String relation);
-
-    @Query("MATCH (n) WHERE n.name={name} RETURN n")
-    List<BaseNode> getNodesbyNameIs(@Param("name") String name);
-
-    @Query("MATCH (n) WHERE n.name=~{name} RETURN n")
-    List<BaseNode> getNodesbyNameLike(@Param("name") String name);
-
-    @Query("MATCH(n) RETURN DISTINCT(LABELS(n))")
-    List<List<String>> getLabels();
-
-    @Query("MATCH (d:疾病{name:{disease}}) " +
-           "MATCH (i:ICD10编码{name:{icd}}) " +
-           "MERGE (d)-[r:{rel}]->(i) RETURN d, i")
-    List<BaseNode> connectDiseasetoICD10(@Param("disease") String disease, @Param("icd") String icd10, @Param("rel") String relation);
-    */
-}
+}

+ 17 - 0
src/main/java/com/diagbot/repository/LisRemindRepository.java

@@ -0,0 +1,17 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.LisRemind;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+import java.util.List;
+
+
+public interface LisRemindRepository extends Neo4jRepository<LisRemind, Long> {
+
+    List<LisRemind> findByNameIs(String name);
+
+    List<LisRemind> findByNameContaining(String name);
+
+}
+