|
@@ -42,7 +42,9 @@ public class Neo4jAPI {
|
|
|
public Neo4jAPI(Driver driver) {
|
|
|
this.driver = driver;
|
|
|
}
|
|
|
-
|
|
|
+// public Neo4jAPI() {
|
|
|
+//
|
|
|
+// }
|
|
|
/**
|
|
|
* 获取所有标签名称
|
|
|
*
|
|
@@ -652,12 +654,13 @@ public class Neo4jAPI {
|
|
|
for (String fild : keys) {
|
|
|
fildList.add("\"" + fild.trim() + "\"");
|
|
|
}
|
|
|
- logger.info("根据 " + fildList + " 这些词推送图谱诊断!!!");
|
|
|
+ logger.info("根据 "+fildList+" 这些词推送图谱诊断!!!");
|
|
|
Session session = null;
|
|
|
StatementResult result = null;
|
|
|
String query = "";
|
|
|
try {
|
|
|
session = driver.session(AccessMode.WRITE);
|
|
|
+ logger.info("session 为: "+session);
|
|
|
//第一步查询是否有组合的词
|
|
|
query = propertiesUtil.getProperty("searchCollection").replace("fildList", fildList.toString());
|
|
|
result = session.run(query);
|
|
@@ -732,7 +735,7 @@ public class Neo4jAPI {
|
|
|
Map<String, String> dis_res = new HashMap<>();
|
|
|
dis_res.put("确诊", "");
|
|
|
diseaseCondition.put(qu, JSON.toJSONString(dis_res));
|
|
|
- logger.info("图谱推出的诊断为: " + qu);
|
|
|
+ logger.info("图谱推出的诊断为: "+qu);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -966,7 +969,7 @@ public class Neo4jAPI {
|
|
|
* @param filds // * @param sign 标志,2是平常诊断的治疗,0是复诊诊断的治疗,1是急诊
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, Filnlly> getMulDiseaseTreat_2(String disease, Integer diseaseType, Set<String> disSet, String filds) {
|
|
|
+ public Map<String, Filnlly> getMulDiseaseTreat_2(String disease,Integer diseaseType,Set<String> disSet, String filds) {
|
|
|
Map<String, Filnlly> diagTreat = new HashMap<>();
|
|
|
Session session = null;
|
|
|
NumberFormat nf = NumberFormat.getPercentInstance();
|
|
@@ -985,7 +988,7 @@ public class Neo4jAPI {
|
|
|
for (String fild : fildsArray) {
|
|
|
fildsList.add("\'" + fild + "\'");
|
|
|
}
|
|
|
- for (String yizhen : disSet) {
|
|
|
+ for (String yizhen:disSet) {
|
|
|
fildsList.add("\'" + yizhen + "\'");
|
|
|
}
|
|
|
for (int j = 0; j < diseaseList.size(); j++) {
|
|
@@ -1161,7 +1164,7 @@ public class Neo4jAPI {
|
|
|
}
|
|
|
Filnlly filnlly = new Filnlly();
|
|
|
//显示不良反应
|
|
|
- if (diseaseType != null && 1 == diseaseType) {
|
|
|
+ if(diseaseType !=null && 1 == diseaseType){
|
|
|
List<Indicators> indicatorsList1 = new ArrayList<>();
|
|
|
Indicators indicators1 = getAdverse(disSet, "低血糖反应");
|
|
|
Indicators indicators2 = getAdverse(disSet, "胃肠道不良反应");
|
|
@@ -1179,11 +1182,11 @@ public class Neo4jAPI {
|
|
|
e.printStackTrace();
|
|
|
} finally {
|
|
|
CloseSession(session);
|
|
|
+// driver.close();
|
|
|
return diagTreat;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- public Indicators getAdverse(Set<String> dis, String name) {
|
|
|
+ public Indicators getAdverse(Set<String> dis,String name){
|
|
|
List<Detail> detailList1 = new ArrayList<>();
|
|
|
Indicators indicators1 = new Indicators();
|
|
|
indicators1.setName(name);
|
|
@@ -1194,7 +1197,7 @@ public class Neo4jAPI {
|
|
|
Detail detail2 = new Detail();
|
|
|
detail2.setName("是");
|
|
|
detail2.setValue(0);
|
|
|
- if (dis.contains(name)) {
|
|
|
+ if(dis.contains(name)){
|
|
|
detail2.setValue(1);
|
|
|
}
|
|
|
Detail detail3 = new Detail();
|
|
@@ -1222,7 +1225,6 @@ public class Neo4jAPI {
|
|
|
indicators1.setDetails(detailList1);
|
|
|
return indicators1;
|
|
|
}
|
|
|
-
|
|
|
/**
|
|
|
* 倒推实现
|
|
|
*
|
|
@@ -1807,7 +1809,6 @@ public class Neo4jAPI {
|
|
|
|
|
|
/**
|
|
|
* 获取量表
|
|
|
- *
|
|
|
* @param scaleName
|
|
|
* @return
|
|
|
*/
|
|
@@ -2089,34 +2090,24 @@ public class Neo4jAPI {
|
|
|
String final_result = null;
|
|
|
Map<String, Object> scaleCalc = getScaleCalc2(scaleName);
|
|
|
for (String scaleItem : scaleItems) {
|
|
|
- List<Map<String, Object>> groupList = (List<Map<String, Object>>) scaleCalc.get("group");
|
|
|
- for (Map<String, Object> groupMap : groupList) {
|
|
|
- int groupSum = 0;
|
|
|
- JSONArray rowList = new JSONArray();
|
|
|
- //获取name
|
|
|
- rowList = JSONArray.parseArray(JSONObject.parseObject(groupMap.get("rows").toString()).get("row").toString());
|
|
|
- for (int i = 0; i < rowList.size(); i++) {
|
|
|
- Map<String, Object> map = (Map<String, Object>) rowList.get(i);
|
|
|
- String name = map.get("name").toString();
|
|
|
- if (scaleItem.contains(name) || name.contains(scaleItem)) {
|
|
|
- List<Map<String, Object>> sub_detail = (List<Map<String, Object>>) map.get("details");
|
|
|
- for (Map<String, Object> sub_map : sub_detail) {
|
|
|
- String detailName = sub_map.get("detailName").toString();
|
|
|
- String score = sub_map.get("score").toString();
|
|
|
- if (scaleItem.contains(detailName)) {
|
|
|
- groupSum += Double.valueOf(score);
|
|
|
- sum += Double.valueOf(score);
|
|
|
- sub_map.put("state", 1);
|
|
|
- JSONObject details = new JSONObject();
|
|
|
- details.put(sub_map);
|
|
|
- }
|
|
|
+ Object details = scaleCalc.get("rows");
|
|
|
+ //获取name
|
|
|
+ List<Map<String, Object>> content = (List<Map<String, Object>>) details;
|
|
|
+ for (Map<String, Object> map : content) {
|
|
|
+ String name = map.get("name").toString();
|
|
|
+ if (scaleItem.contains(name) || name.contains(scaleItem)) {
|
|
|
+ List<Map<String, Object>> sub_detail = (List<Map<String, Object>>) map.get("details");
|
|
|
+ for (Map<String, Object> sub_map : sub_detail) {
|
|
|
+ String detailName = sub_map.get("detailName").toString();
|
|
|
+ String score = sub_map.get("score").toString();
|
|
|
+ if (scaleItem.contains(detailName)) {
|
|
|
+ sum += Double.valueOf(score);
|
|
|
+ sub_map.put("state", "1");
|
|
|
}
|
|
|
- } else {
|
|
|
- continue;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
}
|
|
|
- Map<String, Object> groupCalculate = (Map<String, Object>) groupMap.get("groupCalculate");
|
|
|
- groupCalculate.put("score", String.valueOf(groupSum));
|
|
|
}
|
|
|
}
|
|
|
System.out.println(sum);
|
|
@@ -2141,4 +2132,65 @@ public class Neo4jAPI {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
return map;
|
|
|
}
|
|
|
+
|
|
|
+ public String scaleCalcMethod(String[] scaleItems, String scaleName) {
|
|
|
+ String result = null;
|
|
|
+ Map<String, Object> calcMap = calcMethod();
|
|
|
+ List<Map<String, Object>> calcTypes = (List<Map<String, Object>>) calcMap.get("details");
|
|
|
+ for (Map<String, Object> calcType : calcTypes) {
|
|
|
+ switch ((int) calcType.get("type")) {
|
|
|
+ case 1:
|
|
|
+ result = scaleScoreCalc(scaleItems, scaleName).get("text").toString();
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ Map<String, Object> content = (Map<String, Object>) calcType.get("content");
|
|
|
+ List<Map<String, Object>> details = (List<Map<String, Object>>) content.get("details");
|
|
|
+ int age = 0;
|
|
|
+// double scr = 0.00;
|
|
|
+ double scr = 2.2621;
|
|
|
+ float k = 0.0f;
|
|
|
+ double a = 0.00;
|
|
|
+ double denger = 0.00;
|
|
|
+ for (Map<String, Object> detailsMap : details) {
|
|
|
+ if ("年龄".equals(detailsMap.get("name").toString())) {
|
|
|
+ age = (int) detailsMap.get("value");
|
|
|
+ } else if ("血肌酐".equals(detailsMap.get("name").toString())) {
|
|
|
+ if ("umol/L".equals(detailsMap.get("uint"))) {
|
|
|
+ scr = (double) detailsMap.get("value") * 88.41;
|
|
|
+ } else {
|
|
|
+ scr = (double) detailsMap.get("value");
|
|
|
+ }
|
|
|
+ } else if ("性别".equals(detailsMap.get("name").toString())) {
|
|
|
+ List<Map<String, Object>> genderDetails = (List<Map<String, Object>>) detailsMap.get("details");
|
|
|
+ for (Map<String, Object> genderDetail : genderDetails) {
|
|
|
+ if ("男".equals(genderDetail.get("detailName").toString())) {
|
|
|
+ k = 0.9f;
|
|
|
+ denger = (double) genderDetail.get("value");
|
|
|
+ if (scr <= 0.90) {
|
|
|
+ a = -0.411;
|
|
|
+ } else {
|
|
|
+ a = -1.209;
|
|
|
+ }
|
|
|
+ } else if ("女".equals(genderDetail.get("detailName").toString())) {
|
|
|
+ k = 0.7f;
|
|
|
+ denger = (double) genderDetail.get("value");
|
|
|
+ if (scr <= 0.70) {
|
|
|
+ a = -0.329;
|
|
|
+ } else {
|
|
|
+ a = -1.209;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ age = 20;
|
|
|
+ double eGFR3 = 141 * Math.pow((scr / k), a) * Math.pow(0.993, age) * denger;
|
|
|
+ System.out.println(eGFR3);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
}
|