Selaa lähdekoodia

Revert "不良反应修改"

This reverts commit ec16b95
kongwz 6 vuotta sitten
vanhempi
commit
77c27325e8

+ 9 - 0
common-service/src/main/java/org/diagbot/common/work/ResponseData.java

@@ -26,6 +26,15 @@ public class ResponseData {
     private List<MedicalIndication> medicalIndications;//量表和指标推送
 //    private Map<String,JSONObject> managementEvaluation; //管理评估
     private Map managementEvaluation;
+    private List<String> diffDiag;//鉴别诊断
+
+    public List<String> getDiffDiag() {
+        return diffDiag;
+    }
+
+    public void setDiffDiag(List<String> diffDiag) {
+        this.diffDiag = diffDiag;
+    }
 
     public Map getManagementEvaluation() {
         return managementEvaluation;

+ 199 - 0
graph-web/src/main/java/org/diagbot/graphWeb/work/GraphCalculate.java

@@ -52,6 +52,7 @@ public class GraphCalculate {
         Map<String, Map<String,String>> condition = neo4jAPI.getCondition((String[]) inputList.toArray(new String[inputList.size()]),webDiag );
         List<FeatureRate> featureRates = new ArrayList<>();
         for (Map.Entry<String, Map<String,String>> d : condition.entrySet()) {
+            if (!"低血糖反应".equals(d.getKey()) && !"胃肠道不良反应".equals(d.getKey())) {
                 FeatureRate featureRate = new FeatureRate();
                 featureRate.setFeatureName(d.getKey());
                 featureRate.setExtraProperty("");
@@ -60,6 +61,7 @@ public class GraphCalculate {
                 featureRate.setDesc(s);
                 featureRate.setRate("neo4j");
                 featureRates.add(featureRate);
+            }
         }
         Set<String> diseaseSet = condition.keySet();
         logger.info("diseaseSet :" + diseaseSet);
@@ -77,6 +79,13 @@ public class GraphCalculate {
             }
         }
         logger.info("页面导入的所有化验项为 :" +lisSet);
+        //鉴别诊断
+        /*if(webDiag != null && webDiag.trim() != ""){
+            String[] webDiagSplits = webDiag.split(",");
+            String mainDiag = webDiagSplits[0];
+            List<String> differentialDiagnose = neo4jAPI.getDifferentialDiagnose(mainDiag);
+            responseData.setDiffDiag(differentialDiagnose);
+        }*/
         //走治疗
         if (webDiag.trim() != null && webDiag.trim() != "" && featureTypeList.contains("8")) {
             // 查找页面诊断里是否有不良反应
@@ -97,6 +106,9 @@ public class GraphCalculate {
                 Map<String, JSONObject> mangementEvaluation1 = mangementEvaluation.getMangementEvaluation();
                 responseData.setManagementEvaluation(mangementEvaluation1);
             }
+//            MangementEvaluation mangementEvaluation = this.getMangementEvaluation();
+//            Map<String, JSONObject> mangementEvaluation1 = mangementEvaluation.getMangementEvaluation();
+//            responseData.setManagementEvaluation(mangementEvaluation1);
         }
         int age = searchData.getAge();
         String sex = searchData.getSex();
@@ -105,8 +117,15 @@ public class GraphCalculate {
             //查找指标
             Set<String> indSet = neo4jAPI.getInd((String[]) inputList.toArray(new String[inputList.size()]));
             logger.info("featureTypeList 包含22,走指标推送!!!,图谱推出的指标为:" + indSet);
+            /*List<MedicalIndication> medicalIndicationList = new ArrayList<>();
+            MedicalIndication medicalIndication = this.getMedicalIndication(indSet,age,sex);
+            if (medicalIndication != null) {
+                medicalIndicationList.add(medicalIndication);
+            }
+            responseData.setMedicalIndications(medicalIndicationList);*/
             List<MedicalIndication> idn = neo4jAPI.getIdn(indSet, age, sex);
             responseData.setMedicalIndications(idn);
+
         }
         //诊断推送
         responseData.setDis(featureRates);
@@ -252,6 +271,186 @@ public class GraphCalculate {
         return sortedMap;
     }
 
+    /**
+     * 量表和指标
+     *
+     * @param idnSet
+     * @return
+     */
+    public MedicalIndication getMedicalIndication(Set idnSet,Integer age,String sex) throws Exception {
+        MedicalIndication medicalIndication = new MedicalIndication();
+        if (idnSet.contains("肾功能不全")) {
+            logger.info("diseaseSet中包含肾功能不全");
+            //推送指标
+            medicalIndication.setName("肾功能不全");
+            List<MedicalIndicationDetail> medicalIndicationDetailList = new ArrayList<>();
+            //量表
+            MedicalIndicationDetail medicalIndicationDetail1 = new MedicalIndicationDetail();
+            medicalIndicationDetail1.setType(1);
+            JSONObject liangJson = new JSONObject();
+            liangJson.put("name", "密西根糖尿病周围神经病评分(MDNS)");
+            medicalIndicationDetail1.setContent(liangJson);
+            //公式
+            MedicalIndicationDetail medicalIndicationDetail2 = new MedicalIndicationDetail();
+            medicalIndicationDetail2.setType(2);
+            JSONObject gongshiJson = new JSONObject();
+            gongshiJson.put("name", "肾小球滤过率");
+            List<JSONObject> detailList = new ArrayList<>();
+            JSONObject ageJsonObject = new JSONObject();
+            ageJsonObject.put("controlType", 2);
+            ageJsonObject.put("name", "年龄");
+            ageJsonObject.put("value", age);
+            ageJsonObject.put("uint", "");
+            ageJsonObject.put("details", new ArrayList<>());
+            JSONObject indicationJsonObject = new JSONObject();
+            indicationJsonObject.put("controlType", 2);
+            indicationJsonObject.put("name", "血肌酐");
+            indicationJsonObject.put("value", "");
+            indicationJsonObject.put("uint", "mg/dL");
+            indicationJsonObject.put("details", new ArrayList<>());
+            JSONObject sexJson = new JSONObject();
+            sexJson.put("controlType", 1);
+            sexJson.put("name", "性别");
+            sexJson.put("value", "");
+            sexJson.put("uint", "");
+            List<JSONObject> sexList = new ArrayList<>();
+            JSONObject manJson = new JSONObject();
+            manJson.put("detailName", "男");
+            manJson.put("value", 1);
+            manJson.put("state", 0);
+            if("M".equals(sex)){
+                manJson.put("state", 1);
+            }
+            JSONObject womanJson = new JSONObject();
+            womanJson.put("detailName", "女");
+            womanJson.put("value", 1.018);
+            womanJson.put("state", 0);
+            if("F".equals(sex)){
+                womanJson.put("state", 1);
+            }
+            sexList.add(manJson);
+            sexList.add(womanJson);
+            sexJson.put("details", sexList);
+            detailList.add(ageJsonObject);
+            detailList.add(indicationJsonObject);
+            detailList.add(sexJson);
+            gongshiJson.put("details", detailList);
+            medicalIndicationDetail2.setContent(gongshiJson);
+            //其他
+            MedicalIndicationDetail medicalIndicationDetail3 = new MedicalIndicationDetail();
+            medicalIndicationDetail3.setType(3);
+            JSONObject shiFouJson = new JSONObject();
+            shiFouJson.put("name", "是否");
+            shiFouJson.put("controlType", 0);
+            List<JSONObject> shiFouList = new ArrayList<>();
+            JSONObject shiJsonObject = new JSONObject();
+            shiJsonObject.put("detailName", "是");
+            shiJsonObject.put("state", 1);
+            JSONObject fouJsonObject = new JSONObject();
+            fouJsonObject.put("detailName", "否");
+            fouJsonObject.put("state", 0);
+            shiFouList.add(shiJsonObject);
+            shiFouList.add(fouJsonObject);
+            shiFouJson.put("details", shiFouList);
+            medicalIndicationDetail3.setContent(shiFouJson);
+            medicalIndicationDetailList.add(medicalIndicationDetail1);
+            //Map<String, Object> maps = scaleCalcMethod(medicalIndicationDetail2);
+            JSONObject resultJson = new JSONObject();
+            JSONArray resultList = new JSONArray();
+            JSONObject result = new JSONObject();
+            result.put("text", "");
+            result.put("name", "GFR值");
+            resultList.add(result);
+            result = new JSONObject();
+            result.put("text", "");
+            result.put("name", "评估结论");
+            resultList.add(result);
+            gongshiJson.put("result", resultList);
+            medicalIndicationDetail2.setContent(gongshiJson);
+            medicalIndicationDetailList.add(medicalIndicationDetail2);
+            medicalIndicationDetailList.add(medicalIndicationDetail3);
+            medicalIndication.setDetails(medicalIndicationDetailList);
+        } else {
+            medicalIndication = null;
+        }
+        return medicalIndication;
+    }
+
+    /**
+     * 管理评估
+     *
+     * @return
+     */
+    public MangementEvaluation getMangementEvaluation() {
+        MangementEvaluation mangementEvaluation = new MangementEvaluation();
+        Map<String, JSONObject> mangementMap = new HashMap<>();
+        JSONObject curativeJson = new JSONObject();
+        List<JSONObject> itemJson = new ArrayList<>();
+        JSONObject bloodPressure = new JSONObject();
+        bloodPressure.put("controltype", 0);
+        bloodPressure.put("name", "血压控制情况");
+        List<JSONObject> bloodPressureLevelList = new ArrayList<>();
+        String[] items = { "正常", "1级", "2级", "3级" };
+        for (String item : items) {
+            JSONObject iJson = new JSONObject();
+            iJson.put("detailName", item);
+            iJson.put("state", 0);
+            bloodPressureLevelList.add(iJson);
+        }
+        bloodPressure.put("details", bloodPressureLevelList);
+        itemJson.add(bloodPressure);
+
+        JSONObject bmiControl = new JSONObject();
+        bmiControl.put("controltype", 0);
+        bmiControl.put("name", "BMI控制情况");
+        List<JSONObject> bmiControlLevelList = new ArrayList<>();
+        String[] bmiControlitems = { "体重过低", "体重达标", "肥胖前期", "肥胖" };
+        for (String item : bmiControlitems) {
+            JSONObject iJson = new JSONObject();
+            iJson.put("detailName", item);
+            iJson.put("state", 0);
+            bmiControlLevelList.add(iJson);
+        }
+        bmiControl.put("details", bmiControlLevelList);
+        itemJson.add(bmiControl);
+
+        JSONObject bloodFatControl = new JSONObject();
+        bloodFatControl.put("controltype", 0);
+        bloodFatControl.put("name", "血脂控制情况");
+        List<JSONObject> bloodFatControlLevelList = new ArrayList<>();
+        String[] bloodFatControlitems = { "高血脂" };
+        for (String item : bloodFatControlitems) {
+            JSONObject iJson = new JSONObject();
+            iJson.put("detailName", item);
+            iJson.put("state", 0);
+            bloodFatControlLevelList.add(iJson);
+        }
+        bloodFatControl.put("details", bmiControlLevelList);
+        itemJson.add(bloodFatControl);
+        curativeJson.put("rows", itemJson);
+        //分级管理
+        JSONObject gradeJson = new JSONObject();
+        List<JSONObject> gradItemJson = new ArrayList<>();
+        JSONObject bigGrad = new JSONObject();
+        bigGrad.put("name", "血压控制情况");
+        bigGrad.put("controltype", 0);
+        List<JSONObject> gradItemJ = new ArrayList<>();
+        String[] gradItem = { "常规管理", "强化管理" };
+        for (String item : gradItem) {
+            JSONObject j = new JSONObject();
+            j.put("detailName", item);
+            j.put("state", 0);
+            gradItemJ.add(j);
+        }
+        bigGrad.put("details", gradItemJ);
+        gradItemJson.add(bigGrad);
+        gradeJson.put("rows", gradItemJson);
+        mangementMap.put("疗效评估", curativeJson);
+        mangementMap.put("糖尿病分级管理", gradeJson);
+        mangementEvaluation.setMangementEvaluation(mangementMap);
+        return mangementEvaluation;
+    }
+
     public Map<String, Object> scaleCalcMethod(MedicalIndicationDetail medicalIndicationDetail) throws Exception {
         Map<String, Object> scaleCalcResult = new HashMap<>();
         Integer type = medicalIndicationDetail.getType();

+ 34 - 8
graph/src/main/java/org/diagbot/graph/jdbc/Neo4jAPI.java

@@ -770,6 +770,37 @@ public class Neo4jAPI {
         }
     }
 
+    /**
+     * 鉴别诊断
+     * @param mainDiag
+     * @return
+     */
+    public List<String> getDifferentialDiagnose(String mainDiag){
+        List<String> differentialDiagnoseList = new LinkedList<>();
+        Session session = null;
+        StatementResult result = null;
+        String query = "";
+        try {
+            session = driver.session(AccessMode.WRITE);
+            logger.info("session 为: " + session);
+            query = propertiesUtil.getProperty("searchDifferentialDiagnose").replace("mainDis", mainDiag);
+            result = session.run(query);
+            while (result.hasNext()) {
+                Record record = result.next();
+                List<Object> coll = record.get("coll").asList();
+                if(coll != null && coll.size()>0){
+                    for (Object o:coll) {
+                        differentialDiagnoseList.add(o.toString().replace("\"",""));
+                    }
+                }
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+        }finally {
+            CloseSession(session);
+            return differentialDiagnoseList;
+        }
+    }
     /**
      * 不良反应推送
      */
@@ -1390,19 +1421,13 @@ public class Neo4jAPI {
                             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);
-                              /*  Indicators indicators1 = getAdverse(ueSet, "低血糖反应");
+                                Indicators indicators1 = getAdverse(ueSet, "低血糖反应");
                                 logger.info(disSet + "包含  低血糖反应");
                                 Indicators indicators2 = getAdverse(ueSet, "胃肠道不良反应");
                                 logger.info(disSet + "包含  胃肠道不良反应");
                                 indicatorsList1.add(indicators1);
                                 indicatorsList1.add(indicators2);
-                                filnlly.setAdverseEvent(indicatorsList1);*/
+                                filnlly.setAdverseEvent(indicatorsList1);
                             }
                         }
                         filnlly.setTreatment(drugsList);
@@ -1415,6 +1440,7 @@ public class Neo4jAPI {
             e.printStackTrace();
         } finally {
             CloseSession(session);
+            //            driver.close();
             return diagTreat;
         }
     }

+ 1 - 0
push-web/src/main/java/org/diagbot/push/controller/AlgorithmController.java

@@ -96,6 +96,7 @@ public class AlgorithmController extends BaseController {
             logger.info("合并知识图谱、大数据后推送的诊断信息....: " + fr.getFeatureName());
         }
         searchData.setPushDiags(pushDiags);
+//        bigDataResponseData.setDiffDiag(graphResponseData.getDiffDiag());
 
         bigDataResponseData.setTreat(graphResponseData.getTreat());
         //量表和指标推送