Ver código fonte

高危药品、手术

zhoutg 4 anos atrás
pai
commit
ecc1c6b30b

+ 7 - 0
src/main/java/com/diagbot/aggregate/IndicationAggregate.java

@@ -4,6 +4,7 @@ import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.facade.BillFacade;
 import com.diagbot.facade.HighRiskFacade;
+import com.diagbot.util.CoreUtil;
 import com.diagbot.vo.IndicationPushVO;
 import io.github.lvyahui8.spring.annotation.DataConsumer;
 import io.github.lvyahui8.spring.annotation.DataProvider;
@@ -33,9 +34,11 @@ public class IndicationAggregate {
         IndicationDTO res = new IndicationDTO();
         if (billDTO != null) {
             res.setBillMsgList(billDTO.getBillMsgList());
+            res.getDebugStr().addAll(billDTO.getDebugStr()); // 调试信息
         }
         if (highrisk != null) {
             res.setHighRiskList(highrisk.getHighRiskList());
+            res.getDebugStr().addAll(highrisk.getDebugStr()); // 调试信息
         }
         return res;
     }
@@ -50,10 +53,12 @@ public class IndicationAggregate {
     @DataProvider("bill")
     public IndicationDTO bill(@InvokeParameter("wordCrfDTO") WordCrfDTO wordCrfDTO,
                               @InvokeParameter("indicationPushVO") IndicationPushVO indicationPushVO) {
+        long start = System.currentTimeMillis();
         IndicationDTO res = new IndicationDTO();
         // 开单合理性
         if (indicationPushVO != null && indicationPushVO.getRuleTypeList().contains("2")) {
             billFacade.billFac(indicationPushVO, wordCrfDTO, res);
+            CoreUtil.getDebugStr(start, "开单规则", res.getDebugStr());
             return res;
         }
         return null;
@@ -69,10 +74,12 @@ public class IndicationAggregate {
     @DataProvider("highrisk")
     public IndicationDTO highrisk(@InvokeParameter("wordCrfDTO") WordCrfDTO wordCrfDTO,
                               @InvokeParameter("indicationPushVO") IndicationPushVO indicationPushVO) {
+        long start = System.currentTimeMillis();
         IndicationDTO res = new IndicationDTO();
         // 高风险提示
         if (indicationPushVO != null && indicationPushVO.getRuleTypeList().contains("3")) {
             highRiskFacade.highRiskFac(indicationPushVO, wordCrfDTO, res);
+            CoreUtil.getDebugStr(start, "高风险提示", res.getDebugStr());
             return res;
         }
         return null;

+ 2 - 1
src/main/java/com/diagbot/dto/IndicationDTO.java

@@ -3,6 +3,7 @@ package com.diagbot.dto;
 import lombok.Data;
 
 import java.util.ArrayList;
+import java.util.LinkedList;
 import java.util.List;
 
 /**
@@ -19,5 +20,5 @@ public class IndicationDTO {
     // 高危药品、手术
     private List<BillMsg> highRiskList = new ArrayList<>();
     // 记录调试信息
-    private List<String> dubugStr = new ArrayList<>();
+    private List<String> debugStr = new LinkedList<>();
 }

+ 13 - 7
src/main/java/com/diagbot/facade/IndicationFacade.java

@@ -54,6 +54,8 @@ public class IndicationFacade {
      * @return
      */
     public IndicationDTO indicationFac(IndicationPushVO indicationPushVO) {
+        IndicationDTO res = new IndicationDTO();
+
         //方法适配处理
         List<String> ruleTypeList = Arrays.asList(indicationPushVO.getRuleType().split(","));
         indicationPushVO.setRuleTypeList(ruleTypeList);
@@ -70,23 +72,24 @@ public class IndicationFacade {
             }
         }
 
-        IndicationDTO res = new IndicationDTO();
         WordCrfDTO wordCrfDTO = null;
         long l1 = System.currentTimeMillis();
+
+        // 模型处理数据
+        long crfStart = System.currentTimeMillis();
         if (methodList.contains("crf")) {
-            // 模型处理数据
             wordCrfDTO = commonFacade.crf_process(indicationPushVO);
-            CoreUtil.getDubugStr(l1, "处理模型数据", res.getDubugStr());
         }
+        long crfEnd = System.currentTimeMillis();
 
+        // 标准词转换
+        long standStart = System.currentTimeMillis();
         if (methodList.contains("stand")) {
-            // 标准词转换
-            long l2 = System.currentTimeMillis();
             StandConvert standConvert = commonFacade.dataTypeGet(wordCrfDTO);
             Map<String, Map<String, String>> standConvertMap = neoFacade.standConvertCrf(standConvert);
             commonFacade.dataTypeSet(wordCrfDTO, standConvertMap);
-            CoreUtil.getDubugStr(l2, "同义词转换", res.getDubugStr());
         }
+        long standEnd = System.currentTimeMillis();
 
         try {
             Map<String, Object> invokeParams = new HashMap<>();
@@ -97,7 +100,10 @@ public class IndicationFacade {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "提醒类服务出错" + e.getMessage());
         }
 
-        CoreUtil.getDubugStr(l1, "本次调用总计", res.getDubugStr());
+        // 输入调试信息
+        CoreUtil.getDebugStrFirst(standStart, standEnd,"同义词转换", res.getDebugStr());
+        CoreUtil.getDebugStrFirst(crfStart, crfEnd,"处理模型数据", res.getDebugStr());
+        CoreUtil.getDebugStr(l1, "本次调用总计", res.getDebugStr());
         return res;
     }
 }

+ 23 - 1
src/main/java/com/diagbot/util/CoreUtil.java

@@ -478,11 +478,33 @@ public class CoreUtil {
      * @param msg
      * @param debugStr
      */
-    public static void getDubugStr(long start,  String msg, List<String> debugStr) {
+    public static void getDebugStr(long start, String msg, List<String> debugStr) {
         long end = System.currentTimeMillis();
         debugStr.add(msg + "需要" + (end - start) / 1000.0 + "秒");
     }
 
+    /**
+     * 输出调试信息
+     *
+     * @param start
+     * @param msg
+     * @param debugStr
+     */
+    public static void getDebugStr(long start, long end, String msg, List<String> debugStr) {
+        debugStr.add(msg + "需要" + (end - start) / 1000.0 + "秒");
+    }
+
+    /**
+     * 输出调试信息
+     *
+     * @param start
+     * @param msg
+     * @param debugStr
+     */
+    public static void getDebugStrFirst(long start, long end, String msg, List<String> debugStr) {
+        debugStr.add(0, msg + "需要" + (end - start) / 1000.0 + "秒");
+    }
+
     public static void main(String[] args) {
 
         System.out.println(getCommonBillMsg("男性", "尿常规",""));