Browse Source

反推结构

zhoutg 4 years ago
parent
commit
772da13a11

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

@@ -8,8 +8,15 @@ import com.diagbot.entity.node.Disease;
 import com.diagbot.entity.node.LIS;
 import com.diagbot.entity.node.Medicine;
 import com.diagbot.entity.node.PACS;
-import com.diagbot.repository.*;
+import com.diagbot.repository.DiseaseRepository;
+import com.diagbot.repository.LISNode;
+import com.diagbot.repository.LisRepository;
+import com.diagbot.repository.MedicineNode;
+import com.diagbot.repository.MedicineRepository;
+import com.diagbot.repository.PACSNode;
+import com.diagbot.repository.PacsRepository;
 import com.diagbot.vo.BillNeoVO;
+import com.diagbot.vo.PushNeoVO;
 import com.diagbot.vo.StandConvert;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.Cacheable;
@@ -17,6 +24,7 @@ import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -50,7 +58,16 @@ public class NeoFacade {
         return res;
     }
 
+    /**
+     * 通过诊断反推
+     *
+     * @return
+     */
+    public Map<String, Object> getInverse(PushNeoVO pushNeoVO) {
+        Map<String, Object> map = new LinkedHashMap<>();
 
+        return map;
+    }
 
     /**
      * 处理开单合理性图谱数据

+ 79 - 79
src/main/java/com/diagbot/facade/PushFacade.java

@@ -1,79 +1,79 @@
-// package com.diagbot.facade;
-//
-// import com.diagbot.biz.push.entity.Item;
-// import com.diagbot.dto.IndicationDTO;
-// import com.diagbot.dto.BillNeoDTO;
-// import com.diagbot.dto.WordCrfDTO;
-// import com.diagbot.process.BillProcess;
-// import com.diagbot.vo.BillNeoVO;
-// import com.diagbot.vo.IndicationPushVO;
-// import com.diagbot.vo.PushVO;
-// import com.diagbot.vo.StandConvert;
-// import org.springframework.beans.factory.annotation.Autowired;
-// import org.springframework.stereotype.Component;
-//
-// import java.util.List;
-// import java.util.Map;
-//
-// /**
-//  * @Description: 推送facade
-//  * @author: zhoutg
-//  * @time: 2018/8/6 9:11
-//  */
-// @Component
-// public class PushFacade {
-//
-//     @Autowired
-//     NeoFacade neoFacade;
-//     @Autowired
-//     BillProcess billProcess;
-//     @Autowired
-//     CommonFacade commonFacade;
-//
-//     /**
-//      * 开单合理性业务
-//      * @param
-//      * @return
-//      */
-//     public IndicationDTO billFac(IndicationPushVO indicationPushVO) {
-//         // 模型处理数据 TODO
-//         WordCrfDTO wordCrfDTO = commonFacade.crf_process(indicationPushVO);
-//         StandConvert standConvert = commonFacade.dataTypeGet(wordCrfDTO);
-//
-//         // 标准词转换 TODO
-//         Map<Integer, Map<String, String>> typeStand = neoFacade.standConvert(standConvert);
-//         commonFacade.dataTypeSet(wordCrfDTO, typeStand);
-//
-//         // 图谱接口调用
-//         BillNeoVO billNeoVO = fillBillNeo(indicationPushVO);
-//
-//         List<BillNeoDTO> billNeoDTOs = neoFacade.getBillNeo(billNeoVO);
-//
-//         // 规则开发 TODO
-//         neoFacade.getDrugCache();
-//
-//         // TODO
-//         return null;
-//     }
-//
-//     /**
-//      * 推送业务
-//      * @param
-//      * @return
-//      */
-//     public IndicationDTO pushFac(PushVO pushVo) {
-//         return null;
-//     }
-//
-//
-//     public BillNeoVO fillBillNeo(IndicationPushVO indicationPushVO) {
-//         BillNeoVO billNeoVO = new BillNeoVO();
-//
-//         List<Item> items = indicationPushVO.getDrug();
-//         for (Item item : items) {
-//             billNeoVO.getDrugList().put(item.getName(), item.getUniqueName());
-//         }
-//
-//         return billNeoVO;
-//     }
-// }
+package com.diagbot.facade;
+
+import com.diagbot.biz.push.entity.Item;
+import com.diagbot.dto.PushDTO;
+import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.util.ListUtil;
+import com.diagbot.vo.BillNeoVO;
+import com.diagbot.vo.IndicationPushVO;
+import com.diagbot.vo.PushNeoVO;
+import com.diagbot.vo.PushVO;
+import com.diagbot.vo.StandConvert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description: 推送facade
+ * @author: zhoutg
+ * @time: 2018/8/6 9:11
+ */
+@Component
+public class PushFacade {
+
+    @Autowired
+    NeoFacade neoFacade;
+    @Autowired
+    CommonFacade commonFacade;
+
+    /**
+     * 推送业务
+     * @param
+     * @return
+     */
+    public PushDTO pushFac(PushVO pushVo) {
+        PushDTO pushDTO = new PushDTO();
+        // 模型处理数据
+        WordCrfDTO wordCrfDTO = commonFacade.crf_process(pushVo);
+
+        // 标准词转换
+        StandConvert standConvert = commonFacade.dataTypeGet(wordCrfDTO);
+        Map<Integer, Map<String, String>> standConvertMap = neoFacade.standConvert(standConvert);
+        commonFacade.dataTypeSet(wordCrfDTO, standConvertMap);
+
+        List<String> ruleTypeList = Arrays.asList(pushVo.getFeatureType().split(","));
+
+        if (wordCrfDTO.getDiagLabel() != null && ListUtil.isNotEmpty(wordCrfDTO.getDiagLabel().getDiags())) { // 有诊断
+            List<String> diags = wordCrfDTO.getDiagLabel().getDiags().stream().map(r -> r.getStandName()).collect(Collectors.toList());
+            PushNeoVO pushNeoVO = new PushNeoVO();
+            pushNeoVO.setSex(pushVo.getSex());
+            pushNeoVO.setAge(pushVo.getAge());
+            pushNeoVO.setDiags(diags);
+            Map<String, Object> map = neoFacade.getInverse(pushNeoVO);
+            if (ruleTypeList.contains("5")) {
+                // TODO 存放化验
+            }
+
+            if (ruleTypeList.contains("6")) {
+                // TODO 存放辅检
+            }
+        }
+
+        return pushDTO;
+    }
+
+    public BillNeoVO fillBillNeo(IndicationPushVO indicationPushVO) {
+        BillNeoVO billNeoVO = new BillNeoVO();
+
+        List<Item> items = indicationPushVO.getDrug();
+        for (Item item : items) {
+            billNeoVO.getDrugList().put(item.getName(), item.getUniqueName());
+        }
+
+        return billNeoVO;
+    }
+}

