病历24小时完成率

select '入院记录' as 单据类型,wcd as 完成数,zj as 单据总数,wcd/zj as 完成率  from(
select count(b.id) wcd from(
select a.id,b.create_time,b.complete_time from BZ_ACT_LOG a,bz_doc_tasks b, bz_doc_log c where a.id = b.actlog_id  and b.real_doc_id =c.id and c.creat_time >sysdate -30 
and c.title like'入院记录' and b.complete_time is not null) b  where  (b.complete_time-b.create_time)*24<24 ) a,(
select count (a.id) zj from 
(select a.id,b.create_time,b.complete_time from BZ_ACT_LOG a,bz_doc_tasks b, bz_doc_log c where a.id = b.actlog_id  and b.real_doc_id =c.id and c.creat_time >sysdate -30 
and c.title like'入院记录') a)
union all
select '手术记录' as 单据类型,wcd as 完成数,zj as 单据总数,wcd/zj as 完成率  from(
select count(b.id) wcd from(
select a.id,b.create_time,b.complete_time from BZ_ACT_LOG a,bz_doc_tasks b, bz_doc_log c where a.id = b.actlog_id  and b.real_doc_id =c.id and c.creat_time >sysdate -30 
and c.title like'手术记录' and b.complete_time is not null) b  where  (b.complete_time-b.create_time)*24<24 ) a,(
select count (a.id) zj from 
(select a.id,b.create_time,b.complete_time from BZ_ACT_LOG a,bz_doc_tasks b, bz_doc_log c where a.id = b.actlog_id  and b.real_doc_id =c.id and c.creat_time >sysdate -30 
and c.title like'手术记录') a)
union all
select '出院记录' as 单据类型,wcd as 完成数,zj as 单据总数,wcd/zj as 完成率  from(
select count(b.id) wcd from(
select a.id,b.create_time,b.complete_time from BZ_ACT_LOG a,bz_doc_tasks b, bz_doc_log c where a.id = b.actlog_id  and b.real_doc_id =c.id and c.creat_time >sysdate -30 
and c.title like'出院记录' and b.complete_time is not null) b  where  (b.complete_time-b.create_time)*24<24 ) a,(
select count (a.id) zj from 
(select a.id,b.create_time,b.complete_time from BZ_ACT_LOG a,bz_doc_tasks b, bz_doc_log c where a.id = b.actlog_id  and b.real_doc_id =c.id and c.creat_time >sysdate -30 
and c.title like'出院记录') a)
union all 
select '抢救记录' as 单据类型,wcd as 完成数,zj as 单据总数,wcd/zj as 完成率  from(
select count(a.id) wcd  from BZ_ACT_LOG a,(select actlog_id,real_doc_id,病历,
       create_time,
       complete_time from (select t.actlog_id,t.real_doc_id,decode(instr(t.contenttext, '抢救记录'),
              0,
              null,
              null,null,
              '抢救记录') as 病历,
       t.create_time,
       t.complete_time
  from bz_doc_tasks t  ) where create_time  >sysdate -30 and 病历 is not null and complete_time is not null) b
  where a.id = b.actlog_id  and  (b.complete_time-b.create_time)*24<6) a,(
  select count(a.id) Zj  from BZ_ACT_LOG a,(select actlog_id,real_doc_id,病历,
       create_time,
       complete_time from (select t.actlog_id,t.real_doc_id,decode(instr(t.contenttext, '抢救记录'),
              0,
              null,
              null,null,
              '抢救记录') as 病历,
       t.create_time,
       t.complete_time
  from bz_doc_tasks t  ) where create_time  >sysdate -30 and 病历 is not null) b
  where a.id = b.actlog_id  )b 
union all
select '病案首页' as 单据类型,wcd as 完成数,zj as 单据总数,wcd/zj as 完成率  from

select count( a.病人id||a.主页id||title||a.create_time||complete_time) wcd from( 
select a.病人id,a.主页id,a.出院日期,a.id,t.complete_time,t.create_time,d.title from bz_doc_tasks t ,bz_doc_log d,
(select b.病人id,b.主页id, b.出院日期, c.id
  from 病人变动记录@zlhisdb a, 病案主页@zlhisdb b, BZ_ACT_LOG c
 where a.病人id = b.病人id
   and a.主页id = b.主页id
   and substr(extend_tag, 4) = a.id ) a
   where   t.actlog_id =a.id
   and t.real_doc_id = d.id
   and t.complete_time is not null
   and a.出院日期 >sysdate-30  and (t.complete_time-t.create_time)*24<24) a)  
   a,(   
select count( a.病人id||a.主页id||title||a.create_time||complete_time) zj from( 
select a.病人id,a.主页id,a.出院日期,a.id,t.complete_time,t.create_time,d.title from bz_doc_tasks t ,bz_doc_log d,(select b.病人id,b.主页id, b.出院日期, c.id
  from 病人变动记录@zlhisdb a, 病案主页@zlhisdb b, BZ_ACT_LOG c
 where a.病人id = b.病人id
   and a.主页id = b.主页id
   and substr(extend_tag, 4) = a.id )a
   where   t.actlog_id =a.id
   and t.real_doc_id = d.id
   and a.出院日期 >sysdate-30 ) a)b


 

  • 8
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值