|
@@ -1207,101 +1207,19 @@ public class Neo4jAPI {
|
|
if (diseFilds != null && diseFilds.size() > 0) {
|
|
if (diseFilds != null && diseFilds.size() > 0) {
|
|
for (Map.Entry<String, ArrayList> df : diseFilds.entrySet()) {
|
|
for (Map.Entry<String, ArrayList> df : diseFilds.entrySet()) {
|
|
//大对象集合
|
|
//大对象集合
|
|
- ArrayList<Drugs> drugsList = new ArrayList<Drugs>();
|
|
|
|
-
|
|
|
|
|
|
+ ArrayList<Drugs> drugsList;
|
|
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();//疾病
|
|
ArrayList value = df.getValue();//其他条件
|
|
ArrayList value = df.getValue();//其他条件
|
|
- query = propertiesUtil.getProperty("searchTreat").replace("disName", "\'" + diseaseName + "\'").replace("filds", value.toString());
|
|
|
|
- logger.info("查找诊断对应的类和药物,包括类的排序,查找语句为:\n" + query);
|
|
|
|
- result = tx.run(query);
|
|
|
|
- while (result.hasNext()) {
|
|
|
|
- Record record = result.next();
|
|
|
|
- String big = record.get("big").toString().replace("\"", "");
|
|
|
|
- String sub = record.get("sub").toString().replace("\"", "");
|
|
|
|
- String med = record.get("med").toString().replace("\"", "");
|
|
|
|
- String ty = record.get("ty").toString().replace("\"", "");
|
|
|
|
- if ("NULL".equals(ty)) {
|
|
|
|
- if (medicatonMap.containsKey(big + "$" + sub)) {
|
|
|
|
- List<String> ml = medicatonMap.get(big + "$" + sub);
|
|
|
|
- ml.add(med);
|
|
|
|
- medicatonMap.put(big + "$" + sub, ml);
|
|
|
|
- } else {
|
|
|
|
- List<String> ml = new ArrayList<>();
|
|
|
|
- ml.add(med);
|
|
|
|
- medicatonMap.put(big + "$" + sub, ml);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (medicaton_ji.containsKey(med)) {
|
|
|
|
- if (medicaton_ji.get(med).equals("慎用") && ty.equals("忌用")) {
|
|
|
|
- medicaton_ji.put(med, "忌用");
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- medicaton_ji.put(med, ty);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (medicatonMap != null && medicatonMap.size() > 0) {
|
|
|
|
- for (Map.Entry<String, List<String>> fd : medicatonMap.entrySet()) {
|
|
|
|
- int i = 0;
|
|
|
|
- String big = "", sub = "";
|
|
|
|
- String big_sub = fd.getKey();//大小类
|
|
|
|
- List<String> medications = fd.getValue();//药的集合
|
|
|
|
- String[] splits = big_sub.split("\\$");
|
|
|
|
- Drugs drugs = new Drugs();
|
|
|
|
- if (splits[0].equals(splits[1])) {
|
|
|
|
- sub = "";
|
|
|
|
- big = splits[0];
|
|
|
|
- } else {
|
|
|
|
- big = splits[0];
|
|
|
|
- sub = splits[1];
|
|
|
|
- }
|
|
|
|
- LinkedList<Medicition> mes = new LinkedList<>();
|
|
|
|
- if (medications != null && medications.size() > 0) {
|
|
|
|
- for (String m : medications) {
|
|
|
|
- Medicition medicition = new Medicition();
|
|
|
|
- medicition.setMedicitionName(m);
|
|
|
|
- if (medicaton_ji.containsKey(m)) {
|
|
|
|
- String s = medicaton_ji.get(m);
|
|
|
|
- if (s.equals("忌用")) {
|
|
|
|
- medicition.setForbidden(2);
|
|
|
|
- } else {
|
|
|
|
- medicition.setForbidden(1);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- medicition.setForbidden(0);
|
|
|
|
- }
|
|
|
|
- if (i < 3) {
|
|
|
|
- medicition.setIsShow(1);
|
|
|
|
- i++;
|
|
|
|
- } else {
|
|
|
|
- medicition.setIsShow(0);
|
|
|
|
- }
|
|
|
|
- mes.add(medicition);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- drugs.setBigdrugsName(big);
|
|
|
|
- drugs.setSubdrugsName(sub);
|
|
|
|
- drugs.setDrugsForbidden(0);
|
|
|
|
- drugs.setMedicitionsList(mes);
|
|
|
|
- drugsList.add(drugs);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // TODO: 2019/11/12 处理规则判断的用药情况
|
|
|
|
+
|
|
|
|
+ drugsList = allMedication(tx,medicaton_ji, medicatonMap, diseaseName, value);
|
|
Filnlly filnlly = new Filnlly();
|
|
Filnlly filnlly = new Filnlly();
|
|
//显示不良反应
|
|
//显示不良反应
|
|
if (diseaseType != null && 1 == diseaseType) {
|
|
if (diseaseType != null && 1 == diseaseType) {
|
|
- List<String> stringList = disUE.get(diseaseName);
|
|
|
|
- logger.info(diseaseName + "下面有" + stringList + "不良反应");
|
|
|
|
- if (stringList != null && stringList.size() > 0) {
|
|
|
|
- List<Indicators> indicatorsList1 = new ArrayList<>();
|
|
|
|
- for (String de : stringList) {
|
|
|
|
- Indicators indicators1 = getAdverse(ueSet, de,crisisDetails);
|
|
|
|
- logger.info(disSet + "包含 " + de);
|
|
|
|
- indicatorsList1.add(indicators1);
|
|
|
|
- }
|
|
|
|
- filnlly.setAdverseEvent(indicatorsList1);
|
|
|
|
- }
|
|
|
|
|
|
+ List<Indicators> indicators = sideEffect(diseaseName, disUE, ueSet, crisisDetails, disSet);
|
|
|
|
+ filnlly.setAdverseEvent(indicators);
|
|
}
|
|
}
|
|
filnlly.setTreatment(drugsList);
|
|
filnlly.setTreatment(drugsList);
|
|
newTret.put(diseaseName, filnlly);
|
|
newTret.put(diseaseName, filnlly);
|
|
@@ -1318,6 +1236,114 @@ public class Neo4jAPI {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private ArrayList<Drugs> allMedication(Transaction tx, Map<String, String> medicaton_ji, Map<String, List<String>> medicatonMap, String diseaseName, ArrayList value) {
|
|
|
|
+ ArrayList<Drugs> drugsList = new ArrayList<Drugs>();
|
|
|
|
+ String query;
|
|
|
|
+ StatementResult result;
|
|
|
|
+ query = propertiesUtil.getProperty("searchTreat").replace("disName", "\'" + diseaseName + "\'").replace("filds", value.toString());
|
|
|
|
+ logger.info("查找诊断对应的类和药物,包括类的排序,查找语句为:\n" + query);
|
|
|
|
+ result = tx.run(query);
|
|
|
|
+ while (result.hasNext()) {
|
|
|
|
+ Record record = result.next();
|
|
|
|
+ String big = record.get("big").toString().replace("\"", "");
|
|
|
|
+ String sub = record.get("sub").toString().replace("\"", "");
|
|
|
|
+ String med = record.get("med").toString().replace("\"", "");
|
|
|
|
+ String ty = record.get("ty").toString().replace("\"", "");
|
|
|
|
+ if ("NULL".equals(ty)) {
|
|
|
|
+ if (medicatonMap.containsKey(big + "$" + sub)) {
|
|
|
|
+ List<String> ml = medicatonMap.get(big + "$" + sub);
|
|
|
|
+ ml.add(med);
|
|
|
|
+ medicatonMap.put(big + "$" + sub, ml);
|
|
|
|
+ } else {
|
|
|
|
+ List<String> ml = new ArrayList<>();
|
|
|
|
+ ml.add(med);
|
|
|
|
+ medicatonMap.put(big + "$" + sub, ml);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (medicaton_ji.containsKey(med)) {
|
|
|
|
+ if (medicaton_ji.get(med).equals("慎用") && ty.equals("忌用")) {
|
|
|
|
+ medicaton_ji.put(med, "忌用");
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ medicaton_ji.put(med, ty);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (medicatonMap != null && medicatonMap.size() > 0) {
|
|
|
|
+ for (Map.Entry<String, List<String>> fd : medicatonMap.entrySet()) {
|
|
|
|
+ int i = 0;
|
|
|
|
+ String big = "", sub = "";
|
|
|
|
+ String big_sub = fd.getKey();//大小类
|
|
|
|
+ List<String> medications = fd.getValue();//药的集合
|
|
|
|
+ String[] splits = big_sub.split("\\$");
|
|
|
|
+ Drugs drugs = new Drugs();
|
|
|
|
+ if (splits[0].equals(splits[1])) {
|
|
|
|
+ sub = "";
|
|
|
|
+ big = splits[0];
|
|
|
|
+ } else {
|
|
|
|
+ big = splits[0];
|
|
|
|
+ sub = splits[1];
|
|
|
|
+ }
|
|
|
|
+ LinkedList<Medicition> mes = new LinkedList<>();
|
|
|
|
+ if (medications != null && medications.size() > 0) {
|
|
|
|
+ for (String m : medications) {
|
|
|
|
+ Medicition medicition = new Medicition();
|
|
|
|
+ medicition.setMedicitionName(m);
|
|
|
|
+ if (medicaton_ji.containsKey(m)) {
|
|
|
|
+ String s = medicaton_ji.get(m);
|
|
|
|
+ if (s.equals("忌用")) {
|
|
|
|
+ medicition.setForbidden(2);
|
|
|
|
+ } else {
|
|
|
|
+ medicition.setForbidden(1);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ medicition.setForbidden(0);
|
|
|
|
+ }
|
|
|
|
+ if (i < 3) {
|
|
|
|
+ medicition.setIsShow(1);
|
|
|
|
+ i++;
|
|
|
|
+ } else {
|
|
|
|
+ medicition.setIsShow(0);
|
|
|
|
+ }
|
|
|
|
+ mes.add(medicition);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ drugs.setBigdrugsName(big);
|
|
|
|
+ drugs.setSubdrugsName(sub);
|
|
|
|
+ drugs.setDrugsForbidden(0);
|
|
|
|
+ drugs.setMedicitionsList(mes);
|
|
|
|
+ drugsList.add(drugs);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return drugsList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //不良反应set
|
|
|
|
+ private List<Indicators> sideEffect(String diseaseName, Map<String, List<String>> disUE, Map<String, String> ueSet, Map<String, List<CrisisDetail>> crisisDetails, Set<String> disSet) {
|
|
|
|
+ List<Indicators> indicatorsList1 =null;
|
|
|
|
+ List<String> stringList = disUE.get(diseaseName);
|
|
|
|
+ logger.info(diseaseName + "下面有" + stringList + "不良反应");
|
|
|
|
+ if (stringList != null && stringList.size() > 0) {
|
|
|
|
+ indicatorsList1 = new ArrayList<>();
|
|
|
|
+ for (String de : stringList) {
|
|
|
|
+ Indicators indicators1 = getAdverse(ueSet, de,crisisDetails);
|
|
|
|
+ logger.info(disSet + "包含 " + de);
|
|
|
|
+ indicatorsList1.add(indicators1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return indicatorsList1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 用药规则处理
|
|
|
|
+ * @param diseaseName
|
|
|
|
+ * @param values
|
|
|
|
+ */
|
|
|
|
+ public void medicationRule(String diseaseName,List values,Session session){
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 治疗方案,取每个诊断对应的filds
|
|
* 治疗方案,取每个诊断对应的filds
|
|
*
|
|
*
|