forked from lewisschmidt/CCL
-
Notifications
You must be signed in to change notification settings - Fork 1
/
DiscernAlert_burden
108 lines (87 loc) · 3.12 KB
/
DiscernAlert_burden
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
SELECT
rule = e.dlg_name
, Alert_Dt_Tm = e.dlg_dt_tm
, userloggedin_name = u.NAME_FULL_FORMATTED
, userloggedin = u.username
, userrole = uar_get_code_display(u.position_cd)
, patient = p.name_full_formatted
, FIN = ea.alias
, admit_reason = uar_get_code_display(en.admit_type_cd)
, en.reason_for_visit
;, birth_date1 = p.birth_dt_tm
, age = cnvtage(p.birth_dt_tm,o.orig_order_dt_tm,0)
, override_reason = uar_get_code_display(e.override_reason_cd)
, o.hna_order_mnemonic
, o.order_mnemonic
, o.clinical_display_line
, therapeutic_category = A.LONG_DESCRIPTION
, location = uar_get_code_display(en.loc_facility_cd)
/* long_text lt */
, Free_Text_Override = lt.long_text
, Discern_Alert = lt2.long_text
FROM
eks_dlg_event e
,eks_dlg edlg
, person p
, prsnl u
, orders o
, long_text lt
, long_text lt2
, encounter en
, encntr_alias ea
, alt_sel_list ASL
, ALT_SEL_CAT A
; , CLINICAL_EVENT C
; , CE_STRING_RESULT CE
plan e
;Where e.dlg_name = "PHA_EKM!PHA_STP_DRC_W_HISTORY_EX"
where E.DLG_DT_TM between cnvtdate(06022018) and cnvtdate(06202018)
Join edlg
where edlg.dlg_name = e.dlg_name
;and e.dlg_dt_tm between cnvtdate(6022018) and cnvtdate(6072018)
join p
where p.person_id = e.person_id
join u
where u.person_id = e.DLG_PRSNL_ID
join o
where o.order_id = e.trigger_order_id
Join lt
where lt.long_text_id = e.long_text_id
; and lt.active_ind = 1
Join lt2
where lt2.long_text_id = e.alert_long_text_id
join en
where en.encntr_id = e.encntr_id
and en.loc_facility_cd in(
;CODE_VALUE DISPLAY
21198290 ;Location
,271998575 ;location
,271998583 ;location
,271998479 ;location
,276041517 ;location
,276497813 ;location
,344062579 ;location
,349503863 ;location
,499091795 ;location
,516280427 ;location
,416024841 ;location
,428514323 ;location
,275964153 ;location
,275964173 ;location
)
Join ASL
where asl.synonym_id = o.synonym_id
Join A
where a.alt_sel_category_id = asl.alt_sel_category_id
and A.AHFS_IND = 1
join ea
where o.encntr_id =ea.encntr_id
and EA.ENCNTR_ALIAS_TYPE_CD =1077
; and ea.alias = "###FIN#####" ; <--fin number
;Join C
; where c.encntr_id = e.encntr_id
; and c.order_id = e.trigger_entity_id
; and c.catalog_cd = "xxxxx.00"
;Join CE
; where ce.event_id = c.event_id
with time = 120, maxrec =10