RetrievalMapper.xml 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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.RetrievalMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.diagbot.entity.Retrieval">
  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="spell" property="spell" />
  14. <result column="remark" property="remark" />
  15. </resultMap>
  16. <select id="getSymptopInfo" resultType="com.diagbot.dto.RetrievalDTO">
  17. SELECT a.`name`,c.id as question_id,b.show_type FROM icss_retrieval a
  18. LEFT JOIN icss_retrieval_mapping b ON a.id = b.retrieval_id
  19. LEFT JOIN icss_question_info c ON b.question_id = c.id
  20. WHERE a.is_deleted = 'N' AND b.is_deleted = 'N' AND c.is_deleted = 'N'
  21. AND (a.spell = #{InputStr} or a.`name` = #{InputStr})
  22. AND c.type = #{type}
  23. <if test="age != null and age != ''">
  24. <![CDATA[ and c.age_begin <= #{age} ]]>
  25. <![CDATA[ and c.age_end >= #{age} ]]>
  26. </if>
  27. <if test="sexType == 3">
  28. and c.sex_type in ('1','2','3')
  29. </if>
  30. <if test="sexType != 3">
  31. and c.sex_type in ('3',#{sexType})
  32. </if>
  33. UNION
  34. SELECT a.`name`,c.id as question_id,b.show_type FROM icss_retrieval a
  35. LEFT JOIN icss_retrieval_mapping b ON a.id = b.retrieval_id
  36. LEFT JOIN icss_question_info c ON b.question_id = c.id
  37. WHERE a.is_deleted = 'N' AND b.is_deleted = 'N' AND c.is_deleted = 'N'
  38. AND (a.spell LIKE CONCAT(#{InputStr},'%') or a.`name` LIKE CONCAT(#{InputStr},'%'))
  39. AND c.type = #{type}
  40. <if test="age != null and age != ''">
  41. <![CDATA[ and c.age_begin <= #{age} ]]>
  42. <![CDATA[ and c.age_end >= #{age} ]]>
  43. </if>
  44. <if test="sexType == 3">
  45. and c.sex_type in ('1','2','3')
  46. </if>
  47. <if test="sexType != 3">
  48. and c.sex_type in ('3',#{sexType})
  49. </if>
  50. UNION
  51. SELECT a.`name`,c.id as question_id,b.show_type FROM icss_retrieval a
  52. LEFT JOIN icss_retrieval_mapping b ON a.id = b.retrieval_id
  53. LEFT JOIN icss_question_info c ON b.question_id = c.id
  54. WHERE a.is_deleted = 'N' AND b.is_deleted = 'N' AND c.is_deleted = 'N'
  55. AND (a.spell LIKE CONCAT('%',#{InputStr},'%') or a.`name` LIKE CONCAT('%',#{InputStr},'%'))
  56. AND c.type = #{type}
  57. <if test="age != null and age != ''">
  58. <![CDATA[ and c.age_begin <= #{age} ]]>
  59. <![CDATA[ and c.age_end >= #{age} ]]>
  60. </if>
  61. <if test="sexType == 3">
  62. and c.sex_type in ('1','2','3')
  63. </if>
  64. <if test="sexType != 3">
  65. and c.sex_type in ('3',#{sexType})
  66. </if>
  67. </select>
  68. </mapper>