| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- <?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.qw.mapper.FsCompanyCustomerMapper">
- <resultMap type="com.fs.qw.domain.FsCompanyCustomer" id="FsCompanyCustomerResult">
- <result property="id" column="id" />
- <result property="customerName" column="customer_name" />
- <result property="sex" column="sex" />
- <result property="age" column="age" />
- <result property="address" column="address" />
- <result property="phone" column="phone" />
- <result property="filingTime" column="filing_time" />
- <result property="companyUserId" column="company_user_id" />
- <result property="companyUserName" column="company_user_name" />
- <result property="appointmentTime" column="appointment_time" />
- <result property="doctorId" column="doctor_id" />
- <result property="doctorName" column="doctor_name" />
- <result property="presentIllness" column="present_illness" />
- <result property="currentMedication" column="current_medication" />
- <result property="allergyHistory" column="allergy_history" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- <result property="remark" column="remark" />
- <result property="importMemberId" column="import_member_id" />
- <result property="buyCount" column="buy_count" />
- <result property="claimStatus" column="claim_status" />
- <result property="completeStatus" column="complete_status" />
- <result property="deptId" column="dept_id" />
- <result property="deptName" column="dept_name" />
- </resultMap>
- <sql id="selectFsCompanyCustomerVo">
- select id, customer_name, sex, age, address, phone, filing_time,
- company_user_id, company_user_name, appointment_time, doctor_id, doctor_name,
- present_illness, current_medication, allergy_history,
- create_by, create_time, update_by, update_time, remark, del_flag, import_member_id,
- buy_count, claim_status,
- complete_status, dept_id, dept_name
- from fs_company_customer
- </sql>
- <select id="selectFsCompanyCustomerList" parameterType="com.fs.qw.domain.FsCompanyCustomer" resultMap="FsCompanyCustomerResult">
- <include refid="selectFsCompanyCustomerVo"/>
- where del_flag = '0'
- <if test="customerName != null and customerName != ''">
- and customer_name like concat('%', #{customerName}, '%')
- </if>
- <if test="phone != null and phone != ''">
- and phone like concat('%', #{phone}, '%')
- </if>
- <if test="companyUserName != null and companyUserName != ''">
- and company_user_name like concat('%', #{companyUserName}, '%')
- </if>
- <if test="companyUserId != null">
- and company_user_id = #{companyUserId}
- </if>
- <if test="claimStatus != null">
- and claim_status = #{claimStatus}
- </if>
- <if test="beginTime != null and beginTime != ''">
- and filing_time >= #{beginTime}
- </if>
- <if test="endTime != null and endTime != ''">
- and filing_time <= #{endTime}
- </if>
- <if test="beginCreateTime != null and beginCreateTime != ''">
- and create_time >= #{beginCreateTime}
- </if>
- <if test="endCreateTime != null and endCreateTime != ''">
- and create_time <= #{endCreateTime}
- </if>
- <if test="purchased != null and purchased == true">
- and buy_count > 0
- </if>
- <if test="minBuyCount != null">
- and buy_count >= #{minBuyCount}
- </if>
- <if test="maxBuyCount != null">
- and buy_count <= #{maxBuyCount}
- </if>
- <if test="importMemberId != null">
- and import_member_id = #{importMemberId}
- </if>
- <if test="completeStatus != null">
- and complete_status = #{completeStatus}
- </if>
- order by filing_time desc
- </select>
- <select id="selectImportFsCompanyCustomerList" parameterType="com.fs.qw.domain.FsCompanyCustomer"
- resultMap="FsCompanyCustomerResult">
- <include refid="selectFsCompanyCustomerVo"/>
- where del_flag = '0' and import_member_id is not null
- <if test="customerName != null and customerName != ''">
- and customer_name like concat('%', #{customerName}, '%')
- </if>
- <if test="phone != null and phone != ''">
- and phone like concat('%', #{phone}, '%')
- </if>
- <if test="companyUserName != null and companyUserName != ''">
- and company_user_name like concat('%', #{companyUserName}, '%')
- </if>
- <if test="companyUserId != null">
- and company_user_id = #{companyUserId}
- </if>
- <if test="claimStatus != null">
- and claim_status = #{claimStatus}
- </if>
- <if test="beginTime != null and beginTime != ''">
- and filing_time >= #{beginTime}
- </if>
- <if test="endTime != null and endTime != ''">
- and filing_time <= #{endTime}
- </if>
- <if test="beginCreateTime != null and beginCreateTime != ''">
- and create_time >= #{beginCreateTime}
- </if>
- <if test="endCreateTime != null and endCreateTime != ''">
- and create_time <= #{endCreateTime}
- </if>
- <if test="purchased != null and purchased == true">
- and buy_count > 0
- </if>
- <if test="minBuyCount != null">
- and buy_count >= #{minBuyCount}
- </if>
- <if test="maxBuyCount != null">
- and buy_count <= #{maxBuyCount}
- </if>
- <if test="importMemberId != null">
- and import_member_id = #{importMemberId}
- </if>
- <if test="completeStatus != null">
- and complete_status = #{completeStatus}
- </if>
- order by filing_time desc
- </select>
- <select id="selectFsCompanyCustomerById" parameterType="Long" resultMap="FsCompanyCustomerResult">
- <include refid="selectFsCompanyCustomerVo"/>
- where id = #{id} and del_flag = '0'
- </select>
- <select id="selectFsCompanyCustomerListByCompanyUserIds" resultType="com.fs.qw.domain.FsCompanyCustomer">
- <include refid="selectFsCompanyCustomerVo"/>
- <where>
- del_flag = '0'
- <if test="companyUserIds != null and companyUserIds.size() > 0">
- and company_user_id IN
- <foreach collection="companyUserIds" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- <if test="customerName != null and customerName != ''">
- and customer_name like concat('%', #{customerName}, '%')
- </if>
- <if test="phone != null and phone != ''">
- and phone like concat('%', #{phone}, '%')
- </if>
- <if test="companyUserName != null and companyUserName != ''">
- and company_user_name like concat('%', #{companyUserName}, '%')
- </if>
- </where>
- </select>
- <select id="selectByIdForUpdate" resultMap="FsCompanyCustomerResult">
- SELECT * FROM fs_company_customer WHERE id = #{id} FOR UPDATE
- </select>
- <insert id="insertFsCompanyCustomer" parameterType="com.fs.qw.domain.FsCompanyCustomer" useGeneratedKeys="true" keyProperty="id">
- insert into fs_company_customer
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="customerName != null">customer_name,</if>
- <if test="sex != null">sex,</if>
- <if test="age != null">age,</if>
- <if test="address != null">address,</if>
- <if test="phone != null">phone,</if>
- <if test="filingTime != null">filing_time,</if>
- <if test="companyUserId != null">company_user_id,</if>
- <if test="companyUserName != null">company_user_name,</if>
- <if test="appointmentTime != null">appointment_time,</if>
- <if test="doctorId != null">doctor_id,</if>
- <if test="doctorName != null">doctor_name,</if>
- <if test="presentIllness != null">present_illness,</if>
- <if test="currentMedication != null">current_medication,</if>
- <if test="allergyHistory != null">allergy_history,</if>
- <if test="createBy != null">create_by,</if>
- <if test="remark != null">remark,</if>
- <if test="importMemberId != null">import_member_id,</if>
- <if test="buyCount != null">buy_count,</if>
- <if test="claimStatus != null">claim_status,</if>
- <if test="completeStatus != null">complete_status,</if>
- <if test="deptId != null">dept_id,</if>
- <if test="deptName != null">dept_name,</if>
- create_time
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="customerName != null">#{customerName},</if>
- <if test="sex != null">#{sex},</if>
- <if test="age != null">#{age},</if>
- <if test="address != null">#{address},</if>
- <if test="phone != null">#{phone},</if>
- <if test="filingTime != null">#{filingTime},</if>
- <if test="companyUserId != null">#{companyUserId},</if>
- <if test="companyUserName != null">#{companyUserName},</if>
- <if test="appointmentTime != null">#{appointmentTime},</if>
- <if test="doctorId != null">#{doctorId},</if>
- <if test="doctorName != null">#{doctorName},</if>
- <if test="presentIllness != null">#{presentIllness},</if>
- <if test="currentMedication != null">#{currentMedication},</if>
- <if test="allergyHistory != null">#{allergyHistory},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="remark != null">#{remark},</if>
- <if test="importMemberId != null">#{importMemberId},</if>
- <if test="buyCount != null">#{buyCount},</if>
- <if test="claimStatus != null">#{claimStatus},</if>
- <if test="completeStatus != null">#{completeStatus},</if>
- <if test="deptId != null">#{deptId},</if>
- <if test="deptName != null">#{deptName},</if>
- sysdate()
- </trim>
- </insert>
- <!-- 批量新增-->
- <insert id="insertBatchFsCompanyCustomer" parameterType="list">
- INSERT IGNORE INTO fs_company_customer (
- customer_name, phone, address, create_time,
- import_member_id, present_illness, current_medication, allergy_history, claim_status
- ) VALUES
- <foreach collection="companyCustomers" item="item" separator=",">
- (
- #{item.customerName}, #{item.phone}, #{item.address}, #{item.createTime},
- #{item.importMemberId}, #{item.presentIllness}, #{item.currentMedication},
- #{item.allergyHistory}, #{item.claimStatus}
- )
- </foreach>
- </insert>
- <update id="updateFsCompanyCustomer" parameterType="com.fs.qw.domain.FsCompanyCustomer">
- update fs_company_customer
- <set>
- <if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
- <if test="sex != null">sex = #{sex},</if>
- <if test="age != null">age = #{age},</if>
- <if test="address != null">address = #{address},</if>
- <if test="phone != null">phone = #{phone},</if>
- <if test="filingTime != null">filing_time = #{filingTime},</if>
- <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
- <if test="companyUserName != null">company_user_name = #{companyUserName},</if>
- <if test="appointmentTime != null">appointment_time = #{appointmentTime},</if>
- <if test="doctorId != null">doctor_id = #{doctorId},</if>
- <if test="doctorName != null">doctor_name = #{doctorName},</if>
- <if test="presentIllness != null">present_illness = #{presentIllness},</if>
- <if test="currentMedication != null">current_medication = #{currentMedication},</if>
- <if test="allergyHistory != null">allergy_history = #{allergyHistory},</if>
- <if test="remark != null">remark = #{remark},</if>
- <if test="importMemberId != null">import_member_id = #{importMemberId},</if>
- <if test="buyCount != null">buy_count = #{buyCount},</if>
- <if test="claimStatus != null">claim_status = #{claimStatus},</if>
- <if test="completeStatus != null">complete_status = #{completeStatus},</if>
- <if test="deptId != null">dept_id = #{deptId},</if>
- <if test="deptName != null">dept_name = #{deptName},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- update_time = sysdate()
- </set>
- where id = #{id}
- </update>
- <update id="deleteFsCompanyCustomerById" parameterType="Long">
- update fs_company_customer set del_flag = '2' where id = #{id}
- </update>
- <update id="deleteFsCompanyCustomerByIds" parameterType="String">
- update fs_company_customer set del_flag = '2' where id in
- <foreach collection="array" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <update id="updateCompanyUserIdByIds">
- update fs_company_customer
- set company_user_id = #{targetDoctorId},
- company_user_name = #{targetDoctorName},
- update_time = sysdate()
- where del_flag = '0'
- and id in
- <foreach collection="customerIds" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <update id="updateBatchFsCompanyCustomer">
- UPDATE fs_company_customer
- <trim prefix="SET" suffixOverrides=",">
- <trim prefix="present_illness = CASE" suffix="END,">
- <foreach collection="companyCustomers" item="item">
- WHEN id = #{item.id} THEN #{item.presentIllness}
- </foreach>
- </trim>
- <trim prefix="current_medication = CASE" suffix="END,">
- <foreach collection="companyCustomers" item="item">
- WHEN id = #{item.id} THEN #{item.currentMedication}
- </foreach>
- </trim>
- <trim prefix="allergy_history = CASE" suffix="END,">
- <foreach collection="companyCustomers" item="item">
- WHEN id = #{item.id} THEN #{item.allergyHistory}
- </foreach>
- </trim>
- </trim>
- WHERE id IN
- <foreach collection="companyCustomers" item="item" open="(" separator="," close=")">
- #{item.id}
- </foreach>
- </update>
- </mapper>
|