|
|
|
@ -426,27 +426,160 @@ |
|
|
|
|
|
|
|
|
|
<select id="selectStatistics" resultType="map"> |
|
|
|
|
SELECT |
|
|
|
|
( SELECT GROUP_CONCAT( cnm.dicname ) FROM sys_dictionary cnm WHERE FIND_IN_SET( cnm.dicnum, b.visit_types ) AND dicpcode = 58 ) visitingPlace, |
|
|
|
|
SUM( CASE WHEN write_off = 0 THEN 1 ELSE 0 END ) AS unverified, |
|
|
|
|
SUM( CASE WHEN write_off = 1 THEN 1 ELSE 0 END ) AS verified, |
|
|
|
|
SUM( CASE WHEN write_off = 3 THEN 1 ELSE 0 END ) AS cancel, |
|
|
|
|
SUM( CASE WHEN expired_state = 1 THEN 1 ELSE 0 END ) AS hasExpired, |
|
|
|
|
COUNT( * ) AS altogether |
|
|
|
|
visitingPlace, |
|
|
|
|
SUM( altogether ) AS altogether, -- 预约总数 |
|
|
|
|
SUM( verified_personal + verified_team ) AS verified -- 核销总数 |
|
|
|
|
FROM |
|
|
|
|
ybsj_appointment_people_info a |
|
|
|
|
LEFT JOIN ybsj_appointment_documents_info b ON a.appointment_documents_id = b.id |
|
|
|
|
WHERE |
|
|
|
|
1 = 1 |
|
|
|
|
( |
|
|
|
|
SELECT |
|
|
|
|
( SELECT GROUP_CONCAT( cnm.dicname ) FROM sys_dictionary cnm WHERE FIND_IN_SET( cnm.dicnum, a.visit_types ) AND dicpcode = 58 ) AS visitingPlace,-- 总预约数 |
|
|
|
|
a.appointment_count AS altogether,-- 团队核销数 |
|
|
|
|
CASE |
|
|
|
|
|
|
|
|
|
WHEN a.appointment_documents_write_off = 1 |
|
|
|
|
AND a.appointment_type_id != 5701 THEN |
|
|
|
|
a.appointment_count ELSE 0 |
|
|
|
|
END AS verified_team,-- 个人核销数 |
|
|
|
|
CASE |
|
|
|
|
|
|
|
|
|
WHEN a.appointment_type_id = 5701 THEN |
|
|
|
|
( SELECT COUNT( b.id ) FROM ybsj_appointment_people_info b WHERE b.appointment_documents_id = a.id AND b.write_off = 1 ) ELSE 0 |
|
|
|
|
END AS verified_personal |
|
|
|
|
FROM |
|
|
|
|
ybsj_appointment_documents_info a |
|
|
|
|
where 1 = 1 |
|
|
|
|
and a.del_flag = 0 |
|
|
|
|
<if test="getAppointmentRecordVO.reservationStartDate !=null and getAppointmentRecordVO.reservationStartDate!=''"> |
|
|
|
|
and a.appointment_date >= #{getAppointmentRecordVO.reservationStartDate} |
|
|
|
|
</if> |
|
|
|
|
<if test="getAppointmentRecordVO.reservationEndDate !=null and getAppointmentRecordVO.reservationEndDate!=''"> |
|
|
|
|
and a.appointment_date <= #{getAppointmentRecordVO.reservationEndDate} |
|
|
|
|
</if> |
|
|
|
|
) base |
|
|
|
|
GROUP BY |
|
|
|
|
visitingPlace |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<select id="selectStatisticsQx" resultType="map"> |
|
|
|
|
SELECT |
|
|
|
|
visitingPlace, |
|
|
|
|
SUM(cancel) AS cancel |
|
|
|
|
FROM ( |
|
|
|
|
-- 第一个查询 |
|
|
|
|
SELECT |
|
|
|
|
SUM(a.appointment_count) AS cancel, |
|
|
|
|
( |
|
|
|
|
SELECT GROUP_CONCAT(cnm.dicname) |
|
|
|
|
FROM sys_dictionary cnm |
|
|
|
|
WHERE FIND_IN_SET(cnm.dicnum, a.visit_types) AND dicpcode = 58 |
|
|
|
|
) AS visitingPlace |
|
|
|
|
FROM |
|
|
|
|
ybsj_appointment_documents_info a |
|
|
|
|
WHERE |
|
|
|
|
a.appointment_documents_write_off = 3 |
|
|
|
|
AND a.appointment_type_id != 5701 |
|
|
|
|
and a.del_flag = 0 |
|
|
|
|
<if test="getAppointmentRecordVO.reservationStartDate !=null and getAppointmentRecordVO.reservationStartDate!=''"> |
|
|
|
|
and a.appointment_date >= #{getAppointmentRecordVO.reservationStartDate} |
|
|
|
|
</if> |
|
|
|
|
<if test="getAppointmentRecordVO.reservationEndDate !=null and getAppointmentRecordVO.reservationEndDate!=''"> |
|
|
|
|
and a.appointment_date <= #{getAppointmentRecordVO.reservationEndDate} |
|
|
|
|
</if> |
|
|
|
|
GROUP BY |
|
|
|
|
( |
|
|
|
|
SELECT GROUP_CONCAT(cnm.dicname) |
|
|
|
|
FROM sys_dictionary cnm |
|
|
|
|
WHERE FIND_IN_SET(cnm.dicnum, a.visit_types) AND dicpcode = 58 |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
|
-- 第二个查询 |
|
|
|
|
SELECT |
|
|
|
|
COUNT(b.id) AS cancel, |
|
|
|
|
( |
|
|
|
|
SELECT GROUP_CONCAT(cnm.dicname) |
|
|
|
|
FROM sys_dictionary cnm |
|
|
|
|
WHERE FIND_IN_SET(cnm.dicnum, a.visit_types) AND dicpcode = 58 |
|
|
|
|
) AS visitingPlace |
|
|
|
|
FROM |
|
|
|
|
ybsj_appointment_people_info b |
|
|
|
|
LEFT JOIN ybsj_appointment_documents_info a ON a.id = b.appointment_documents_id |
|
|
|
|
WHERE |
|
|
|
|
b.write_off = 3 |
|
|
|
|
AND a.appointment_type_id = 5701 |
|
|
|
|
and a.del_flag = 0 |
|
|
|
|
<if test="getAppointmentRecordVO.reservationStartDate !=null and getAppointmentRecordVO.reservationStartDate!=''"> |
|
|
|
|
and a.appointment_date >= #{getAppointmentRecordVO.reservationStartDate} |
|
|
|
|
</if> |
|
|
|
|
<if test="getAppointmentRecordVO.reservationEndDate !=null and getAppointmentRecordVO.reservationEndDate!=''"> |
|
|
|
|
and a.appointment_date <= #{getAppointmentRecordVO.reservationEndDate} |
|
|
|
|
</if> |
|
|
|
|
GROUP BY |
|
|
|
|
( |
|
|
|
|
SELECT GROUP_CONCAT(cnm.dicname) |
|
|
|
|
FROM sys_dictionary cnm |
|
|
|
|
WHERE FIND_IN_SET(cnm.dicnum, a.visit_types) AND dicpcode = 58 |
|
|
|
|
) |
|
|
|
|
) AS combined |
|
|
|
|
GROUP BY |
|
|
|
|
visitingPlace; |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<select id="selectStatisticsGq" resultType="map"> |
|
|
|
|
SELECT |
|
|
|
|
visitingPlace, |
|
|
|
|
SUM(team_cancel + personal_cancel) AS hasExpired |
|
|
|
|
FROM ( |
|
|
|
|
-- 团队/研学过期人数 |
|
|
|
|
SELECT |
|
|
|
|
(SELECT GROUP_CONCAT(cnm.dicname) |
|
|
|
|
FROM sys_dictionary cnm |
|
|
|
|
WHERE FIND_IN_SET(cnm.dicnum, a.visit_types) AND dicpcode = 58) AS visitingPlace, |
|
|
|
|
IFNULL(SUM(a.appointment_count), 0) AS team_cancel, |
|
|
|
|
0 AS personal_cancel |
|
|
|
|
FROM |
|
|
|
|
ybsj_appointment_documents_info a |
|
|
|
|
LEFT JOIN ybsj_appointment_people_info b ON a.id = b.appointment_documents_id AND b.expired_state = 1 |
|
|
|
|
WHERE |
|
|
|
|
b.expired_state = 1 |
|
|
|
|
AND a.appointment_type_id != 5701 |
|
|
|
|
and a.del_flag = 0 |
|
|
|
|
<if test="getAppointmentRecordVO.reservationStartDate !=null and getAppointmentRecordVO.reservationStartDate!=''"> |
|
|
|
|
and a.appointment_date >= #{getAppointmentRecordVO.reservationStartDate} |
|
|
|
|
</if> |
|
|
|
|
<if test="getAppointmentRecordVO.reservationEndDate !=null and getAppointmentRecordVO.reservationEndDate!=''"> |
|
|
|
|
and a.appointment_date <= #{getAppointmentRecordVO.reservationEndDate} |
|
|
|
|
</if> |
|
|
|
|
GROUP BY visitingPlace |
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
|
-- 个人过期人数 |
|
|
|
|
SELECT |
|
|
|
|
(SELECT GROUP_CONCAT(cnm.dicname) |
|
|
|
|
FROM sys_dictionary cnm |
|
|
|
|
WHERE FIND_IN_SET(cnm.dicnum, a.visit_types) AND dicpcode = 58) AS visitingPlace, |
|
|
|
|
0 AS team_cancel, |
|
|
|
|
COUNT(b.id) AS personal_cancel |
|
|
|
|
FROM |
|
|
|
|
ybsj_appointment_people_info b |
|
|
|
|
LEFT JOIN ybsj_appointment_documents_info a ON a.id = b.appointment_documents_id |
|
|
|
|
WHERE |
|
|
|
|
b.expired_state = 1 |
|
|
|
|
AND a.appointment_type_id = 5701 |
|
|
|
|
and a.del_flag = 0 |
|
|
|
|
<if test="getAppointmentRecordVO.reservationStartDate !=null and getAppointmentRecordVO.reservationStartDate!=''"> |
|
|
|
|
and a.appointment_date >= #{getAppointmentRecordVO.reservationStartDate} |
|
|
|
|
</if> |
|
|
|
|
<if test="getAppointmentRecordVO.reservationEndDate !=null and getAppointmentRecordVO.reservationEndDate!=''"> |
|
|
|
|
and a.appointment_date <= #{getAppointmentRecordVO.reservationEndDate} |
|
|
|
|
</if> |
|
|
|
|
GROUP BY visitingPlace |
|
|
|
|
) combined |
|
|
|
|
GROUP BY visitingPlace; |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<select id="selectPop" resultType="map"> |
|
|
|
|
select guid,ybsj_message_info.title,ybsj_tk_content.content,ybsj_tk_content.start_time,ybsj_tk_content.end_time |
|
|
|
|
from ybsj_message_info left join ybsj_tk_content |
|
|
|
|