|
@@ -36,6 +36,10 @@ public class GraphCalculate {
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
public ResponseData calculate(HttpServletRequest request, SearchData searchData) throws Exception {
|
|
public ResponseData calculate(HttpServletRequest request, SearchData searchData) throws Exception {
|
|
|
|
+
|
|
|
|
+ long starttime = System.currentTimeMillis();
|
|
|
|
+ System.out.println("Start at: " + starttime);
|
|
|
|
+
|
|
ResponseData responseData = new ResponseData();
|
|
ResponseData responseData = new ResponseData();
|
|
// ParamsDataProxy paramsDataProxy = new ParamsDataProxy();
|
|
// ParamsDataProxy paramsDataProxy = new ParamsDataProxy();
|
|
// paramsDataProxy.createSearchData(request, searchData);
|
|
// paramsDataProxy.createSearchData(request, searchData);
|
|
@@ -44,7 +48,7 @@ public class GraphCalculate {
|
|
String sex = searchData.getSex();
|
|
String sex = searchData.getSex();
|
|
logger.info("前端传来的年龄为 :"+age+" 前端传来的性别为 :"+sex);
|
|
logger.info("前端传来的年龄为 :"+age+" 前端传来的性别为 :"+sex);
|
|
//获取缓存
|
|
//获取缓存
|
|
- Map<String, String> lexionCache = CacheUtil.getLexionCache();
|
|
|
|
|
|
+// Map<String, String> lexionCache = CacheUtil.getLexionCache();
|
|
Map<String, Map<String, String>> sexAgeCache = CacheUtil.getSexAgeCache();
|
|
Map<String, Map<String, String>> sexAgeCache = CacheUtil.getSexAgeCache();
|
|
Map<String, Map<String, String>> inputs = searchData.getGraphInputs();
|
|
Map<String, Map<String, String>> inputs = searchData.getGraphInputs();
|
|
Set<String> ss = new HashSet<>();
|
|
Set<String> ss = new HashSet<>();
|
|
@@ -59,6 +63,8 @@ public class GraphCalculate {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
logger.info("从分词系统接收到的词 :" + ss);
|
|
logger.info("从分词系统接收到的词 :" + ss);
|
|
|
|
+ System.out.println("Participle takes: " + (System.currentTimeMillis()-starttime)/1000d + 's');
|
|
|
|
+
|
|
String[] featureTypes = searchData.getFeatureType().split(",");
|
|
String[] featureTypes = searchData.getFeatureType().split(",");
|
|
List<String> featureTypeList = Arrays.asList(featureTypes);
|
|
List<String> featureTypeList = Arrays.asList(featureTypes);
|
|
logger.info("featureTypeList : " + featureTypeList);
|
|
logger.info("featureTypeList : " + featureTypeList);
|
|
@@ -71,9 +77,15 @@ public class GraphCalculate {
|
|
logger.info("页面诊断为 :"+webDiag);
|
|
logger.info("页面诊断为 :"+webDiag);
|
|
//计算诊断
|
|
//计算诊断
|
|
Map<String, Map<String,String>> condition =null;
|
|
Map<String, Map<String,String>> condition =null;
|
|
|
|
+ Map<String, Map<String, String>> excludelist = null;
|
|
if(featureTypeList.contains("2")){
|
|
if(featureTypeList.contains("2")){
|
|
condition = neo4jAPI.getNewCondition((String[]) inputList.toArray(new String[inputList.size()]),webDiag );
|
|
condition = neo4jAPI.getNewCondition((String[]) inputList.toArray(new String[inputList.size()]),webDiag );
|
|
|
|
+
|
|
|
|
+ // 查找需要排除的诊断
|
|
|
|
+ excludelist = neo4jAPI.getExcludeDiag(inputList);
|
|
|
|
+ responseData.setExcludeDiag(Arrays.asList(excludelist.keySet().stream().toArray(String[]::new)));
|
|
}
|
|
}
|
|
|
|
+
|
|
List<FeatureRate> featureRates = new ArrayList<>();
|
|
List<FeatureRate> featureRates = new ArrayList<>();
|
|
if(condition != null){
|
|
if(condition != null){
|
|
for (Map.Entry<String, Map<String,String>> d : condition.entrySet()) {
|
|
for (Map.Entry<String, Map<String,String>> d : condition.entrySet()) {
|
|
@@ -151,9 +163,12 @@ public class GraphCalculate {
|
|
responseData.setMedicalIndications(idn);
|
|
responseData.setMedicalIndications(idn);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
//诊断推送
|
|
//诊断推送
|
|
responseData.setDis(featureRates);
|
|
responseData.setDis(featureRates);
|
|
responseData.setInputs(searchData.getInputs());
|
|
responseData.setInputs(searchData.getInputs());
|
|
|
|
+
|
|
|
|
+ System.out.println("Total takes: " + (System.currentTimeMillis()-starttime)/1000d + 's');
|
|
return responseData;
|
|
return responseData;
|
|
}
|
|
}
|
|
|
|
|