Kaynağa Gözat

智能预问诊模板维护

wangyu 6 yıl önce
ebeveyn
işleme
91baf5ce03
45 değiştirilmiş dosya ile 2193 ekleme ve 0 silme
  1. 42 0
      precman-service/src/main/java/com/diagbot/client/KnowledgemanServiceClient.java
  2. 47 0
      precman-service/src/main/java/com/diagbot/client/hystrix/KnowledgemanServiceHystrix.java
  3. 16 0
      precman-service/src/main/java/com/diagbot/dto/ConceptBaseDTO.java
  4. 15 0
      precman-service/src/main/java/com/diagbot/dto/DeptDTO.java
  5. 15 0
      precman-service/src/main/java/com/diagbot/dto/DisDTO.java
  6. 20 0
      precman-service/src/main/java/com/diagbot/dto/GetAllDeptAndDisInfoDTO.java
  7. 54 0
      precman-service/src/main/java/com/diagbot/dto/GetModuleDetailInfoDTO.java
  8. 30 0
      precman-service/src/main/java/com/diagbot/dto/GetModuleInfoOneDTO.java
  9. 19 0
      precman-service/src/main/java/com/diagbot/dto/GetModuleTypeDTO.java
  10. 25 0
      precman-service/src/main/java/com/diagbot/dto/GetQuestionInfoDTO.java
  11. 16 0
      precman-service/src/main/java/com/diagbot/dto/GetQuestiongAndModuleRelationsDTO.java
  12. 23 0
      precman-service/src/main/java/com/diagbot/dto/ModuleInfoDTO.java
  13. 23 0
      precman-service/src/main/java/com/diagbot/dto/ModuleInfoListDTO.java
  14. 99 0
      precman-service/src/main/java/com/diagbot/entity/ModuleDetail.java
  15. 84 0
      precman-service/src/main/java/com/diagbot/entity/ModuleInfo.java
  16. 49 0
      precman-service/src/main/java/com/diagbot/enums/ModuleInfoTypeEnum.java
  17. 57 0
      precman-service/src/main/java/com/diagbot/enums/QuestionTypeEnum.java
  18. 178 0
      precman-service/src/main/java/com/diagbot/facade/ModuleDetailFacade.java
  19. 582 0
      precman-service/src/main/java/com/diagbot/facade/ModuleInfoFacade.java
  20. 21 0
      precman-service/src/main/java/com/diagbot/mapper/ModuleDetailMapper.java
  21. 30 0
      precman-service/src/main/java/com/diagbot/mapper/ModuleInfoMapper.java
  22. 11 0
      precman-service/src/main/java/com/diagbot/mapper/QuestionInfoMapper.java
  23. 34 0
      precman-service/src/main/java/com/diagbot/service/ModuleDetailService.java
  24. 36 0
      precman-service/src/main/java/com/diagbot/service/ModuleInfoService.java
  25. 10 0
      precman-service/src/main/java/com/diagbot/service/QuestionInfoService.java
  26. 31 0
      precman-service/src/main/java/com/diagbot/service/impl/ModuleDetailServiceImpl.java
  27. 34 0
      precman-service/src/main/java/com/diagbot/service/impl/ModuleInfoServiceImpl.java
  28. 8 0
      precman-service/src/main/java/com/diagbot/service/impl/QuestionInfoServiceImpl.java
  29. 22 0
      precman-service/src/main/java/com/diagbot/vo/AddModuleDetailVO.java
  30. 29 0
      precman-service/src/main/java/com/diagbot/vo/AddModuleInfoVO.java
  31. 18 0
      precman-service/src/main/java/com/diagbot/vo/ConceptSearchVO.java
  32. 17 0
      precman-service/src/main/java/com/diagbot/vo/ConceptTypeVO.java
  33. 16 0
      precman-service/src/main/java/com/diagbot/vo/DeleteModuleVO.java
  34. 19 0
      precman-service/src/main/java/com/diagbot/vo/GetAllDeptAndDisInfoVO.java
  35. 20 0
      precman-service/src/main/java/com/diagbot/vo/GetModuleDetailInfoVO.java
  36. 18 0
      precman-service/src/main/java/com/diagbot/vo/GetModuleInfoOneVO.java
  37. 25 0
      precman-service/src/main/java/com/diagbot/vo/GetModuleInfoVO.java
  38. 19 0
      precman-service/src/main/java/com/diagbot/vo/GetModuleTypeVO.java
  39. 16 0
      precman-service/src/main/java/com/diagbot/vo/GetQuestiongAndModuleRelationsVO.java
  40. 37 0
      precman-service/src/main/java/com/diagbot/vo/ModuleGetQuestionInfoVO.java
  41. 29 0
      precman-service/src/main/java/com/diagbot/vo/UpdateModuleInfoVO.java
  42. 183 0
      precman-service/src/main/java/com/diagbot/web/ModuleInfoController.java
  43. 41 0
      precman-service/src/main/resources/mapper/ModuleDetailMapper.xml
  44. 44 0
      precman-service/src/main/resources/mapper/ModuleInfoMapper.xml
  45. 31 0
      precman-service/src/main/resources/mapper/QuestionInfoMapper.xml

+ 42 - 0
precman-service/src/main/java/com/diagbot/client/KnowledgemanServiceClient.java

@@ -0,0 +1,42 @@
+package com.diagbot.client;
+
+import com.diagbot.client.hystrix.KnowledgemanServiceHystrix;
+import com.diagbot.dto.ConceptBaseDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.vo.ConceptSearchVO;
+import com.diagbot.vo.ConceptTypeVO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:调用中间层服务
+ * @Author: Mark Huang
+ * @time: 2019/03/25 19:15
+ */
+@FeignClient(value = "knowledgeman-service", fallback = KnowledgemanServiceHystrix.class)
+public interface KnowledgemanServiceClient {
+
+
+
+    /**
+     * 根据概念Id列表获取概念列表Map
+     *
+     * @param conceptSearchVO 搜索参数
+     * @return 术语id和术语 Map
+     */
+    @PostMapping("/concept/getConceptMap")
+    RespDTO<Map<Long, String>> getConceptMap(@RequestBody ConceptSearchVO conceptSearchVO);
+
+    /**
+     * 根据类型获取术语列表(科室、辅检、慢病)
+     *
+     * @param conceptTypeVO 类型 type: 1:科室、2:辅检、3:慢病
+     * @return 术语列表
+     */
+    @PostMapping("/concept/getConceptListByType")
+    RespDTO<List<ConceptBaseDTO>> getConceptListByType(@RequestBody ConceptTypeVO conceptTypeVO);
+}

+ 47 - 0
precman-service/src/main/java/com/diagbot/client/hystrix/KnowledgemanServiceHystrix.java

@@ -0,0 +1,47 @@
+package com.diagbot.client.hystrix;
+
+import com.diagbot.client.KnowledgemanServiceClient;
+import com.diagbot.dto.ConceptBaseDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.vo.ConceptSearchVO;
+import com.diagbot.vo.ConceptTypeVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:调用中间层服务
+ * @Author: Mark Huang
+ * @time: 2019/03/25 19:15
+ */
+@Component
+@Slf4j
+public class KnowledgemanServiceHystrix implements KnowledgemanServiceClient {
+
+    /**
+     * 根据概念Id列表获取概念列表Map
+     *
+     * @param conceptSearchVO 搜索参数
+     * @return 术语id和术语 Map
+     */
+    @Override
+    public RespDTO<Map<Long, String>> getConceptMap(@RequestBody ConceptSearchVO conceptSearchVO) {
+        log.error("【hystrix】调用{}异常", "getConceptMap");
+        return null;
+    }
+
+    /**
+     * 根据类型获取术语列表(科室、辅检、慢病)
+     *
+     * @param conceptTypeVO 类型
+     * @return 术语列表
+     */
+    public RespDTO<List<ConceptBaseDTO>> getConceptListByType(@RequestBody ConceptTypeVO conceptTypeVO){
+        log.error("【hystrix】调用{}异常", "getConceptListByType");
+        return null;
+    }
+
+}

+ 16 - 0
precman-service/src/main/java/com/diagbot/dto/ConceptBaseDTO.java

@@ -0,0 +1,16 @@
+package com.diagbot.dto;
+
+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;    //概念名称
+}

+ 15 - 0
precman-service/src/main/java/com/diagbot/dto/DeptDTO.java

@@ -0,0 +1,15 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2019/4/9 14:27
+ */
+@Setter
+@Getter
+public class DeptDTO extends ConceptBaseDTO {
+
+}

+ 15 - 0
precman-service/src/main/java/com/diagbot/dto/DisDTO.java

@@ -0,0 +1,15 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2019/4/9 14:27
+ */
+@Setter
+@Getter
+public class DisDTO extends ConceptBaseDTO{
+
+}

+ 20 - 0
precman-service/src/main/java/com/diagbot/dto/GetAllDeptAndDisInfoDTO.java

@@ -0,0 +1,20 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2019/4/9 14:25
+ */
+@Setter
+@Getter
+public class GetAllDeptAndDisInfoDTO {
+
+    private List<DeptDTO> deptDTOS;
+
+    private List<DisDTO> disDTOS;
+}

+ 54 - 0
precman-service/src/main/java/com/diagbot/dto/GetModuleDetailInfoDTO.java

@@ -0,0 +1,54 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/12/28 13:35
+ */
+@Setter
+@Getter
+public class GetModuleDetailInfoDTO {
+
+    /**
+     * 前置内容
+     */
+    private String prefix;
+
+    /**
+     * 后置内容
+     */
+    private String suffix;
+
+    /**
+     * questionId
+     */
+    private Long questionId;
+
+    /**
+     * 标签名
+     */
+    private String tagName;
+
+    /**
+     * 标签类型
+     */
+    private Integer tagType;
+
+    /**
+     * 关联模板
+     */
+    private Long relationModule;
+
+    /**
+     * 子模板名称
+     */
+    private String relationModuleName;
+
+    /**
+     * 特殊标识
+     */
+    private String flag;
+}

