diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml
index 24dba3b..aa81cb8 100644
--- a/.idea/sqldialects.xml
+++ b/.idea/sqldialects.xml
@@ -15,6 +15,7 @@
+
@@ -26,6 +27,7 @@
+
\ No newline at end of file
diff --git a/dw/dws/dws_estate_incident_info_m.sql b/dw/dws/dws_estate_incident_info_m.sql
index c9861b1..f46662f 100644
--- a/dw/dws/dws_estate_incident_info_m.sql
+++ b/dw/dws/dws_estate_incident_info_m.sql
@@ -5,7 +5,7 @@ select
, b.comm_name
, date_format(a.IncidentDate,'%Y%m') incident_ym
, 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.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
@@ -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.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 ifnull(MainEndDate,'') = '' and IFNULL(CloseTime,'') = '' AND IsClose = 0 then 1 else 0 end) indeal_incident_num
from dwd_estate_incident_info_d a
inner join (select distinct organ_code, organ_name, comm_id, comm_name from dim_organ_mapping) b
on a.CommID = b.comm_id
diff --git a/finereport/xiazuan/3_property/2_报事情况报表.sql b/finereport/xiazuan/3_property/2_报事情况报表.sql
index e69de29..1d6ee26 100644
--- a/finereport/xiazuan/3_property/2_报事情况报表.sql
+++ b/finereport/xiazuan/3_property/2_报事情况报表.sql
@@ -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
\ No newline at end of file