forked from lewisschmidt/CCL
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDRC details
159 lines (125 loc) · 4.06 KB
/
DRC details
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
/****************************************************************************************************
Author: Lewis Schmidt
Date Written: 7/28/2015
Source File Name: <File name in CCLUSERDIR>
Object Name: <Name in CCLQUERY>
Request #: <Optional>
Product: <Product report addresses>
Product Team: Pharmnet/Discern/Medication Process
HNA Version: 500
CCL Version: 2015.x.x.x
Program Purpose: provide details on the alert and trigger
Tables Read: eks_dlg_event, long_text, eks_dlg, eks_alert_esc_hist person, prsnl, orders
Tables Updated: none
Executing From: <Explorer Menu, ad hoc>
Special Notes: <Optional>
****************************************************************************************************
****************************************************************************************************
*********************************** MODIFICATION CONTROL LOG ***********************************
****************************************************************************************************
Mod Date Engineer Comment
----------------------------------------------------------------------------------------------------
000 8/13/2015 lewis schmidt Initial idea is to pull in enough data to measure impact and understand why the rule fired.
****************************************************************************************************/
/*
;for RTF Clean-Up
set BlobOut= fillstring( 32768, ' ' )
set BlobNoRTF = fillstring( 32768, ' ' )
set bsize = 0
SELECT into $outdev
*/
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)
, 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
, 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
, mess_each_txt = lt3.long_text
/*
;buggy
, eaeh.ack_dt_tm
, eaeh.alert_source
, eaeh.recipient_name
, eaeh.msg_long_text_id
, eaeh.parent_entity_name
, eaeh.subject_prefix_text
, eaeh.subject_text
*/
from
eks_dlg_event e
, eks_alert_esc_hist eaeh
, person p
, prsnl u
, orders o
, long_text lt
, long_text lt2
, long_text lt3
, encounter en
, alt_sel_list ASL
, ALT_SEL_CAT A
; , CLINICAL_EVENT C
; , CE_STRING_RESULT CE
; , order_catalog_synonym OCS
; , order_catalog oc
plan e
; where e.DLG_NAME = "PHA_EKM!PHA_DRC_PROD_PC_ALL"
where e.DLG_NAME = "PHA_EKM!PHA_DRC_W_HISTORY"
and E.DLG_DT_TM between cnvtdate(090915) and cnvtdate(091015)
;and e.dlg_dt_tm
; between cnvtdatetime("10-sep-2015 000:000:000")
; and cnvtdatetime(CURDATE, CURTIME3)
join eaeh
where eaeh.encntr_id = e.encntr_id
; and each.person_id = e.person_id
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 lt3
where lt3.long_text_id = eaeh.msg_long_text_id
join en
where en.encntr_id = e.encntr_id
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 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
;Join OCS
; where ocs.
;Join OC
with time = 300
/*
HEAD REPORT
row + 0
DETAIL
stat = uar_rtf(l.long_text ,size(l.long_text ),blobnortf,size(blobnortf),bsize,0)
string = TRIM(blobnortf)
COL 1 string
FOOT REPORT
ROW + 0
*/