报事关闭率逻辑优化
This commit is contained in:
parent
dd57251f66
commit
1e62c20766
@ -15,6 +15,7 @@
|
|||||||
<file url="file://$PROJECT_DIR$/dw/dws/dws_business_rent_rate_d.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/dw/dws/dws_business_rent_rate_d.sql" dialect="MySQL" />
|
||||||
<file url="file://$PROJECT_DIR$/dw/dws/dws_engine_equipment_in_good_d.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/dw/dws/dws_engine_equipment_in_good_d.sql" dialect="MySQL" />
|
||||||
<file url="file://$PROJECT_DIR$/dw/dws/dws_engine_equipment_inspect_task_m.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/dw/dws/dws_engine_equipment_inspect_task_m.sql" dialect="MySQL" />
|
||||||
|
<file url="file://$PROJECT_DIR$/dw/dws/dws_estate_incident_info_m.sql" dialect="MySQL" />
|
||||||
<file url="file://$PROJECT_DIR$/dw/dws/dws_finance_fees_serial_m.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/dw/dws/dws_finance_fees_serial_m.sql" dialect="MySQL" />
|
||||||
<file url="file://$PROJECT_DIR$/dw/ods/ods_cost_budget_data_d.sql" dialect="Oracle" />
|
<file url="file://$PROJECT_DIR$/dw/ods/ods_cost_budget_data_d.sql" dialect="Oracle" />
|
||||||
<file url="file://$PROJECT_DIR$/finereport/kanban/mobile/创新生态_mobile.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/finereport/kanban/mobile/创新生态_mobile.sql" dialect="MySQL" />
|
||||||
@ -26,6 +27,7 @@
|
|||||||
<file url="file://$PROJECT_DIR$/finereport/xiazuan/2_operation/住服比异常项目.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/finereport/xiazuan/2_operation/住服比异常项目.sql" dialect="MySQL" />
|
||||||
<file url="file://$PROJECT_DIR$/finereport/xiazuan/2_operation/计划到期明细.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/finereport/xiazuan/2_operation/计划到期明细.sql" dialect="MySQL" />
|
||||||
<file url="file://$PROJECT_DIR$/finereport/xiazuan/2_operation/项目明细弹窗.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/finereport/xiazuan/2_operation/项目明细弹窗.sql" dialect="MySQL" />
|
||||||
|
<file url="file://$PROJECT_DIR$/finereport/xiazuan/3_property/2_报事情况报表.sql" dialect="MySQL" />
|
||||||
<file url="PROJECT" dialect="MySQL" />
|
<file url="PROJECT" dialect="MySQL" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -5,7 +5,7 @@ select
|
|||||||
, b.comm_name
|
, b.comm_name
|
||||||
, date_format(a.IncidentDate,'%Y%m') incident_ym
|
, date_format(a.IncidentDate,'%Y%m') incident_ym
|
||||||
, count(*) incident_num
|
, count(*) incident_num
|
||||||
, sum(case when ifnull(a.CloseTime,0)=0 then 1 else 0 end) incident_close_num
|
, sum(case when ifnull(a.CloseTime,0)=0 then 0 else 1 end) incident_close_num
|
||||||
, sum(case when a.IsClose=0 and CloseTime is null and a.MainEndDate is null then 1 else 0 end) processing_incident_num
|
, sum(case when a.IsClose=0 and CloseTime is null and a.MainEndDate is null then 1 else 0 end) processing_incident_num
|
||||||
, sum(case when a.CloseTime is null and MainEndDate is not null then 1 else 0 end) completed_not_close_incident_num
|
, sum(case when a.CloseTime is null and MainEndDate is not null then 1 else 0 end) completed_not_close_incident_num
|
||||||
, sum(case when timestampdiff(hour,a.ForwardDateTime, a.IncidentDate)>2 then 1 else 0 end) response_timeout_incident_num
|
, sum(case when timestampdiff(hour,a.ForwardDateTime, a.IncidentDate)>2 then 1 else 0 end) response_timeout_incident_num
|
||||||
@ -17,6 +17,7 @@ select
|
|||||||
, sum(case when a.DelayHours is not null then 1 else 0 end) delay_incident_num
|
, sum(case when a.DelayHours is not null then 1 else 0 end) delay_incident_num
|
||||||
, sum(case when a.IsTouSu = 1 then 1 else 0 end) tousu_incident_num
|
, sum(case when a.IsTouSu = 1 then 1 else 0 end) tousu_incident_num
|
||||||
, sum(case when a.IsClose=1 and a.IsTouSu = 1 then 1 else 0 end) tousu_close_incident_num
|
, sum(case when a.IsClose=1 and a.IsTouSu = 1 then 1 else 0 end) tousu_close_incident_num
|
||||||
|
, sum(case when ifnull(MainEndDate,'') = '' and IFNULL(CloseTime,'') = '' AND IsClose = 0 then 1 else 0 end) indeal_incident_num
|
||||||
from dwd_estate_incident_info_d a
|
from dwd_estate_incident_info_d a
|
||||||
inner join (select distinct organ_code, organ_name, comm_id, comm_name from dim_organ_mapping) b
|
inner join (select distinct organ_code, organ_name, comm_id, comm_name from dim_organ_mapping) b
|
||||||
on a.CommID = b.comm_id
|
on a.CommID = b.comm_id
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
-- ======================================
|
||||||
|
-- report_5_完成率
|
||||||
|
-- ======================================
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
organ_code AS 片区id,
|
||||||
|
organ_name AS 片区名称,
|
||||||
|
SUM(IFNULL(incident_num,0)) AS 报事总数,
|
||||||
|
IFNULL((SUM(IFNULL(response_timely_incident_num,0)) / SUM(IFNULL(incident_num,0))),0) AS 及时响应率,
|
||||||
|
IFNULL((SUM(IFNULL(completed_incident_num,0)) / SUM(IFNULL(incident_num,0))),0) AS 完成率,
|
||||||
|
IFNULL((SUM(IFNULL(follow_up_incident_num,0)) / SUM(IFNULL(incident_num,0))),0) AS 回访率,
|
||||||
|
IFNULL((SUM(IFNULL(incident_close_num,0)) / SUM(IFNULL(incident_num,0))),0) AS 闭单率,
|
||||||
|
case when (sum(incident_num) - sum(indeal_incident_num)) = 0 THEN 0
|
||||||
|
else sum(incident_close_num) / (sum(incident_num) - sum(indeal_incident_num))
|
||||||
|
end AS 有效闭单率
|
||||||
|
FROM dw.dws_estate_incident_info_m T1
|
||||||
|
WHERE 1=1
|
||||||
|
${IF(LEN(p_startdate)>0,"AND T1.incident_ym = '"+FORMAT(CONCATENATE(p_startdate,"-01"),"yyyyMM")+"'","")}
|
||||||
|
${IF(LEN(p_area)>0," AND T1.organ_code IN ('"+p_area+"')", "")}
|
||||||
|
GROUP BY organ_code,organ_name
|
Loading…
Reference in New Issue
Block a user