|
|
@@ -0,0 +1,187 @@
|
|
|
+<?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.FsPrescribeDrugDataScrmMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.fs.his.domain.FsPrescribeDrugDataScrm" id="FsPrescribeDrugDataScrmResult">
|
|
|
+ <id 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="productId" column="product_id" />
|
|
|
+ <result property="drugImgUrl" column="drug_img_url" />
|
|
|
+ <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" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectFsPrescribeDrugDataScrmVo">
|
|
|
+ select drug_id, prescribe_id, drug_name, drug_spec, usage_method, usage_frequency_unit,
|
|
|
+ usage_per_use_count, usage_per_use_unit, usage_days, drug_price, drug_num,
|
|
|
+ drug_unit, instructions, product_id, drug_img_url, product_attr_value_id,
|
|
|
+ remark, drug_type, is_drug
|
|
|
+ from fs_prescribe_drug_data_scrm
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectFsPrescribeDrugDataScrmList" parameterType="FsPrescribeDrugDataScrm" resultMap="FsPrescribeDrugDataScrmResult">
|
|
|
+ <include refid="selectFsPrescribeDrugDataScrmVo"/>
|
|
|
+ <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 like concat('%', #{drugSpec}, '%')</if>
|
|
|
+ <if test="usageMethod != null and usageMethod != ''"> and usage_method like concat('%', #{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="drugPrice != null"> and drug_price = #{drugPrice}</if>
|
|
|
+ <if test="drugNum != null"> and drug_num = #{drugNum}</if>
|
|
|
+ <if test="drugUnit != null and drugUnit != ''"> and drug_unit = #{drugUnit}</if>
|
|
|
+ <if test="instructions != null and instructions != ''"> and instructions like concat('%', #{instructions}, '%')</if>
|
|
|
+ <if test="productId != null"> and product_id = #{productId}</if>
|
|
|
+ <if test="drugImgUrl != null and drugImgUrl != ''"> and drug_img_url like concat('%', #{drugImgUrl}, '%')</if>
|
|
|
+ <if test="productAttrValueId != null"> and product_attr_value_id = #{productAttrValueId}</if>
|
|
|
+ <if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
|
|
|
+ <if test="drugType != null"> and drug_type = #{drugType}</if>
|
|
|
+ <if test="isDrug != null"> and is_drug = #{isDrug}</if>
|
|
|
+ </where>
|
|
|
+ order by drug_id desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectFsPrescribeDrugDataScrmById" parameterType="Long" resultMap="FsPrescribeDrugDataScrmResult">
|
|
|
+ <include refid="selectFsPrescribeDrugDataScrmVo"/>
|
|
|
+ where drug_id = #{drugId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectFsPrescribeDrugDataScrmByPrescribeId" parameterType="Long" resultMap="FsPrescribeDrugDataScrmResult">
|
|
|
+ <include refid="selectFsPrescribeDrugDataScrmVo"/>
|
|
|
+ where prescribe_id = #{prescribeId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertFsPrescribeDrugDataScrm" parameterType="FsPrescribeDrugDataScrm" useGeneratedKeys="true" keyProperty="drugId">
|
|
|
+ insert into fs_prescribe_drug_data_scrm
|
|
|
+ <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>
|
|
|
+
|
|
|
+ <!-- 批量插入处方药品表 -->
|
|
|
+ <insert id="batchInsertDrugs" parameterType="list">
|
|
|
+ insert into fs_prescribe_drug_data_scrm (
|
|
|
+ prescribe_id, drug_name, drug_spec, usage_method, usage_frequency_unit,
|
|
|
+ usage_per_use_count, usage_per_use_unit, usage_days, drug_price, drug_num,
|
|
|
+ drug_unit, instructions, product_id, drug_img_url, product_attr_value_id,
|
|
|
+ remark, drug_type, is_drug
|
|
|
+ ) values
|
|
|
+ <foreach collection="newDrugs" item="item" separator=",">
|
|
|
+ (
|
|
|
+ #{item.prescribeId},
|
|
|
+ #{item.drugName},
|
|
|
+ #{item.drugSpec},
|
|
|
+ #{item.usageMethod},
|
|
|
+ #{item.usageFrequencyUnit},
|
|
|
+ #{item.usagePerUseCount},
|
|
|
+ #{item.usagePerUseUnit},
|
|
|
+ #{item.usageDays},
|
|
|
+ #{item.drugPrice},
|
|
|
+ #{item.drugNum},
|
|
|
+ #{item.drugUnit},
|
|
|
+ #{item.instructions},
|
|
|
+ #{item.productId},
|
|
|
+ #{item.drugImgUrl},
|
|
|
+ #{item.productAttrValueId},
|
|
|
+ #{item.remark},
|
|
|
+ #{item.drugType},
|
|
|
+ #{item.isDrug}
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateFsPrescribeDrugDataScrm" parameterType="FsPrescribeDrugDataScrm">
|
|
|
+ update fs_prescribe_drug_data_scrm
|
|
|
+ <set>
|
|
|
+ <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>
|
|
|
+ <if test="drugType != null">drug_type = #{drugType},</if>
|
|
|
+ <if test="isDrug != null">is_drug = #{isDrug},</if>
|
|
|
+ </set>
|
|
|
+ where drug_id = #{drugId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteFsPrescribeDrugDataScrmById" parameterType="Long">
|
|
|
+ delete from fs_prescribe_drug_data_scrm where drug_id = #{drugId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteFsPrescribeDrugDataScrmByIds" parameterType="Long">
|
|
|
+ delete from fs_prescribe_drug_data_scrm where drug_id in
|
|
|
+ <foreach collection="array" item="drugId" open="(" separator="," close=")">
|
|
|
+ #{drugId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteByPrescribeId">
|
|
|
+ delete from fs_prescribe_drug_data_scrm where prescribe_id = #{prescribeId}
|
|
|
+ </delete>
|
|
|
+</mapper>
|