Bladeren bron

不良反应关联标签,增加计算接口

Zhaops 6 jaren geleden
bovenliggende
commit
3137729130

+ 3 - 0
icss-service/src/main/java/com/diagbot/client/bean/AdverseReaction.java

@@ -13,7 +13,10 @@ import java.util.List;
 @Getter
 @Setter
 public class AdverseReaction {
+    private Long id;
     private String name;  //名称
+    private String tagName; //标签名称
+    private String showInfo = "0";//是否显示提示信息
     private Integer controlType; //控件类型
     private List<AdverseReactionDetail> details;
 }

+ 1 - 0
icss-service/src/main/java/com/diagbot/client/bean/CalcResult.java

@@ -13,4 +13,5 @@ import lombok.Setter;
 public class CalcResult {
     private Double value;
     private String text;
+    private String unit;
 }

+ 15 - 0
icss-service/src/main/java/com/diagbot/dto/CalculateDTO.java

@@ -0,0 +1,15 @@
+package com.diagbot.dto;
+
+import com.diagbot.client.bean.CalcResult;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:计算结果返回
+ * @Author:zhaops
+ * @time: 2019/4/15 14:52
+ */
+@Getter
+@Setter
+public class CalculateDTO extends CalcResult {
+}

+ 0 - 1
icss-service/src/main/java/com/diagbot/dto/PushDTO.java

@@ -27,5 +27,4 @@ public class PushDTO {
     private List<MedicalIndicationDTO> medicalIndications;
     private List<ScaleContent> scale;
     private List<EvaluationModuleMappingDTO> evaluationModule;
-    private CalcResult calcResult;
 }

+ 10 - 10
icss-service/src/main/java/com/diagbot/enums/ARControlTypeEnum.java

@@ -4,13 +4,13 @@ import com.diagbot.core.KeyedNamed;
 import lombok.Setter;
 
 /**
- * @Description: 不良反应控件类型
+ * @Description: 计算类型
  * @Author:zhaops
- * @time: 2019/3/14 11:16
+ * @time: 2019/4/15 13:57
  */
