Procházet zdrojové kódy

Merge remote-tracking branch 'origin/dev/icss' into debug

rgb před 6 roky
rodič
revize
b461e83826
24 změnil soubory, kde provedl 663 přidání a 44 odebrání
  1. 5 1
      config-server/src/main/resources/shared/icss-service-local.yml
  2. 20 0
      icss-service/src/main/java/com/diagbot/client/TreatServiceClient.java
  3. 20 0
      icss-service/src/main/java/com/diagbot/client/bean/Medicition.java
  4. 20 0
      icss-service/src/main/java/com/diagbot/client/bean/MedicitionClass.java
  5. 19 0
      icss-service/src/main/java/com/diagbot/client/bean/ResponseTreatData.java
  6. 23 0
      icss-service/src/main/java/com/diagbot/client/hystrix/TreatServiceHystrix.java
  7. 17 0
      icss-service/src/main/java/com/diagbot/dto/TreatmentDTO.java
  8. 3 1
      icss-service/src/main/java/com/diagbot/enums/QuestionTypeEnum.java
  9. 28 5
      icss-service/src/main/java/com/diagbot/facade/InquiryInfoFacade.java
  10. 136 0
      icss-service/src/main/java/com/diagbot/facade/TreatmentFacade.java
  11. 35 0
      icss-service/src/main/java/com/diagbot/vo/GetLastOtherVO.java
  12. 47 11
      icss-service/src/main/java/com/diagbot/vo/ReadInquiryVO.java
  13. 24 0
      icss-service/src/main/java/com/diagbot/vo/TreatmentVO.java
  14. 20 9
      icss-service/src/main/java/com/diagbot/web/InquiryInfoController.java
  15. 43 0
      icss-service/src/main/java/com/diagbot/web/TreatmentController.java
  16. 62 0
      icssman-service/src/main/java/com/diagbot/dto/RetrievalListDTO.java
  17. 3 1
      icssman-service/src/main/java/com/diagbot/enums/QuestionTypeEnum.java
  18. 42 6
      icssman-service/src/main/java/com/diagbot/facade/RetrievalFacade.java
  19. 10 0
      icssman-service/src/main/java/com/diagbot/mapper/RetrievalMapper.java
  20. 5 0
      icssman-service/src/main/java/com/diagbot/service/RetrievalService.java
  21. 10 1
      icssman-service/src/main/java/com/diagbot/service/impl/RetrievalServiceImpl.java
  22. 27 0
      icssman-service/src/main/java/com/diagbot/vo/RetrievalListVO.java
  23. 22 9
      icssman-service/src/main/java/com/diagbot/web/RetrievalController.java
  24. 22 0
      icssman-service/src/main/resources/mapper/RetrievalMapper.xml

+ 5 - 1
config-server/src/main/resources/shared/icss-service-local.yml

@@ -100,4 +100,8 @@ mybatis-plus:
 
 ai:
   server:
-    address: http://192.168.2.234:8080
+    address: http://192.168.2.234:8080
+
+treat:
+  server:
+    address: http://192.168.3.112:8080

+ 20 - 0
icss-service/src/main/java/com/diagbot/client/TreatServiceClient.java

@@ -0,0 +1,20 @@
+package com.diagbot.client;
+
+import com.diagbot.client.bean.Response;
+import com.diagbot.client.bean.ResponseTreatData;
+import com.diagbot.client.bean.SearchData;
+import com.diagbot.client.hystrix.TreatServiceHystrix;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2018/12/17 15:02
+ */
+@FeignClient(name = "Treat", url = "${treat.server.address}", fallback = TreatServiceHystrix.class)
+public interface TreatServiceClient {
+    @PostMapping(value = "/web/graphdb/treat")
+    Response<ResponseTreatData> treatPageData(@RequestBody SearchData searchData);
+}

+ 20 - 0
icss-service/src/main/java/com/diagbot/client/bean/Medicition.java

@@ -0,0 +1,20 @@
+package com.diagbot.client.bean;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:药品信息
+ * @Author:zhaops
+ * @time: 2018/12/17 13:27
+ */
+@Getter
+@Setter
+public class Medicition {
+    private Long id;
+    private String medicitionName;
+    private String isShow;
+    private String forbidden;
+    private Boolean showInfo;
+    private String rate;
+}

