Sfoglia il codice sorgente

1、grade分支合并进grade-rule

louhr 5 anni fa
parent
commit
168d5af9b6

+ 2 - 2
algorithm/src/main/resources/algorithm.properties

@@ -1,7 +1,7 @@
 ################################ model basic url ###################################
 
-#basicPath=E:/project/push/algorithm/src/main/models/model_version_replacement/model
-basicPath=/opt/models/dev/models/model_version_replacement/model
+basicPath=E:/project/push/algorithm/src/main/models/model_version_replacement/model
+#basicPath=/opt/models/dev/models/model_version_replacement/model
 #basicPath=E:/xxx/model_version_replacement/model
 
 ############################### current model version ################################

+ 40 - 4
graph-web/src/main/java/org/diagbot/graphWeb/work/GraphCalculate.java

@@ -47,8 +47,7 @@ public class GraphCalculate {
         int age = searchData.getAge();
         String sex = searchData.getSex();
         logger.info("前端传来的年龄为 :"+age+" 前端传来的性别为 :"+sex);
-        //获取缓存
-//        Map<String, String> lexionCache = CacheUtil.getLexionCache();
+
         Map<String, Map<String, String>> sexAgeCache = CacheUtil.getSexAgeCache();
         Map<String, Map<String, String>> inputs = searchData.getGraphInputs();
         Set<String> ss = new HashSet<>();
@@ -152,16 +151,20 @@ public class GraphCalculate {
                 responseData.setManagementEvaluation(mangementEvaluation1);
             }
         }
-
+        String pacsOrder = searchData.getPacsOrder();
         //指标推送
         if (featureTypeList.contains("22") ) {
+            List<MedicalIndication> pacsMi = getPacsMi(pacsOrder, inputList,webDiag);
             //查找指标
             Set<String> indSet = neo4jAPI.getInd((String[]) inputList.toArray(new String[inputList.size()]));
             logger.info("featureTypeList 包含22,走指标推送!!!,图谱推出的指标为:" + indSet);
             if(indSet.contains("肾功能不全")){
                 List<MedicalIndication> idn = neo4jAPI.getIdn(indSet, age, sex);
-                responseData.setMedicalIndications(idn);
+                pacsMi.addAll(idn);
+                responseData.setMedicalIndications(pacsMi);
             }
+            responseData.setMedicalIndications(pacsMi);
+
         }
 
         //诊断推送
@@ -171,6 +174,39 @@ public class GraphCalculate {
         System.out.println("Total takes: " + (System.currentTimeMillis()-starttime)/1000d + 's');
         return responseData;
     }