+ 30 - 0
precman-service/src/main/java/com/diagbot/dto/GetModuleInfoOneDTO.java

@@ -0,0 +1,30 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/12/28 17:11
+ */
+@Setter
+@Getter
+public class GetModuleInfoOneDTO {
+    //模板id
+    private Long id;
+    //模板名称
+    private String name;
+    //模板类型
+    private String type;
+    //属于名称
+    private String ascriptionName;
+    //模板类型
+    private Long moduleType;
+    //模板类型名称
+    private String moduleTypeName;
+    //关联id
+    private Long relationId;
+    //关联名称
+    private String relationName;
+}

+ 19 - 0
precman-service/src/main/java/com/diagbot/dto/GetModuleTypeDTO.java

@@ -0,0 +1,19 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2019/3/28 14:44
+ */
+@Getter
+@Setter
+public class GetModuleTypeDTO {
+    //类型
+    private String type;
+    //类型名称
+    private String name;
+
+}

+ 25 - 0
precman-service/src/main/java/com/diagbot/dto/GetQuestionInfoDTO.java

@@ -0,0 +1,25 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/12/12 13:20
+ */
+@Getter
+@Setter
+public class GetQuestionInfoDTO {
+
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 标签名
+     */
+    private String tagName;
+}

+ 16 - 0
precman-service/src/main/java/com/diagbot/dto/GetQuestiongAndModuleRelationsDTO.java

@@ -0,0 +1,16 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2019/4/25 10:21
+ */
+@Getter
+@Setter
+public class GetQuestiongAndModuleRelationsDTO {
+    //返回关联信息
+    private StringBuffer relationInfos;
+}

+ 23 - 0
precman-service/src/main/java/com/diagbot/dto/ModuleInfoDTO.java

@@ -0,0 +1,23 @@
+package com.diagbot.dto;
+
+import com.diagbot.entity.ModuleDetail;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/12/26 15:44
+ */
+@Getter
+@Setter
+public class ModuleInfoDTO {
+    //模板id
+    private Long id;
+    //模板名称
+    private String name;
+    //模板明细
+    private List<ModuleDetail> moduleDetails;
+}

+ 23 - 0
precman-service/src/main/java/com/diagbot/dto/ModuleInfoListDTO.java

@@ -0,0 +1,23 @@
+package com.diagbot.dto;
+
+import com.diagbot.entity.ModuleInfo;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/12/27 11:46
+ */
+@Getter
+@Setter
+public class ModuleInfoListDTO extends ModuleInfo {
+    //操作人名称
+    private String userName;
+    //属于名称
+    private String ascriptionName;
+    //关联名称
+    private String relationName;
+    //模板类型名称
+    private String moduleTypeName;
+}

+ 99 - 0
precman-service/src/main/java/com/diagbot/entity/ModuleDetail.java

@@ -0,0 +1,99 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 模型明细表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-22
+ */
+@TableName("icss_module_detail")
+@Getter
+@Setter
+public class ModuleDetail implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 名称
+     */
+    private Long moduleId;
+
+    /**
+     * 前置内容
+     */
+    private String prefix;
+
+    /**
+     * 后置内容
+     */
+    private String suffix;
+
+    /**
+     * questionId
+     */
+    private Long questionId;
+
+    /**
+     * 关联模板
+     */
+    private Long relationModule;
+
+
+    /**
+     * 排序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 特殊标识
+     */
+    private String flag;
+
+}

+ 84 - 0
precman-service/src/main/java/com/diagbot/entity/ModuleInfo.java

@@ -0,0 +1,84 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 模型表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-05
+ */
+@TableName("icss_module_info")
+@Getter
+@Setter
+public class ModuleInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 类型
+     */
+    private String type;
+
+    /**
+     * 慢病
+     */
+    private Long moduleType;
+
+    /**
+     * 关联id
+     */
+    private Long relationId;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+
+}

+ 49 - 0
precman-service/src/main/java/com/diagbot/enums/ModuleInfoTypeEnum.java

