forked from troyshelton/CCL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOncology_Oral_agents_PWP
91 lines (78 loc) · 2.79 KB
/
Oncology_Oral_agents_PWP
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
SELECT distinct
Power_Plan = p.description
, Subphase = pca.description
, PowerOrder = O.MNEMONIC
, PowerOrder_type = uar_get_code_display(o.mnemonic_type_cd)
; , IVSet = IF(PCO.IV_COMP_SYN_ID = 0)"No"
; ELSE "Yes"
; ENDIF
, OrderSentence = OS.ORDER_SENTENCE_DISPLAY_LINE
; , Route = cv.display
; , Orders_View = if(ocsfr.facility_cd = 0) "ALL"
; else uar_get_code_display(ocsfr.facility_cd)
; endif
FROM
PATHWAY_CATALOG P
, PW_CAT_RELTN PC
, PATHWAY_CATALOG PCA
, PATHWAY_COMP PCAT
, ORDER_CATALOG_SYNONYM O
, order_catalog oc
, PW_COMP_OS_RELTN PCO
, ORDER_SENTENCE OS
; , code_value cv
; , order_sentence_detail osd2
PLAN P
WHERE P.TYPE_MEAN = "PATHWAY"
and p.description = "Breast-P-Lapatinib + Trastuzumab"
and P.ACTIVE_IND = 1
and P.END_EFFECTIVE_DT_TM > CNVTDATETIME(CURDATE, curtime3)
and p.pathway_type_cd = 20584402.00/* plan type = oncology*/
; and p.description != "zz*"
; and p.description != "ZZ*"
; and p.description != "test*"
JOIN PC
where PC.PW_CAT_S_ID = outerjoin(P.PATHWAY_CATALOG_ID)
; and PC.TYPE_MEAN = "GROUP"
Join PCA
where PCA.PATHWAY_CATALOG_ID = PC.PW_CAT_T_ID
; and pca.active_ind =1
Join PCAT
where PCAT.PATHWAY_CATALOG_ID = PCA.PATHWAY_CATALOG_ID
; and PCAT.ACTIVE_IND = 1
Join O
where O.SYNONYM_ID = PCAT.PARENT_ENTITY_ID
Join OC
where oc.catalog_cd = o.catalog_cd
and oc.active_ind = 1
and oc.primary_mnemonic != "zz*"
and oc.primary_mnemonic != "ZZ"
; and oc.primary_mnemonic = "*rastuzu*"
and oc.activity_type_cd = 705.00
join PCO
where PCO.PATHWAY_COMP_ID = PCAT.PATHWAY_COMP_ID
join OS
where OS.ORDER_SENTENCE_ID = PCO.ORDER_SENTENCE_ID
;WHERE os.order_sentence_id = outerjoin(pco.order_sentence_id)
;Join cv ; code_value
; where cv.code_set = 4001
/* and 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
;order by p.description, pca.description, o.mnemonic, pco.order_sentence_seq
with time = 60