Эх сурвалжийг харах

Merge branch 'dev' of http://110.188.24.182:10023/Fengwo/hotline into dev

tangjiang 9 сар өмнө
parent
commit
b3c4f67006
1 өөрчлөгдсөн 53 нэмэгдсэн , 1 устгасан
  1. 53 1
      src/Hotline/dataview.md

+ 53 - 1
src/Hotline/dataview.md

@@ -186,4 +186,56 @@ CASE "DelayState"
 END AS DelayState 
  from order_delay delaytemp
 left join "order" ordertemp on delaytemp."OrderId"= ordertemp."Id"
-where ordertemp."CreationTime">='2024-06-01' and ordertemp."CreationTime"<'2024-07-01' and delaytemp."DelayState"<>3
+where ordertemp."CreationTime">='2024-06-01' and ordertemp."CreationTime"<'2024-07-01' and delaytemp."DelayState"<>3
+
+
+### 智能回访任务统计
+select 
+cc."No" as "No",
+cc."Title" as "Title",
+CASE aa."AiOrderVisitState"
+	WHEN 1 THEN '待执行'
+	WHEN 2 THEN '暂停中'
+	WHEN 3 THEN '执行中'
+	WHEN 4 THEN '失效'
+	WHEN 5 THEN '呼叫失败'
+	WHEN 6 THEN '已结束'
+	ELSE
+		'未知'
+END AS "AiOrderVisitState",
+CASE aa."IsSuccess"
+	WHEN true THEN
+		'成功'
+	ELSE
+		'失败'
+END AS "IsSuccess",
+aa."OuterNo" as "OuterNo",
+cc."FromName" as "FromName",
+CASE cc."FromGender"
+		WHEN 0 THEN '女士'
+	WHEN 1 THEN '先生'
+	ELSE '未知'
+END AS "FromGender",
+cc."StartTime" as "StartTime",
+cc."FiledTime" as "FiledTime",
+(select 
+CASE qq."SeatEvaluate"
+	WHEN 0 THEN	'默认满意'
+	WHEN 2 THEN '不满意'
+	WHEN 4 THEN '满意'
+	WHEN 5 THEN '非常满意'
+	WHEN 6 THEN '未接通'
+	WHEN 7 THEN '未做评价'
+	ELSE
+		'未知'
+END AS SeatEvaluate
+ from order_visit_detail qq where qq."VisitId"= aa."OrderVisitId" and qq."VisitTarget"=10 and qq."CreationTime">'2024-06-01' and qq."CreationTime"<'2024-07-24' LIMIT 1)  AS SeatEvaluate,
+(
+select ww."OrgProcessingResults"::JSON->>'Value'  from order_visit_detail ww  WHERE ww."VisitId" = aa."OrderVisitId" AND ww."VisitTarget"=20 and ww."CreationTime">'2024-06-01' and ww."CreationTime"<'2024-07-24' LIMIT 1) AS OrgProcessingResults,
+(select ee."IsContact"  from order_visit_detail ee  WHERE ee."VisitId" = aa."OrderVisitId" AND ee."VisitTarget"=20 and ee."CreationTime">'2024-06-01' and ee."CreationTime"<'2024-07-24' LIMIT 1) as "IsContact",
+(select rr."Volved"  from order_visit_detail rr  WHERE rr."VisitId" = aa."OrderVisitId" AND rr."VisitTarget"=20 and rr."CreationTime">'2024-06-01' and rr."CreationTime"<'2024-07-24' LIMIT 1) as "IsContact"
+ from ai_order_visit_detail aa
+left join order_visit bb on aa."OrderVisitId"=bb."Id"
+left join "order" cc on bb."OrderId"=cc."Id"
+--left join order_visit_detail dd on bb."Id"=dd."VisitId"
+where aa."CreationTime" >'2024-07-01' --and dd."VisitTarget"=20