forked from lewisschmidt/CCL
-
Notifications
You must be signed in to change notification settings - Fork 1
/
OrdersCount_per_drugcategory
131 lines (102 loc) · 2.95 KB
/
OrdersCount_per_drugcategory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
SELECT
orders_count = count(*)
, pharmacy_order = o.hna_order_mnemonic
FROM
ORDERS O
,order_catalog_synonym ocs
,ALT_SEL_LIST ASE
,ALT_SEL_CAT A
Plan O
WHERE o.order_status_cd = 2550.00; cs 6004, Ordered
and o.catalog_type_cd = 2516.00; cs 6000, pharmacy
and o.activity_type_cd = 705.00; cs 106, pharmacy = 705.00
and o.template_order_id = 0; child orders are > 0
and o.orig_order_dt_tm between cnvtdatetime( "1-Jan-2018, 0")
and cnvtdatetime( "31-Jan-2018, 120059" )
join ocs
where ocs.catalog_cd = o.catalog_cd
join ASE
where ase.alt_sel_category_id = ocs.synonym_id
join asl
where asl.alt_sel_category_id = ase.alt_sel_category_id
and a.short_description in( x, x, x, )
group by o.hna_order_mnemonic
WITH time = 120
275964153.00 facility
/*
24 antineoplastic hormones
25 miscellaneous antineoplastics
26 mitotic inhibitors
27 radiopharmaceuticals
254 immunologic agents
256 interferons
257 immunosuppressive monoclonal antibodies
431 anti-CTLA-4 monoclonal antibodies
444 selective immunosuppressants
442 TNF alpha inhibitors
443 interleukin inhibitors
438 interleukins
447 CD30 monoclonal antibodies
323 antineoplastic monoclonal antibodies
324 antineoplastic interferons
383 antineoplastic detoxifying agents
399 CD52 monoclonal antibodies
400 CD33 monoclonal antibodies
401 CD20 monoclonal antibodies
423 aromatase inhibitors
420 antiandrogens
455 guanylate cyclase-C agonists
456 AMPA receptor antagonists
458 SGLT-2 inhibitors
401 CD20 monoclonal antibodies
447 CD30 monoclonal antibodies
400 CD33 monoclonal antibodies
489 CD38 monoclonal antibodies
399 CD52 monoclonal antibodies
501 CDK 4/6 inhibitors
431 anti-CTLA-4 monoclonal antibodies
493 anti-PD-1 monoclonal antibodies
23 antimetabolites
22 antineoplastic antibiotics
498 antineoplastic combinations
383 antineoplastic detoxifying agents
24 antineoplastic hormones
324 antineoplastic interferons
323 antineoplastic monoclonal antibodies
20 antineoplastics
104 immunosuppressive agents
257 immunosuppressive monoclonal antibodies
25 miscellaneous antineoplastics
26 mitotic inhibitors
439 other immunostimulants
445 other immunosuppressants
444 selective immunosuppressants
343 tyrosine kinase inhibitors
*/
Fail state,
SELECT
orders_count = count(*)
, pharmacy_order = o.hna_order_mnemonic
;, a.long_description
FROM
ORDERS O
,order_catalog_synonym ocs
,ALT_SEL_LIST ASE
,ALT_SEL_CAT A
Plan O
WHERE o.order_status_cd = 2550.00; cs 6004, Ordered
and o.catalog_type_cd = 2516.00; cs 6000, pharmacy
and o.activity_type_cd = 705.00; cs 106, pharmacy = 705.00
and o.template_order_id = 0; child orders are > 0
and o.orig_order_dt_tm between cnvtdatetime( "1-Jan-2018, 0")
and cnvtdatetime( "31-Jan-2018, 120059" )
join ocs
where ocs.catalog_cd = o.catalog_cd
and OCS.active_ind = 1
join ASE
where ase.alt_sel_category_id = ocs.synonym_id
join A
where a.alt_sel_category_id = ase.alt_sel_category_id
and a.short_description in( 25, 26, 27 )
;group by o.hna_order_mnemonic, a.long_description
WITH time = 120