12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?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.RetrievalMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.diagbot.entity.Retrieval">
- <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="spell" property="spell" />
- <result column="remark" property="remark" />
- </resultMap>
- <select id="getSymptopInfo" resultType="com.diagbot.dto.RetrievalDTO">
- SELECT a.`name`,c.id as question_id,b.show_type 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 a.`name`,c.id as question_id,b.show_type 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 a.`name`,c.id as question_id,b.show_type 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>
|