+ 20 - 0
icss-service/src/main/java/com/diagbot/client/bean/MedicitionClass.java

@@ -0,0 +1,20 @@
+package com.diagbot.client.bean;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2018/12/17 13:32
+ */
+@Getter
+@Setter
+public class MedicitionClass {
+    private Long id;
+    private String className;
+    private Boolean showInfo;
+    private List<Medicition> medicitionList;
+}

+ 19 - 0
icss-service/src/main/java/com/diagbot/client/bean/ResponseTreatData.java

@@ -0,0 +1,19 @@
+package com.diagbot.client.bean;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2018/12/17 15:05
+ */
+@Getter
+@Setter
+public class ResponseTreatData {
+    private String status;
+    private Map<String, Map<String, List<MedicitionClass>>> result;
+}

+ 23 - 0
icss-service/src/main/java/com/diagbot/client/hystrix/TreatServiceHystrix.java

@@ -0,0 +1,23 @@
+package com.diagbot.client.hystrix;
+
+import com.diagbot.client.TreatServiceClient;
+import com.diagbot.client.bean.Response;
+import com.diagbot.client.bean.ResponseTreatData;
+import com.diagbot.client.bean.SearchData;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2018/12/17 15:03
+ */
+@Component
+@Slf4j
+public class TreatServiceHystrix implements TreatServiceClient {
+    @Override
+    public Response<ResponseTreatData> treatPageData(SearchData searchData) {
+        log.error("【hystrix】调用{}异常", "treatPageData");
+        return null;
+    }
+}

+ 17 - 0
icss-service/src/main/java/com/diagbot/dto/TreatmentDTO.java

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2018/12/17 13:33
+ */
+@Getter
+@Setter
+public class TreatmentDTO {
+    private Map<String,Object> map;
+}

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

