业务流程待办分析

1、获取明细数据
select tb.user_name as 待办人,tb.dept_name as 待办人当前部门, ta.*
from
(select
tt.bd_title as 文件标题,tt.deptname as 起草部门,tt.pername as 起草人,
to_char(tt.create_date,'yyyy-mm-dd') as 起草时间,
to_char(t.SART_DATETIME,'yyyy-mm-dd') as 待办时间,t.WORKFLOW_NAME,
substr(t.RECEIVER_DN,instr(t.RECEIVER_DN,'=',1,1)+1,instr(t.RECEIVER_DN,',',1,1)-instr(t.RECEIVER_DN,'=',1,1)-1) as userid,
tt.bd_id as 表单ID,
t.workflow_guid,t.workflow_id
from cordys.task_list_wait t,oa_ywlc.biaodan tt ,o_dn t1 
where t.WORKFLOW_MODULE != '公文模块'
and substr(tt.deptdn,1,instr(tt.deptdn,'@',1,1)-1)= t1.o_dn
and tt.bd_id = t.BO_ID
and t.SART_DATETIME <= to_date('20120601','yyyymmdd')

) ta,ldap_exp_rawdata tb
where ta.userid = tb.g_mail(+)
order by ta.userid,ta.起草时间 desc

2、汇总统计
select substr(t.RECEIVER_DN,instr(t.RECEIVER_DN,'=',1,1)+1,instr(t.RECEIVER_DN,',',1,1)-instr(t.RECEIVER_DN,'=',1,1)-1),t1.o_name,count(*) as aa
from cordys.task_list_wait t,oa_ywlc.biaodan tt,o_dn t1
where t.WORKFLOW_MODULE != '公文模块'
and substr(tt.deptdn,1,instr(tt.deptdn,'@',1,1)-1)= t1.o_dn
and tt.bd_id = t.BO_ID
and t.SART_DATETIME <= to_date('20120601','yyyymmdd')
group by substr(t.RECEIVER_DN,instr(t.RECEIVER_DN,'=',1,1)+1,instr(t.RECEIVER_DN,',',1,1)-instr(t.RECEIVER_DN,'=',1,1)-1),t1.o_name
having count(*) > 3
order by t1.o_name,aa desc

3、按人汇总统计
select substr(t.RECEIVER_DN,instr(t.RECEIVER_DN,'=',1,1)+1,instr(t.RECEIVER_DN,',',1,1)-instr(t.RECEIVER_DN,'=',1,1)-1),tb.user_name,t1.o_name,tb.dept_name,count(*) as aa
from cordys.task_list_wait t,oa_ywlc.biaodan tt,o_dn t1,ldap_exp_rawdata tb
where t.WORKFLOW_MODULE != '公文模块'
and substr(tt.deptdn,1,instr(tt.deptdn,'@',1,1)-1)= t1.o_dn
and substr(t.RECEIVER_DN,instr(t.RECEIVER_DN,'=',1,1)+1,instr(t.RECEIVER_DN,',',1,1)-instr(t.RECEIVER_DN,'=',1,1)-1)= tb.g_mail(+)
and tt.bd_id = t.BO_ID
and t.SART_DATETIME <= to_date('20120607','yyyymmdd')
group by substr(t.RECEIVER_DN,instr(t.RECEIVER_DN,'=',1,1)+1,instr(t.RECEIVER_DN,',',1,1)-instr(t.RECEIVER_DN,'=',1,1)-1),
tb.user_name,t1.o_name,tb.dept_name
having count(*) > 3
order by t1.o_name,aa desc
其中,时间可以设置某个时间之前的,having可以去掉,少于3个的待办也可统计到。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

肖永威

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值