|
@@ -34,6 +34,7 @@ public class GraphCalculate {
|
|
|
}
|
|
|
}
|
|
|
private static Neo4jAPI neo4jAPI ;
|
|
|
+ private static Map<String,List<String>> mergeMap;
|
|
|
|
|
|
/**
|
|
|
* 返回诊断和治疗
|
|
@@ -51,14 +52,14 @@ public class GraphCalculate {
|
|
|
List<String> inputList = new ArrayList<>();
|
|
|
int age = searchData.getAge();
|
|
|
String sex = searchData.getSex();
|
|
|
- String diseaseName = searchData.getDiseaseName();
|
|
|
- String webDiag = searchData.getDiag();
|
|
|
- logger.info("页面诊断为 :"+webDiag);
|
|
|
- String[] webDiagList = webDiag.split(",|,|、|;|:|;");
|
|
|
+ String diseaseName = "";
|
|
|
+ if (searchData.getDiseaseName() != null) {
|
|
|
+ diseaseName = searchData.getDiseaseName().getUniqueName();
|
|
|
+ }
|
|
|
logger.info("前端传来的年龄为 :"+age+" 前端传来的性别为 :"+sex);
|
|
|
Map<String, Map<String, String>> sexAgeCache = CacheUtil.getSexAgeCache();
|
|
|
Map<String, Map<String, String>> inputs = searchData.getGraphInputs();
|
|
|
- List<String> exculdDiagFilds = this.exculdDiagFilds(inputs,webDiagList,diseaseName);
|
|
|
+ List<String> exculdDiagFilds = this.exculdDiagFilds(inputs);
|
|
|
//从大数据解析分词
|
|
|
Set<String> ss = processParticiple(inputs);
|
|
|
logger.info("从分词系统接收到的词 :" + ss);
|
|
@@ -71,9 +72,21 @@ public class GraphCalculate {
|
|
|
neo4jAPI = new Neo4jAPI(driver);
|
|
|
}
|
|
|
logger.info("图谱开始推送诊断!!!!!!!!!!!");
|
|
|
+ String webDiag = "";
|
|
|
+ if(searchData.getDiagOrder() !=null){
|
|
|
+ for (PreResult preResult : searchData.getDiagOrder()) {
|
|
|
+ if (StringUtils.isEmpty(webDiag)) {
|
|
|
+ webDiag = preResult.getValue();
|
|
|
+ } else {
|
|
|
+ webDiag = webDiag + "," + preResult.getValue();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ logger.info("页面诊断为 :"+webDiag);
|
|
|
+ String[] webDiagList = webDiag.split(",|,|、|;|:|;");
|
|
|
//处理血肌酐
|
|
|
- List<PreResult> lisArr = searchData.getLisArr();
|
|
|
+ List<PreResult> lisArr = searchData.getLis();
|
|
|
String serumCreatinine = processSerumcreatinine(lisArr);
|
|
|
|
|
|
//计算诊断
|
|
@@ -99,12 +112,6 @@ public class GraphCalculate {
|
|
|
if (StringUtils.isNotEmpty(diseaseName) && featureTypeList.contains(Constants.feature_type_treat)) {
|
|
|
PushTreat pushTreat = new PushTreat();
|
|
|
Treat treat = pushTreat.processTreat(diseaseName,webDiag,diseaseType, driver, (String[]) inputList.toArray(new String[inputList.size()]),exculdDiagFilds, crisisDetails);
|
|
|
-// Map<String, List<String>> disUE = pushTreat.getDisUE(diseaseName,1,driver);
|
|
|
-// Map<String,String> ue = pushTreat.getUe((String[]) inputList.toArray(new String[inputList.size()]),driver);
|
|
|
- //走平常诊断治疗
|
|
|
-// Map<String, Filnlly> mulDiseaseTreat = neo4jAPI.getMulDiseaseTreat_2(diseaseName,webDiag, diseaseType, diseaseSet,disUE,ue,String.join(",", inputList));
|
|
|
-// Map<String, Filnlly> mulDiseaseTreat_new = neo4jAPI.getMulDiseaseTreat_new(diseaseName,webDiag, diseaseType, diseaseSet,disUE,ue,String.join(",", inputList),crisisDetails);
|
|
|
-// System.out.println("推送治疗消耗:"+(System.currentTimeMillis()-starttime)+"s");
|
|
|
responseData.setTreat(treat);
|
|
|
}
|
|
|
//管理评估(慢病才有)
|
|
@@ -149,9 +156,10 @@ public class GraphCalculate {
|
|
|
idns.addAll(idn);
|
|
|
}
|
|
|
}
|
|
|
+ newindSet1 = mergerIndex(newindSet1, mergeMap);
|
|
|
if(newindSet1 != null && newindSet1.size()>0){
|
|
|
for (String ind:newindSet1
|
|
|
- ) {
|
|
|
+ ) {
|
|
|
MedicalIndication medicalIndication= new MedicalIndication();
|
|
|
medicalIndication.setName(ind);
|
|
|
List<MedicalIndicationDetail> ds = new ArrayList<>();
|
|
@@ -159,7 +167,7 @@ public class GraphCalculate {
|
|
|
medicalIndicationDetail.setType(1);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if(indLiang != null){
|
|
|
- jsonObject.put("name",indLiang.get(ind));
|
|
|
+ jsonObject.put("name",indLiang.get(ind));
|
|
|
}
|
|
|
medicalIndicationDetail.setContent(jsonObject);
|
|
|
ds.add(medicalIndicationDetail);
|
|
@@ -177,6 +185,69 @@ public class GraphCalculate {
|
|
|
return responseData;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 合并指标
|
|
|
+ * @param newindSet
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Set<String> mergerIndex(Set<String> newindSet,Map<String,List<String>> merge){
|
|
|
+ Map<String,List<String>> disColl = new HashMap<>();
|
|
|
+ Set<String> newindSetResult = new HashSet<>();
|
|
|
+ Map<String, List<String>> mergeInit = mergeInit(merge);
|
|
|
+ if(newindSet != null && newindSet.size()>0){
|
|
|
+ for (Map.Entry<String, List<String>> ds:mergeInit.entrySet()) {
|
|
|
+ String key = ds.getKey();
|
|
|
+ if(newindSet.contains(key)){
|
|
|
+ Iterator<String> iterator = newindSet.iterator();
|
|
|
+ while (iterator.hasNext()){
|
|
|
+ String next = iterator.next();
|
|
|
+ // values ["2型糖尿病","1型糖尿病","成人迟发性自身免疫糖尿病"]
|
|
|
+ // newindSet ["糖尿病","糖尿病足"]
|
|
|
+ if(key.equals(next)){
|
|
|
+ List<String> disList = new ArrayList<>();
|
|
|
+ for (String dis:newindSet) {
|
|
|
+ if(!dis.equals(key)){
|
|
|
+ disList.add(dis);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ disColl.put(key,disList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(disColl != null && disColl.size()>0){
|
|
|
+ for (Map.Entry<String,List<String>> disList:disColl.entrySet()) {
|
|
|
+ String key1 = disList.getKey();
|
|
|
+ List<String> value = disList.getValue();
|
|
|
+ if(value.size() == 0){
|
|
|
+ newindSetResult.add(key1);
|
|
|
+ }else {
|
|
|
+ for (String dis:value
|
|
|
+ ) {
|
|
|
+ if(!dis.equals(key1)){
|
|
|
+ newindSetResult.add(dis);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ newindSetResult = newindSet;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return newindSetResult;
|
|
|
+ }
|
|
|
+ private Map<String,List<String>> mergeInit(Map<String,List<String>> merge){
|
|
|
+ if(merge == null){
|
|
|
+ merge = new HashMap<>();
|
|
|
+ List<String> otherIn = new ArrayList<>();
|
|
|
+ otherIn.add("2型糖尿病");
|
|
|
+ otherIn.add("1型糖尿病");
|
|
|
+ otherIn.add("成人迟发性自身免疫糖尿病");
|
|
|
+ merge.put("糖尿病",otherIn);
|
|
|
+ }
|
|
|
+ return merge;
|
|
|
+ }
|
|
|
+
|
|
|
private Set<String> getQueNiDiagnose(Map<String, Object> condition) {
|
|
|
Set<String> diseaseSet =new HashSet<>();
|
|
|
if(condition != null){
|
|
@@ -270,11 +341,10 @@ public class GraphCalculate {
|
|
|
}
|
|
|
return sc;
|
|
|
}
|
|
|
- private List<String> exculdDiagFilds(Map<String, Map<String, String>> inputs,String[] webDiagList,String disName){
|
|
|
+ private List<String> exculdDiagFilds(Map<String, Map<String, String>> inputs){
|
|
|
List<String> exculdDiagFilds = new ArrayList<>();
|
|
|
- String fildName ="";
|
|
|
if(inputs != null && inputs.size()>0){
|
|
|
-
|
|
|
+ String fildName ="";
|
|
|
for (Map.Entry<String, Map<String, String>> fild:inputs.entrySet()) {
|
|
|
fildName = fild.getKey();
|
|
|
Map<String, String> value = fild.getValue();
|
|
@@ -290,22 +360,6 @@ public class GraphCalculate {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- try{
|
|
|
- if(webDiagList!=null && webDiagList.length>0){
|
|
|
- for (String wd:webDiagList) {
|
|
|
- if(wd != null && !disName.equals(wd)){
|
|
|
- fildName = "'"+wd+"'";
|
|
|
- if(!exculdDiagFilds.contains(fildName)){
|
|
|
- exculdDiagFilds.add(fildName);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
return exculdDiagFilds;
|
|
|
}
|
|
|
}
|