QuestionInfoMapper.xml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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="getByQuestionMapping" parameterType="java.util.Map" resultType="com.diagbot.entity.wrapper.QuestionInfoWrapper">
  41. 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
  42. where t.is_deleted = 'N' and m.is_deleted = 'N' and m.son_question = t.id
  43. <if test="id != null">
  44. and m.parent_question = #{id}
  45. </if>
  46. <if test="ids != null and ids.size > 0">
  47. <foreach item="myId" collection="ids" open="and(" separator="or" close=")" >
  48. m.parent_question = #{myId}
  49. </foreach>
  50. </if>
  51. <if test="sexType != null">
  52. and t.sex_type in (3, #{sexType})
  53. </if>
  54. <if test="age != null">
  55. <![CDATA[ and t.age_begin <= #{age} ]]>
  56. <![CDATA[ and t.age_end >= #{age} ]]>
  57. </if>
  58. <if test="id != null">
  59. order by m.order_no
  60. </if>
  61. <if test="ids != null and ids.size > 0">
  62. order by m.parent_question, m.order_no
  63. </if>
  64. </select>
  65. <select id="getByQuestionRelation" parameterType="java.util.Map" resultMap="BaseResultMap">
  66. select t.* from icss_question_info t, icss_question_relation r
  67. where t.is_deleted = 'N' and r.is_deleted = 'N' and r.sibling_question = t.id
  68. and r.curent_question = #{id}
  69. <if test="sexType != null">
  70. and t.sex_type in (3, #{sexType})
  71. </if>
  72. <if test="age != null">
  73. <![CDATA[ and t.age_begin <= #{age} ]]>
  74. <![CDATA[ and t.age_end >= #{age} ]]>
  75. </if>
  76. order by r.order_no
  77. </select>
  78. </mapper>