<?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.pz.system.mapper.ZyphOrderMapper">
<resultMap type="com.pz.system.domain.ZyphOrder" id="ZyphOrderResult">
<result property="id" column="id"/>
<result property="orderId" column="order_id"/>
<result property="hid" column="hid"/>
<result property="did" column="did"/>
<result property="visitor" column="visitor"/>
<result property="startDay" column="start_day"/>
<result property="endDay" column="end_day"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
<result property="status" column="status"/>
<result property="overTime" column="over_time"/>
<result property="voucher" column="voucher"/>
<result property="delFlag" column="del_flag"/>
<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"/>
</resultMap>
<select id="findZyphOrderVoPage" resultType="com.pz.system.domain.vo.ZyphOrderVo">
SELECT
tlo.order_sn AS orderSn,
tlo.pay_money AS PayMoney,
s.`name` AS serviceName,
c.`name` AS cityName,
d.title AS title,
e.`name` AS eName,
tlo.remark AS remark,
yyod.`status` AS yStatus,
h.`name` AS hName,
tlo.`status` AS tStatus,
tlo.is_satisfaction AS isSatisfaction,
tlo.evaluation_content AS evaluationContent,
yyod.over_time AS overtime,
yyod.voucher AS voucher,
yyod.start_day,
yyod.end_day,
yyod.start_time,
yyod.end_time,
yyod.create_time
FROM zyph_order AS yyod
LEFT JOIN total_order AS tlo ON yyod.order_id = tlo.id
LEFT JOIN city AS c ON c.id = tlo.city_id
LEFT JOIN hospital AS h ON h.id = yyod.hid
LEFT JOIN department AS d ON d.id = yyod.did
LEFT JOIN services AS s ON s.id = tlo.service_id
LEFT JOIN employees AS e ON e.id = tlo.em_id
<if test="bo.orderSn != null and bo.orderSn != ''">
where tlo.order_sn LIKE CONCAT('%', #{bo.orderSn}, '%')
</if>
</select>
<select id="selectSonOrderInfoByTotalId" resultType="com.pz.merchant.domain.vo.SonOrderVo">
select vsitor.name as userName,
zyph_order.status as orderStatus,
sys_user.avatar,
hospital.name as hospital,
zyph_order.start_day as visitTime,
zyph_order.id as sonOrderId
from zyph_order
left join user_vsitor as vsitor on vsitor.id = zyph_order.visitor
left join sys_user on sys_user.user_id = vsitor.uid
left join hospital on hospital.id = zyph_order.hid
where zyph_order.order_id = #{totalId}
</select>
<select id="selectZyphOrderDetailDataByTotalId" resultType="com.pz.system.domain.vo.ZyphOrderItemVo">
select total_order.id as orderId,
zyph_order.id as serviceOrderId,
total_order.business_id,
total_order.status as orderStatus,
zyph_order.status as serviceStatus,
services.name as project,
business.name as businessName,
CONVERT((1 - services.fenmo / 100), decimal(10, 2)) *
CONVERT(services.price, decimal(10, 2)) as commission,
user_vsitor.name as userName,
hospital.name as hospital,
department.title as department,
total_order.remark as description,
zyph_order.remark,
concat(zyph_order.start_day, ' ~ ', zyph_order.end_day) as visitDate,
concat(zyph_order.start_time, ' ~ ', zyph_order.end_time) as visitTime,
zyph_order.voucher,
total_order.evaluation_content,
total_order.is_satisfaction as evaluation_flag,
total_order.uid as userId,
employees.uid as euserId
from total_order
left join business on total_order.business_id = business.id
left join zyph_order on zyph_order.order_id = total_order.id
left join employees on employees.id = total_order.em_id
left join services on total_order.service_id = services.id
left join user_vsitor on user_vsitor.id = zyph_order.visitor
left join hospital on zyph_order.hid = hospital.id
left join department on department.id = zyph_order.did
where total_order.id = #{id}
</select>
<select id="selectFinishTime" resultType="java.lang.String">
select concat(d.start_day, ' ', d.start_time)
from total_order t left join zyph_order d on d.order_id = t.id
where t.id = #{id}
</select>
</mapper>