-public enum  ARControlTypeEnum implements KeyedNamed {
-    Radio(1, "单选"),
-    CheckBox(0, "多选");
+public enum CalculateTypeEnum implements KeyedNamed {
+    Scale(1, "量表计算"),
+    Formula(11, "公式计算");
 
     @Setter
     private Integer key;
@@ -18,13 +18,13 @@ public enum  ARControlTypeEnum implements KeyedNamed {
     @Setter
     private String name;
 
-    ARControlTypeEnum(Integer key, String name) {
+    CalculateTypeEnum(Integer key, String name) {
         this.key = key;
         this.name = name;
     }
 
-    public static ARControlTypeEnum getEnum(Integer key) {
-        for (ARControlTypeEnum item : ARControlTypeEnum.values()) {
+    public static CalculateTypeEnum getEnum(Integer key) {
+        for (CalculateTypeEnum item : CalculateTypeEnum.values()) {
             if (item.key == key) {
                 return item;
             }
@@ -33,7 +33,7 @@ public enum  ARControlTypeEnum implements KeyedNamed {
     }
 
     public static String getName(Integer key) {
-        ARControlTypeEnum item = getEnum(key);
+        CalculateTypeEnum item = getEnum(key);
         return item != null ? item.name : null;
     }
 
@@ -46,4 +46,4 @@ public enum  ARControlTypeEnum implements KeyedNamed {
     public String getName() {
         return name;
     }
-}
+}

+ 1 - 2
icss-service/src/main/java/com/diagbot/enums/FeatureTypeEnum.java

@@ -18,8 +18,7 @@ public enum FeatureTypeEnum implements KeyedNamed {
     Treat(8, "治疗"),
     Scale(21, "量表内容"),
     MedicalIndication(22, "指标"),
-    ManagementEvaluation(11, "管理评估"),
-    Calculate(31,"计算");
+    ManagementEvaluation(11, "管理评估");
 
     @Setter
     private Integer key;

+ 1 - 0
icss-service/src/main/java/com/diagbot/enums/QuestionTypeEnum.java

@@ -17,6 +17,7 @@ public enum QuestionTypeEnum implements KeyedNamed {
     Disease(7, "诊断"),
     Drug(8, "药品"),
     DrugClass(9, "药品分类"),
+    AdverseReaction(10,"不良反应"),
     Scale(21, "量表"),
     MedicalIndication(22, "推送指标");
 

+ 26 - 0
icss-service/src/main/java/com/diagbot/facade/CalculateFacade.java

@@ -0,0 +1,26 @@
+package com.diagbot.facade;
+
+import com.diagbot.client.AiptServiceClient;
+import com.diagbot.dto.CalculateDTO;
+import com.diagbot.vo.CalculateVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2019/4/15 13:45
+ */
+@Component
+public class CalculateFacade {
+    @Autowired
+    AiptServiceClient aiptServiceClient;
+
+    public CalculateDTO calculate(CalculateVO calculateVO) {
+        CalculateDTO calculateDTO = new CalculateDTO();
+        calculateDTO.setValue(10D);
+        calculateDTO.setUnit("ml/min•1.73m2");
+        calculateDTO.setText("肾功能衰竭");
+        return calculateDTO;
+    }
+}

+ 0 - 8
icss-service/src/main/java/com/diagbot/facade/PushFacade.java

@@ -417,14 +417,6 @@ public class PushFacade {
                 pushDTO.setMedicalIndications(medicalIndicationDTOList);
             }
         }
-
-        //公式计算 featuretype=31
-        if (featureTypeSet.contains(String.valueOf(FeatureTypeEnum.Calculate.getKey()))) {
-            CalcResult result = new CalcResult();
-            result.setValue(10D);
-            result.setText("肾功能衰竭");
-            pushDTO.setCalcResult(result);
-        }
         return pushDTO;
     }
 

+ 20 - 2
icss-service/src/main/java/com/diagbot/facade/TreatmentFacade.java

@@ -146,12 +146,30 @@ public class TreatmentFacade {
 
             //不良反应
             List<AdverseReaction> adverseReactionList = FastJsonUtils.getJsonToListByKey(treatmentJson.toString(), "adverseEvent", AdverseReaction.class);
+            List<String> adNameList = adverseReactionList.stream().map(adverseReaction -> adverseReaction.getName()).collect(Collectors.toList());
+            List<QuestionInfo> adList = getTopQuestionList(adNameList, QuestionTypeEnum.AdverseReaction.getKey());
+            Map<String, QuestionInfo> adMap = EntityUtil.makeEntityMap(adList, "tagName");
+            List<Long> adIds = adList.stream().map(ad -> ad.getId()).collect(Collectors.toList());
+            List<IntroduceMap> adIntroduceMapList = getIntroduceMapList(adIds, QuestionTypeEnum.AdverseReaction.getKey());
+            Map<Long, IntroduceMap> adIntroduceMapMap = EntityUtil.makeEntityMap(adIntroduceMapList, "questionId");
+            for (AdverseReaction adverseReaction : adverseReactionList) {
+                adverseReaction.setTagName(adverseReaction.getName());
+                if (null != adMap && adMap.size() > 0) {
+                    QuestionInfo adInfo = adMap.get(adverseReaction.getName());
+                    if (adInfo != null) {
+                        adverseReaction.setId(adInfo.getId());
+                    }
+                    IntroduceMap adIntorduceMap = adIntroduceMapMap.get(adInfo.getId());
+                    if (adIntorduceMap != null) {
+                        adverseReaction.setShowInfo("1");
+                    }
+                }
+            }
             retMap.put("adverseReactions", adverseReactionList);
         }
         return retMap;
     }
 
-
     /**
      * 根据展示位置获取提示信息明细列表
      *
@@ -181,7 +199,7 @@ public class TreatmentFacade {
         QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
         questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
                 .in("tag_name", tagNameList)
-                .eq("sub_type", 0)
+                //.eq("sub_type", 0)
                 .eq("type", type);
         List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
         return questionInfoList;

+ 17 - 0
icss-service/src/main/java/com/diagbot/vo/CalculateVO.java

@@ -0,0 +1,17 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:计算参数
+ * @Author:zhaops
+ * @time: 2019/4/15 13:53
+ */
+@Getter
+@Setter
+public class CalculateVO {
+    private Integer type;
+    private String scale;
+    private String formula;
+}

+ 0 - 1
icss-service/src/main/java/com/diagbot/vo/PushVO.java

@@ -38,5 +38,4 @@ public class PushVO {
     private Integer disType;  //0-普通病(默认不填),1-慢病,2-急诊
     private List<AdverseReaction> adverseReactions; //不良反应
     private List<IndicationResult> medicalIndications;   //推理指标
-    private JSONObject formula;//计算公式
 }

+ 39 - 0
icss-service/src/main/java/com/diagbot/web/CalculateController.java

@@ -0,0 +1,39 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.CalculateDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.CalculateFacade;
+import com.diagbot.vo.CalculateVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+
+/**
+ * @Description:计算相关
+ * @Author:zhaops
+ * @time: 2019/4/15 13:40
+ */
+@RestController
+@RequestMapping("/push")
+@Api(value = "计算相关API", tags = { "2期-计算相关API" })
+public class CalculateController {
+    @Autowired
+    CalculateFacade calculateFacade;
+
+    @ApiOperation(value = "推理结果计算接口[by:zhaops]",
+            notes = "type: 1-量表,11-计算公式(必填),Integer<br>" +
+                    "scale:量表填写内容,String<br>" +
+                    "formula:计算公式填写内容,String<br>")
+    @PostMapping("/calculate")
+    @SysLogger("calculate")
+    public RespDTO<CalculateDTO> calculate(@RequestBody @Valid CalculateVO calculateVO) {
+        return RespDTO.onSuc(calculateFacade.calculate(calculateVO));
+    }
+}