@@ -0,0 +1,49 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author: wangyu
+ * @Date: 13:41 2019/3/28
+ */
+public enum ModuleInfoTypeEnum implements KeyedNamed {
+    Common(0, "通用"),
+    ByDept(1, "根据科室划分"),
+    ByDis(2, "慢病");
+    @Setter
+    private Integer key;
+
+    @Setter
+    private String name;
+
+    ModuleInfoTypeEnum(Integer key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static ModuleInfoTypeEnum getEnum(Integer key) {
+        for (ModuleInfoTypeEnum item : ModuleInfoTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(Integer key) {
+        ModuleInfoTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}

+ 57 - 0
precman-service/src/main/java/com/diagbot/enums/QuestionTypeEnum.java

@@ -0,0 +1,57 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @Description:标签类型
+ * @Author:zhaops
+ * @time: 2018/11/21 11:39
+ */
+public enum QuestionTypeEnum implements KeyedNamed {
+    Symptom(1, "症状"),
+    Other(3, "其他史"),
+    Vital(4, "查体"),
+    Lis(5, "化验"),
+    Pacs(6, "辅检"),
+    Disease(7, "诊断"),
+    Drug(8, "药品"),
+    DrugClass(9, "药品分类"),
+    Scale(21, "量表"),
+    Index(22, "核心指标");
+
+    @Setter
+    private Integer key;
+
+    @Setter
+    private String name;
+
+    QuestionTypeEnum(Integer key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static QuestionTypeEnum getEnum(Integer key) {
+        for (QuestionTypeEnum item : QuestionTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(Integer key) {
+        QuestionTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}

+ 178 - 0
precman-service/src/main/java/com/diagbot/facade/ModuleDetailFacade.java

@@ -0,0 +1,178 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.diagbot.entity.ModuleDetail;
+import com.diagbot.entity.QuestionInfo;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.ModuleDetailService;
+import com.diagbot.service.QuestionInfoService;
+import com.diagbot.service.impl.ModuleDetailServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.util.UserUtils;
+import com.diagbot.vo.AddModuleDetailVO;
+import com.diagbot.vo.AddModuleInfoVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2018/11/23 11:37
+ */
+@Component
+public class ModuleDetailFacade extends ModuleDetailServiceImpl {
+
+    @Autowired
+    private ModuleInfoFacade moduleInfoFacade;
+    @Autowired
+    @Qualifier("moduleDetailServiceImpl")
+    private ModuleDetailService moduleDetailService;
+    @Autowired
+    private QuestionFacade questionFacade;
+    @Autowired
+    @Qualifier("questionInfoServiceImpl")
+    private QuestionInfoService questionInfoService;
+
+    /**
+     * 根据questionId删除明细
+     *
+     * @param map
+     * @return
+     */
+    public void deleteByQuestionIdFac(Map map) {
+        this.deleteByQuestionIds(map);
+    }
+
+
+    /**
+     * 根据moduleId删除明细
+     *
+     * @param map
+     * @return
+     */
+    public void deleteByModuleIdFac(Map map) {
+        this.deleteByModuleIds(map);
+    }
+
+    /**
+     * 添加模板明细
+     *
+     * @param addModuleInfoVO
+     * @return
+     */
+    public Boolean saveOrUpdateInfos(AddModuleInfoVO addModuleInfoVO, Long moduleId) {
+        String userId = UserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+        //如果该模板添加过明细,先删除
+        UpdateWrapper<ModuleDetail> moduleDetailUpdateWrapper = new UpdateWrapper<>();
+        moduleDetailUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("module_id", moduleId)
+                .set("is_deleted", IsDeleteEnum.Y.getKey())
+                .set("modifier", userId)
+                .set("gmt_modified", now);
+        this.update(new ModuleDetail(), moduleDetailUpdateWrapper);
+        //查询自定义标签的id
+        List<String> textList = new ArrayList<>();
+        for (AddModuleDetailVO addModuleDetailVO : addModuleInfoVO.getModelDetils()) {
+            if (StringUtil.isNotEmpty(addModuleDetailVO.getText())) {
+                textList.add(addModuleDetailVO.getText());
+            }
+        }
+        QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
+        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("tag_type",1 /*TagTypeEnum.T8.getKey()*/)
+                .eq("type", addModuleInfoVO.getTextType())
+                .in("name", textList);
+        List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
+        //将标签id放入map
+        Map<String, Long> questionIdMap = new HashMap<>();
+        for (AddModuleDetailVO addModuleDetailVO : addModuleInfoVO.getModelDetils()) {
+            if (StringUtil.isNotEmpty(addModuleDetailVO.getText())) {
+                questionIdMap = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getTagName, questionInfo -> questionInfo.getId()));
+            }
+        }
+        QuestionInfo addquestionInfo = null;
+        List<QuestionInfo> addQuestionInfoList = new ArrayList<>();
+        List<String> textExistList = new ArrayList<>();
+        //循环给questionId赋值,如果遇到赋值失败的则是没有questionID,执行添加
+        for (AddModuleDetailVO addModuleDetailVO : addModuleInfoVO.getModelDetils()) {
+            if (StringUtil.isNotEmpty(addModuleDetailVO.getText())) {
+                addModuleDetailVO.setQuestionId(questionIdMap.get(addModuleDetailVO.getText()));
+                if (addModuleDetailVO.getQuestionId() == null && addModuleDetailVO.getText() != null) {
+                    addquestionInfo = new QuestionInfo();
+                    addquestionInfo.setModifier(userId);
+                    addquestionInfo.setCreator(userId);
+                    addquestionInfo.setGmtCreate(now);
+                    addquestionInfo.setGmtModified(now);
+                    addquestionInfo.setTagType(1/*TagTypeEnum.T8.getKey()*/);
+                    addquestionInfo.setTagName(addModuleDetailVO.getText());
+                    addquestionInfo.setName(addModuleDetailVO.getText());
+                    addquestionInfo.setType(addModuleInfoVO.getTextType());
+                    addquestionInfo.setName(addModuleDetailVO.getText());
+                    if (!textExistList.contains(addModuleDetailVO.getText())) {
+                        textExistList.add(addModuleDetailVO.getText());
+                        addQuestionInfoList.add(addquestionInfo);
+                    }
+                }
+            }
+        }
+        questionInfoService.saveBatch(addQuestionInfoList);
+        //查询自定义标签的id
+        QueryWrapper<QuestionInfo> questionInfoQueryWrapper1 = new QueryWrapper<>();
+        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("type", addModuleInfoVO.getTextType())
+                .eq("tag_type", 1/*TagTypeEnum.T8.getKey()*/);
+        List<QuestionInfo> questionInfoList1 = questionFacade.list(questionInfoQueryWrapper1);
+        if (ListUtil.isNotEmpty(questionInfoList1)) {
+            for (QuestionInfo questionInfo : questionInfoList1) {
+                if (StringUtil.isNotEmpty(questionInfo.getTagName())) {
+                    questionIdMap.put(questionInfo.getTagName(), questionInfo.getId());
+                }
+            }
+        }
+        //二次赋值保证每一个questionId都有值
+        ModuleDetail moduleDetail = null;
+        List<ModuleDetail> moduleDetailList = new ArrayList<>();
+        for (int i = 0; i < addModuleInfoVO.getModelDetils().size(); i++) {
+            moduleDetail = new ModuleDetail();
+            moduleDetail.setModuleId(moduleId);
+            moduleDetail.setCreator(userId);
+            moduleDetail.setModifier(userId);
+            moduleDetail.setGmtCreate(now);
+            moduleDetail.setGmtModified(now);
+            moduleDetail.setOrderNo(i + 1);
+            if (addModuleInfoVO.getModelDetils().get(i).getRelationModule() != null) {
+                moduleDetail.setRelationModule(addModuleInfoVO.getModelDetils().get(i).getRelationModule());
+            }
+            if (StringUtil.isNotEmpty(addModuleInfoVO.getModelDetils().get(i).getText())) {
+                moduleDetail.setQuestionId(questionIdMap.get(addModuleInfoVO.getModelDetils().get(i).getText()));
+            } else {
+                moduleDetail.setQuestionId(addModuleInfoVO.getModelDetils().get(i).getQuestionId());
+            }
+            if (StringUtil.isNotEmpty(addModuleInfoVO.getModelDetils().get(i).getFlag())) {
+                moduleDetail.setFlag(addModuleInfoVO.getModelDetils().get(i).getFlag());
+            }
+            //判断是否是有效数据
+            if (addModuleInfoVO.getModelDetils().get(i).getRelationModule() != null
+                    || StringUtil.isNotEmpty(addModuleInfoVO.getModelDetils().get(i).getText())
+                    || StringUtil.isNotEmpty(addModuleInfoVO.getModelDetils().get(i).getFlag())
+                    || addModuleInfoVO.getModelDetils().get(i).getQuestionId() != null) {
+                moduleDetailList.add(moduleDetail);
+            }
+        }
+        //添加模板明细
+        moduleDetailService.saveBatch(moduleDetailList);
+        return true;
+    }
+}

+ 582 - 0
precman-service/src/main/java/com/diagbot/facade/ModuleInfoFacade.java

@@ -0,0 +1,582 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.client.KnowledgemanServiceClient;
+import com.diagbot.client.UserServiceClient;
+import com.diagbot.dto.ConceptBaseDTO;
+import com.diagbot.dto.DeptDTO;
+import com.diagbot.dto.GetAllDeptAndDisInfoDTO;
+import com.diagbot.dto.GetModuleDetailInfoDTO;
+import com.diagbot.dto.GetModuleInfoOneDTO;
+import com.diagbot.dto.GetModuleTypeDTO;
+import com.diagbot.dto.GetQuestionInfoDTO;
+import com.diagbot.dto.GetQuestiongAndModuleRelationsDTO;
+import com.diagbot.dto.ModuleInfoDTO;
+import com.diagbot.dto.ModuleInfoListDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.DictionaryInfo;
+import com.diagbot.entity.ModuleDetail;
+import com.diagbot.entity.ModuleInfo;
+import com.diagbot.entity.QuestionInfo;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.ModuleInfoTypeEnum;
+import com.diagbot.enums.QuestionTypeEnum;
+import com.diagbot.service.impl.ModuleInfoServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.RespDTOUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.util.UserUtils;
+import com.diagbot.vo.AddModuleInfoVO;
+import com.diagbot.vo.ConceptTypeVO;
+import com.diagbot.vo.GetAllDeptAndDisInfoVO;
+import com.diagbot.vo.GetModuleDetailInfoVO;
+import com.diagbot.vo.GetModuleInfoOneVO;
+import com.diagbot.vo.GetModuleInfoVO;
+import com.diagbot.vo.GetModuleTypeVO;
+import com.diagbot.vo.GetQuestiongAndModuleRelationsVO;
+import com.diagbot.vo.ModuleGetQuestionInfoVO;
+import com.diagbot.vo.UpdateModuleInfoVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2018/11/23 11:37
+ */
+@Component
+public class ModuleInfoFacade extends ModuleInfoServiceImpl {
+
+
+    @Autowired
+    ModuleDetailFacade moduleDetailFacade;
+    @Autowired
+    QuestionFacade questionFacade;
+    @Autowired
+    UserServiceClient userServiceClient;
+    @Autowired
+    DictionaryFacade dictionaryFacade;
+    @Autowired
+    KnowledgemanServiceClient knowledgemanServiceClient;
+    /**
+     * 根据id删除标签模板
+     *
+     * @param ids
+     * @return
+     */
+    public Boolean deleteByIdsFac(String ids) {
+        //如果是子模板,删除该子模板与其他模板的关联
+        QueryWrapper<ModuleInfo> moduleInfoQueryWrapper = new QueryWrapper<>();
+        moduleInfoQueryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey())
+                .eq("id",ids);
+        ModuleInfo moduleInfo = this.getOne(moduleInfoQueryWrapper);
+        String userId = UserUtils.getCurrentPrincipleID();
+        Date date = DateUtil.now();
+        if(null != moduleInfo){
+            if("31".equals(moduleInfo.getType())
+                    || "32".equals(moduleInfo.getType())
+                    || "322".equals(moduleInfo.getType())){
+                UpdateWrapper<ModuleDetail> moduleDetailUpdateWrapper = new UpdateWrapper<>();
+                moduleDetailUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("relation_module", moduleInfo.getId())
+                        .set("is_deleted", IsDeleteEnum.Y.getKey())
+                        .set("modifier", userId)
+                        .set("gmt_modified",date );
+                moduleDetailFacade.update(new ModuleDetail(),moduleDetailUpdateWrapper);
+            }
+        }
+        if (StringUtil.isEmpty(ids)) {
+            return true;
+        }
+        Map paramMap = new HashMap<>();
+        paramMap.put("delete", IsDeleteEnum.Y.getKey());
+        paramMap.put("ids", Arrays.asList(ids.split(",")));
+        paramMap.put("gmtModified", date);
+        paramMap.put("modifier", userId);
+
+        //删除模板
+        this.deleteByIds(paramMap);
+
+        //删除明细表
+        moduleDetailFacade.deleteByModuleIdFac(paramMap);
+        return true;
+    }
+
+    /**
+     * 添加模板
+     *
+     * @param addModulInfoVO
+     * @return
+     */
+    public Boolean saveModuleInfo(AddModuleInfoVO addModulInfoVO) {
+        String userId = UserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+        ModuleInfo moduleInfo = new ModuleInfo();
+        BeanUtil.copyProperties(addModulInfoVO, moduleInfo);
+        moduleInfo.setCreator(userId);
+        moduleInfo.setModifier(userId);
+        moduleInfo.setGmtCreate(now);
+        moduleInfo.setGmtModified(now);
+        moduleInfo.setType(addModulInfoVO.getType());
+        moduleInfo.setModuleType(addModulInfoVO.getModuleType());
+        //当添加为科室专用模板或者慢病模板时添加关联id
+        if(addModulInfoVO.getModuleType().intValue() == 1 || addModulInfoVO.getModuleType().intValue() == 2){
+            moduleInfo.setRelationId(addModulInfoVO.getRelationId());
+        }
+        this.save(moduleInfo);
+        Long moduleId = moduleInfo.getId();
+        return moduleDetailFacade.saveOrUpdateInfos(addModulInfoVO, moduleId);
+    }
+
+    /**
+     * 修改模板
+     *
+     * @param updateModuleInfoVO
+     * @return
+     */
+    public Boolean updateModuleInfo(UpdateModuleInfoVO updateModuleInfoVO) {
+        String userId = UserUtils.getCurrentPrincipleID();
+        UpdateWrapper<ModuleInfo> moduleInfoUpdateWrapper = new UpdateWrapper<>();
+        moduleInfoUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("id", updateModuleInfoVO.getId())
+                .set("name", updateModuleInfoVO.getName())
+                .set("type", updateModuleInfoVO.getType())
+                .set("module_type",updateModuleInfoVO.getModuleType())
+                .set("modifier", userId)
+                .set("gmt_modified", DateUtil.now());
+        if(updateModuleInfoVO.getRelationId() != null){
+            moduleInfoUpdateWrapper.set("relation_id", updateModuleInfoVO.getRelationId());
+        }
+        this.update(new ModuleInfo(), moduleInfoUpdateWrapper);
+        AddModuleInfoVO addModuleInfoVO = new AddModuleInfoVO();
+        BeanUtil.copyProperties(updateModuleInfoVO, addModuleInfoVO);
+        return moduleDetailFacade.saveOrUpdateInfos(addModuleInfoVO, updateModuleInfoVO.getId());
+    }
+
+    /**
+     * 获取标签池信息
+     *
+     * @param moduleGetQuestionInfoVO
+     * @return
+     */
+    public List<GetQuestionInfoDTO> getQuestionInfos(ModuleGetQuestionInfoVO moduleGetQuestionInfoVO) {
+        List<GetQuestionInfoDTO> getQuestionInfoDTOS = new ArrayList<>();
+        GetQuestionInfoDTO getQuestionInfoDTO = new GetQuestionInfoDTO();
+        //如果是辅检,调用aipt-获取概念信息
+        if(moduleGetQuestionInfoVO.getType().intValue() == QuestionTypeEnum.Pacs.getKey()){
+            getQuestionInfoDTOS = new ArrayList<>();
+            ConceptTypeVO conceptTypeVO = new ConceptTypeVO();
+            conceptTypeVO.setType(2);
+            RespDTO<List<ConceptBaseDTO>> conceptBaseDTOS = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
+            RespDTOUtil.respNGDeal(conceptBaseDTOS,"获取辅检标签失败");
+            if(ListUtil.isNotEmpty(moduleGetQuestionInfoVO.getNoIds())){
+                Iterator<ConceptBaseDTO> conceptBaseDTOIterator = conceptBaseDTOS.data.iterator();
+                while (conceptBaseDTOIterator.hasNext()){
+                    for (Long notId : moduleGetQuestionInfoVO.getNoIds()) {
+                        if(conceptBaseDTOIterator.next().getConceptId().intValue() == notId.intValue()){
+                            conceptBaseDTOIterator.remove();
+                        }
+                    }
+                }
+            }
+            for (ConceptBaseDTO conceptBaseDTO : conceptBaseDTOS.data) {
+                getQuestionInfoDTO = new GetQuestionInfoDTO();
+                getQuestionInfoDTO.setId(conceptBaseDTO.getConceptId());
+                getQuestionInfoDTO.setTagName(conceptBaseDTO.getName());
+                getQuestionInfoDTOS.add(getQuestionInfoDTO);
+            }
+        }else {//返回除辅检以外的questionInfo信息
+            getQuestionInfoDTOS = new ArrayList<>();
+            getQuestionInfoDTOS = questionFacade.moduleGetQuestiongInfoByName(moduleGetQuestionInfoVO);
+        }
+
+        return getQuestionInfoDTOS;
+    }
+
+    /**
+     * 获取子模板
+     *
+     * @param getModuleInfoVO
+     * @return
+     */
+    public List<ModuleInfoDTO> getModuleInfo(GetModuleInfoVO getModuleInfoVO) {
+        //获取模板信息
+        QueryWrapper<ModuleInfo> moduleInfoQueryWrapper = new QueryWrapper<>();
+        moduleInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+        if (getModuleInfoVO.getModuleType() != null) {
+            moduleInfoQueryWrapper.eq("module_type", getModuleInfoVO.getModuleType());
+        }
+        if(getModuleInfoVO.getType() != null) {
+            moduleInfoQueryWrapper.eq("type", getModuleInfoVO.getType());
+        }
+        if(ListUtil.isNotEmpty(getModuleInfoVO.getNoIds())){
+            moduleInfoQueryWrapper.notIn("id", getModuleInfoVO.getNoIds());
+        }
+        if(getModuleInfoVO.getRelationId() != null) {
+            moduleInfoQueryWrapper.eq("relation_id", getModuleInfoVO.getRelationId());
+        }
+        List<ModuleInfo> moduleInfoList = this.list(moduleInfoQueryWrapper);
+        List<Long> moduleIdList = moduleInfoList.stream().map(m -> m.getId()).collect(Collectors.toList());
+        //获取模板明细信息
+        QueryWrapper<ModuleDetail> moduleDetailQueryWrapper = new QueryWrapper<>();
+        moduleDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .in("module_id", moduleIdList);
+        List<ModuleDetail> moduleDetailList = moduleDetailFacade.list(moduleDetailQueryWrapper);
+        //将模板明细根据模板id放入map
+        Map<Long, List<ModuleDetail>> moduleDetailMap = new HashMap<>();
+        List<ModuleDetail> allModuleDetials = null;
+        for (ModuleInfo moduleInfo : moduleInfoList) {
+            allModuleDetials = new ArrayList<>();
+            for (ModuleDetail moduleDetail : moduleDetailList) {
+                if (moduleInfo.getId().longValue() == moduleDetail.getModuleId().longValue()) {
+                    allModuleDetials.add(moduleDetail);
+                }
+            }
+            moduleDetailMap.put(moduleInfo.getId(), allModuleDetials);
+        }
+        //给ModuleInfoDTO设值
+        List<ModuleInfoDTO> moduleInfoDTOList = new ArrayList<>();
+        ModuleInfoDTO moduleInfoDTO = null;
+        for (ModuleInfo moduleInfo : moduleInfoList) {
+            moduleInfoDTO = new ModuleInfoDTO();
+            moduleInfoDTO.setId(moduleInfo.getId());
+            moduleInfoDTO.setName(moduleInfo.getName());
+            moduleInfoDTO.setModuleDetails(moduleDetailMap.get(moduleInfoDTO.getId()));
+            moduleInfoDTOList.add(moduleInfoDTO);
+        }
+        return moduleInfoDTOList;
+    }
+
+    /**
+     * 模板维护页面获取模板列表
+     *
+     * @param getModuleInfoVO
+     * @return
+     */
+    public IPage<ModuleInfoListDTO> getModuleInfoList(GetModuleInfoVO getModuleInfoVO) {
+        //获取模板信息
+        IPage<ModuleInfoListDTO> moduleInfoDTOIPage = this.getModuleInfoListByType(getModuleInfoVO);
+        List<String> ids = new ArrayList<>();
+        List<Long> deptId = new ArrayList<>();
+        List<Long> disId = new ArrayList<>();
+        for (ModuleInfoListDTO moduleInfoListDTO : moduleInfoDTOIPage.getRecords()) {
+            ids.add(moduleInfoListDTO.getModifier());
+            if(moduleInfoListDTO.getModuleType().intValue() == 1){
+                deptId.add(moduleInfoListDTO.getRelationId());
+            }
+            if(moduleInfoListDTO.getModuleType().intValue() == 2){
+                disId.add(moduleInfoListDTO.getRelationId());
+            }
+        }
+        //获取科室名称
+        ConceptTypeVO conceptTypeVO = new ConceptTypeVO();
+        conceptTypeVO.setType(1);
+        RespDTO<List<ConceptBaseDTO>> deptInfoList = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
+        RespDTOUtil.respNGDeal(deptInfoList,"获取科室信息失败");
+        Map<Long, ConceptBaseDTO> deptInfoMap = deptInfoList.data.stream().collect(Collectors.toMap(ConceptBaseDTO::getConceptId,conceptBaseDTO -> conceptBaseDTO));
+        //获取疾病名称
+        conceptTypeVO = new ConceptTypeVO();
+        conceptTypeVO.setType(3);
+        RespDTO<List<ConceptBaseDTO>> disInfoList = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
+        RespDTOUtil.respNGDeal(disInfoList,"获取疾病信息失败");
+        Map<Long, ConceptBaseDTO> disInfoMap = disInfoList.data.stream().collect(Collectors.toMap(ConceptBaseDTO::getConceptId,conceptBaseDTO -> conceptBaseDTO));
+        /*QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
+        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .in("id", disId);
+        List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
+        Map<Long, QuestionInfo> questionInfoMap = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getId,questionInfo -> questionInfo));*/
+        //获取模板类型名称
+        QueryWrapper<DictionaryInfo> dictionaryInfoQueryWrapper = new QueryWrapper<>();
+        dictionaryInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("group_type", 4)
+                .eq("return_type", 1)
+                .orderByDesc("order_no");
+        List<DictionaryInfo> dictionaryInfoList = dictionaryFacade.list(dictionaryInfoQueryWrapper);
+        Map<String, DictionaryInfo> dictionaryInfoMap = dictionaryInfoList.stream().collect(Collectors.toMap(DictionaryInfo::getVal,dictionaryInfo -> dictionaryInfo));
+        if(ListUtil.isNotEmpty(moduleInfoDTOIPage.getRecords())){
+            //获取用户信息
+            RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);
+            RespDTOUtil.respNGDeal(respDTO,"获取用户信息失败");
+            //将用户信息放入实体
+            for (ModuleInfoListDTO moduleInfoListDTO : moduleInfoDTOIPage.getRecords()) {
+                moduleInfoListDTO.setUserName(respDTO.data.get(moduleInfoListDTO.getModifier()));
+                if(dictionaryInfoMap.get(moduleInfoListDTO.getType()) != null ){
+                    moduleInfoListDTO.setAscriptionName(dictionaryInfoMap.get(moduleInfoListDTO.getType()).getName());
+                }
+                if(moduleInfoListDTO.getModuleType().intValue() == 1){//根据科室
+                    if(moduleInfoListDTO.getRelationId().intValue() != -1){//判断是不是科室通用子模板
+                        if(null != deptInfoMap.get(moduleInfoListDTO.getRelationId())){
+                            moduleInfoListDTO.setRelationName(deptInfoMap.get(moduleInfoListDTO.getRelationId()).getName());
+                        }
+                    }else {
+                        moduleInfoListDTO.setRelationName(ModuleInfoTypeEnum.Common.getName());
+                    }
+                }
+                if(moduleInfoListDTO.getModuleType().intValue() == 2){//根据疾病
+                    if(moduleInfoListDTO.getRelationId().intValue() != -1){//判断是不是疾病通用子模板
+                        if(null != disInfoMap.get(moduleInfoListDTO.getRelationId())){
+                            moduleInfoListDTO.setRelationName(disInfoMap.get(moduleInfoListDTO.getRelationId()).getName());
+                        }
+                    }else {
+                        moduleInfoListDTO.setRelationName(ModuleInfoTypeEnum.Common.getName());
+                    }
+                }
+                moduleInfoListDTO.setModuleTypeName(ModuleInfoTypeEnum.getName(moduleInfoListDTO.getModuleType().intValue()));
+            }
+        }
+        return moduleInfoDTOIPage;
+    }
+
+    /**
+     * 模板维护修改获取已添加标签信息
+     *
+     * @param getModuleDetailInfoVO
+     * @return
+     */
+    public List<GetModuleDetailInfoDTO> getModuleDetailInfo(GetModuleDetailInfoVO getModuleDetailInfoVO) {
+        List<GetModuleDetailInfoDTO> getModuleDetailInfoDTOList = new ArrayList<>();
+        GetModuleDetailInfoDTO getModuleDetailInfoDTO = null;
+        //获取模板明细
+        QueryWrapper<ModuleDetail> moduleDetailQueryWrapper = new QueryWrapper<>();
+        moduleDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("module_id", getModuleDetailInfoVO.getModuleId())
+                .orderByAsc("order_no");
+        List<ModuleDetail> moduleDetailList = moduleDetailFacade.list(moduleDetailQueryWrapper);
+        List<Long> questionIdList = moduleDetailList.stream().map(moduleDetail -> moduleDetail.getQuestionId()).collect(Collectors.toList());
+        List<Long> moduleIdList = moduleDetailList.stream().map(moduleDetail -> moduleDetail.getRelationModule()).collect(Collectors.toList());
+
+        if(getModuleDetailInfoVO.getType().intValue() == QuestionTypeEnum.Pacs.getKey()){//如果是辅检,调用knowledgeman获取辅检信息
+            ConceptTypeVO conceptTypeVO = new ConceptTypeVO();
+            conceptTypeVO.setType(2);
+            RespDTO<List<ConceptBaseDTO>> pacsCeptInfo = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
+            Map<Long,ConceptBaseDTO> pacsCeptMap = pacsCeptInfo.data.stream().collect(Collectors.toMap(ConceptBaseDTO::getConceptId,conceptBaseDTO -> conceptBaseDTO));
+            //循环给出参赋值
+            for (ModuleDetail moduleDetail : moduleDetailList) {
+                getModuleDetailInfoDTO = new GetModuleDetailInfoDTO();
+                BeanUtil.copyProperties(moduleDetail, getModuleDetailInfoDTO);
+                getModuleDetailInfoDTO.setTagName(pacsCeptMap.get(moduleDetail.getQuestionId()).getName());
+            }
+        }else {
+            //获取标签信息
+            QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
+            questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .in("id", questionIdList);
+            List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
+            Map<Long, QuestionInfo> questionInfoMap = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getId, questionInfo -> questionInfo));
+            //获取模板信息
+            QueryWrapper<ModuleInfo> moduleInfoQueryWrapper = new QueryWrapper<>();
+            questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .in("id", moduleIdList);
+            List<ModuleInfo> moduleInfoList = this.list(moduleInfoQueryWrapper);
+            Map<Long, ModuleInfo> moduleInfoMap = moduleInfoList.stream().collect(Collectors.toMap(ModuleInfo::getId, moduleInfo -> moduleInfo));
+            //循环给出参赋值
+            for (ModuleDetail moduleDetail : moduleDetailList) {
+                getModuleDetailInfoDTO = new GetModuleDetailInfoDTO();
+                BeanUtil.copyProperties(moduleDetail, getModuleDetailInfoDTO);
+                if (moduleDetail.getQuestionId() != null) {
+                    getModuleDetailInfoDTO.setTagName(questionInfoMap.get(moduleDetail.getQuestionId()).getTagName());
+                    getModuleDetailInfoDTO.setTagType(questionInfoMap.get(moduleDetail.getQuestionId()).getTagType());
+                } else {
+                    getModuleDetailInfoDTO.setRelationModuleName(moduleInfoMap.get(moduleDetail.getRelationModule()).getName());
+                }
+                getModuleDetailInfoDTOList.add(getModuleDetailInfoDTO);
+            }
+        }
+        return getModuleDetailInfoDTOList;
+    }
+
+    /**
+     * 模板维护页面获取模板列表
+     *
+     * @param getModuleInfoOneVO
+     * @return
+     */
+    public GetModuleInfoOneDTO getModuleInfoOne(GetModuleInfoOneVO getModuleInfoOneVO) {
+        GetModuleInfoOneDTO getModuleInfoOneDTO = new GetModuleInfoOneDTO();
+        List<Long> deptId = new ArrayList<>();
+        List<Long> disId = new ArrayList<>();
+        //获取模板信息
+        QueryWrapper<ModuleInfo> moduleInfoQueryWrapper = new QueryWrapper<>();
+        moduleInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("id", getModuleInfoOneVO.getModuleId());
+        ModuleInfo moduleInfo = this.getOne(moduleInfoQueryWrapper);
+        //获取模板类型名称
+        if(moduleInfo.getModuleType().intValue() == 1){
+            deptId.add(moduleInfo.getRelationId());
+        }
+        if(moduleInfo.getModuleType().intValue() == 2){
+            disId.add(moduleInfo.getRelationId());
+        }
+        //获取科室名称
+        ConceptTypeVO conceptTypeVO = new ConceptTypeVO();
+        conceptTypeVO.setType(1);
+        RespDTO<List<ConceptBaseDTO>> deptInfoList = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
+        RespDTOUtil.respNGDeal(deptInfoList,"获取科室信息失败");
+        Map<Long, ConceptBaseDTO> deptInfoMap = deptInfoList.data.stream().collect(Collectors.toMap(ConceptBaseDTO::getConceptId,conceptBaseDTO -> conceptBaseDTO));
+        //获取疾病名称
+        QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
+        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .in("id", disId);
+        List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
+        Map<Long, QuestionInfo> questionInfoMap = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getId,questionInfo -> questionInfo));
+        //获取模板类型
+        QueryWrapper<DictionaryInfo> dictionaryInfoQueryWrapper = new QueryWrapper<>();
+        dictionaryInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("group_type", 4)
+                .eq("return_type", 1)
+                .orderByDesc("order_no");
+        List<DictionaryInfo> dictionaryInfoList = dictionaryFacade.list(dictionaryInfoQueryWrapper);
+        Map<String, DictionaryInfo> dictionaryInfoMap = dictionaryInfoList.stream().collect(Collectors.toMap(DictionaryInfo::getVal,dictionaryInfo -> dictionaryInfo));
+        BeanUtil.copyProperties(moduleInfo, getModuleInfoOneDTO);
+        getModuleInfoOneDTO.setAscriptionName(dictionaryInfoMap.get(String.valueOf(moduleInfo.getType())).getName());
+        getModuleInfoOneDTO.setModuleTypeName(ModuleInfoTypeEnum.getName(getModuleInfoOneDTO.getModuleType().intValue()));
+        if(getModuleInfoOneDTO.getModuleType().intValue() == 1){
+            getModuleInfoOneDTO.setRelationName(deptInfoMap.get(getModuleInfoOneDTO.getRelationId()).getName());
+        }
+        if(getModuleInfoOneDTO.getModuleType().intValue() == 2){
+            getModuleInfoOneDTO.setRelationName(questionInfoMap.get(getModuleInfoOneDTO.getRelationId()).getName());
+        }
+        return getModuleInfoOneDTO;
+    }
+
+    /**
+     * 获取模板类型(从主诉到诊断)
+     *
+     * @param getModuleTypeVO
+     * @return
+     */
+    public List<GetModuleTypeDTO> getModuleType(GetModuleTypeVO getModuleTypeVO){
+        QueryWrapper<ModuleInfo> moduleInfoQueryWrapper = new QueryWrapper<>();
+        moduleInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("module_Type", getModuleTypeVO.getModuleType());
+        if(getModuleTypeVO.getRelationId() != null){
+            moduleInfoQueryWrapper.eq("relation_id", getModuleTypeVO.getRelationId());
+        }
+        List<ModuleInfo> moduleInfos = this.list(moduleInfoQueryWrapper);
+        List<String> types = moduleInfos.stream().map(moduleInfo -> moduleInfo.getType()).collect(Collectors.toList());
+        //获取模板类型
+        QueryWrapper<DictionaryInfo> dictionaryInfoQueryWrapper = new QueryWrapper<>();
+        dictionaryInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("group_type", 4)
+                .eq("return_type", 1)
+                .notIn("val",types)
+                .orderByAsc("order_no");
+        if(getModuleTypeVO.getRelationId() != null && getModuleTypeVO.getRelationId().intValue() == -1){//如果是-1时返回所有子模板
+            dictionaryInfoQueryWrapper.in("val","322","31","32");
+        }
+        if(getModuleTypeVO.getModuleType() != null && getModuleTypeVO.getModuleType().intValue() == 2){//为慢病时过滤现病史空模板、主诉模板、现病史空模板子模板
+            dictionaryInfoQueryWrapper.notIn("val","1","22","31","322");
+        }
+        if(getModuleTypeVO.getModuleType() != null && getModuleTypeVO.getModuleType().intValue() == 0 || getModuleTypeVO.getModuleType() != null && getModuleTypeVO.getModuleType().intValue() == 1){//为通用或科室时过滤化验附件诊断
+            dictionaryInfoQueryWrapper.notIn("val","4","5","6","7");
+        }
+        List<DictionaryInfo> dictionaryInfoList = dictionaryFacade.list(dictionaryInfoQueryWrapper);
+        List<GetModuleTypeDTO> getModuleTypeDTOS = new ArrayList<>();
+        for (DictionaryInfo dictionaryInfo: dictionaryInfoList) {
+            GetModuleTypeDTO getModuleTypeDTO = new GetModuleTypeDTO();
+            getModuleTypeDTO.setName(dictionaryInfo.getName());
+            getModuleTypeDTO.setType(dictionaryInfo.getVal());
+            getModuleTypeDTOS.add(getModuleTypeDTO);
+        }
+        return getModuleTypeDTOS;
+    }
+
+    /**
+     * 获取所有的科室和疾病信息
+     *
+     * @return
+     */
+    public GetAllDeptAndDisInfoDTO getAllDeptAndDisInfo(GetAllDeptAndDisInfoVO getAllDeptAndDisInfoVO){
+        //获取所有科室
+        ConceptTypeVO deptType = new ConceptTypeVO();
+        deptType.setType(1);
+        RespDTO<List<ConceptBaseDTO>> deptInfoList = knowledgemanServiceClient.getConceptListByType(deptType);
+        RespDTOUtil.respNGDeal(deptInfoList,"获取科室信息失败");
+        if(getAllDeptAndDisInfoVO.getModuleType() != null && getAllDeptAndDisInfoVO.getModuleType().intValue() == 1){//过滤添加过得科室
+            List<ModuleInfo> moduleInfoList = getModuleInfos(getAllDeptAndDisInfoVO.getModuleType(),getAllDeptAndDisInfoVO.getType());
+            List<Long> deptIds = moduleInfoList.stream().map(ModuleInfo::getRelationId).collect(Collectors.toList());
+            Iterator<ConceptBaseDTO> deptIterator = deptInfoList.data.iterator();
+            for (Long deptId : deptIds) {
+                while (deptIterator.hasNext()){
+                    Long deptConceptId = deptIterator.next().getConceptId();
+                    if(deptId.intValue() == deptConceptId.intValue()){
+                        deptIterator.remove();
+                    }
+                }
+            }
+        }
+        List<DeptDTO> deptDTOS = BeanUtil.listCopyTo(deptInfoList.data,DeptDTO.class);
+        GetAllDeptAndDisInfoDTO getAllDeptAndDisInfoDTO = new GetAllDeptAndDisInfoDTO();
+        getAllDeptAndDisInfoDTO.setDeptDTOS(deptDTOS);
+        return getAllDeptAndDisInfoDTO;
+    }
+
+    /**
+     * 获取模板信息
+     *
+     * @param moduleType
+     * @param type
+     * @return
+     */
+    public List<ModuleInfo> getModuleInfos(Long moduleType,String type){
+        QueryWrapper<ModuleInfo> moduleInfoQueryWrapper = new QueryWrapper<>();
+        moduleInfoQueryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey())
+                .eq("module_type",moduleType)
+                .eq("type",type);
+        return this.list(moduleInfoQueryWrapper);
+    }
+
+    /**
+     * 返回标签关联模板信息
+     *
+     * @param getQuestiongAndModuleRelationsVO
+     * @return
+     */
+    public GetQuestiongAndModuleRelationsDTO getQuestiongAndModuleRelations(GetQuestiongAndModuleRelationsVO getQuestiongAndModuleRelationsVO){
+        StringBuffer errMsg = new StringBuffer();
+        List<ModuleDetail> moduleDetails = moduleDetailFacade.list(new QueryWrapper<ModuleDetail>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("question_id", getQuestiongAndModuleRelationsVO.getQuestionId()));
+        if (ListUtil.isNotEmpty(moduleDetails)) {
+            List<Long> moduleIds = moduleDetails.stream().map(row -> row.getModuleId()).collect(Collectors.toList());
+            List<String> moduleNames = this.list(new QueryWrapper<ModuleInfo>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .in("id", moduleIds))
+                    .stream().map(row ->  row.getName()).collect(Collectors.toList());
+            for (String mouduleName: moduleNames) {
+                errMsg.append("该标签已关联").append("【" + mouduleName + "】").append("<br/>");
+            }
+        }
+        StringBuffer titalMsg = new StringBuffer();
+        StringBuffer questionMsg = new StringBuffer();
+        List<QuestionInfo> info = questionFacade.getParentQuestion(getQuestiongAndModuleRelationsVO.getQuestionId());
+        for (QuestionInfo bean : info) {
+            //TODO
+            if (bean.getTagType() != null /*&& bean.getTagType() == TagTypeEnum.T10.getKey()*/) {
+                List<QuestionInfo> info2 = questionFacade.getParentQuestion(bean.getId());
+                List<String> msg = info2.stream().map(row -> "【" + row.getTagName() + "】").collect(Collectors.toList());
+                questionMsg.append(String.join("", msg));
+            } else {
+                questionMsg.append("【"+bean.getTagName()+"】");
+            }
+        }
+        titalMsg.append("该标签已关联父级:").append(questionMsg).append("<br/>").append(errMsg);
+        GetQuestiongAndModuleRelationsDTO getQuestiongAndModuleRelationsDTO = new GetQuestiongAndModuleRelationsDTO();
+        getQuestiongAndModuleRelationsDTO.setRelationInfos(titalMsg.append("是否删除?"));
+        return getQuestiongAndModuleRelationsDTO;
+    }
+
+}

