소스 검색

cdss推送调用后端推送接口

kongwz 4 년 전
부모
커밋
caefc257a0

+ 25 - 0
src/main/java/com/diagbot/client/IcssPush5ServiceClient.java

@@ -0,0 +1,25 @@
+package com.diagbot.client;
+
+
+import com.diagbot.client.hystrix.IcssPush5ServiceHystrix;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.icss5.PushDTO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+
+/**
+ * @Description: ICSS5.0推送
+ * @author: Mark Huang
+ * @time: 2019/12/13 9:52
+ */
+@FeignClient(value = "IcssPush5-service", url="${IcssPush5.url}", fallback = IcssPush5ServiceHystrix.class)
+public interface IcssPush5ServiceClient {
+
+    @PostMapping(value = "/api/ltapi/push/push")
+    RespDTO<PushDTO> getAnnotation(@RequestBody com.diagbot.icss5.PushVO searchData);
+}
+
+
+

+ 18 - 0
src/main/java/com/diagbot/client/hystrix/IcssPush5ServiceHystrix.java

@@ -0,0 +1,18 @@
+package com.diagbot.client.hystrix;
+
+import com.diagbot.client.IcssPush5ServiceClient;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.icss5.PushDTO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
+
+@Component
+@Slf4j
+public class IcssPush5ServiceHystrix implements IcssPush5ServiceClient {
+    @Override
+    public RespDTO<PushDTO> getAnnotation(@RequestBody com.diagbot.icss5.PushVO searchData) {
+        log.error("【hystrix】调用{}异常", "CRF-getAnnotation");
+        return null;
+    }
+}

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

