Explorar el Código

多线程处理

zhoutg hace 4 años
padre
commit
487087c856

+ 6 - 0
pom.xml

@@ -33,6 +33,7 @@
         <swagger.version>2.9.2</swagger.version>
         <logstash.version>5.2</logstash.version>
         <docker-maven-plugin.version>1.2.1</docker-maven-plugin.version>
+        <aggregator.version>1.1.0</aggregator.version>
         <docker.image.prefix>192.168.2.236:5000/diagbotcloud</docker.image.prefix>
         <registryUrl>http://192.168.2.236:5000/repository/diagbotcloud/</registryUrl>
     </properties>
@@ -221,6 +222,11 @@
             <version>2.4</version>
         </dependency>
 
+        <dependency>
+            <groupId>io.github.lvyahui8</groupId>
+            <artifactId>spring-boot-data-aggregator-starter</artifactId>
+            <version>${aggregator.version}</version>
+        </dependency>
     </dependencies>
 
     <!-- 私有仓库 -->

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

@@ -0,0 +1,81 @@
+package com.diagbot.aggregate;
+
+import com.diagbot.dto.IndicationDTO;
+import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.facade.BillFacade;
+import com.diagbot.facade.HighRiskFacade;
+import com.diagbot.vo.IndicationPushVO;
+import io.github.lvyahui8.spring.annotation.DataConsumer;
+import io.github.lvyahui8.spring.annotation.DataProvider;
+import io.github.lvyahui8.spring.annotation.InvokeParameter;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description: 提醒类聚合
+ * @author: zhoutg
+ * @time: 2019/10/16 13:37
+ */
+@Component
+public class IndicationAggregate {
+
+    @Autowired
+    BillFacade billFacade;
+    @Autowired
+    HighRiskFacade highRiskFacade;
+
+    @DataProvider("indicationAll")
+    public IndicationDTO indicationAll(
+            @InvokeParameter("wordCrfDTO") WordCrfDTO wordCrfDTO,
+            @InvokeParameter("indicationPushVO") IndicationPushVO indicationPushVO,
+            @DataConsumer("bill") IndicationDTO billDTO,
+            @DataConsumer("highrisk") IndicationDTO highrisk) {
+        IndicationDTO res = new IndicationDTO();
+        if (billDTO != null) {
+            res.setBillMsgList(billDTO.getBillMsgList());
+        }
+        if (highrisk != null) {
+            res.setHighRiskList(highrisk.getHighRiskList());
+        }
+        return res;
+    }
+
+    /**
+     * 开单合理性
+     *
+     * @param wordCrfDTO
+     * @param indicationPushVO
+     * @return
+     */
+    @DataProvider("bill")
+    public IndicationDTO bill(@InvokeParameter("wordCrfDTO") WordCrfDTO wordCrfDTO,
+                              @InvokeParameter("indicationPushVO") IndicationPushVO indicationPushVO) {
+        IndicationDTO res = new IndicationDTO();
+        // 开单合理性
+        if (indicationPushVO != null && indicationPushVO.getRuleTypeList().contains("2")) {
+            billFacade.billFac(indicationPushVO, wordCrfDTO, res);
+            return res;
+        }
+        return null;
+    }
+
+
+    /**
+     * 高风险提示
+     *
+     * @param wordCrfDTO
+     * @param indicationPushVO
+     * @return
+     */
+    @DataProvider("highrisk")
+    public IndicationDTO highrisk(@InvokeParameter("wordCrfDTO") WordCrfDTO wordCrfDTO,
+                              @InvokeParameter("indicationPushVO") IndicationPushVO indicationPushVO) {
+        IndicationDTO res = new IndicationDTO();
+        // 高风险提示
+        if (indicationPushVO != null && indicationPushVO.getRuleTypeList().contains("3")) {
+            highRiskFacade.highRiskFac(indicationPushVO, wordCrfDTO, res);
+            return res;
+        }
+        return null;
+    }
+}

+ 3 - 0
src/main/java/com/diagbot/dto/BillNeoMaxDTO.java

