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

AGMCRP3.m

Go to the documentation of this file.
AGMCRP3 ; IHS/ASDS/EFG - PRINT ALPHA LIST OF MEDICARE/RAILROAD HOLDERS ;   
 ;;7.1;PATIENT REGISTRATION;**14**;AUG 25,2005;Build 1
 ;
 ;IHS/OIT/NKD AG*7.1*14 MBI PHASE 2
 ;
 S AGIO=IO,AG("HAT")=""
PTS ;
 S DIR(0)="S^B:ALL BENEFICIARIES;A:ACTIVE PATIENTS ONLY;D:DECEASED AND INACTIVE PATIENTS ONLY"
 S DIR("A")="SELECT DESIRED ACCOUNTS"
 D ^DIR K DIR
 S AGPTS=Y
 Q:$D(DTOUT)!(Y="^")!(Y="/.,")!(Y="^^")
DEV S %ZIS="OPQ" D ^%ZIS I POP S IOP=ION D ^%ZIS Q
 G:'$D(IO("Q")) START K IO("Q") I $D(IO("S"))!($E(IOST)'="P") W *7,!,"Please queue to system printers." D ^%ZISC G DEV
 X ^%ZOSF("UCI") S ZTRTN="START^AGMCRP",ZTUCI=Y,ZTIO="",ZTDESC="Alpha List MEDICARE/RR Holders for "_$P(^AUTTLOC(DUZ(2),0),U,2)_".",AGQIO=IO F G="AGQIO" S ZTSAVE(G)=""
 D ^%ZTLOAD G:'$D(ZTSK) DEV K AG,AGIO,AGQIO,G,ZTDESC,ZTIO,ZTRTN,ZTSK,ZTUCI D ^%ZISC
 Q
START ;EP - From TaskMan.
 S (DFN,AGTOT)=0 K ^TMP($J)
 F  S DFN=$O(^AUPNMCR(DFN)) Q:+DFN<1  D
 .S AGFLAG=0
 .;if there is an HRN for this person and data in VA PATIENT
 .I $D(^AUPNPAT(DFN,41,DUZ(2))),$D(^DPT(DFN,0)) D
 ..I AGPTS="A" D   ;active people only
 ...I $P($G(^AUPNPAT(DFN,41,DUZ(2),0)),U,3)="",$P($G(^DPT(DFN,.35)),U)="" S AGFLAG=1
 ..I AGPTS="D" D   ;deceased/inactive only
 ...I $P($G(^AUPNPAT(DFN,41,DUZ(2),0)),U,3)'=""!($P($G(^DPT(DFN,.35)),U)'="") S AGFLAG=1
 ..I AGPTS="B" S AGFLAG=1
 ..I AGFLAG S ^TMP($J,$P(^DPT(DFN,0),U),DFN)="",AGTOT=AGTOT+1
 I $D(AGQIO) F AGZ("I")=1:1 S IOP=AGQIO D ^%ZIS Q:'POP  H 30
 X ^%ZOSF("UCI") S X="UCI: "_$P(Y,",",1)
 D CTR^AG
 S AGUCI=X,AGPGPG=0,AG("LOC")=$P(^DIC(4,DUZ(2),0),U),AG("USR")=$P(^VA(200,DUZ,0),U),AG("USRLOC")=AG("USR")_$J("",40-($L(AG("LOC"))\2)-$L(AG("USR")))_AG("LOC"),AGBM=IOSL-10
 I $D(AGIO),AGIO=IO S AGBM=IOSL-4
 K AG("LOC"),AG("USR") D LINES^AG,NOW^AG S AGNM="",X="as of "_AGTIME D CTR^AG S AGTIME=X U IO D HDR
 F AGZ("I")=1:1 S AGNM=$O(^TMP($J,AGNM)) Q:AGNM=""  S DFN=0 F AGZ("I")=1:1 S DFN=$O(^TMP($J,AGNM,DFN)) Q:DFN=""  D PRINT I $Y>AGBM D RTRN^AG G END1:$D(DUOUT)!$D(DTOUT)!$D(DFOUT) D HDR
END W !!!,"TOTAL MEDICARE/RAILROAD RET. PATIENTS: ",AGTOT K AG("HAT") D RTRN^AG W $$S^AGVDF("IOF")
END1 D ^%ZISC K ^TMP($J),A,AG,AGBM,AGDOB,AGIO,AGTIME,DA,AG("DENT"),DIC,DFN,DR,G,AGL,I,AG("LKDATA"),AG("LKPRINT"),AGNEW,AGNM,AGPCC,AGPGPG,AGTOT,AGUCI,AG("USRLOC"),X,Y D:$D(ZTQUEUED) KILL^%ZTLOAD
 Q
