|
@@ -653,17 +653,17 @@ public class Neo4jAPI {
|
|
|
String query = "";
|
|
|
try {
|
|
|
session = driver.session(AccessMode.WRITE);
|
|
|
- query = propertiesUtil.getProperty("serchCollect").replace("fildList",fildList.toString());
|
|
|
+ query = propertiesUtil.getProperty("serchCollect").replace("fildList", fildList.toString());
|
|
|
result = session.run(query);
|
|
|
- while (result.hasNext()){
|
|
|
+ while (result.hasNext()) {
|
|
|
Record record = result.next();
|
|
|
String fild = record.get("fild").toString();
|
|
|
List<Object> typeCollect = record.get("typeCollect").asList();
|
|
|
//如果不包含诊断依据就找它的同义词,否则就要这个词
|
|
|
- if("近义词".equals(typeCollect.get(0)) && typeCollect.size() ==1){
|
|
|
- query = "match(l)-[r:近义词]->(h) where l.name="+fild+" return h.name as js";
|
|
|
+ if ("近义词".equals(typeCollect.get(0)) && typeCollect.size() == 1) {
|
|
|
+ query = "match(l)-[r:近义词]->(h) where l.name=" + fild + " return h.name as js";
|
|
|
StatementResult jinyiResult = session.run(query);
|
|
|
- while (jinyiResult.hasNext()){
|
|
|
+ while (jinyiResult.hasNext()) {
|
|
|
Record next = jinyiResult.next();
|
|
|
String js = next.get("js").toString();
|
|
|
fildList.remove(fild);
|
|
@@ -684,7 +684,7 @@ public class Neo4jAPI {
|
|
|
fildList.remove(c);
|
|
|
fildList.add(d);
|
|
|
}*/
|
|
|
-// System.out.println("参与计算的词:"+fildList);
|
|
|
+ // System.out.println("参与计算的词:"+fildList);
|
|
|
newList.addAll(fildList);
|
|
|
int i = 0;
|
|
|
while (newList.size() > 0) {
|
|
@@ -696,8 +696,8 @@ public class Neo4jAPI {
|
|
|
"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);
|
|
|
+ // System.out.println("第"+i+"次查询:");
|
|
|
+ // System.out.println(query);
|
|
|
result = session.run(query);
|
|
|
newList.clear();
|
|
|
while (result.hasNext()) {
|
|
@@ -720,11 +720,11 @@ public class Neo4jAPI {
|
|
|
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)){
|
|
|
+ String quezhenName = record.get("name").toString().replace("\"", "");
|
|
|
+ String conditionType = record.get("relationType").toString().replace("\"", "");
|
|
|
+ if ("确诊".equals(conditionType)) {
|
|
|
quezhen.add(quezhenName);
|
|
|
- }else if("拟诊".equals(conditionType)){
|
|
|
+ } else if ("拟诊".equals(conditionType)) {
|
|
|
quezhen.add(quezhenName);
|
|
|
}
|
|
|
}
|
|
@@ -1066,11 +1066,11 @@ public class Neo4jAPI {
|
|
|
* 查找药类的忌用
|
|
|
*/
|
|
|
Map<String, String> drugsUseMap = new HashMap<>();//key:药名 value:禁忌(慎用)
|
|
|
- query = "match (n:Disease{name:'"+diseaseName+"'})-[:推荐]->(d:Drugs)<-[r0:慎用]-(m)\n" +
|
|
|
+ query = "match (n:Disease{name:'" + diseaseName + "'})-[:推荐]->(d:Drugs)<-[r0:慎用]-(m)\n" +
|
|
|
"where m.name in " + value + "" +
|
|
|
"return d.name as ff,type(r0) as hh\n" +
|
|
|
"union\n" +
|
|
|
- "match (n:Disease{name:'"+diseaseName+"'})-[:推荐]->(d:Drugs)<-[r0:忌用]-(m)\n" +
|
|
|
+ "match (n:Disease{name:'" + diseaseName + "'})-[:推荐]->(d:Drugs)<-[r0:忌用]-(m)\n" +
|
|
|
"where m.name in " + value + "" +
|
|
|
"return d.name as ff,type(r0) as hh";
|
|
|
result = tx.run(query);
|
|
@@ -1332,14 +1332,14 @@ public class Neo4jAPI {
|
|
|
if ("LIS".equals(lei)) {
|
|
|
lisArray.add(name);
|
|
|
} else if ("PACS".equals(lei)) {
|
|
|
- pacsArray.add(name);
|
|
|
+ pacsArray.add(name);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// lisPacsMap.put("LIS", processList(lisList));
|
|
|
-// lisPacsMap.put("PACS", processList(pacsList));
|
|
|
- lisPacsMap1.put("LIS",processList(lisArray));
|
|
|
- lisPacsMap1.put("PACS",processList(pacsArray));
|
|
|
+ // lisPacsMap.put("LIS", processList(lisList));
|
|
|
+ // lisPacsMap.put("PACS", processList(pacsList));
|
|
|
+ lisPacsMap1.put("LIS", processList(lisArray));
|
|
|
+ lisPacsMap1.put("PACS", processList(pacsArray));
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
|
|
@@ -1654,15 +1654,18 @@ public class Neo4jAPI {
|
|
|
Record rec;
|
|
|
scaleName = scaleName.toUpperCase();
|
|
|
|
|
|
- //<年龄,<<=44,0>> 最外层
|
|
|
- Map<String, Object> twoLevelItems = new LinkedHashMap<>();
|
|
|
- //第二层
|
|
|
Map<String, Object> threeLevelItems = new LinkedHashMap<>();
|
|
|
//<<=44,0>
|
|
|
- Map<Object, Object> itemOrIndex = new LinkedHashMap<>();
|
|
|
+
|
|
|
+ Map<String, Object> result = null;
|
|
|
+ Map<String, Object> title = new LinkedHashMap<>();
|
|
|
+ List<Object> results = new ArrayList<>();
|
|
|
+ List<Object> titles;
|
|
|
+
|
|
|
+ threeLevelItems.put("type", "");
|
|
|
|
|
|
try {
|
|
|
- String query1 = "match (m:Scale)-[r1]->(n1)-[r2]->(n2) WHERE m.name=~'.*" + scaleName + ".*' return n1.name,r1.score,n2.name," +
|
|
|
+ String query1 = "match (m:Scale)-[r1]->(n1)-[r2]->(n2) WHERE m.name=~'.*" + scaleName + ".*' return n1.name,n1.method,r1.score,n2.name," +
|
|
|
"r2.score,n2.type,r2.p order by toInt(r2.p),n2.type";
|
|
|
|
|
|
String query2 = "match (m:Scale)-[r1]->(n1)-[r2]->(n2)-[r3]->(n3) WHERE m.name=~'.*" + scaleName + ".*' return n1.name,r1.score,n2.name," +
|
|
@@ -1683,32 +1686,75 @@ public class Neo4jAPI {
|
|
|
item = rec.get("n1.name").toString().replace("\"", "");
|
|
|
optionOrIndex = rec.get("n2.name").toString().replace("\"", "");
|
|
|
score1 = rec.get("r2.score").toString().replace("\"", "");
|
|
|
+
|
|
|
+
|
|
|
if (!"NULL".equals(score1)) {
|
|
|
- if (!threeLevelItems.containsKey(item)) {
|
|
|
- itemOrIndex = new LinkedHashMap<>();
|
|
|
+ if ("计算方法".equals(item)) {
|
|
|
+ String[] score = score1.split("~|-");
|
|
|
+ String min = score[0];
|
|
|
+ String max = score[1];
|
|
|
+ result = new LinkedHashMap<>();
|
|
|
+ result.put("min", min);
|
|
|
+ result.put("max", max);
|
|
|
+ result.put("text", optionOrIndex);
|
|
|
+ results.add(result);
|
|
|
}
|
|
|
- itemOrIndex.put(optionOrIndex, score1);
|
|
|
- threeLevelItems.put(item, itemOrIndex);
|
|
|
+
|
|
|
+ threeLevelItems.put("result", results);
|
|
|
+ } else {
|
|
|
+ titles = new ArrayList<>();
|
|
|
+ title.put("name", item);
|
|
|
+ title.put("column", "name");
|
|
|
+ titles.add(title);
|
|
|
+ title = new LinkedHashMap<>();
|
|
|
+ title.put("name", "临床症状");
|
|
|
+ title.put("column", "detailName");
|
|
|
+ titles.add(title);
|
|
|
+ title = new LinkedHashMap<>();
|
|
|
+ title.put("name", "得分");
|
|
|
+ title.put("column", "score");
|
|
|
+ titles.add(title);
|
|
|
+ title = new LinkedHashMap<>();
|
|
|
+ title.put("name", "推荐选项");
|
|
|
+ title.put("column", "");
|
|
|
+ titles.add(title);
|
|
|
+ threeLevelItems.put("title", titles);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ Map<String, List<Map<String, String>>> nameDetails = new HashMap<>();
|
|
|
+ List<Object> finalResult = new ArrayList<>();
|
|
|
while (Rset2.hasNext()) {
|
|
|
rec = Rset2.next();
|
|
|
item = rec.get("n1.name").toString().replace("\"", "");
|
|
|
+ //左拇指震动觉、右拇指振动觉
|
|
|
optionOrIndex = rec.get("n2.name").toString().replace("\"", "");
|
|
|
+ //正常、存在、消失
|
|
|
index = rec.get("n3.name").toString().replace("\"", "");
|
|
|
+ //score
|
|
|
score2 = rec.get("r3.score").toString().replace("\"", "");
|
|
|
|
|
|
- if (!threeLevelItems.containsKey(item)) {
|
|
|
- itemOrIndex = new LinkedHashMap<>();
|
|
|
- twoLevelItems = new LinkedHashMap<>();
|
|
|
- }
|
|
|
- if (!twoLevelItems.containsKey(optionOrIndex)) {
|
|
|
- itemOrIndex = new LinkedHashMap<>();
|
|
|
+ Map<String, String> detailInfo = new LinkedHashMap<>();
|
|
|
+ detailInfo.put("detailName", index);
|
|
|
+ detailInfo.put("score", score2);
|
|
|
+ detailInfo.put("state","0");
|
|
|
+ if (nameDetails.containsKey(optionOrIndex)){
|
|
|
+ nameDetails.get(optionOrIndex).add(detailInfo);
|
|
|
+ }else{
|
|
|
+ nameDetails.put(optionOrIndex, new ArrayList<>());
|
|
|
+ nameDetails.get(optionOrIndex).add(detailInfo);
|
|
|
}
|
|
|
- itemOrIndex.put(index, score2);
|
|
|
- twoLevelItems.put(optionOrIndex, itemOrIndex);
|
|
|
- threeLevelItems.put(item, twoLevelItems);
|
|
|
}
|
|
|
+ for (Map.Entry<String, List<Map<String, String>>> nameDetailEntry: nameDetails.entrySet()){
|
|
|
+ String key = nameDetailEntry.getKey();
|
|
|
+ List<Map<String, String>> value = nameDetailEntry.getValue();
|
|
|
+ Map<String, Object> detailsResult = new LinkedHashMap<>();
|
|
|
+ detailsResult.put("name", key);
|
|
|
+ detailsResult.put("details", value);
|
|
|
+ detailsResult.put("type","1:radio,2:checkbox.....");
|
|
|
+ finalResult.add(detailsResult);
|
|
|
+ }
|
|
|
+ threeLevelItems.put("detials", finalResult);
|
|
|
} catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
System.out.println("返回带得分需要计算的量表时出了问题!---->getScaleCalc");
|