+ 21 - 0
precman-service/src/main/java/com/diagbot/mapper/ModuleDetailMapper.java

@@ -0,0 +1,21 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.entity.ModuleDetail;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 模型明细表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-22
+ */
+public interface ModuleDetailMapper extends BaseMapper<ModuleDetail> {
+
+    public void deleteByQuestionIds(Map map);
+
+    public void deleteByModuleIds(Map map);
+}

+ 30 - 0
precman-service/src/main/java/com/diagbot/mapper/ModuleInfoMapper.java

@@ -0,0 +1,30 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.ModuleInfoListDTO;
+import com.diagbot.entity.ModuleInfo;
+import com.diagbot.vo.GetModuleInfoVO;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 模型表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-05
+ */
+public interface ModuleInfoMapper extends BaseMapper<ModuleInfo> {
+
+    public void deleteByIds(Map map);
+
+    /**
+     * 获取模板列表
+     *
+     * @param getModuleInfoVO
+     * @return
+     */
+    public IPage<ModuleInfoListDTO> getModuleInfoListByType(GetModuleInfoVO getModuleInfoVO);
+}

+ 11 - 0
precman-service/src/main/java/com/diagbot/mapper/QuestionInfoMapper.java

@@ -2,10 +2,13 @@ package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.GetQuestionInfoDTO;
 import com.diagbot.dto.QuestionPageDTO;
 import com.diagbot.entity.QuestionInfo;
 import com.diagbot.entity.wrapper.QuestionInfoWrapper;
