source: FOIAVistA/trunk/r/ENROLLMENT_APPLICATION_SYSTEM-EAS/EASEZC1.m@ 1722

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

initial load of FOIAVistA 6/30/08 version

File size: 7.9 KB
Line 
1EASEZC1 ;ALB/jap - Compare 1010EZ Data with VistA Database ;10/16/00 13:08
2 ;;1.0;ENROLLMENT APPLICATION SYSTEM;**1,51**;Mar 15, 2001
3 ;
4EN(EASAPP,EASDFN) ;this entry point is called as soon as user has selected an Application
5 ;
6 ;input
7 ; EASAPP = application ien in file #712
8 ; EASDFN = ien in file #2; if 0, then application not yet linked to file #2
9 ;output
10 ; ^TMP("EZDATA" where
11 ; ^TMP("EZDATA",$J,ien_file711)=file#^subfile#^field#^data_id
12 ; ^TMP("EZDATA",$J,ien_file711,multiple,1)=ezdata^accept_flag^subien_subfile712.01
13 ; ^TMP("EZDATA",$J,ien_file711,multiple,2)=vista_data^link_ien
14 ;
15 N IEN,KEY,SUBIEN,ACCEPT,FFF,LINK,MULTIPLE,ORIG,UPD,X,Y,C2711KEY
16 ;don't continue if passed in dfn doesn't match link
17 I $G(EASDFN),$P($G(^EAS(712,EASAPP,0)),U,10)'=EASDFN S EASDFN="" Q
18 ;don't continue if link to file #2 not available
19 I '$G(EASDFN) S EASDFN=+$P($G(^EAS(712,EASAPP,0)),U,10)
20 ;if applicant is new to database, user accept/not accept of data elements is constrained
21 S EASEZNEW=$P(^EAS(712,EASAPP,0),U,11)
22 ;display/file/print varies with version
23 S EASVRSN=$$VERSION^EASEZU4(EASAPP) ;alb/cmf/51
24 ;
25 ; setup local mapping array
26 D LOCAL711^EASEZU2
27 ;need this for later
28 S C2711KEY=+$$KEY711^EASEZU1("TYPE OF BENEFIT-ENROLLMENT")
29 ;correlate #712 data with tmp mapping array
30 S SUBIEN=0 F S SUBIEN=$O(^EAS(712,EASAPP,10,SUBIEN)) Q:'SUBIEN D
31 .S X=^EAS(712,EASAPP,10,SUBIEN,0)
32 .S (IEN,KEY)=$P(X,U,1),MULTIPLE=$P(X,U,2),ACCEPT=$P(X,U,3),FFF=$P(^TMP("EZDATA",$J,IEN),U,1,3)
33 .S X=$G(^EAS(712,EASAPP,10,SUBIEN,1)),ORIG=$P(X,U,1),UPD=$P(X,U,2)
34 .;if link exists, it is pointer to Vista database record for an existing patient
35 .; or possibly a 'new' patient (i.e., this applicant's data), if this is done post filing
36 .S LINK=$P($G(^EAS(712,EASAPP,10,SUBIEN,2)),U,2)
37 .;eliminate some garbage from web app
38 .I (ORIG="-")!(ORIG="--")!(ORIG="//") S ORIG=""
39 .Q:((ORIG="")&(UPD=""))
40 .I UPD="" S ^TMP("EZDATA",$J,IEN,MULTIPLE,1)=ORIG_U_ACCEPT_U_SUBIEN
41 .E S ^TMP("EZDATA",$J,IEN,MULTIPLE,1)=UPD_U_ACCEPT_U_SUBIEN
42 .;if this applicant is new to VistA database, there is no existing patient data for comparison
43 .;just pickup name,ssn,dob anyway;
44 .I EASEZNEW,EASDFN D
45 ..S F=$P(FFF,U,1),SF=$P(FFF,U,2),FD=$P(FFF,U,3)
46 ..I F=2,SF=2 I (FD=.01)!(FD=.02)!(FD=.03)!(FD=.09) S LINK=EASDFN
47 ..K F,SF,FD
48 .;if link to database exists then get VistA data into tmp array
49 .I 'LINK,$P(FFF,U,1)=2 S LINK=EASDFN
50 .I LINK D
51 ..S X=$$GET(LINK,FFF) S:X=-1 X="" S ^TMP("EZDATA",$J,IEN,MULTIPLE,2)=X_U_LINK
52 ..;special for file #27.11 (Enrollment) data
53 ..I KEY=C2711KEY D
54 ...S CUR=$P($G(^EAS(712,EASAPP,10,SUBIEN,2)),U,2)
55 ...D ENR(CUR,.VDATA) K CUR
56 ...S ^TMP("EZDATA",$J,IEN,MULTIPLE,2)=VDATA_U_LINK K VDATA
57 ..I $G(^TMP("EZDATA",$J,IEN,MULTIPLE,1))="" S ^TMP("EZDATA",$J,IEN,MULTIPLE,1)=U_ACCEPT_U_SUBIEN
58 D C206^EASEZC3 ;alb/cmf/51 special for ethnicity multiple
59 D C202^EASEZC3 ;alb/cmf/51 special for race multiple
60 ;set 'transformed' data into ^TMP("EZDISP" array
61 D SORT^EASEZC3(EASAPP)
62 Q
63 ;
64GET(EASLINK,EASFFF) ;get data from existing Patient database
65 ;input EASLINK = IEN(s) needed
66 ; format: file_ien;subfile_ien
67 ; EASFFF = field # for file or subfile
68 ; format: file#^subfile#^field#
69 ;output RTR = data obtained from Patient database; external format;
70 ; OR -1 if invalid input
71 ;
72 N FILE,SUBFILE,FIELD,RTR,ARRAY,DA,DR,DIC,DIQ,X,Y
73 S FILE=$P(EASFFF,U,1),SUBFILE=$P(EASFFF,U,2),FIELD=$P(EASFFF,U,3)
74 I ('FILE)!('FIELD) Q -1
75 I SUBFILE,SUBFILE'=FILE,EASLINK'[";" Q -1
76 I EASLINK[";",SUBFILE="" Q -1
77 ;
78 I (SUBFILE="")!(SUBFILE=FILE) D
79 .;data in main file
80 .S DIQ="ARRAY",DIQ(0)="E",DA=EASLINK,DR=FIELD,DIC=FILE
81 .D EN^DIQ1
82 .S RTR=$G(ARRAY(FILE,EASLINK,FIELD,"E"))
83 I SUBFILE'="",SUBFILE'=FILE D
84 .;data in subfile
85 .;in this case EASLINK = file_ien;subfile_ien
86 .S DIQ="ARRAY",DIQ(0)="E",DA=$P(EASLINK,";",1),DIC=FILE
87 .;get field # for subfile
88 .S DR=$O(^DD(FILE,"SB",SUBFILE,0))
89 .S DR(SUBFILE)=FIELD,DA(SUBFILE)=$P(EASLINK,";",2)
90 .D EN^DIQ1
91 .S RTR=$G(ARRAY(SUBFILE,$P(EASLINK,";",2),FIELD,"E"))
92 Q RTR
93 ;
94 ;
95C2 ;get data from file #2 into local array L711
96 ;there are alot of fields; quickest just to order thru local mapping file
97 ;
98 N KEY,MAP,VDATA,EASAEL
99 ;2nd subscript for array is always 1 (no multiples)
100 S KEY=0 F S KEY=$O(^TMP("EZDATA",$J,KEY)) Q:'KEY S MAP=^TMP("EZDATA",$J,KEY) I ($P(MAP,U,1)=2)&($P(MAP,U,2)=2) D
101 .S EASAEL=$P($G(^TMP("EZDATA",$J,KEY,1,1)),U,3)
102 .S VDATA=$$GET(EASDFN,MAP)
103 .Q:VDATA=-1 Q:VDATA=""
104 .;special handling for field #.362
105 .I ($P(MAP,U,1)=5)="I;14D3." D
106 ..I VDATA["IN LIEU OF VA COMP" S VDATA="YES"
107 ..I VDATA="YES, RECEIVING MILITARY RETIREMENT" S VDATA="NO"
108 .;ien to #711 is 1st subscript of local array is
109 .S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
110 .;if data exists in 1010EZ then insert link to file #2
111 .I EASAEL D LINKUP^EASEZU1(EASAPP,EASAEL,EASDFN)
112 .;if data does not exist in 1010EZ add subrecord to hold link
113 .I 'EASAEL D ADD71201^EASEZU1(EASAPP,KEY,EASDFN,1)
114 Q
115 ;
116C201 ;get data in Alias subfile #2.01 into local array L711
117 ; using ien(s) local array ALIAS
118 ;
119 ;for Alias name(s) - if other name on 1010EZ doesn't match any on file
120 ; then it will be auto-accepted; comparision only with matching name if any.
121 N X,M,B,ADATA,VDATA,KEY,EASAEL
122 S KEY=+$$KEY711^EASEZU1("APPLICANT OTHER NAME")
123 S M=0 F S M=$O(^TMP("EZDATA",$J,KEY,M)) Q:'M D
124 .S ADATA=$P(^TMP("EZDATA",$J,KEY,M,1),U,1)
125 .S B=0 F S B=$O(ALIAS(B)) Q:'B D
126 ..S VDATA=$$GET(ALIAS(B),^TMP("EZDATA",$J,KEY)) Q:VDATA=-1
127 ..I VDATA=ADATA D
128 ...S ^TMP("EZDATA",$J,KEY,M,2)=VDATA
129 ...S EASAEL=$P(^TMP("EZDATA",$J,KEY,M,1),U,3)
130 ...;only insert link if data exists in 1010EZ
131 ...I EASAEL D LINKUP^EASEZU1(EASAPP,EASAEL,ALIAS(B))
132 Q
133 ;
134C2101 ;get data in Disposition subfile #2.101 into local array L711
135 ; using ien(s) local array DISPOS
136 ;
137 ;display data on most recent registration if any
138 ;2nd subscript of local array always 1 (no multiples)
139 N B,X,FLD,KEY,ADATA,VDATA,EASAEL
140 S FLD=0 F S FLD=$O(^TMP("EZINDEX","A",2,2.101,FLD)) Q:FLD="" D
141 .S KEY=$O(^TMP("EZINDEX","A",2,2.101,FLD,0))
142 .S ADATA=$G(^TMP("EZDATA",$J,KEY,1,1))
143 .S VDATA=$$GET(DISPOS(1),^TMP("EZDATA",$J,KEY))
144 .Q:VDATA=-1 Q:VDATA=""
145 .S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
146 .S EASAEL=$P($G(^TMP("EZDATA",$J,KEY,1,1)),U,3)
147 .;if data exists in 1010EZ then insert link
148 .I EASAEL D LINKUP^EASEZU1(EASAPP,EASAEL,DISPOS(1)) Q
149 .;if data does not exist in 1010EZ add subrecord to hold link
150 .I 'EASAEL D ADD71201^EASEZU1(EASAPP,KEY,DISPOS(1),1)
151 Q
152 ;
153C2711 ;get data in Current Enrollment #27.11 into local array L711
154 ; using ien(s) local array ENROLL
155 ;
156 ;2nd subscript of local array always 1 (no multiples)
157 N X,M,B,ADATA,CUR,DGENR,VDATA,KEY,EASAEL
158 S KEY=+$$KEY711^EASEZU1("TYPE OF BENEFIT-ENROLLMENT")
159 S CUR=$G(ENROLL(1)),VDATA=""
160 Q:CUR=-1
161 Q:CUR=""
162 D ENR(CUR,.VDATA)
163 S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
164 S EASAEL=$P($G(^TMP("EZDATA",$J,KEY,1,1)),U,3)
165 ;if data exists in 1010EZ then insert link
166 I EASAEL D LINKUP^EASEZU1(EASAPP,EASAEL,CUR)
167 ;if data does not exist in 1010EZ add subrecord to hold link
168 I 'EASAEL D ADD71201^EASEZU1(EASAPP,KEY,CUR,1)
169 Q
170 ;
171ENR(CUR,VDATA) ;get data for current enrollment from VistA database
172 ;input CUR = pointer to file #27.11
173 N DGENCAT
174 S VDATA=""
175 I $$GET^DGENA(CUR,.DGENR) D
176 .I $G(DGENR("STATUS"))=10!($G(DGENR("STATUS"))=19)!($G(DGENR("STATUS"))=20) D Q
177 ..S VDATA=$S($G(DGENR("STATUS")):$$EXT^DGENU("STATUS",DGENR("STATUS")),1:"")
178 .S DGENCAT=$$CATEGORY^DGENA4(+EASDFN)
179 .S DGENCAT=$$EXTERNAL^DILFD(27.15,.02,"",DGENCAT)
180 .S VDATA=$S($G(DGENR("PRIORITY")):$$EXT^DGENU("PRIORITY",DGENR("PRIORITY")),1:"")
181 .S VDATA=VDATA_$S($G(DGENR("SUBGRP"))="":"",1:$$EXT^DGENU("SUBGRP",$G(DGENR("SUBGRP"))))
182 .S VDATA=VDATA_" | "_DGENCAT
183 Q
184 ;
185C408 ;get data from financial files into tmp mapping array
186 ; using ien(s) local array INCREL
187 ;if no iens for veteran then nothing at all; exit
188 I $G(INCREL(408,"V",1))="" Q
189 ;link EZ applicant to veteran data
190 D A408^EASEZC2
191 ;link EZ spouse to spouse data
192 D SP408^EASEZC2
193 ;link EZ child to child/dependent data
194 D C1N408^EASEZC2
195 Q
Note: See TracBrowser for help on using the repository browser.