@@ -14,7 +14,9 @@ public enum QuestionTypeEnum implements KeyedNamed {
     Vital(4, "查体"),
     Lis(5, "化验"),
     Pacs(6, "辅检"),
-    Disease(7, "诊断");
+    Disease(7, "诊断"),
+    Drug(8, "药品"),
+    DrugClass(9, "药品分类");
 
     @Setter
     private Integer key;

+ 28 - 5
icss-service/src/main/java/com/diagbot/facade/InquiryInfoFacade.java

@@ -17,6 +17,7 @@ import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.GetInquiryDetailVO;
+import com.diagbot.vo.GetLastOtherVO;
 import com.diagbot.vo.HisInquirysVO;
 import com.diagbot.vo.ReadInquiryVO;
 import com.diagbot.vo.SaveInquiryDetailVO;
@@ -126,9 +127,31 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
      */
     public ReadInquiryDTO readInquiry(ReadInquiryVO readInquiryVO) {
         ReadInquiryDTO readInquiryDTO = new ReadInquiryDTO();
+        QueryWrapper<InquiryInfo> queryWrapper = new QueryWrapper<InquiryInfo>();
+        queryWrapper.eq("is_deleted", "N");
+        queryWrapper.eq("hospital_id", readInquiryVO.getHospitalId());
+        queryWrapper.eq("hospital_dept_id", readInquiryVO.getHospitalDeptId());
+        queryWrapper.eq("doctor_id", readInquiryVO.getDoctorId());
+        queryWrapper.eq("patient_id", readInquiryVO.getPatientId());
+        queryWrapper.eq("inquiry_code", readInquiryVO.getInquiryCode());
+        InquiryInfo inquiryInfo = this.getOne(queryWrapper);
 
-        HospitalInfo hospitalInfo = hospitalInfoFacade.getHospitalByCode(readInquiryVO.getHospitalCode());
-        PatientInfo patientInfo = patientInfoFacade.getPatientByCode(readInquiryVO.getHospitalCode(), readInquiryVO.getPatientCode());
+        if (inquiryInfo != null) {
+            readInquiryDTO.setDataJson(inquiryInfo.getDataJson());
+        }
+
+        return readInquiryDTO;
+    }
+    
+    /**
+     * 获取最近一次其他史信息
+     *
+     * @param readInquiryVO
+     * @return
+     */
+    public String getLastOther(GetLastOtherVO getLastOtherVO) {
+        HospitalInfo hospitalInfo = hospitalInfoFacade.getHospitalByCode(getLastOtherVO.getHospitalCode());
+        PatientInfo patientInfo = patientInfoFacade.getPatientByCode(getLastOtherVO.getHospitalCode(), getLastOtherVO.getPatientCode());
 
         Map<String, Object> map = new HashMap<>();
         map.put("hospitalId", hospitalInfo.getId());
@@ -136,10 +159,10 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
         InquiryInfo inquiryInfo = baseMapper.getPatientLast(map);
 
         if (inquiryInfo != null) {
-            readInquiryDTO.setDataJson(inquiryInfo.getDataJson());
+        	return inquiryInfo.getDataJson();
+        }else{
+        	return null;
         }
-
-        return readInquiryDTO;
     }
 
     /**

+ 136 - 0
icss-service/src/main/java/com/diagbot/facade/TreatmentFacade.java

@@ -0,0 +1,136 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.client.TreatServiceClient;
+import com.diagbot.client.bean.Medicition;
+import com.diagbot.client.bean.MedicitionClass;
+import com.diagbot.client.bean.Response;
+import com.diagbot.client.bean.ResponseTreatData;
+import com.diagbot.client.bean.SearchData;
+import com.diagbot.dto.TreatmentDTO;
+import com.diagbot.entity.IntroduceDetail;
+import com.diagbot.entity.IntroduceMap;
+import com.diagbot.entity.QuestionInfo;
+import com.diagbot.enums.IntroducePositionEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.QuestionTypeEnum;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.vo.TreatmentVO;
+import com.google.common.collect.Lists;
+import feign.QueryMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2018/12/17 13:41
+ */
+@Component
+public class TreatmentFacade {
+    @Autowired
+    QuestionFacade questionFacade;
+    @Autowired
+    IntroduceDetailFacade introduceDetailFacade;
+    @Autowired
+    TreatServiceClient treatServiceClient;
+    @Autowired
+    IntroduceMapFacade introduceMapFacade;
+
+    public TreatmentDTO getTreatment(TreatmentVO treatmentVO) {
+        TreatmentDTO treatmentDTO = new TreatmentDTO();
+        Map<String, Object> retMap = new LinkedHashMap<>();
+
+        SearchData searchData = new SearchData();
+        searchData.setSymptom(treatmentVO.getSymptom());
+        searchData.setVital(treatmentVO.getVital());
+        searchData.setLis(treatmentVO.getLis());
+        searchData.setPacs(treatmentVO.getPacs());
+        searchData.setOther(treatmentVO.getOther());
+        searchData.setDiag(treatmentVO.getDiag());
+
+        Long diseaseId = treatmentVO.getDiseaseId();
+        QuestionInfo disease = questionFacade.getById(diseaseId);
+        //一般治疗
+        QueryWrapper<IntroduceDetail> introduceDetailQueryWrapper = new QueryWrapper<>();
+        String sql = "select introduce_id from icss_introduce_map where question_id=" + diseaseId + " and type=" + QuestionTypeEnum.Disease.getKey();
+        introduceDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .apply("find_in_set({0},'position')", IntroducePositionEnum.CommonTreatment.getKey())
+                .inSql("introduce_id", sql)
+                .orderByAsc("introduce_id", "order_no");
+        List<IntroduceDetail> commonTreatmentDetailList = introduceDetailFacade.list(introduceDetailQueryWrapper);
+        retMap.put("commonTreatment", commonTreatmentDetailList);
+
+        //手术治疗
+        introduceDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .apply("find_in_set({0},'position')", IntroducePositionEnum.SurgeryTreatment.getKey())
+                .inSql("introduce_id", sql)
+                .orderByAsc("introduce_id", "order_no");
+        List<IntroduceDetail> surgeryTreatmentDetailList = introduceDetailFacade.list(introduceDetailQueryWrapper);
+        retMap.put("surgeryTreatment", surgeryTreatmentDetailList);
+
+        //获取知识图谱治疗方案
+        Response<ResponseTreatData> responseTreatData = treatServiceClient.treatPageData(searchData);
+        Map<String, Map<String, List<MedicitionClass>>> resultMap = responseTreatData.getData().getResult();
+        List<MedicitionClass> medicitionClassList = resultMap.get("des").get("treatment");
+
+        List<String> classNameList = medicitionClassList.stream().map(medicitionClass -> medicitionClass.getClassName()).collect(Collectors.toList());
+        QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
+        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).in("tagName", classNameList)
+                .eq("sub_type", 0)
+                .eq("type", QuestionTypeEnum.DrugClass.getKey());
+        List<QuestionInfo> drugClassList = questionFacade.list(questionInfoQueryWrapper);
+        Map<String, QuestionInfo> drugClassMap = EntityUtil.makeEntityMap(drugClassList, "tagName");
+        List<Long> drugClassIds = drugClassList.stream().map(drugClass -> drugClass.getId()).collect(Collectors.toList());
+        QueryWrapper<IntroduceMap> introduceMapQueryWrapper = new QueryWrapper<>();
+        introduceDetailQueryWrapper.in("question_id", drugClassIds)
+                .eq("type", QuestionTypeEnum.DrugClass.getKey())
+                .eq("is_deleted", IsDeleteEnum.N.getKey());
+        List<IntroduceMap> introduceMapList = introduceMapFacade.list(introduceMapQueryWrapper);
+        Map<Long, IntroduceMap> introduceMapMap = EntityUtil.makeEntityMap(introduceMapList, "questionId");
+
+        for (MedicitionClass medicitionClass : medicitionClassList) {
+            QuestionInfo drugClass = drugClassMap.get(medicitionClass.getClassName());
+            if (drugClass != null) {
+                medicitionClass.setId(drugClass.getId());
+                if (introduceMapMap.get(drugClass.getId()) != null) {
+                    medicitionClass.setShowInfo(true);
+                }
+            }
+            List<Medicition> medicitionList = medicitionClass.getMedicitionList();
+            List<String> drugNameList = medicitionList.stream().map(medicition -> medicition.getMedicitionName()).collect(Collectors.toList());
+            QueryWrapper<QuestionInfo> drugListQueryWrapper = new QueryWrapper<>();
+            drugListQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).in("tagName", drugNameList)
+                    .eq("sub_type", 0)
+                    .eq("type", QuestionTypeEnum.Drug.getKey());
+            List<QuestionInfo> drugList = questionFacade.list(drugListQueryWrapper);
+            Map<String, QuestionInfo> drugMap = EntityUtil.makeEntityMap(drugList, "tagName");
+            List<Long> drugIds = drugList.stream().map(drug -> drug.getId()).collect(Collectors.toList());
+            QueryWrapper<IntroduceMap> introduceDrugQueryWrapper = new QueryWrapper<>();
+            introduceDrugQueryWrapper.in("question_id", drugIds)
+                    .eq("type", QuestionTypeEnum.Drug.getKey())
+                    .eq("is_deleted", IsDeleteEnum.N.getKey());
+            List<IntroduceMap> drugIntroduceMapList = introduceMapFacade.list(introduceDrugQueryWrapper);
+            Map<Long, IntroduceMap> drugIntroduceMapMap = EntityUtil.makeEntityMap(drugIntroduceMapList, "questionId");
+            for (Medicition medicition : medicitionList) {
+                QuestionInfo drug = drugMap.get(medicition.getMedicitionName());
+                if (drug != null) {
+                    medicition.setId(drug.getId());
+                    if (drugIntroduceMapMap.get(drug.getId()) != null) {
+                        medicition.setShowInfo(true);
+                    }
+                }
+            }
+            medicitionClass.setMedicitionList(medicitionList);
+        }
+
+        retMap.put("treatment", medicitionClassList);
+        treatmentDTO.setMap(retMap);
+        return treatmentDTO;
+    }
+}