+import com.diagbot.vo.ModuleGetQuestionInfoVO;
 import com.diagbot.vo.QuestionPageVO;
+
 import java.util.List;
 import java.util.Map;
 
@@ -56,5 +59,13 @@ public interface QuestionInfoMapper extends BaseMapper<QuestionInfo> {
      */
     public List<QuestionInfoWrapper> getByQuestionMapping(Map map);
 
+    /**
+     * 根据名称获取标签信息
+     *
+     * @param moduleGetQuestionInfoVO
+     * @return
+     */
+    public List<GetQuestionInfoDTO> moduleGetQuestiongInfoByName(ModuleGetQuestionInfoVO moduleGetQuestionInfoVO);
+
 
 }

+ 34 - 0
precman-service/src/main/java/com/diagbot/service/ModuleDetailService.java

@@ -0,0 +1,34 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.entity.ModuleDetail;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 模型明细表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-22
+ */
+public interface ModuleDetailService extends IService<ModuleDetail> {
+
+    /**
+     * 根据id删除标签
+     *
+     * @param map
+     * @return
+     */
+    public void deleteByQuestionIds(Map map);
+
+
+    /**
+     * 根据id删除标签模板
+     *
+     * @param map
+     * @return
+     */
+    public void deleteByModuleIds(Map map);
+}