+    public List<MedicalIndication> getPacsMi(String pacsOrder,List<String> inputList,String webDiag){
+        if(StringUtils.isNotEmpty(webDiag)){
+            String[] webDiagsplits = webDiag.split(",|,|、|;|:|;");
+            for (String wd:webDiagsplits
+                 ) {
+                inputList.add(wd);
+            }
+        }
+
+        List<MedicalIndication> pacsMi = new ArrayList<>();
+        Map<String, String> newInd = neo4jAPI.getNewInd((String[]) inputList.toArray(new String[inputList.size()]));
+        if(StringUtils.isNotEmpty(pacsOrder)){
+            String[] pacsOrders = pacsOrder.split(",|,");
+            for (String pacs:pacsOrders) {
+                if(newInd.containsKey(pacs)){
+                    String causes = newInd.get(pacs);
+                    MedicalIndication m = new MedicalIndication();
+                    List<MedicalIndicationDetail> mds = new ArrayList<>();
+                    MedicalIndicationDetail medicalIndicationDetail = new MedicalIndicationDetail();
+                    medicalIndicationDetail.setType(4);
+                    JSONObject jsonObject = new JSONObject();
+                    jsonObject.put("name", causes);
+                    jsonObject.put("controlType",2);
+                    medicalIndicationDetail.setContent(jsonObject);
+                    mds.add(medicalIndicationDetail);
+                    m.setName("不建议做:"+pacs);
+                    m.setDetails(mds);
+                    pacsMi.add(m);
+                }
+            }
+        }
+        return pacsMi;
+    }
 //    诊断过滤
     public void filterDis(List<FeatureRate> graphFeatureRates,String sex,Integer age) throws Exception {
         if(neo4jAPI == null){

+ 48 - 1
graph/src/main/java/org/diagbot/graph/jdbc/Neo4jAPI.java

@@ -1143,7 +1143,54 @@ public class Neo4jAPI {
         }
     }
 
-
+    /**
+     * 指标推送,检查预警
+     */
+    public Map<String,String> getNewInd(String[] keys) {
+        //查找指标推送
+        Map<String ,String> indMap = new HashMap<>();
+        List<String> fildList = new ArrayList<>();
+        for (String fild : keys) {
+            fildList.add("\"" + fild.trim() + "\"");
+        }
+        logger.info("根据 " + fildList + " 这些词推送指标!!!");
+        Session session = null;
+        StatementResult result = null;
+        String query = "";
+        try {
+            session = driver.session(AccessMode.WRITE);
+            //第一步查询输入的词所在number
+            query = "match(t:Temporary)-[r:属于]->(n:NewCondition)-[r1:诊断依据]->(n1:NewCondition)-[r2:拟诊]->(n2:NewIndicators) \n" +
+                    "where t.name in "+fildList+" return n2.name as name";
+            System.out.println(query);
+            result = session.run(query);
+            while (result.hasNext()) {
+                Record record = result.next();
+                String newIndName = record.get("name").toString();
+                StringBuffer s = new StringBuffer();
+                query = "match(n2:NewIndicators)-[r:表现]->(t:Temporary) where n2.name="+newIndName+" return collect(t.name) as names";
+                StatementResult sr = session.run(query);
+                while (sr.hasNext()){
+                    Record next = sr.next();
+                    List<Object> names = next.get("names").asList();
+                    if(names.size()>0){
+                        for (Object o:names) {
+
+                            if(fildList.indexOf("\""+o.toString()+"\"") >= 0){
+                                s.append(o.toString().replace("\"", ""));
+                            }
+                        }
+                    }
+                }
+                indMap.put(newIndName.replace("\"", ""),s.toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            CloseSession(session);
+            return indMap;
+        }
+    }
     /**
      * 多疾病下治疗方案
      *

+ 2 - 2
graph/src/main/resources/bolt.properties

@@ -5,7 +5,7 @@ pass_235 = diagbot@20180822
 
 # neo4j bolt credentials
 #\u7EBF\u4E0A\u4F7F\u7528
-bolt.uri=bolt://192.168.2.232
+bolt.uri=bolt://192.168.2.234
 bolt.user=neo4j
 bolt.passwd=root
 
@@ -87,7 +87,7 @@ searchDifferentialDiagnose=match(d:Disease)-[r:\u9274\u522B\u8BCA\u65AD]->(h) wh
 searchEmergency=match(d:Disease) where d.name in disList return d.name as emDis,d.emergency as em
 
 #\u67E5\u627E\u6307\u6807\u7684\u8BED\u53E5
-searchIndication=match (n:Condition)-[r:\u786E\u8BCA|:\u62DF\u8BCA]->(m:Indicators)\n \
+    searchIndication=match (n:Condition)-[r:\u786E\u8BCA|:\u62DF\u8BCA]->(m:Indicators)\n \
 where n.name in fildList\n \
 with distinct m,r\n \
 return m.name as name

+ 2 - 2
graphdb/src/main/resources/application.yml

@@ -6,14 +6,14 @@ spring:
     active: local
   data:
     neo4j:
-      uri: bolt://192.168.2.232:7687
+      uri: bolt://192.168.2.234:7687
       username: neo4j
       password: root
 
 # 驱动配置信息
   datasource:
     driver-class-name: org.neo4j.jdbc.Driver
-    url: jdbc:neo4j:http://192.168.2.232:7474
+    url: jdbc:neo4j:http://192.168.2.234:7474
     username: neo4j
     password: root
     #定义初始连接数

+ 2 - 2
nlp/src/main/resources/nlp.properties

@@ -1,3 +1,3 @@
 #Êý¾ÝÎļþ´æ·Å·¾¶
-cache.file.dir=/opt/diagbot-push/cache_file/
-#cache.file.dir=d:\\cache_file\\
+#cache.file.dir=/opt/diagbot-push/cache_file/
+cache.file.dir=d:\\cache_file\\