|
@@ -770,6 +770,103 @@ public class Neo4jAPI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 新结构,包含关联词
|
|
|
|
+ * @param keys
|
|
|
|
+ * @param webDiag
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public Map<String, Map<String,String>> getNewCondition(String[] keys,String webDiag) {
|
|
|
|
+ Map<String, Map<String,String>> diseaseCondition = new LinkedHashMap<>();
|
|
|
|
+ List<String> newList = new ArrayList<>();
|
|
|
|
+ List<String> fildList = new ArrayList<>();
|
|
|
|
+ List<String> startList = new ArrayList<>();
|
|
|
|
+ //输出确诊集合
|
|
|
|
+ Set<String> quezhen = new LinkedHashSet<>();
|
|
|
|
+ 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);
|
|
|
|
+ logger.info("session 为: " + session);
|
|
|
|
+ //第一步查询是否有组合的词
|
|
|
|
+ query = propertiesUtil.getProperty("searchNumColl").replace("startList", fildList.toString());
|
|
|
|
+ result = session.run(query);
|
|
|
|
+ while (result.hasNext()) {
|
|
|
|
+ Record next = result.next();
|
|
|
|
+ String v = next.get("v").toString();
|
|
|
|
+ startList.add(v);
|
|
|
|
+ }
|
|
|
|
+ newList.addAll(startList);
|
|
|
|
+ while (newList.size() > 0) {
|
|
|
|
+ query = propertiesUtil.getProperty("searchNewCondition").replace("newList", newList.toString()).replace("fildList", startList.toString());
|
|
|
|
+ result = session.run(query);
|
|
|
|
+ newList.clear();
|
|
|
|
+ while (result.hasNext()) {
|
|
|
|
+ Record record = result.next();
|
|
|
|
+ String condition = record.get("condition").toString();
|
|
|
|
+ String jundgement = record.get("jundgement").toString();
|
|
|
|
+ if ("TRUE".equals(jundgement)) {
|
|
|
|
+ newList.add(condition);
|
|
|
|
+ startList.add(condition);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //第三步查找确诊
|
|
|
|
+ query = propertiesUtil.getProperty("searchDis").replace("startList", startList.toString());
|
|
|
|
+ result = session.run(query);
|
|
|
|
+ while (result.hasNext()) {
|
|
|
|
+ Record record = result.next();
|
|
|
|
+ String quezhenName = record.get("name").toString().replace("\"", "");
|
|
|
|
+ String conditionType = record.get("relationType").toString().replace("\"", "");
|
|
|
|
+ if ("确诊".equals(conditionType)) {
|
|
|
|
+ quezhen.add(quezhenName);
|
|
|
|
+ } else if ("拟诊".equals(conditionType)) {
|
|
|
|
+ quezhen.add(quezhenName);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (String qu : quezhen) {
|
|
|
|
+ Map<String, String> dis_res = new HashMap<>();
|
|
|
|
+ dis_res.put("确诊", "");
|
|
|
|
+// diseaseCondition.put(qu, JSON.toJSONString(dis_res));
|
|
|
|
+ diseaseCondition.put(qu,dis_res);
|
|
|
|
+ logger.info("图谱推出的诊断为: " + qu);
|
|
|
|
+ }
|
|
|
|
+ Set<String> queSets = diseaseCondition.keySet();
|
|
|
|
+ if(webDiag != null && webDiag.trim() != ""){
|
|
|
|
+ String[] webDiagSplits = webDiag.split(",");
|
|
|
|
+ String mainDiag = webDiagSplits[0];
|
|
|
|
+ query = propertiesUtil.getProperty("searchDifferentialDiagnose").replace("mainDis", mainDiag);
|
|
|
|
+ result = session.run(query);
|
|
|
|
+ while (result.hasNext()) {
|
|
|
|
+ Record record = result.next();
|
|
|
|
+ List<Object> coll = record.get("coll").asList();
|
|
|
|
+ if(coll != null && coll.size()>0){
|
|
|
|
+ for (Object o:coll) {
|
|
|
|
+ if(queSets.contains(o.toString().replace("\"",""))){
|
|
|
|
+ Map<String, String> stringStringMap = diseaseCondition.get(o.toString().replace("\"", ""));
|
|
|
|
+ stringStringMap.put("鉴别诊断","");
|
|
|
|
+ diseaseCondition.put(o.toString().replace("\"",""),stringStringMap);
|
|
|
|
+ }else {
|
|
|
|
+ Map<String, String> diffMap = new HashMap<>();
|
|
|
|
+ diffMap.put("鉴别诊断","");
|
|
|
|
+ diseaseCondition.put(o.toString().replace("\"",""),diffMap);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ } finally {
|
|
|
|
+ CloseSession(session);
|
|
|
|
+ return diseaseCondition;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 不良反应推送
|
|
* 不良反应推送
|
|
*/
|
|
*/
|