+ 36 - 0
precman-service/src/main/java/com/diagbot/service/ModuleInfoService.java

@@ -0,0 +1,36 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.ModuleInfoListDTO;
+import com.diagbot.entity.ModuleInfo;
+import com.diagbot.vo.GetModuleInfoVO;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 模型表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-05
+ */
+public interface ModuleInfoService extends IService<ModuleInfo> {
+
+    /**
+     * 根据id删除标签模板
+     *
+     * @param map
+     * @return
+     */
+    public void deleteByIds(Map map);
+
+    /**
+     * 获取模板列表
+     *
+     * @param getModuleInfoVO
+     * @return
+     */
+    public IPage<ModuleInfoListDTO> getModuleInfoListByType(GetModuleInfoVO getModuleInfoVO);
+}

+ 10 - 0
precman-service/src/main/java/com/diagbot/service/QuestionInfoService.java

@@ -2,9 +2,11 @@ package com.diagbot.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.GetQuestionInfoDTO;
 import com.diagbot.dto.QuestionPageDTO;
 import com.diagbot.entity.QuestionInfo;
 import com.diagbot.entity.wrapper.QuestionInfoWrapper;
+import com.diagbot.vo.ModuleGetQuestionInfoVO;
 import com.diagbot.vo.QuestionPageVO;
 
 import java.util.List;
@@ -76,6 +78,14 @@ public interface QuestionInfoService extends IService<QuestionInfo> {
      */
     public List<QuestionInfoWrapper> getByQuestionMapping(Map map);
 
+    /**
+     * 根据名称获取标签信息
+     *
+     * @param moduleGetQuestionInfoVO
+     * @return
+     */
+    public List<GetQuestionInfoDTO> moduleGetQuestiongInfoByName(ModuleGetQuestionInfoVO moduleGetQuestionInfoVO);
+
 }
 
 

+ 31 - 0
precman-service/src/main/java/com/diagbot/service/impl/ModuleDetailServiceImpl.java

@@ -0,0 +1,31 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.entity.ModuleDetail;
+import com.diagbot.mapper.ModuleDetailMapper;
+import com.diagbot.service.ModuleDetailService;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 模型明细表 服务实现类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-11-22
+ */
+@Service
+public class ModuleDetailServiceImpl extends ServiceImpl<ModuleDetailMapper, ModuleDetail> implements ModuleDetailService {
+
+    @Override
+    public void deleteByQuestionIds(Map map) {
+        baseMapper.deleteByQuestionIds(map);
+    }
+
+    @Override
+    public void deleteByModuleIds(Map map) {
+        baseMapper.deleteByModuleIds(map);
+    }
+}

+ 34 - 0
precman-service/src/main/java/com/diagbot/service/impl/ModuleInfoServiceImpl.java

@@ -0,0 +1,34 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.ModuleInfoListDTO;
+import com.diagbot.entity.ModuleInfo;
+import com.diagbot.mapper.ModuleInfoMapper;
+import com.diagbot.service.ModuleInfoService;
+import com.diagbot.vo.GetModuleInfoVO;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 模型表 服务实现类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-05
+ */
+@Service
+public class ModuleInfoServiceImpl extends ServiceImpl<ModuleInfoMapper, ModuleInfo> implements ModuleInfoService {
+
+    @Override
+    public void deleteByIds(Map map) {
+        baseMapper.deleteByIds(map);
+    }
+
+    @Override
+    public IPage<ModuleInfoListDTO> getModuleInfoListByType(GetModuleInfoVO getModuleInfoVO) {
+        return baseMapper.getModuleInfoListByType(getModuleInfoVO);
+    }
+}