+ 35 - 0
icss-service/src/main/java/com/diagbot/vo/GetLastOtherVO.java

@@ -0,0 +1,35 @@
+package com.diagbot.vo;
+
+import javax.validation.constraints.NotBlank;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: rengb
+ * @time: 2018/11/19 18:58
+ */
+@ApiModel(value="获取最近一次其他史信息接口传参")
+@Getter
+@Setter
+public class GetLastOtherVO {
+	
+	/**
+	 * 医院编号
+	 */
+	@ApiModelProperty(value="医院编号",required=true)
+	@NotBlank(message="医院编号必填")
+	private String hospitalCode;
+	
+	/**
+	 * 医院患者编号
+	 */
+	@ApiModelProperty(value="医院患者编号",required=true)
+	@NotBlank(message="医院患者编号必填")
+	private String patientCode;
+	
+	   
+}

+ 47 - 11
icss-service/src/main/java/com/diagbot/vo/ReadInquiryVO.java

@@ -1,6 +1,7 @@
 package com.diagbot.vo;
 
 import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -17,19 +18,54 @@ import lombok.Setter;
 @Setter
 public class ReadInquiryVO {
 	
-	/**
-	 * 医院编号
-	 */
-	@ApiModelProperty(value="医院编号",required=true)
-	@NotBlank(message="医院编号必填")
-	private String hospitalCode;
+//	/**
+//	 * 医院编号
+//	 */
+//	@ApiModelProperty(value="医院编号",required=true)
+//	@NotBlank(message="医院编号必填")
+//	private String hospitalCode;
+//	
+//	/**
+//	 * 医院患者编号
+//	 */
+//	@ApiModelProperty(value="医院患者编号",required=true)
+//	@NotBlank(message="医院患者编号必填")
+//	private String patientCode;
 	
 	/**
-	 * 医院患者编号
-	 */
-	@ApiModelProperty(value="医院患者编号",required=true)
-	@NotBlank(message="医院患者编号必填")
-	private String patientCode;
+     * 医院id
+     */
+	@ApiModelProperty(value="医院id",required=true)
+	@NotNull(message="医院id必传")
+    private Long hospitalId;
+
+    /**
+     * 科室id
+     */
+	@ApiModelProperty(value="科室id",required=true)
+	@NotNull(message="科室id必传")
+    private Long hospitalDeptId;
+
+    /**
+     * 医生id
+     */
+	@ApiModelProperty(value="医生id",required=true)
+	@NotNull(message="医生id必传")
+    private Long doctorId;
+
+    /**
+     * 患者id
+     */
+	@ApiModelProperty(value="患者id",required=true)
+	@NotNull(message="患者id必传")
+    private Long patientId;
+
+    /**
+     * 就诊序列号
+     */
+	@ApiModelProperty(value="就诊序列号",required=true)
+	@NotBlank(message="就诊序列号必传")
+    private String inquiryCode;
 	
 	   
 }

