source: FOIAVistA/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPFLMT1.m@ 905

Last change on this file since 905 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 7.7 KB
Line 
1DGPFLMT1 ;ALB/RBS - PRF TRANSMISSION ERRORS BUILD LIST AREA ; 6/10/05 11:38am
2 ;;5.3;Registration;**650**;Aug 13, 1993;Build 3
3 ;
4 ;no direct entry
5 QUIT
6 ;
7 ;
8EN(DGARY,DGSRTBY,DGCNT) ;Entry point to build list area
9 ;
10 ;The following input variables are 'system wide variables' in the
11 ;DGPF TRANSMISSION ERRORS List Manager screen:
12 ;
13 ; Input:
14 ; DGARY - subscript name for temp global
15 ; DGSRTBY - list sort by criteria
16 ; "N" = Patient Name
17 ; "D" = Date/Time Error Received
18 ; Output:
19 ; DGCNT - number of lines in the list
20 ; DGARY - ^TMP(DGARY,$J) - display list
21 ; - ^TMP("DGPFSORT",$J) - used to create final DGARY list
22 ;
23 ;display wait msg
24 D WAIT^DICD
25 ;
26 ;retrieve and sort
27 D GET(DGSRTBY)
28 ;
29 ;build list
30 D BLD(DGARY,DGSRTBY,.DGCNT)
31 ;
32 ;if no entries in list, display message
33 I 'DGCNT D
34 . D SET(DGARY,1,"",1,,,.DGCNT)
35 . D SET(DGARY,2,"There are no transmission error messages on file.",3,$G(IOINHI),$G(IOINORM),.DGCNT)
36 ;
37 Q
38 ;
39 ;
40GET(DGSRTBY) ;Get "RJ" status entries.
41 ;
42 ; Input:
43 ; DGSRTBY - list sort by value
44 ;
45 ; Output:
46 ; ^TMP("DGPFSORT",$J,0,<assignment ien>,<site ien>,<HL7 log ien>)=""
47 ;
48 ;The 0 node is created to group each patient's PRF Assignment record
49 ;with each Site Transmitted To that is rejecting the update with all
50 ;of the pointed to HL7 transmission log records.
51 ;Only the most recent transmission log entry will be displayed.
52 ;
53 N DGAIEN ;assignment ien
54 N DGDAT ;original transmission date
55 N DGLIEN ;HL7 log record ien
56 N DGPFA ;assignment array
57 N DGPFAH ;assignment history data array
58 N DGPFL ;HL7 transmission log data array
59 N DGPFPAT ;patient data array
60 N DGSITE ;site transmitted to ien
61 N DGSSN ;patient ssn
62 ;
63 ;loop through ASTAT index of transmission date/times
64 S DGDAT=0
65 F S DGDAT=$O(^DGPF(26.17,"ASTAT",DGDAT)) Q:'DGDAT D
66 . Q:'$D(^DGPF(26.17,"ASTAT",DGDAT,"RJ"))
67 . S DGLIEN=0
68 . F S DGLIEN=$O(^DGPF(26.17,"ASTAT",DGDAT,"RJ",DGLIEN)) Q:'DGLIEN D
69 . . K DGPFL,DGPFAH
70 . . ;- retrieve HL7 log data
71 . . Q:'$$GETLOG^DGPFHLL(DGLIEN,.DGPFL)
72 . . Q:'+DGPFL("ASGNHIST")
73 . . S DGSITE=$P($G(DGPFL("SITE")),U,1)
74 . . Q:DGSITE']""
75 . . ;- retrieve assignment history data to get PRF Assignment ien
76 . . Q:'$$GETHIST^DGPFAAH(+DGPFL("ASGNHIST"),.DGPFAH)
77 . . S DGAIEN=$P($G(DGPFAH("ASSIGN")),U,1)
78 . . Q:'DGAIEN
79 . . ;
80 . . ;- create 0 node by patient assignment, site ien and log ien
81 . . S ^TMP("DGPFSORT",$J,0,DGAIEN,DGSITE,DGLIEN)=""
82 ;
83 Q:'$O(^TMP("DGPFSORT",$J,0,"")) ;quit if nothing setup
84 ;
85 ;- now loop the sorted 0 node and only use the most recent HL7 error
86 ; record to create the List Manager display temp file.
87 ;
88 S DGAIEN=0
89 F S DGAIEN=$O(^TMP("DGPFSORT",$J,0,DGAIEN)) Q:DGAIEN="" D
90 . S DGSITE=0
91 . F S DGSITE=$O(^TMP("DGPFSORT",$J,0,DGAIEN,DGSITE)) Q:DGSITE="" D
92 . . K DGPFL,DGPFAH,DGPFA,DGPFPAT
93 . . S DGLIEN=0 ;- get most recent record ien
94 . . S DGLIEN=$O(^TMP("DGPFSORT",$J,0,DGAIEN,DGSITE,""),-1)
95 . . Q:DGLIEN=""
96 . . ;- retrieve HL7 log data
97 . . Q:'$$GETLOG^DGPFHLL(DGLIEN,.DGPFL)
98 . . ;- retrieve assignment file data to get Owner Site
99 . . Q:'$$GETASGN^DGPFAA(DGAIEN,.DGPFA)
100 . . ;- retrive patient data to get ssn
101 . . Q:'$$GETPAT^DGPFUT2(+DGPFA("DFN"),.DGPFPAT)
102 . . S DGSSN=$G(DGPFPAT("SSN")) S:'DGSSN DGSSN="UNKNOWN"
103 . . ;- add ssn to existing array
104 . . S DGPFA("SSN")=DGSSN
105 . . ;- retrieve assignment history data
106 . . Q:'$$GETHIST^DGPFAAH(+DGPFL("ASGNHIST"),.DGPFAH)
107 . . ;
108 . . ;- setup output array
109 . . D SORT(DGLIEN,DGSRTBY,.DGPFA,.DGPFAH,.DGPFL)
110 ;
111 Q
112 ;
113 ;
114SORT(DGLIEN,DGSRTBY,DGPFA,DGPFAH,DGPFL) ;Setup output global
115 ;
116 ; Input:
117 ; DGLIEN - ien of HL7 log record
118 ; DGSRTBY - list sort value
119 ; DGPFA - assignment array
120 ; DGPFAH - assignment history array
121 ; DGPFL - HL7 log array
122 ;
123 ; Output:
124 ; ^TMP("DGPFSORT",$J,1,<>,<>,<>,<>) = data string values
125 ; Subscript's (,<>,) are as follows for each sort by:
126 ;
127 ; - SORT="N" - list by <patient name>:
128 ; ,1,<patient name>,<assignment ien>,<site ien>,<HL7 log ien>)
129 ;
130 ; - SORT="D" - list by <ack received d/t>:
131 ; ,1,<ack received d/t>,<assignment ien>,<site ien>,<HL7 log ien>)
132 ;
133 ; - The 6 data string values are as follows: (^ - up-arrow delimited)
134 ; <patient dfn>^<patient name>^<ssn>^<ack received d/t>^<site transmitted to>^<owner site>
135 ;
136 N DGACKDT ;d/t error msg received
137 N DGAIEN ;assignment ien
138 N DGPNAME ;patient name
139 N DGSITE ;site transmitted to ien
140 N DGSTRING ;detail line
141 N DGSUB ;subscript var
142 ;
143 ;- subscript setup
144 S DGACKDT=$P($G(DGPFL("ACKDT")),U,1)
145 S:DGACKDT="" DGACKDT="UNKNOWN"
146 S DGAIEN=$P($G(DGPFAH("ASSIGN")),U,1)
147 S:DGAIEN="" DGAIEN="UNKNOWN"
148 S DGPNAME=$P($G(DGPFA("DFN")),U,2)
149 S:DGPNAME="" DGPNAME="UNKNOWN"
150 S DGSITE=$P($G(DGPFL("SITE")),U,1)
151 ;
152 ;- data string setup -
153 S DGSTRING=$P($G(DGPFA("DFN")),U,1)_U_DGPNAME_U_$P($G(DGPFA("SSN")),U,1)_U_DGACKDT_U_$P($G(DGPFL("SITE")),U,2)_U_$P($G(DGPFA("OWNER")),U,2)
154 ;
155 ;- patient name sort
156 I DGSRTBY="N" S DGSUB=DGPNAME
157 ;- date/time error received type sort
158 I DGSRTBY="D" S DGSUB=DGACKDT
159 ;
160 S ^TMP("DGPFSORT",$J,1,DGSUB,DGAIEN,DGSITE,DGLIEN)=DGSTRING
161 Q
162 ;
163 ;
164BLD(DGARY,DGSRTBY,DGCNT) ;Build list area
165 ;
166 ; Input:
167 ; DGARY - subscript name for temp global
168 ; DGSRTBY - list sort by value
169 ;
170 ; Output:
171 ; DGCNT - number of lines in the list
172 ; DGARY - display list - ^TMP(DGARY,$J)
173 ;
174 N DGACKDT ;d/t error msg received
175 N DGAIEN ;assignment ien
176 N DGLIEN ;log record ien
177 N DGLINE ;line counter
178 N DGOWNER ;owner of assignment
179 N DGPNAME ;patient name
180 N DGSIEN ;site ien
181 N DGSITE ;site transmitted to name
182 N DGSSN ;patient ssn
183 N DGSTRING ;detail line
184 N DGSUB ;loop var
185 N DGTEMP ;sort array root
186 ;
187 S DGTEMP=$NA(^TMP("DGPFSORT",$J,1))
188 S DGSUB="",DGLINE=0
189 ;
190 F S DGSUB=$O(@DGTEMP@(DGSUB)) Q:DGSUB="" D
191 . S DGAIEN=0
192 . F S DGAIEN=$O(@DGTEMP@(DGSUB,DGAIEN)) Q:'DGAIEN D
193 . . S DGSIEN=0
194 . . F S DGSIEN=$O(@DGTEMP@(DGSUB,DGAIEN,DGSIEN)) Q:'DGSIEN D
195 . . . S DGLIEN=0
196 . . . F S DGLIEN=$O(@DGTEMP@(DGSUB,DGAIEN,DGSIEN,DGLIEN)) Q:'DGLIEN D
197 . . . . ;- get data fields
198 . . . . S DGSTRING=$G(@DGTEMP@(DGSUB,DGAIEN,DGSIEN,DGLIEN))
199 . . . . S DGPNAME=$E($P(DGSTRING,U,2),1,27)
200 . . . . S DGSSN=$E($P(DGSTRING,U,3),6,9)
201 . . . . S DGACKDT=$E($$FDTTM^VALM1($P(DGSTRING,U,4)),1,8)
202 . . . . S DGSITE=$E($P(DGSTRING,U,5),1,14)
203 . . . . S DGOWNER=$E($P(DGSTRING,U,6),1,14)
204 . . . . ;- increment line counter
205 . . . . S DGLINE=DGLINE+1
206 . . . . ;- set line into list area
207 . . . . D SET(DGARY,DGLINE,DGLINE,1,,,.DGCNT)
208 . . . . D SET(DGARY,DGLINE,DGPNAME,6,,,.DGCNT)
209 . . . . D SET(DGARY,DGLINE,DGSSN,35,,,.DGCNT)
210 . . . . D SET(DGARY,DGLINE,DGACKDT,41,,,.DGCNT)
211 . . . . D SET(DGARY,DGLINE,DGSITE,51,,,.DGCNT)
212 . . . . D SET(DGARY,DGLINE,DGOWNER,67,,,.DGCNT)
213 . . . . ;
214 . . . . ;- associate "IDX" list item entry with the pointer's
215 . . . . ; back to ^TMP("DGPFSORT",$J,0,DGAIEN,DGSITE,DGLIEN) global:
216 . . . . ; <asignment ien>^<site ien>^<HL7 log ien>^<patient dfn>^pat name^site name
217 . . . . S ^TMP(DGARY,$J,"IDX",DGLINE,DGLINE)=DGAIEN_U_DGSIEN_U_DGLIEN_U_$P(DGSTRING,U,1)_U_DGPNAME_U_$P(DGSTRING,U,5)
218 ;
219 ;cleanup temp sort global
220 K @DGTEMP
221 Q
222 ;
223 ;
224SET(DGARY,DGLINE,DGTEXT,DGCOL,DGON,DGOFF,DGCNT) ;Setup display detail lines
225 ;
226 ; Input:
227 ; DGARY - subscript name for temp global
228 ; DGLINE - line number
229 ; DGTEXT - text
230 ; DGCOL - starting column
231 ; DGON - highlighting on
232 ; DGOFF - highlighting off
233 ;
234 ; Output:
235 ; DGARY - temp global array of LM detail lines
236 ; DGCNT - number of lines in the list
237 ;
238 N DGX ;string to insert new text into
239 ;
240 S DGX=$S($D(^TMP(DGARY,$J,DGLINE,0)):^(0),1:"")
241 S DGCNT=DGLINE
242 ;
243 S ^TMP(DGARY,$J,DGLINE,0)=$$SETSTR^VALM1(DGTEXT,DGX,DGCOL,$L(DGTEXT))
244 ;
245 D:$G(DGON)]""!($G(DGOFF)]"") CNTRL^VALM10(DGLINE,DGCOL,$L(DGTEXT),$G(DGON),$G(DGOFF))
246 ;
247 Q
Note: See TracBrowser for help on using the repository browser.