+ 8 - 0
precman-service/src/main/java/com/diagbot/service/impl/QuestionInfoServiceImpl.java

@@ -2,11 +2,13 @@ package com.diagbot.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.GetQuestionInfoDTO;
 import com.diagbot.dto.QuestionPageDTO;
 import com.diagbot.entity.QuestionInfo;
 import com.diagbot.entity.wrapper.QuestionInfoWrapper;
 import com.diagbot.mapper.QuestionInfoMapper;
 import com.diagbot.service.QuestionInfoService;
+import com.diagbot.vo.ModuleGetQuestionInfoVO;
 import com.diagbot.vo.QuestionPageVO;
 import org.springframework.stereotype.Service;
 
@@ -53,4 +55,10 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
     public IPage<QuestionPageDTO> getList(QuestionPageVO questionPageVO) {
         return baseMapper.getList(questionPageVO);
     }
+
+    @Override
+    public List<GetQuestionInfoDTO> moduleGetQuestiongInfoByName(ModuleGetQuestionInfoVO moduleGetQuestionInfoVO) {
+        return baseMapper.moduleGetQuestiongInfoByName(moduleGetQuestionInfoVO);
+    }
+
 }

+ 22 - 0
precman-service/src/main/java/com/diagbot/vo/AddModuleDetailVO.java

@@ -0,0 +1,22 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/12/24 11:46
+ */
+@Getter
+@Setter
+public class AddModuleDetailVO {
+    //标签id
+    private Long questionId;
+    //特殊标识
+    private String flag;
+    //特殊符号,例如逗号,句号
+    private String text;
+    //子模板id
+    private Long relationModule;
+}

+ 29 - 0
precman-service/src/main/java/com/diagbot/vo/AddModuleInfoVO.java

@@ -0,0 +1,29 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/12/24 11:35
+ */
+@Getter
+@Setter
+public class AddModuleInfoVO {
+    @NotNull(message="模板名称不能为空")
+    private String name;
+    @NotNull(message="模板归属不能为空")
+    private String type;
+    //特殊标签归属类型
+    private Integer textType;
+    //标签id
+    private List<AddModuleDetailVO> modelDetils;
+    @NotNull(message="模板类型不能为空")//模板类型(通用,普通,慢病)
+    private Long moduleType;
+    //关联id
+    private Long relationId;
+}

+ 18 - 0
precman-service/src/main/java/com/diagbot/vo/ConceptSearchVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2019/5/6 18:50
+ */
+@Getter
+@Setter
+public class ConceptSearchVO {
+    //术语Id列表
+    private List<Long> conceptIds;
+}

+ 17 - 0
precman-service/src/main/java/com/diagbot/vo/ConceptTypeVO.java

@@ -0,0 +1,17 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2019/5/10 14:03
+ */
+@Getter
+@Setter
+public class ConceptTypeVO {
+    //类型
+    private Integer type;
+
+}

+ 16 - 0
precman-service/src/main/java/com/diagbot/vo/DeleteModuleVO.java

@@ -0,0 +1,16 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2019/1/28 15:55
+ */
+@Getter
+@Setter
+public class DeleteModuleVO {
+    //要删除的id
+    private String ids;
+}

+ 19 - 0
precman-service/src/main/java/com/diagbot/vo/GetAllDeptAndDisInfoVO.java

@@ -0,0 +1,19 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2019/4/24 16:36
+ */
+@Getter
+@Setter
+public class GetAllDeptAndDisInfoVO {
+    //模板类型
+    private Long moduleType;
+    //模板归属
+    private String type;
+
+}

+ 20 - 0
precman-service/src/main/java/com/diagbot/vo/GetModuleDetailInfoVO.java

@@ -0,0 +1,20 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/12/27 16:55
+ */
+@Getter
+@Setter
+public class GetModuleDetailInfoVO {
+    @NotNull(message = "请输入模板id")
+    private Long moduleId;
+    //模板类型
+    private Integer type;
+}

+ 18 - 0
precman-service/src/main/java/com/diagbot/vo/GetModuleInfoOneVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/12/28 17:03
+ */
+@Getter
+@Setter
+public class GetModuleInfoOneVO {
+    /**
+     * 模板id
+     */
+    private Long moduleId;
+}

+ 25 - 0
precman-service/src/main/java/com/diagbot/vo/GetModuleInfoVO.java

@@ -0,0 +1,25 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/12/26 15:27
+ */
+@Getter
+@Setter
+public class GetModuleInfoVO extends Page {
+    //模板归属
+    private String type;
+    //模板类型
+    private Integer moduleType;
+    //关联id
+    private Long relationId;
+    //要去重的子模板
+    private List<Long> noIds;
+}

+ 19 - 0
precman-service/src/main/java/com/diagbot/vo/GetModuleTypeVO.java

@@ -0,0 +1,19 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2019/3/28 14:46
+ */
+@Getter
+@Setter
+public class GetModuleTypeVO {
+    @NotNull(message = "请输入moduleType")
+    private Long moduleType;
+    private Long relationId;
+}

+ 16 - 0
precman-service/src/main/java/com/diagbot/vo/GetQuestiongAndModuleRelationsVO.java

@@ -0,0 +1,16 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2019/4/25 10:22
+ */
+@Getter
+@Setter
+public class GetQuestiongAndModuleRelationsVO {
+    //疾病id
+    private Long questionId;
+}

+ 37 - 0
precman-service/src/main/java/com/diagbot/vo/ModuleGetQuestionInfoVO.java

@@ -0,0 +1,37 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/12/25 17:26
+ */
+@Getter
+@Setter
+public class ModuleGetQuestionInfoVO {
+    /**
+     * 标签名称
+     */
+    private String tagName;
+
+    /**
+     * 模板id
+     */
+    private String moduleId;
+
+    /**
+     * 要去重的id
+     */
+    private List<Long> noIds;
+
+    /**
+     * 标签类型
+     */
+    @NotNull(message="归属类型不能为空")
+    private Integer type;
+}

+ 29 - 0
precman-service/src/main/java/com/diagbot/vo/UpdateModuleInfoVO.java

@@ -0,0 +1,29 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/12/24 11:35
+ */
+@Getter
+@Setter
+public class UpdateModuleInfoVO {
+    @NotNull(message="模板id不能为空")
+    private Long id;
+    @NotNull(message="模板名称不能为空")
+    private String name;
+    @NotNull(message="模板属于不能为空")
+    private int type;
+    @NotNull(message="标签id不能为空")
+    private List<AddModuleDetailVO> modelDetils;
+    @NotNull(message="模板类型不能为空")
+    private Long moduleType;
+    //关联id
+    private Long relationId;
+}

+ 183 - 0
precman-service/src/main/java/com/diagbot/web/ModuleInfoController.java

