|
@@ -1,7 +1,6 @@
|
|
|
package org.diagbot.graphWeb.work;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import org.diagbot.common.work.FeatureRate;
|
|
|
import org.diagbot.common.javabean.Filnlly;
|
|
|
import org.diagbot.common.work.ResponseData;
|
|
@@ -11,6 +10,9 @@ import org.diagbot.graph.jdbc.Neo4jAPI;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.*;
|
|
|
+
|
|
|
+import org.diagbot.common.javabean.MedicalIndication;
|
|
|
+import org.diagbot.common.javabean.MedicalIndicationDetail;
|
|
|
import org.diagbot.graphWeb.util.MapValueComparator;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -33,25 +35,6 @@ public class GraphCalculate {
|
|
|
Set<String> ss = inputs.keySet();
|
|
|
inputList.addAll(ss);
|
|
|
Neo4jAPI neo4jAPI = new Neo4jAPI(DriverManager.newDrive());
|
|
|
- //处理化验数据
|
|
|
- /* if(searchData.getLisArr().size()!=0){
|
|
|
- JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(searchData.getLisArr()));
|
|
|
- List<String> lisResult = neo4jAPI.AnalysisLISResult(jsonArray);
|
|
|
- inputList.addAll(lisResult);
|
|
|
- }*/
|
|
|
- //计算提出的词,是否在图谱中找到
|
|
|
- List<String> grapWords = neo4jAPI.getGrapWords((String[]) inputList.toArray(new String[inputList.size()]));
|
|
|
- List<FeatureRate> graphWordfeatureRates = new ArrayList<>();
|
|
|
- if(grapWords.size()>0){
|
|
|
- for (String word: grapWords ) {
|
|
|
- FeatureRate featureRate = new FeatureRate();
|
|
|
- featureRate.setFeatureName(word.replaceAll("\"",""));
|
|
|
- featureRate.setExtraProperty("");
|
|
|
- featureRate.setDesc("");
|
|
|
- featureRate.setRate("");
|
|
|
- graphWordfeatureRates.add(featureRate);
|
|
|
- }
|
|
|
- }
|
|
|
//计算诊断
|
|
|
Map<String, String> condition = neo4jAPI.getCondition((String[]) inputList.toArray(new String[inputList.size()]));
|
|
|
List<FeatureRate> featureRates = new ArrayList<>();
|
|
@@ -60,7 +43,8 @@ public class GraphCalculate {
|
|
|
FeatureRate featureRate = new FeatureRate();
|
|
|
featureRate.setFeatureName(d.getKey());
|
|
|
featureRate.setExtraProperty("");
|
|
|
- if("低血糖反应".equals(d.getKey()) || "胃肠道不良反应".equals(d.getKey())){
|
|
|
+ if("低血糖反应".equals(d.getKey()) || "胃肠道不良反应".equals(d.getKey())
|
|
|
+ || "肾功能不全".equals(d.getKey())){
|
|
|
featureRate.setDesc("不良反应");
|
|
|
featureRate.setRate("治疗影响");
|
|
|
}else {
|
|
@@ -69,7 +53,6 @@ public class GraphCalculate {
|
|
|
}
|
|
|
featureRates.add(featureRate);
|
|
|
}
|
|
|
-
|
|
|
String webDiag = searchData.getDiag();
|
|
|
Set<String> diseaseSet = condition.keySet();
|
|
|
Integer diseaseType = searchData.getDisType();
|
|
@@ -79,8 +62,10 @@ public class GraphCalculate {
|
|
|
Map<String, Filnlly> mulDiseaseTreat = neo4jAPI.getMulDiseaseTreat_2(webDiag,diseaseType,diseaseSet,String.join(",", inputList));
|
|
|
responseData.setTreat(mulDiseaseTreat);
|
|
|
}
|
|
|
-
|
|
|
-// responseData.setGraphWords(graphWordfeatureRates);
|
|
|
+ List<MedicalIndication> medicalIndicationList = new ArrayList<>();
|
|
|
+ MedicalIndication medicalIndication = this.getMedicalIndication(diseaseSet);
|
|
|
+ medicalIndicationList.add(medicalIndication);
|
|
|
+ responseData.setMedicalIndications(medicalIndicationList);
|
|
|
responseData.setDis(featureRates);
|
|
|
responseData.setInputs(searchData.getInputs());
|
|
|
return responseData;
|
|
@@ -226,4 +211,85 @@ public class GraphCalculate {
|
|
|
}
|
|
|
return sortedMap;
|
|
|
}
|
|
|
+
|
|
|
+ public MedicalIndication getMedicalIndication(Set diseaseSet){
|
|
|
+ MedicalIndication medicalIndication = new MedicalIndication();
|
|
|
+ if(diseaseSet.contains("肾功能不全")){
|
|
|
+ //推送指标
|
|
|
+ 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","20");
|
|
|
+ ageJsonObject.put("uint","");
|
|
|
+ ageJsonObject.put("details",new ArrayList<>());
|
|
|
+ JSONObject indicationJsonObject = new JSONObject();
|
|
|
+ indicationJsonObject.put("controlType",2);
|
|
|
+ indicationJsonObject.put("name","血肌酐");
|
|
|
+ indicationJsonObject.put("value","2.26");
|
|
|
+ indicationJsonObject.put("uint","mg/dL");
|
|
|
+ indicationJsonObject.put("details",new ArrayList<>());
|
|
|
+ JSONObject sexJson = new JSONObject();
|
|
|
+ sexJson.put("controlType",3);
|
|
|
+ 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);
|
|
|
+ JSONObject womanJson = new JSONObject();
|
|
|
+ womanJson.put("detailName","女");
|
|
|
+ womanJson.put("value",1.018);
|
|
|
+ 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);
|
|
|
+ JSONObject resultJson = new JSONObject();
|
|
|
+ resultJson.put("value",10);
|
|
|
+ resultJson.put("unit","ml/min•1.73m2");
|
|
|
+ resultJson.put("text","肾功能衰竭");
|
|
|
+ gongshiJson.put("result",resultJson);
|
|
|
+ medicalIndicationDetail2.setContent(gongshiJson);
|
|
|
+ //其他
|
|
|
+ MedicalIndicationDetail medicalIndicationDetail3 = new MedicalIndicationDetail();
|
|
|
+ medicalIndicationDetail3.setType(3);
|
|
|
+ JSONObject shiFouJson = new JSONObject();
|
|
|
+ shiFouJson.put("controlType",0);
|
|
|
+ List<JSONObject> shiFouList = new ArrayList<>();
|
|
|
+ JSONObject shiJsonObject = new JSONObject();
|
|
|
+ shiJsonObject.put("detailName","是");
|
|
|
+ shiJsonObject.put("state",0);
|
|
|
+ JSONObject fouJsonObject = new JSONObject();
|
|
|
+ fouJsonObject.put("detailName","否");
|
|
|
+ fouJsonObject.put("state",1);
|
|
|
+ shiFouList.add(shiJsonObject);
|
|
|
+ shiFouList.add(fouJsonObject);
|
|
|
+ shiFouJson.put("details",shiFouList);
|
|
|
+ medicalIndicationDetail3.setContent(shiFouJson);
|
|
|
+ medicalIndicationDetailList.add(medicalIndicationDetail1);
|
|
|
+ medicalIndicationDetailList.add(medicalIndicationDetail2);
|
|
|
+ medicalIndicationDetailList.add(medicalIndicationDetail3);
|
|
|
+ medicalIndication.setDetails(medicalIndicationDetailList);
|
|
|
+ }
|
|
|
+ return medicalIndication;
|
|
|
+ }
|
|
|
}
|