ConceptInfoMapper.xml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.diagbot.mapper.ConceptInfoMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.diagbot.entity.ConceptInfo">
  6. <id column="id" property="id"/>
  7. <result column="is_deleted" property="isDeleted"/>
  8. <result column="gmt_create" property="gmtCreate"/>
  9. <result column="gmt_modified" property="gmtModified"/>
  10. <result column="creator" property="creator"/>
  11. <result column="modifier" property="modifier"/>
  12. <result column="name" property="name"/>
  13. <result column="type" property="type"/>
  14. <result column="clinical_pathway_name" property="clinicalPathwayName"/>
  15. <result column="notice_name" property="noticeName"/>
  16. </resultMap>
  17. <select id="getReverse" resultType="com.diagbot.dto.ReverseDTO">
  18. SELECT
  19. t.*, e.sex_type,
  20. e.min_age,
  21. e.max_age
  22. FROM
  23. (
  24. SELECT
  25. a.lib_name,
  26. d.id sonId,
  27. d.lib_type sonType,
  28. d.lib_name sonName,
  29. c.order_no,
  30. b.relation_id
  31. FROM
  32. kl_concept a,
  33. kl_relation b,
  34. kl_relation_order c,
  35. kl_concept d
  36. WHERE
  37. a.is_deleted = 'N'
  38. AND b.is_deleted = 'N'
  39. AND c.is_deleted = 'N'
  40. AND d.is_deleted = 'N'
  41. <if test="libName != null and libName != ''">
  42. AND a.lib_name = #{libName}
  43. </if>
  44. <if test="libType != null and libType != ''">
  45. AND a.lib_type = #{libType}
  46. </if>
  47. AND a.id = b.start_id
  48. AND b.end_id = d.id
  49. AND b.id = c.t_relation_id
  50. <if test="relationType != null and relationType.size() > 0">
  51. AND b.relation_id IN
  52. <foreach collection="relationType" open="(" close=")" separator="," item="item">
  53. #{item}
  54. </foreach>
  55. </if>
  56. ) t
  57. LEFT JOIN kl_concept_common e ON t.sonId = e.concept_id
  58. AND e.is_deleted = 'N'
  59. <if test="sexType != null and sexType != 3 and sexType != ''">
  60. and e.sex_type in (3, #{sexType})
  61. </if>
  62. <if test="age != null and age != ''">
  63. <![CDATA[ and ((e.min_age <= #{age} and e.max_age >= #{age})
  64. OR e.min_age IS NULL
  65. OR e.max_age IS NULL)]]>
  66. </if>
  67. ORDER BY
  68. t.relation_id,
  69. t.order_no
  70. </select>
  71. </mapper>