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

APCM2ANP.m

Go to the documentation of this file.
APCM2ANP ;IHS/CMI/LAB - MU PRINT;
 ;;1.0;MU PERFORMANCE REPORTS;**7**;MAR 26, 2012;Build 15
 ;
LIST ;EP
 S APCMQUIT="",APCMGPG=0
 S APCMINDB=0,APCMCOUN=0
 S APCMINDB=0 F  S APCMINDB=$O(APCMINDL(APCMINDB)) Q:APCMINDB'=+APCMINDB  D
 .S APCMORD=$P($G(^APCM25OB(APCMINDB,0)),U,4)
 .S APCMLIEN=0 F  S APCMLIEN=$O(APCMINDL(APCMINDB,APCMLIEN)) Q:APCMLIEN'=+APCMLIEN  D
 ..S APCMLORD=$S(APCMRPTT=1:$P(^APCMM25L(APCMLIEN,0),U,5),1:$P(^APCMM25L(APCMLIEN,0),U,6))
 ..S APCMINDL("AOI",APCMORD,APCMINDB,APCMLORD,APCMLIEN)=""
 S APCMORD=0 F  S APCMORD=$O(APCMINDL("AOI",APCMORD)) Q:APCMORD=""!(APCMQUIT)  D
 .S APCMINDB=$O(APCMINDL("AOI",APCMORD,0))
 .S APCMLORD=0 F  S APCMLORD=$O(APCMINDL("AOI",APCMORD,APCMINDB,APCMLORD)) Q:APCMLORD=""!(APCMQUIT)  D
 ..S APCMLIEN=$O(APCMINDL("AOI",APCMORD,APCMINDB,APCMLORD,0))
 ..I '$O(APCMINDL(APCMINDB,APCMLIEN,0)) D NONE Q
 ..;I '$$ANYPATS(APCMINDB,APCMINDII) D HEADER W !!,"No Patients to Report.",! Q
 ..D NPL11 ;F  S APCMINDB=$O(^XTMP("APCM1D",APCMJ,APCMH,"LIST",APCMINDB)) Q:APCMINDB'=+APCMINDB!(APCMQUIT)  D NPL1
 Q
NONE ;
 I APCMPTYP="P" D HEADER
 I APCMPTYP="D" D HEADER1
 D H1
 D W^APCM2AEH(" ",0,0,APCMPTYP)
 D W^APCM2AEH("Total # of patients on list: 0",0,0,APCMPTYP)
 Q
NPL11 ;
 D
NEXT .;
 .;S APCMX=0 F  S APCMX=$O(^APCMM25L(APCMLIEN,11,APCMX)) Q:APCMX'=+APCMX  D
 .;.I APCMPTYP="P",$Y>(APCMIOSL-3) D HEADER Q:APCMQUIT
 .;.D W^APCM2AEH(^APCMM25L(APCMLIEN,11,APCMX,0),0,1,APCMPTYP)
 .D:APCMPTYP="P" HEADER D H1
 .S APCMP="" F  S APCMP=$O(^XTMP("APCM1D",APCMJ,APCMH,"LIST",APCMORD,APCMINDB,APCMLORD,APCMLIEN,APCMP)) Q:APCMP=""  D NEXT1
 Q
