|
@@ -754,6 +754,7 @@ public class Neo4jAPI {
|
|
|
return diseaseCondition;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 不良反应推送
|
|
|
*/
|
|
@@ -1114,18 +1115,19 @@ public class Neo4jAPI {
|
|
|
|
|
|
/**
|
|
|
* 获取每个慢病对应的不良反应
|
|
|
+ *
|
|
|
* @param webDiagArray
|
|
|
* @param diseaseType
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String,List<String>> getDisUE(String[] webDiagArray,Integer diseaseType){
|
|
|
+ public Map<String, List<String>> getDisUE(String[] webDiagArray, Integer diseaseType) {
|
|
|
Session session = null;
|
|
|
- Map<String,List<String>> disUE = new HashMap<>();
|
|
|
+ Map<String, List<String>> disUE = new HashMap<>();
|
|
|
List<String> webDiagList = new ArrayList<>();
|
|
|
- if(diseaseType != null && 1 == diseaseType){
|
|
|
- for (String dis:webDiagArray) {
|
|
|
- if(!"".equals(dis)){
|
|
|
- webDiagList.add("\""+dis+"\"");
|
|
|
+ if (diseaseType != null && 1 == diseaseType) {
|
|
|
+ for (String dis : webDiagArray) {
|
|
|
+ if (!"".equals(dis)) {
|
|
|
+ webDiagList.add("\"" + dis + "\"");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1135,18 +1137,18 @@ public class Neo4jAPI {
|
|
|
public Integer execute(Transaction tx) {
|
|
|
StatementResult result = null;
|
|
|
String query = "";
|
|
|
- query = "match(d:Disease)-[r:不良反应]->(u:UntowardEffect) where d.name in "+webDiagList+" \n" +
|
|
|
+ query = "match(d:Disease)-[r:不良反应]->(u:UntowardEffect) where d.name in " + webDiagList + " \n" +
|
|
|
"return d.name as dis,collect(u.name) as ueCollect";
|
|
|
result = tx.run(query);
|
|
|
- while (result.hasNext()){
|
|
|
+ while (result.hasNext()) {
|
|
|
Record next = result.next();
|
|
|
String dis = next.get("dis").toString().replace("\"", "");
|
|
|
List<Object> stringList = next.get("ueCollect").asList();
|
|
|
List<String> ueList = new ArrayList<>();
|
|
|
- for (Object o:stringList) {
|
|
|
- ueList.add(o.toString().replace("\"",""));
|
|
|
+ for (Object o : stringList) {
|
|
|
+ ueList.add(o.toString().replace("\"", ""));
|
|
|
}
|
|
|
- disUE.put(dis,ueList);
|
|
|
+ disUE.put(dis, ueList);
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
@@ -1154,6 +1156,7 @@ public class Neo4jAPI {
|
|
|
CloseSession(session);
|
|
|
return disUE;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 第二版治疗方案
|
|
|
*
|
|
@@ -1161,7 +1164,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,Map<String, List<String>> disUE,Set<String> ueSet, String filds) {
|
|
|
+ public Map<String, Filnlly> getMulDiseaseTreat_2(String disease, Integer diseaseType, Set<String> disSet, Map<String, List<String>> disUE, Set<String> ueSet, String filds) {
|
|
|
Map<String, Filnlly> diagTreat = new HashMap<>();
|
|
|
Session session = null;
|
|
|
NumberFormat nf = NumberFormat.getPercentInstance();
|
|
@@ -1183,7 +1186,7 @@ public class Neo4jAPI {
|
|
|
for (String yizhen : disSet) {
|
|
|
fildsList.add("\'" + yizhen + "\'");
|
|
|
}
|
|
|
- for (String h:ueSet) {
|
|
|
+ for (String h : ueSet) {
|
|
|
fildsList.add("\'" + h + "\'");
|
|
|
}
|
|
|
for (int j = 0; j < diseaseList.size(); j++) {
|
|
@@ -1369,8 +1372,8 @@ public class Neo4jAPI {
|
|
|
//显示不良反应
|
|
|
if (diseaseType != null && 1 == diseaseType) {
|
|
|
List<String> stringList = disUE.get(diseaseName);
|
|
|
- logger.info(diseaseName+"下面有"+stringList+"不良反应");
|
|
|
- if(stringList !=null && stringList.size()>0){
|
|
|
+ logger.info(diseaseName + "下面有" + stringList + "不良反应");
|
|
|
+ if (stringList != null && stringList.size() > 0) {
|
|
|
List<Indicators> indicatorsList1 = new ArrayList<>();
|
|
|
Indicators indicators1 = getAdverse(ueSet, "低血糖反应");
|
|
|
logger.info(disSet + "包含 低血糖反应");
|
|
@@ -1442,7 +1445,7 @@ public class Neo4jAPI {
|
|
|
String value = next1.get("value").toString();
|
|
|
String uint = next1.get("uint").toString();
|
|
|
String details = next1.get("details").toString();
|
|
|
-// System.out.println(sort1+"\t"+conten+"\t"+sort2+"\t"+item+"\t"+controlType+"\t"+value+"\t"+uint+"\t"+details);
|
|
|
+ // System.out.println(sort1+"\t"+conten+"\t"+sort2+"\t"+item+"\t"+controlType+"\t"+value+"\t"+uint+"\t"+details);
|
|
|
if (1 == sort1) {
|
|
|
if (medicalIndicationDetail1 == null) {
|
|
|
medicalIndicationDetail1 = new MedicalIndicationDetail();
|
|
@@ -1572,9 +1575,9 @@ public class Neo4jAPI {
|
|
|
result = session.run(query);
|
|
|
while (result.hasNext()) {
|
|
|
Record next = result.next();
|
|
|
- String eff = next.get("eff").toString().replace("\"","");//血压控制情况
|
|
|
- String res = next.get("res").toString().replace("\"","");//正常
|
|
|
-// System.out.println(eff + "\t" + res);
|
|
|
+ String eff = next.get("eff").toString().replace("\"", "");//血压控制情况
|
|
|
+ String res = next.get("res").toString().replace("\"", "");//正常
|
|
|
+ // System.out.println(eff + "\t" + res);
|
|
|
if (effCollect.keySet().contains(eff)) {
|
|
|
if (!effCollect.get(eff).contains(res)) {
|
|
|
LinkedList<String> strings = effCollect.get(eff);
|
|
@@ -1607,7 +1610,7 @@ public class Neo4jAPI {
|
|
|
|
|
|
if (bloodPressure.get("name").equals("血脂控制情况")) {
|
|
|
List<JSONObject> details = (List<JSONObject>) bloodPressure.get("details");
|
|
|
- Map<String,String> idnRes = new HashMap<>();
|
|
|
+ Map<String, String> idnRes = new HashMap<>();
|
|
|
//化验计算
|
|
|
String query1 = "match(e:Effect)-[r:指标]->(l:LIS)-[r1:计算结果]->(k:Result) where e.name='血脂控制情况'\n" +
|
|
|
"return l.name as name,r1.between as between ,k.name as res";
|
|
@@ -1624,49 +1627,49 @@ public class Neo4jAPI {
|
|
|
if (lis_Result.keySet().contains(name)) {
|
|
|
Double aDouble = lis_Result.get(name);
|
|
|
if (min < aDouble && aDouble <= max) {
|
|
|
- idnRes.put(res1,"血脂控制情况");
|
|
|
+ idnRes.put(res1, "血脂控制情况");
|
|
|
} else {
|
|
|
- idnRes.put("","血脂控制情况");
|
|
|
+ idnRes.put("", "血脂控制情况");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
Collection<String> values = idnRes.keySet();
|
|
|
List<String> newValues = new ArrayList<>();
|
|
|
- if(values.contains("重度")){
|
|
|
+ if (values.contains("重度")) {
|
|
|
newValues.clear();
|
|
|
newValues.add("重度");
|
|
|
- }else if(!values.contains("重度") && values.contains("中度")){
|
|
|
+ } else if (!values.contains("重度") && values.contains("中度")) {
|
|
|
newValues.clear();
|
|
|
newValues.add("中度");
|
|
|
- }else if(!values.contains("重度") && !values.contains("中度") && values.contains("轻度")){
|
|
|
+ } else if (!values.contains("重度") && !values.contains("中度") && values.contains("轻度")) {
|
|
|
newValues.clear();
|
|
|
newValues.add("轻度");
|
|
|
- }else if(!values.contains("重度") && !values.contains("中度") && !values.contains("轻度") && values.contains("正常")){
|
|
|
+ } else if (!values.contains("重度") && !values.contains("中度") && !values.contains("轻度") && values.contains("正常")) {
|
|
|
newValues.clear();
|
|
|
newValues.add("正常");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
newValues.clear();
|
|
|
newValues.add("");
|
|
|
}
|
|
|
- for (String s:newValues) {
|
|
|
- int i =0;
|
|
|
- if(!"".equals(s)){
|
|
|
- for (i =0;i<details.size();i++) {
|
|
|
+ for (String s : newValues) {
|
|
|
+ int i = 0;
|
|
|
+ if (!"".equals(s)) {
|
|
|
+ for (i = 0; i < details.size(); i++) {
|
|
|
String detailName = (String) details.get(i).get("detailName");
|
|
|
- if(detailName.equals(s)){
|
|
|
+ if (detailName.equals(s)) {
|
|
|
details.remove(i);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
JSONObject k = new JSONObject();
|
|
|
k.put("detailName", s);
|
|
|
- k.put("state",1);
|
|
|
-// details.add(k);
|
|
|
- details.add(i,k);
|
|
|
+ k.put("state", 1);
|
|
|
+ // details.add(k);
|
|
|
+ details.add(i, k);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- bloodPressure.put("details",details);
|
|
|
+ bloodPressure.put("details", details);
|
|
|
}
|
|
|
itemJson.add(bloodPressure);
|
|
|
}
|
|
@@ -1678,7 +1681,7 @@ public class Neo4jAPI {
|
|
|
bigGrad.put("name", "糖尿病控制情况");
|
|
|
bigGrad.put("controltype", 0);
|
|
|
List<JSONObject> gradItemJ = new ArrayList<>();
|
|
|
- String[] gradItem = {"常规管理", "强化管理"};
|
|
|
+ String[] gradItem = { "常规管理", "强化管理" };
|
|
|
for (String item : gradItem) {
|
|
|
JSONObject j = new JSONObject();
|
|
|
j.put("detailName", item);
|
|
@@ -1748,7 +1751,7 @@ public class Neo4jAPI {
|
|
|
public Map<String, List> getPushBack(String diseaseName, int sign) {
|
|
|
// Map<String, String> labelMap = new HashMap<>();
|
|
|
HashMap<String, List> backMap = new HashMap<>();
|
|
|
- String[] label = {"Symptom", "Vital", "LIS", "PACS", "History"};
|
|
|
+ String[] label = { "Symptom", "Vital", "LIS", "PACS", "History" };
|
|
|
Session session = null;
|
|
|
StatementResult result = null;
|
|
|
String query = "";
|
|
@@ -2129,20 +2132,20 @@ public class Neo4jAPI {
|
|
|
* @param scaleName
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, Object> getScale(String scaleName) {
|
|
|
+ public Map<String, Object> getScale(String[] scaleItems,String scaleName) {
|
|
|
Session session = driver.session(AccessMode.READ);
|
|
|
StatementResult Rset;
|
|
|
- scaleName = scaleName.toUpperCase();
|
|
|
+
|
|
|
Map<String, Object> scale = new LinkedHashMap<>();
|
|
|
|
|
|
try {
|
|
|
String query = "match (m:Scale) WHERE m.name=~'.*" + scaleName + ".*' return m.type";
|
|
|
Rset = session.run(query);
|
|
|
String type = Rset.next().get("m.type").toString().replace("\"", "");
|
|
|
- if ("NoCalc".equals(type)) {
|
|
|
- scale = this.getScaleNoCalc(scaleName);
|
|
|
+ if (Integer.valueOf(type) == 1) {
|
|
|
+ scale = this.getScaleCalc2(scaleItems,scaleName);
|
|
|
} else {
|
|
|
- scale = this.getScaleCalc(scaleName);
|
|
|
+ scale = this.getScaleNoCalc(scaleName);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -2607,118 +2610,89 @@ public class Neo4jAPI {
|
|
|
* @param scaleName
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, Object> getScaleNoCalc(String scaleName) {
|
|
|
+ public JSONObject getScaleNoCalc(String scaleName) {
|
|
|
Session session = driver.session(AccessMode.READ);
|
|
|
- StatementResult Rset1 = null;
|
|
|
- StatementResult Rset2 = null;
|
|
|
+ StatementResult Rset = null;
|
|
|
Record rec;
|
|
|
- scaleName = scaleName.toUpperCase();
|
|
|
-
|
|
|
- Map<String, Object> fourLevelItems = new LinkedHashMap<>();
|
|
|
- Map<String, Object> threeLevelItems = new LinkedHashMap<>();
|
|
|
- Map<String, Object> twoLevelItems = new LinkedHashMap<>();
|
|
|
- Map<Object, Object> firstLevelItems = new LinkedHashMap<>();
|
|
|
+ //scaleName = scaleName.toUpperCase();
|
|
|
|
|
|
+ JSONObject scaleStructure = new JSONObject();
|
|
|
+ JSONArray rows = new JSONArray();
|
|
|
+ JSONObject row = new JSONObject();
|
|
|
try {
|
|
|
- String query1 = "match (m:Scale)-[r1]->(n1) where m.name=~'.*" + scaleName + ".*' " +
|
|
|
- "return m.name,r1.grade,n1.name order by r1.grade,toInt(r1.p)";
|
|
|
-
|
|
|
- String query2 = "match (m:Scale)-[r1]->(n1)-[r2]->(n2) where m.name=~'.*" + scaleName + ".*' " +
|
|
|
- "return m.name,r1.grade,n1.name,r2.stage,n2.name order by r1.grade,r2.stage,toInt(r1.p)";
|
|
|
- writeLog(query1);
|
|
|
- Rset1 = session.run(query1);
|
|
|
- Rset2 = session.run(query2);
|
|
|
- writeLog(query2);
|
|
|
-
|
|
|
- String scale = "";
|
|
|
- String grade = "";
|
|
|
- String gradeName = "";
|
|
|
- String stage = "";
|
|
|
- String stageName = "";
|
|
|
-
|
|
|
- while (Rset1.hasNext()) {
|
|
|
- rec = Rset1.next();
|
|
|
- scale = rec.get("m.name").toString().replace("\"", "");
|
|
|
- grade = rec.get("r1.grade").toString().replace("\"", "");
|
|
|
- gradeName = rec.get("n1.name").toString().replace("\"", "");
|
|
|
-
|
|
|
- firstLevelItems.put(gradeName, grade);
|
|
|
- fourLevelItems.put(scale, firstLevelItems);
|
|
|
+ String query = "match (m:Scale)-[r1]->(n1)-[r2]->(n2)-[r3]->(n3) WHERE m.name=~'.*" + scaleName + ".*' " +
|
|
|
+ "return m.name,m.calc,m.type,n1.name,n1.indexId,n1.required,n1.controlType,n2.name,n3.name " +
|
|
|
+ "order by toInt(r1.p),toInt(r2.p),toInt(r3.p)";
|
|
|
|
|
|
- }
|
|
|
+ Rset = session.run(query);
|
|
|
|
|
|
- while (Rset2.hasNext()) {
|
|
|
- rec = Rset2.next();
|
|
|
- scale = rec.get("m.name").toString().replace("\"", "");
|
|
|
- grade = rec.get("r1.grade").toString().replace("\"", "");
|
|
|
- gradeName = rec.get("n1.name").toString().replace("\"", "");
|
|
|
- stage = rec.get("r2.stage").toString().replace("\"", "");
|
|
|
- stageName = rec.get("n2.name").toString().replace("\"", "");
|
|
|
-
|
|
|
- if (!threeLevelItems.containsKey(gradeName)) {
|
|
|
- firstLevelItems = new LinkedHashMap<>();
|
|
|
- twoLevelItems = new LinkedHashMap<>();
|
|
|
+ String calc = "";
|
|
|
+ String type = "";
|
|
|
+ String index = "";
|
|
|
+ String indexId = "";
|
|
|
+ String required = "";
|
|
|
+ String controlType = "";
|
|
|
+ String feature = "";
|
|
|
+ String result = "";
|
|
|
+ while (Rset.hasNext()) {
|
|
|
+ rec = Rset.next();
|
|
|
+ scaleName = rec.get("m.name").toString().replace("\"", "");
|
|
|
+ calc = rec.get("m.calc").toString().replace("\"", "");
|
|
|
+ type = rec.get("m.type").toString().replace("\"", "");
|
|
|
+ index = rec.get("n1.name").toString().replaceAll("(\"|_)", "");
|
|
|
+ indexId = rec.get("n1.indexId").toString().replace("\"", "");
|
|
|
+ required = rec.get("n1.required").toString().replace("\"", "");
|
|
|
+ controlType = rec.get("n1.controlType").toString().replace("\"", "");
|
|
|
+ feature = rec.get("n2.name").toString().replace("\"", "");
|
|
|
+ result = rec.get("n3.name").toString().replace("\"", "");
|
|
|
+
|
|
|
+ if (!scaleStructure.containsKey("scaleType")) {
|
|
|
+ scaleStructure.put("scaleType", Integer.valueOf(type));
|
|
|
+ }
|
|
|
+ if (!scaleStructure.containsKey("Calc")) {
|
|
|
+ scaleStructure.put("Calc", Integer.valueOf(calc));
|
|
|
}
|
|
|
- if (!twoLevelItems.containsKey(grade)) {
|
|
|
- firstLevelItems = new LinkedHashMap<>();
|
|
|
+ if (!scaleStructure.containsKey("scaleName")) {
|
|
|
+ scaleStructure.put("scaleName", scaleName);
|
|
|
+ }
|
|
|
+
|
|
|
+ JSONObject detail = new JSONObject();
|
|
|
+ detail.put("detailName", feature);
|
|
|
+ detail.put("state", 0);
|
|
|
+ detail.put("result", result);
|
|
|
+ if (scaleStructure.containsKey("rows")) {
|
|
|
+ JSONArray rowsList = scaleStructure.getJSONArray("rows");
|
|
|
+ if (index.equals(rowsList.getJSONObject(rowsList.size() - 1).getString("name"))) {
|
|
|
+ rowsList.getJSONObject(rowsList.size() - 1).getJSONArray("details").add(detail);
|
|
|
+ } else {
|
|
|
+ row = new JSONObject();
|
|
|
+ JSONArray details = new JSONArray();
|
|
|
+ details.add(detail);
|
|
|
+ row.put("name", index);
|
|
|
+ row.put("indexId", Integer.valueOf(indexId));
|
|
|
+ row.put("required", Integer.valueOf(required));
|
|
|
+ row.put("controlType", Integer.valueOf(controlType));
|
|
|
+ row.put("details", details);
|
|
|
+ rowsList.add(row);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ JSONArray details = new JSONArray();
|
|
|
+ details.add(detail);
|
|
|
+ row.put("name", index);
|
|
|
+ row.put("indexId", Integer.valueOf(indexId));
|
|
|
+ row.put("required", Integer.valueOf(required));
|
|
|
+ row.put("controlType", Integer.valueOf(controlType));
|
|
|
+ row.put("details", details);
|
|
|
+ rows.add(row);
|
|
|
+ scaleStructure.put("rows", rows);
|
|
|
}
|
|
|
- firstLevelItems.put(stageName, stage);
|
|
|
- twoLevelItems.put(grade, firstLevelItems);
|
|
|
- threeLevelItems.put(gradeName, twoLevelItems);
|
|
|
- fourLevelItems.put(scale, threeLevelItems);
|
|
|
}
|
|
|
} catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
System.out.println("返回不带得分不需要计算的量表出了问题!---->getScaleNoCalc");
|
|
|
} finally {
|
|
|
CloseSession(session);
|
|
|
- return fourLevelItems;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /*public Map<String, Object> scaleScoreCalc(String[] scaleItems, String scaleName) {
|
|
|
-
|
|
|
- int sum = 0;
|
|
|
- String final_result = null;
|
|
|
- Map<String, Object> scaleCalc = getScaleCalc2(scaleName);
|
|
|
- for (String scaleItem : scaleItems) {
|
|
|
- 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;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- System.out.println(sum);
|
|
|
- Map<String, Object> calculate = (Map<String, Object>) scaleCalc.get("calculate");
|
|
|
- List<Map<String, String>> range = (List<Map<String, String>>) calculate.get("range");
|
|
|
- for (Map<String, String> range_map : range) {
|
|
|
- Integer min = Integer.valueOf(range_map.get("min"));
|
|
|
- Integer max = Integer.valueOf(range_map.get("max"));
|
|
|
- String text = range_map.get("text");
|
|
|
- if (sum >= min && sum <= max) {
|
|
|
- final_result = text;
|
|
|
- break;
|
|
|
- }
|
|
|
+ return scaleStructure;
|
|
|
}
|
|
|
- Map<String, String> result = (Map<String, String>) calculate.get("result");
|
|
|
- result.put("score", String.valueOf(sum));
|
|
|
- result.put("text", final_result);
|
|
|
- return scaleCalc;
|
|
|
}
|
|
|
- */
|
|
|
-
|
|
|
}
|