Browse Source

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

zhoutg 6 years ago
parent
commit
7fca5e7c88

+ 11 - 0
icss-service/src/main/java/com/diagbot/facade/RetrievalFacade.java

@@ -3,6 +3,7 @@ package com.diagbot.facade;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.entity.QuestionInfo;
 import com.diagbot.service.impl.RetrievalServiceImpl;
+import com.diagbot.util.ListUtil;
 import com.diagbot.vo.RetrievalVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -35,6 +36,16 @@ public class RetrievalFacade extends RetrievalServiceImpl {
         if (retrievalVO.getInputStr() == null || retrievalVO.getInputStr() == "") {
             retrievalVO.setInputStr(" ");
         }
+        //过滤传来的空值
+        if(ListUtil.isNotEmpty(retrievalVO.getInputIds())){
+            List<Long> questionIds = new ArrayList<>();
+            for (Long questionId:retrievalVO.getInputIds()) {
+                if (null != questionId){
+                    questionIds.add(questionId);
+                }
+            }
+            retrievalVO.setInputIds(questionIds);
+        }
         //获取同义词标签信息
         List<RetrievalDTO> data = this.getSymptopInfo(retrievalVO);
         List<Long> selfIds = new ArrayList<>();

+ 52 - 0
icssman-service/src/main/java/com/diagbot/enums/ModuleTypeEnum.java

@@ -0,0 +1,52 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @Description:标签类型
+ * @Author:zhaops
+ * @time: 2018/11/21 11:39
+ */
+public enum ModuleTypeEnum implements KeyedNamed {
+    ChiefComplaint(1, "主诉模板"),
+    HistoryOfPresentIllness(2, "现病史模板"),
+    HistoryOfPresentIllnessNull(3, "现病史空模板"),
+    OtherHistory(4, "其他史模板"),
+    Nesting(5, "嵌套模板");
+
+    @Setter
+    private Integer key;
+
+    @Setter
+    private String name;
+
+    ModuleTypeEnum(Integer key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static ModuleTypeEnum getEnum(Integer key) {
+        for (ModuleTypeEnum item : ModuleTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(Integer key) {
+        ModuleTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}

+ 4 - 0
icssman-service/src/main/java/com/diagbot/facade/ModuleInfoFacade.java

@@ -20,6 +20,7 @@ import com.diagbot.exception.CommonException;
 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.StringUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.AddModuleInfoVO;
@@ -155,6 +156,9 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
         if (getModuleInfoVO.getType() != null) {
             moduleInfoQueryWrapper.eq("type", getModuleInfoVO.getType());
         }
+        if(ListUtil.isNotEmpty(getModuleInfoVO.getNoIds())){
+            moduleInfoQueryWrapper.notIn("id", getModuleInfoVO.getNoIds());
+        }
         List<ModuleInfo> moduleInfoList = this.list(moduleInfoQueryWrapper);
         List<Long> moduleIdList = moduleInfoList.stream().map(m -> m.getId()).collect(Collectors.toList());
         //获取模板明细信息

+ 2 - 0
icssman-service/src/main/java/com/diagbot/service/impl/EnumsDataServiceImpl.java

@@ -2,6 +2,7 @@ package com.diagbot.service.impl;
 
 import com.diagbot.enums.DisclaimerCodeEnum;
 import com.diagbot.enums.IntroducePositionEnum;
+import com.diagbot.enums.ModuleTypeEnum;
 import com.diagbot.enums.QuestionTypeEnum;
 import com.diagbot.service.EnumsDataService;
 import com.diagbot.util.EnumEntriesBuilder;
@@ -29,6 +30,7 @@ public class EnumsDataServiceImpl implements EnumsDataService {
                 .addEnums("questionTypeEnum", QuestionTypeEnum.values())
                 .addEnums("introducePositionEnum", IntroducePositionEnum.values())
                 .addEnums("disclaimerCodeEnum", DisclaimerCodeEnum.values())
+                .addEnums("moduleTypeEnum", ModuleTypeEnum.values())
                 .build();
         return enumMap;
     }

+ 4 - 0
icssman-service/src/main/java/com/diagbot/vo/GetModuleInfoVO.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.List;
+
 /**
  * @Description:
  * @author: wangyu
@@ -14,4 +16,6 @@ import lombok.Setter;
 public class GetModuleInfoVO extends Page {
     //模板类型
     private Integer type;
+    //要去重的子模板
+    private List<Long> noIds;
 }

+ 14 - 0
icssman-service/src/main/java/com/diagbot/vo/ModuleGetQuestionInfoVO.java

@@ -3,6 +3,9 @@ package com.diagbot.vo;
 import lombok.Getter;
 import lombok.Setter;
 
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
 /**
  * @Description:
  * @author: wangyu
@@ -20,4 +23,15 @@ public class ModuleGetQuestionInfoVO {
      * 模板id
      */
     private String moduleId;
+
+    /**
+     * 要去重的id
+     */
+    private List<Long> noIds;
+
+    /**
+     * 标签类型
+     */
+    @NotNull(message="归属类型不能为空")
+    private Integer type;
 }

+ 4 - 3
icssman-service/src/main/java/com/diagbot/web/ModuleInfoController.java

@@ -89,7 +89,8 @@ public class ModuleInfoController {
 
     @ApiOperation(value = "获取标签池信息[by:wangyu]",
             notes = "tagName: 标签名<br>" +
-                    "moduleId: 模板id,添加时不用填,修改时必填<br>")
+                    "moduleId: 模板id,添加时不用填,修改时必填<br>" +
+                    "type: 标签归属类型,必填")
     @PostMapping("/getQuestionInfos")
     @SysLogger("getQuestionInfos")
     public RespDTO<List<GetQuestionInfoDTO>> getQuestionInfos(@Valid @RequestBody ModuleGetQuestionInfoVO moduleGetQuestionInfoVO) {
@@ -97,7 +98,7 @@ public class ModuleInfoController {
         return RespDTO.onSuc(date);
     }
 
-    @ApiOperation(value = "获取模板信息[by:wangyu]",
+    @ApiOperation(value = "获取模板信息(作为子模板使用时传入type)[by:wangyu]",
             notes = "type: 模板类型,1:主诉模板 2:现病史模板 3:现病史空模板 4 : 其他史模板 5:嵌套模板 6:慢病模板<br>" +
                     "<br>")
     @PostMapping("/getModuleInfo")
@@ -107,7 +108,7 @@ public class ModuleInfoController {
         return RespDTO.onSuc(date);
     }
 
-    @ApiOperation(value = "获取模板列表[by:wangyu]",
+    @ApiOperation(value = "获取模板列表(主页面查询)[by:wangyu]",
             notes = "type: 模板类型,1:主诉模板 2:现病史模板 3:现病史空模板 4 : 其他史模板 5:嵌套模板 6:慢病模板<br>" +
                     "<br>")
     @PostMapping("/getModuleInfoList")

+ 8 - 0
icssman-service/src/main/resources/mapper/QuestionInfoMapper.xml

@@ -129,6 +129,7 @@
         `icss_question_info` a
         WHERE
         a.is_deleted = 'N'
+        AND a.type = #{type}
         <if test="moduleId != null and moduleId != ''">
             AND a.id NOT IN (
             SELECT
@@ -138,8 +139,15 @@
             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>