-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathEKS_DLG_alert_Facility_Patient_Specific
84 lines (67 loc) · 2.7 KB
/
EKS_DLG_alert_Facility_Patient_Specific
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
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
;, admit_reason = uar_get_code_display(en.admit_type_cd)
, ea.alias
, birth_date1 = p.birth_dt_tm
, override_reason = uar_get_code_display(e.override_reason_cd)
, o.hna_order_mnemonic
, o.order_mnemonic
, o.clinical_display_line
, 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
, person p
, prsnl u
, orders o
, long_text lt
, long_text lt2
, encounter en
, encntr_alias ea
plan e
Where E.DLG_DT_TM between cnvtdate(022018) and cnvtdate(022218)
join p
where p.person_id = e.person_id
; and p.name_first = "" ; < -- patient first name, to be used
; and p.name_last = "" ; < -- patient last name, to be used
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 ea
where o.encntr_id =ea.encntr_id
and EA.ENCNTR_ALIAS_TYPE_CD =1077
and ea.alias = "###FIN#####" ; <--fin number
with time = 600
/*******END QUERY *********/