123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.fs.his.mapper.FsPrescribeDrugMapper">
- <resultMap type="FsPrescribeDrug" id="FsPrescribeDrugResult">
- <result property="drugId" column="drug_id" />
- <result property="prescribeId" column="prescribe_id" />
- <result property="drugName" column="drug_name" />
- <result property="drugSpec" column="drug_spec" />
- <result property="usageMethod" column="usage_method" />
- <result property="usageFrequencyUnit" column="usage_frequency_unit" />
- <result property="usagePerUseCount" column="usage_per_use_count" />
- <result property="usagePerUseUnit" column="usage_per_use_unit" />
- <result property="usageDays" column="usage_days" />
- <result property="drugPrice" column="drug_price" />
- <result property="drugNum" column="drug_num" />
- <result property="drugUnit" column="drug_unit" />
- <result property="instructions" column="instructions" />
- <result property="drugImgUrl" column="drug_img_url" />
- <result property="productId" column="product_id" />
- <result property="productAttrValueId" column="product_attr_value_id" />
- <result property="remark" column="remark" />
- <result property="drugType" column="drug_type" />
- <result property="isDrug" column="is_drug" />
- <result property="failMsg" column="fail_msg" />
- <result property="count" column="count" />
- </resultMap>
- <sql id="selectFsPrescribeDrugVo">
- 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
- </sql>
- <select id="selectFsPrescribeDrugList" parameterType="FsPrescribeDrug" resultMap="FsPrescribeDrugResult">
- <include refid="selectFsPrescribeDrugVo"/>
- <where>
- <if test="prescribeId != null "> and prescribe_id = #{prescribeId}</if>
- <if test="drugName != null and drugName != ''"> and drug_name like concat('%', #{drugName}, '%')</if>
- <if test="drugSpec != null and drugSpec != ''"> and drug_spec = #{drugSpec}</if>
- <if test="usageMethod != null and usageMethod != ''"> and usage_method = #{usageMethod}</if>
- <if test="usageFrequencyUnit != null and usageFrequencyUnit != ''"> and usage_frequency_unit = #{usageFrequencyUnit}</if>
- <if test="usagePerUseCount != null and usagePerUseCount != ''"> and usage_per_use_count = #{usagePerUseCount}</if>
- <if test="usagePerUseUnit != null and usagePerUseUnit != ''"> and usage_per_use_unit = #{usagePerUseUnit}</if>
- <if test="usageDays != null and usageDays != ''"> and usage_days = #{usageDays}</if>
- <if test="instructions != null and instructions != ''"> and instructions = #{instructions}</if>
- <if test="productId != null "> and product_id = #{productId}</if>
- </where>
- </select>
- <select id="selectFsPrescribeDrugByDrugId" parameterType="Long" resultMap="FsPrescribeDrugResult">
- <include refid="selectFsPrescribeDrugVo"/>
- where drug_id = #{drugId}
- </select>
- <insert id="insertFsPrescribeDrug" parameterType="FsPrescribeDrug" useGeneratedKeys="true" keyProperty="drugId">
- insert into fs_prescribe_drug
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="prescribeId != null">prescribe_id,</if>
- <if test="drugName != null">drug_name,</if>
- <if test="drugSpec != null">drug_spec,</if>
- <if test="usageMethod != null">usage_method,</if>
- <if test="usageFrequencyUnit != null">usage_frequency_unit,</if>
- <if test="usagePerUseCount != null">usage_per_use_count,</if>
- <if test="usagePerUseUnit != null">usage_per_use_unit,</if>
- <if test="usageDays != null">usage_days,</if>
- <if test="drugPrice != null">drug_price,</if>
- <if test="drugNum != null">drug_num,</if>
- <if test="drugUnit != null">drug_unit,</if>
- <if test="instructions != null">instructions,</if>
- <if test="productId != null">product_id,</if>
- <if test="drugImgUrl != null">drug_img_url,</if>
- <if test="productAttrValueId != null">product_attr_value_id,</if>
- <if test="remark != null">remark,</if>
- <if test="drugType != null">drug_type,</if>
- <if test="isDrug != null">is_drug,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="prescribeId != null">#{prescribeId},</if>
- <if test="drugName != null">#{drugName},</if>
- <if test="drugSpec != null">#{drugSpec},</if>
- <if test="usageMethod != null">#{usageMethod},</if>
- <if test="usageFrequencyUnit != null">#{usageFrequencyUnit},</if>
- <if test="usagePerUseCount != null">#{usagePerUseCount},</if>
- <if test="usagePerUseUnit != null">#{usagePerUseUnit},</if>
- <if test="usageDays != null">#{usageDays},</if>
- <if test="drugPrice != null">#{drugPrice},</if>
- <if test="drugNum != null">#{drugNum},</if>
- <if test="drugUnit != null">#{drugUnit},</if>
- <if test="instructions != null">#{instructions},</if>
- <if test="productId != null">#{productId},</if>
- <if test="drugImgUrl != null">#{drugImgUrl},</if>
- <if test="productAttrValueId != null">#{productAttrValueId},</if>
- <if test="remark != null">#{remark},</if>
- <if test="drugType != null">#{drugType},</if>
- <if test="isDrug != null">#{isDrug},</if>
- </trim>
- </insert>
- <update id="updateFsPrescribeDrug" parameterType="FsPrescribeDrug">
- update fs_prescribe_drug
- <trim prefix="SET" suffixOverrides=",">
- <if test="prescribeId != null">prescribe_id = #{prescribeId},</if>
- <if test="drugName != null">drug_name = #{drugName},</if>
- <if test="drugSpec != null">drug_spec = #{drugSpec},</if>
- <if test="usageMethod != null">usage_method = #{usageMethod},</if>
- <if test="usageFrequencyUnit != null">usage_frequency_unit = #{usageFrequencyUnit},</if>
- <if test="usagePerUseCount != null">usage_per_use_count = #{usagePerUseCount},</if>
- <if test="usagePerUseUnit != null">usage_per_use_unit = #{usagePerUseUnit},</if>
- <if test="usageDays != null">usage_days = #{usageDays},</if>
- <if test="drugPrice != null">drug_price = #{drugPrice},</if>
- <if test="drugNum != null">drug_num = #{drugNum},</if>
- <if test="drugUnit != null">drug_unit = #{drugUnit},</if>
- <if test="instructions != null">instructions = #{instructions},</if>
- <if test="productId != null">product_id = #{productId},</if>
- <if test="drugImgUrl != null">drug_img_url = #{drugImgUrl},</if>
- <if test="productAttrValueId != null">product_attr_value_id = #{productAttrValueId},</if>
- <if test="remark != null">remark = #{remark},</if>
- </trim>
- where drug_id = #{drugId}
- </update>
- <delete id="deleteFsPrescribeDrugByDrugId" parameterType="Long">
- delete from fs_prescribe_drug where drug_id = #{drugId}
- </delete>
- <delete id="deleteFsPrescribeDrugByDrugIds" parameterType="String">
- delete from fs_prescribe_drug where drug_id in
- <foreach item="drugId" collection="array" open="(" separator="," close=")">
- #{drugId}
- </foreach>
- </delete>
- </mapper>
|