浏览代码

页面检索接口

wangyu 6 年之前
父节点
当前提交
c75599df55

+ 18 - 0
icss-service/src/main/java/com/diagbot/dto/RetrievalDTO.java

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/11/27 14:58
+ */
+@Getter
+@Setter
+public class RetrievalDTO {
+    //标签名称
+    private String name;
+    //标签id
+    private Long questionId;
+}

+ 22 - 0
icss-service/src/main/java/com/diagbot/entity/QuestionType.java

@@ -0,0 +1,22 @@
+package com.diagbot.entity;
+
+/**
+ * @Description:标签类型常量类
+ * @author: wangyu
+ * @time: 2018/11/27 19:58
+ */
+public class QuestionType {
+    //症状
+    public static final String Symptom= "1";
+    //其他史
+    public static final String Other= "3";
+    //查体
+    public static final String Vital= "4";
+    //化验
+    public static final String Lis= "5";
+    //辅检
+    public static final String Pacs= "6";
+    //诊断
+    public static final String Disease= "7";
+
+}

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

@@ -0,0 +1,33 @@
+package com.diagbot.facade;
+
+import com.diagbot.dto.RetrievalDTO;
+import com.diagbot.service.impl.RetrievalServiceImpl;
+import com.diagbot.vo.RetrievalVO;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/11/27 14:54
+ */
+@Component
+public class RetrievalFacade extends RetrievalServiceImpl {
+
+    /**
+     * 获取标签信息
+     * @param retrievalVO
+     * @return
+     */
+    public List<RetrievalDTO> getTagInfos(RetrievalVO retrievalVO) {
+        List<RetrievalDTO> data =new ArrayList<>();
+        if(retrievalVO.getInputStr() == null || retrievalVO.getInputStr().isEmpty()){
+            data = new ArrayList<>();
+            return data;
+        }
+        data = this.getSymptopInfo(retrievalVO);
+        return data;
+    }
+}

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

@@ -1,7 +1,11 @@
 package com.diagbot.mapper;
 package com.diagbot.mapper;
 
 
+import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.entity.Retrieval;
 import com.diagbot.entity.Retrieval;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.vo.RetrievalVO;
+
+import java.util.List;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -13,4 +17,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
  */
 public interface RetrievalMapper extends BaseMapper<Retrieval> {
 public interface RetrievalMapper extends BaseMapper<Retrieval> {
 
 
+    /**
+     * 获取主诉信息
+     * @param retrievalVO
+     * @return
+     */
+    public List<RetrievalDTO> getSymptopInfo(RetrievalVO retrievalVO);
 }
 }

+ 11 - 1
icss-service/src/main/java/com/diagbot/service/RetrievalService.java

@@ -1,7 +1,11 @@
 package com.diagbot.service;
 package com.diagbot.service;
 
 
-import com.diagbot.entity.Retrieval;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.RetrievalDTO;
+import com.diagbot.entity.Retrieval;
+import com.diagbot.vo.RetrievalVO;
+
+import java.util.List;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -13,4 +17,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
  */
 public interface RetrievalService extends IService<Retrieval> {
 public interface RetrievalService extends IService<Retrieval> {
 
 
+    /**
+     * 获取主诉信息
+     * @param retrievalVO
+     * @return
+     */
+    public List<RetrievalDTO> getSymptopInfo(RetrievalVO retrievalVO);
 }
 }

+ 8 - 0
icss-service/src/main/java/com/diagbot/service/impl/RetrievalServiceImpl.java

@@ -1,11 +1,15 @@
 package com.diagbot.service.impl;
 package com.diagbot.service.impl;
 
 
+import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.entity.Retrieval;
 import com.diagbot.entity.Retrieval;
 import com.diagbot.mapper.RetrievalMapper;
 import com.diagbot.mapper.RetrievalMapper;
 import com.diagbot.service.RetrievalService;
 import com.diagbot.service.RetrievalService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.vo.RetrievalVO;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  * 检索表 服务实现类
  * 检索表 服务实现类
@@ -17,4 +21,8 @@ import org.springframework.stereotype.Service;
 @Service
 @Service
 public class RetrievalServiceImpl extends ServiceImpl<RetrievalMapper, Retrieval> implements RetrievalService {
 public class RetrievalServiceImpl extends ServiceImpl<RetrievalMapper, Retrieval> implements RetrievalService {
 
 
+    @Override
+    public List<RetrievalDTO> getSymptopInfo(RetrievalVO retrievalVO) {
+        return baseMapper.getSymptopInfo(retrievalVO);
+    }
 }
 }

+ 25 - 0
icss-service/src/main/java/com/diagbot/vo/RetrievalVO.java

@@ -0,0 +1,25 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/11/27 14:58
+ */
+@Getter
+@Setter
+public class RetrievalVO {
+
+    @NotNull(message = "请输入标签类型")
+    private Integer type;
+    @NotNull(message = "请输入病人年龄")
+    private Integer age;
+    @NotNull(message = "请输入症状")
+    private String InputStr;
+    @NotNull(message = "请输入病人性别")
+    private Integer sexType;
+}

