|
@@ -653,6 +653,17 @@ public class Neo4jAPI {
|
|
String query = "";
|
|
String query = "";
|
|
try {
|
|
try {
|
|
session = driver.session(AccessMode.WRITE);
|
|
session = driver.session(AccessMode.WRITE);
|
|
|
|
+ //第一步查询是否有组合的词
|
|
|
|
+ query = propertiesUtil.getProperty("searchCollection").replace("fildList",fildList.toString());
|
|
|
|
+ result = session.run(query);
|
|
|
|
+ while (result.hasNext()){
|
|
|
|
+ Record next = result.next();
|
|
|
|
+ String jundgement = next.get("jundgement").toString();
|
|
|
|
+ String standName = next.get("standName").toString();
|
|
|
|
+ if ("TRUE".equals(jundgement)){
|
|
|
|
+ fildList.add(standName);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
query = propertiesUtil.getProperty("serchCollect").replace("fildList", fildList.toString());
|
|
query = propertiesUtil.getProperty("serchCollect").replace("fildList", fildList.toString());
|
|
result = session.run(query);
|
|
result = session.run(query);
|
|
while (result.hasNext()) {
|
|
while (result.hasNext()) {
|
|
@@ -669,35 +680,22 @@ public class Neo4jAPI {
|
|
fildList.remove(fild);
|
|
fildList.remove(fild);
|
|
fildList.add(js);
|
|
fildList.add(js);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ }else {
|
|
|
|
+ fildList.add(fild);
|
|
|
|
+ query = "match(l)-[r:近义词]->(h) where l.name="+fild+" return h.name as js";
|
|
|
|
+ StatementResult run1 = session.run(query);
|
|
|
|
+ while (run1.hasNext()){
|
|
|
|
+ Record next = run1.next();
|
|
|
|
+ String js = next.get("js").toString();
|
|
|
|
+ fildList.add(js);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-/* //判断是否有近义词
|
|
|
|
- query = "match (l)-[r:近义词]->(m)\n" +
|
|
|
|
- "where l.name in " + fildList + "\n" +
|
|
|
|
- "return l.name as zi,type(r),m.name as fu";
|
|
|
|
- result = session.run(query);
|
|
|
|
- while (result.hasNext()) {
|
|
|
|
- Record record = result.next();
|
|
|
|
- String c = record.get("zi").toString();
|
|
|
|
- String d = record.get("fu").toString();
|
|
|
|
- fildList.remove(c);
|
|
|
|
- fildList.add(d);
|
|
|
|
- }*/
|
|
|
|
- // System.out.println("参与计算的词:"+fildList);
|
|
|
|
newList.addAll(fildList);
|
|
newList.addAll(fildList);
|
|
int i = 0;
|
|
int i = 0;
|
|
while (newList.size() > 0) {
|
|
while (newList.size() > 0) {
|
|
i++;
|
|
i++;
|
|
- query = "with " + newList + " as data unwind data as row\n" +
|
|
|
|
- "match (l)-[r:诊断依据]->(m)\n" +
|
|
|
|
- "where l.name= row\n" +
|
|
|
|
- "with m," + fildList + " as data unwind data as row\n" +
|
|
|
|
- "match (n)-[r:诊断依据]->(m)\n" +
|
|
|
|
- "where n.name= row\n" +
|
|
|
|
- "return m.name as condition, count(distinct r)>=m.path as jundgement, labels(m)[0] as label";
|
|
|
|
- // System.out.println("第"+i+"次查询:");
|
|
|
|
- // System.out.println(query);
|
|
|
|
|
|
+ query = propertiesUtil.getProperty("searchCondition").replace("newList",newList.toString()).replace("fildList",fildList.toString());
|
|
result = session.run(query);
|
|
result = session.run(query);
|
|
newList.clear();
|
|
newList.clear();
|
|
while (result.hasNext()) {
|
|
while (result.hasNext()) {
|
|
@@ -711,12 +709,8 @@ public class Neo4jAPI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- query = "with " + fildList + " as data unwind data as row\n" +
|
|
|
|
- "match (n)-[r:确诊|:拟诊]->(m)\n" +
|
|
|
|
- "where n.name=row\n" +
|
|
|
|
- "with distinct m,r\n" +
|
|
|
|
- "return m.name as name, labels(m)[0] as label,type(r) as relationType";
|
|
|
|
|
|
+ //第三步查找确诊
|
|
|
|
+ query = propertiesUtil.getProperty("searchQuezhen").replace("fildList",fildList.toString());
|
|
result = session.run(query);
|
|
result = session.run(query);
|
|
while (result.hasNext()) {
|
|
while (result.hasNext()) {
|
|
Record record = result.next();
|
|
Record record = result.next();
|
|
@@ -733,10 +727,8 @@ public class Neo4jAPI {
|
|
dis_res.put("确诊", "");
|
|
dis_res.put("确诊", "");
|
|
diseaseCondition.put(qu, JSON.toJSONString(dis_res));
|
|
diseaseCondition.put(qu, JSON.toJSONString(dis_res));
|
|
}
|
|
}
|
|
-
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
-
|
|
|
|
} finally {
|
|
} finally {
|
|
CloseSession(session);
|
|
CloseSession(session);
|
|
return diseaseCondition;
|
|
return diseaseCondition;
|