<?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.DbwzOrderMapper">
<resultMap type="com.pz.system.domain.DbwzOrder" id="DbwzOrderResult">
<result property="id" column="id"/>
<result property="orderId" column="order_id"/>
<result property="visitor" column="visitor"/>
<result property="visitTime" column="visit_time"/>
<result property="did" column="did"/>
<result property="chiefComplaint" column="chief_complaint"/>
<result property="historyOfPresentIllness" column="history_of_present_illness"/>
<result property="pastHistory" column="past_history"/>
<result property="lastMedicalTreatmentSituation" column="last_medical_treatment_situation"/>
<result property="postTreatmentCondition" column="post_treatment_condition"/>
<result property="relatedReports" column="related_reports"/>
<result property="serviceRequirements" column="service_requirements"/>
<result property="status" column="status"/>
<result property="overTime" column="over_time"/>
<result property="voucher" column="voucher"/>
<result property="indications" column="indications"/>
<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="findDbwzOrderVoPage" resultType="com.pz.system.domain.vo.DbwzOrderVo">
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.visit_time AS visitTime,
yyod.`status` AS yStatus,
tlo.`status` AS tStatus,
tlo.is_satisfaction AS isSatisfaction,
tlo.evaluation_content AS evaluationContent,
yyod.over_time AS overtime,
yyod.voucher AS voucher,
yyod.*
FROM dbwz_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 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
LEFT JOIN company AS co ON co.id = e.company_id
<where>
<if test="bo.orderSn != null and bo.orderSn != ''">
and tlo.order_sn LIKE CONCAT('%', #{bo.orderSn}, '%')
</if>
<if test="bo.userId != null">
and co.uid = #{bo.userId}
</if>
</where>
</select>
<select id="selectSonOrderInfoByTotalId" resultType="com.pz.merchant.domain.vo.SonOrderVo">
select vsitor.name as userName,
dbwz_order.status as orderStatus,
sys_user.avatar,
dbwz_order.visit_time,
dbwz_order.id as sonOrderId
from dbwz_order
left join user_vsitor as vsitor on vsitor.id = dbwz_order.visitor
left join sys_user on sys_user.user_id = vsitor.uid
where dbwz_order.order_id = #{id}
</select>
<select id="selectDbwzOrderDetailDataByTotalId" resultType="com.pz.system.domain.vo.DbwzOrderItemVo">
select total_order.id as orderId,
dbwz_order.id as serviceOrderId,
total_order.business_id,
total_order.status as orderStatus,
dbwz_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,
dbwz_order.visit_time,
department.title as department,
dbwz_order.chief_complaint,
dbwz_order.history_of_present_illness,
dbwz_order.past_history,
dbwz_order.related_reports,
dbwz_order.service_requirements,
dbwz_order.last_medical_treatment_situation,
dbwz_order.post_treatment_condition,
total_order.evaluation_content,
total_order.is_satisfaction as evaluation_flag,
total_order.remark as description,
dbwz_order.remark,
dbwz_order.voucher,
total_order.uid as userId,
dbwz_order.voucher,
dbwz_order.indications as doctor,
employees.uid as euserId
from total_order
left join business on total_order.business_id = business.id
left join dbwz_order on dbwz_order.order_id = total_order.id
left join services on total_order.service_id = services.id
left join employees on employees.id = total_order.em_id
left join user_vsitor on user_vsitor.id = dbwz_order.visitor
left join department on department.id = dbwz_order.did
where total_order.id = #{id}
</select>
<select id="selectFinishTime" resultType="java.lang.String">
select visit_time
from total_order t
left join dbwz_order d on d.order_id = t.id
where t.id = #{id}
</select>
</mapper>