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

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

initial load of WorldVistAEHR

File size: 9.1 KB
Line 
1VAFCDD01 ;ALB/JRP,LTL-DATA DICTIONARY UTILITIES ;05-SEP-1996
2 ;;5.3;Registration;**91,149**;Jun 06, 1996
3AVAFC(DFN) ;AVAFC* cross reference for PATIENT file (#2)
4 ;
5 ;Input : IFN - Pointer to entry in PATIENT file (#2)
6 ;Output : None
7 ; VAFCFLG will be set to 1 if the cross reference is
8 ; not executed because the change is being made from
9 ; within the Registration process. This notifies
10 ; Registration that a change was made and that this
11 ; cross reference should be executed if the Registration
12 ; process is aborted.
13 ;
14 ;Notes : The AVAFC* cross references are used to remember that
15 ; changes were made to the PATIENT file (#2) outside of
16 ; the Registration process. Execution of this cross
17 ; reference will create an entry in the ADT/HL7 PIVOT
18 ; file (#391.71) and mark it as requiring transmission
19 ; of an HL7 ADT-A08 message.
20 ;
21 ; : Execution of this cross reference can be prevented by
22 ; setting the local variables: VAFCA08 equal to 1
23 ; VAFHCA08 equal to 1
24 ;
25 ; : If only one of the CA08 variables is set to 1 an entry
26 ; will be made in the pivot file (#391.71) but the
27 ; corresponding transmission flag will not be set. In this
28 ; case setting VAFCA08=1 will prevent the REQUIRES TRANSMISSION
29 ; flag from being set and setting VAFHCA08=1 will prevent the
30 ; TRANSMITTED-REQUIRES TRANSMISSION flag from being set.
31 ; This allows control for sending HL7 and/or HL7v2.3
32 ;
33 ;Check input
34 I +$G(DFN),$D(^DPT(DFN,0))
35 E Q
36 ;quit if re-indexing
37 Q:$D(DIU(0))
38 ;
39 N VARPTR,PIVOTNUM ;Declare variables
40 ;
41 DO K VAFCF ; do HL7 V2.3 MESSAGING
42 .;CHECK TURNOFF FLAG
43 .Q:$D(VAFCA08)
44 .;IF SEND HL7 V2.3 MESSAGES IN MAS PARAMETER FILE IS SET
45 .;TO SEND/SUSPEND THEN DO IT, ELSE QUIT
46 .I '$P($$SEND^VAFHUTL(),"^",2) Q
47 .;IF in Registration option, save fields edited
48 .I $$REG() D Q
49 . . Q:$G(VAFCF)=""
50 . . S VAFCFLDS(VAFCF)=""
51 .;IF NOT IN REGISTRATION DO THIS
52 .D PVT4A08(DFN)
53 .I PIVOTNUM<0 Q
54 .; set need to transmit flag
55 .D XMITFLAG(0,PIVOTNUM)
56 ;
57 DO ; do HL7 V2.2 MESSAGING
58 .Q:$G(VAFHCA08)
59 .Q:$G(VAFCFLG)
60 .I $$EN^VAFHREG() S VAFCFLG=1 Q
61 .I '$$SEND^VAFHUTL() Q
62 .I +$G(PIVOTNUM)<0 Q ; its already been called and failed quit
63 .I '$G(PIVOTNUM) D PVT4A08(DFN) ; set ac xref and pivot
64 .I PIVOTNUM<0 Q
65 .; set requires transmission-Yes flag
66 .D SETTFLAG(0,PIVOTNUM)
67 .;done
68 QUIT
69 ;
70PVT4A08(DFN) ;Create entry in ADT/HL7 PIVOT file for an ADT-A08 event
71 ; and mark it for transmission
72 ;
73 ;Input : IFN - Pointer to entry in PATIENT file (#2)
74 ;Output : None
75 ;Notes : There are no checks to determine if the entry should be
76 ; created (other than input of a valid DFN)
77 ;
78 ;Check input
79 I +$G(DFN),$D(^DPT(DFN,0))
80 E QUIT
81 ;Declare variables don't new for call from top
82 ;N VARPTR,PIVOTNUM
83 ;Set variable pointer used by ADT/HL7 PIVOT file
84 S VARPTR=DFN_";DPT("
85 ;Create entry
86 S PIVOTNUM=+$$PIVNW^VAFHPIVT(DFN,$P(DT,"."),4,VARPTR)
87 Q:(PIVOTNUM<0)
88 ;Mark entry as requires transmission
89 I $P($$SEND^VAFHUTL(),"^",2) D XMITFLAG(0,PIVOTNUM)
90 ;Mark entry as transmitted field YES
91 I $G(VAFCFLG),$$SEND^VAFHUTL() D SETTFLAG(0,PIVOTNUM)
92 ;Done
93 Q
94 ;
95PROCESS() ;
96 ;This call simply processes the array elements in the VAFCFLDS
97 ;variable into a string
98 Q:'$D(VAFCFLDS) -1
99 N INDEX,RETURN S INDEX="",RETURN=""
100 F S INDEX=$O(VAFCFLDS(INDEX)) Q:INDEX="" D
101 . S RETURN=RETURN_INDEX
102 Q:$G(RETURN)="" -1
103 Q RETURN
104 ;
105REGEDIT(PIVOTNUM,FIELDS) ;
106 ;This call is used to generate an HL7 VERSION 2.3 A04 or A08 message
107 ;from the pivot file the A04 is generated from DGREG00 when a
108 ;Registration is known to have been completed. The A08 message
109 ;is generated from DGREG0 when the Registration option was used
110 ;to edit some fields, but the Registration was never completed.
111 ;FIELDS variable contains the fields edited during the session.
112 S DIE="391.71",DA=PIVOTNUM
113 S DR="2.1///^S X=FIELDS"
114 D ^DIE
115 K DIE,DA,DR
116 Q
117TRANSMIT(PIVOTNUM) ;
118 ;This call is used to simply set the 'Requires Transmission'
119 ;flag in the pivot file
120 S DIE="391.71",DA=PIVOTNUM
121 S DR=".08///^S X=1"
122 D ^DIE
123 K DIE,DA,DR
124 Q
125 ;
126MESSAGE(PIVOTPTR,NUMBER) ;
127 ;This tag stuffs the message id from hl7 into pivot file
128 S DIE="391.71",DA=PIVOTPTR
129 S DR="1.1///^S X=NUMBER"
130 D ^DIE
131 K DIE,DA,DR
132 Q
133 ;
134REG() ;
135 ;this tag looks at what option the user is in at the time
136 ;
137 I $P($G(XQY0),"^")="DG REGISTER PATIENT" Q 1
138 I $P($G(XQY0),"^")="DGRPT 10-10T REGISTRATION" Q 1
139 Q 0
140 ;
141HL7A08 ;
142 I $D(VAFHMRG) D KILL^VAFHUTL2(DFN,VAFHBEF)
143 ;Registration process was aborted and changes were made
144 ;to key demographic data. Create an HL7 V2.3 entry in
145 ;the ADT/HL PIVOT file so that demographic changes will be
146 ;broadcast. VAFCFLDS is set in routine VAFCDD01. It contains the
147 ;fields that were edited.
148 I $D(VAFCFLDS) D
149 . N PIVOTNUM,IEN,PTR
150 . S PTR=DFN_";DPT("
151 . S PIVOTNUM=+$$PIVNW^VAFHPIVT(DFN,DT,4,PTR)
152 . Q:PIVOTNUM'>0
153 . S IEN=$O(^VAT(391.71,"D",PIVOTNUM,""))
154 . Q:IEN'>0
155 . S VAFCFLDS=$$PROCESS^VAFCDD01()
156 . I VAFCFLDS'=-1 D
157 . . D REGEDIT^VAFCDD01(IEN,VAFCFLDS)
158 . . D TRANSMIT^VAFCDD01(IEN)
159 K VAFCFLDS
160 Q
161 ;
162SECA08(DFN) ;PUT ENTRY IN PIVOT FILE WHEN USER FLAGS A PT AS SENSITIVE IN
163 ;FILE 38.1 THIS IS TRIGGERED OUT OF ROUTINE DGSEC1
164 N PIVOTNUM,IEN,PTR
165 S PTR=DFN_";DPT("
166 S PIVOTNUM=+$$PIVNW^VAFHPIVT(DFN,DT,4,PTR)
167 Q:PIVOTNUM'>0
168 S IEN=$O(^VAT(391.71,"D",PIVOTNUM,""))
169 Q:IEN'>0
170 ;SET EVENT CODE FIELD TO 97 INDICATING A SENSITIVITY UPDATE
171 S DIE="391.71",DA=IEN
172 S DR=".1///^S X=97"
173 D ^DIE
174 K DIE,DA,DR
175 D TRANSMIT^VAFCDD01(IEN)
176 Q
177 ;
178XMITFLAG(PIVOTPTR,PIVOTNUM,TURNOFF) ;Turn transmission flag for entry
179 ; in ADT/HL7 PIVOT file on/off
180 ;
181 ;Input : PIVOTPTR - Pointer to entry in ADT/HL7 PIVOT file (#391.71)
182 ; - Use this parameter if the entry number is known
183 ; - Not required if using PIVOTNUM parameter
184 ; - Use of this parameter takes precedence over use
185 ; the PIVOTNUM parameter
186 ; PIVOTNUM - PIVOT NUMBER value (field #.02) for entry
187 ; in ADT/HL7 PIVOT file (#391.71)
188 ; - Use this parameter if the pivot number is known
189 ; - Not required if using PIVOTPTR parameter
190 ; TURNOFF - Denotes if REQUIRES TRANSMISSION field (#.08) should
191 ; be turned on (set to 'YES') or off (set to 'NO')
192 ; 1 = Turns transmission off
193 ; 0 = Turns transmission on (default)
194 ;Output : None
195 ;
196 ;Check input
197 S PIVOTPTR=+$G(PIVOTPTR)
198 S PIVOTNUM=+$G(PIVOTNUM)
199 Q:(('PIVOTPTR)&('PIVOTNUM))
200 S TURNOFF=+$G(TURNOFF)
201 ;Declare variables
202 N VALUE,NODE,XREFNUM,DA,X
203 ;Passed pointer - validate
204 I (PIVOTPTR) Q:('$D(^VAT(391.71,PIVOTPTR,0)))
205 ;Passed pivot number - convert to pointer
206 I ('PIVOTPTR) S PIVOTPTR=+$O(^VAT(391.71,"D",PIVOTNUM,0)) Q:('PIVOTPTR)
207 ;Set FileMan variables
208 S DA=PIVOTPTR
209 S X='TURNOFF
210 ;If already transmitted, empty field(s) edited, can't do 8th piece ""
211 ;I $G(VAFCF),'$P($G(^VAT(391.71,DA,0)),U,8),$G(^VAT(391.71,DA,2)) S $P(^VAT(391.71,DA,2),U)=""
212 ;Hard set field
213 S $P(^VAT(391.71,DA,0),"^",8)=X
214 ;Hard set fields edited
215 S:$G(VAFCF)&($P($G(^VAT(391.71,DA,2)),U)'[$G(VAFCF)) $P(^VAT(391.71,DA,2),U)=$P($G(^VAT(391.71,DA,2)),U)_$G(VAFCF)
216 ;Execute cross references
217 S XREFNUM=0
218 F S XREFNUM=+$O(^DD(391.71,.08,1,XREFNUM)) Q:('XREFNUM) D
219 .;Execute kill logic
220 .S NODE=$G(^DD(391.71,.08,1,XREFNUM,2))
221 .I (NODE'="") X NODE
222 .;Execute set logic
223 .S NODE=$G(^DD(391.71,.08,1,XREFNUM,1))
224 .I (NODE'="") X NODE
225 Q
226 ;
227SETTFLAG(PIVOTPTR,PIVOTNUM,TURNOFF) ;Turn transmission flag for entry
228 ; in ADT/HL7 PIVOT file on/off
229 ;
230 ;Input : PIVOTPTR - Pointer to entry in ADT/HL7 PIVOT file (#391.71)
231 ; - Use this parameter if the entry number is known
232 ; - Not required if using PIVOTNUM parameter
233 ; - Use of this parameter takes precedence over use
234 ; the PIVOTNUM parameter
235 ; PIVOTNUM - PIVOT NUMBER value (field #.02) for entry
236 ; in ADT/HL7 PIVOT file (#391.71)
237 ; - Use this parameter if the pivot number is known
238 ; - Not required if using PIVOTPTR parameter
239 ; TURNOFF - Denotes if TRANSMITTED field (#.06) should
240 ; be turned on (set to 'YES') or off (set to 'NO')
241 ; 1 = Turns transmission off
242 ; 0 = Turns transmission on (default)
243 ;Output : None
244 ;
245 ;Check input
246 S PIVOTPTR=+$G(PIVOTPTR)
247 S PIVOTNUM=+$G(PIVOTNUM)
248 Q:(('PIVOTPTR)&('PIVOTNUM))
249 S TURNOFF=+$G(TURNOFF)
250 ;Declare variables
251 N VALUE,NODE,XREFNUM,DA,X
252 ;Passed pointer - validate
253 I (PIVOTPTR) Q:('$D(^VAT(391.71,PIVOTPTR,0)))
254 ;Passed pivot number - convert to pointer
255 I ('PIVOTPTR) S PIVOTPTR=+$O(^VAT(391.71,"D",PIVOTNUM,0)) Q:('PIVOTPTR)
256 ;Set FileMan variables
257 S DA=PIVOTPTR
258 S X='TURNOFF
259 ;Hard set field
260 S $P(^VAT(391.71,DA,0),"^",6)=X
261 ;Execute cross references
262 S XREFNUM=0
263 F S XREFNUM=+$O(^DD(391.71,.06,1,XREFNUM)) Q:('XREFNUM) D
264 .;Execute kill logic
265 .S NODE=$G(^DD(391.71,.06,1,XREFNUM,2))
266 .I (NODE'="") X NODE
267 .;Execute set logic
268 .S NODE=$G(^DD(391.71,.06,1,XREFNUM,1))
269 .I (NODE'="") X NODE
270 Q
Note: See TracBrowser for help on using the repository browser.