FsPrescribeDrugMapper.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.his.mapper.FsPrescribeDrugMapper">
  6. <resultMap type="FsPrescribeDrug" id="FsPrescribeDrugResult">
  7. <result property="drugId" column="drug_id" />
  8. <result property="prescribeId" column="prescribe_id" />
  9. <result property="drugName" column="drug_name" />
  10. <result property="drugSpec" column="drug_spec" />
  11. <result property="usageMethod" column="usage_method" />
  12. <result property="usageFrequencyUnit" column="usage_frequency_unit" />
  13. <result property="usagePerUseCount" column="usage_per_use_count" />
  14. <result property="usagePerUseUnit" column="usage_per_use_unit" />
  15. <result property="usageDays" column="usage_days" />
  16. <result property="drugPrice" column="drug_price" />
  17. <result property="drugNum" column="drug_num" />
  18. <result property="drugUnit" column="drug_unit" />
  19. <result property="instructions" column="instructions" />
  20. <result property="drugImgUrl" column="drug_img_url" />
  21. <result property="productId" column="product_id" />
  22. <result property="productAttrValueId" column="product_attr_value_id" />
  23. <result property="remark" column="remark" />
  24. <result property="drugType" column="drug_type" />
  25. <result property="isDrug" column="is_drug" />
  26. <result property="failMsg" column="fail_msg" />
  27. <result property="count" column="count" />
  28. </resultMap>
  29. <sql id="selectFsPrescribeDrugVo">
  30. select drug_id, prescribe_id,is_drug, drug_name, drug_spec, usage_method, usage_frequency_unit, usage_per_use_count, usage_per_use_unit, usage_days, drug_num,drug_price, drug_unit, instructions,drug_img_url, product_id,product_attr_value_id,remark,drug_type,fail_msg,count from fs_prescribe_drug
  31. </sql>
  32. <select id="selectFsPrescribeDrugList" parameterType="FsPrescribeDrug" resultMap="FsPrescribeDrugResult">
  33. <include refid="selectFsPrescribeDrugVo"/>
  34. <where>
  35. <if test="prescribeId != null "> and prescribe_id = #{prescribeId}</if>
  36. <if test="drugName != null and drugName != ''"> and drug_name like concat('%', #{drugName}, '%')</if>
  37. <if test="drugSpec != null and drugSpec != ''"> and drug_spec = #{drugSpec}</if>
  38. <if test="usageMethod != null and usageMethod != ''"> and usage_method = #{usageMethod}</if>
  39. <if test="usageFrequencyUnit != null and usageFrequencyUnit != ''"> and usage_frequency_unit = #{usageFrequencyUnit}</if>
  40. <if test="usagePerUseCount != null and usagePerUseCount != ''"> and usage_per_use_count = #{usagePerUseCount}</if>
  41. <if test="usagePerUseUnit != null and usagePerUseUnit != ''"> and usage_per_use_unit = #{usagePerUseUnit}</if>
  42. <if test="usageDays != null and usageDays != ''"> and usage_days = #{usageDays}</if>
  43. <if test="instructions != null and instructions != ''"> and instructions = #{instructions}</if>
  44. <if test="productId != null "> and product_id = #{productId}</if>
  45. </where>
  46. </select>
  47. <select id="selectFsPrescribeDrugByDrugId" parameterType="Long" resultMap="FsPrescribeDrugResult">
  48. <include refid="selectFsPrescribeDrugVo"/>
  49. where drug_id = #{drugId}
  50. </select>
  51. <insert id="insertFsPrescribeDrug" parameterType="FsPrescribeDrug" useGeneratedKeys="true" keyProperty="drugId">
  52. insert into fs_prescribe_drug
  53. <trim prefix="(" suffix=")" suffixOverrides=",">
  54. <if test="prescribeId != null">prescribe_id,</if>
  55. <if test="drugName != null">drug_name,</if>
  56. <if test="drugSpec != null">drug_spec,</if>
  57. <if test="usageMethod != null">usage_method,</if>
  58. <if test="usageFrequencyUnit != null">usage_frequency_unit,</if>
  59. <if test="usagePerUseCount != null">usage_per_use_count,</if>
  60. <if test="usagePerUseUnit != null">usage_per_use_unit,</if>
  61. <if test="usageDays != null">usage_days,</if>
  62. <if test="drugPrice != null">drug_price,</if>
  63. <if test="drugNum != null">drug_num,</if>
  64. <if test="drugUnit != null">drug_unit,</if>
  65. <if test="instructions != null">instructions,</if>
  66. <if test="productId != null">product_id,</if>
  67. <if test="drugImgUrl != null">drug_img_url,</if>
  68. <if test="productAttrValueId != null">product_attr_value_id,</if>
  69. <if test="remark != null">remark,</if>
  70. <if test="drugType != null">drug_type,</if>
  71. <if test="isDrug != null">is_drug,</if>
  72. </trim>
  73. <trim prefix="values (" suffix=")" suffixOverrides=",">
  74. <if test="prescribeId != null">#{prescribeId},</if>
  75. <if test="drugName != null">#{drugName},</if>
  76. <if test="drugSpec != null">#{drugSpec},</if>
  77. <if test="usageMethod != null">#{usageMethod},</if>
  78. <if test="usageFrequencyUnit != null">#{usageFrequencyUnit},</if>
  79. <if test="usagePerUseCount != null">#{usagePerUseCount},</if>
  80. <if test="usagePerUseUnit != null">#{usagePerUseUnit},</if>
  81. <if test="usageDays != null">#{usageDays},</if>
  82. <if test="drugPrice != null">#{drugPrice},</if>
  83. <if test="drugNum != null">#{drugNum},</if>
  84. <if test="drugUnit != null">#{drugUnit},</if>
  85. <if test="instructions != null">#{instructions},</if>
  86. <if test="productId != null">#{productId},</if>
  87. <if test="drugImgUrl != null">#{drugImgUrl},</if>
  88. <if test="productAttrValueId != null">#{productAttrValueId},</if>
  89. <if test="remark != null">#{remark},</if>
  90. <if test="drugType != null">#{drugType},</if>
  91. <if test="isDrug != null">#{isDrug},</if>
  92. </trim>
  93. </insert>
  94. <update id="updateFsPrescribeDrug" parameterType="FsPrescribeDrug">
  95. update fs_prescribe_drug
  96. <trim prefix="SET" suffixOverrides=",">
  97. <if test="prescribeId != null">prescribe_id = #{prescribeId},</if>
  98. <if test="drugName != null">drug_name = #{drugName},</if>
  99. <if test="drugSpec != null">drug_spec = #{drugSpec},</if>
  100. <if test="usageMethod != null">usage_method = #{usageMethod},</if>
  101. <if test="usageFrequencyUnit != null">usage_frequency_unit = #{usageFrequencyUnit},</if>
  102. <if test="usagePerUseCount != null">usage_per_use_count = #{usagePerUseCount},</if>
  103. <if test="usagePerUseUnit != null">usage_per_use_unit = #{usagePerUseUnit},</if>
  104. <if test="usageDays != null">usage_days = #{usageDays},</if>
  105. <if test="drugPrice != null">drug_price = #{drugPrice},</if>
  106. <if test="drugNum != null">drug_num = #{drugNum},</if>
  107. <if test="drugUnit != null">drug_unit = #{drugUnit},</if>
  108. <if test="instructions != null">instructions = #{instructions},</if>
  109. <if test="productId != null">product_id = #{productId},</if>
  110. <if test="drugImgUrl != null">drug_img_url = #{drugImgUrl},</if>
  111. <if test="productAttrValueId != null">product_attr_value_id = #{productAttrValueId},</if>
  112. <if test="remark != null">remark = #{remark},</if>
  113. </trim>
  114. where drug_id = #{drugId}
  115. </update>
  116. <delete id="deleteFsPrescribeDrugByDrugId" parameterType="Long">
  117. delete from fs_prescribe_drug where drug_id = #{drugId}
  118. </delete>
  119. <delete id="deleteFsPrescribeDrugByDrugIds" parameterType="String">
  120. delete from fs_prescribe_drug where drug_id in
  121. <foreach item="drugId" collection="array" open="(" separator="," close=")">
  122. #{drugId}
  123. </foreach>
  124. </delete>
  125. </mapper>