Переглянути джерело

生成push入参,供图谱调用

kongwz 4 роки тому
батько
коміт
951b3ccce3
21 змінених файлів з 365 додано та 28 видалено
  1. 89 23
      src/main/java/com/diagbot/facade/CommonFacade.java
  2. 6 5
      src/main/java/com/diagbot/facade/PushFacade.java
  3. 17 0
      src/main/java/com/diagbot/process/PushProcess.java
  4. 10 0
      src/main/java/com/diagbot/vo/NeoPushVO.java
  5. 13 0
      src/main/java/com/diagbot/vo/neoPushEntity/Allergy.java
  6. 13 0
      src/main/java/com/diagbot/vo/neoPushEntity/AllergyFood.java
  7. 13 0
      src/main/java/com/diagbot/vo/neoPushEntity/AllergyMedicine.java
  8. 13 0
      src/main/java/com/diagbot/vo/neoPushEntity/BloodTransfusion.java
  9. 16 0
      src/main/java/com/diagbot/vo/neoPushEntity/ChiefPushVo.java
  10. 12 0
      src/main/java/com/diagbot/vo/neoPushEntity/Diag.java
  11. 13 0
      src/main/java/com/diagbot/vo/neoPushEntity/DiagInfectious.java
  12. 12 0
      src/main/java/com/diagbot/vo/neoPushEntity/Drug.java
  13. 13 0
      src/main/java/com/diagbot/vo/neoPushEntity/GeneralVo.java
  14. 16 0
      src/main/java/com/diagbot/vo/neoPushEntity/LisPushVo.java
  15. 13 0
      src/main/java/com/diagbot/vo/neoPushEntity/Operation.java
  16. 16 0
      src/main/java/com/diagbot/vo/neoPushEntity/PacsPushVo.java
  17. 25 0
      src/main/java/com/diagbot/vo/neoPushEntity/PastPushVo.java
  18. 17 0
      src/main/java/com/diagbot/vo/neoPushEntity/PresentPushVo.java
  19. 12 0
      src/main/java/com/diagbot/vo/neoPushEntity/Symptom.java
  20. 13 0
      src/main/java/com/diagbot/vo/neoPushEntity/Vaccinate.java
  21. 13 0
      src/main/java/com/diagbot/vo/neoPushEntity/Wound.java

+ 89 - 23
src/main/java/com/diagbot/facade/CommonFacade.java

@@ -6,15 +6,13 @@ import com.diagbot.client.CRFServiceClient;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.enums.StandConvertEnum;
 import com.diagbot.model.ai.AIAnalyze;
-import com.diagbot.model.label.ChiefLabel;
-import com.diagbot.model.label.DiagLabel;
-import com.diagbot.model.label.PastLabel;
-import com.diagbot.model.label.PresentLabel;
-import com.diagbot.model.label.VitalLabel;
+import com.diagbot.model.label.*;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.vo.NeoPushVO;
 import com.diagbot.vo.SearchData;
 import com.diagbot.vo.StandConvert;
