Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: AGFIX7A

AGFIX7A.m

Go to the documentation of this file.
AGFIX7A ; IHS/ASDS/EFG - FIX MEDICAID ELIGIBLE FILE ; 
 ;;7.0;IHS PATIENT REGISTRATION;;MAR 28, 2003
 W !,"IF YOU ARE SURE YOU WANT TO RUN THIS ROUTINE",!!,"PLEASE ENTER AT 'START', I.E. 'D START^AGFIX7A'.",!
 Q
START I '$D(DT) S %DT="",X="T" D ^%DT S DT=Y K %DT
 S AGTOTAL=0
MSG S:'$D(DTIME) DTIME=300 W $$S^AGVDF("IOF")
 W !?31,"***   AGFIX7A   ***"
 W !!?5,"THIS REGISTRATION UTILITY READS THRU THE 'B' INDEX OF THE",!!?5,"MEDICAID ELIGIBLE FILE (^AUPNMCD), REMOVES ALL NON-NUMERIC CHARACTERS",!!?5,"FROM THE M'CAID ELIGIBILITY NUMBERS,"
 W !!?5,"AND SETS ^AGPATCH SO THE CORRECTED PATIENTS ARE EXPORTED DURING"
 W !!?5,"THE NEXT REGISTRATION EXPORT.",!!?5,"note:  THE 'AB' INDEX IS KILLED AND REBUILT DURING THE PROCESS",!!!?10,"DO YOU WANT TO CONTINUE? (Y/N)  N // "
 D READ G END:$D(DLOUT)!$D(DUOUT)!$D(DFOUT)!$D(DTOUT)!("Nn"[$E(Y)),MSG:$D(DQOUT)!("Yy"'[$E(Y))
USER W !! S DIC="^VA(200,",DIC("A")="Who are you?",DIC(0)="AEFMNQ" D ^DIC G:+Y<0 END S DUZ=+Y
FACILITY W !! S DIC="^AUTTLOC(",DIC(0)="QAZEM",DIC("A")="Set MEDICAID export for which FACILITY? " D ^DIC K DIC G:+Y<0 END S (DUZ2,DUZ(2))=+Y
QUE W !!,"Do you want to q this process? (Y/N)  Y // " D READ G END:$D(DTOUT)!$D(DFOUT),FACILITY:$D(DUOUT) S Y=$E(Y_"Y") I $D(DQOUT)!("YN"'[Y) W !!,*7,"You can 'q' this process to TaskMan to run at another time.",! G QUE
 I Y="N" G ENTRY
DEV X ^%ZOSF("UCI") S ZTRTN="ENTRY^AGFIX7A",ZTUCI=Y,ZTIO="",ZTDESC="Check MCAID Accounts, non-numerics, for "_$P(^AUTTLOC(DUZ(2),0),U,2)_"." S ZTSAVE=""
 D ^%ZTLOAD G:'$D(ZTSK) QUE W !!,"Task Number = ",ZTSK,!!,"Press RETURN..." R Y:DTIME K AG,AGIO,AGQIO,G,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK,ZTUCI D ^%ZISC Q
ENTRY ; EP - TaskMan.
 I '$D(ZTQUEUED) W !! S IOP=ION D ^%ZIS,WAIT^DICD S DX=$X,DY=$Y+1
 S (AGTOTAL,DFN)=0
DFN ;
 S DFN=$O(^AUPNMCD("B",DFN)) G:+DFN<1 END1
 S IEN=0
IEN ;
 S IEN=$O(^AUPNMCD("B",DFN,IEN)) G:+IEN<1 DFN
 I '$D(^AUPNMCD(IEN,0)) K ^AUPNMCD("B",DFN,IEN) G IEN
 S AGST=$P(^AUPNMCD(IEN,0),U,4),AGACCT=$P(^(0),U,3)
 I 'AGST!('$L(AGACCT)) G IEN
 S ^AUPNMCD("AB",DFN,AGST,AGACCT,IEN)=""
 I AGACCT?1N.N G IEN
 S AG("STATE")=$P(^DIC(5,AGST,0),U,2) I AG("STATE")'="NM"&(AG("STATE")'="AZ") G IEN
 S AGNEWNUM="" F I=1:1:$L(AGACCT) I $E(AGACCT,I)?1N S AGNEWNUM=AGNEWNUM_$E(AGACCT,I)
 I '$L(AGNEWNUM) G IEN
 K ^AUPNMCD("AB",DFN,AGST,AGACCT,IEN)
 S $P(^AUPNMCD(IEN,0),U,3)=AGNEWNUM,^AUPNMCD("AB",DFN,AGST,AGNEWNUM,IEN)="",AGTOTAL=AGTOTAL+1
 D NOW^%DTC S AGDTS=%
 S:'$D(^AGPATCH(AGDTS,DUZ(2),DFN)) ^AGPATCH(AGDTS,DUZ(2),DFN)=""
 G IEN
END1 I '$D(ZTQUEUED) W !,AGTOTAL," records changed.",!
 F D=0:0 S D=$O(^AUPNMCD("AB",D)) Q:'D  F S=0:0 S S=$O(^AUPNMCD("AB",D,S)) Q:'S  S A="" F I=0:0 S A=$O(^AUPNMCD("AB",D,S,A)) Q:A=""  F IEN=0:0 S IEN=$O(^AUPNMCD("AB",D,S,A,IEN)) Q:'IEN  I '$D(^AUPNMCD(IEN,0)) K ^AUPNMCD("AB",D,S,A,IEN)
END K %DT,A,AGACCT,AG,D,AGDATE,DFN,DFOUT,DLOUT,DQOUT,DTOUT,DUOUT,DUZ2,DX,DY,IEN,AGNEWNUM,S,AGTOTAL,X,XY,Y,AGST,AGDTS
 Q
READ K DFOUT,DTOUT,DUOUT,DQOUT,DLOUT R Y:$S($D(DTIME):DTIME,1:300) I '$T W *7 R Y:5 G READ:Y="." I '$T S (DTOUT,Y)="" Q
 S:Y="/.," (DFOUT,Y)="" S:Y="" DLOUT="" S:Y="^" (DUOUT,Y)="" S:Y?1"?".E!(Y["^") (DQOUT,Y)=""
 Q
COMMENT ; This routine is a one-time-only run.
 ; It reads thru the 'B' index of the MEDICAID ELIGIBLE
 ; file (^AUPNMCD) to look for patients who are eligible for MEDICAID,
 ; fix their eligibility numbers if necessary, and
 ; flag them for inclusion with next export.
 ;                                    RPMS/GTH