|
|
@@ -901,4 +901,228 @@
|
|
|
and io.licenseno like CONCAT('%', #{vo.licenseno}, '%')
|
|
|
</if>
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="queryPageTaskStatistics" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
|
+ SELECT
|
|
|
+ sd.name as "deptName",
|
|
|
+ su.name as "userName",
|
|
|
+ io.userid as "userId",
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS qutationCount,
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS underwritingCount,
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) AS qutationInsureCount,
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 4 THEN 1 END ) AS underwritingReturn,
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) as "passingRate",
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) as "closeRate",
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) as "contributionRate",
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) / COUNT(iac.orderstatus) as "quotationRate",
|
|
|
+ COUNT( CASE WHEN ifa.auditstatus = '0' THEN 1 END ) as "auditOrder"
|
|
|
+ FROM
|
|
|
+ ins_area_company iac
|
|
|
+ left join ins_orders io on io.orderno = iac.orderno
|
|
|
+ left join sys_dept sd on sd.id=io.deptid
|
|
|
+ left join sys_user su on su.id=io.userid
|
|
|
+ left join ins_fee_audit ifa on ifa .ins_order_no =iac.id
|
|
|
+ <where>
|
|
|
+ sd.management_source = '1'
|
|
|
+ <if test="taskStatisticsVo.provinceId != null and taskStatisticsVo.provinceId != ''">
|
|
|
+ and io.deptid like "${taskStatisticsVo.provinceId}%"
|
|
|
+ </if>
|
|
|
+ <if test="taskStatisticsVo.cityId != null and taskStatisticsVo.cityId != ''">
|
|
|
+ and io.deptid like "${taskStatisticsVo.cityId}%"
|
|
|
+ </if>
|
|
|
+ <if test="taskStatisticsVo.countyId != null and taskStatisticsVo.countyId != ''">
|
|
|
+ and io.deptid like "${taskStatisticsVo.countyId}%"
|
|
|
+ </if>
|
|
|
+ <if test="taskStatisticsVo.houseId != null and taskStatisticsVo.houseId != ''">
|
|
|
+ and io.deptid like "${taskStatisticsVo.houseId}%"
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="taskStatisticsVo.createtimeStart !=null and taskStatisticsVo.createtimeStart != '' and taskStatisticsVo.createtimeEnd !=null and taskStatisticsVo.createtimeEnd != ''">
|
|
|
+ AND DATE_FORMAT( io.createtime, '%Y-%m-%d') BETWEEN #{taskStatisticsVo.createtimeStart} AND #{taskStatisticsVo.createtimeEnd}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="taskStatisticsVo.days !=null and taskStatisticsVo.days !='' ">
|
|
|
+ <choose>
|
|
|
+ <when test="taskStatisticsVo.days =='1'">
|
|
|
+ and io.createtime >= DATE_SUB(NOW(), INTERVAL 1 DAY)
|
|
|
+ </when>
|
|
|
+
|
|
|
+ <when test="taskStatisticsVo.days =='7'">
|
|
|
+ and io.createtime >= DATE_SUB(NOW(), INTERVAL 7 DAY)
|
|
|
+ </when>
|
|
|
+
|
|
|
+ <when test="taskStatisticsVo.days =='30'">
|
|
|
+ and io.createtime >= DATE_SUB(NOW(), INTERVAL 30 DAY)
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY io.userid , su.name, sd.id , sd.name
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="insuranceCompanyQueryPage" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
|
+ SELECT
|
|
|
+ pa.insurance_company_id,
|
|
|
+ pa.insurance_company as "insuranceCompanyName",
|
|
|
+ eic.namesimple as "partnerCompaniesName",
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS qutationCount,
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS underwritingCount,
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) AS qutationInsureCount,
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 4 THEN 1 END ) AS underwritingReturn,
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS "passingRate",
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS "closeRate",
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS "contributionRate",
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) / COUNT( iac.orderstatus ) AS "quotationRate",
|
|
|
+ COUNT( CASE WHEN ifa.auditstatus = '0' THEN 1 END ) AS "auditOrder"
|
|
|
+ FROM
|
|
|
+ ins_area_company iac
|
|
|
+ LEFT JOIN ins_orders io ON io.orderno = iac.orderno
|
|
|
+ LEFT JOIN sys_dept sd ON sd.id = io.deptid
|
|
|
+ LEFT JOIN ins_fee_audit ifa ON ifa.ins_order_no = iac.id
|
|
|
+ LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
|
|
|
+ LEFT JOIN esm_ins_company eic ON eic.id = pa.partner_companies_id
|
|
|
+ <where>
|
|
|
+ pa.insurance_company_id IS NOT NULL
|
|
|
+ <if test="taskStatisticsVo.provinceId != null and taskStatisticsVo.provinceId != ''">
|
|
|
+ and io.deptid like "${taskStatisticsVo.provinceId}%"
|
|
|
+ </if>
|
|
|
+ <if test="taskStatisticsVo.cityId != null and taskStatisticsVo.cityId != ''">
|
|
|
+ and io.deptid like "${taskStatisticsVo.cityId}%"
|
|
|
+ </if>
|
|
|
+ <if test="taskStatisticsVo.countyId != null and taskStatisticsVo.countyId != ''">
|
|
|
+ and io.deptid like "${taskStatisticsVo.countyId}%"
|
|
|
+ </if>
|
|
|
+ <if test="taskStatisticsVo.houseId != null and taskStatisticsVo.houseId != ''">
|
|
|
+ and io.deptid like "${taskStatisticsVo.houseId}%"
|
|
|
+ </if>
|
|
|
+ <if test="taskStatisticsVo.createtimeStart !=null and taskStatisticsVo.createtimeStart != '' and taskStatisticsVo.createtimeEnd !=null and taskStatisticsVo.createtimeEnd != ''">
|
|
|
+ AND DATE_FORMAT( io.createtime, '%Y-%m-%d') BETWEEN #{taskStatisticsVo.createtimeStart} AND #{taskStatisticsVo.createtimeEnd}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="taskStatisticsVo.days !=null and taskStatisticsVo.days !='' ">
|
|
|
+ <choose>
|
|
|
+ <when test="taskStatisticsVo.days =='1'">
|
|
|
+ and io.createtime >= DATE_SUB(NOW(), INTERVAL 1 DAY)
|
|
|
+ </when>
|
|
|
+
|
|
|
+ <when test="taskStatisticsVo.days =='7'">
|
|
|
+ and io.createtime >= DATE_SUB(NOW(), INTERVAL 7 DAY)
|
|
|
+ </when>
|
|
|
+
|
|
|
+ <when test="taskStatisticsVo.days =='30'">
|
|
|
+ and io.createtime >= DATE_SUB(NOW(), INTERVAL 30 DAY)
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ pa.insurance_company_id,
|
|
|
+ pa.insurance_company,
|
|
|
+ eic.namesimple,
|
|
|
+ pa.insurance_company
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="agentStatisticsQueryPage" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
|
+ SELECT
|
|
|
+ sd.name as "deptName",
|
|
|
+ su.name as "userName",
|
|
|
+ io.userid as "userId",
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS qutationCount,
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS underwritingCount,
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) AS qutationInsureCount,
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 4 THEN 1 END ) AS underwritingReturn,
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) as "passingRate",
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) as "closeRate",
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) as "contributionRate",
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) / COUNT(iac.orderstatus) as "quotationRate",
|
|
|
+ COUNT( CASE WHEN ifa.auditstatus = '0' THEN 1 END ) as "auditOrder"
|
|
|
+ FROM
|
|
|
+ ins_area_company iac
|
|
|
+ left join ins_orders io on io.orderno = iac.orderno
|
|
|
+ left join sys_dept sd on sd.id=io.deptid
|
|
|
+ left join sys_user su on su.id=io.userid
|
|
|
+ left join ins_fee_audit ifa on ifa .ins_order_no =iac.id
|
|
|
+ <where>
|
|
|
+ sd.management_source = '2'
|
|
|
+ <if test="taskStatisticsVo.provinceId != null and taskStatisticsVo.provinceId != ''">
|
|
|
+ and io.deptid like "${taskStatisticsVo.provinceId}%"
|
|
|
+ </if>
|
|
|
+ <if test="taskStatisticsVo.cityId != null and taskStatisticsVo.cityId != ''">
|
|
|
+ and io.deptid like "${taskStatisticsVo.cityId}%"
|
|
|
+ </if>
|
|
|
+ <if test="taskStatisticsVo.countyId != null and taskStatisticsVo.countyId != ''">
|
|
|
+ and io.deptid like "${taskStatisticsVo.countyId}%"
|
|
|
+ </if>
|
|
|
+ <if test="taskStatisticsVo.houseId != null and taskStatisticsVo.houseId != ''">
|
|
|
+ and io.deptid like "${taskStatisticsVo.houseId}%"
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="taskStatisticsVo.createtimeStart !=null and taskStatisticsVo.createtimeStart != '' and taskStatisticsVo.createtimeEnd !=null and taskStatisticsVo.createtimeEnd != ''">
|
|
|
+ AND DATE_FORMAT( io.createtime, '%Y-%m-%d') BETWEEN #{taskStatisticsVo.createtimeStart} AND #{taskStatisticsVo.createtimeEnd}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="taskStatisticsVo.days !=null and taskStatisticsVo.days !='' ">
|
|
|
+ <choose>
|
|
|
+ <when test="taskStatisticsVo.days =='1'">
|
|
|
+ and io.createtime >= DATE_SUB(NOW(), INTERVAL 1 DAY)
|
|
|
+ </when>
|
|
|
+
|
|
|
+ <when test="taskStatisticsVo.days =='7'">
|
|
|
+ and io.createtime >= DATE_SUB(NOW(), INTERVAL 7 DAY)
|
|
|
+ </when>
|
|
|
+
|
|
|
+ <when test="taskStatisticsVo.days =='30'">
|
|
|
+ and io.createtime >= DATE_SUB(NOW(), INTERVAL 30 DAY)
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY io.userid , su.name, sd.id , sd.name
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="costCenter" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
|
+ SELECT
|
|
|
+ iac.company_id,
|
|
|
+ iac.inscompany as “insuranceCompanyName”,
|
|
|
+ COUNT( CASE WHEN ifa.auditstatus = 1 THEN 1 END ) AS "auditstatusOrders",
|
|
|
+ COUNT( CASE WHEN ifa.auditstatus = 0 THEN 1 END ) AS "auditOrder",
|
|
|
+ COUNT( CASE WHEN pa.audit_type = 1 AND ifa.auditstatus = 1 THEN 1 END ) AS "persionAudit",
|
|
|
+ COUNT( CASE WHEN pa.audit_type = 2 AND ifa.auditstatus = 1 THEN 1 END ) AS "automaticAudit"
|
|
|
+ FROM
|
|
|
+ ins_fee_audit ifa
|
|
|
+ LEFT JOIN ins_area_company iac ON iac.id = ifa.ins_order_no
|
|
|
+ LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
|
|
|
+ LEFT JOIN ins_fee_order_new ion ON ion.ins_order_no = iac.id
|
|
|
+ <where>
|
|
|
+ 1=1
|
|
|
+ <if test="taskStatisticsVo.createtimeStart !=null and taskStatisticsVo.createtimeStart != '' and taskStatisticsVo.createtimeEnd !=null and taskStatisticsVo.createtimeEnd != ''">
|
|
|
+ AND DATE_FORMAT( ifa.audittime, '%Y-%m-%d') BETWEEN #{taskStatisticsVo.createtimeStart} AND #{taskStatisticsVo.createtimeEnd}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="taskStatisticsVo.days !=null and taskStatisticsVo.days !='' ">
|
|
|
+ <choose>
|
|
|
+ <when test="taskStatisticsVo.days =='1'">
|
|
|
+ and ifa.audittime >= DATE_SUB(NOW(), INTERVAL 1 DAY)
|
|
|
+ </when>
|
|
|
+
|
|
|
+ <when test="taskStatisticsVo.days =='7'">
|
|
|
+ and ifa.audittime >= DATE_SUB(NOW(), INTERVAL 7 DAY)
|
|
|
+ </when>
|
|
|
+
|
|
|
+ <when test="taskStatisticsVo.days =='30'">
|
|
|
+ and ifa.audittime >= DATE_SUB(NOW(), INTERVAL 30 DAY)
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="taskStatisticsVo.riskCode != null and taskStatisticsVo.riskCode != ''">
|
|
|
+ and iac.product = #{taskStatisticsVo.riskCode}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ iac.company_id,
|
|
|
+ iac.inscompany
|
|
|
+ </select>
|
|
|
</mapper>
|