|
@@ -874,7 +874,7 @@ public class Neo4jAPI {
|
|
|
/**
|
|
|
* 指标推送
|
|
|
*/
|
|
|
- public Set<String> getInd(String[] keys,String sex,int age) {
|
|
|
+ public Set<String> getInd(String[] keys,String sex,int age,String[] webDiagList) {
|
|
|
//查找指标推送
|
|
|
Set<String> indSet = new HashSet<>();
|
|
|
List<String> newList = new ArrayList<>();
|
|
@@ -883,6 +883,10 @@ public class Neo4jAPI {
|
|
|
for (String fild : keys) {
|
|
|
fildList.add("\"" + fild.trim() + "\"");
|
|
|
}
|
|
|
+ for (String diag:webDiagList
|
|
|
+ ) {
|
|
|
+ fildList.add("\"" + diag + "\"");
|
|
|
+ }
|
|
|
logger.info("根据 " + fildList + " 这些词推送指标!!!");
|
|
|
Session session = null;
|
|
|
StatementResult result = null;
|
|
@@ -989,34 +993,7 @@ public class Neo4jAPI {
|
|
|
nf.setMinimumFractionDigits(0);//设置该百分比数字,保留2位小数;
|
|
|
nf.setRoundingMode(RoundingMode.HALF_UP); //设置满5向上进位,即四舍五入;
|
|
|
Map<String, String> resultMap = new HashMap<>();
|
|
|
- String[] diseaseArray = disease.split(",|,|、|;|:|;");
|
|
|
- List<String> diseaseList = new ArrayList<>();//诊断数组
|
|
|
- for (int i = 0; i < diseaseArray.length; i++) {
|
|
|
- diseaseList.add(diseaseArray[i]);
|
|
|
- }
|
|
|
- Map<String, ArrayList> diseFilds = new HashMap<>();
|
|
|
-// for (int i = 0; i < diseaseList.size(); i++) {
|
|
|
- String[] fildsArray = filds.split(",");
|
|
|
- ArrayList<String> fildsList = new ArrayList<>();//其他条件数组
|
|
|
- for (String fild : fildsArray) {
|
|
|
- fildsList.add("\'" + fild + "\'");
|
|
|
- }
|
|
|
- if(disSet != null && disSet.size()>0){
|
|
|
- for (String yizhen : disSet) {
|
|
|
- fildsList.add("\'" + yizhen + "\'");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- for (String h : ueSet) {
|
|
|
- fildsList.add("\'" + h + "\'");
|
|
|
- }
|
|
|
- /* for (int j = 0; j < diseaseList.size(); j++) {
|
|
|
- if (i != j) {
|
|
|
- fildsList.add("\'" + diseaseList.get(j) + "\'");
|
|
|
- }
|
|
|
- }*/
|
|
|
-
|
|
|
- diseFilds.put(disName, fildsList);
|
|
|
+ Map<String, ArrayList> diseFilds = getdisFilds(disName, disease, disSet, ueSet, filds);
|
|
|
// }
|
|
|
try {
|
|
|
session = driver.session(AccessMode.WRITE);
|
|
@@ -1210,6 +1187,163 @@ public class Neo4jAPI {
|
|
|
return diagTreat;
|
|
|
}
|
|
|
}
|
|
|
+ public Map<String,Filnlly> getMulDiseaseTreat_new(String disName,String disease, Integer diseaseType, Set<String> disSet, Map<String, List<String>> disUE, Set<String> ueSet, String filds) {
|
|
|
+ Map<String,Filnlly> newTret = new HashMap<>();
|
|
|
+ Session session = null;
|
|
|
+ Map<String, ArrayList> diseFilds = getdisFilds(disName, disease, disSet, ueSet, filds);
|
|
|
+ try{
|
|
|
+ session = driver.session(AccessMode.WRITE);
|
|
|
+ Integer integer = session.writeTransaction(new TransactionWork<Integer>() {
|
|
|
+ @Override
|
|
|
+ public Integer execute(Transaction tx) {
|
|
|
+ StatementResult result = null;
|
|
|
+ String query = "";
|
|
|
+ if(diseFilds != null && diseFilds.size()>0){
|
|
|
+ for (Map.Entry<String, ArrayList> df : diseFilds.entrySet()) {
|
|
|
+ //大对象集合
|
|
|
+ ArrayList<Drugs> drugsList = new ArrayList<Drugs>();
|
|
|
+
|
|
|
+ Map<String,String> medicaton_ji = new HashMap<>();//药的忌用和慎用集合
|
|
|
+ Map<String,List<String>> medicatonMap = new LinkedHashMap<>();//全部的药集合
|
|
|
+ String diseaseName = df.getKey();//疾病
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Filnlly filnlly = new Filnlly();
|
|
|
+ //显示不良反应
|
|
|
+ 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);
|
|
|
+ logger.info(disSet + "包含 " + de);
|
|
|
+ indicatorsList1.add(indicators1);
|
|
|
+ }
|
|
|
+ filnlly.setAdverseEvent(indicatorsList1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ filnlly.setTreatment(drugsList);
|
|
|
+ newTret.put(diseaseName, filnlly);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ CloseSession(session);
|
|
|
+ return newTret;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 治疗方案,取每个诊断对应的filds
|
|
|
+ * @param disName
|
|
|
+ * @param disease
|
|
|
+ * @param disSet
|
|
|
+ * @param ueSet
|
|
|
+ * @param filds
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Map<String, ArrayList> getdisFilds(String disName, String disease, Set<String> disSet, Set<String> ueSet, String filds) {
|
|
|
+ String[] diseaseArray = disease.split(",|,|、|;|:|;");
|
|
|
+ List<String> diseaseList = new ArrayList<>();//诊断数组
|
|
|
+ for (int i = 0; i < diseaseArray.length; i++) {
|
|
|
+ diseaseList.add(diseaseArray[i]);
|
|
|
+ }
|
|
|
+ Map<String, ArrayList> diseFilds = new HashMap<>();
|
|
|
+ String[] fildsArray = filds.split(",");
|
|
|
+ ArrayList<String> fildsList = new ArrayList<>();//其他条件数组
|
|
|
+ for (String fild : fildsArray) {
|
|
|
+ fildsList.add("\'" + fild + "\'");
|
|
|
+ }
|
|
|
+ if(disSet != null && disSet.size()>0){
|
|
|
+ for (String yizhen : disSet) {
|
|
|
+ fildsList.add("\'" + yizhen + "\'");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (String h : ueSet) {
|
|
|
+ fildsList.add("\'" + h + "\'");
|
|
|
+ }
|
|
|
+ diseFilds.put(disName, fildsList);
|
|
|
+ return diseFilds;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 推送指标
|
|
@@ -1523,7 +1657,7 @@ public class Neo4jAPI {
|
|
|
bigGrad.put("details", gradItemJ);
|
|
|
gradItemJson.add(bigGrad);
|
|
|
gradeJson.put("rows", gradItemJson);
|
|
|
- mangementMap.put("疗效评估", curativeJson);
|
|
|
+ mangementMap.put("风险因素评估", curativeJson);
|
|
|
mangementMap.put("糖尿病分级管理", gradeJson);
|
|
|
mangementEvaluation.setMangementEvaluation(mangementMap);
|
|
|
// }
|
|
@@ -2267,4 +2401,5 @@ public class Neo4jAPI {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|