| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- <?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.FsPrescribeMapper">
- <resultMap type="FsPrescribe" id="FsPrescribeResult">
- <result property="prescribeId" column="prescribe_id" />
- <result property="prescribeType" column="prescribe_type" />
- <result property="inquiryOrderId" column="inquiry_order_id" />
- <result property="storeOrderId" column="store_order_id" />
- <result property="userId" column="user_id" />
- <result property="patientId" column="patient_id" />
- <result property="prescribeCode" column="prescribe_code" />
- <result property="patientDescs" column="patient_descs" />
- <result property="nowIllness" column="now_illness" />
- <result property="historyIllness" column="history_illness" />
- <result property="patientAge" column="patient_age" />
- <result property="patientName" column="patient_name" />
- <result property="weight" column="weight" />
- <result property="isHistoryAllergic" column="is_history_allergic" />
- <result property="historyAllergic" column="history_allergic" />
- <result property="liverUnusual" column="liver_unusual" />
- <result property="renalUnusual" column="renal_unusual" />
- <result property="isLactation" column="is_lactation" />
- <result property="patientTel" column="patient_tel" />
- <result property="patientGender" column="patient_gender" />
- <result property="recordPic" column="record_pic" />
- <result property="prescribeImgUrl" column="prescribe_img_url" />
- <result property="auditReason" column="audit_reason" />
- <result property="diagnose" column="diagnose" />
- <result property="doctorId" column="doctor_id" />
- <result property="drugDoctorId" column="drug_doctor_id" />
- <result property="createTime" column="create_time" />
- <result property="status" column="status" />
- <result property="auditTime" column="audit_time" />
- <result property="remark" column="remark" />
- <result property="usageJson" column="usage_json" />
- <result property="storeId" column="store_id" />
- <result property="prescribeDoctorId" column="prescribe_doctor_id" />
- <result property="doctorSignUrl" column="doctor_sign_url" />
- <result property="prescribeDoctorSignUrl" column="prescribe_doctor_sign_url" />
- <result property="drugDoctorSignUrl" column="drug_doctor_sign_url" />
- <result property="patientBirthday" column="patient_birthday" />
- <result property="recipeType" column="recipe_type" />
- <result property="prescribeCodeUrl" column="prescribe_code_url" />
- <result property="cycle" column="cycle" />
- <result property="icdCode" column="icd_code" />
- <result property="source" column="source" />
- <result property="prescribeImgStoreUrl" column="prescribe_img_store_url" />
- </resultMap>
- <sql id="selectFsPrescribeVo">
- select prescribe_id,prescribe_code_url,prescribe_img_store_url,source,cycle,icd_code,prescribe_type,recipe_type,patient_birthday,drug_doctor_sign_url,prescribe_doctor_id,doctor_sign_url,prescribe_doctor_sign_url, inquiry_order_id, store_order_id, user_id, patient_id, prescribe_code, patient_descs, now_illness, history_illness, patient_age, patient_name, weight, is_history_allergic, history_allergic, liver_unusual, renal_unusual, is_lactation, patient_tel, patient_gender, record_pic, prescribe_img_url, audit_reason, diagnose, doctor_id,drug_doctor_id, create_time, status, audit_time,remark,usage_json,store_id from fs_prescribe
- </sql>
- <select id="selectFsPrescribeList" parameterType="FsPrescribe" resultMap="FsPrescribeResult">
- <include refid="selectFsPrescribeVo"/>
- <where>
- <if test="prescribeType != null "> and prescribe_type = #{prescribeType}</if>
- <if test="inquiryOrderId != null "> and inquiry_order_id = #{inquiryOrderId}</if>
- <if test="storeOrderId != null "> and store_order_id = #{storeOrderId}</if>
- <if test="userId != null "> and user_id = #{userId}</if>
- <if test="patientId != null "> and patient_id = #{patientId}</if>
- <if test="prescribeCode != null and prescribeCode != ''"> and prescribe_code = #{prescribeCode}</if>
- <if test="patientDescs != null and patientDescs != ''"> and patient_descs = #{patientDescs}</if>
- <if test="nowIllness != null and nowIllness != ''"> and now_illness = #{nowIllness}</if>
- <if test="historyIllness != null and historyIllness != ''"> and history_illness = #{historyIllness}</if>
- <if test="patientAge != null and patientAge != ''"> and patient_age = #{patientAge}</if>
- <if test="patientName != null and patientName != ''"> and patient_name like concat('%', #{patientName}, '%')</if>
- <if test="weight != null and weight != ''"> and weight = #{weight}</if>
- <if test="isHistoryAllergic != null and isHistoryAllergic != ''"> and is_history_allergic = #{isHistoryAllergic}</if>
- <if test="historyAllergic != null and historyAllergic != ''"> and history_allergic = #{historyAllergic}</if>
- <if test="liverUnusual != null and liverUnusual != ''"> and liver_unusual = #{liverUnusual}</if>
- <if test="renalUnusual != null and renalUnusual != ''"> and renal_unusual = #{renalUnusual}</if>
- <if test="isLactation != null and isLactation != ''"> and is_lactation = #{isLactation}</if>
- <if test="patientTel != null and patientTel != ''"> and patient_tel = #{patientTel}</if>
- <if test="patientGender != null and patientGender != ''"> and patient_gender = #{patientGender}</if>
- <if test="recordPic != null and recordPic != ''"> and record_pic = #{recordPic}</if>
- <if test="prescribeImgUrl != null and prescribeImgUrl != ''"> and prescribe_img_url = #{prescribeImgUrl}</if>
- <if test="auditReason != null and auditReason != ''"> and audit_reason = #{auditReason}</if>
- <if test="diagnose != null and diagnose != ''"> and diagnose = #{diagnose}</if>
- <if test="doctorId != null and doctorId != ''"> and doctor_id = #{doctorId}</if>
- <if test="status != null "> and status = #{status}</if>
- <if test="auditTime != null "> and audit_time = #{auditTime}</if>
- </where>
- order by prescribe_id desc
- </select>
- <select id="selectFsPrescribeByPrescribeId" parameterType="Long" resultMap="FsPrescribeResult">
- <include refid="selectFsPrescribeVo"/>
- where prescribe_id = #{prescribeId}
- </select>
- <insert id="insertFsPrescribe" parameterType="FsPrescribe" useGeneratedKeys="true" keyProperty="prescribeId">
- insert into fs_prescribe
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="prescribeType != null">prescribe_type,</if>
- <if test="inquiryOrderId != null">inquiry_order_id,</if>
- <if test="storeOrderId != null">store_order_id,</if>
- <if test="userId != null">user_id,</if>
- <if test="patientId != null">patient_id,</if>
- <if test="prescribeCode != null">prescribe_code,</if>
- <if test="patientDescs != null">patient_descs,</if>
- <if test="nowIllness != null">now_illness,</if>
- <if test="historyIllness != null">history_illness,</if>
- <if test="patientAge != null">patient_age,</if>
- <if test="patientName != null">patient_name,</if>
- <if test="weight != null">weight,</if>
- <if test="isHistoryAllergic != null">is_history_allergic,</if>
- <if test="historyAllergic != null">history_allergic,</if>
- <if test="liverUnusual != null">liver_unusual,</if>
- <if test="renalUnusual != null">renal_unusual,</if>
- <if test="isLactation != null">is_lactation,</if>
- <if test="patientTel != null">patient_tel,</if>
- <if test="patientGender != null">patient_gender,</if>
- <if test="recordPic != null">record_pic,</if>
- <if test="prescribeImgUrl != null">prescribe_img_url,</if>
- <if test="auditReason != null">audit_reason,</if>
- <if test="diagnose != null">diagnose,</if>
- <if test="doctorId != null">doctor_id,</if>
- <if test="drugDoctorId != null">drug_doctor_id,</if>
- <if test="createTime != null">create_time,</if>
- <if test="status != null">status,</if>
- <if test="auditTime != null">audit_time,</if>
- <if test="remark != null">remark,</if>
- <if test="usageJson != null">usage_json,</if>
- <if test="storeId != null">store_id,</if>
- <if test="prescribeDoctorId != null">prescribe_doctor_id,</if>
- <if test="doctorSignUrl != null">doctor_sign_url,</if>
- <if test="prescribeDoctorSignUrl != null">prescribe_doctor_sign_url,</if>
- <if test="drugDoctorSignUrl != null">drug_doctor_sign_url,</if>
- <if test="patientBirthday != null">patient_birthday,</if>
- <if test="recipeType != null">recipe_type,</if>
- <if test="prescribeCodeUrl != null">prescribe_code_url,</if>
- <if test="cycle != null">cycle,</if>
- <if test="icdCode != null">icd_code,</if>
- <if test="source != null">source,</if>
- <if test="prescribeImgStoreUrl != null">prescribe_img_store_url,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="prescribeType != null">#{prescribeType},</if>
- <if test="inquiryOrderId != null">#{inquiryOrderId},</if>
- <if test="storeOrderId != null">#{storeOrderId},</if>
- <if test="userId != null">#{userId},</if>
- <if test="patientId != null">#{patientId},</if>
- <if test="prescribeCode != null">#{prescribeCode},</if>
- <if test="patientDescs != null">#{patientDescs},</if>
- <if test="nowIllness != null">#{nowIllness},</if>
- <if test="historyIllness != null">#{historyIllness},</if>
- <if test="patientAge != null">#{patientAge},</if>
- <if test="patientName != null">#{patientName},</if>
- <if test="weight != null">#{weight},</if>
- <if test="isHistoryAllergic != null">#{isHistoryAllergic},</if>
- <if test="historyAllergic != null">#{historyAllergic},</if>
- <if test="liverUnusual != null">#{liverUnusual},</if>
- <if test="renalUnusual != null">#{renalUnusual},</if>
- <if test="isLactation != null">#{isLactation},</if>
- <if test="patientTel != null">#{patientTel},</if>
- <if test="patientGender != null">#{patientGender},</if>
- <if test="recordPic != null">#{recordPic},</if>
- <if test="prescribeImgUrl != null">#{prescribeImgUrl},</if>
- <if test="auditReason != null">#{auditReason},</if>
- <if test="diagnose != null">#{diagnose},</if>
- <if test="doctorId != null">#{doctorId},</if>
- <if test="drugDoctorId != null">#{drugDoctorId},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="status != null">#{status},</if>
- <if test="auditTime != null">#{auditTime},</if>
- <if test="remark != null">#{remark},</if>
- <if test="usageJson != null">#{usageJson},</if>
- <if test="storeId != null">#{storeId},</if>
- <if test="prescribeDoctorId != null">#{prescribeDoctorId},</if>
- <if test="doctorSignUrl != null">#{doctorSignUrl},</if>
- <if test="prescribeDoctorSignUrl != null">#{prescribeDoctorSignUrl},</if>
- <if test="drugDoctorSignUrl != null">#{drugDoctorSignUrl},</if>
- <if test="patientBirthday != null">#{patientBirthday},</if>
- <if test="recipeType != null">#{recipeType},</if>
- <if test="prescribeCodeUrl != null">#{prescribeCodeUrl},</if>
- <if test="cycle != null">#{cycle},</if>
- <if test="icdCode != null">#{icdCode},</if>
- <if test="source != null">#{source},</if>
- <if test="prescribeImgStoreUrl != null">#{prescribeImgStoreUrl},</if>
- </trim>
- </insert>
- <update id="updateFsPrescribe" parameterType="FsPrescribe">
- update fs_prescribe
- <trim prefix="SET" suffixOverrides=",">
- <if test="prescribeType != null">prescribe_type = #{prescribeType},</if>
- <if test="inquiryOrderId != null">inquiry_order_id = #{inquiryOrderId},</if>
- <if test="storeOrderId != null">store_order_id = #{storeOrderId},</if>
- <if test="userId != null">user_id = #{userId},</if>
- <if test="patientId != null">patient_id = #{patientId},</if>
- <if test="prescribeCode != null">prescribe_code = #{prescribeCode},</if>
- <if test="patientDescs != null">patient_descs = #{patientDescs},</if>
- <if test="nowIllness != null">now_illness = #{nowIllness},</if>
- <if test="historyIllness != null">history_illness = #{historyIllness},</if>
- <if test="patientAge != null">patient_age = #{patientAge},</if>
- <if test="patientName != null">patient_name = #{patientName},</if>
- <if test="weight != null">weight = #{weight},</if>
- <if test="isHistoryAllergic != null">is_history_allergic = #{isHistoryAllergic},</if>
- <if test="historyAllergic != null">history_allergic = #{historyAllergic},</if>
- <if test="liverUnusual != null">liver_unusual = #{liverUnusual},</if>
- <if test="renalUnusual != null">renal_unusual = #{renalUnusual},</if>
- <if test="isLactation != null">is_lactation = #{isLactation},</if>
- <if test="patientTel != null">patient_tel = #{patientTel},</if>
- <if test="patientGender != null">patient_gender = #{patientGender},</if>
- <if test="recordPic != null">record_pic = #{recordPic},</if>
- <if test="prescribeImgUrl != null">prescribe_img_url = #{prescribeImgUrl},</if>
- <if test="auditReason != null">audit_reason = #{auditReason},</if>
- <if test="diagnose != null">diagnose = #{diagnose},</if>
- <if test="doctorId != null">doctor_id = #{doctorId},</if>
- <if test="drugDoctorId != null">drug_doctor_id = #{drugDoctorId},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="status != null">status = #{status},</if>
- <if test="auditTime != null">audit_time = #{auditTime},</if>
- <if test="remark != null">remark = #{remark},</if>
- <if test="usageJson != null">usage_json = #{usageJson},</if>
- <if test="storeId != null">store_id = #{storeId},</if>
- <if test="prescribeDoctorId != null">prescribe_doctor_id = #{prescribeDoctorId},</if>
- <if test="doctorSignUrl != null">doctor_sign_url = #{doctorSignUrl},</if>
- <if test="prescribeDoctorSignUrl != null">prescribe_doctor_sign_url = #{prescribeDoctorSignUrl},</if>
- <if test="drugDoctorSignUrl != null">drug_doctor_sign_url = #{drugDoctorSignUrl},</if>
- <if test="patientBirthday != null">patient_birthday = #{patientBirthday},</if>
- <if test="recipeType != null">recipe_type = #{recipeType},</if>
- <if test="prescribeCodeUrl != null">prescribe_code_url = #{prescribeCodeUrl},</if>
- <if test="cycle != null">cycle = #{cycle},</if>
- <if test="icdCode != null">icd_code = #{icdCode},</if>
- <if test="source != null">source = #{source},</if>
- <if test="prescribeImgStoreUrl != null">prescribe_img_store_url = #{prescribeImgStoreUrl},</if>
- </trim>
- where prescribe_id = #{prescribeId}
- </update>
- <delete id="deleteFsPrescribeByPrescribeId" parameterType="Long">
- delete from fs_prescribe where prescribe_id = #{prescribeId}
- </delete>
- <delete id="deleteFsPrescribeByPrescribeIds" parameterType="String">
- delete from fs_prescribe where prescribe_id in
- <foreach item="prescribeId" collection="array" open="(" separator="," close=")">
- #{prescribeId}
- </foreach>
- </delete>
- <select id="selectFsPrescribeListVO_COUNT" parameterType="com.fs.his.param.FsStoreOrderParam" resultType="Long">
- select count(1) from fs_prescribe so
- <if test="companyId != null or companyUserId != null or orderCode != null or orderStatus != null "> LEFT JOIN fs_store_order fso ON fso.order_id = so.store_order_id </if>
- <if test="doctorName != null and doctorName != ''"> LEFT JOIN fs_doctor dc ON dc.doctor_id = so.doctor_id </if>
- where 1=1
- <if test="companyId != null "> and fso.company_id = #{companyId}</if>
- <if test="companyUserId != null "> and fso.company_user_id = #{companyUserId}</if>
- <if test="prescribeType != null "> and so.prescribe_type = #{prescribeType}</if>
- <if test="inquiryOrderId != null "> and so.inquiry_order_id = #{inquiryOrderId}</if>
- <if test="storeOrderId != null "> and so.store_order_id = #{storeOrderId}</if>
- <if test="userId != null "> and so.user_id = #{userId}</if>
- <if test="prescribeCode != null and prescribeCode != ''"> and so.prescribe_code = #{prescribeCode}</if>
- <if test="patientName != null and patientName != ''"> and so.patient_name like concat('%', #{patientName}, '%')</if>
- <if test="doctorName != null and doctorName != ''"> and dc.doctor_name like concat('%', #{doctorName}, '%')</if>
- <if test="patientTel != null and patientTel != ''"> and so.patient_tel = #{patientTel}</if>
- <if test="doctorId != null and doctorId != ''"> and so.doctor_id = #{doctorId}</if>
- <if test="status != null "> and so.status = #{status}</if>
- <if test="sTime != null "> and DATE(so.create_time) >= DATE(#{sTime})</if>
- <if test="eTime != null "> and DATE(so.create_time) <= DATE(#{eTime})</if>
- <if test="auditSTime != null "> and DATE(so.audit_time) >= DATE(#{auditSTime})</if>
- <if test="auditETime != null "> and DATE(so.audit_time) <= DATE(#{auditETime})</if>
- <if test="auditTime != null "> and so.audit_time = #{auditTime}</if>
- <if test="orderCode != null "> and fso.order_code = #{orderCode}</if>
- <if test="orderStatus != null "> and fso.`status` = #{orderStatus}</if>
- <if test="storeId != null "> and so.store_id = #{storeId}</if>
- </select>
- <select id="selectFsPrescribeListVOWithConfirm" resultType="com.fs.his.vo.FsPrescribeListVO">
- select so.*,us.nick_name,dc.doctor_name,
- dp.doctor_name doctor_drug_name,
- fso.order_code,fso.`status` order_status,
- fse.store_name FROM fs_prescribe so
- LEFT JOIN fs_user us ON us.user_id=so.user_id
- LEFT JOIN fs_doctor dc ON dc.doctor_id = so.doctor_id
- LEFT JOIN fs_doctor dp ON dp.doctor_id =so.drug_doctor_id
- LEFT JOIN fs_store_order fso ON fso.order_id = so.store_order_id
- LEFT JOIN fs_store fse ON fse.store_id = so.store_id
- <where>
- doctor_confirm != -1
- <if test="companyId != null "> and fso.company_id = #{companyId}</if>
- <if test="companyUserId != null "> and fso.company_user_id = #{companyUserId}</if>
- <if test="prescribeType != null "> and so.prescribe_type = #{prescribeType}</if>
- <if test="inquiryOrderId != null "> and so.inquiry_order_id = #{inquiryOrderId}</if>
- <if test="storeOrderId != null "> and so.store_order_id = #{storeOrderId}</if>
- <if test="userId != null "> and so.user_id = #{userId}</if>
- <if test="prescribeCode != null and prescribeCode != ''"> and so.prescribe_code = #{prescribeCode}</if>
- <if test="patientName != null and patientName != ''"> and so.patient_name like concat('%', #{patientName}, '%')</if>
- <if test="doctorName != null and doctorName != ''"> and dc.doctor_name like concat('%', #{doctorName}, '%')</if>
- <if test="patientTel != null and patientTel != ''"> and so.patient_tel = #{patientTel}</if>
- <if test="doctorId != null and doctorId != ''"> and so.doctor_id = #{doctorId}</if>
- <if test="status != null "> and so.status = #{status}</if>
- <if test="sTime != null "> and DATE(so.create_time) >= DATE(#{sTime})</if>
- <if test="eTime != null "> and DATE(so.create_time) <= DATE(#{eTime})</if>
- <if test="auditSTime != null "> and DATE(so.audit_time) >= DATE(#{auditSTime})</if>
- <if test="auditETime != null "> and DATE(so.audit_time) <= DATE(#{auditETime})</if>
- <if test="auditTime != null "> and so.audit_time = #{auditTime}</if>
- <if test="orderCode != null "> and fso.order_code = #{orderCode}</if>
- <if test="orderStatus != null "> and fso.`status` = #{orderStatus}</if>
- <if test="storeId != null "> and so.store_id = #{storeId}</if>
- </where>
- order by prescribe_id desc
- </select>
- </mapper>
|