source: WorldVistAEHR/trunk/r/ENROLLMENT_APPLICATION_SYSTEM-EAS/EASEZC2.m@ 619

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

initial load of WorldVistAEHR

File size: 6.1 KB
Line 
1EASEZC2 ;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 ;
4A408 ;get applicant financial data from VistA
5 N IENS,IEN,B,FF,FILE,SUBF,FLD,MAP,VDATA,KEY,EASAEL
6 S IENS=$G(INCREL(408,"V",1))
7 Q:IENS=""
8 ;associate each ien with file/subfile
9 S B=0 F FF=408.12,2,408.21,408.22 D
10 .S B=B+1,IEN=+$P(IENS,U,B)
11 .Q:'IEN Q:FF=2
12 .S (FILE,SUBF)=FF
13 .S FLD=0 F S FLD=$O(^TMP("EZINDEX",$J,"A",FILE,SUBF,FLD)) Q:FLD="" D
14 ..S MAP=FILE_U_SUBF_U_FLD
15 ..;get patient database data
16 ..S VDATA=$$GET^EASEZC1(IEN,MAP)
17 ..;store link in all 1010EZ elements associated with this file/subfile
18 ..;store patient data in tmp array and link in subfile #712.01; KEY is ien to file #711
19 ..S KEY=0 F S KEY=$O(^TMP("EZINDEX",$J,"A",FILE,SUBF,FLD,KEY)) Q:'KEY D
20 ...S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
21 ...S EASAEL=$P($G(^TMP("EZDATA",$J,KEY,1,1)),U,3)
22 ...I EASAEL D LINKUP^EASEZU1(EASAPP,EASAEL,IEN)
23 ...I 'EASAEL,VDATA'="" D ADD71201^EASEZU1(EASAPP,KEY,IEN,1)
24 Q
25 ;
26SP408 ;get spouse financial data from VistA
27 ;
28 N B,TYPE,MAP,M,MM,NSD,OUT,X,IEN,IENS,KEY,FILE,FF,FFF,FLD,SUBF,SUBIEN,VDATA,WHERE
29 ;get identifying data for database spouse
30 S IENS=$G(INCREL(408,"S",1))
31 Q:IENS=""
32 ;associate each ien with file/subfile
33 S B=0 F FF=408.12,408.13,408.21,408.22 D
34 .S B=B+1,IEN=+$P(IENS,U,B)
35 .Q:'IEN
36 .S (FILE,SUBF)=FF
37 .S FLD=0 F S FLD=$O(^TMP("EZINDEX",$J,"S",FILE,SUBF,FLD)) Q:FLD="" D
38 ..S MAP=FILE_U_SUBF_U_FLD
39 ..;get patient database data
40 ..S VDATA=$$GET^EASEZC1(IEN,MAP)
41 ..;store link in all 1010EZ elements associated with this file/subfile
42 ..;store patient data in tmp array and link in subfile #712.01; KEY is ien to file #711
43 ..S KEY=0 F S KEY=$O(^TMP("EZINDEX",$J,"S",FILE,SUBF,FLD,KEY)) Q:'KEY D
44 ...S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
45 ...S EASAEL=$P($G(^TMP("EZDATA",$J,KEY,1,1)),U,3)
46 ...I EASAEL D LINKUP^EASEZU1(EASAPP,EASAEL,IEN)
47 ...I 'EASAEL,VDATA'="" D ADD71201^EASEZU1(EASAPP,KEY,IEN,1)
48 .;get data in subfile #408.1275
49 .I FILE=408.12 S SUBF=408.1275 S FLD=0 F S FLD=$O(^TMP("EZINDEX",$J,"S",FILE,SUBF,FLD)) Q:FLD="" D
50 ..S SUBIEN=$$I1275^EASEZI(IEN)
51 ..S MAP=FILE_U_SUBF_U_FLD,WHERE=IEN_";"_SUBIEN
52 ..S VDATA=$$GET^EASEZC1(WHERE,MAP)
53 ..;store link in all 1010EZ elements associated with this file/subfile
54 ..;store patient data in tmp array and link in subfile #712.01; KEY is ien to file #711
55 ..S KEY=0 F S KEY=$O(^TMP("EZINDEX",$J,"S",FILE,SUBF,FLD,KEY)) Q:'KEY D
56 ...S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
57 ...S EASAEL=$P($G(^TMP("EZDATA",$J,KEY,1,1)),U,3)
58 ...I EASAEL D LINKUP^EASEZU1(EASAPP,EASAEL,WHERE)
59 ...I 'EASAEL,VDATA'="" D ADD71201^EASEZU1(EASAPP,KEY,WHERE,1)
60 Q
61 ;
62C1N408 ;get child/dependent financial data from VistA
63 N B,PERS,EZ,PT,TYPE,GRP,GRP1,MAP,M,MM,NSD,OUT,X,IEN,IENS,FLD,FF,FFF,FILE,SUBF,SUBIEN,VDATA,WHERE
64 ;
65 ;get identifying data for 1010EZ child dependents
66 K PERS("EZ")
67 S TYPE="CHILD1" S X=$$NSD^EASEZU3(EASAPP,TYPE,1) I X'="" S PERS("EZ",TYPE,1)=X
68 S TYPE="CHILD(N)",M=0,OUT=0 F S M=M+1 D Q:OUT
69 .S X=$$NSD^EASEZU3(EASAPP,TYPE,M)
70 .I X="" S OUT=1 Q
71 .S PERS("EZ",TYPE,M)=X
72 ;
73 ;get identifying data for all database dependents
74 K PERS("PT")
75 S M=0,MM=0 F S M=$O(INCREL(408,"C",M)) Q:'M D
76 .S IEN=+$P(INCREL(408,"C",M),U,2)
77 .S NSD="" F FLD=".01",".09",".03" D
78 ..S FFF="408.13^408.13^"_FLD S X=$$GET^EASEZC1(IEN,FFF)
79 ..I FLD=".09" S X=$$SSNOUT^EASEZT1(X)
80 ..S NSD=NSD_X_U
81 .S MM=MM+1,PERS("PT","CHILD",MM)=NSD,PERS("PT","CHILD",MM,"IENS")=INCREL(408,"C",M)
82 ;
83 ;match each EZ child dependent to database dependent if possible
84 F TYPE="CHILD1","CHILD(N)" S M=0 F S M=$O(PERS("EZ",TYPE,M)) Q:'M D
85 .S EZ=PERS("EZ",TYPE,M)
86 .S MM=0 F S MM=$O(PERS("PT","CHILD",MM)) Q:'MM S PT=PERS("PT","CHILD",MM) D
87 ..I ($P(EZ,U,2,3)=$P(PT,U,2,3))!($$CMORE^EASEZC2(EZ,PT)) D
88 ...S PERS("EZ",TYPE,M,"IENS")=PERS("PT","CHILD",MM,"IENS")
89 ...K PERS("PT","CHILD",MM)
90 ;
91 ;get identifying data for child in database
92 F TYPE="CHILD1","CHILD(N)" S M=0 F S M=$O(PERS("EZ",TYPE,M)) Q:'M D
93 .S IENS=$G(PERS("EZ",TYPE,M,"IENS"))
94 .Q:IENS=""
95 .S GRP=$S(TYPE="CHILD1":"C1",1:"CN")
96 .;associate each ien with file/subfile
97 .S B=0 F FF=408.12,408.13,408.21,408.22 D
98 ..S B=B+1,IEN=+$P(IENS,U,B)
99 ..Q:'IEN
100 ..S (FILE,SUBF)=FF
101 ..S FLD=0 F S FLD=$O(^TMP("EZINDEX",$J,GRP,FILE,SUBF,FLD)) Q:FLD="" D
102 ...S MAP=FILE_U_SUBF_U_FLD
103 ...S GRP1=GRP I EASVRSN>5.99,FILE=408.21,".08;.14;.17"[FLD S GRP1="CN"
104 ...;get patient database data
105 ...S VDATA=$$GET^EASEZC1(IEN,MAP)
106 ...;I FILE=408.21 W !,FLD,?8,TYPE,?18,M,?21,VDATA ;instrumentation for testing
107 ...;store link in all 1010EZ elements associated with this file/subfile
108 ...;store patient data in tmp array and link in subfile #712.01; KEY is ien to file #711
109 ...S KEY=$O(^TMP("EZINDEX",$J,GRP1,FILE,SUBF,FLD,0)) Q:'KEY D
110 ....S MM=M I EASVRSN>5.99,FILE=408.21,".08;.14;.17"[FLD S:(TYPE="CHILD(N)") MM=M+1
111 ....;I FILE=408.21 W !,"*",FLD,?8,TYPE,?18,MM,?21,VDATA ;instrumentation for testing
112 ....S ^TMP("EZDATA",$J,KEY,MM,2)=VDATA
113 ....S EASAEL=$P($G(^TMP("EZDATA",$J,KEY,MM,1)),U,3)
114 ....I EASAEL D LINKUP^EASEZU1(EASAPP,EASAEL,IEN)
115 ....I 'EASAEL,VDATA'="" D ADD71201^EASEZU1(EASAPP,KEY,IEN,1)
116 ..;get data in subfile #408.1275
117 ..I FILE=408.12 S SUBF=408.1275 S FLD=0 F S FLD=$O(^TMP("EZINDEX",$J,GRP,FILE,SUBF,FLD)) Q:FLD="" D
118 ...S SUBIEN=$$I1275^EASEZI(IEN)
119 ...S MAP=FILE_U_SUBF_U_FLD,WHERE=IEN_";"_SUBIEN
120 ...S VDATA=$$GET^EASEZC1(WHERE,MAP)
121 ...;store link in all 1010EZ elements associated with this file/subfile
122 ...;store patient data in tmp array and link in subfile #712.01; KEY is ien to file #711
123 ...S KEY=0 F S KEY=$O(^TMP("EZINDEX",$J,GRP,FILE,SUBF,FLD,KEY)) Q:'KEY D
124 ....S ^TMP("EZDATA",$J,KEY,MM,2)=VDATA
125 ....S EASAEL=$P($G(^TMP("EZDATA",$J,KEY,MM,1)),U,3)
126 ....I EASAEL D LINKUP^EASEZU1(EASAPP,EASAEL,WHERE)
127 ....I 'EASAEL,VDATA'="" D ADD71201^EASEZU1(EASAPP,KEY,WHERE,1)
128 Q
129 ;
130CMORE(EZ,PT) ;
131 ;input EZ = name^ssn^dob of child on 1010EZ
132 ; PT = name^ssn^dob of child in database
133 ;output MATCH = 0, if no match
134 N PSSN,PDOB,ESSN,EDOB,K,MATCH,MATCH1,MATCH2
135 S (MATCH,MATCH1,MATCH2)=0
136 S ESSN=$P(EZ,U,2),EDOB=$P(EZ,U,3),PSSN=$P(PT,U,2),PDOB=$P(PT,U,3)
137 S MATCH1=0 F K=1,2,3,5,6,8,9,10,11 I $P(ESSN,U,K)=$P(PSSN,U,K) S MATCH1=MATCH1+1
138 I $P(EDOB,"/",3)=$P(PDOB,"/",3) S MATCH2=1
139 I MATCH1>7,MATCH2 S MATCH=1
140 Q MATCH
Note: See TracBrowser for help on using the repository browser.