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

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

initial load of WorldVistAEHR

File size: 8.7 KB
RevLine 
[613]1VAFCMGB0 ;ALB/JRP-DEMOGRAPHIC MERGE SCREENS ;10/18/96
2 ;;5.3;Registration;**149,255,477,479**;Aug 13, 1993
3 ;
4 ;NOTE: This routine contains line tags used to build the display
5 ; screen for a List Manager interface. Refer to routine
6 ; VAFCMGB for a description of input/output variables.
7 ;
8LOCAL(FILE,FIELD,IENS,ARRAY) ;Get local data from extraction array
9 ;
10 ;Input : FILE - File number
11 ; FIELD - Field number
12 ; IENS - FDA entry number (ex: "DFN,")
13 ; ARRAY - FDA array containing local data (full global ref)
14 ; (ie: ARRAY(File,IENS,Field) = Value)
15 ; All variables denoted in VAFCMGB routine
16 ;Output : Value to display
17 ;Notes : Existance/validity of input variables is assumed
18 ; : ARRAY() is the ouput of the call to GETDATA^VAFCMGU0()
19 ; :<No Data Found> is returned when ARRAY(File,IENS,Field) is NULL
20 ; or does not exist
21 ; : Phone numbers are returned in HL7 format
22 ; : Social security numbers will contain dashes
23 ; : Dates are returned in the format MM-DD-YYYY@HH:MM:SS
24 ;
25 ;Declare variables
26 N VALUE,QUOTE
27 S QUOTE=$C(34)
28 ;Get data
29 S VALUE=$G(@ARRAY@(FILE,IENS,FIELD))
30 ;Convert NULLS and quit
31 Q:(VALUE="") "<No Data Found>"
32 ;Convert phone numbers to HL7 format
33 I ((FIELD=.131)!(FIELD=.132)!(FIELD=.219)) I (FILE=2) D
34 .S VALUE=$$HLPHONE^HLFNC(VALUE)
35 ;Add dashes to SSN
36 I (FIELD=.09) I (FILE=2) D
37 .S VALUE=$TR(VALUE,"-","")
38 .S VALUE=$E(VALUE,1,3)_"-"_$E(VALUE,4,5)_"-"_$E(VALUE,6,10)
39 ;Convert dates to MM-DD-YYYY@HH:MM:SS format
40 I ((FIELD=.03)!(FIELD=.351)) I (FILE=2) D
41 .S VALUE=$$EX2INDT^VAFCMGU0(VALUE)
42 .S VALUE=$$IN2EXDT^VAFCMGU0(VALUE)
43 ;Done
44 Q VALUE
45 ;
46REMOTE(FILE,FIELD) ;Get remote data from merge array [VAFCARR()]
47 ;
48 ;Input : FILE - File number
49 ; FIELD - Field number
50 ; All variables denoted in VAFCMGB routine
51 ;Output : Value to display
52 ;Notes : Existance/validity of input variables is assumed
53 ; :<No Data Found> is returned when VAFCARR(File,Field) is NULL or
54 ; does not exist
55 ; : <Data Deleted> is returned when VAFCARR(File,Field)="@"
56 ; : When VAFCARR(Field,Field)="^text", text will be returned
57 ; : Phone numbers are returned in HL7 format
58 ; : Social security numbers will contain dashes
59 ; : Dates are returned in the format MM-DD-YYYY@HH:MM:SS
60 ;
61 ;Declare variables
62 N VALUE,QUOTE
63 S QUOTE=$C(34)
64 ;Get data
65 S VALUE=$G(@VAFCARR@(FILE,FIELD))
66 ;Convert NULLS and quit
67 Q:($P(VALUE,U)="") "<No Data Found>"
68 ;Convert "@" and quit
69 Q:($P(VALUE,U)=(QUOTE_"@"_QUOTE)) "<Data Deleted>"
70 ;Convert unresolved and quit
71 Q:$P(VALUE,U,3) "<UR> "_$P(VALUE,U)
72 S VALUE=$P(VALUE,U)
73 ;Convert phone numbers to HL7 format
74 I ((FIELD=.131)!(FIELD=.132)!(FIELD=.219)) I (FILE=2) D
75 .S VALUE=$$HLPHONE^HLFNC(VALUE)
76 ;Add dashes to SSN
77 I (FIELD=.09) I (FILE=2) D
78 .S VALUE=$TR(VALUE,"-","")
79 .S VALUE=$E(VALUE,1,3)_"-"_$E(VALUE,4,5)_"-"_$E(VALUE,6,10)
80 ;Convert dates to MM-DD-YYYY@HH:MM:SS format
81 I ((FIELD=.03)!(FIELD=.351)) I (FILE=2) D
82 .S VALUE=$$IN2EXDT^VAFCMGU0(VALUE)
83 ;Convert ZIP to ZIP+4
84 ;I (FIELD=.1112) I (FILE=2) D ;**255 **479
85 ;.S VALUE=$TR(VALUE,"-") ;**477 old messaging didn't contain '-'
86 ;.S VALUE=$E(VALUE,1,5)_$S($E(VALUE,6,9)]"":"-"_$E(VALUE,6,9),1:"")
87 I (FIELD=.3612) I (FILE=2) D ;**477
88 .I $L(VALUE)>7 S VALUE=$$HL7TFM^XLFDT(VALUE) ;convert hl7 to fileman date
89 ;Done
90 Q VALUE
91 ;
92DIFFCHK(FILE,FIELD,IENS,ARRAY) ;Compare local and remote data for differences
93 ;
94 ;Input : FILE - File number
95 ; FIELD - Field number
96 ; IENS - FDA entry number (ex: "2169,")
97 ; ARRAY - FDA array containing local data (full global ref)
98 ; (ie: ARRAY(File,IENS,Field) = Value)
99 ; All variables denoted in VAFCMGB routine
100 ;Output : 1 = Local & remote data are different
101 ; 0 = Local & remote data are not different
102 ;Notes : Existance/validity of input variables is assumed
103 ; : ARRAY() is the ouput of the call to GETDATA^VAFCMGU0()
104 ; : If VAFCARR(File,Field) is undefined, NULL, or has a value of
105 ; "^text" a difference is not found (prevents overwritting of
106 ; local data)
107 ; : If VAFCARR(File,Field) is "@" and ARRAY(File,IENS,Field) is
108 ; NULL or does not exist a difference is not found (prevents
109 ; deletion of nothing)
110 ; : Phone numbers are converted to HL7 format for comparison
111 ; : Social security numbers are compared with dashes removed
112 ; : Dates are converted to FileMan format for comparison
113 ;
114 ;Declare variables
115 N LOCAL,REMOTE,QUOTE
116 S QUOTE=$C(34)
117 ;Get local data
118 S LOCAL=$G(@ARRAY@(FILE,IENS,FIELD))
119 ;Get remote data
120 S REMOTE=$P($G(@VAFCARR@(FILE,FIELD)),U)
121 ;S:$E(REMOTE)=U&($P(REMOTE,U,2)]"") REMOTE=$P(REMOTE,U,2)
122 ;S:$P(REMOTE,U)=""&('$P(REMOTE,U,2)) REMOTE=""
123 ;S:$P(REMOTE,U)]"" REMOTE=$P(REMOTE,U)
124 ;Screen for remote value of NULL - return no diff
125 I (REMOTE="") Q 0
126 ;Screen for remote value of "^text" - return no diff
127 I (REMOTE=(QUOTE_"^")) Q 0
128 ;Screen for remote value of "@" and no local value - return no diff
129 I ((REMOTE=(QUOTE_"@"_QUOTE))&(LOCAL="")) Q 0
130 ;Convert phone numbers to HL7 format
131 I ((FIELD=.131)!(FIELD=.132)!(FIELD=.219)) I (FILE=2) D
132 .S LOCAL=$$HLPHONE^HLFNC(LOCAL)
133 .S REMOTE=$$HLPHONE^HLFNC(REMOTE)
134 ;Remove dashes from SSN
135 I (FIELD=.09) I (FILE=2) D
136 .S LOCAL=$TR(LOCAL,"-","")
137 .S REMOTE=$TR(REMOTE,"-","")
138 ;Convert dates to FileMan format (remote dates already in FM format)
139 I ((FIELD=.03)!(FIELD=.351)) I (FILE=2) D
140 .S LOCAL=$$EX2INDT^VAFCMGU0(LOCAL)
141 I (FIELD=.3612) I (FILE=2) D ;*477
142 .S LOCAL=$$EX2INDT^VAFCMGU0(LOCAL)
143 .I $L(REMOTE)>7 S REMOTE=$$HL7TFM^XLFDT(REMOTE) ;convert hl7 to fileman date
144 ;Convert zip+4 to fileman format
145 ;I (FIELD=.1112) I (FILE=2) D ;**255 **479
146 ;.S LOCAL=$TR(LOCAL,"-","")
147 ;.S REMOTE=$TR(REMOTE,"-","")
148 ;Done - return comparison of local & remote data
149 Q ('(LOCAL=REMOTE))
150 ;
151GROUP1 ;Line tag to build logical group number one
152 ;
153 ;Group one contains the following fields:
154 ; .01, .03, .09, .351
155 ;
156 ;Column width is limited to 30 characters
157 ;
158 ;Declare variables
159 N IENS,TARGET,MESSAGE,LINE,DATA,LOCAL,REMOTE,DIFF
160 S TARGET="^TMP(""VAFC-MERGE-TO"","_$J_",""DATA"")"
161 S MESSAGE="^TMP(""VAFC-MERGE-TO"","_$J_",""MESSAGE"")"
162 ;Initialize global locations
163 K @TARGET,@MESSAGE
164 ;Set group index
165 S @VALMAR@("GRP",1)=VALMCNT
166 ;Get local data for patient
167 D GETDATA^VAFCMGU0(VAFCDFN,1,TARGET,MESSAGE)
168 ;Build display
169 S IENS=VAFCDFN_","
170 ;Name
171 S LOCAL=$$LOCAL(2,.01,IENS,TARGET)
172 S LOCAL=$E(LOCAL,1,30)
173 S REMOTE=$$REMOTE(2,.01)
174 S REMOTE=$E(REMOTE,1,30)
175 S DIFF=$$DIFFCHK(2,.01,IENS,TARGET)
176 S LINE=$S(DIFF:"**",1:" ")_" 1"
177 S:DIFF&($P($G(@VAFCARR@(2,.01)),U,2)) LINE="->"_" 1" ;**477 flag name if different - no longer auto updated
178 S DATA="Name: "_LOCAL
179 S LINE=$$INSERT^VAFCMGU0(DATA,LINE,8)
180 S @VALMAR@(VALMCNT,0)=$$INSERT^VAFCMGU0(REMOTE,LINE,48)
181 S @VALMAR@("IDX",VALMCNT,1)=""
182 I (DIFF) D
183 .S @VALMAR@("E2F",1,1)="2^.01"
184 .S @VALMAR@("E2G",1)=1
185 I ('DIFF) D
186 .K @VALMAR@("E2F",1)
187 .K @VALMAR@("E2G",1)
188 W:(+$G(VAFCDOTS)) "."
189 S VALMCNT=VALMCNT+1
190 ;SSN
191 S LOCAL=$$LOCAL(2,.09,IENS,TARGET)
192 S REMOTE=$$REMOTE(2,.09)
193 S DIFF=$$DIFFCHK(2,.09,IENS,TARGET)
194 S LINE=$S(DIFF:"**",1:" ")_" 2"
195 S:DIFF&($P($G(@VAFCARR@(2,.09)),U,2)) LINE="->"_" 2"
196 S DATA="SSN: "_LOCAL
197 S LINE=$$INSERT^VAFCMGU0(DATA,LINE,9)
198 S @VALMAR@(VALMCNT,0)=$$INSERT^VAFCMGU0(REMOTE,LINE,48)
199 S @VALMAR@("IDX",VALMCNT,2)=""
200 I (DIFF) D
201 .S @VALMAR@("E2F",2,1)="2^.09"
202 .S @VALMAR@("E2G",2)=1
203 I ('DIFF) D
204 .K @VALMAR@("E2F",2)
205 .K @VALMAR@("E2G",2)
206 W:(+$G(VAFCDOTS)) "."
207 S VALMCNT=VALMCNT+1
208 ;Date of birth
209 S LOCAL=$$LOCAL(2,.03,IENS,TARGET)
210 S LOCAL=$P(LOCAL,"@",1)
211 S REMOTE=$$REMOTE(2,.03)
212 S REMOTE=$P(REMOTE,"@",1)
213 S DIFF=$$DIFFCHK(2,.03,IENS,TARGET)
214 S LINE=$S(DIFF:"**",1:" ")_" 3"
215 S:DIFF&($P($G(@VAFCARR@(2,.03)),U,2)) LINE="->"_" 3"
216 S DATA="DOB: "_LOCAL
217 S LINE=$$INSERT^VAFCMGU0(DATA,LINE,9)
218 S @VALMAR@(VALMCNT,0)=$$INSERT^VAFCMGU0(REMOTE,LINE,48)
219 S @VALMAR@("IDX",VALMCNT,3)=""
220 I (DIFF) D
221 .S @VALMAR@("E2F",3,1)="2^.03"
222 .S @VALMAR@("E2G",3)=1
223 I ('DIFF) D
224 .K @VALMAR@("E2F",3)
225 .K @VALMAR@("E2G",3)
226 W:(+$G(VAFCDOTS)) "."
227 S VALMCNT=VALMCNT+1
228 ;Date of death - strip time
229 S LOCAL=$$LOCAL(2,.351,IENS,TARGET)
230 ;S LOCAL=$P(LOCAL,"@",1) ;**477 time has already been stripped
231 S REMOTE=$$REMOTE(2,.351)
232 ;S REMOTE=$P(REMOTE,"@",1) ;**477 time has already been stripped
233 S DIFF=$$DIFFCHK(2,.351,IENS,TARGET)
234 S LINE=$S(DIFF:"**",1:" ")_" 4"
235 S:DIFF&($P($G(@VAFCARR@(2,.351)),U,2)) LINE="->"_" 4"
236 S DATA="DOD: "_LOCAL
237 S LINE=$$INSERT^VAFCMGU0(DATA,LINE,9)
238 S @VALMAR@(VALMCNT,0)=$$INSERT^VAFCMGU0(REMOTE,LINE,48)
239 S @VALMAR@("IDX",VALMCNT,4)=""
240 I (DIFF) D
241 .S @VALMAR@("E2F",4,1)="2^.351"
242 .S @VALMAR@("E2G",4)=1
243 I ('DIFF) D
244 .K @VALMAR@("E2F",4)
245 .K @VALMAR@("E2G",4)
246 W:(+$G(VAFCDOTS)) "."
247 S VALMCNT=VALMCNT+1
248 Q
Note: See TracBrowser for help on using the repository browser.