+import com.diagbot.vo.neoPushEntity.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -35,8 +33,8 @@ public class CommonFacade {
     CRFServiceClient crfServiceClient;
 
     //组装好的label
-    public WordCrfDTO crf_process(SearchData searchData){
-        
+    public WordCrfDTO crf_process(SearchData searchData) {
+
         AIAnalyze aiAnalyze = new AIAnalyze(crfServiceClient);
         WordCrfDTO wordCrfDTO = new WordCrfDTO();
         wordCrfDTO.setAge(searchData.getAge());
@@ -52,7 +50,7 @@ public class CommonFacade {
     }
 
     //返回给图谱的词,这些词需要转换成标准词
-    public StandConvert dataTypeGet(WordCrfDTO wordCrfDTO){
+    public StandConvert dataTypeGet(WordCrfDTO wordCrfDTO) {
         StandConvert standConvert = new StandConvert();
 
         //所有的症状(主诉、现病史)
@@ -73,17 +71,17 @@ public class CommonFacade {
 
         //所有化验(结构化数据)
         List<Lis> lis = wordCrfDTO.getLis();
-        if(ListUtil.isNotEmpty(lis)){
+        if (ListUtil.isNotEmpty(lis)) {
             List<String> lis_unique = lis.stream().filter(x -> StringUtils.isBlank(x.getUniqueName()))
-                    .map(x ->x.getName()+x.getDetailName()).collect(Collectors.toList());
+                    .map(x -> x.getName() + x.getDetailName()).collect(Collectors.toList());
             standConvert.setLisList(lis_unique);
         }
 
         //所有辅助检查(结构化数据)
         List<Pacs> pacs = wordCrfDTO.getPacs();
-        if(ListUtil.isNotEmpty(pacs)){
+        if (ListUtil.isNotEmpty(pacs)) {
             List<String> pacss_unique = pacs.stream().filter(x -> StringUtils.isBlank(x.getUniqueName()))
-                    .map(x ->x.getName()).collect(Collectors.toList());
+                    .map(x -> x.getName()).collect(Collectors.toList());
             standConvert.setPacsList(pacss_unique);
         }
 
@@ -115,7 +113,7 @@ public class CommonFacade {
     }
 
     //把图谱返回的标准词set到label中
-    public void dataTypeSet(WordCrfDTO wordCrfDTO, Map<String, Map<String, String>> map){
+    public void dataTypeSet(WordCrfDTO wordCrfDTO, Map<String, Map<String, String>> map) {
         ChiefLabel chiefLabel = wordCrfDTO.getChiefLabel();
         PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
         PastLabel pastLabel = wordCrfDTO.getPastLabel();
@@ -125,22 +123,90 @@ public class CommonFacade {
         VitalLabel vitalLabel = wordCrfDTO.getVitalLabel();
 
         //症状回填
-        CoreUtil.setPropertyList(chiefLabel.getClinicals(),map.get(StandConvertEnum.clinical.getName()));
-        CoreUtil.setPropertyList(presentLabel.getClinicals(),map.get(StandConvertEnum.clinical.getName()));
+        CoreUtil.setPropertyList(chiefLabel.getClinicals(), map.get(StandConvertEnum.clinical.getName()));
+        CoreUtil.setPropertyList(presentLabel.getClinicals(), map.get(StandConvertEnum.clinical.getName()));
         //诊断回填
-        CoreUtil.setPropertyList(diagLabel.getDiags(),map.get(StandConvertEnum.disease.getName()));
+        CoreUtil.setPropertyList(diagLabel.getDiags(), map.get(StandConvertEnum.disease.getName()));
         //药品回填
-        CoreUtil.setPropertyList(presentLabel.getMedicines(),map.get(StandConvertEnum.drug.getName()));
-        CoreUtil.setPropertyList(pastLabel.getAllergyMedicines(),map.get(StandConvertEnum.drug.getName()));
+        CoreUtil.setPropertyList(presentLabel.getMedicines(), map.get(StandConvertEnum.drug.getName()));
+        CoreUtil.setPropertyList(pastLabel.getAllergyMedicines(), map.get(StandConvertEnum.drug.getName()));
         // TODO: 2020/8/5 化验回填
-        CoreUtil.setPropertyList(lis,"name","detailName","uniqueName",map.get(StandConvertEnum.lis.getName()));
+        CoreUtil.setPropertyList(lis, "name", "detailName", "uniqueName", map.get(StandConvertEnum.lis.getName()));
         // TODO: 2020/8/5 辅助检查回填
-        CoreUtil.setPropertyList(pacs,"name","uniqueName",map.get(StandConvertEnum.pacs.getName()));
+        CoreUtil.setPropertyList(pacs, "name", "uniqueName", map.get(StandConvertEnum.pacs.getName()));
         //体征回填
-        CoreUtil.setPropertyList(vitalLabel.getVitals(),map.get(StandConvertEnum.vital.getName()));
+        CoreUtil.setPropertyList(vitalLabel.getVitals(), map.get(StandConvertEnum.vital.getName()));
         //手术回填
-        CoreUtil.setPropertyList(presentLabel.getOperations(),map.get(StandConvertEnum.operation.getName()));
-        CoreUtil.setPropertyList(pastLabel.getOperations(),map.get(StandConvertEnum.operation.getName()));
+        CoreUtil.setPropertyList(presentLabel.getOperations(), map.get(StandConvertEnum.operation.getName()));
+        CoreUtil.setPropertyList(pastLabel.getOperations(), map.get(StandConvertEnum.operation.getName()));
+    }
+
+    /**
+     * 生成给图谱的入参(推送)
+     */
+    public NeoPushVO generatePushImput(WordCrfDTO wordCrfDTO) {
+        NeoPushVO pushVO = new NeoPushVO();
+        ChiefLabel chiefLabel = wordCrfDTO.getChiefLabel();
+        PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
+        PastLabel pastLabel = wordCrfDTO.getPastLabel();
+        List<Lis> lis = wordCrfDTO.getLis();
+        List<Pacs> pacs = wordCrfDTO.getPacs();
+        pushVO.setAge(wordCrfDTO.getAge());
+        pushVO.setSex(wordCrfDTO.getSex());
+        if (chiefLabel != null) {
+            List<Symptom> cjiefClinicals = chiefLabel.getClinicals().stream().filter(x -> x.getNegative() == null).map(z ->
+            {
+                Symptom symptom = new Symptom();
+                symptom.setName(z.getStandName());
+                return symptom;
+            }).collect(Collectors.toList());
+            if (ListUtil.isNotEmpty(cjiefClinicals)) {
+                ChiefPushVo chiefPushVo = new ChiefPushVo();
+                chiefPushVo.setSymptoms(cjiefClinicals);
+                pushVO.setChiefPushVo(chiefPushVo);
+            }
+        }
+        if(presentLabel != null){
+            PresentPushVo presentPushVo = new PresentPushVo();
+            List<Symptom> presentClinicals = presentLabel.getClinicals().stream().filter(x -> x.getNegative() == null).map(z ->
+            {
+                Symptom symptom = new Symptom();
+                symptom.setName(z.getStandName());
+                return symptom;
+            }).collect(Collectors.toList());
+            presentPushVo.setSymptoms(presentClinicals);
+
+            List<Diag> presentdiags = presentLabel.getDiags().stream().filter(x -> x.getNegative() == null).map(z ->
+            {
+                Diag diag = new Diag();
+                diag.setName(z.getStandName());
+                return diag;
+            }).collect(Collectors.toList());
+            presentPushVo.setDiags(presentdiags);
+
+            List<Drug> presentdrugs = presentLabel.getMedicines().stream().filter(x -> x.getNegative() == null).map(z ->
+            {
+                Drug drug = new Drug();
+                drug.setName(z.getStandName());
+                return drug;
+            }).collect(Collectors.toList());
+            presentPushVo.setDrugs(presentdrugs);
+
+            pushVO.setPresentPushVo(presentPushVo);
+        }
+        if(ListUtil.isNotEmpty(lis)){
+            LisPushVo lisPushVo = new LisPushVo();
+            lisPushVo.setLises(lis);
+            pushVO.setLisPushVo(lisPushVo);
+        }
+        if(ListUtil.isNotEmpty(pacs)){
+            PacsPushVo pacsPushVo = new PacsPushVo();
+            pacsPushVo.setPacs(pacs);
+            pushVO.setPacsPushVo(pacsPushVo);
+        }
+
+        return pushVO;
     }
 
 }
+

+ 6 - 5
src/main/java/com/diagbot/facade/PushFacade.java

@@ -4,12 +4,9 @@ import com.diagbot.biz.push.entity.Item;
 import com.diagbot.dto.PushBaseDTO;
 import com.diagbot.dto.PushDTO;
 import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.process.PushProcess;
 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 com.diagbot.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -31,6 +28,8 @@ public class PushFacade {
     NeoFacade neoFacade;
     @Autowired
     CommonFacade commonFacade;
+    @Autowired
+    PushProcess pushProcess;
 
     /**
      * 推送业务
@@ -46,6 +45,8 @@ public class PushFacade {
         StandConvert standConvert = commonFacade.dataTypeGet(wordCrfDTO);
         Map<String, Map<String, String>> standConvertMap = neoFacade.standConvert(standConvert);
         commonFacade.dataTypeSet(wordCrfDTO, standConvertMap);
+        //生成push入参,供图谱调用
+        NeoPushVO pushVO = commonFacade.generatePushImput(wordCrfDTO);
 
         List<String> ruleTypeList = Arrays.asList(pushVo.getFeatureType().split(","));
 

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

@@ -0,0 +1,17 @@
+package com.diagbot.process;
+
+import com.diagbot.dto.WordCrfDTO;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 19:42
+ */
+@Component
+public class PushProcess {
+    public void process(WordCrfDTO wordCrfDTO) {
+
+    }
+}
+

+ 10 - 0
src/main/java/com/diagbot/vo/NeoPushVO.java

@@ -1,13 +1,23 @@
 package com.diagbot.vo;
 
+import com.diagbot.vo.neoPushEntity.*;
 import lombok.Data;
 
 /**
  * @Description: 图谱推理入参
  * @Author:zhoutg
  * @time: 2020/7/29 15:34
+ * 现病史
  */
 @Data
 public class NeoPushVO {
+    private Integer age;
+    // 性别(1:男,2:女)
+    private Integer sex;
+    private ChiefPushVo chiefPushVo;//主诉
+    private PresentPushVo presentPushVo;//现病史
+    private PastPushVo pastPushVo;//既往史
+    private LisPushVo lisPushVo;//化验
+    private PacsPushVo pacsPushVo;//辅检
 
 }

+ 13 - 0
src/main/java/com/diagbot/vo/neoPushEntity/Allergy.java

@@ -0,0 +1,13 @@
+package com.diagbot.vo.neoPushEntity;
+
+import lombok.Data;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 16:13
+ * 过敏史
+ */
+@Data
+public class Allergy extends GeneralVo {
+}

+ 13 - 0
src/main/java/com/diagbot/vo/neoPushEntity/AllergyFood.java

@@ -0,0 +1,13 @@
+package com.diagbot.vo.neoPushEntity;
+
+import lombok.Data;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 16:14
+ * 食物过敏史
+ */
+@Data
+public class AllergyFood extends GeneralVo {
+}

+ 13 - 0
src/main/java/com/diagbot/vo/neoPushEntity/AllergyMedicine.java

@@ -0,0 +1,13 @@
+package com.diagbot.vo.neoPushEntity;
+
+import lombok.Data;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 16:14
+ * 药物过敏史
+ */
+@Data
+public class AllergyMedicine extends GeneralVo {
+}

+ 13 - 0
src/main/java/com/diagbot/vo/neoPushEntity/BloodTransfusion.java

@@ -0,0 +1,13 @@
+package com.diagbot.vo.neoPushEntity;
+
+import lombok.Data;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 16:16
+ * 输血史
+ */
+@Data
+public class BloodTransfusion extends GeneralVo {
+}

+ 16 - 0
src/main/java/com/diagbot/vo/neoPushEntity/ChiefPushVo.java

@@ -0,0 +1,16 @@
+package com.diagbot.vo.neoPushEntity;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 15:42
+ * 主诉
+ */
+@Data
+public class ChiefPushVo {
+    private List<Symptom> symptoms;
+}

+ 12 - 0
src/main/java/com/diagbot/vo/neoPushEntity/Diag.java

@@ -0,0 +1,12 @@
+package com.diagbot.vo.neoPushEntity;
+
+import lombok.Data;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 16:02
+ */
+@Data
+public class Diag extends GeneralVo{
+}

+ 13 - 0
src/main/java/com/diagbot/vo/neoPushEntity/DiagInfectious.java

@@ -0,0 +1,13 @@
+package com.diagbot.vo.neoPushEntity;
+
+import lombok.Data;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 16:12
+ * 传染病史
+ */
+@Data
+public class DiagInfectious extends GeneralVo {
+}

+ 12 - 0
src/main/java/com/diagbot/vo/neoPushEntity/Drug.java

@@ -0,0 +1,12 @@
+package com.diagbot.vo.neoPushEntity;
+
+import lombok.Data;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 16:02
+ */
+@Data
+public class Drug extends GeneralVo{
+}

+ 13 - 0
src/main/java/com/diagbot/vo/neoPushEntity/GeneralVo.java

@@ -0,0 +1,13 @@
+package com.diagbot.vo.neoPushEntity;
+
+import lombok.Data;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 15:45
+ */
+@Data
+public class GeneralVo {
+    private String name;
+}

+ 16 - 0
src/main/java/com/diagbot/vo/neoPushEntity/LisPushVo.java

@@ -0,0 +1,16 @@
+package com.diagbot.vo.neoPushEntity;
+
+import com.diagbot.biz.push.entity.Lis;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 17:10
+ */
+@Data
+public class LisPushVo {
+    private List<Lis> lises;
+}

+ 13 - 0
src/main/java/com/diagbot/vo/neoPushEntity/Operation.java

@@ -0,0 +1,13 @@
+package com.diagbot.vo.neoPushEntity;
+
+import lombok.Data;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 16:17
+ * 手术史
+ */
+@Data
+public class Operation extends GeneralVo {
+}

+ 16 - 0
src/main/java/com/diagbot/vo/neoPushEntity/PacsPushVo.java

@@ -0,0 +1,16 @@
+package com.diagbot.vo.neoPushEntity;
+
+import com.diagbot.biz.push.entity.Pacs;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 17:10
+ */
+@Data
+public class PacsPushVo {
+    private List<Pacs> pacs;
+}

+ 25 - 0
src/main/java/com/diagbot/vo/neoPushEntity/PastPushVo.java

@@ -0,0 +1,25 @@
+package com.diagbot.vo.neoPushEntity;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 15:42
+ * 既往史
+ */
+@Data
+public class PastPushVo {
+    private List<Diag> diags;//疾病史
+    private List<Wound> wounds;//外伤史
+    private List<DiagInfectious> diagInfectious;//传染病史
+//    private List<Allergy> allergies;//过敏史
+    private List<AllergyFood> allergyFoods;//食物过敏史
+    private List<AllergyMedicine> allergyMedicines;//药物过敏史
+    private List<BloodTransfusion> bloodTransfusions;//输血史
+    private List<Operation> operations;//手术史
+    private List<Vaccinate> vaccinates;//预防接种史
+
+}

+ 17 - 0
src/main/java/com/diagbot/vo/neoPushEntity/PresentPushVo.java

@@ -0,0 +1,17 @@
+package com.diagbot.vo.neoPushEntity;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 15:42
+ */
+@Data
+public class PresentPushVo {
+    private List<Symptom> symptoms;
+    private List<Diag> diags;
+    private List<Drug> drugs;
+}

+ 12 - 0
src/main/java/com/diagbot/vo/neoPushEntity/Symptom.java

@@ -0,0 +1,12 @@
+package com.diagbot.vo.neoPushEntity;
+
+import lombok.Data;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 15:55
+ */
+@Data
+public class Symptom extends GeneralVo {
+}

+ 13 - 0
src/main/java/com/diagbot/vo/neoPushEntity/Vaccinate.java

@@ -0,0 +1,13 @@
+package com.diagbot.vo.neoPushEntity;
+
+import lombok.Data;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 16:18
+ * 预防接种史
+ */
+@Data
+public class Vaccinate extends GeneralVo {
+}

+ 13 - 0
src/main/java/com/diagbot/vo/neoPushEntity/Wound.java

@@ -0,0 +1,13 @@
+package com.diagbot.vo.neoPushEntity;
+
+import lombok.Data;
+
+/**
+ * @author kwz
+ * @date 2020/8/17
+ * @time 16:10
+ * 外伤史
+ */
+@Data
+public class Wound extends GeneralVo {
+}