+ 19 - 0
src/main/java/com/diagbot/vo/PushNeoVO.java

@@ -0,0 +1,19 @@
+package com.diagbot.vo;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @description:
+ * @author: zhoutg
+ * @time: 2020/8/6 16:42
+ */
+@Data
+public class PushNeoVO {
+
+    List<String> diags = new ArrayList<>();
+    private Integer sex;
+    private Integer age;
+}

+ 7 - 6
src/main/java/com/diagbot/web/CoreController.java

@@ -4,6 +4,7 @@ import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.PushDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.IndicationFacade;
+import com.diagbot.facade.PushFacade;
 import com.diagbot.vo.IndicationPushVO;
 import com.diagbot.vo.PushVO;
 import io.swagger.annotations.Api;
@@ -29,21 +30,21 @@ public class CoreController {
 
     @Autowired
     private IndicationFacade indicationFacade;
-    // @Autowired
-    // private PushFacade pushFacade;
+    @Autowired
+    private PushFacade pushFacade;
 
     @ApiOperation(value = "开单合理性API[zhoutg]", notes = "ruleType(1:危急值提醒,2:开单合理项,3:管理评估,4:不良反应,5:药物推荐,6:异常值)")
     @PostMapping("/indication")
     public RespDTO<IndicationDTO> indication(@Valid @RequestBody IndicationPushVO indicationPushVO) {
-        return RespDTO.onSuc(indicationFacade.indicationFac(indicationPushVO));
+        IndicationDTO indicationDTO = indicationFacade.indicationFac(indicationPushVO);
+        return RespDTO.onSuc(indicationDTO);
     }
 
      @ApiOperation(value = "推送API[zhoutg]", notes = "类型(多选必填),1:症状,4:查体结果,5:检验,6:检查,7:诊断")
      @PostMapping("/push")
      public RespDTO<PushDTO> push(@RequestBody PushVO pushVo) {
-//         return RespDTO.onSuc(pushFacade.pushFac(pushVo));
-         PushDTO pushDTO = new PushDTO();
-         return  RespDTO.onSuc(pushDTO);
+         PushDTO pushDTO = pushFacade.pushFac(pushVo);
+         return RespDTO.onSuc(pushDTO);
      }
 }