NEXT1 ;
 S APCMPIEN=$S(APCMRPTT=1:$O(^VA(200,"B",APCMP,0)),1:$O(^DIC(4,"B",APCMP,0)))
 S APCMCOUN=0,APCMPCNT=0
 ;I APCMPTYP="P" D HEADER Q:APCMQUIT
 S APCMCNT=APCMINDL(APCMINDB,APCMLIEN,APCMPIEN)
 I APCMCNT<11!(APCMLIST'="R") S APCMCNT=1 G GO
 I APCMCNT<100 S APCMCNT=APCMCNT\10 G GO
 S APCMCNT=10
GO ;
 ;D W^APCM2AEH($P(^APCM25OB(APCMINDB,0),U,5),0,1,APCMPTYP)
 S APCMCOM="" F  S APCMCOM=$O(^XTMP("APCM1D",APCMJ,APCMH,"LIST",APCMORD,APCMINDB,APCMLORD,APCMLIEN,APCMP,APCMCOM)) Q:APCMCOM=""!(APCMQUIT)  D
 .S APCMSEX="" F  S APCMSEX=$O(^XTMP("APCM1D",APCMJ,APCMH,"LIST",APCMORD,APCMINDB,APCMLORD,APCMLIEN,APCMP,APCMCOM,APCMSEX)) Q:APCMSEX=""!(APCMQUIT)  D
 ..S APCMAGE="" F  S APCMAGE=$O(^XTMP("APCM1D",APCMJ,APCMH,"LIST",APCMORD,APCMINDB,APCMLORD,APCMLIEN,APCMP,APCMCOM,APCMSEX,APCMAGE)) Q:APCMAGE=""!(APCMQUIT)  D
 ...S DFN=0 F  S DFN=$O(^XTMP("APCM1D",APCMJ,APCMH,"LIST",APCMORD,APCMINDB,APCMLORD,APCMLIEN,APCMP,APCMCOM,APCMSEX,APCMAGE,DFN)) Q:DFN'=+DFN!(APCMQUIT)  S APCMCOUN=APCMCOUN+1 D PRINTL
 I APCMPTYP="P",$Y>(APCMIOSL-3) D HEADER Q:APCMQUIT  D H1
 D W^APCM2AEH("Total # of patients on list: "_+$G(APCMPCNT),0,2,APCMPTYP)
 D W^APCM2AEH("",0,1,APCMPTYP)
 Q
 ;
PRINTL ;print one line
 Q:(APCMCOUN#APCMCNT)
 I APCMPTYP="P",$Y>(APCMIOSL-3) D HEADER Q:APCMQUIT  D
 .;S X=0 F  S X=$O(^APCMM25L(APCMLIEN,11,X)) Q:X'=+X  W !,^APCMM25L(APCMLIEN,11,X,0)
 .D H1
 Q:APCMQUIT
 S APCMPCNT=APCMPCNT+1
 D
 .D W^APCM2AEH($E($P(^DPT(DFN,0),U),1,22),0,1,APCMPTYP)
 .D W^APCM2AEH($$HRN^AUPNPAT(DFN,DUZ(2)),0,0,APCMPTYP,2,24)
 .D W^APCM2AEH($E(APCMP,1,24),0,0,APCMPTYP,3,31)
 .D W^APCM2AEH(APCMCOM,0,0,APCMPTYP,4,57)
 .D W^APCM2AEH(APCMSEX,0,0,APCMPTYP,5,70)
 .D W^APCM2AEH(APCMAGE,0,0,APCMPTYP,6,75)
 .D W^APCM2AEH($P(^XTMP("APCM1D",APCMJ,APCMH,"LIST",APCMORD,APCMINDB,APCMLORD,APCMLIEN,APCMP,APCMCOM,APCMSEX,APCMAGE,DFN),"|||",1),0,$S(APCMPTYP="P":1,1:0),APCMPTYP,7,1)
 .D W^APCM2AEH($P(^XTMP("APCM1D",APCMJ,APCMH,"LIST",APCMORD,APCMINDB,APCMLORD,APCMLIEN,APCMP,APCMCOM,APCMSEX,APCMAGE,DFN),"|||",2),0,0,APCMPTYP,8,40)
PRINTL1 .;D W^APCM2AEH(" ",0,1,APCMPTYP)
 K ^TMP($J,"A")
 Q
 ;
 G:'APCMGPG HEADER1
 K DIR I $E(IOST)="C",IO=IO(0),'$D(ZTQUEUED) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S APCMQUIT=1 Q
HEADER1 ;
 I APCMPTYP="P" W:$D(IOF) @IOF S APCMGPG=APCMGPG+1
 D W^APCM2AEH($$CTR("***** CONFIDENTIAL PATIENT INFORMATION, COVERED BY THE PRIVACY ACT *****",80),0,1,APCMPTYP)
 I APCMPTYP="P" W !?3,$P(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",APCMGPG,!
 I APCMRPTT=1 D W^APCM2AEH($$CTR("** IHS Modified Stage 2 Meaningful Use Performance Measure Report for EPs **",80),0,1,APCMPTYP)
 D W^APCM2AEH($$CTR("Alternate Stage 1 Exclusions",80),0,1,APCMPTYP)
 ;I APCMRPTT=2 D W^APCM2AEH($$CTR("** IHS Modified Stage 2 MU Performance Report for Eligible Hospitals/CAHs **",80),0,1,APCMPTYP)
 D W^APCM2AEH($$CTR($P(^DIC(4,DUZ(2),0),U),80),0,1,APCMPTYP)
 S X="Reporting Period: "_$$FMTE^XLFDT(APCMBD)_" to "_$$FMTE^XLFDT(APCMED) D W^APCM2AEH($$CTR(X,80),0,1,APCMPTYP)
 ;W !,$$CTR($P(^APCM25OB(APCMINDB,0),U,5))
 D W^APCM2AEH($TR($J("",80)," ","-"),0,1,APCMPTYP)
 Q
H1 ;
 ;S X=$S(APCMLIST="A":"Entire Patient List",APCMLIST="R":"Random Patient List",1:"Patient List by Provider: "_APCMLPROV) D W^APCM2AEH(X,0,1,APCMPTYP)
 D W^APCM2AEH($P(^APCM25OB(APCMINDB,0),U,5),0,$S(APCMPTYP="D":3,1:1),APCMPTYP)
 S X=0 F  S X=$O(^APCMM25L(APCMLIEN,11,X)) Q:X'=+X  D W^APCM2AEH(^APCMM25L(APCMLIEN,11,X,0),0,1,APCMPTYP)
 ;S N=$S(APCMCOUN<2:22,1:22) S X=0 F  S X=$O(^APCM25OB(APCMINDB,N,X)) Q:X'=+X  D W^APCM2AEH(^APCM25OB(APCMINDB,N,X,0),0,1,APCMPTYP)
 D W^APCM2AEH("PATIENT NAME",0,2,APCMPTYP)
 D W^APCM2AEH("HRN",0,0,APCMPTYP,2,24)
 D W^APCM2AEH($S(APCMRPTT=1:"EP",1:"HOSPITAL/CAH"),0,0,APCMPTYP,3,31)
 D W^APCM2AEH("COMMUNITY",0,0,APCMPTYP,4,57)
 D W^APCM2AEH("SEX",0,0,APCMPTYP,5,70)
 D W^APCM2AEH("AGE",0,0,APCMPTYP,6,75)
 D W^APCM2AEH("DENOM",0,$S(APCMPTYP="P":1,1:0),APCMPTYP,7,3)
 D W^APCM2AEH("NUMERATOR",0,0,APCMPTYP,8,40)
 D W^APCM2AEH($TR($J("",80)," ","-"),0,1,APCMPTYP)
 Q
CTR(X,Y) ;EP - Center X in a field Y wide.
 Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
 ;----------
USR() ;EP - Return name of current user from ^VA(200.
 Q $S($G(DUZ):$S($D(^VA(200,DUZ,0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
 ;----------
LOC() ;EP - Return location name from file 4 based on DUZ(2).
 Q $S($G(DUZ(2)):$S($D(^DIC(4,DUZ(2),0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")