@@ -19,6 +19,9 @@ public class BillNeoMaxDTO {
 
     // 开单标准名称
     private String orderStandName;
+
+    // 类型
+    private String type;
     /****************扩展数据结束******************/
 
     // 禁忌性别

+ 1 - 0
src/main/java/com/diagbot/facade/BillFacade.java

@@ -42,6 +42,7 @@ public class BillFacade {
 
         // 规则处理
         billProcess.process(billNeoDTOList, wordCrfDTO, res);
+        System.out.println(res);
     }
 
 

+ 80 - 0
src/main/java/com/diagbot/facade/HighRiskFacade.java

@@ -0,0 +1,80 @@
+package com.diagbot.facade;
+
+import com.diagbot.biz.push.entity.Item;
+import com.diagbot.biz.push.entity.Lis;
+import com.diagbot.biz.push.entity.Pacs;
+import com.diagbot.dto.BillNeoDTO;
+import com.diagbot.dto.IndicationDTO;
+import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.process.HighRiskProcess;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.BillNeoVO;
+import com.diagbot.vo.IndicationPushVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Description: 高风险合理性facade
+ * @author: zhoutg
+ * @time: 2018/8/6 9:11
+ */
+@Component
+public class HighRiskFacade {
+
+    @Autowired
+    NeoFacade neoFacade;
+    @Autowired
+    HighRiskProcess highRiskProcess;
+    @Autowired
+    CommonFacade commonFacade;
+
+    /**
+     * 高风险业务
+     * @param
+     * @return
+     */
+    public void highRiskFac(IndicationPushVO indicationPushVO, WordCrfDTO wordCrfDTO, IndicationDTO res) {
+        // 高风险图谱接口调用
+        BillNeoVO billNeoVO = fillBillNeo(wordCrfDTO);
+        List<BillNeoDTO> billNeoDTOList = neoFacade.getBillNeo(billNeoVO);
+
+        // 规则处理
+        highRiskProcess.process(billNeoDTOList, wordCrfDTO, res);
+        System.out.println(res);
+    }
+
+
+    public BillNeoVO fillBillNeo(WordCrfDTO wordCrfDTO) {
+        BillNeoVO billNeoVO = new BillNeoVO();
+
+        List<Item> items = wordCrfDTO.getDrugOrder();
+
+        for (Item item : items) {
+            billNeoVO.getDrugList().put(item.getName(), item.getUniqueName());
+        }
+
+        List<Pacs> pacslist = wordCrfDTO.getPacsOrder();
+        for (Pacs pacs : pacslist) {
+            billNeoVO.getPacsList().put(pacs.getName(), pacs.getUniqueName());
+        }
+
+        List<Lis> lislist = wordCrfDTO.getLisOrder();
+        for (Lis lis : lislist) {
+            if (StringUtil.isBlank(lis.getDetailName())) {
+                billNeoVO.getLisList().put(lis.getName(), lis.getUniqueName());
+            }
+            else {
+                billNeoVO.getLisDetailList().put(lis.getDetailName(), lis.getUniqueName());
+            }
+        }
+
+        List<Item> diags = wordCrfDTO.getDiagOrder();
+        for (Item item : diags) {
+            billNeoVO.getDiagList().put(item.getName(), item.getUniqueName());
+        }
+
+        return billNeoVO;
+    }
+}

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

@@ -3,10 +3,13 @@ package com.diagbot.facade;
 import com.diagbot.client.StandConvertServiceClient;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.vo.IndicationPushVO;
 import com.diagbot.vo.StandConvert;
+import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -32,6 +35,8 @@ public class IndicationFacade {
     BillFacade billFacade;
     @Autowired
     StandConvertServiceClient standConvertServiceClient;
+    @Autowired
+    DataBeanAggregateQueryFacade dataBeanAggregateQueryFacade;
 
     private static final Map<String, List<String>> methodMap;
 
@@ -51,6 +56,8 @@ public class IndicationFacade {
     public IndicationDTO indicationFac(IndicationPushVO indicationPushVO) {
         //方法适配处理
         List<String> ruleTypeList = Arrays.asList(indicationPushVO.getRuleType().split(","));
+        indicationPushVO.setRuleTypeList(ruleTypeList);
+
         List<String> methodList = new ArrayList<>();
         for (String ruleType : ruleTypeList) {
             if (ListUtil.isNotEmpty(methodMap.get(ruleType))) {
@@ -81,15 +88,15 @@ public class IndicationFacade {
             CoreUtil.getDubugStr(l2, "同义词转换", res.getDubugStr());
         }
 
-        long l3 = System.currentTimeMillis();
-        // 开单合理性
-        if (ruleTypeList.contains("2")) {
-            billFacade.billFac(indicationPushVO, wordCrfDTO, res);
+        try {
+            Map<String, Object> invokeParams = new HashMap<>();
+            invokeParams.put("wordCrfDTO", wordCrfDTO);
+            invokeParams.put("indicationPushVO", indicationPushVO);
+            res = dataBeanAggregateQueryFacade.get("indicationAll", invokeParams, IndicationDTO.class);
+        } catch (Exception e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "提醒类服务出错" + e.getMessage());
         }
-        // 其他类型提示
 
-        // 调试信息
-        CoreUtil.getDubugStr(l3, "开单合理性规则处理", res.getDubugStr());
         CoreUtil.getDubugStr(l1, "本次调用总计", res.getDubugStr());
         return res;
     }

+ 1 - 1
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -144,7 +144,7 @@ public class NeoFacade {
         List<BillNeoDTO> billNeoDTOs = new ArrayList<>();
 
         billNeoDTOs.addAll(getDrugBill(billNeoVO.getDrugList()));
-        billNeoDTOs.addAll(getPacsBill(billNeoVO.getPacsList()));
+        // billNeoDTOs.addAll(getPacsBill(billNeoVO.getPacsList()));
         billNeoDTOs.addAll(getLisDetailBill(billNeoVO.getLisDetailList()));
         billNeoDTOs.addAll(getLisBill(billNeoVO.getLisList()));
 

+ 52 - 0
src/main/java/com/diagbot/process/HighRiskProcess.java

@@ -0,0 +1,52 @@
+package com.diagbot.process;
+
+import com.diagbot.dto.BillMsg;
+import com.diagbot.dto.BillNeoDTO;
+import com.diagbot.dto.IndicationDTO;
+import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.facade.NeoFacade;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Description: 高风险总入口
+ * @author: zhoutg
+ * @time: 2018/8/6 9:11
+ */
+@Component
+public class HighRiskProcess {
+
+    @Autowired
+    NeoFacade neoFacade;
+
+    public void process(List<BillNeoDTO> billNeoDTOList, WordCrfDTO wordCrfDTO, IndicationDTO res) {
+        for (BillNeoDTO billNeoDTO : billNeoDTOList) {
+            if (billNeoDTO.getDrugBillNeoDTO() != null) {
+                // TODO
+                if (true) {
+                    getHighRiskMsg(billNeoDTO, "药品", res);
+                }
+            } else if (billNeoDTO.getLisBillNeoDTO() != null) {
+                // TODO
+                getHighRiskMsg(billNeoDTO, "手术", res);
+            }
+        }
+    }
+
+    /**
+     *
+     * @param billNeoDTO
+     * @param type
+     * @param res
+     */
+    public void getHighRiskMsg(BillNeoDTO billNeoDTO, String type, IndicationDTO res) {
+        BillMsg billMsg = new BillMsg();
+        billMsg.setMsg(billNeoDTO.getName() + "为高风险要" + type + ",请留意");
+        billMsg.setOrderName(billNeoDTO.getName());
+        billMsg.setOrderStandName(billNeoDTO.getStandname());
+        billMsg.setType(type);
+        res.getHighRiskList().add(billMsg);
+    }
+}

+ 2 - 1
src/main/java/com/diagbot/rule/AgeRule.java

@@ -30,7 +30,8 @@ public class AgeRule {
             flag = CoreUtil.compareNum(ageNeoDTO, age);
         }
         if (flag) {
-            String message = CoreUtil.getStrMsgWithRange(ageNeoDTO, "年龄", String.valueOf(wordCrfDTO.getAge()));
+            // String message = CoreUtil.getStrMsgWithRange(ageNeoDTO, "年龄", String.valueOf(wordCrfDTO.getAge()));
+            String message = "该患者年龄" + wordCrfDTO.getAge();
             BillMsg billMsg = CoreUtil.getCommonBillMsg(billNeoMaxDTO.getOrderName(), billNeoMaxDTO.getOrderStandName(),
                     message, message, type);
             billMsgList.add(billMsg);

+ 1 - 2
src/main/java/com/diagbot/vo/BillNeoVO.java

@@ -2,9 +2,7 @@ package com.diagbot.vo;
 
 import lombok.Data;
 
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 @Data
@@ -22,5 +20,6 @@ public class BillNeoVO {
     // 药品入参
     private Map<String, String> drugList = new HashMap<>();
 
+    // 诊断入参
     private Map<String, String> diagList = new HashMap<>();
 }

+ 3 - 0
src/main/java/com/diagbot/vo/IndicationPushVO.java

@@ -4,6 +4,8 @@ import lombok.Getter;
 import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @Description:病情提示入参
@@ -19,6 +21,7 @@ public class IndicationPushVO extends SearchData {
     @NotBlank(message = "ruleType不能为空")
     private String ruleType = "";
 
+    List<String> ruleTypeList = new ArrayList<>();
     // 文件的行号,测试文件数据用
     private String idNum;
 }