Selaa lähdekoodia

Merge branch 'master' of http://223.93.170.82:10080/louhr/push into his/shaoyifu

# Conflicts:
#	common-push/src/main/java/org/diagbot/common/push/cache/CacheFileManager.java
#	graph/src/main/resources/bolt.properties
#	graphdb/src/main/resources/application.yml
lipc 5 vuotta sitten
vanhempi
commit
347332ccf8

+ 1 - 1
common-push/src/main/java/org/diagbot/common/push/cache/CacheFileManager.java

@@ -397,7 +397,7 @@ public class CacheFileManager {
         }
     }
 
-    private List<Map.Entry<String, String>> rsToMap(ResultSet rs, boolean isJoin) throws SQLException{
+    private List<Map.Entry<String, String>> rsToMap(ResultSet rs, boolean isJoin) throws SQLException {
         String r1 = "";
         String r2 = "";
         Map<String, String> libraryMap = new HashMap<>(10);

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

@@ -154,16 +154,57 @@ public class GraphCalculate {
         String pacsOrder = searchData.getPacsOrder();
         //指标推送
         if (featureTypeList.contains("22") ) {
-            List<MedicalIndication> pacsMi = getPacsMi(pacsOrder, inputList,webDiag);
+            List<MedicalIndication> idns =new ArrayList<>();
+//            List<MedicalIndication> pacsMi = getPacsMi(pacsOrder, inputList,webDiag);
+            Set<String> newindSet = new HashSet<>();
+            Set<String> newindSet1 = new HashSet<>();
             //查找指标
             Set<String> indSet = neo4jAPI.getInd((String[]) inputList.toArray(new String[inputList.size()]));
+            if(indSet != null && indSet.size()>0){
+                for (String ind:indSet) {
+                    if("肾功能不全".equals(ind)){
+                        newindSet.add(ind);
+                    }else {
+                        newindSet1.add(ind);
+                    }
+                }
+            }
+
+
+            Map<String, String> indLiang =null;
+            if(newindSet1 != null && newindSet1.size()>0){
+                indLiang =neo4jAPI.getIndLiang(newindSet1);
+
+            }
             logger.info("featureTypeList 包含22,走指标推送!!!,图谱推出的指标为:" + indSet);
-            if(indSet.contains("肾功能不全")){
-                List<MedicalIndication> idn = neo4jAPI.getIdn(indSet, age, sex);
-                pacsMi.addAll(idn);
-                responseData.setMedicalIndications(pacsMi);
+            List<MedicalIndication> idn =null;
+            if(newindSet.contains("肾功能不全")){
+                idn = neo4jAPI.getIdn(newindSet, age, sex);
+                if(idn!= null && idn.size()>0){
+                    idns.addAll(idn);
+                }
+            }
+            if(newindSet1 != null && newindSet1.size()>0){
+                for (String ind:newindSet1
+                     ) {
+                    MedicalIndication medicalIndication= new MedicalIndication();
+                    medicalIndication.setName(ind);
+                    List<MedicalIndicationDetail> ds = new ArrayList<>();
+                    MedicalIndicationDetail medicalIndicationDetail = new MedicalIndicationDetail();
+                    medicalIndicationDetail.setType(1);
+                    JSONObject jsonObject = new JSONObject();
+                    if(indLiang != null){
+                        jsonObject.put("name",indLiang.get(ind)); 
+                    }
+                    
+                    medicalIndicationDetail.setContent(jsonObject);
+                    ds.add(medicalIndicationDetail);
+                    medicalIndication.setDetails(ds);
+                    idns.add(medicalIndication);
+
+                }
             }
-            responseData.setMedicalIndications(pacsMi);
+            responseData.setMedicalIndications(idns);
 
         }
 

+ 18 - 1
graph/src/main/java/org/diagbot/graph/jdbc/Neo4jAPI.java

@@ -1794,7 +1794,24 @@ public class Neo4jAPI {
         CloseSession(session);
         return medicalIndicationList;
     }
-
+   public Map<String,String> getIndLiang(Set<String> inds){
+       Map<String,String> kk = new HashMap<>();
+       String query = "";
+       Session session = null;
+       StatementResult result = null;
+       for (String ind:inds){
+           query = "match(i:Indicators)-[r:内容]->(c:Content) where i.name=\""+ind+"\" return c.name as name";
+           session = driver.session(AccessMode.WRITE);
+           result = session.run(query);
+           while (result.hasNext()) {
+               Record next1 = result.next();
+               String name = next1.get("name").toString();
+               kk.put(ind,name.replace("\"",""));
+           }
+       }
+       CloseSession(session);
+       return kk;
+   }
     public MangementEvaluation pushMe(String[] webDiagsplits, Map<String, Double> lis_Result) {
         MangementEvaluation mangementEvaluation = new MangementEvaluation();
         Map<String, JSONObject> mangementMap = new HashMap<>();

+ 2 - 2
nlp-web/src/main/java/org/diagbot/nlp/controller/FeatureController.java

@@ -84,7 +84,7 @@ public class FeatureController extends BaseController<Feature, FeatureWrapper, L
             for (int i = 0; i < properties.length; i++) {
                 if (NlpUtil.isFeature(properties[i], new NegativeEnum[]{NegativeEnum.SYMPTOM})) {
                     Map<String, String> map = new HashMap<>();
-                    map.put("conceptId", conceptIds[i]);
+//                    map.put("conceptId", conceptIds[i]);
                     map.put("name", lexeme.getText());
                     map.put("libType", NegativeEnum.SYMPTOM.toString());
                     map.put("chronicLabel", "0");
@@ -93,7 +93,7 @@ public class FeatureController extends BaseController<Feature, FeatureWrapper, L
                 if (NlpUtil.isFeature(properties[i], new NegativeEnum[]{NegativeEnum.DISEASE})) {
                     if ("慢病".equals(classifies.get(lexeme.getText()))) {
                         Map<String, String> map = new HashMap<>();
-                        map.put("conceptId", conceptIds[i]);
+//                        map.put("conceptId", conceptIds[i]);
                         map.put("name", lexeme.getText());
                         map.put("libType", NegativeEnum.DISEASE.toString());
                         map.put("chronicLabel", "0");

+ 15 - 9
nlp/src/main/java/org/diagbot/nlp/relation/analyze/StructureAnalyze.java

@@ -430,6 +430,7 @@ public class StructureAnalyze {
                     break;
                 case Constants.word_property_diagnose:
                 case Constants.word_property_med:
+                case Constants.word_property_med_com:
                 case Constants.word_property_treat:
                     current = updateClinicalInfo(outputInfo, lexeme.getText(), lexeme.getProperty());
                     updated = true;
@@ -603,12 +604,12 @@ public class StructureAnalyze {
                 Cause cause = new Cause();
                 cause.setCauseName(name);
 
-//                if (current instanceof Symptom) {
-//                    symptom = (Symptom)current;
-//                }
-//                else {
+                if (current instanceof Symptom) {
+                    symptom = (Symptom)current;
+                }
+                else {
                     symptom = outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1);
-//                }
+                }
 
                 if (symptom.getCause() != null) {
                     if (!outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1).getSymptomName().equals(symptom.getSymptomName())) {
@@ -635,10 +636,14 @@ public class StructureAnalyze {
 //                    symptom = outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1);
                 }
 
-                else if (symptom.getDegree() != null) {
-                    if (!outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1).getSymptomName().equals(symptom.getSymptomName())) {
-                        outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1).setSymptomName(symptom.getSymptomName());
-                        symptom = outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1);
+                else if (current instanceof Symptom) {
+                    symptom = (Symptom)current;
+
+                    if (symptom.getDegree() != null) {
+                        if (!outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1).getSymptomName().equals(symptom.getSymptomName())) {
+                            outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1).setSymptomName(symptom.getSymptomName());
+                            symptom = outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1);
+                        }
                     }
                     symptom.setDegree(degree);
 
@@ -698,6 +703,7 @@ public class StructureAnalyze {
                 }
                 break;
             case Constants.word_property_med:
+            case Constants.word_property_med_com:
                 if (current_treat instanceof Past || current instanceof Past) {
                     if (current_treat instanceof Past) {
                         past = (Past) current_treat;