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

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

initial load of WorldVistAEHR

File size: 9.1 KB
Line 
1VAFCMGA ;ALB/JRP,LTL-DEMOGRAPHIC MERGE SCREEN ACTIONS ;31-OCT-96
2 ;;5.3;Registration;**149,477,479**;Aug 13, 1993
3 ;
4 ;NOTE: The VAFCMGA* routines contain line tags used to implement
5 ; the actions of a List Manager user interface. All line
6 ; tags assume that the following variables and arrays are
7 ; defined.
8 ;
9 ;Input : VAFCDFN - Pointer to entry in PATIENT file (#2) to merge
10 ; data into
11 ; VAFCARR - Array contain data to merge (full global reference)
12 ; VAFCARR() should be set as follows:
13 ; VAFCARR(File,Field) = Value
14 ; Where File = File number Value is from
15 ; Field = Field number Value is from
16 ; Value = Info to merge
17 ; Notes: Dates must be in FileMan format
18 ; : Special considerations for Value
19 ; "@" - Displays <DELETE> and deletes
20 ; local value if merged
21 ; "^text" - Displays text and ignores
22 ; field if merged
23 ; NULL - Displays <UNSPECIFIED> and
24 ; ignores field if merged
25 ; Doesn't exist - Displays <UNSPECIFIED>
26 ; and ignores field
27 ; if merged
28 ; VAFCFROM - Text denoting where merge data cam from (1-35)
29 ; VAFCEVDT - Date/time merge data was instantiated (FileMan)
30 ; All variables set by List Manager Interface
31 ; Display area and variables required List Manager interface
32 ; Display
33 ; VALMAR(Line,0) = Line of text in display
34 ; Indexes
35 ; VALMAR("IDX",Line,Entry) = ""
36 ; VALMAR("E2F",Entry,N) = File^Field
37 ; N => Allows for multiple fields per entry (starts with 1)
38 ; VALMAR("E2G",Entry) = Group entry is contained in
39 ; VALMAR("GRP",Group) = First line of group in display
40 ; Note: The E2F and E2G indexes are only set if the data
41 ; to merge does not match the local data
42 ;
43MRGALL ;Merge all differences
44 ;
45 ;Input : See above note on input variables
46 ;Output : VALMAR() array will be rebuilt accordingly
47 ;
48 ;Declare variables
49 N VAFCDOTS,ENTRY,REBUILD,FILE,FIELD,VALUE,REPEAT
50 N TMP,IENS,FDAROOT,MSGROOT,QUOTE
51 S FDAROOT="^TMP(""VAFC-MERGE-UPLOAD"","_$J_",""FDA"")"
52 S MSGROOT="^TMP(""VAFC-MERGE-UPLOAD"","_$J_",""MSG"")"
53 S QUOTE=$C(34)
54 S IENS=VAFCDFN_","
55 K @FDAROOT,@MSGROOT
56 ;Build array of differences to merge
57 N DGNOFDEL S DGNOFDEL=1 ;**477 stop NOK Name x-ref from firing.
58 NEW EASZIPLK S EASZIPLK=1 ;**477 zipcode lookup for GMT
59 S ENTRY=""
60 F S ENTRY=$O(@VALMAR@("E2F",ENTRY)) Q:(ENTRY="") D
61 .;Remember which group(s) to rebuild
62 .S TMP=$G(@VALMAR@("E2G",ENTRY))
63 .S:(TMP'="") REBUILD(TMP)=""
64 .;Loop through list of fields contained in the entry
65 .S REPEAT=""
66 .F S REPEAT=$O(@VALMAR@("E2F",ENTRY,REPEAT)) Q:(REPEAT="") D
67 ..S TMP=$G(@VALMAR@("E2F",ENTRY,REPEAT))
68 ..S FILE=+$P(TMP,"^",1)
69 ..S FIELD=+$P(TMP,"^",2)
70 ..;Get remote value
71 ..S VALUE=$G(@VAFCARR@(FILE,FIELD))
72 ..;Screen for ignore conditions
73 ..I $P(VALUE,U,3) S VALMSG=$S($G(VALMSG)]"":VALMSG_","_ENTRY,1:"Can't merge unresolved item(s) "_ENTRY) Q
74 ..S VALUE=$P(VALUE,U)
75 ..Q:(VALUE="")
76 ..;Convert "@" to @
77 ..S:(VALUE=(QUOTE_"@"_QUOTE)) VALUE="@"
78 ..;Move data into upload array
79 ..;I $S(ENTRY=6:0,ENTRY=7:0,ENTRY=9:0,1:1) S @FDAROOT@(FILE,IENS,FIELD)=VALUE ;let zipcode populate city, state and county for merge all ;**477 for GMT ;**479 address removed
80 .. S @FDAROOT@(FILE,IENS,FIELD)=VALUE ;**479 address removed - allow merge
81 ..;Prepare for undo
82 ..S ^TMP("VAFC-UNDO",$J,"FDA",FILE,IENS,FIELD)=$$GET1^DIQ(FILE,IENS,FIELD)
83 ;Merge differences
84 I (+$O(@FDAROOT@(0))) D FILE^DIE("E",FDAROOT,MSGROOT)
85 ;Rebuild required portion of display
86 S VAFCDOTS=1
87 S ENTRY=""
88 F S ENTRY=$O(REBUILD(ENTRY)) Q:(ENTRY="") D RBLDGRP^VAFCMGB(ENTRY)
89 ;No more differences
90 S:('$D(@VALMAR@("E2F"))) VALMSG="** No differences found **"
91 ;Done - refresh List Manager display
92 S VALMBCK="R"
93 Q
94MRGSLCT ;Merge user selected differences
95 ;
96 ;Input : See above note on input variables
97 ;Output : Modified areas of VALMAR() array will be rebuilt accordingly
98 ;
99 ;Declare variables
100 N VAFCDOTS,ENTRY,REBUILD,VALMY,FILE,FIELD,REPEAT
101 N TMP,IENS,FDAROOT,MSGROOT,QUOTE,UNDO
102 S QUOTE=$C(34)
103 S FDAROOT="^TMP(""VAFC-MERGE-UPLOAD"","_$J_",""FDA"")"
104 S MSGROOT="^TMP(""VAFC-MERGE-UPLOAD"","_$J_",""MSG"")"
105 S IENS=VAFCDFN_","
106 K @FDAROOT,@MSGROOT
107 ;Prompt user for entries to merge
108 D EN^VALM2($G(XQORNOD(0)),"O")
109 ;Build array of data selected for merging
110 N DGNOFDEL S DGNOFDEL=1 ;**477 stop NOK Name x-ref from firing.
111 NEW EASZIPLK S EASZIPLK=1 ;**477 zipcode lookup for GMT
112 ;I $D(VALMY(8)) F ENTRY=6,7,9 I '$D(VALMY(ENTRY)) S VALMY(ENTRY)="",UNDO(ENTRY)="" ;prepare to undo city, state and county if zip selected ;**477 for GMT ;**479 address removed
113 S ENTRY=""
114 F S ENTRY=$O(VALMY(ENTRY)) Q:(ENTRY="") D
115 .;Remember which group(s) to rebuild
116 .S TMP=$G(@VALMAR@("E2G",ENTRY))
117 .S:(TMP'="") REBUILD(TMP)=""
118 .;Loop through list of fields contained in the entry
119 .S REPEAT=""
120 .F S REPEAT=$O(@VALMAR@("E2F",ENTRY,REPEAT)) Q:(REPEAT="") D
121 ..S TMP=$G(@VALMAR@("E2F",ENTRY,REPEAT))
122 ..S FILE=+$P(TMP,"^",1)
123 ..S FIELD=+$P(TMP,"^",2)
124 ..;Get remote value
125 ..S VALUE=$G(@VAFCARR@(FILE,FIELD))
126 ..;Screen for ignore conditions
127 ..I $P(VALUE,U,3) S VALMSG=$S($G(VALMSG)]"":VALMSG_","_ENTRY,1:"Can't merge unresolved item(s) "_ENTRY) Q
128 ..S VALUE=$P(VALUE,U)
129 ..Q:(VALUE="")
130 ..;Convert "@" to @
131 ..S:(VALUE=(QUOTE_"@"_QUOTE)) VALUE="@"
132 ..;Move data into upload array
133 ..I '$D(UNDO(ENTRY)) S @FDAROOT@(FILE,IENS,FIELD)=VALUE ;**477 for GMT
134 ..;Prepare for undo
135 ..S ^TMP("VAFC-UNDO",$J,"FDA",FILE,IENS,FIELD)=$$GET1^DIQ(FILE,IENS,FIELD)
136 ;Merge selected data BUT don't transmit until merge completed or rejected
137 I (+$O(@FDAROOT@(0))) S VAFCA08=1 D FILE^DIE("E",FDAROOT,MSGROOT) K VAFCA08
138 ;Rebuild required portion of display
139 S VAFCDOTS=1
140 S ENTRY=""
141 F S ENTRY=$O(REBUILD(ENTRY)) Q:(ENTRY="") D RBLDGRP^VAFCMGB(ENTRY)
142 ;No more differences
143 S:('$D(@VALMAR@("E2F"))) VALMSG="** No differences found **"
144 ;Done - refresh List Manager display
145 K @FDAROOT,@MSGROOT
146 S VALMBCK="R"
147 Q
148 ;
149COMPLETE ;Merge process completed ;**477 always prompt for merge, add verbage
150 ;
151 ;Input : See above note on input variables
152 ;Output : VAFCDONE will be set to '1'
153 ;
154 ;Declare variables
155 N DIR,X,Y
156 S VAFCDONE=1
157 D FULL^VALM1 ;switch to full screen
158 I ($D(@VALMAR@("E2F"))) D ;check for differences
159 .S DIR("A",7)=" ** Differences still exist between local and remote data **" ;check for differences
160 .S DIR("A",8)=" "
161 ;Make sure user is really done with merge process
162 S DIR(0)="YA"
163 S DIR("A",1)=" "
164 S DIR("A",2)="NOTE: Since your site is the CMOR, you are considered to be the"
165 S DIR("A",3)=" authoritative source. By completing the merge, you confirm that"
166 S DIR("A",4)=" your facility's NAME, SEX, DOB, SSN and MOTHER'S MAIDEN NAME are"
167 S DIR("A",5)=" accurate for broadcast to all facilities sharing this patient."
168 S DIR("A",6)=" "
169 S DIR("A")="Are you ready to complete the merge process? (Yes/No) : "
170 S DIR("B")="YES"
171 D ^DIR
172 S VAFCDONE=+Y
173 ;User not done
174 I ('VAFCDONE) S VALMBCK="R" Q
175 ; Create an entry in the ADT/HL7 PIVOT file (#391.71) and
176 ; mark it as requiring transmission of an HL7 ADT-A08 message
177 D AVAFC^VAFCDD01(VAFCDFN)
178 ;Done - quit List Manager interface
179 S VALMBCK="Q"
180 Q
181 ;
182REJECT ;Reject/ignore differences ;**477 add verbage
183 ;
184 ;Input : See above note on input variables
185 ;Output : VAFCRJCT will be set to '1'
186 ;
187 ;Declare variables
188 N DIR,X,Y
189 S VAFCRJCT=1
190 ;Switch to full screen
191 D FULL^VALM1
192 ;Make sure user really wants to reject differences
193 S DIR(0)="YA"
194 S DIR("A",1)=" "
195 S DIR("A",2)="NOTE: Since your site is the CMOR, you are considered to be the"
196 S DIR("A",3)=" authoritative source. By rejecting the remote data, you confirm"
197 S DIR("A",4)=" that your facility's NAME, SEX, DOB, SSN and MOTHER'S MAIDEN NAME"
198 S DIR("A",5)=" are accurate for broadcast to all facilities sharing this patient."
199 S DIR("A",6)=" "
200 S DIR("A")="Are you sure you want to reject the remote data? (Yes/No) : "
201 S DIR("B")="YES"
202 D ^DIR
203 S VAFCRJCT=+Y
204 ;Don't reject
205 I ('VAFCRJCT) S VALMBCK="R" Q
206 ; Create an entry in the ADT/HL7 PIVOT file (#391.71) and
207 ; mark it as requiring transmission of an HL7 ADT-A08 message
208 D AVAFC^VAFCDD01(VAFCDFN)
209 ;Done - quit List Manager interface
210 S VALMBCK="Q"
211 Q
212HI ;Hinq Inquiry
213 S DFN=VAFCDFN
214 D HINQ^DG10 S VALMBCK=""
215 ;D EN^DVBHQZ4 S VALMBCK=""
216 ;S VALMSG="Hinq request has "_$S($D(^DVB(395.5,DFN,0))&("PNEA"[$P($G(^DVB(395.5,DFN,0)),U,4)):"",1:"NOT ")_"been made for this patient."
217HIQ Q
218PA ;Patient Audit
219 Q ;**477 - no longer in use replaced by remote audit protcols
220 I '$O(^DIA(2,"B",VAFCDFN,0)) S VALMSG="This patient has no audit data available.",VALMBCK="" G PAQ
221 N IEN S DFN=VAFCDFN,QFLG=1 D FULL^VALM1 D:$T(ASK2^RGMTAUD)]"" ASK2^RGMTAUD S VALMBCK="R"
222PAQ Q
Note: See TracBrowser for help on using the repository browser.