QuestionInfoMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.QuestionInfoMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.diagbot.entity.QuestionInfo">
  6. <id column="id" property="id" />
  7. <result column="name" property="name" />
  8. <result column="tag_name" property="tagName" />
  9. <result column="sex_type" property="sexType" />
  10. <result column="age_begin" property="ageBegin" />
  11. <result column="age_end" property="ageEnd" />
  12. <result column="type" property="type" />
  13. <result column="text_generate" property="textGenerate" />
  14. <result column="control_type" property="controlType" />
  15. <result column="sub_type" property="subType" />
  16. <result column="item_type" property="itemType" />
  17. <result column="tag_type" property="tagType" />
  18. <result column="label_prefix" property="labelPrefix" />
  19. <result column="label_suffix" property="labelSuffix" />
  20. <result column="min_value" property="minValue" />
  21. <result column="max_value" property="maxValue" />
  22. <result column="copy_type" property="copyType" />
  23. <result column="show_add" property="showAdd" />
  24. <result column="show_info" property="showInfo" />
  25. <result column="joint" property="joint" />
  26. <result column="formula_code" property="formulaCode" />
  27. <result column="remark" property="remark" />
  28. </resultMap>
  29. <select id="getByParam" parameterType="java.util.Map" resultMap="BaseResultMap">
  30. select * from icss_question_info where is_deleted = 'N'
  31. and id = #{id}
  32. <if test="sexType != null and sexType != 3 and sexType != ''">
  33. and sex_type in (3, #{sexType})
  34. </if>
  35. <if test="age != null and age != ''">
  36. <![CDATA[ and age_begin <= #{age} ]]>
  37. <![CDATA[ and age_end >= #{age} ]]>
  38. </if>
  39. </select>
  40. <select id="getByParam2" parameterType="java.util.Map" resultMap="BaseResultMap">
  41. select * from icss_question_info where is_deleted = 'N'
  42. <if test="idList != null and idList.size > 0">
  43. and id in
  44. <foreach item="item" collection="idList" open="(" separator="," close=")" >
  45. #{item}
  46. </foreach>
  47. </if>
  48. <if test="sexType != null and sexType != 3 and sexType != ''">
  49. and sex_type in (3, #{sexType})
  50. </if>
  51. <if test="age != null and age != ''">
  52. <![CDATA[ and age_begin <= #{age} ]]>
  53. <![CDATA[ and age_end >= #{age} ]]>
  54. </if>
  55. </select>
  56. <select id="getByQuestionMapping" parameterType="java.util.Map" resultType="com.diagbot.entity.wrapper.QuestionInfoWrapper">
  57. select t.*, m.parent_question, m.position, m.form_position , m.exclusion_type, m.symptom_type from icss_question_info t, icss_question_mapping m
  58. where t.is_deleted = 'N' and m.is_deleted = 'N' and m.son_question = t.id
  59. <if test="id != null">
  60. and m.parent_question = #{id}
  61. </if>
  62. <if test="ids != null and ids.size > 0">
  63. <foreach item="myId" collection="ids" open="and(" separator="or" close=")" >
  64. m.parent_question = #{myId}
  65. </foreach>
  66. </if>
  67. <if test="sexType != null and sexType != 3 and sexType != ''">
  68. and t.sex_type in (3, #{sexType})
  69. </if>
  70. <if test="age != null">
  71. <![CDATA[ and t.age_begin <= #{age} ]]>
  72. <![CDATA[ and t.age_end >= #{age} ]]>
  73. </if>
  74. <if test="id != null">
  75. order by m.order_no
  76. </if>
  77. <if test="ids != null and ids.size > 0">
  78. order by m.parent_question, m.order_no
  79. </if>
  80. </select>
  81. <select id="getByQuestionRelation" parameterType="java.util.Map" resultMap="BaseResultMap">
  82. select t.* from icss_question_info t, icss_question_relation r
  83. where t.is_deleted = 'N' and r.is_deleted = 'N' and r.sibling_question = t.id
  84. and r.curent_question = #{id}
  85. <if test="sexType != null">
  86. and t.sex_type in (3, #{sexType})
  87. </if>
  88. <if test="age != null">
  89. <![CDATA[ and t.age_begin <= #{age} ]]>
  90. <![CDATA[ and t.age_end >= #{age} ]]>
  91. </if>
  92. order by r.order_no
  93. </select>
  94. </mapper>