AGCVT6 ; IHS/ASDS/EFG - ONE TIME, EXPORT PATIENTS WITH MEDICAID COVERAGE ;
;;7.1;PATIENT REGISTRATION;;AUG 25,2005
W !,"IF YOU ARE SURE YOU WANT TO RUN THIS ROUTINE",!!,"PLEASE ENTER AT 'ENTRY', I.E. 'D ENTRY^AGCVT6'.",! Q
CHKHRN S DUZ2=DUZ(2)
Q:$D(^AUPNPAT(DFN,41,DUZ2)) S DUZ2=0 F J=0:0 S DUZ2=$O(^(DUZ2)) Q:'+DUZ2 Q:$P(^AUPNPAT(DFN,41,DUZ2,0),U,2)]""
Q
ENTRY ;EP
W $$S^AGVDF("IOF"),!!?5,"THIS REGISTRATION UTILITY READS THRU THE 'B' INDEX OF THE",!!?5,"MEDICAID ELIGIBLE FILE (^AUPNMCD), AND SETS ^AGPATCH SO MEDICAID",!!?5,"ELIGIBLE PATIENTS ARE EXPORTED DURING THE NEXT REGISTRATION EXPORT.",!!
W ?5,"THE ENTRIES IN ^AGPATCH WILL BE YESTERDAY'S DATE SO YOU CAN RUN",!?5,"THIS ROUTINE AND THE EXPORT ON THE SAME DATE.",!!
W ?10,"DO YOU WANT TO CONTINUE? (Y/N) N // " D READ G END:$D(DLOUT)!$D(DUOUT)!$D(DFOUT)!$D(DTOUT)!("Nn"[$E(Y)),ENTRY:$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("A") G:+Y<0 END S (DUZ2,DUZ(2))=+Y
QUE W !!,"Do you want to q this process? (Y/N) Y // " D READ S Y=$E(Y_"Y") G END:$D(DTOUT)!$D(DFOUT),FACILITY:$D(DUOUT),START:Y="N" I $D(DQOUT)!("YN"'[Y) W !!,*7,"You can 'q' this process to TaskMan to run at another time.",! G QUE
DEV X ^%ZOSF("UCI") S ZTRTN="START^AGCVT6",ZTUCI=Y,ZTIO="",ZTDESC="Set AGPATCH to export all MEDICAID eligibles." S ZTSAVE=""
D ^%ZTLOAD G:'$D(ZTSK) QUE W !!,"Task Number = ",ZTSK,!!,"Press RETURN..." D READ K G,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK,ZTUCI D ^%ZISC Q
START ;EP - TaskMan.
I '$D(AGDATE) S %DT="",X="T-1" D ^%DT S AGDATE=Y
S AGTOTAL=0 I '$D(ZTQUEUED) W !! S IOP=ION D ^%ZIS,WAIT^DICD S DX=$X,DY=$Y+1
F DFN=0:0 S DFN=$O(^AUPNMCD("B",DFN)) Q:'DFN D CHKHRN I +DUZ2,'$D(^AGPATCH(AGDATE,DUZ2,DFN)) S ^(DFN)="",AGTOTAL=AGTOTAL+1 I '$D(ZTQUEUED) X XY W AGTOTAL
I '$D(ZTQUEUED) W " MEDICAID's added to ^AGPATCH."
END K %DT,AGDATE,DFN,DFOUT,DLOUT,DQOUT,DTOUT,DUOUT,DUZ2,DX,DY,J,AGTOTAL,X,XY,Y D:$D(ZTQUEUED) KILL^%ZTLOAD
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
;It reads thru the 'B' index of the MEDICAID ELIGIBLE
;file (^AUPNMCD) to look for patients who are eligible for
;MEDICAID, flag them for inclusion with next export, to ensure
;eligibile patients are recorded at DPSC.
; RPMS/GTH
TEST S AGDATE=2890325 K ^AGPATCH(AGDATE) G ENTRY
AGCVT6 ; IHS/ASDS/EFG - ONE TIME, EXPORT PATIENTS WITH MEDICAID COVERAGE ;
+1 ;;7.1;PATIENT REGISTRATION;;AUG 25,2005
+2 WRITE !,"IF YOU ARE SURE YOU WANT TO RUN THIS ROUTINE",!!,"PLEASE ENTER AT 'ENTRY', I.E. 'D ENTRY^AGCVT6'.",!
QUIT
CHKHRN SET DUZ2=DUZ(2)
+1 IF $DATA(^AUPNPAT(DFN,41,DUZ2))
QUIT
SET DUZ2=0
FOR J=0:0
SET DUZ2=$ORDER(^(DUZ2))
IF '+DUZ2
QUIT
IF $PIECE(^AUPNPAT(DFN,41,DUZ2,0),U,2)]""
QUIT
+2 QUIT
ENTRY ;EP
+1 WRITE $$S^AGVDF("IOF"),!!?5,"THIS REGISTRATION UTILITY READS THRU THE 'B' INDEX OF THE",!!?5,"MEDICAID ELIGIBLE FILE (^AUPNMCD), AND SETS ^AGPATCH SO MEDICAID",!!?5,"ELIGIBLE PATIENTS ARE EXPORTED DURING THE NEXT REGISTRATION EXPORT.",!!
+2 WRITE ?5,"THE ENTRIES IN ^AGPATCH WILL BE YESTERDAY'S DATE SO YOU CAN RUN",!?5,"THIS ROUTINE AND THE EXPORT ON THE SAME DATE.",!!
+3 WRITE ?10,"DO YOU WANT TO CONTINUE? (Y/N) N // "
DO READ
IF $DATA(DLOUT)!$DATA(DUOUT)!$DATA(DFOUT)!$DATA(DTOUT)!("Nn"[$EXTRACT(Y))
GOTO END
IF $DATA(DQOUT)!("Yy"'[$EXTRACT(Y))
GOTO ENTRY
USER WRITE !!
SET DIC="^VA(200,"
SET DIC("A")="Who are you?"
SET DIC(0)="AEFMNQ"
DO ^DIC
IF +Y<0
GOTO END
SET DUZ=+Y
FACILITY WRITE !!
SET DIC="^AUTTLOC("
SET DIC(0)="QAZEM"
SET DIC("A")="Set MEDICAID export for which FACILITY? "
DO ^DIC
KILL DIC("A")
IF +Y<0
GOTO END
SET (DUZ2,DUZ(2))=+Y
QUE WRITE !!,"Do you want to q this process? (Y/N) Y // "
DO READ
SET Y=$EXTRACT(Y_"Y")
IF $DATA(DTOUT)!$DATA(DFOUT)
GOTO END
IF $DATA(DUOUT)
GOTO FACILITY
IF Y="N"
GOTO START
IF $DATA(DQOUT)!("YN"'[Y)
WRITE !!,*7,"You can 'q' this process to TaskMan to run at another time.",!
GOTO QUE
DEV XECUTE ^%ZOSF("UCI")
SET ZTRTN="START^AGCVT6"
SET ZTUCI=Y
SET ZTIO=""
SET ZTDESC="Set AGPATCH to export all MEDICAID eligibles."
SET ZTSAVE=""
+1 DO ^%ZTLOAD
IF '$DATA(ZTSK)
GOTO QUE
WRITE !!,"Task Number = ",ZTSK,!!,"Press RETURN..."
DO READ
KILL G,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK,ZTUCI
DO ^%ZISC
QUIT
START ;EP - TaskMan.
+1 IF '$DATA(AGDATE)
SET %DT=""
SET X="T-1"
DO ^%DT
SET AGDATE=Y
+2 SET AGTOTAL=0
IF '$DATA(ZTQUEUED)
WRITE !!
SET IOP=ION
DO ^%ZIS
DO WAIT^DICD
SET DX=$X
SET DY=$Y+1
+3 FOR DFN=0:0
SET DFN=$ORDER(^AUPNMCD("B",DFN))
IF 'DFN
QUIT
DO CHKHRN
IF +DUZ2
IF '$DATA(^AGPATCH(AGDATE,DUZ2,DFN))
SET ^(DFN)=""
SET AGTOTAL=AGTOTAL+1
IF '$DATA(ZTQUEUED)
XECUTE XY
WRITE AGTOTAL
+4 IF '$DATA(ZTQUEUED)
WRITE " MEDICAID's added to ^AGPATCH."
END KILL %DT,AGDATE,DFN,DFOUT,DLOUT,DQOUT,DTOUT,DUOUT,DUZ2,DX,DY,J,AGTOTAL,X,XY,Y
IF $DATA(ZTQUEUED)
DO KILL^%ZTLOAD
+1 QUIT
READ KILL DFOUT,DTOUT,DUOUT,DQOUT,DLOUT
READ Y:$SELECT($DATA(DTIME):DTIME,1:300)
IF '$TEST
WRITE *7
READ Y:5
IF Y="."
GOTO READ
IF '$TEST
SET (DTOUT,Y)=""
QUIT
+1 IF Y="/.,"
SET (DFOUT,Y)=""
IF Y=""
SET DLOUT=""
IF Y="^"
SET (DUOUT,Y)=""
IF Y?1"?".E!(Y["^")
SET (DQOUT,Y)=""
+2 QUIT
+1 ;It reads thru the 'B' index of the MEDICAID ELIGIBLE
+2 ;file (^AUPNMCD) to look for patients who are eligible for
+3 ;MEDICAID, flag them for inclusion with next export, to ensure
+4 ;eligibile patients are recorded at DPSC.
+5 ; RPMS/GTH
TEST SET AGDATE=2890325
KILL ^AGPATCH(AGDATE)
GOTO ENTRY