+ 24 - 1
icss-service/src/main/java/com/diagbot/web/RetrievalController.java

@@ -1,10 +1,22 @@
 package com.diagbot.web;
 package com.diagbot.web;
 
 
 
 
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.RetrievalDTO;
+import com.diagbot.facade.RetrievalFacade;
+import com.diagbot.vo.RetrievalVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
+import javax.validation.Valid;
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  * 同义词检索检索表 前端控制器
  * 同义词检索检索表 前端控制器
@@ -15,8 +27,19 @@ import org.springframework.web.bind.annotation.RestController;
  */
  */
 @RestController
 @RestController
 @RequestMapping("/retrieval")
 @RequestMapping("/retrieval")
-@Api(value = "同义词检索API", tags = { "同义词检索API" })
+@Api(value = "页面检索API", tags = { "页面检索API" })
 @SuppressWarnings("unchecked")
 @SuppressWarnings("unchecked")
 public class RetrievalController {
 public class RetrievalController {
+    @Autowired
+    private RetrievalFacade retrievalFacade;
 
 
+    @ApiOperation(value = "页面检索——查询[by:wangyu]",
+            notes = "patientCode:患者编号,必填<br>" +
+                    "hospitalCode:医院编号,必填<br>")
+    @PostMapping("/getTagInfos")
+    @SysLogger("getTagInfos")
+    public RespDTO<List<RetrievalDTO>> getTagInfos(@Valid @RequestBody RetrievalVO retrievalVO) {
+        List<RetrievalDTO> data = retrievalFacade.getTagInfos(retrievalVO);
+        return RespDTO.onSuc(data);
+    }
 }
 }

+ 52 - 0
icss-service/src/main/resources/mapper/RetrievalMapper.xml

@@ -15,4 +15,56 @@
         <result column="remark" property="remark" />
         <result column="remark" property="remark" />
     </resultMap>
     </resultMap>
 
 
+    <select id="getSymptopInfo" resultType="com.diagbot.dto.RetrievalDTO">
+        SELECT c.`name`,c.id as questionId FROM icss_retrieval a
+        LEFT JOIN icss_retrieval_mapping b ON a.id = b.retrieval_id
+        LEFT JOIN icss_question_info c ON b.question_id = c.id
+        WHERE a.is_deleted = 'N' AND b.is_deleted = 'N' AND c.is_deleted = 'N'
+        AND (a.spell = #{InputStr} or a.`name` = #{InputStr})
+        AND c.type = #{type}
+        <if test="age != null and age != ''">
+            <![CDATA[ and c.age_begin <= #{age} ]]>
+            <![CDATA[ and c.age_end >= #{age} ]]>
+        </if>
+        <if test="sexType == 3">
+            and c.sex_type in ('1','2','3')
+        </if>
+        <if test="sexType != 3">
+            and c.sex_type in ('3',#{sexType})
+        </if>
+        UNION
+        SELECT c.`name`,c.id as questionId FROM icss_retrieval a
+        LEFT JOIN icss_retrieval_mapping b ON a.id = b.retrieval_id
+        LEFT JOIN icss_question_info c ON b.question_id = c.id
+        WHERE a.is_deleted = 'N' AND b.is_deleted = 'N' AND c.is_deleted = 'N'
+        AND (a.spell LIKE CONCAT(#{InputStr},'%') or a.`name` LIKE CONCAT(#{InputStr},'%'))
+        AND c.type = #{type}
+        <if test="age != null and age != ''">
+            <![CDATA[ and c.age_begin <= #{age} ]]>
+            <![CDATA[ and c.age_end >= #{age} ]]>
+        </if>
+        <if test="sexType == 3">
+            and c.sex_type in ('1','2','3')
+        </if>
+        <if test="sexType != 3">
+            and c.sex_type in ('3',#{sexType})
+        </if>
+        UNION
+        SELECT c.`name`,c.id as questionId FROM icss_retrieval a
+        LEFT JOIN icss_retrieval_mapping b ON a.id = b.retrieval_id
+        LEFT JOIN icss_question_info c ON b.question_id = c.id
+        WHERE a.is_deleted = 'N' AND b.is_deleted = 'N' AND c.is_deleted = 'N'
+        AND (a.spell LIKE CONCAT('%',#{InputStr},'%') or a.`name` LIKE CONCAT('%',#{InputStr},'%'))
+        AND c.type = #{type}
+        <if test="age != null and age != ''">
+            <![CDATA[ and c.age_begin <= #{age} ]]>
+            <![CDATA[ and c.age_end >= #{age} ]]>
+        </if>
+        <if test="sexType == 3">
+            and c.sex_type in ('1','2','3')
+        </if>
+        <if test="sexType != 3">
+            and c.sex_type in ('3',#{sexType})
+        </if>
+    </select>
 </mapper>
 </mapper>