+ 24 - 0
icss-service/src/main/java/com/diagbot/vo/TreatmentVO.java

@@ -0,0 +1,24 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2018/12/17 13:37
+ */
+@Getter
+@Setter
+public class TreatmentVO {
+    @NotNull(message = "请输入诊断id")
+    private Long diseaseId;
+    private String symptom;
+    private String other;
+    private String vital;
+    private String lis;
+    private String pacs;
+    private String diag;
+}

+ 20 - 9
icss-service/src/main/java/com/diagbot/web/InquiryInfoController.java

@@ -1,6 +1,17 @@
 package com.diagbot.web;
 
 
+import java.util.List;
+
+import javax.validation.Valid;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+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 com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.GetInquiryDetailDTO;
 import com.diagbot.dto.HisInquiryDTO;
@@ -9,20 +20,13 @@ import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.SaveInquiryDTO;
 import com.diagbot.facade.InquiryInfoFacade;
 import com.diagbot.vo.GetInquiryDetailVO;
+import com.diagbot.vo.GetLastOtherVO;
 import com.diagbot.vo.HisInquirysVO;
 import com.diagbot.vo.ReadInquiryVO;
 import com.diagbot.vo.SaveInquiryVO;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-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;
-import java.util.List;
 
 /**
  * @author rengb
@@ -51,6 +55,13 @@ public class InquiryInfoController {
     public RespDTO<ReadInquiryDTO> readInquiry(@Valid @RequestBody ReadInquiryVO readInquiryVO) {
         return RespDTO.onSuc(inquiryInfoFacade.readInquiry(readInquiryVO));
     }
+    
+    @ApiOperation(value = "获取最近一次其他史信息[by:rengb]")
+    @PostMapping("/getLastOther")
+    @SysLogger("getLastOther")
+    public RespDTO<String> getLastOther(@Valid @RequestBody GetLastOtherVO getLastOtherVO) {
+        return RespDTO.onSuc(inquiryInfoFacade.getLastOther(getLastOtherVO));
+    }
 
     @ApiOperation(value = "历史病历列表[by:rengb]")
     @PostMapping("/hisInquirys")

+ 43 - 0
icss-service/src/main/java/com/diagbot/web/TreatmentController.java

@@ -0,0 +1,43 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.TreatmentDTO;
+import com.diagbot.facade.TreatmentFacade;
+import com.diagbot.vo.TreatmentVO;
+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: 2018/12/17 11:42
+ */
+@RestController
+@RequestMapping("/treatment")
+@Api(value = "治疗方案相关API", tags = { "治疗方案相关API" })
+public class TreatmentController {
+    @Autowired
+    TreatmentFacade treatmentFacade;
+
+    @ApiOperation(value = "治疗方案[by:zhaops]",
+            notes = "symptom:症状<br>" +
+                    "other:其它史<br>" +
+                    "vital:查体<br>" +
+                    "lis:化验<br>" +
+                    "pacs:辅检<br>" +
+                    "dis:诊断<br>")
+    @PostMapping("/getTreatment")
+    @SysLogger("getTreatment")
+    public RespDTO<TreatmentDTO> getTreatment(@RequestBody @Valid TreatmentVO treatmentVO) {
+        TreatmentDTO data = treatmentFacade.getTreatment(treatmentVO);
+        return RespDTO.onSuc(data);
+    }
+}

