Zhaops 6 gadi atpakaļ
vecāks
revīzija
f469136fec

+ 16 - 0
icss-service/src/main/java/com/diagbot/dto/IntroduceDetailDTO.java

@@ -0,0 +1,16 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2019/3/21 14:13
+ */
+@Getter
+@Setter
+public class IntroduceDetailDTO {
+    private String content;
+    private String text;
+}

+ 13 - 8
icss-service/src/main/java/com/diagbot/facade/TreatmentFacade.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.client.bean.Medicition;
 import com.diagbot.client.bean.MedicitionClass;
+import com.diagbot.dto.IntroduceDetailDTO;
 import com.diagbot.entity.IntroduceDetail;
 import com.diagbot.entity.IntroduceMap;
 import com.diagbot.entity.QuestionInfo;
@@ -12,8 +13,10 @@ import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.QuestionTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
+import com.diagbot.util.BeanUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.FastJsonUtils;
+import com.diagbot.util.ListUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -58,23 +61,25 @@ public class TreatmentFacade {
 
         //一般治疗
         List<IntroduceDetail> commonTreatmentDetailList = getIntroduceDetailList(diseaseId, IntroducePositionEnum.CommonTreatment.getKey());
-        retMap.put("commonTreatment", commonTreatmentDetailList.size() > 0 ? commonTreatmentDetailList.get(0).getContent() : "");
+        IntroduceDetailDTO commonDetailDTO = new IntroduceDetailDTO();
+        if (ListUtil.isNotEmpty(commonTreatmentDetailList)) {
+            BeanUtil.copyProperties(commonTreatmentDetailList.get(0), commonDetailDTO);
+        }
+        retMap.put("commonTreatment", commonDetailDTO);
 
         //手术治疗
         List<IntroduceDetail> surgeryTreatmentDetailList = getIntroduceDetailList(diseaseId, IntroducePositionEnum.SurgeryTreatment.getKey());
-        retMap.put("surgeryTreatment", surgeryTreatmentDetailList.size() > 0 ? surgeryTreatmentDetailList.get(0).getContent() : "");
-
+        IntroduceDetailDTO surgeryDetailDTO = new IntroduceDetailDTO();
+        if (ListUtil.isNotEmpty(surgeryTreatmentDetailList)) {
+            BeanUtil.copyProperties(surgeryTreatmentDetailList.get(0), surgeryDetailDTO);
+        }
+        retMap.put("surgeryTreatment", surgeryDetailDTO);
         //获取知识图谱治疗方案
         JSONObject treatmentJson = treatmentMap.get(disease.getTagName());
         if (treatmentJson == null || treatmentJson.isEmpty()) {
             return retMap;
         }
 
-        /*JSONObject treatmentJson = diseaseJson.getJSONObject(disease.getTagName());
-        if (treatmentJson == null || treatmentJson.isEmpty()) {
-            return retMap;
-        }*/
-
         List<MedicitionClass> drugsList = FastJsonUtils.getJsonToListByKey(treatmentJson.toString(), "treatment", MedicitionClass.class);
 
         List<String> classNameList = drugsList.stream().map(drugs -> drugs.getBigdrugsName()).collect(Collectors.toList());