瀏覽代碼

执行时间 日志追踪

rengb 5 年之前
父節點
當前提交
22b48e8584

+ 12 - 1
kernel/src/main/java/com/lantone/qc/kernel/analysis/QCAnalysis.java

@@ -1,17 +1,18 @@
 package com.lantone.qc.kernel.analysis;
 
 import com.google.common.collect.Maps;
+import com.lantone.qc.dbanaly.util.SpecialStorageUtil;
 import com.lantone.qc.kernel.client.CRFServiceClient;
 import com.lantone.qc.kernel.client.SimilarityServiceClient;
 import com.lantone.qc.kernel.structure.ai.AIAnalyze;
 import com.lantone.qc.kernel.util.CatalogueUtil;
-import com.lantone.qc.dbanaly.util.SpecialStorageUtil;
 import com.lantone.qc.pub.exception.AIException;
 import com.lantone.qc.pub.exception.CatalogueException;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.vo.QueryVo;
 import com.lantone.qc.trans.TransDispatch;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -23,6 +24,7 @@ import java.util.Map;
  * @Author : 楼辉荣
  * @Date: 2020-03-04 11:48
  */
+@Slf4j
 @Component
 public class QCAnalysis {
     @Autowired
@@ -35,7 +37,9 @@ public class QCAnalysis {
     public OutputInfo anlysis(QueryVo queryVo) throws AIException, CatalogueException, Exception {
         specialStorageUtil.getHospitalIdThreadLocal().set(queryVo.getHospitalId());
         OutputInfo outputInfo = new OutputInfo();
+        long t1 = System.currentTimeMillis();
         InputInfo inputInfo = TransDispatch.trans(queryVo);
+        long t2 = System.currentTimeMillis();
         inputInfo.setUseCrfCache(queryVo.isUseCrfCache());
         inputInfo.setInputCatalogueMap(queryVo.getInputCatalogueMap());
         AIAnalyze aiAnalyze = new AIAnalyze(crfServiceClient, similarityServiceClient);
@@ -44,12 +48,19 @@ public class QCAnalysis {
         } catch (Exception e) {
             throw new AIException("AI模型执行错误:" + e.getMessage());
         }
+        long t3 = System.currentTimeMillis();
         for (Map.Entry<String, Map<String, String>> entry : inputInfo.getInputCatalogueMap().entrySet()) {
             if (CatalogueUtil.qcCatalogueMap.get(entry.getKey()) == null) {
                 continue;
             }
             CatalogueUtil.qcCatalogueMap.get(entry.getKey()).execute(inputInfo, outputInfo);
         }
+        long t4 = System.currentTimeMillis();
+
+        log.error(queryVo.getBehospitalInfo().getBehospitalCode() + "-----" + "trans层  耗时:" + (t2 - t1));
+        log.error(queryVo.getBehospitalInfo().getBehospitalCode() + "-----" + "CRF  耗时:" + (t3 - t2));
+        log.error(queryVo.getBehospitalInfo().getBehospitalCode() + "-----" + "所有规则  耗时:" + (t4 - t3));
+
         outputInfo.setPageData(inputInfo.getPageData());
         Map<String, Map<String, String>> result = outputInfo.getResult();
         Map<String, Map<String, String>> resultNew = Maps.newHashMap();

+ 3 - 26
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/AIAnalyze.java

@@ -2,13 +2,10 @@ package com.lantone.qc.kernel.structure.ai;
 
 import com.lantone.qc.kernel.client.CRFServiceClient;
 import com.lantone.qc.kernel.client.SimilarityServiceClient;
-import com.lantone.qc.kernel.structure.ai.model.CrfOut;
 import com.lantone.qc.pub.model.InputInfo;
+import lombok.extern.slf4j.Slf4j;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+@Slf4j
 public class AIAnalyze {
 
     private CRFServiceClient crfServiceClient;
@@ -25,31 +22,11 @@ public class AIAnalyze {
     }
 
     public void aiProcess(InputInfo inputInfo) {
-        long start = System.currentTimeMillis();
         beHospitalizedAI.medrec(inputInfo, crfServiceClient);
-        long end = System.currentTimeMillis();
-        System.out.println("入院记录 AI处理....." + (end - start));
-        start = System.currentTimeMillis();
-
         firstCourseRecordAI.medrec(inputInfo, crfServiceClient, similarityServiceClient);
-        end = System.currentTimeMillis();
-        System.out.println("首次病程录 AI处理....." + (end - start));
-        start = System.currentTimeMillis();
-
         leaveHospitalAI.medrec(inputInfo, crfServiceClient);
-        end = System.currentTimeMillis();
-        System.out.println("出院小结 AI处理....." + (end - start));
-        start = System.currentTimeMillis();
-
         threeLevelWardAI.medrec(inputInfo, crfServiceClient);
-        end = System.currentTimeMillis();
-        System.out.println("三级查房 AI处理....." + (end - start));
-        start = System.currentTimeMillis();
-
         operationAI.medrec(inputInfo, crfServiceClient);
-        end = System.currentTimeMillis();
-        System.out.println("手术 AI处理....." + (end - start));
     }
 
-
-}
+}

+ 5 - 0
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ModelAI.java

@@ -15,6 +15,7 @@ import com.lantone.qc.pub.model.vo.ChiefPresentSimilarityVo;
 import com.lantone.qc.pub.model.vo.SimilarityVo;
 import com.lantone.qc.pub.util.SpringContextUtil;
 import com.lantone.qc.pub.util.StringUtil;
+import lombok.extern.slf4j.Slf4j;
 
 import java.util.List;
 
@@ -24,6 +25,7 @@ import java.util.List;
  * @Author : 楼辉荣
  * @Date: 2020-03-19 15:08
  */
+@Slf4j
 public class ModelAI {
     /**
      * 获取CRF返回数据
@@ -43,8 +45,11 @@ public class ModelAI {
             //存储CRF完整所需结构数据
             CRFVo crfVo = new CRFVo();
             crfVo.setData(crfContent);
+            long t1 = System.currentTimeMillis();
             //获取CRF模型返回数据
             data = getAnnotation(crfServiceClient, crfVo).getData();
+            long t2 = System.currentTimeMillis();
+            log.error(behospitalCode + "-----" + classname + "(CRF)  耗时:" + (t2 - t1));
             if (data != null) {
                 redisUtil.hset(behospitalCode, classname, data, 86400);
             }

+ 8 - 15
kernel/src/main/java/com/lantone/qc/kernel/web/controller/QCController.java

@@ -16,9 +16,6 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.LinkedHashMap;
-import java.util.Map;
-
 /**
  * @ClassName : QCController
  * @Description : 质控总入口
@@ -37,34 +34,30 @@ public class QCController {
     @ApiOperation(value = "质控外部接口,需要token信息", notes = "")
     @PostMapping("rec")
     public Response<OutputInfo> extract(@RequestBody QueryVo queryVo) {
+        log.error(queryVo.getBehospitalInfo().getBehospitalCode() + "-----开始质控");
+        long t1 = System.currentTimeMillis();
         Response response = new Response();
         try {
-            long t1 = System.currentTimeMillis();
-            log.error("----开始质控----");
             response.setData(qCAnalysis.anlysis(queryVo));
-            long t2 = System.currentTimeMillis();
-            log.error("----结束质控 crf处理时间:"+(t2-t1));
         } catch (AIException aie) {
-            log.error(aie.getMessage(),aie);
+            log.error(aie.getMessage(), aie);
             response.setRet(-1);
             response.setMsg(aie.getMessage());
         } catch (TransException trae) {
-            log.error(trae.getMessage(),trae);
+            log.error(trae.getMessage(), trae);
             response.setRet(-2);
             response.setMsg(trae.getMessage());
         } catch (CatalogueException ce) {
-            log.error(ce.getMessage(),ce);
+            log.error(ce.getMessage(), ce);
             response.setRet(-3);
             response.setMsg(ce.getMessage());
         } catch (Exception e) {
-            log.error(e.getMessage(),e);
+            log.error(e.getMessage(), e);
             response.setRet(-9);
             response.setMsg("质控出错:" + e.getMessage());
         }
-        if (response == null || response.getData() == null) {
-            log.error("------------------------------------远程质控接口没有返回数据!");
-        }
-
+        long t2 = System.currentTimeMillis();
+        log.error(queryVo.getBehospitalInfo().getBehospitalCode() + "-----质控结束  耗时:" + (t2 - t1));
         return response;
     }
 

+ 177 - 0
public/src/main/java/com/lantone/qc/pub/model/vo/BehospitalInfoVO.java

@@ -0,0 +1,177 @@
+package com.lantone.qc.pub.model.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 住院病历信息
+ * </p>
+ *
+ * @author rgb
+ * @since 2020-05-29
+ */
+@Getter
+@Setter
+public class BehospitalInfoVO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 病人住院ID
+     */
+    private String behospitalCode;
+
+    /**
+     * 医院ID
+     */
+    private Long hospitalId;
+
+    /**
+     * 姓名
+     */
+    private String name;
+
+    /**
+     * 性别(男,女)
+     */
+    private String sex;
+
+    /**
+     * 出生日期
+     */
+    //    private Date birthday;
+
+    /**
+     * 档案号
+     */
+    private String fileCode;
+
+    /**
+     * 质控类型
+     */
+    private Long qcTypeId;
+
+    /**
+     * 病区编码
+     */
+    private String wardCode;
+
+    /**
+     * 病区名称
+     */
+    private String wardName;
+
+    /**
+     * 住院科室ID
+     */
+    private String behDeptId;
+
+    /**
+     * 住院科室名称
+     */
+    private String behDeptName;
+
+    /**
+     * 床位号
+     */
+    private String bedCode;
+
+    /**
+     * 床位名称
+     */
+    private String bedName;
+
+    /**
+     * 医保类别
+     */
+    private String insuranceName;
+
+    /**
+     * 职业
+     */
+    private String jobType;
+
+    /**
+     * 入院时间
+     */
+    //    private Date behospitalDate;
+
+    /**
+     * 出院时间
+     */
+    //    private Date leaveHospitalDate;
+
+    /**
+     * 疾病ICD编码
+     */
+    private String diagnoseIcd;
+
+    /**
+     * 疾病名称
+     */
+    private String diagnose;
+
+    /**
+     * 主治医生ID
+     */
+    private String doctorId;
+
+    /**
+     * 主治医生姓名
+     */
+    private String doctorName;
+
+    /**
+     * 住院医生ID
+     */
+    private String behDoctorId;
+
+    /**
+     * 住院医生姓名
+     */
+    private String behDoctorName;
+
+    /**
+     * 主任医生ID
+     */
+    private String directorDoctorId;
+
+    /**
+     * 主任医生姓名
+     */
+    private String directorDoctorName;
+
+    /**
+     * 是否归档(0:未归档,1:已归档)
+     */
+    private String isPlacefile;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    //    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    //    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+}

+ 3 - 1
public/src/main/java/com/lantone/qc/pub/model/vo/QueryVo.java

@@ -27,4 +27,6 @@ public class QueryVo extends TokenVO {
 
     private boolean useCrfCache = true;
 
-}
+    private BehospitalInfoVO behospitalInfo;
+
+}