|
@@ -1033,10 +1033,10 @@ public class Neo4jAPI {
|
|
|
}
|
|
|
Map<String, String> medicationUseMap = new HashMap<>();//key:药名 value:禁忌(慎用)
|
|
|
StringBuffer fildBuffer = new StringBuffer();
|
|
|
- fildBuffer.append("match (n:Disease{name:'" + diseaseName + "'})-[:推荐]->(d)<-[r0:慎用]-(m)").append("\n");
|
|
|
+ fildBuffer.append("match (n:Disease{name:'" + diseaseName + "'})-[:推荐]->(d:Medicine)<-[r0:慎用]-(m)").append("\n");
|
|
|
fildBuffer.append("where m.name in " + value + "").append("\n");
|
|
|
fildBuffer.append("return d.name as ff,type(r0) as hh").append("\n").append("union\n");
|
|
|
- fildBuffer.append("match (n:Disease{name:'" + diseaseName + "'})-[:推荐]->(d)<-[r0:忌用]-(m)\n");
|
|
|
+ fildBuffer.append("match (n:Disease{name:'" + diseaseName + "'})-[:推荐]->(d:Medicine)<-[r0:忌用]-(m)\n");
|
|
|
fildBuffer.append("where m.name in " + value + "").append("\n");
|
|
|
fildBuffer.append("return d.name as ff,type(r0) as hh");
|
|
|
query = fildBuffer.toString();
|
|
@@ -1047,6 +1047,24 @@ public class Neo4jAPI {
|
|
|
String type = next.get("hh").toString().replace("\"", "");//忌用(慎用)
|
|
|
medicationUseMap.put(name, type);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 查找药类的忌用
|
|
|
+ */
|
|
|
+ Map<String, String> drugsUseMap = new HashMap<>();//key:药名 value:禁忌(慎用)
|
|
|
+ query = "match (n:Disease{name:'急性胰腺炎'})-[:推荐]->(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:'急性胰腺炎'})-[:推荐]->(d:Drugs)<-[r0:忌用]-(m)\n" +
|
|
|
+ "where m.name in "+value+"" +
|
|
|
+ "return d.name as ff,type(r0) as hh";
|
|
|
+ result = tx.run(query);
|
|
|
+ while (result.hasNext()) {
|
|
|
+ Record next = result.next();
|
|
|
+ String name = next.get("ff").toString().replace("\"", "");//类名
|
|
|
+ String type = next.get("hh").toString().replace("\"", "");//忌用(慎用)
|
|
|
+ drugsUseMap.put(name, type);
|
|
|
+ }
|
|
|
//大对象集合
|
|
|
ArrayList<Drugs> drugsList = new ArrayList<Drugs>();
|
|
|
DrugsPattern drugsPattern = new DrugsPattern();
|
|
@@ -1056,39 +1074,77 @@ public class Neo4jAPI {
|
|
|
String drugsName = w.getKey();//药类
|
|
|
// Map<String, String> bigSubDrugs = new DrugsPattern().bigSubDrugs(drugsName);
|
|
|
Map<String, String> bigSubDrugs = drugsPattern.bigSubDrugs(drugsName);
|
|
|
+ drugs.setBigdrugsName(bigSubDrugs.get("big"));
|
|
|
+ drugs.setSubdrugsName(bigSubDrugs.get("sub"));
|
|
|
LinkedList<Medicition> medicitionsList=new LinkedList<>();
|
|
|
LinkedHashMap<String, String> meditionRate = w.getValue();
|
|
|
- for (Map.Entry<String,String> g:meditionRate.entrySet()
|
|
|
- ) {
|
|
|
- Medicition medicition = new Medicition();
|
|
|
- String meditionName = g.getKey().trim();//药名
|
|
|
- String rate = nf.format(Double.parseDouble(g.getValue().trim()));//百分比
|
|
|
- medicition.setMedicitionName(meditionName);
|
|
|
- medicition.setRate(rate);
|
|
|
- if (i<3) {
|
|
|
- medicition.setIsShow(1);
|
|
|
- i++;
|
|
|
- } else {
|
|
|
- medicition.setIsShow(0);
|
|
|
- }
|
|
|
- if ("忌用".equals(medicationUseMap.get(meditionName))) {
|
|
|
+ if("忌用".equals(drugsUseMap.get(bigSubDrugs.get("big"))) || "忌用".equals(drugsUseMap.get(bigSubDrugs.get("sub")))){
|
|
|
+ drugs.setDrugsForbidden(2);
|
|
|
+ for (Map.Entry<String,String> g:meditionRate.entrySet()
|
|
|
+ ) {
|
|
|
+ Medicition medicition = new Medicition();
|
|
|
+ String meditionName = g.getKey().trim();//药名
|
|
|
+ String rate = nf.format(Double.parseDouble(g.getValue().trim()));//百分比
|
|
|
+ medicition.setMedicitionName(meditionName);
|
|
|
+ medicition.setRate(rate);
|
|
|
+ if (i<3) {
|
|
|
+ medicition.setIsShow(1);
|
|
|
+ i++;
|
|
|
+ } else {
|
|
|
+ medicition.setIsShow(0);
|
|
|
+ }
|
|
|
medicition.setForbidden(2);
|
|
|
- } else if ("慎用".equals(medicationUseMap.get(meditionName))) {
|
|
|
+ medicitionsList.add(medicition);
|
|
|
+ }
|
|
|
+ }else if("慎用".equals(drugsUseMap.get(bigSubDrugs.get("big"))) || "慎用".equals(drugsUseMap.get(bigSubDrugs.get("sub")))){
|
|
|
+ drugs.setDrugsForbidden(1);
|
|
|
+ for (Map.Entry<String,String> g:meditionRate.entrySet()
|
|
|
+ ) {
|
|
|
+ Medicition medicition = new Medicition();
|
|
|
+ String meditionName = g.getKey().trim();//药名
|
|
|
+ String rate = nf.format(Double.parseDouble(g.getValue().trim()));//百分比
|
|
|
+ medicition.setMedicitionName(meditionName);
|
|
|
+ medicition.setRate(rate);
|
|
|
+ if (i<3) {
|
|
|
+ medicition.setIsShow(1);
|
|
|
+ i++;
|
|
|
+ } else {
|
|
|
+ medicition.setIsShow(0);
|
|
|
+ }
|
|
|
medicition.setForbidden(1);
|
|
|
- } else {
|
|
|
- medicition.setForbidden(0);
|
|
|
+ medicitionsList.add(medicition);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ drugs.setDrugsForbidden(0);
|
|
|
+ for (Map.Entry<String,String> g:meditionRate.entrySet()
|
|
|
+ ) {
|
|
|
+ Medicition medicition = new Medicition();
|
|
|
+ String meditionName = g.getKey().trim();//药名
|
|
|
+ String rate = nf.format(Double.parseDouble(g.getValue().trim()));//百分比
|
|
|
+ medicition.setMedicitionName(meditionName);
|
|
|
+ medicition.setRate(rate);
|
|
|
+ if (i<3) {
|
|
|
+ medicition.setIsShow(1);
|
|
|
+ i++;
|
|
|
+ } else {
|
|
|
+ medicition.setIsShow(0);
|
|
|
+ }
|
|
|
+ if ("忌用".equals(medicationUseMap.get(meditionName))) {
|
|
|
+ medicition.setForbidden(2);
|
|
|
+ } else if ("慎用".equals(medicationUseMap.get(meditionName))) {
|
|
|
+ medicition.setForbidden(1);
|
|
|
+ } else {
|
|
|
+ medicition.setForbidden(0);
|
|
|
+ }
|
|
|
+ medicitionsList.add(medicition);
|
|
|
}
|
|
|
- medicitionsList.add(medicition);
|
|
|
}
|
|
|
- drugs.setBigdrugsName(bigSubDrugs.get("big"));
|
|
|
- drugs.setSubdrugsName(bigSubDrugs.get("sub"));
|
|
|
drugs.setMedicitionsList(medicitionsList);
|
|
|
drugsList.add(drugs);
|
|
|
}
|
|
|
Filnlly filnlly = new Filnlly();
|
|
|
filnlly.setTreatment(drugsList);
|
|
|
diagTreat.put(diseaseName,filnlly);
|
|
|
-
|
|
|
}
|
|
|
return 1;
|
|
|
}
|