Selaa lähdekoodia

Merge remote-tracking branch 'origin/push-dev-ruletype' into push-test

kongwz 5 vuotta sitten
vanhempi
commit
b4d9adfe1a

+ 97 - 6
graph-web/src/main/java/org/diagbot/graphWeb/work/GraphCalculate.java

@@ -34,6 +34,7 @@ public class GraphCalculate {
         }
     }
     private static Neo4jAPI neo4jAPI ;
+    private static Map<String,List<String>> mergeMap;
 
     /**
      * 返回诊断和治疗
@@ -109,14 +110,13 @@ public class GraphCalculate {
         starttime = System.currentTimeMillis();
         //走治疗
         if (StringUtils.isNotEmpty(diseaseName) && featureTypeList.contains(Constants.feature_type_treat)) {
+            List<MedicalIndication> medicalIndications = responseData.getMedicalIndications();
+            CrisisDetail shenGong = getShenGong(medicalIndications);
+            List<CrisisDetail> crisis = crisisDetails.get("crisis");
+            crisis.add(shenGong);
+            crisisDetails.put("crisis",crisis);
             PushTreat pushTreat = new PushTreat();
             Treat treat = pushTreat.processTreat(diseaseName,webDiag,diseaseType, driver, (String[]) inputList.toArray(new String[inputList.size()]),exculdDiagFilds, crisisDetails);
-//            Map<String, List<String>> disUE = pushTreat.getDisUE(diseaseName,1,driver);
-//            Map<String,String> ue = pushTreat.getUe((String[]) inputList.toArray(new String[inputList.size()]),driver);
-            //走平常诊断治疗
-//            Map<String, Filnlly> mulDiseaseTreat = neo4jAPI.getMulDiseaseTreat_2(diseaseName,webDiag, diseaseType, diseaseSet,disUE,ue,String.join(",", inputList));
-//            Map<String, Filnlly> mulDiseaseTreat_new = neo4jAPI.getMulDiseaseTreat_new(diseaseName,webDiag, diseaseType, diseaseSet,disUE,ue,String.join(",", inputList),crisisDetails);
-//            System.out.println("推送治疗消耗:"+(System.currentTimeMillis()-starttime)+"s");
             responseData.setTreat(treat);
         }
         //管理评估(慢病才有)
@@ -161,6 +161,7 @@ public class GraphCalculate {
                     idns.addAll(idn);
                 }
             }
+//            newindSet1 = mergerIndex(newindSet1, mergeMap);
             if(newindSet1 != null && newindSet1.size()>0){
                 for (String ind:newindSet1
                      ) {
@@ -189,6 +190,96 @@ public class GraphCalculate {
         return responseData;
     }
 
+   private CrisisDetail getShenGong(List<MedicalIndication> medicalIndications){
+       CrisisDetail crisisDetail = new CrisisDetail();
+       if(medicalIndications != null && medicalIndications.size()>0){
+           for (MedicalIndication m:medicalIndications) {
+               String name = m.getName();
+               if("肾功能不全".equals(name)){
+                   List<MedicalIndicationDetail> details = m.getDetails();
+                   if(details != null && details.size()>0){
+                       for (MedicalIndicationDetail med:details) {
+                           Integer type = med.getType();
+                           if(type == 2){
+                               JSONObject content = med.getContent();
+                               if(content!= null){
+                                   List<JSONObject> results = (List<JSONObject>) content.get("result");
+                                   if(results != null && results.size()>0){
+                                       for (JSONObject j:results) {
+                                           String pr = j.getString("评估结论");
+                                           if(StringUtils.isNotEmpty(pr)){
+                                               if("重度肾功能不全".equals(pr)){
+                                                   pr = "肾功能不全:重度";
+                                               }else if("中度肾功能不全".equals(pr)){
+                                                   pr = "肾功能不全:中度";
+                                               }else if("轻度肾功能不全".equals(pr)){
+                                                   pr = "肾功能不全:轻度";
+                                               }else if("肾功能正常".equals(pr)){
+                                                   pr = "肾功能:正常";
+                                               }
+                                               crisisDetail.setRemindText(pr);
+                                               crisisDetail.setTypeId("4");
+
+                                           }
+
+                                       }
+                                   }
+                               }
+                           }
+                       }
+                   }
+               }
+           }
+       }
+
+       return crisisDetail;
+   }
+    /**
+     * 合并指标
+     * @param newindSet
+     * @return
+     */
+    private Set<String> mergerIndex(Set<String> newindSet,Map<String,List<String>> merge){
+        Set<String> newindSetResult = new HashSet<>();
+        Map<String, List<String>> mergeInit = mergeInit(merge);
+        if(newindSet != null && newindSet.size()>0){
+            for (Map.Entry<String, List<String>> ds:mergeInit.entrySet()) {
+                String key = ds.getKey();
+                List<String> values = ds.getValue();
+                if(newindSet.contains(key)){
+                    Iterator<String> iterator = newindSet.iterator();
+                    while (iterator.hasNext()){
+                        String next = iterator.next();
+                        // values   ["2型糖尿病","1型糖尿病","成人迟发性自身免疫糖尿病"]
+                        // newindSet ["糖尿病","糖尿病足"]
+                        if(values.contains(next)){
+                            newindSetResult.add(next);
+                        }else {
+                            if(!mergeInit.containsKey(next)){
+
+                            }
+                        }
+
+                    }
+                }
+
+            }
+
+        }
+        return newindSetResult;
+    }
+    private Map<String,List<String>> mergeInit(Map<String,List<String>> merge){
+        if(merge == null){
+            merge = new HashMap<>();
+            List<String> otherIn = new ArrayList<>();
+            otherIn.add("2型糖尿病");
+            otherIn.add("1型糖尿病");
+            otherIn.add("成人迟发性自身免疫糖尿病");
+            merge.put("糖尿病",otherIn);
+        }
+        return merge;
+    }
+
     private Set<String> getQueNiDiagnose(Map<String, Object> condition) {
         Set<String> diseaseSet =new HashSet<>();
         if(condition != null){