1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?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.ConceptInfoMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.diagbot.entity.ConceptInfo">
- <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="clinical_pathway_name" property="clinicalPathwayName"/>
- <result column="notice_name" property="noticeName"/>
- </resultMap>
- <select id="getReverse" resultType="com.diagbot.dto.ReverseDTO">
- SELECT
- t.*, e.sex_type,
- e.min_age,
- e.max_age
- FROM
- (
- SELECT
- a.lib_name,
- d.id sonId,
- d.lib_type sonType,
- d.lib_name sonName,
- c.order_no,
- b.relation_id
- FROM
- kl_concept a,
- kl_relation b,
- kl_relation_order c,
- kl_concept d
- WHERE
- a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND c.is_deleted = 'N'
- AND d.is_deleted = 'N'
- <if test="libName != null and libName != ''">
- AND a.lib_name = #{libName}
- </if>
- <if test="libType != null and libType != ''">
- AND a.lib_type = #{libType}
- </if>
- AND a.id = b.start_id
- AND b.end_id = d.id
- AND b.id = c.t_relation_id
- <if test="relationType != null and relationType.size() > 0">
- AND b.relation_id IN
- <foreach collection="relationType" open="(" close=")" separator="," item="item">
- #{item}
- </foreach>
- </if>
- ) t
- LEFT JOIN kl_concept_common e ON t.sonId = e.concept_id
- AND e.is_deleted = 'N'
- <if test="sexType != null and sexType != 3 and sexType != ''">
- and e.sex_type in (3, #{sexType})
- </if>
- <if test="age != null and age != ''">
- <![CDATA[ and ((e.min_age <= #{age} and e.max_age >= #{age})
- OR e.min_age IS NULL
- OR e.max_age IS NULL)]]>
- </if>
- ORDER BY
- t.relation_id,
- t.order_no
- </select>
- </mapper>
|