source: FOIAVistA/trunk/r/INCOME_VERIFICATION_MATCH-IVM/IVMZ7CR.m@ 1492

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

initial load of FOIAVistA 6/30/08 version

File size: 9.5 KB
Line 
1IVMZ7CR ;BAJ,ERC - HL7 Z07 CONSISTENCY CHECKER -- REGISTRATION SUBROUTINE ; 12/6/07 8:51am
2 ;;2.0;INCOME VERIFICATION MATCH;**105,127**;JUL 8,1996;Build 6
3 ;
4 ; Registration Consistency Checks
5 Q ; Entry point must be specified
6EN(DFN,DGP,DGSD) ;Entry point
7 ; input: DFN - Patient IEN
8 ; DGP - Patient data array
9 ; DGSD - Spouse and Dependent data array
10 ; output: ^TMP($J,DFN,RULE) global
11 ; DFN - Patient IEN
12 ; RULE - Consistency rule #
13 ;initialize variables
14 N RULE,Y,X,FILERR,SPDEP
15 S SPDEP=$D(DGSD("DEP"))
16 ; we do not count through all numbers to save routine space
17 F RULE=4,7,9,11,13,15,16,19,24,29:1:31,34,60,72,74,75,76,78,81,83,85,86 I $D(^DGIN(38.6,RULE)) D
18 . I $$ON(RULE) D @RULE
19 I $D(FILERR) M ^TMP($J,DFN)=FILERR
20 Q
214 ; DOB UNSPECIFIED
22 ; Note: RULE #302 in IVMZ7CD is a duplicate of this rule
23 N RIEN
24 I $P($G(DGP("PAT",0)),U,3)="" S FILERR(RULE)=""
25 I 'SPDEP Q
26 S RIEN=0 F S RIEN=$O(DGSD("DEP",RIEN)) Q:RIEN="" D
27 . I $P(DGSD("DEP",RIEN,0),U,3)="" S FILERR(RULE)=""
28 Q
297 ; SSN UNSPECIFIED
30 ; Note: RULE #305 in IVMZ7CD is a duplicate of this rule
31 I $P($G(DGP("PAT",0)),U,9)="" S FILERR(RULE)=""
32 Q
339 ; VETERAN STATUS UNSPECIFIED
34 I $P($G(DGP("PAT","VET")),U)="" S FILERR(RULE)=""
35 Q
3611 ; SC PROMPT INCONSISTENT
37 N VET,SC,PTYPE
38 ; If VET Status is not specified (RULE 9) no need for this test
39 Q:$P($G(DGP("PAT","VET")),U)=""
40 S VET=$P(DGP("PAT","VET"),U,1)="Y",SC=$P(DGP("PAT",.3),U,1)="Y"
41 I 'VET,SC S FILERR(RULE)=""
42 Q
4313 ; POS UNSPECIFIED
44 ; Note: Rule #413 IN IVMZ7CE is a duplicate of this rule
45 Q:$P($G(DGP("PAT","VET")),U,1)'="Y"
46 ; Make sure that the value in the field is valid -- DGRPC does this as well
47 I '$D(^DIC(21,+$P(DGP("PAT",.32),U,3),0)) S FILERR(RULE)=""
48 Q
4915 ; INEL REASON UNSPECIFIED
50 ; Note: Rule #404 IN IVMZ7CE is a duplicate of this rule
51 I $P(DGP("PAT",.15),U,2),$P($G(DGP("PAT",.3)),U,7)="" S FILERR(RULE)=""
52 Q
5316 ; DATE OF DEATH IN FUTURE
54 ; Note: Rule #308 IN IVMZ7CD is a duplicate of this rule
55 S X=$P($G(DGP("PAT",.35)),U) I X']"" Q
56 ; Compare DOD to right now
57 I X>$$DT^XLFDT S FILERR(RULE)=""
58 Q
5919 ; ELIG/NONVET STAT INCONSISTENT
60 ; Note: Rule #405 in IVMZ7CE is a duplicate of this rule
61 N VET,ELIG,FILE8,FILE81,MPTR,MTYPE,PTYPE
62 ; Patient's VET status
63 S VET=$P($G(DGP("PAT","VET")),U,1) I VET="" S FILERR(RULE)="" Q
64 ; do this check for NON-VET status only
65 Q:VET="Y"
66 ; Check PT type to see if we skip VET checks
67 S PTYPE=$P($G(DGP("PAT","TYPE")),U,1)
68 I PTYPE]"",$P(^DG(391,PTYPE,0),U,2) Q
69 ; Eligibility Code
70 S ELIG=$P($G(DGP("PAT",.36)),U,1) I ELIG="" S FILERR(RULE)="" Q
71 ;start in File #8
72 S FILE8=$G(^DIC(8,ELIG,0)) I FILE8="" S FILERR(RULE)="" Q
73 ;using the pointer value in field #8 (node 0; piece 9)
74 S MPTR=$P(FILE8,U,9)
75 ;find the record in File #8.1
76 S FILE81=$G(^DIC(8.1,MPTR,0)) I FILE81="" S FILERR(RULE)="" Q
77 ;check the Type field #4 (node 0; piece 5).
78 S MTYPE=$P(FILE81,U,5)
79 ; Pt's VET status must match NON-VET Status of Eligibility Code
80 I VET'=MTYPE S FILERR(RULE)=""
81 Q
8224 ; POS/ELIG CODE INCONSISTENT
83 ; Note: Rule #412 in IVMZ7CE is a duplicate of this rule
84 I '$D(^DIC(21,+$P(DGP("PAT",.32),U,3),"E",+$P(DGP("PAT",.36),U,1))) S FILERR(RULE)=""
85 Q
8629 ; A&A CLAIMED, NONVET
87 I $P(DGP("PAT","VET"),U,1)'="Y",$P($G(^DPT(DFN,.362)),U,12)="Y" S FILERR(RULE)=""
88 Q
8930 ; HOUSEBOUND CLAIMED, NONVET
90 I $P(DGP("PAT","VET"),U,1)'="Y",$P($G(^DPT(DFN,.362)),U,13)="Y" S FILERR(RULE)=""
91 Q
9231 ; VA PENSION CLAIMED, NONVET
93 I $P(DGP("PAT","VET"),U,1)'="Y",$P($G(^DPT(DFN,.362)),U,14)="Y" S FILERR(RULE)=""
94 Q
9534 ; POW CLAIMED, NONVET
96 I $P(DGP("PAT","VET"),U,1)'="Y",$P($G(^DPT(DFN,.52)),U,5)="Y" S FILERR(RULE)=""
97 Q
9860 ; AGENT ORANGE EXP LOC MISSING
99 ; Note: Rule #512 in IVMZ7CS is a duplicate of this rule.
100 I $P(DGP("PAT",.321),U,2)="Y",$P(DGP("PAT",.321),U,13)="" S FILERR(RULE)=""
101 Q
10272 ; MSE DATA MISSING/INCOMPLETE, turned off with DG*5.3*765
103 ; Note: Rule #513 in IVMZ7CS is a duplicate of this rule.
104 N I,X
105 S X=DGP("PAT",.32)
106 F I=4,5,8 I $P(X,U,I)'="",'$$YY^IVMZ7CS($P(X,U,6)) S FILERR(RULE)="" Q ;LAST
107 F I=9,10,13 I $P(X,U,I)'="",'$$YY^IVMZ7CS($P(X,U,11)) S FILERR(RULE)="" Q ;NTL
108 F I=14,15,18 I $P(X,U,I)'="",'$$YY^IVMZ7CS($P(X,U,11)) S FILERR(RULE)="" ;NNTL
109 Q
110 ;
11174 ; CONFLICT DT MISSING/INCOMPLETE, turned off with DG*5.3*765
112 ; Note:#515 IVMZ7CS is a duplicate, turned off with DG*5.3*771
11375 ; ALSO # 75 CONFLICT TO DT BEFORE FROM DT
11476 ; # 76 INACCURATE CONFLICT DATE, turned off with DG*5.3*771
115 ;
116 N I,T,FROM,TO,NODE,PCE,PCEFR,PCETO,CONFL,RANGE,RFR,RTO,RNGE,ERR,COM,ON74,ON75,ON76
117 S ON74=$$ON(74),ON75=$$ON(75),ON76=$$ON(76)
118 S I=$$RANGE^DGMSCK() ; load range table
119 F I=1:1 S CONFL=$P($T(CONLIST+I),";;",3) Q:CONFL="QUIT" D
120 . ;we have to have a flag ERR because we don't want multiple
121 . ;inconsistencies on a single conflict but we do want to
122 . ;flag a single inconsistency on multiple conflicts
123 . S ERR=0
124 . S NODE=$P(CONFL,U,1),PCE=$P(CONFL,U,2),PCEFR=$P(CONFL,U,3),PCETO=$P(CONFL,U,4)
125 . S RNGE=$P(CONFL,U,5)
126 . Q:$P(DGP("PAT",NODE),U,PCE)'="Y"
127 . S FROM=$P(DGP("PAT",NODE),U,PCEFR),TO=$P(DGP("PAT",NODE),U,PCETO)
128 . ; check rule 74 CONFLICT DT MISSING/INCOMPLETE
129 . I ON74,(RULE=74) F T=FROM,TO I '$$YM^IVMZ7CS(T) S FILERR(RULE)="",ERR=1
130 . Q:ERR
131 . ; check rule 75 CONFLICT TO DT BEFORE CONFLICT FROM DT
132 . I ON75,(RULE=75),(FROM>TO) S FILERR(RULE)="",ERR=1
133 . Q:ERR
134 . ; check rule 76 INACCURATE CONFLICT DATE
135 . Q:ERR
136 . Q:'$D(RANGE(RNGE)) ; can't calculate if range table is missing
137 . ; determine whether dates are withing conflict range
138 . S RFR=$P(RANGE(RNGE),U,1),RTO=$P(RANGE(RNGE),U,2)
139 . I ON76,(RULE=76) D
140 . . I '((RFR'>FROM)&((RTO'<TO))) S FILERR(RULE)=""
141 Q
14278 ; INACCURATE COMBAT DT/LOC, turned off with DG*5.3*771
143 N I,T,FROM,TO,RULE,NODE,PCE,PCEFR,PCETO,CONFL,RANGE,RFR,RTO,RNGE,ERR,COM,ON78,LOC
144 ; This tag checks COMBAT status and verifies that valid FROM & TO dates are found
145 S RULE=78
146 I '$$ON(RULE) Q
147 S I=$$RANGE^DGMSCK() ; load range table
148 F I=1:1 S CONFL=$P($T(COMLIST+I),";;",3) Q:CONFL="QUIT" D
149 . S NODE=$P(CONFL,U,1),PCE=$P(CONFL,U,2),PCEFR=$P(CONFL,U,3),PCETO=$P(CONFL,U,4)
150 . S RNGE=$P(CONFL,U,5)
151 . ; if we have COMBAT data, get Service Location info, it comes under a different rule
152 . Q:$P(DGP("PAT",NODE),U,PCE)'="Y"
153 . S RNGE=$$COMPOW^DGRPMS($P(DGP("PAT",.52),U,12)) I $G(RNGE)="" S FILERR(RULE)="" Q
154 . S FROM=$P(DGP("PAT",NODE),U,PCEFR),TO=$P(DGP("PAT",NODE),U,PCETO)
155 . ; determine whether Pt dates are within conflict range for specified location
156 . S RFR=$P(RANGE(RNGE),U,1),RTO=$P(RANGE(RNGE),U,2)
157 . I '(RFR'>FROM&((FROM'>RTO)&((RTO'<TO)&((TO'<RFR))))) S FILERR(RULE)=""
158 Q
15981 ; COMBAT DT NOT WITHIN MSE, turned off with DG*5.3*765
160 ; this code is copied from DGRP3
161 ; MSFROMTO^DGMSCK creates a block for a continual MSE
162 N MSE,MSECHK,MSESET,ANYMSE,DGP81
163 I '$P($G(DGP("PAT",.52)),U,12) Q
164 ;
165 ; we're calling into DG Legacy code so we have to modify some arrays
166 M DGP81=DGP K DGP
167 M DGP=DGP81("PAT")
168 ; set up the check
169 S:'$G(MSECHK) MSECHK=$$MSCK^DGMSCK S:'$G(MSESET) MSESET=$$MSFROMTO^DGMSCK
170 ; If COMBAT, but no MSE, then Range is NOT within MSE
171 I '$G(ANYMSE) D Q
172 . S FILERR(RULE)=""
173 . K DGP M DGP=DGP81
174 I '$$RWITHIN^DGRPDT($P(MSESET,U,1),$P(MSESET,U,2),$P($G(DGP81("PAT",.52)),U,13),$P($G(DGP81("PAT",.52)),U,14)) S FILERR(RULE)=""
175 K DGP M DGP=DGP81
176 Q
177 ;
17883 ; BOS REQUIRES DATE W/IN WWII
179 ; this code is copied from DGRP3
180 N BOS,BOSN,MS,MSE,DGP83
181 Q:'$D(DGP("PAT",.32))
182 ; we're calling into DG Legacy code so we have to modify some arrays
183 M DGP83=DGP K DGP
184 M DGP=DGP83("PAT")
185 F MS=1:1:3 D
186 . I MS=2,$P(DGP83("PAT",.32),U,19)'="Y" Q
187 . I MS=3,$P(DGP83("PAT",.32),U,20)'="Y" Q
188 . S BOS=$P(DGP83("PAT",.32),U,(5*MS)) Q:'BOS S BOSN=$P($G(^DIC(23,BOS,0)),U)
189 . S MSE=$P("MSL^MSNTL^MSNNTL",U,MS)
190 . I $$BRANCH^DGRPMS(BOS_U_BOSN),'$$WWII^DGRPMS(DFN,"",MSE) S FILERR(RULE)=""
191 ; fix the arrays before we leave
192 K DGP M DGP=DGP83
193 Q
19485 ; FILIPINO VET SHOULD BE VET='Y'
195 ; this code is copied from DGRP3
196 N MS,BOS,FV,FILV,NOTFV,MSE,RULE2,DGVT,DGP85
197 Q:'$D(DGP("PAT",.32))
198 ; we're calling into DG Legacy code so we have to modify some arrays
199 S DGVT=$P($G(DGP("PAT","VET")),U)="Y"
200 M DGP85=DGP K DGP
201 M DGP=DGP85("PAT")
202 S RULE2=86 ; will also check RULE #86 INEL FIL VET SHOULD BE VET='N'
203 F MS=1:1:3 D
204 . I MS=2,$P(DGP85("PAT",.32),U,19)'="Y" Q
205 . I MS=3,$P(DGP85("PAT",.32),U,20)'="Y" Q
206 . S BOS=$P(DGP85("PAT",.32),U,(5*MS)),FV=$$FV^DGRPMS(BOS) I 'FV S NOTFV="" Q
207 . S MSE=$P("MSL^MSNTL^MSNNTL",U,MS)
208 . I '$$WWII^DGRPMS(DFN,"",MSE) S FILV("I")="" Q
209 . I FV=2 S FILV("E")="" Q
210 . I $P(DGP85("PAT",.321),U,14)=""!($P(DGP85("PAT",.321),U,14)="NO") S FILV("I")="" Q
211 . S FILV("E")=""
212 I $D(FILV) D
213 . I DGVT'=1,$D(FILV("E")) S FILERR(RULE)=""
214 . I DGVT=1,'$D(NOTFV),'$D(FILV("E")),$D(FILV("I")) S FILERR(RULE2)=""
215 ; fix the arrays before we leave
216 K DGP M DGP=DGP85
217 Q
21886 ; INEL FIL VET SHOULD BE VET='N'
219 ; This rule is satisfied in #85 above
220 Q
221ON(RULE) ;verify RULE is turned on
222 N ON,Y
223 S ON=0
224 S Y=^DGIN(38.6,RULE,0)
225 I '$P(Y,U,5),$P(Y,U,6) S ON=1
226 Q ON
227CONLIST ;;CONFLICT;;NODE^PIECE^FROM^TO^RANGE -- offset list, do not add comments
228 ;;VIETNAM;;.321^1^4^5^VIET
229 ;;LEBANON;;.322^1^2^3^LEB
230 ;;GRENADA;;.322^4^5^6^GREN
231 ;;PANAMA;;.322^7^8^9^PAN
232 ;;PERSIAN GULF;;.322^10^11^12^GULF
233 ;;SOMALIA;;.322^16^17^18^SOM
234 ;;YUGOSLAVIA;;.322^19^20^21^YUG
235 ;;QUIT;;QUIT
236COMLIST ;;COMBAT;;NODE^PIECE^FROM^TO^RANGE -- offset list, do not add comments
237 ;;WWI;;.52^11^13^14^WWI
238 ;;WWIIE;;.52^11^13^14^WWIIE
239 ;;WWIIP;;.52^11^13^14^WWIIP
240 ;;KOREA;;.52^11^13^14^KOR
241 ;;OTHER;;.52^11^13^14^OTHER
242 ;;VIETNAM;;.52^11^13^14^VIET
243 ;;LEBANON;;.52^11^13^14^LEB
244 ;;GRENADA;;.52^11^13^14^GREN
245 ;;PANAMA;;.52^11^13^14^PAN
246 ;;PERSIAN GULF;;.52^11^13^14^GULF
247 ;;SOMALIA;;.52^11^13^14^SOM
248 ;;YUGOSLAVIA;;.52^11^13^14^YUG
249 ;;QUIT;;QUIT
Note: See TracBrowser for help on using the repository browser.