zhoutg 6 år sedan
förälder
incheckning
00b4e9a6a3

+ 30 - 7
icssman-service/src/main/java/com/diagbot/facade/QuestionInfoFacade.java

@@ -4,7 +4,6 @@ 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.dto.GetQuestionInfoDTO;
-import com.diagbot.dto.QuestionIndexDTO;
 import com.diagbot.dto.QuestionPageDTO;
 import com.diagbot.entity.CommonParam;
 import com.diagbot.entity.DeptInfo;
@@ -28,8 +27,10 @@ import com.diagbot.util.StringUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.GetQuestionInfoVO;
 import com.diagbot.vo.GetQuestionUsualByDeptVO;
+import com.diagbot.vo.QuestionIndexVO;
 import com.diagbot.vo.QuestionPageVO;
 import com.diagbot.vo.QuestionSaveVO;
+import com.diagbot.vo.QuestionSpecVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
@@ -283,6 +284,7 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
         this.saveOrUpdate(questionInfo);
     }
 
+
     /**
      * 标签列表
      *
@@ -333,19 +335,38 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
     /**
      * 检索
      *
-     * @param questionIndexDTO
+     * @param questionIndexVO
      * @return
      */
-    public List<QuestionInfo> indexFac(QuestionIndexDTO questionIndexDTO) {
+    public List<QuestionInfo> indexFac(QuestionIndexVO questionIndexVO) {
         Map<String, Object> paramMap = new HashMap<>();
         paramMap.put("isDeleted", IsDeleteEnum.N.getKey());
-        paramMap.put("age", questionIndexDTO.getAge());
-        paramMap.put("sexType", questionIndexDTO.getSexType());
-        paramMap.put("tagName", questionIndexDTO.getTagName());
-        paramMap.put("type", questionIndexDTO.getType());
+        paramMap.put("age", questionIndexVO.getAge());
+        paramMap.put("sexType", questionIndexVO.getSexType());
+        paramMap.put("tagName", questionIndexVO.getTagName());
+        paramMap.put("type", questionIndexVO.getType());
+        paramMap.put("controlType", questionIndexVO.getControlType());
+        paramMap.put("notIds", questionIndexVO.getNotIds());
         return this.index(paramMap);
     }
 
+
+    /**
+     * 获取特殊标签(同伴|无)
+     *
+     * @param questionSpecVO
+     * @return
+     */
+    public List<QuestionInfo> getSpecialFac(QuestionSpecVO questionSpecVO) {
+        Map<String, Object> paramMap = new HashMap<>();
+        paramMap.put("age", questionSpecVO.getAge());
+        paramMap.put("sexType", questionSpecVO.getSexType());
+        paramMap.put("type", questionSpecVO.getType());
+        paramMap.put("notIds", questionSpecVO.getNotIds());
+        return this.getSpecial(paramMap);
+    }
+
+
     /**
      * 根据标签名获取标签信息
      *
@@ -360,6 +381,7 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
         return this.getOne(queryWrapper);
     }
 
+
     /**
      * 根据标签名获取标签信息
      *
@@ -371,6 +393,7 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
         return getQuestionInfoDTOS;
     }
 
+
     /**
      * 根据科室id获取常用标签信息
      *

+ 8 - 0
icssman-service/src/main/java/com/diagbot/mapper/QuestionInfoMapper.java

@@ -43,6 +43,14 @@ public interface QuestionInfoMapper extends BaseMapper<QuestionInfo> {
     public List<GetQuestionInfoDTO> getQuestionUsualsByDept(GetQuestionUsualByDeptVO getQuestionUsualByDeptVO);
 
 
+    /**
+     * 获取特殊标签,同伴|无
+     * @param map
+     * @return
+     */
+    public List<QuestionInfo> getSpecial(Map map);
+
+
     /**
      * 获取标签列表
      *

+ 9 - 0
icssman-service/src/main/java/com/diagbot/service/QuestionInfoService.java

@@ -63,6 +63,15 @@ public interface QuestionInfoService extends IService<QuestionInfo> {
      * @return
      */
     public List<GetQuestionInfoDTO> getQuestionUsualsByDept(GetQuestionUsualByDeptVO getQuestionUsualByDeptVO);
+
+
+    /**
+     * 获取特殊标签
+     *
+     * @param map
+     * @return
+     */
+    public List<QuestionInfo> getSpecial(Map map);
 }
 
 

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

@@ -46,6 +46,11 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
         return baseMapper.getQuestionUsualsByDept(getQuestionUsualByDeptVO);
     }
 