PRINT ;Print a Patient's MEDICARE/RAILROAD file.
 ;this is to make sure they are Part B somewhere
 S (I,AGCFLAG)=""
 F  S I=$O(^AUPNMCR(DFN,11,I)) Q:I=""  D
 .S AGCOV=$P($G(^AUPNMCR(DFN,11,I,0)),U,3)
 .I AGCOV="B" S AGCFLAG=1
 Q:AGCFLAG'=1
 S DIC=2,DA=DFN,DR=.03 D ^AGDICLK K AGDOB S:$D(AG("LKPRINT")) AGDOB=AG("LKPRINT") W "(REG) ",AGNM,?36,$P($G(^AUPNPAT(DFN,41,DUZ(2),0)),U,2),?49 G RR:^TMP($J,AGNM,DFN)="R"
 ;S DIC=9000003,DA=DFN,DR=.03 D ^AGDICLK W:$D(AG("LKPRINT")) AG("LKPRINT") S DR=.04 D ^AGDICLK W:$D(AG("LKPRINT")) AG("LKPRINT") W ?64 W:$D(AGDOB) AGDOB  ;IHS/OIT/NKD AG*7.1*14
 W $$GETMCR^AGUTL(DFN) W ?64 W:$D(AGDOB) AGDOB
 S DIC=9000003,DR=2101,DA=DFN D ^AGDICLK K AGMCRNM I $D(AG("LKPRINT")),AG("LKPRINT")]"" S AGMCRNM=AG("LKPRINT")
 S DR=2102 D ^AGDICLK K AGMCRDB I $D(AG("LKPRINT")),AG("LKPRINT")]"" S AGMCRDB=AG("LKPRINT")
 I $D(AGMCRNM)!$D(AGMCRDB) W !,"(MCR) " W:$D(AGMCRNM) AGMCRNM W:$D(AGMCRDB) ?64,AGMCRDB K AGMCRNM,AGMCRDB
 S DIC=9000003.11,DA=DFN
 F  S I=$O(^AUPNMCR(DFN,11,I)) Q:I=""  D
 .S AGCOV=$P($G(^AUPNMCR(DFN,11,I,0)),U,3)
 .Q:AGCOV'="B"
 .S DR=.01,AG("DRENT1")=I D ^AGDICLK
 .W !,"(MCR) " W:$D(AG("LKPRINT")) ?14,AG("LKPRINT")
 .S DR=.03,AG("DRENT1")=I D ^AGDICLK W:$D(AG("LKPRINT")) ?37,AG("LKPRINT")
 .S DR=.02,AG("DRENT1")=I D ^AGDICLK W:$D(AG("LKPRINT")) ?49,AG("LKPRINT")
 W !,AG("-"),!
 Q
 ;RR S DIC=9000005,DA=DFN,DR=.03 D ^AGDICLK W:$D(AG("LKPRINT")) AG("LKPRINT") S DR=.04 D ^AGDICLK W:$D(AG("LKPRINT")) AG("LKPRINT") W ?64 W:$D(AGDOB) AGDOB  ;IHS/OIT/NKD AG*7.1*14
RR W $$GETRRE^AGUTL(DFN) W ?64 W:$D(AGDOB) AGDOB
 S DIC=9000005,DR=2101,DA=DFN D ^AGDICLK K AGRRNM I $D(AG("LKPRINT")),AG("LKPRINT")]"" S AGRRNM=AG("LKPRINT")
 S DR=2102 D ^AGDICLK K AGRRDB I $D(AG("LKPRINT")),AG("LKPRINT")]"" S AGRRDB=AG("LKPRINT")
 I $D(AGRRNM)!$D(AGRRDB) W !,"(RR)  " W:$D(AGRRNM) AGRRNM W:$D(AGRRDB) ?64,AGRRDB K AGRRNM,AGRRDB
 S DIC=9000005.11,DA=DFN
 F I=0:0 S I=$O(^AUPNRRE(DFN,11,I)) Q:I=""  D
 .S DR=.01,AG("DRENT1")=I D ^AGDICLK W !,"(RR)  " W:$D(AG("LKPRINT")) ?14,AG("LKPRINT")
 .S DR=.03,AG("DRENT1")=I D ^AGDICLK W:$D(AG("LKPRINT")) ?37,AG("LKPRINT")
 .S DR=.02,AG("DRENT1")=I D ^AGDICLK W:$D(AG("LKPRINT")) ?49,AG("LKPRINT")
 W !,AG("-"),!
 Q
HDR S AGPGPG=AGPGPG+1
 W $$S^AGVDF("IOF"),!!,AG("USRLOC"),?72,"page ",AGPGPG
 W !?17,"REGISTERED PATIENTS - MEDICARE/RAILROAD ACCOUNTS"
 W !,AGUCI,!,AGTIME
 W !!?17,"REPORT CONTAINS "_$S(AGPTS="B":"ALL BENEFICIARIES",AGPTS="A":"ATIENTS ONLY",AGPTS="D":"DECEASED AND INACTIVE PATIENTS ONLY")
 W !!,"        NAME",?36,"CHART #",?49,"NUMBER",!,"(TYPE)",?14,"ELIG DATE END DATE",?64,"DATE OF BIRTH"
 W !,AG("="),!
 Q