下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、报表有点复杂declare begin_ date, end_date datetime begin_date =:begin_date set end_date =:end_date set begin_date=convert(varchar(10),begin_date,120) + 00:00:00 set end_date=convert(varchar(10),end_date,120) + 23:59:59 select visit_dept,convert(varchar(10),visit_date,120) date,name,clinic_type into visit_
2、table from mz_visit_table where date(mi,mz_visit_table.visit_date ,begin_date ) =0 and datiff(mi, mz_visit_table.visit_date , end_date ) =0 group by visit_dept,convert(varchar(10),visit_date,120),name,clinic_type select m(a) a,sum(b) b,sum(c) c,sum(d) d,sum(e) e,sum(f) f,sum(g) g,sum(h) h,sum(i) i,s
3、um(j) j,sum(k) k ,sum(m) m,sum(l) l,sum(n) n ,sum(o) o,sum(p) p ,sum(q) q from(select (select count(*) from visit_table a where a.visit_dept in ( 1010100 , 1010101 , 1010200 , 1010201 , 1010300 , 1010301 , 1010500 , 1010501 , 1010600 , 1010601 , 1010400 , 1010401 , 1010700 , 1010701 ) and isnull(cli
4、nic_type, 01 ) in ( 01 , 05 , 06 , 11 , 14 ) )a , (select count(*) from visit_table a where a.visit_dept in ( 1020100 , 1020101 , 1020300 , 1020301 , 1020500 , 1020501 , 1020400 , 1020401 , 1020600 , 1020601 , 1020700 , 1020701 , 1020800 , 1020801 )and isnull(clinic_type, 01 ) in ( 01 , 05 , 06 , 11
5、 , 14 ) )b, (select count(*) from visit_table a where a.visit_dept in ( 1040000 , 1040001 , 1030000 , 1030001 )and isnull(clinic_type, 01 ) in ( 01 , 05 , 06 , 11 , 14 ) )c, (select count(*) from visit_table a where a.visit_dept in ( 1060300 , 1060301 )and isnull(clinic_type, 01 ) in ( 01 , 05 , 06
6、, 11 , 14 )d, (select count(*) from visit_table a where a.visit_dept in ( 1050000 , 1050001 )and isnull(clinic_type, 01 ) in ( 01 , 05 , 06 , 11 , 14 )e, (select count(*) from visit_table a where a.visit_dept in ( 1010900 , 1010901 )and isnull(clinic_type, 01 ) in ( 01 , 05 , 06 , 11 , 14 )f, (selec
7、t count(*) from visit_table a where a.visit_dept in ( 1070000 , 1070001 )and isnull(clinic_type, 01 ) in ( 01 , 05 , 06 , 11 , 14 )g, (select count(*) from visit_table a where a.visit_dept in ( 1060200 , 1060201 )and isnull(clinic_type, 01 ) in ( 01 , 05 , 06 , 11 , 14 )h, (select count(*) from visi
8、t_table a where a.visit_dept in ( 1080000 , 1080001 , 1010800 , 1010801 )and isnull(clinic_type, 01 ) in ( 01 , 05 , 06 , 11 , 14 )i, (select count(*) from visit_table a where a.visit_dept in ( 1120000 )and isnull(clinic_type, 01 ) in ( 01 , 05 , 06 , 11 , 14 )j, (select count(*) from visit_table a
9、where a.visit_dept in ( 1060100 , 1060101 )and isnull(clinic_type, 01 ) in ( 01 , 05 , 06 , 11 , 14 )o, (select count(*) from visit_table a where a.visit_dept not in ( 1010100 , 1010101 , 1010200 , 1010201 , 1010300 , 1010301 , 1010500 , 1010501 , 1010600 , 1010601 , 1010400 , 1010401 , 1010700 , 10
10、10701 , 1020100 , 1020101 , 1020300 , 1020301 , 1020500 , 1020501 , 1020400 , 1020401 , 1020600 , 1020601 , 1020700 , 1020701 , 1020800 , 1020801 , 1040000 , 1040001 , 1030000 , 1030001 , 1060300 , 1060301 , 1050000 , 1050001 , 1010900 , 1010901 , 1070000 , 1070001 , 1060200 , 1060201 , 1080000 , 10
11、80001 , 1010800 , 1010801 , 1120000 , 1060100 , 1060101 )and isnull(clinic_type, 01 ) in ( 01 , 05 , 06 , 11 , 14 )q, 0 k, 0 m, 0 l, 0 n, 0 p union all select 0,0,0,0,0,0,0,0,0,0,0,0, (select count(*) from visit_table a where isnull(clinic_type, 01 ) in( 03 , 04 , 07 , 08 , 09 , 10 ) k, (select count(*) from visit_table a where isnull(clinic_type, 01 ) in( 12 )m, (select count(*) from visit_table a where isnull(clinic_type
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 支气管肺癌患者的并发症预防与处理
- 改性塑料配制工安全规程知识考核试卷含答案
- 联碱洗盐工变更管理模拟考核试卷含答案
- 伞制作工创新实践强化考核试卷含答案
- 静电成像显影材料载体制造工安全教育强化考核试卷含答案
- 汽车车身涂装修复工安全宣贯强化考核试卷含答案
- 果树栽培工岗前班组评比考核试卷含答案
- 三聚氰胺装置操作工岗前实操掌握考核试卷含答案
- 售票值班员岗前复测考核试卷含答案
- 软体家具制作工岗前规章考核试卷含答案
- 2025年银行考试-中信银行运营管理资质认证考试历年参考题库含答案解析(5套典型考题)
- 林蛙驯养管理办法
- 银行走访管理办法
- 设备巡检标准流程与实施要点
- 2025年北京市高考化学试卷真题(含答案解析)
- 2025年八年级数学下册反比例函数专项训练100题(含答案)
- 数学-第十一章 不等式与不等式组单元测试卷 2024-2025学年人教版数学七年级下册
- 医疗整形美容麻醉安全规范
- 人音版一年级下册《第3课 火车波尔卡》课堂教学设计
- 高三学生人生规划
- 2024-2025学年高中化学第三章有机化合物1.2烷烃练习含解析新人教版必修2
评论
0/150
提交评论