271 lines
12 KiB
XML
271 lines
12 KiB
XML
<?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.openhis.clinical.mapper.OrderMapper">
|
|
|
|
<resultMap type="com.openhis.clinical.domain.Order" id="OrderResult">
|
|
<id property="id" column="id"/>
|
|
<result property="orderNo" column="order_no"/>
|
|
<result property="patientId" column="patient_id"/>
|
|
<result property="patientName" column="patient_name"/>
|
|
<result property="medicalCard" column="medical_card"/>
|
|
<result property="phone" column="phone"/>
|
|
<result property="gender" column="gender"/>
|
|
<result property="scheduleId" column="schedule_id"/>
|
|
<result property="slotId" column="slot_id"/>
|
|
<result property="departmentId" column="department_id"/>
|
|
<result property="departmentName" column="department_name"/>
|
|
<result property="doctorId" column="doctor_id"/>
|
|
<result property="doctorName" column="doctor_name"/>
|
|
<result property="regType" column="reg_type"/>
|
|
<result property="fee" column="fee"/>
|
|
<result property="appointmentDate" column="appointment_date"/>
|
|
<result property="appointmentTime" column="appointment_time"/>
|
|
<result property="cancelTime" column="cancel_time"/>
|
|
<result property="cancelReason" column="cancel_reason"/>
|
|
<result property="status" column="status"/>
|
|
<result property="payStatus" column="pay_status"/>
|
|
<result property="version" column="version"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
</resultMap>
|
|
|
|
<select id="selectOrderList" resultMap="OrderResult">
|
|
select * from order_main
|
|
<where>
|
|
<if test="orderNo != null and orderNo != ''">
|
|
and order_no = #{orderNo}
|
|
</if>
|
|
<if test="patientId != null">
|
|
and patient_id = #{patientId}
|
|
</if>
|
|
<if test="patientName != null and patientName != ''">
|
|
and patient_name like #{patientName}
|
|
</if>
|
|
<if test="medicalCard != null and medicalCard != ''">
|
|
and medical_card = #{medicalCard}
|
|
</if>
|
|
<if test="phone != null and phone != ''">
|
|
and phone = #{phone}
|
|
</if>
|
|
<if test="scheduleId != null">
|
|
and schedule_id = #{scheduleId}
|
|
</if>
|
|
<if test="slotId != null">
|
|
and slot_id = #{slotId}
|
|
</if>
|
|
<if test="departmentId != null">
|
|
and department_id = #{departmentId}
|
|
</if>
|
|
<if test="doctorId != null">
|
|
and doctor_id = #{doctorId}
|
|
</if>
|
|
<if test="status != null">
|
|
and status = #{status}
|
|
</if>
|
|
<if test="payStatus != null">
|
|
and pay_status = #{payStatus}
|
|
</if>
|
|
<if test="appointmentDate != null">
|
|
and appointment_date = #{appointmentDate}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectOrderPage" resultMap="OrderResult">
|
|
select * from order_main
|
|
<where>
|
|
<if test="order.orderNo != null and order.orderNo != ''">
|
|
and order_no = #{order.orderNo}
|
|
</if>
|
|
<if test="order.patientId != null">
|
|
and patient_id = #{order.patientId}
|
|
</if>
|
|
<if test="order.patientName != null and order.patientName != ''">
|
|
and patient_name like #{order.patientName}
|
|
</if>
|
|
<if test="order.medicalCard != null and order.medicalCard != ''">
|
|
and medical_card = #{order.medicalCard}
|
|
</if>
|
|
<if test="order.phone != null and order.phone != ''">
|
|
and phone = #{order.phone}
|
|
</if>
|
|
<if test="order.scheduleId != null">
|
|
and schedule_id = #{order.scheduleId}
|
|
</if>
|
|
<if test="order.slotId != null">
|
|
and slot_id = #{order.slotId}
|
|
</if>
|
|
<if test="order.departmentId != null">
|
|
and department_id = #{order.departmentId}
|
|
</if>
|
|
<if test="order.doctorId != null">
|
|
and doctor_id = #{order.doctorId}
|
|
</if>
|
|
<if test="order.status != null">
|
|
and status = #{order.status}
|
|
</if>
|
|
<if test="order.payStatus != null">
|
|
and pay_status = #{order.payStatus}
|
|
</if>
|
|
<if test="order.appointmentDate != null">
|
|
and appointment_date = #{order.appointmentDate}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectOrderById" resultMap="OrderResult">
|
|
select * from order_main where id = #{id}
|
|
</select>
|
|
|
|
<select id="selectOrderBySlotId" resultMap="OrderResult">
|
|
select * from order_main where slot_id = #{slotId} and status = 1
|
|
</select>
|
|
|
|
<insert id="insertOrder" parameterType="com.openhis.clinical.domain.Order">
|
|
insert into order_main
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="orderNo != null and orderNo != ''">order_no,</if>
|
|
<if test="patientId != null">patient_id,</if>
|
|
<if test="patientName != null and patientName != ''">patient_name,</if>
|
|
<if test="medicalCard != null and medicalCard != ''">medical_card,</if>
|
|
<if test="phone != null and phone != ''">phone,</if>
|
|
<if test="gender != null">gender,</if>
|
|
<if test="scheduleId != null">schedule_id,</if>
|
|
<if test="slotId != null">slot_id,</if>
|
|
<if test="departmentId != null">department_id,</if>
|
|
<if test="departmentName != null and departmentName != ''">department_name,</if>
|
|
<if test="doctorId != null">doctor_id,</if>
|
|
<if test="doctorName != null and doctorName != ''">doctor_name,</if>
|
|
<if test="regType != null and regType != ''">reg_type,</if>
|
|
<if test="fee != null">fee,</if>
|
|
<if test="appointmentDate != null">appointment_date,</if>
|
|
<if test="appointmentTime != null">appointment_time,</if>
|
|
<if test="cancelTime != null">cancel_time,</if>
|
|
<if test="cancelReason != null and cancelReason != ''">cancel_reason,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="payStatus != null">pay_status,</if>
|
|
<if test="version != null">version,</if>
|
|
<if test="tenantId != null">tenant_id,</if>
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="orderNo != null and orderNo != ''">#{orderNo},</if>
|
|
<if test="patientId != null">#{patientId},</if>
|
|
<if test="patientName != null and patientName != ''">#{patientName},</if>
|
|
<if test="medicalCard != null and medicalCard != ''">#{medicalCard},</if>
|
|
<if test="phone != null and phone != ''">#{phone},</if>
|
|
<if test="gender != null">#{gender},</if>
|
|
<if test="scheduleId != null">#{scheduleId},</if>
|
|
<if test="slotId != null">#{slotId},</if>
|
|
<if test="departmentId != null">#{departmentId},</if>
|
|
<if test="departmentName != null and departmentName != ''">#{departmentName},</if>
|
|
<if test="doctorId != null">#{doctorId},</if>
|
|
<if test="doctorName != null and doctorName != ''">#{doctorName},</if>
|
|
<if test="regType != null and regType != ''">#{regType},</if>
|
|
<if test="fee != null">#{fee},</if>
|
|
<if test="appointmentDate != null">#{appointmentDate},</if>
|
|
<if test="appointmentTime != null">#{appointmentTime},</if>
|
|
<if test="cancelTime != null">#{cancelTime},</if>
|
|
<if test="cancelReason != null and cancelReason != ''">#{cancelReason},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="payStatus != null">#{payStatus},</if>
|
|
<if test="version != null">#{version},</if>
|
|
<if test="tenantId != null">#{tenantId},</if>
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateOrder" parameterType="com.openhis.clinical.domain.Order">
|
|
update order_main
|
|
<trim prefix="set" suffixOverrides=",">
|
|
<if test="orderNo != null and orderNo != ''">order_no = #{orderNo},</if>
|
|
<if test="patientId != null">patient_id = #{patientId},</if>
|
|
<if test="patientName != null and patientName != ''">patient_name = #{patientName},</if>
|
|
<if test="medicalCard != null and medicalCard != ''">medical_card = #{medicalCard},</if>
|
|
<if test="phone != null and phone != ''">phone = #{phone},</if>
|
|
<if test="gender != null">gender = #{gender},</if>
|
|
<if test="scheduleId != null">schedule_id = #{scheduleId},</if>
|
|
<if test="slotId != null">slot_id = #{slotId},</if>
|
|
<if test="departmentId != null">department_id = #{departmentId},</if>
|
|
<if test="departmentName != null and departmentName != ''">department_name = #{departmentName},</if>
|
|
<if test="doctorId != null">doctor_id = #{doctorId},</if>
|
|
<if test="doctorName != null and doctorName != ''">doctor_name = #{doctorName},</if>
|
|
<if test="regType != null and regType != ''">reg_type = #{regType},</if>
|
|
<if test="fee != null">fee = #{fee},</if>
|
|
<if test="appointmentDate != null">appointment_date = #{appointmentDate},</if>
|
|
<if test="appointmentTime != null">appointment_time = #{appointmentTime},</if>
|
|
<if test="cancelTime != null">cancel_time = #{cancelTime},</if>
|
|
<if test="cancelReason != null and cancelReason != ''">cancel_reason = #{cancelReason},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="payStatus != null">pay_status = #{payStatus},</if>
|
|
<if test="version != null">version = #{version},</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="updateOrderStatusById">
|
|
update order_main set status = #{status} where id = #{id}
|
|
</update>
|
|
|
|
<update id="updateOrderCancelInfoById">
|
|
update order_main set status = 3, cancel_time = #{cancelTime}, cancel_reason = #{cancelReason} where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteOrderById">
|
|
delete from order_main where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteOrderByIds">
|
|
delete from order_main where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="countOrders" resultType="int">
|
|
select count(*) from order_main
|
|
<where>
|
|
<if test="orderNo != null and orderNo != ''">
|
|
and order_no = #{orderNo}
|
|
</if>
|
|
<if test="patientId != null">
|
|
and patient_id = #{patientId}
|
|
</if>
|
|
<if test="scheduleId != null">
|
|
and schedule_id = #{scheduleId}
|
|
</if>
|
|
<if test="slotId != null">
|
|
and slot_id = #{slotId}
|
|
</if>
|
|
<if test="departmentId != null">
|
|
and department_id = #{departmentId}
|
|
</if>
|
|
<if test="doctorId != null">
|
|
and doctor_id = #{doctorId}
|
|
</if>
|
|
<if test="status != null">
|
|
and status = #{status}
|
|
</if>
|
|
<if test="payStatus != null">
|
|
and pay_status = #{payStatus}
|
|
</if>
|
|
<if test="appointmentDate != null">
|
|
and appointment_date = #{appointmentDate}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
</mapper>
|