@@ -40,7 +40,7 @@ public class PushFacade {
     public PushDTO pushFacIcss(PushVO pushVo) {
         Map<String, Object> debug = new LinkedHashMap<>();
         long pushStart = System.currentTimeMillis();
-        PushDTO pushDTO = pushProcess.processIcss(pushVo);
+        PushDTO pushDTO = pushProcess.processIcss5(pushVo);
         CoreUtil.getDebugStr(pushStart, "推送耗时", debug);
         pushDTO.setDebug(debug);
         return pushDTO;

+ 16 - 0
src/main/java/com/diagbot/icss5/ConceptBaseDTO.java

@@ -0,0 +1,16 @@
+package com.diagbot.icss5;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 概念出参基础实体类
+ * @author: gaodm
+ * @time: 2019/5/7 9:44
+ */
+@Getter
+@Setter
+public class ConceptBaseDTO {
+    private Long conceptId; // 概念id
+    private String name;    //概念名称
+}

+ 19 - 0
src/main/java/com/diagbot/icss5/ConceptPushDTO.java

@@ -0,0 +1,19 @@
+package com.diagbot.icss5;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:推理返回标签(概念)
+ * @Author:zhaops
+ * @time: 2019/5/7 20:06
+ */
+@Getter
+@Setter
+public class ConceptPushDTO extends ConceptBaseDTO {
+    private Integer libType;  //词性
+    private List<String> clientNames;//数据服务模式调用方名称
+    private Integer type;
+}

+ 153 - 0
src/main/java/com/diagbot/icss5/MRBaseData.java

@@ -0,0 +1,153 @@
+package com.diagbot.icss5;
+
+import com.diagbot.biz.push.entity.Item;
+import com.diagbot.biz.push.entity.Lis;
+import com.diagbot.biz.push.entity.Pacs;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description:病历基本信息
+ * @Author:zhaops
+ * @time: 2019/12/16 16:22
+ */
+@Getter
+@Setter
+public class MRBaseData {
+    /**
+     * 医院编码
+     */
+    private String hosCode = "";
+    /**
+     * 年龄
+     */
+    private Integer age;
+
+    /**
+     * 婚姻
+     */
+    private String marriage = "";
+    /**
+     * 主诉
+     */
+    private String chief = "";
+    /**
+     * 现病史
+     */
+    private String symptom = "";
+    /**
+     * 查体
+     */
+    private String vital = "";
+    /**
+     * 既往史
+     */
+    private String pasts = "";
+    /**
+     * 传染病史
+     */
+    private String infectious = "";
+    /**
+     * 手术外伤史
+     */
+    private String operation = "";
+    /**
+     * 过敏史
+     */
+    private String allergy = "";
+    /**
+     * 接种史
+     */
+    private String vaccination = "";
+    /**
+     * 个人史
+     */
+    private String personal = "";
+    /**
+     * 婚育史
+     */
+    private String marital = "";
+    /**
+     * 家族史
+     */
+    private String family = "";
+    /**
+     * 月经史
+     */
+    private String menstrual = "";
+    /**
+     * 其他史
+     */
+    private String other = "";
+    /**
+     * 化验文本数据
+     */
+    private String lisString = "";
+    /**
+     * 辅检文本数据
+     */
+    private String pacsString = "";
+    /**
+     * 诊断文本数据
+     */
+    private String diagString = "";
+    /**
+     * 药品文本数据
+     */
+    private String drugString = "";
+    /**
+     * 化验项目和结果
+     */
+    private List<Lis> lis = new ArrayList<>();
+    /**
+     * 辅检项目和结果
+     */
+    private List<Pacs> pacs = new ArrayList<>();
+    /**
+     * 诊断
+     */
+    private List<Item> diag = new ArrayList<>();
+    /**
+     * 药品
+     */
+    private List<Item> drug = new ArrayList<>();
+    /**
+     * 当前化验开单项
+     */
+    private List<Lis> lisOrder = new ArrayList<>();
+    /**
+     * 当前辅检开单项
+     */
+    private List<Pacs> pacsOrder = new ArrayList<>();
+    /**
+     * 当前诊断开单项
+     */
+    private List<Item> diagOrder = new ArrayList<>();
+    /**
+     * 当前药品开单项
+     */
+    private List<Item> drugOrder = new ArrayList<>();
+    /**
+     * 当前手术开单项
+     */
+    private List<Item> operationOrder = new ArrayList<>();
+    /**
+     * 其他开单项
+     */
+    private List<Item> otherOrder = new ArrayList<>();
+    /**
+     * 选中诊断
+     */
+    private Item diseaseName;
+    /**
+     * 诊断类型(0-普通病(默认不填),1-慢病,2-急诊)
+     */
+    private Integer disType = 0;
+    /**
+     * 量表名称
+     */
+    private String scaleName = "";
+}

+ 51 - 0
src/main/java/com/diagbot/icss5/PushDTO.java

@@ -0,0 +1,51 @@
+package com.diagbot.icss5;
+
+import com.diagbot.biz.push.entity.MedicalIndication;
+import com.diagbot.biz.push.entity.Treat;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 推理出参
+ * @Author:zhaops
+ * @time: 2018/11/20 13:44
+ */
+@Getter
+@Setter
+public class PushDTO {
+    /**
+     * 症状
+     */
+    private List<ConceptPushDTO> symptom;
+    /**
+     * 体征结果
+     */
+    private List<ConceptPushDTO> vital;
+    /**
+     * 化验
+     */
+    private List<ConceptPushDTO> lab;
+    /**
+     * 辅检
+     */
+    private List<ConceptPushDTO> pacs;
+    /**
+     * 诊断
+     */
+    private Map<String, List<ConceptPushDTO>> dis;
+    /**
+     * 病情提示
+     */
+    private List<MedicalIndication> medicalIndications;
+    /**
+     * 治疗方案
+     */
+    private Treat treat;
+    /**
+     * 有无病情提示标志(0:无,1:有)
+     */
+    private String hasIndications;
+}

+ 15 - 0
src/main/java/com/diagbot/icss5/PushVO.java

@@ -0,0 +1,15 @@
+package com.diagbot.icss5;
+
+import com.diagbot.biz.push.vo.SearchVO;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2018/11/20 13:38
+ */
+@Getter
+@Setter
+public class PushVO extends SearchVO {
+}

+ 40 - 0
src/main/java/com/diagbot/icss5/SearchBaseData.java

@@ -0,0 +1,40 @@
+package com.diagbot.icss5;
+
+import com.diagbot.biz.push.entity.MRBaseData;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:推理通用入参
+ * @Author:zhaops
+ * @time: 2019/12/11 14:16
+ */
+@Getter
+@Setter
+public class SearchBaseData extends MRBaseData {
+    /**
+     * 外部系统编码 用于返回映射数据,如果sysCode为空或null,则返回kl_standard_info标准名称
+     */
+    private String sysCode = "1";
+    /**
+     * 大数据返回内容截取长度
+     */
+    private Integer length = 10;
+
+    /**
+     * 推理类型(1:症状,4:查体结果,41:查体模板,42:查体指标,5:化验,6:辅检,7:诊断,8:治疗方案,11:管理评估,21:量表,22:病情提示-量表、计算公式、可能结果、危急值、开单合理性、异常值等)
+     */
+    private String featureType = "";
+    /**
+     * 规则类型(1:危机值提醒,2:开单合理性,3:管理评估,4:不良反应,5:药物推荐,6:异常值)
+     */
+    private String ruleType = "";
+    /**
+     * 是否映射(0:否,1:是)
+     */
+    private Integer isMapping;
+    /**
+     * 系统类型
+     */
+    private Integer sysType;
+}

+ 19 - 0
src/main/java/com/diagbot/icss5/SearchVO.java

@@ -0,0 +1,19 @@
+package com.diagbot.icss5;
+
+import com.diagbot.biz.push.entity.SearchBaseData;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:推理个性化入参
+ * @Author:zhaops
+ * @time: 2019/12/11 14:18
+ */
+@Getter
+@Setter
+public class SearchVO extends SearchBaseData {
+    /**
+     * 性别(1:男,2:女,3:通用)
+     */
+    private Integer sex;
+}

+ 50 - 0
src/main/java/com/diagbot/process/PushProcess.java

@@ -3,6 +3,7 @@ package com.diagbot.process;
 import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.biz.push.entity.Pacs;
+import com.diagbot.client.IcssPush5ServiceClient;
 import com.diagbot.client.IcssPushServiceClient;
 import com.diagbot.dto.*;
 import com.diagbot.dto.icss.FeatureRate;
@@ -14,6 +15,7 @@ import com.diagbot.enums.MedicalAdviceEnum;
 import com.diagbot.enums.StandConvertEnum;
 import com.diagbot.facade.CommonFacade;
 import com.diagbot.facade.NeoFacade;
+import com.diagbot.icss5.ConceptPushDTO;
 import com.diagbot.util.ListUtil;
 import com.diagbot.vo.IcssVo;
 import com.diagbot.vo.NeoPushVO;
@@ -22,6 +24,7 @@ import com.diagbot.vo.neoPushEntity.Diag;
 import com.diagbot.vo.neoPushEntity.DiagVo;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,6 +47,53 @@ public class PushProcess {
     CommonFacade commonFacade;
     @Autowired
     IcssPushServiceClient icssPushServiceClient;
+    @Autowired
+    IcssPush5ServiceClient icssPush5ServiceClient;
+
+    public PushDTO processIcss5(PushVO pushVo){
+        List<String> ruleTypeList = Arrays.asList(pushVo.getFeatureType().split(","));
+        Map<String, List<String>> typeWords = Maps.newHashMap();
+        int length = pushVo.getLength();
+        PushDTO pushDTO = new PushDTO();
+        com.diagbot.icss5.PushVO icssVo = new com.diagbot.icss5.PushVO();
+        BeanUtils.copyProperties(pushVo,icssVo);
+        icssVo.setAge(new Double(pushVo.getAgeNum()).intValue());
+        icssVo.setFeatureType("7");
+        List<String> allDis = Lists.newArrayList();
+        RespDTO<com.diagbot.icss5.PushDTO> annotation = icssPush5ServiceClient.getAnnotation(icssVo);
+        Map<String, List<ConceptPushDTO>> disess = annotation.data.getDis();
+        if(MapUtils.isNotEmpty(disess)){
+            disess.values().forEach(x ->allDis.addAll(x.stream().map(z->z.getName()).collect(Collectors.toList())));
+        }
+        Map<String, List<PushBaseDTO>> dis = new HashMap<>();
+        if (ListUtil.isNotEmpty(allDis)) {
+            //先把所有疾病推出来
+            if (ruleTypeList.contains("7")) {
+                List<PushBaseDTO> diseeases =  allDis.stream().map(x -> {
+                    PushBaseDTO pushBaseDTO = new PushBaseDTO();
+                    pushBaseDTO.setName(x);
+                    return pushBaseDTO;
+                }).collect(Collectors.toList());
+                diseeases = diseeases.subList(0, diseeases.size() >= length ? length : diseeases.size());
+                dis.put(DiseaseTypeEnum.possibleDis.getName(), diseeases);
+                pushDTO.setDis(dis);
+
+            }
+            //把第一个推送出来的诊断set到diagOrder中,再反推
+            NeoPushVO pushVO = new NeoPushVO();
+            DiagVo diagVo = new DiagVo();
+            diagVo.setDiags(allDis.stream().map(x ->{
+                Diag diag = new Diag();
+                diag.setName(x);
+                return diag;
+            }).collect(Collectors.toList()));
+            pushVO.setDiagVo(diagVo);
+            //调用反推
+            reversePushPackage(length, pushDTO, ruleTypeList, typeWords, pushVO, dis);
+
+        }
+        return pushDTO;
+    }
 
     public PushDTO processIcss(PushVO pushVo){
         List<Item> diag1 = pushVo.getDiag();

+ 3 - 0
src/main/resources/application-local.yml

@@ -159,4 +159,7 @@ StandConvert:
 IcssPush:
   url: http://192.168.2.234:5008
 
+IcssPush5:
+  url: http://192.168.2.236:5050
+
 debugFlag: true