+ 62 - 0
icssman-service/src/main/java/com/diagbot/dto/RetrievalListDTO.java

@@ -0,0 +1,62 @@
+package com.diagbot.dto;
+
+import java.util.Date;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description
+ * @author rgb
+ * @time 2018年12月17日上午10:11:39
+ */
+@ApiModel(value="获取标签同义词列表接口出参")
+@Getter
+@Setter
+public class RetrievalListDTO {
+	
+	/**
+     * 标签id
+     */
+	@ApiModelProperty(value="标签id")
+    private Long questionId;
+	
+	/**
+	 * 标签名称
+	 */
+	@ApiModelProperty(value="标签名称")
+	private String questionName;
+	
+	/**
+	 * 本体
+	 */
+	@ApiModelProperty(value="本体")
+	private String retrievalSelfName;
+	
+	/**
+	 * 别名
+	 */
+	@ApiModelProperty(value="别名")
+	private String retrievalNames;
+	
+	/**
+	 * 子项
+	 */
+	@ApiModelProperty(value="子项")
+	private String retrievalSonNames;
+	
+    /**
+     * 操作人姓名
+     */
+	@ApiModelProperty(value="操作人姓名")
+    private String operatorName;
+    
+    /**
+     * 操作时间
+     */
+	@ApiModelProperty(value="操作时间")
+    private Date gmtOperate;
+
+}

+ 3 - 1
icssman-service/src/main/java/com/diagbot/enums/QuestionTypeEnum.java

