Переглянути джерело

将规则过滤层放到大数据和图谱推送之前

MarkHuang 5 роки тому
батько
коміт
ec58d3979b

+ 1 - 1
bigdata-web/src/main/java/org/diagbot/bigdata/controller/AlgorithmController.java

@@ -34,7 +34,7 @@ public class AlgorithmController extends BaseController {
     public Response<ResponseData> algorithm(HttpServletRequest request, SearchData searchData) throws Exception {
         Response<ResponseData> response = new Response();
         AlgorithmCore core = new AlgorithmCore();
-        ResponseData responseData = core.algorithm(request, searchData);
+        ResponseData responseData = core.algorithm(request, searchData, null);
         response.setData(responseData);
         return response;
     }

+ 4 - 2
bigdata-web/src/main/java/org/diagbot/bigdata/work/AlgorithmCore.java

@@ -25,8 +25,10 @@ import java.util.*;
  **/
 public class AlgorithmCore {
     Logger logger = LoggerFactory.getLogger(AlgorithmCore.class);
-    public ResponseData algorithm(HttpServletRequest request, SearchData searchData) throws Exception {
-        ResponseData responseData = new ResponseData();
+    public ResponseData algorithm(HttpServletRequest request, SearchData searchData, ResponseData responseData) throws Exception {
+        if (responseData == null) {
+            responseData = new ResponseData();
+        }
         //录入文本处理,包括提取特征、推送类型转换等
         ParamsDataProxy paramsDataProxy = new ParamsDataProxy();
         logger.info("页面文本信息:" + searchData.getSymptom());

+ 6 - 6
push-web/src/main/java/org/diagbot/push/controller/AlgorithmController.java

@@ -119,15 +119,15 @@ public class AlgorithmController extends BaseController {
     }
 
     public Response<ResponseData> combine(HttpServletRequest request, SearchData searchData) throws Exception {
-        logger.info("开始推送服务......");
-        Response<ResponseData> response = new Response();
-        AlgorithmCore core = new AlgorithmCore();
-        ResponseData bigDataResponseData = core.algorithm(request, searchData);
-
         logger.info("开始规则转换......");
         PreProcess prepro = new PreProcess();
         searchData = prepro.processClinicalData(searchData);
-        bigDataResponseData = prepro.applyrules(searchData, bigDataResponseData);
+        ResponseData RuleResponseData = prepro.applyrules(searchData);
+
+        logger.info("开始推送服务......");
+        Response<ResponseData> response = new Response();
+        AlgorithmCore core = new AlgorithmCore();
+        ResponseData bigDataResponseData = core.algorithm(request, searchData, RuleResponseData);
 
         GraphCalculate graphCalculate = new GraphCalculate();
         ResponseData graphResponseData = graphCalculate.calculate(request, searchData);

+ 5 - 3
push-web/src/main/java/org/diagbot/push/transform/PreProcess.java

@@ -39,7 +39,9 @@ public class PreProcess {
         return sData;
     }
 
-    public ResponseData applyrules(SearchData sData, ResponseData bigDataResponse) {
+    public ResponseData applyrules(SearchData sData) {
+
+        ResponseData ruleResponse = new ResponseData();
 
         List<MedicalIndication> reminder;
         try {
@@ -47,12 +49,12 @@ public class PreProcess {
 
             reminder = applytolis(sData, rule);
 
-            bigDataResponse.setMedicalIndications(reminder);
+            ruleResponse.setMedicalIndications(reminder);
 
         } catch (Exception ex) {
             ex.printStackTrace();
         } finally {
-            return bigDataResponse;
+            return ruleResponse;
         }
     }