DGRPC2 ;ALB/MRL/SCK/PJR,BAJ - CHECK CONSISTENCY OF PATIENT DATA (CONT) ; 11/20/2005 ;;5.3;Registration;**45,69,108,121,205,218,342,387,470,467,489,505,507,528,451,564,570,657**;Aug 13, 1993;Build 19 ; 43 ;off 44 ;off 45 ;off 46 ;off 47 ;off S DGLST=$S(DGCHK[",47,":47,DGCHK[",46,":46,DGCHK[",45,":45,DGCHK[",44,":44,1:DGLST) D NEXT G @DGLST 48 I DGVT S DGD=DGP(.362) I DGCHK[(",48,"),($P(DGD,"^",17)="Y"),($P(DGD,"^",6)="") S X=48 D COMB D NEXT G @DGLST 49 ; 50 ; insurance checks I DGCHK[",49,"!(DGCHK[",50,") D S DGLST=$S(DGCHK["50":50,1:49) . N COV,INS,X . S X=0,COV=$S($P(DGP(.31),"^",11)="Y":1,1:0) . S INS=$$INSUR^IBBAPI(DFN,DT,"R") . I COV,'INS S X=49 ; yes, but none . I 'COV,INS S X=50 ; not yes, but some . I DGCHK[(","_X_",") D COMB D NEXT G @DGLST 51 D NEXT G @DGLST ; 51 disabled S X=$S($D(^DIC(21,+$P(DGP(.32),"^",3),0)):$P(^(0),"^",3),1:"") I X="Z"&($P(DGP(.32),"^",5)'=7)&($P(DGP(.32),"^",10)'=7)&($P(DGP(.32),"^",15)'=7)!($P(DGP(.32),"^",5)=7&(X'="Z")) S X=51 D COMB ; 52 I $P(DGP(.31),"^",11)']"" S X=52 D COMB ;automatically on D NEXT G @DGLST 53 I $P(DGP(.311),"^",15)']"" S X=53 D COMB ;automatically on D NEXT G @DGLST 54 ; 55 ;BELOW IS USED BY BOTH 54 & 55 S DGLST=$S(DGCHK["55":55,1:54) I $G(^DPT(DFN,.35)),(^(.35)<+($E(DT,1,3)_"0000")) D NEXT G @DGLST ; patient died before current year N DGE S DGE=+$O(^DIC(8.1,"B","SERVICE CONNECTED 50% to 100%",0)) I $P($G(^DPT(DFN,.3)),U,2)'<50!($P($G(^DIC(8,+$G(^DPT(DFN,.36)),0)),U,9)=DGE) D NEXT G @DGLST ;50-100% SC S DGPTYP=$G(^DG(391,+DGP("TYPE"),"S")),DGISYR=$E(DT,1,3)-1_"0000" I '$P(DGPTYP,"^",8)&('$P(DGPTYP,"^",9)) K DGPTYP,DGISYR D NEXT G @DGLST ; screens 8 and 9 off D ALL^DGMTU21(DFN,"VSD",DT,"IP") I '$P(DGPTYP,"^",8)!(DGCHK'["54") G JUST55 ; screen 8 off OR JUST 55 IN CHK S DGFL=0 I $D(DGREL("S")),($$SSN^DGMTU1(+DGREL("S"))']"") S DGFL=1 I 'DGFL F I=0:0 S I=$O(DGREL("D",I)) Q:'I I $$SSN^DGMTU1(+DGREL("D",I))']"" S DGFL=1 Q I DGFL S X=54 D COMB JUST55 I DGCHK'["55" D NEXT G @DGLST S DGLST=55 I '$P(DGPTYP,"^",9) D NEXT G @DGLST ; screen 9 off D TOT^DGRP9(.DGINC) S DGFL=0 F DGD="V","S","D" I $D(DGTOT(DGD)) F I=8:1:17 I $P(DGTOT(DGD),"^",I)]"" S DGFL=1 Q I 'DGFL N DGAPD,DG55 D I 'DGAPD&('DG55) S X=55 D COMB . S DGAPD=+$$LST^DGMTU(DFN),DGAPD=+$P($G(^DGMT(408.31,+DGAPD,0)),U,11) . S DG55=$$CHECK55(DFN) ; **507, Additional Income Checks D NEXT G @DGLST 56 I DGVT S DGD=DGP(.3) I DGCHK[(",56,"),($P(DGD,"^",11)="Y"),($P(DGP(.362),"^",20)="") S X=56 D COMB D NEXT G END^DGRPC3:$S('+DGLST:1,+DGLST=99:1,1:0) G @DGLST 57 I $P(DGP(.38),U,1) D .N X1,X2 .S X1=$P(DGP(.38),U,2) .S X=$P($G(^DG(43,1,0)),U,46) S X2=$S(X:X,1:365) D C^%DTC .I X