@@ -14,7 +14,9 @@ public enum QuestionTypeEnum implements KeyedNamed {
     Vital(4, "查体"),
     Lis(5, "化验"),
     Pacs(6, "辅检"),
-    Disease(7, "诊断");
+    Disease(7, "诊断"),
+    Drug(8, "药品"),
+    DrugClass(9, "药品分类");
 
     @Setter
     private Integer key;

+ 42 - 6
icssman-service/src/main/java/com/diagbot/facade/RetrievalFacade.java

@@ -3,21 +3,31 @@
  */
 package com.diagbot.facade;
 
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.client.UserServiceClient;
 import com.diagbot.dto.AddTagRetrievalDTO;
 import com.diagbot.dto.GetRetrievalsByTagDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.RetrievalListDTO;
 import com.diagbot.entity.Retrieval;
 import com.diagbot.entity.RetrievalMapping;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.RetrievalServiceImpl;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.AddTagRetrievalVO;
 import com.diagbot.vo.DelRetrievalsByMapsVO;
 import com.diagbot.vo.GetRetrievalsByTagVO;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
+import com.diagbot.vo.RetrievalListVO;
 
 /**
  * @author rgb
@@ -29,6 +39,8 @@ public class RetrievalFacade extends RetrievalServiceImpl {
 
     @Autowired
     private RetrievalMappingFacade retrievalMappingFacade;
+    @Autowired
+    private UserServiceClient userServiceClient;
 
     /**
      * 根据标签获取同义词
@@ -48,8 +60,15 @@ public class RetrievalFacade extends RetrievalServiceImpl {
      * @return
      */
     public Boolean delRetrievalsByMaps(DelRetrievalsByMapsVO delRetrievalsByMapsVO) {
-        retrievalMappingFacade.removeByIds(delRetrievalsByMapsVO.getRetrievalMappingIds());
-        return true;
+    	QueryWrapper<RetrievalMapping> mappingQe = new QueryWrapper<>();
+		String userId = UserUtils.getCurrentPrincipleID();
+		RetrievalMapping retrievalMapping = new RetrievalMapping();
+		retrievalMapping.setGmtModified(DateUtil.now());
+		retrievalMapping.setModifier(userId);
+		retrievalMapping.setIsDeleted("Y");
+		mappingQe.in("id", delRetrievalsByMapsVO.getRetrievalMappingIds());
+		retrievalMappingFacade.update(retrievalMapping, mappingQe);
+		return true;
     }
 
     /**
@@ -92,5 +111,22 @@ public class RetrievalFacade extends RetrievalServiceImpl {
         addTagRetrievalDTO.setRetrievalMappingId(retrievalMapping.getId());
         return addTagRetrievalDTO;
     }
+    
+    /**
+	 * 获取标签同义词列表
+	 * @param retrievalListVO
+	 * @return
+	 */
+    public IPage<RetrievalListDTO> retrievalList(RetrievalListVO retrievalListVO) {
+        IPage<RetrievalListDTO> ipage = this.getRetrievalList(retrievalListVO);
+        List<String> ids = ipage.getRecords().stream().map(i->i.getOperatorName()).collect(Collectors.toList());
+        RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);
+        if (respDTO == null || !"0".equals(respDTO.code)) {
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
+                    "获取用户信息失败");
+        }
+        ipage.getRecords().forEach(i->i.setOperatorName(respDTO.data.get(i.getOperatorName())));
+        return ipage;
+    }
 
 }

+ 10 - 0
icssman-service/src/main/java/com/diagbot/mapper/RetrievalMapper.java

@@ -3,9 +3,12 @@ package com.diagbot.mapper;
 import java.util.List;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.GetRetrievalsByTagDTO;
+import com.diagbot.dto.RetrievalListDTO;
 import com.diagbot.entity.Retrieval;
 import com.diagbot.vo.GetRetrievalsByTagVO;
+import com.diagbot.vo.RetrievalListVO;
 
 /**
  * <p>
@@ -23,5 +26,12 @@ public interface RetrievalMapper extends BaseMapper<Retrieval> {
 	 * @return
 	 */
 	List<GetRetrievalsByTagDTO> getRetrievalsByTag(GetRetrievalsByTagVO getRetrievalsByTagVO);
+	
+	/**
+	 * 获取标签同义词列表
+	 * @param retrievalListVO
+	 * @return
+	 */
+	IPage<RetrievalListDTO> getRetrievalList(RetrievalListVO retrievalListVO);
 
 }

+ 5 - 0
icssman-service/src/main/java/com/diagbot/service/RetrievalService.java

@@ -1,7 +1,10 @@
 package com.diagbot.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.RetrievalListDTO;
 import com.diagbot.entity.Retrieval;
+import com.diagbot.vo.RetrievalListVO;
 
 /**
  * <p>
@@ -12,5 +15,7 @@ import com.diagbot.entity.Retrieval;
  * @since 2018-12-03
  */
 public interface RetrievalService extends IService<Retrieval> {
+	
+	IPage<RetrievalListDTO> getRetrievalList(RetrievalListVO retrievalListVO);
 
 }

+ 10 - 1
icssman-service/src/main/java/com/diagbot/service/impl/RetrievalServiceImpl.java

@@ -1,10 +1,14 @@
 package com.diagbot.service.impl;
 
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.RetrievalListDTO;
 import com.diagbot.entity.Retrieval;
 import com.diagbot.mapper.RetrievalMapper;
 import com.diagbot.service.RetrievalService;
