|
|
@@ -89,4 +89,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
+
|
|
|
+ <select id="selectDetailStatisticsVOList" parameterType="com.fs.his.param.FsProjectRedDetailStatisticsParam" resultType="com.fs.his.vo.FsProjectRedDetailStatisticsVO">
|
|
|
+ SELECT
|
|
|
+ DATE(d.send_time) AS send_date,
|
|
|
+ d.company_user_id AS sales_id,
|
|
|
+ u.nick_name as company_user_name,
|
|
|
+ CONCAT_WS('-',p.project_name,p.day_name) as project_name,
|
|
|
+ d.project_id AS physio_id,
|
|
|
+ COUNT(*) AS total_send_count,
|
|
|
+ COUNT(DISTINCT CASE WHEN d.status = 1 THEN d.user_id END) AS clicked_user_count,
|
|
|
+ SUM(CASE WHEN d.status = 1 THEN d.read_duration ELSE 0 END) AS total_stay_duration,
|
|
|
+ ROUND(AVG(CASE WHEN d.status = 1 THEN d.read_duration END), 2) AS avg_stay_duration
|
|
|
+ FROM fs_project_red_detail d
|
|
|
+ LEFT JOIN company_user u ON d.company_user_id = u.user_id
|
|
|
+ LEFT JOIN fs_project p ON d.project_id = p.id
|
|
|
+ <where>
|
|
|
+ <if test="sendDate != null and sendDate !=''"> AND DATE(d.send_time) = #{sendDate} </if>
|
|
|
+ <if test="companyUserName != null"> AND u.nick_name like concat('%', #{companyUserName}, '%') </if>
|
|
|
+ <if test="projectId != null "> AND d.project_id = #{projectId}</if>
|
|
|
+ </where>
|
|
|
+ GROUP BY DATE(send_time), company_user_id, project_id
|
|
|
+ ORDER BY send_date, sales_id, physio_id DESC
|
|
|
+ </select>
|
|
|
</mapper>
|