<?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="SCgxsCfdjPrescriptionRecordMapper" >
    <!-- 通用查询映射结果 -->

    <select id="selectSCgxsCfdjPrescriptionRecordList" parameterType="pd" resultType="pd">
        select * from s_cgxs_cfdj_prescription_record where 1=1
        <if test="id !=null and id !='' ">
            and id = #{id}
        </if>
        <if test="createdBy !=null and createdBy !='' ">
            and createdBy = #{createdBy}
        </if>
        <if test="createdDate !=null and createdDate !='' ">
            and createdDate = #{createdDate}
        </if>
        <if test="saleOrderNumber !=null and saleOrderNumber !='' ">
            and saleOrderNumber = #{saleOrderNumber}
        </if>
        <if test="saleTime !=null and saleTime !='' ">
            and saleTime = #{saleTime}
        </if>
        <if test="registerTime !=null and registerTime !='' ">
            and registerTime = #{registerTime}
        </if>
        <if test="prescriptionNumber !=null and prescriptionNumber !='' ">
            and prescriptionNumber = #{prescriptionNumber}
        </if>
        <if test="type !=null and type !='' ">
            and type = #{type}
        </if>
        <if test="prescriptionDate !=null and prescriptionDate !='' ">
            and prescriptionDate = #{prescriptionDate}
        </if>
        <if test="medicalInstitutionName !=null and medicalInstitutionName !='' ">
            and medicalInstitutionName = #{medicalInstitutionName}
        </if>
        <if test="doctorName !=null and doctorName !='' ">
            and doctorName = #{doctorName}
        </if>
        <if test="customerInfo !=null and customerInfo !='' ">
            and customerInfo = #{customerInfo}
        </if>
        <if test="reviewPharmacist !=null and reviewPharmacist !='' ">
            and reviewPharmacist = #{reviewPharmacist}
        </if>
        <if test="dispenser !=null and dispenser !='' ">
            and dispenser = #{dispenser}
        </if>
        <if test="verifier !=null and verifier !='' ">
            and verifier = #{verifier}
        </if>
    </select>


    <update id="updateSCgxsCfdjPrescriptionRecord" parameterType="pd" >
        update s_cgxs_cfdj_prescription_record
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="createdBy !=null and createdBy !='' ">
            createdBy = #{createdBy},
        </if>
        <if test="createdDate !=null and createdDate !='' ">
            createdDate = #{createdDate},
        </if>
        <if test="saleOrderNumber !=null and saleOrderNumber !='' ">
            saleOrderNumber = #{saleOrderNumber},
        </if>
        <if test="saleTime !=null and saleTime !='' ">
            saleTime = #{saleTime},
        </if>
        <if test="registerTime !=null and registerTime !='' ">
            registerTime = #{registerTime},
        </if>
        <if test="prescriptionNumber !=null and prescriptionNumber !='' ">
            prescriptionNumber = #{prescriptionNumber},
        </if>
        <if test="type !=null and type !='' ">
            type = #{type},
        </if>
        <if test="prescriptionDate !=null and prescriptionDate !='' ">
            prescriptionDate = #{prescriptionDate},
        </if>
        <if test="medicalInstitutionName !=null and medicalInstitutionName !='' ">
            medicalInstitutionName = #{medicalInstitutionName},
        </if>
        <if test="doctorName !=null and doctorName !='' ">
            doctorName = #{doctorName},
        </if>
        <if test="customerInfo !=null and customerInfo !='' ">
            customerInfo = #{customerInfo},
        </if>
        <if test="reviewPharmacist !=null and reviewPharmacist !='' ">
            reviewPharmacist = #{reviewPharmacist},
        </if>
        <if test="dispenser !=null and dispenser !='' ">
            dispenser = #{dispenser},
        </if>
        <if test="verifier !=null and verifier !='' ">
            verifier = #{verifier},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

    <delete id="SCgxsCfdjPrescriptionRecordRemove" parameterType="pd">
        <if test="ids != null">
            delete from s_cgxs_cfdj_prescription_record where
            <if test="ids != null">
                id in(${ids})
            </if>
        </if>
    </delete>

    <insert id="addSCgxsCfdjPrescriptionRecord" parameterType="pd" >

        insert into s_cgxs_cfdj_prescription_record
        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">

        <if test="createdBy !=null and createdBy !='' ">
            createdBy,
        </if>
        <if test="createdDate !=null and createdDate !='' ">
            createdDate,
        </if>
        <if test="saleOrderNumber !=null and saleOrderNumber !='' ">
            saleOrderNumber,
        </if>
        <if test="saleTime !=null and saleTime !='' ">
            saleTime,
        </if>
        <if test="registerTime !=null and registerTime !='' ">
            registerTime,
        </if>
        <if test="prescriptionNumber !=null and prescriptionNumber !='' ">
            prescriptionNumber,
        </if>
        <if test="type !=null and type !='' ">
            type,
        </if>
        <if test="prescriptionDate !=null and prescriptionDate !='' ">
            prescriptionDate,
        </if>
        <if test="medicalInstitutionName !=null and medicalInstitutionName !='' ">
            medicalInstitutionName,
        </if>
        <if test="doctorName !=null and doctorName !='' ">
            doctorName,
        </if>
        <if test="customerInfo !=null and customerInfo !='' ">
            customerInfo,
        </if>
        <if test="reviewPharmacist !=null and reviewPharmacist !='' ">
            reviewPharmacist,
        </if>
        <if test="dispenser !=null and dispenser !='' ">
            dispenser,
        </if>
        <if test="verifier !=null and verifier !='' ">
            verifier,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="createdBy !=null and createdBy !='' ">
             #{createdBy},
        </if>
        <if test="createdDate !=null and createdDate !='' ">
             #{createdDate},
        </if>
        <if test="saleOrderNumber !=null and saleOrderNumber !='' ">
             #{saleOrderNumber},
        </if>
        <if test="saleTime !=null and saleTime !='' ">
             #{saleTime},
        </if>
        <if test="registerTime !=null and registerTime !='' ">
             #{registerTime},
        </if>
        <if test="prescriptionNumber !=null and prescriptionNumber !='' ">
             #{prescriptionNumber},
        </if>
        <if test="type !=null and type !='' ">
             #{type},
        </if>
        <if test="prescriptionDate !=null and prescriptionDate !='' ">
             #{prescriptionDate},
        </if>
        <if test="medicalInstitutionName !=null and medicalInstitutionName !='' ">
             #{medicalInstitutionName},
        </if>
        <if test="doctorName !=null and doctorName !='' ">
             #{doctorName},
        </if>
        <if test="customerInfo !=null and customerInfo !='' ">
             #{customerInfo},
        </if>
        <if test="reviewPharmacist !=null and reviewPharmacist !='' ">
             #{reviewPharmacist},
        </if>
        <if test="dispenser !=null and dispenser !='' ">
             #{dispenser},
        </if>
        <if test="verifier !=null and verifier !='' ">
             #{verifier},
        </if>
        </trim>

    </insert>

</mapper>