-import org.springframework.stereotype.Service;
+import com.diagbot.vo.RetrievalListVO;
 
 /**
  * <p>
@@ -16,5 +20,10 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class RetrievalServiceImpl extends ServiceImpl<RetrievalMapper, Retrieval> implements RetrievalService {
+	
+	@Override
+	public IPage<RetrievalListDTO> getRetrievalList(RetrievalListVO retrievalListVO) {
+		return this.baseMapper.getRetrievalList(retrievalListVO);
+	}
 
 }

+ 27 - 0
icssman-service/src/main/java/com/diagbot/vo/RetrievalListVO.java

@@ -0,0 +1,27 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description
+ * @author rgb
+ * @time 2018年12月17日上午10:08:43
+ */
+@ApiModel(value="获取标签同义词列表接口传参")
+@SuppressWarnings({ "serial", "rawtypes" })
+@Getter
+@Setter
+public class RetrievalListVO extends Page {
+	
+	/**
+	 * 标签名称
+	 */
+	@ApiModelProperty(value="标签名称")
+	private String questionName;
+
+}

+ 22 - 9
icssman-service/src/main/java/com/diagbot/web/RetrievalController.java

@@ -1,24 +1,30 @@
 package com.diagbot.web;
 
+import java.util.List;
+
+import javax.validation.Valid;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+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 com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.AddTagRetrievalDTO;
 import com.diagbot.dto.GetRetrievalsByTagDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.RetrievalListDTO;
 import com.diagbot.facade.RetrievalFacade;
 import com.diagbot.vo.AddTagRetrievalVO;
 import com.diagbot.vo.DelRetrievalsByMapsVO;
 import com.diagbot.vo.GetRetrievalsByTagVO;
+import com.diagbot.vo.RetrievalListVO;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-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;
-import java.util.List;
 
 /**
  * <p>
@@ -61,5 +67,12 @@ public class RetrievalController {
         return RespDTO.onSuc(retrievalFacade.addTagRetrieval(addTagRetrievalVO));
     }
 
+    @ApiOperation(value = "获取标签同义词列表[by:rengb]")
+	@PostMapping("/retrievalList")
+	@SysLogger("retrievalList")
+	public RespDTO<IPage<RetrievalListDTO>> retrievalList(@RequestBody RetrievalListVO retrievalListVO) {
+    	IPage<RetrievalListDTO> ipage = retrievalFacade.retrievalList(retrievalListVO);
+		return RespDTO.onSuc(ipage);
+	}
 
 }

+ 22 - 0
icssman-service/src/main/resources/mapper/RetrievalMapper.xml

@@ -36,5 +36,27 @@
 			AND a.`name`=#{questionName}
 		</if>
 	</select>
+	
+	<select id="getRetrievalList" parameterType="com.diagbot.vo.RetrievalListVO" 
+		resultType="com.diagbot.dto.RetrievalListDTO">
+		SET sql_mode="";
+		SELECT
+		id as questionId,
+		tag_name as questionName,
+		creator as operatorName,
+		gmt_create as gmtOperate,
+		GROUP_CONCAT(CASE WHEN show_type=1 THEN `name` ELSE NULL END SEPARATOR '、') as retrievalSelfName,
+		GROUP_CONCAT(CASE WHEN show_type=2 THEN `name` ELSE NULL END SEPARATOR '、') as retrievalNames,
+		GROUP_CONCAT(CASE WHEN show_type=3 THEN `name` ELSE NULL END SEPARATOR '、') as retrievalSonNames
+		FROM
+		(SELECT
+		a.id,a.tag_name,b.creator,b.gmt_create,b.show_type,c.`name`
+		FROM icss_question_info a LEFT JOIN icss_retrieval_mapping b ON a.id=b.question_id
+		LEFT JOIN icss_retrieval c ON b.retrieval_id=c.id
+		WHERE a.is_deleted='N' AND b.is_deleted='N' AND c.is_deleted='N'
+		AND a.tag_name LIKE CONCAT('%',#{questionName},'%')
+		ORDER BY b.gmt_create DESC) t
+		GROUP BY t.id
+	</select>
 
 </mapper>