@@ -0,0 +1,183 @@
+package com.diagbot.web;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.GetAllDeptAndDisInfoDTO;
+import com.diagbot.dto.GetModuleDetailInfoDTO;
+import com.diagbot.dto.GetModuleInfoOneDTO;
+import com.diagbot.dto.GetModuleTypeDTO;
+import com.diagbot.dto.GetQuestionInfoDTO;
+import com.diagbot.dto.GetQuestiongAndModuleRelationsDTO;
+import com.diagbot.dto.ModuleInfoDTO;
+import com.diagbot.dto.ModuleInfoListDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.ModuleInfoFacade;
+import com.diagbot.vo.AddModuleInfoVO;
+import com.diagbot.vo.DeleteModuleVO;
+import com.diagbot.vo.GetAllDeptAndDisInfoVO;
+import com.diagbot.vo.GetModuleDetailInfoVO;
+import com.diagbot.vo.GetModuleInfoOneVO;
+import com.diagbot.vo.GetModuleInfoVO;
+import com.diagbot.vo.GetModuleTypeVO;
+import com.diagbot.vo.GetQuestiongAndModuleRelationsVO;
+import com.diagbot.vo.ModuleGetQuestionInfoVO;
+import com.diagbot.vo.UpdateModuleInfoVO;
+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>
+ * 模型表 前端控制器
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-05
+ */
+@RestController
+@RequestMapping("/moduleInfo")
+@SuppressWarnings("unchecked")
+@Api(value = "主诉-既往史模板相关API", tags = { "知识库标准化-模板相关API" })
+public class ModuleInfoController {
+
+
+    @Autowired
+    ModuleInfoFacade moduleInfoFacade;
+
+    @ApiOperation(value = "2期-模板新增[by:wangyu]",
+            notes = "name: 模板名称,必填<br>" +
+                    "type: 模板类型,必填<br>" +
+                    "questionId: 标签id,不是标点符号时需要填写<br>" +
+                    "flag: 特殊标识类型<br>" +
+                    "relationModule: 关联模板id<br>" +
+                    "text: 特殊标签(如逗号句号)<br>" +
+                    "textType: 特殊标签归属类型<br>" +
+                    "moduleType: 模板类型,必填<br>" +
+                    "relationId: 关联id,moduleType为0不用传,moduleType为1传科室id,moduleType为2传疾病id")
+    @PostMapping("/saveModuleInfo")
+    @SysLogger("saveModuleInfo")
+    @Transactional
+    public RespDTO<Boolean> saveModuleInfo(@Valid @RequestBody AddModuleInfoVO addModuleInfoVO) {
+        Boolean data = moduleInfoFacade.saveModuleInfo(addModuleInfoVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "2期-模板修改[by:wangyu]",
+            notes = "id: 模板id,必填<br>" +
+                    "name: 模板名称,必填<br>" +
+                    "type: 模板类型,必填<br>" +
+                    "questionId: 标签id,必填<br>" +
+                    "flag: 特殊标示类型<br>" +
+                    "relationModule: 关联模板id<br>"+
+                    "moduleType: 模板类型,必填<br>" +
+                    "relationId: 关联id,moduleType为0不用传,moduleType为1传科室id,moduleType为2传疾病id")
+    @PostMapping("/updateModuleInfo")
+    @SysLogger("updateModuleInfo")
+    @Transactional
+    public RespDTO<Boolean> updateModuleInfo(@Valid @RequestBody UpdateModuleInfoVO updateModuleInfoVO) {
+        Boolean data = moduleInfoFacade.updateModuleInfo(updateModuleInfoVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "模板删除[by:zhoutg]",
+            notes = "")
+    @PostMapping("/delete")
+    @SysLogger("delete")
+    @Transactional
+    public RespDTO<Boolean> delete(@RequestBody DeleteModuleVO deleteModuleVO) {
+        moduleInfoFacade.deleteByIdsFac(deleteModuleVO.getIds());
+        return RespDTO.onSuc(true);
+    }
+
+    @ApiOperation(value = "获取标签池信息[by:wangyu]",
+            notes = "tagName: 标签名<br>" +
+                    "moduleId: 模板id,添加时不用填,修改时必填<br>" +
+                    "type: 标签归属类型,必填<br>" +
+                    "noIds: 要去重的id")
+    @PostMapping("/getQuestionInfos")
+    @SysLogger("getQuestionInfos")
+    public RespDTO<List<GetQuestionInfoDTO>> getQuestionInfos(@Valid @RequestBody ModuleGetQuestionInfoVO moduleGetQuestionInfoVO) {
+        List<GetQuestionInfoDTO> date = moduleInfoFacade.getQuestionInfos(moduleGetQuestionInfoVO);
+        return RespDTO.onSuc(date);
+    }
+
+    @ApiOperation(value = "2期-获取模板信息(作为子模板使用时传入type时需3+模板自己的type)[by:wangyu]",
+            notes = "moduleType: 模板类型,0.通用 1.根据科室划分 2.慢病<br>" +
+                    "type: 模板归属<br>" +
+                    "relationId: 关联id<br>" +
+                    "noIds: 要去重的子模板")
+    @PostMapping("/getModuleInfo")
+    @SysLogger("getModuleInfo")
+    public RespDTO<List<ModuleInfoDTO>> getModuleInfo(@Valid @RequestBody GetModuleInfoVO getModuleInfoVO) {
+        List<ModuleInfoDTO> date = moduleInfoFacade.getModuleInfo(getModuleInfoVO);
+        return RespDTO.onSuc(date);
+    }
+
+    @ApiOperation(value = "2期-获取模板列表(主页面查询)[by:wangyu]",
+            notes = "type: 模板类型,1.主诉 2.现病史 3.其他史 4.查体 5.化验 6.辅检 7.诊断 8.医嘱<br>" +
+                    "moduleType: 模板类型,0.通用 1.根据科室划分 2.慢病<br>" +
+                    "relationId: 关联id<br>")
+    @PostMapping("/getModuleInfoList")
+    @SysLogger("getModuleInfoList")
+    public RespDTO<IPage<ModuleInfoListDTO>> getModuleInfoList(@Valid @RequestBody GetModuleInfoVO getModuleInfoVO) {
+        IPage<ModuleInfoListDTO> date = moduleInfoFacade.getModuleInfoList(getModuleInfoVO);
+        return RespDTO.onSuc(date);
+    }
+
+    @ApiOperation(value = "2期-获取模板明细信息——修改时获取已添加过的标签[by:wangyu]",
+            notes = "moduleId: 模板id<br>" +
+                    "type: 模板归属<br>")
+    @PostMapping("/getModuleDetailInfo")
+    @SysLogger("getModuleDetailInfo")
+    public RespDTO<List<GetModuleDetailInfoDTO>> getModuleDetailInfo(@Valid @RequestBody GetModuleDetailInfoVO getModuleDetailInfoVO) {
+        List<GetModuleDetailInfoDTO> date = moduleInfoFacade.getModuleDetailInfo(getModuleDetailInfoVO);
+        return RespDTO.onSuc(date);
+    }
+
+    @ApiOperation(value = "2期-获取单个模板信息(修改用)[by:wangyu]",
+            notes = "" +
+                    "moduleId: 模板id<br>")
+    @PostMapping("/getModuleInfoOne")
+    @SysLogger("getModuleInfoOne")
+    public RespDTO<GetModuleInfoOneDTO> getModuleInfoOne(@Valid @RequestBody GetModuleInfoOneVO getModuleInfoVO) {
+        GetModuleInfoOneDTO date = moduleInfoFacade.getModuleInfoOne(getModuleInfoVO);
+        return RespDTO.onSuc(date);
+    }
+
+    @ApiOperation(value = "2期-获取模板Type[主诉到诊断](修改获取类型用)[by:wangyu]",
+            notes = "moduleType: 模板mouduleType,必填<br>" +
+                    "")
+    @PostMapping("/getModuleType")
+    @SysLogger("getModuleType")
+    public RespDTO<List<GetModuleTypeDTO>> getModuleType(@Valid @RequestBody GetModuleTypeVO getModuleTypeVO) {
+        List<GetModuleTypeDTO> date = moduleInfoFacade.getModuleType(getModuleTypeVO);
+        return RespDTO.onSuc(date);
+    }
+
+    @ApiOperation(value = "2期-获取科室和疾病所有信息(主页面下拉用)[by:wangyu]",
+            notes = "")
+    @PostMapping("/getAllDeptAndDisInfo")
+    @SysLogger("getAllDeptAndDisInfo")
+    public RespDTO<GetAllDeptAndDisInfoDTO> getAllDeptAndDisInfo(@RequestBody GetAllDeptAndDisInfoVO getAllDeptAndDisInfoVO) {
+        GetAllDeptAndDisInfoDTO date = moduleInfoFacade.getAllDeptAndDisInfo(getAllDeptAndDisInfoVO);
+        return RespDTO.onSuc(date);
+    }
+
+    @ApiOperation(value = "2期-获取标签和模板关联信息(删除标签时校验用)[by:wangyu]",
+            notes = "questionId: 标签id")
+    @PostMapping("/getQuestiongAndModuleRelations")
+    @SysLogger("getQuestiongAndModuleRelations")
+    public RespDTO<GetQuestiongAndModuleRelationsDTO> getQuestiongAndModuleRelations(@RequestBody GetQuestiongAndModuleRelationsVO getQuestiongAndModuleRelationsVO) {
+        GetQuestiongAndModuleRelationsDTO date = moduleInfoFacade.getQuestiongAndModuleRelations(getQuestiongAndModuleRelationsVO);
+        return RespDTO.onSuc(date);
+    }
+}

+ 41 - 0
precman-service/src/main/resources/mapper/ModuleDetailMapper.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.ModuleDetailMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.ModuleDetail">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="module_id" property="moduleId" />
+        <result column="prefix" property="prefix" />
+        <result column="suffix" property="suffix" />
+        <result column="question_id" property="questionId" />
+        <result column="order_no" property="orderNo" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+    <delete id="deleteByQuestionIds" parameterType="java.util.Map">
+        update `icss_module_detail`
+        set gmt_modified = #{gmtModified}, modifier = #{modifier}, is_deleted = #{delete}
+        where is_deleted = 'N'
+        and question_id in
+        <foreach item="id" collection="ids" open="(" separator="," close=")" >
+            #{id}
+        </foreach>
+    </delete>
+
+
+    <delete id="deleteByModuleIds" parameterType="java.util.Map">
+        update `icss_module_detail`
+        set gmt_modified = #{gmtModified}, modifier = #{modifier}, is_deleted = #{delete}
+        where is_deleted = 'N'
+        and module_id in
+        <foreach item="id" collection="ids" open="(" separator="," close=")" >
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 44 - 0
precman-service/src/main/resources/mapper/ModuleInfoMapper.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.ModuleInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.ModuleInfo">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="name" property="name" />
+        <result column="type" property="type" />
+        <result column="module_type" property="moduleType" />
+        <result column="relation_id" property="relationId" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+
+    <delete id="deleteByIds" parameterType="java.util.Map">
+        update `icss_module_info`
+        set gmt_modified = #{gmtModified}, modifier = #{modifier}, is_deleted = #{delete}
+        where is_deleted = 'N'
+        and id in
+        <foreach item="id" collection="ids" open="(" separator="," close=")" >
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="getModuleInfoListByType" resultType="com.diagbot.dto.ModuleInfoListDTO">
+        SELECT * FROM `icss_module_info` WHERE is_deleted = 'N'
+        <if test="type != null and type != ''">
+            and type = #{type}
+        </if>
+        <if test="moduleType != null">
+            and  module_type = #{moduleType}
+        </if>
+        <if test="relationId != null and relationId != ''">
+            and  relation_id = #{relationId}
+        </if>
+        order by gmt_modified desc
+    </select>
+</mapper>

+ 31 - 0
precman-service/src/main/resources/mapper/QuestionInfoMapper.xml

@@ -176,4 +176,35 @@
         </if>
     </select>
 
+
+    <select id="moduleGetQuestiongInfoByName" resultType="com.diagbot.dto.GetQuestionInfoDTO">
+        SELECT
+        a.*
+        FROM
+        `icss_question_info` a
+        WHERE
+        a.is_deleted = 'N'
+        AND a.type = #{type} AND a.tag_type != 8 and a.control_type != 99
+        <if test="moduleId != null and moduleId != ''">
+            AND a.id NOT IN (
+            SELECT
+            c.question_id
+            FROM
+            `icss_module_detail` c
+            WHERE
+            c.is_deleted = 'N'
+            AND c.module_id = #{moduleId}
+            AND c.question_id != ''
+            )
+        </if>
+        <if test="noIds != null and noIds.size != 0">
+            AND a.id NOT IN
+            <foreach  collection="noIds" item="noId" open="("  separator=","  close=")">
+                #{noId}
+            </foreach>
+        </if>
+        <if test="tagName != null and tagName != ''">
+            AND a.tag_name like CONCAT('%', #{tagName}, '%')
+        </if>
+    </select>
 </mapper>