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

APCM14NP.m

Go to the documentation of this file.
APCM14NP ;IHS/CMI/LAB - MU PRINT;
 ;;1.0;IHS MU PERFORMANCE REPORTS;**5,6**;MAR 26, 2012;Build 65
 ;
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(^APCM14OB(APCMINDB,0)),U,4)
 .S APCMLIEN=0 F  S APCMLIEN=$O(APCMINDL(APCMINDB,APCMLIEN)) Q:APCMLIEN'=+APCMLIEN  D
 ..S APCMLORD=$S(APCMRPTT=1:$P(^APCMM14L(APCMLIEN,0),U,5),1:$P(^APCMM14L(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^APCM14EH(" ",0,0,APCMPTYP)
 D W^APCM14EH("Total # of patients on list: 0",0,0,APCMPTYP)
 Q
NPL11 ;
 D
NEXT .;
 .;S APCMX=0 F  S APCMX=$O(^APCMM14L(APCMLIEN,11,APCMX)) Q:APCMX'=+APCMX  D
 .;.I APCMPTYP="P",$Y>(APCMIOSL-3) D HEADER Q:APCMQUIT
 .;.D W^APCM14EH(^APCMM14L(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^APCM14EH($P(^APCM14OB(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^APCM14EH("Total # of patients on list: "_+$G(APCMPCNT),0,2,APCMPTYP)
 D W^APCM14EH("",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(^APCMM14L(APCMLIEN,11,X)) Q:X'=+X  W !,^APCMM14L(APCMLIEN,11,X,0)
 .D H1
 Q:APCMQUIT
 S APCMPCNT=APCMPCNT+1
 D
 .D W^APCM14EH($E($P(^DPT(DFN,0),U),1,22),0,1,APCMPTYP)
 .D W^APCM14EH($$HRN^AUPNPAT(DFN,DUZ(2)),0,0,APCMPTYP,2,24)
 .D W^APCM14EH($E(APCMP,1,24),0,0,APCMPTYP,3,31)
 .D W^APCM14EH(APCMCOM,0,0,APCMPTYP,4,57)
 .D W^APCM14EH(APCMSEX,0,0,APCMPTYP,5,70)
 .D W^APCM14EH(APCMAGE,0,0,APCMPTYP,6,75)
 .D W^APCM14EH($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^APCM14EH($P(^XTMP("APCM1D",APCMJ,APCMH,"LIST",APCMORD,APCMINDB,APCMLORD,APCMLIEN,APCMP,APCMCOM,APCMSEX,APCMAGE,DFN),"|||",2),0,0,APCMPTYP,8,40)
PRINTL1 .;D W^APCM14EH(" ",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^APCM14EH($$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^APCM14EH($$CTR("** IHS 2014/2015 Stage 1 Meaningful Use Performance Measure Report for EPs **",80),0,1,APCMPTYP)
 I APCMRPTT=2 D W^APCM14EH($$CTR("** IHS 2014/2015 Stage 1 MU Performance Report for Eligible Hospitals/CAHs **",80),0,1,APCMPTYP)
 D W^APCM14EH($$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^APCM14EH($$CTR(X,80),0,1,APCMPTYP)
 ;W !,$$CTR($P(^APCM14OB(APCMINDB,0),U,5))
 D W^APCM14EH($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^APCM14EH(X,0,1,APCMPTYP)
 D W^APCM14EH($P(^APCM14OB(APCMINDB,0),U,5),0,$S(APCMPTYP="D":3,1:1),APCMPTYP)
 S X=0 F  S X=$O(^APCMM14L(APCMLIEN,11,X)) Q:X'=+X  D W^APCM14EH(^APCMM14L(APCMLIEN,11,X,0),0,1,APCMPTYP)
 ;S N=$S(APCMCOUN<2:22,1:22) S X=0 F  S X=$O(^APCM14OB(APCMINDB,N,X)) Q:X'=+X  D W^APCM14EH(^APCM14OB(APCMINDB,N,X,0),0,1,APCMPTYP)
 D W^APCM14EH("PATIENT NAME",0,2,APCMPTYP)
 D W^APCM14EH("HRN",0,0,APCMPTYP,2,24)
 D W^APCM14EH($S(APCMRPTT=1:"EP",1:"HOSPITAL/CAH"),0,0,APCMPTYP,3,31)
 D W^APCM14EH("COMMUNITY",0,0,APCMPTYP,4,57)
 D W^APCM14EH("SEX",0,0,APCMPTYP,5,70)
 D W^APCM14EH("AGE",0,0,APCMPTYP,6,75)
 D W^APCM14EH("DENOM",0,$S(APCMPTYP="P":1,1:0),APCMPTYP,7,3)
 D W^APCM14EH("NUMERATOR",0,0,APCMPTYP,8,40)
 D W^APCM14EH($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")