forked from lewisschmidt/CCL
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Oncology_Oral_agents_Orders
172 lines (154 loc) · 4.61 KB
/
Oncology_Oral_agents_Orders
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
select distinct
CPOE_Order = o.ordered_as_mnemonic
,Power_Order = ocs.mnemonic
,Order_type = uar_get_code_display(ocs.mnemonic_type_cd)
;,o.order_detail_display_line
;, os.order_sentence_display_line
;, route = cv.display
, therapeutic_category = a.long_description
from
orders o
, order_catalog_synonym ocs
;, order_catalog oc
, alt_sel_list ASL
, ALT_SEL_CAT A
;, order_sentence os
;, code_value cv
;, order_sentence_detail osd2
Plan o
where o.orig_order_dt_tm > sysdate - 15 ;integer determines the date back in days (sysdate)
;and o.order_status_cd in (2543.00); cs 6004, Future 2546.00, Ordered 2550.00, Completed 2543.00
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.order_detail_display_line in (
;"*Oral Topical*"
;,"*Buccal*"
;,"*Gastrostomy Tube*"
;,"*Jejunostomy Tube*"
;,"*Nasogastric Tube*"
"*Oral*"
;,"*Chew*"
;,"*Feeding Tube*"
;,"*Swish and Spit*"
;,"*Oral Gastric Tube*"
;,"*Nasojejunum Tube*"
;,"*SubLingual*"
)
Join OCS
where o.catalog_cd = ocs.catalog_cd
and ocs.synonym_id = o.synonym_id
and ocs.catalog_type_cd = 2516.00
and ocs.activity_type_cd = 705.00
and ocs.mnemonic_type_cd in(
;CODE_VALUE DISPLAY
2580 ;Brand Name
,2581 ;Direct Care Provider
,614542 ;C - Dispensable Drug Names
;2582 ;Generic Name
,614548 ;Y - Generic Products
,614544 ;M - Generic Miscellaneous Products
,614543 ;E - IV Fluids and Nicknames
;614546 ;Outreach
;614547 ;PathLink
,2583 ;Primary
;2584 ;Rx Mnemonic
;2585 ;Surgery Med
,614549 ;Z - Trade Products
,614545 ;N - Trade Miscellaneous Products
)
/*
Join OC
where oc.catalog_cd = ocs.catalog_cd
and oc.active_ind = 1
and oc.catalog_type_cd = 705.00
and oc.primary_mnemonic != "zz*"
and oc.primary_mnemonic != "ZZ"
*/
Join ASL
where asl.synonym_id = ocs.synonym_id
Join A
where asl.alt_sel_category_id = a.alt_sel_category_id
and A.AHFS_IND = 1
and A.Long_Description in (
;ORDERCATALOG_THERAPEUTIC_CATEGORY
"5-alpha-reductase inhibitors"
,"alkylating agents"
,"anti-PD-1 monoclonal antibodies"
,"antiandrogens"
,"antigonadotropic agents"
,"antimetabolites"
,"antineoplastic antibiotics"
,"antineoplastic combinations"
,"antineoplastic detoxifying agents"
,"antineoplastic hormones"
,"antineoplastic interferons"
,"antineoplastic interferons"
,"antineoplastic monoclonal antibodies"
,"antineoplastics"
,"antiviral interferons"
,"aromatase inhibitors"
,"BCR-ABL tyrosine kinase inhibitors"
,"bisphosphonates"
,"CD20 monoclonal antibodies"
,"CD30 monoclonal antibodies"
,"CD33 monoclonal antibodies"
,"CD38 monoclonal antibodies"
,"CD52 monoclonal antibodies"
,"CDK 4/6 inhibitors"
,"estrogen receptor antagonists"
,"estrogens"
,"gonadotropin-releasing hormone antagonists"
,"gonadotropin-releasing hormone and analogs"
,"hedgehog pathway inhibitors"
,"HER2 inhibitors"
,"histone deacetylase inhibitors"
,"integrase strand transfer inhibitor"
,"interferons"
,"interleukin inhibitors"
,"interleukins"
,"miscellaneous antineoplastics"
,"mitotic inhibitors"
,"mTOR inhibitors"
,"mTOR kinase inhibitors"
,"multikinase inhibitors"
,"PI3K inhibitors"
,"progesterone receptor modulators"
,"radiopharmaceuticals"
,"selective estrogen receptor modulators"
,"therapeutic radiopharmaceuticals"
,"topical antineoplastics"
,"TNF alpha inhibitors"
,"VEGF/VEGFR inhibitors"
)
/*join OS
where OS.ORDER_SENTENCE_ID = ocs.order_sentence_id
*/
/*Join cv ; code_value
where cv.code_set = 4001
and cv.display != "IntraMuscular"
and cv.display != "IntraVesical"
and cv.display != "IV Piggyback"
and cv.display != "SubCutaneous"
and cv.display != "IV Push"
and cv.display != "IntraPeritoneal"
or cv.display = "Oral Topical"
or cv.display = "Buccal"
or cv.display = "Gastrostomy Tube"
or cv.display = "Jejunostomy Tube"
or cv.display = "Nasogastric Tube"
or cv.display = "Oral"
or cv.display = "Chew"
or cv.display = "Feeding Tube"
or cv.display = "Swish and Spit"
or cv.display = "Oral Gastric Tube"
or cv.display = "Nasojejunum Tube"
or cv.display = "SubLingual"
;or cv.display = "
join osd2; order_sentence_detail
where osd2.order_sentence_id = os.order_sentence_id
and osd2.default_parent_entity_name = "CODE_VALUE"
and osd2.default_parent_entity_id = cv.code_value
*/
;group by o.ordered_as_mnemonic, ocs.mnemonic , ocs.mnemonic_type_cd
with time = 600, format(date, ";;q")