|
@@ -1208,7 +1208,7 @@ public class Neo4jAPI {
|
|
for (Map.Entry<String, ArrayList> df : diseFilds.entrySet()) {
|
|
for (Map.Entry<String, ArrayList> df : diseFilds.entrySet()) {
|
|
//大对象集合
|
|
//大对象集合
|
|
List<Drugs> drugsList;
|
|
List<Drugs> drugsList;
|
|
- TreatCate treatCate = null;
|
|
|
|
|
|
+ List<TreatCate> treatCate = null;
|
|
Map<String, String> medicaton_ji = new HashMap<>();//药的忌用和慎用集合
|
|
Map<String, String> medicaton_ji = new HashMap<>();//药的忌用和慎用集合
|
|
Map<String, List<String>> medicatonMap = new LinkedHashMap<>();//全部的药集合
|
|
Map<String, List<String>> medicatonMap = new LinkedHashMap<>();//全部的药集合
|
|
String diseaseName = df.getKey();//疾病
|
|
String diseaseName = df.getKey();//疾病
|
|
@@ -1217,11 +1217,7 @@ public class Neo4jAPI {
|
|
// TODO: 2019/11/12 处理规则判断的用药情况
|
|
// TODO: 2019/11/12 处理规则判断的用药情况
|
|
JSONObject jsonObject = medicationRule(tx, medicaton_ji, medicatonMap,diseaseName,value);
|
|
JSONObject jsonObject = medicationRule(tx, medicaton_ji, medicatonMap,diseaseName,value);
|
|
drugsList = (List<Drugs>)jsonObject.get("drugs");
|
|
drugsList = (List<Drugs>)jsonObject.get("drugs");
|
|
- treatCate = (TreatCate)jsonObject.get("treatCate");
|
|
|
|
- if(treatCate.getType() == null){
|
|
|
|
- treatCate = null;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ treatCate = (List<TreatCate>)jsonObject.get("treatCate");
|
|
//规则不成立,返回全部用药
|
|
//规则不成立,返回全部用药
|
|
if(drugsList == null || drugsList.size() == 0){
|
|
if(drugsList == null || drugsList.size() == 0){
|
|
drugsList = allMedication(tx,medicaton_ji, medicatonMap, diseaseName, value,1,null);
|
|
drugsList = allMedication(tx,medicaton_ji, medicatonMap, diseaseName, value,1,null);
|
|
@@ -1240,7 +1236,7 @@ public class Neo4jAPI {
|
|
newTret.put(diseaseName, filnlly);
|
|
newTret.put(diseaseName, filnlly);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return 1;
|
|
|
|
|
|
+ return 1;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -1256,8 +1252,10 @@ public class Neo4jAPI {
|
|
String query = null;
|
|
String query = null;
|
|
StatementResult result;
|
|
StatementResult result;
|
|
if(sign == 1){
|
|
if(sign == 1){
|
|
|
|
+ //不经过规则,全部数据
|
|
query = propertiesUtil.getProperty("searchTreat").replace("disName", "\'" + diseaseName + "\'").replace("filds", value.toString());
|
|
query = propertiesUtil.getProperty("searchTreat").replace("disName", "\'" + diseaseName + "\'").replace("filds", value.toString());
|
|
}else if(sign == 2){
|
|
}else if(sign == 2){
|
|
|
|
+ //规则匹配
|
|
query = propertiesUtil.getProperty("searchRuleMedicaton").replace("disName", "\'" + diseaseName + "\'").replace("filds", value.toString()).replace("drugsList",drugslist.toString());
|
|
query = propertiesUtil.getProperty("searchRuleMedicaton").replace("disName", "\'" + diseaseName + "\'").replace("filds", value.toString()).replace("drugsList",drugslist.toString());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1363,8 +1361,12 @@ public class Neo4jAPI {
|
|
String query;
|
|
String query;
|
|
StatementResult result;
|
|
StatementResult result;
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
- TreatCate treatCate = new TreatCate();
|
|
|
|
- List<Drugs> drugs = new ArrayList<>();
|
|
|
|
|
|
+ List<TreatCate> treatCateList = new ArrayList<>();
|
|
|
|
+ List<TreatCate> compliCateList = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Map<String,List<String>> bingdisDrugs = new LinkedHashMap<>();//并发症
|
|
|
|
+ Map<String,List<String>> zhudisDrugs =new LinkedHashMap<>();//主症
|
|
// TODO: 2019/11/13 开始匹配规则
|
|
// TODO: 2019/11/13 开始匹配规则
|
|
query=propertiesUtil.getProperty("medicationRule").replace("filds",value.toString());
|
|
query=propertiesUtil.getProperty("medicationRule").replace("filds",value.toString());
|
|
result = tx.run(query);
|
|
result = tx.run(query);
|
|
@@ -1373,37 +1375,66 @@ public class Neo4jAPI {
|
|
while (result.hasNext()) {
|
|
while (result.hasNext()) {
|
|
Record record = result.next();
|
|
Record record = result.next();
|
|
int j = record.get("design").asInt();
|
|
int j = record.get("design").asInt();
|
|
- if(j>i){
|
|
|
|
|
|
+ String p = record.get("p").toString();
|
|
|
|
+ String category = record.get("category").toString().replace("\"","");
|
|
|
|
+ String disName = record.get("disName").toString().replace("\"","");
|
|
|
|
+ if(j>=i){
|
|
i = j;
|
|
i = j;
|
|
collection = (List) record.get("collection").asList();
|
|
collection = (List) record.get("collection").asList();
|
|
}
|
|
}
|
|
- }
|
|
|
|
- List<String> medictionDrugs =null;
|
|
|
|
- if(collection != null){
|
|
|
|
- medictionDrugs = new ArrayList<>();
|
|
|
|
- for (String drugsp:collection) {
|
|
|
|
- String[] splits = drugsp.replace("\"", "").split("\\+");
|
|
|
|
- for (String drug:splits) {
|
|
|
|
- if(medictionDrugs.contains("'"+drug+"'")){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- medictionDrugs.add("'"+drug+"'");
|
|
|
|
- }
|
|
|
|
|
|
+ if(!"NULL".equals(p)){
|
|
|
|
+ bingdisDrugs.put(disName,collection);
|
|
|
|
+ }else {
|
|
|
|
+ zhudisDrugs.put(disName,collection);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // TODO: 2019/11/18 处理主症
|
|
|
|
+ List<String> medictionDrugs =null;
|
|
|
|
+ medictionDrugs =processDisDrugs(zhudisDrugs);
|
|
//根据类找药
|
|
//根据类找药
|
|
- try {
|
|
|
|
- drugs = allMedication(tx, medicaton_ji, medicatonMap, diseaseName, value, 2, medictionDrugs);
|
|
|
|
- }catch (Exception e){
|
|
|
|
- drugs = null;
|
|
|
|
- }
|
|
|
|
|
|
+ List<Drugs> zhu_drugs = allMedication(tx, medicaton_ji, medicatonMap, diseaseName, value, 2, medictionDrugs);
|
|
|
|
+ TreatCate treatCate = new TreatCate();
|
|
treatCate.setType(switchType(i));
|
|
treatCate.setType(switchType(i));
|
|
treatCate.setName(collection);
|
|
treatCate.setName(collection);
|
|
- jsonObject.put("drugs",drugs);
|
|
|
|
- jsonObject.put("treatCate",treatCate);
|
|
|
|
|
|
+ treatCateList.add(treatCate);
|
|
|
|
+ jsonObject.put("drugs",zhu_drugs);
|
|
|
|
+ jsonObject.put("treatCate",treatCateList);
|
|
|
|
+
|
|
|
|
+ // TODO: 2019/11/18 处理并发症
|
|
|
|
+ List<String> fdf = processDisDrugs(bingdisDrugs);
|
|
|
|
+ List<Drugs> bing_drugs = allMedication(tx, medicaton_ji, medicatonMap, diseaseName, value, 2, fdf);
|
|
|
|
+ for (Map.Entry<String,List<String>>db:bingdisDrugs.entrySet()
|
|
|
|
+ ) {
|
|
|
|
+ TreatCate treatCa = new TreatCate();
|
|
|
|
+ treatCa.setType(db.getKey());
|
|
|
|
+ treatCa.setName(db.getValue());
|
|
|
|
+ compliCateList.add(treatCa);
|
|
|
|
+ }
|
|
|
|
+ jsonObject.put("compli_cate",compliCateList);
|
|
|
|
+ jsonObject.put("compli_treatment",bing_drugs);
|
|
return jsonObject;
|
|
return jsonObject;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public List<String> processDisDrugs(Map<String,List<String>> disDrugs){
|
|
|
|
+ List<String> drugsList = new ArrayList<>();
|
|
|
|
+ if(disDrugs != null && disDrugs.size()>0){
|
|
|
|
+ for (Map.Entry<String,List<String>> dd:disDrugs.entrySet()) {
|
|
|
|
+ List<String> value = dd.getValue();
|
|
|
|
+ for (String drugsp:value) {
|
|
|
|
+ String[] splits = drugsp.replace("\"", "").split("\\+");
|
|
|
|
+ for (String drug:splits) {
|
|
|
|
+ if(drugsList.contains("'"+drug+"'")){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ drugsList.add("'"+drug+"'");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return drugsList;
|
|
|
|
+ }
|
|
|
|
+
|
|
//单、双药、胰岛素药
|
|
//单、双药、胰岛素药
|
|
private String switchType(int i) {
|
|
private String switchType(int i) {
|
|
String type;
|
|
String type;
|
|
@@ -1446,6 +1477,12 @@ public class Neo4jAPI {
|
|
for (String fild : fildsArray) {
|
|
for (String fild : fildsArray) {
|
|
fildsList.add("\'" + fild + "\'");
|
|
fildsList.add("\'" + fild + "\'");
|
|
}
|
|
}
|
|
|
|
+ if(diseaseList != null && diseaseList.size()>0){
|
|
|
|
+ for (String dis:diseaseList
|
|
|
|
+ ) {
|
|
|
|
+ fildsList.add("\'" + dis + "\'");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (disSet != null && disSet.size() > 0) {
|
|
if (disSet != null && disSet.size() > 0) {
|
|
for (String yizhen : disSet) {
|
|
for (String yizhen : disSet) {
|
|
fildsList.add("\'" + yizhen + "\'");
|
|
fildsList.add("\'" + yizhen + "\'");
|
|
@@ -1465,7 +1502,7 @@ public class Neo4jAPI {
|
|
}
|
|
}
|
|
if(details != null && details.size() >0){
|
|
if(details != null && details.size() >0){
|
|
for (Map.Entry<String,String> de:details.entrySet()) {
|
|
for (Map.Entry<String,String> de:details.entrySet()) {
|
|
- fildsList.add("\'"+de.getValue()+de.getKey()+"\'");
|
|
|
|
|
|
+ fildsList.add("\'"+de.getValue().trim()+de.getKey().trim()+"\'");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
diseFilds.put(disName, fildsList);
|
|
diseFilds.put(disName, fildsList);
|