+    @Override
+    public List<QuestionInfo> getSpecial(Map map) {
+        return baseMapper.getSpecial(map);
+    }
+
     @Override
     public IPage<QuestionPageDTO> getList(QuestionPageVO questionPageVO) {
         return baseMapper.getList(questionPageVO);

+ 6 - 2
icssman-service/src/main/java/com/diagbot/dto/QuestionIndexDTO.java

@@ -1,8 +1,10 @@
-package com.diagbot.dto;
+package com.diagbot.vo;
 
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.List;
+
 /**
  * @Description:
  * @Author:zhaops
@@ -10,9 +12,11 @@ import lombok.Setter;
  */
 @Getter
 @Setter
-public class QuestionIndexDTO {
+public class QuestionIndexVO {
     private String tagName;
     private Integer sexType;
     private Integer age;
     private Integer type;
+    private Integer controlType;
+    private List<Long> notIds;
 }

+ 20 - 0
icssman-service/src/main/java/com/diagbot/vo/QuestionSpecVO.java

@@ -0,0 +1,20 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description: 特殊标签
+ * @Author: ztg
+ * @Date: 2018/12/18 16:35
+ */
+@Getter
+@Setter
+public class QuestionSpecVO {
+    private Integer sexType;
+    private Integer age;
+    private Integer type;
+    private List<Long> notIds;
+}

+ 14 - 3
icssman-service/src/main/java/com/diagbot/web/QuestionInfoController.java

@@ -3,13 +3,14 @@ package com.diagbot.web;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
-import com.diagbot.dto.QuestionIndexDTO;
 import com.diagbot.dto.QuestionPageDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.QuestionInfo;
 import com.diagbot.facade.QuestionInfoFacade;
+import com.diagbot.vo.QuestionIndexVO;
 import com.diagbot.vo.QuestionPageVO;
 import com.diagbot.vo.QuestionSaveVO;
+import com.diagbot.vo.QuestionSpecVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -63,8 +64,18 @@ public class QuestionInfoController {
             notes = "")
     @PostMapping("/index")
     @SysLogger("index")
-    public RespDTO<List<QuestionInfo>> index(@RequestBody QuestionIndexDTO questionIndexDTO) {
-        List<QuestionInfo> data = questionInfoFacade.indexFac(questionIndexDTO);
+    public RespDTO<List<QuestionInfo>> index(@RequestBody QuestionIndexVO questionIndexVO) {
+        List<QuestionInfo> data = questionInfoFacade.indexFac(questionIndexVO);
+        return RespDTO.onSuc(data);
+    }
+
+
+    @ApiOperation(value = "获取特殊标签(同伴|无)[by:zhoutg]",
+            notes = "")
+    @PostMapping("/getSpecial")
+    @SysLogger("getSpecial")
+    public RespDTO<List<QuestionInfo>> getSpecial(@RequestBody QuestionSpecVO questionSpecVO) {
+        List<QuestionInfo> data = questionInfoFacade.getSpecialFac(questionSpecVO);
         return RespDTO.onSuc(data);
     }
 

+ 33 - 17
icssman-service/src/main/resources/mapper/QuestionInfoMapper.xml

@@ -48,7 +48,7 @@
         select * from `icss_question_info`
         where is_deleted = 'N'
         <if test="tagName != null and tagName != ''">
-            and tag_name = #{tagName}
+            and tag_name like concat("%", #{tagName}, "%")
         </if>
         <if test="sexType != null and sexType != ''">
             and sex_type in (3, #{sexType})
@@ -60,24 +60,16 @@
         <if test="type != null and type != ''">
             and type = #{type}
         </if>
-
-        union
-
-        select * from `icss_question_info`
-        where is_deleted = 'N'
-        <if test="tagName != null and tagName != ''">
-            and tag_name like concat("%", #{tagName}, "%")
-        </if>
-        <if test="sexType != null and sexType != ''">
-            and sex_type in (3, #{sexType})
+        <if test="controlType != null and controlType != ''">
+            and control_type = #{controlType}
         </if>
-        <if test="age != null and age != ''">
-            <![CDATA[ and age_begin <= #{age} ]]>
-            <![CDATA[ and age_end >= #{age} ]]>
-        </if>
-        <if test="type != null and type != ''">
-            and type = #{type}
+        <if test="notIds != null and notIds.size() > 0 ">
+            and id not in
+            <foreach  collection="notIds" item="id" open="("  separator=","  close=")">
+                #{id}
+            </foreach>
         </if>
+        order by gmt_modified desc
     </select>
 
     <select id="getQuestiongInfoByName" resultType="com.diagbot.dto.GetQuestionInfoDTO">
@@ -127,4 +119,28 @@
         GROUP BY a.id
     </select>
 
+
+    <select id="getSpecial" parameterType="java.util.Map" resultMap="BaseResultMap">
+        SELECT DISTINCT t1.* FROM icss_question_info t1, `icss_question_detail` t2
+        where t1.is_deleted = 'N' and t2.is_deleted = 'N' and
+        t1.id = t2.question_id and t2.`code` in (1,2)
+        <if test="sexType != null and sexType != ''">
+            and t1.sex_type in (3, #{sexType})
+        </if>
+        <if test="age != null and age != ''">
+            <![CDATA[ and t1.age_begin <= #{age} ]]>
+            <![CDATA[ and t1.age_end >= #{age} ]]>
+        </if>
+        <if test="type != null and type != ''">
+            and t1.type = #{type}
+        </if>
+        <if test="notIds != null and notIds.size() > 0 ">
+            and t1.id not in
+            <foreach  collection="notIds" item="id" open="("  separator=","  close=")">
+                #{id}
+            </foreach>
+        </if>
+    </select>
+
+
 </mapper>