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

APCM13EP.m

Go to the documentation of this file.
APCM13EP ; IHS/CMI/LAB - IHS MU ;
 ;;1.0;IHS MU PERFORMANCE REPORTS;**2,4,5,6**;MAR 26, 2012;Build 65
 ;
 ;
PRINT ;EP
 K ^TMP($J)
 S APCMIOSL=$S($G(APCMGUI):55,1:IOSL)
 S APCMQUIT=""
 S ^TMP($J,"APCMDEL",0)=0
 I APCMROT="D" G DEL
 S APCMPTYP="P"
 D ^APCM13EH
 S APCMGPG=0
 S APCMQUIT=""
 I APCMSUM="F" D PRINT1
 D SUMEOP
 D SUM
 D W^APCM13EH(" ",0,2,APCMPTYP)
 D LIST^APCM13NP
 D W^APCM13EH(" ",0,2,APCMPTYP)
 K ^TMP($J)
 I APCMROT="P" K ^XTMP("APCM1D",APCMJ,APCMH) D EOP Q
 ;
DEL ;create delimited output file
 D ^%ZISC
 K ^TMP($J)
 S ^TMP($J,"APCMDEL",0)=0
 S APCMPTYP="D"
 D ^APCM13EH
 S APCMQUIT=""
 I APCMSUM="F" D PRINT1
 Q:APCMQUIT
 D SUM
 Q:APCMQUIT
 D LIST^APCM13NP
 Q:APCMQUIT
 D SAVEDEL^APCM13EQ
 K ^XTMP("APCM1D",APCMJ,APCMH)
 K ^TMP($J)
 D EOP
 Q
WP ;
 K ^UTILITY($J,"W")
 S APCMZ=0,APCMLCNT=0
 S DIWL=1,DIWR=APCMCOL,DIWF="",APCMZ=0 F  S APCMZ=$O(^APCM13OB(APCMIC,APCMNODE,APCMY,1,APCMZ)) Q:APCMZ'=+APCMZ  D
 .S APCMLCNT=APCMLCNT+1
 .S X=^APCM13OB(APCMIC,APCMNODE,APCMY,1,APCMZ,0) S:APCMLCNT=1 X=" - "_X D ^DIWP
 .Q
WPS ;
 S Z=0 F  S Z=$O(^UTILITY($J,"W",DIWL,Z)) Q:Z'=+Z  D
 .I APCMPTYP="P",$Y>(APCMIOSL-3) D HEADER Q:APCMQUIT
 .D W^APCM13EH(^UTILITY($J,"W",DIWL,Z,0),0,1,APCMPTYP)
 K DIWL,DIWR,DIWF,Z
 K ^UTILITY($J,"W"),X
 Q
EOP ;EP - End of page.
 Q:$E(IOST)'="C"
 Q:$D(ZTQUEUED)!(IOT'["TRM")!$D(IO("S"))
 NEW DIR
 K DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
 S DIR("A")="End of Report.  Press Enter",DIR(0)="E" D ^DIR
 Q
 ;
SUMEOP ;EP - End of page.
 Q:$E(IOST)'="C"
 Q:$D(ZTQUEUED)!(IOT'["TRM")!$D(IO("S"))
 NEW DIR
 K DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
 S DIR("A")="End of Full Report.  Press Enter to continue to the Summary Report.",DIR(0)="E" D ^DIR
 Q
 ;
PRINT1 ;EP
 ;REORDER THE PROVIDERS ALPHABETICALLY
 K APCMINDO
 S X=0 F  S X=$O(APCMIND(X)) Q:X'=+X  D
 .S C=$P(^APCM13OB(X,0),U,3)
 .S O=$P(^APCM13OB(X,0),U,4)
 .S APCMINDO(C,O,X)=""
 I APCMRPTT=2 G PRINT1H
 K APCMPROV
 S X=0 F  S X=$O(APCMPRV(X)) Q:X'=+X  S APCMPROV($P(^VA(200,X,0),U),X)=""
 S APCMPNAM="" F  S APCMPNAM=$O(APCMPROV(APCMPNAM)) Q:APCMPNAM=""!(APCMQUIT)  D
 .S APCMPROV=0 F  S APCMPROV=$O(APCMPROV(APCMPNAM,APCMPROV)) Q:APCMPROV=""!(APCMQUIT)  D PRINT1N
 Q
PRINT1H ;
 S APCMPNAM=$P(^DIC(4,APCMFAC,0),U,1)
 S APCMPROV=APCMFAC
 D PRINT1N
 Q
PRINT1N ;REORDER THE PRINT BY CORE,ORDER THEN MENU,ORDER
 I APCMPTYP="D" D HEADER1
 S APCMCM="" F  S APCMCM=$O(APCMINDO(APCMCM)) Q:APCMCM=""!(APCMQUIT)  D
 .S APCMMO=0 F  S APCMMO=$O(APCMINDO(APCMCM,APCMMO)) Q:APCMMO=""!(APCMQUIT)  D
 ..S APCMIC=0 F  S APCMIC=$O(APCMINDO(APCMCM,APCMMO,APCMIC)) Q:APCMIC=""!(APCMQUIT)  D PRINT2
 Q
PRINT2 ;
 I APCMPTYP="P" D HEADER Q:APCMQUIT
 ;I APCMPTYP="D" D W^APCM13EH(" ",0,$S(APCMPTYP="D":2,1:1),APCMPTYP)
 D W^APCM13EH("#"_$P(^APCM13OB(APCMIC,0),U,15)_"  "_$P(^APCM13OB(APCMIC,0),U,5)_", "_$$VAL^XBDIQ1(9001301.02,APCMIC,.03),0,1,APCMPTYP)
 I APCMPTYP="P",$Y>(APCMIOSL-4) D HEADER Q:APCMQUIT
 D W^APCM13EH("Objective:",0,2,APCMPTYP)
 S APCMNODE=11
 S APCMX=0 F  S APCMX=$O(^APCM13OB(APCMIC,APCMNODE,APCMX)) Q:APCMX'=+APCMX!(APCMQUIT)  D
 .I APCMPTYP="P",$Y>(APCMIOSL-4) D HEADER Q:APCMQUIT
 .D W^APCM13EH(^APCM13OB(APCMIC,APCMNODE,APCMX,0),0,1,APCMPTYP)
 Q:APCMQUIT
 I APCMPTYP="P",$Y>(APCMIOSL-4) D HEADER Q:APCMQUIT
 S APCMNODE=21
 D W^APCM13EH("Stage 1 Measure:",0,2,APCMPTYP)
 S APCMX=0 F  S APCMX=$O(^APCM13OB(APCMIC,APCMNODE,APCMX)) Q:APCMX'=+APCMX!(APCMQUIT)  D
 .I APCMPTYP="P",$Y>(APCMIOSL-4) D HEADER Q:APCMQUIT
 .D W^APCM13EH(^APCM13OB(APCMIC,APCMNODE,APCMX,0),0,1,APCMPTYP)
 Q:APCMQUIT
 I APCMPTYP="P",$Y>(APCMIOSL-4) D HEADER Q:APCMQUIT
 D W^APCM13EH("CMS Denominator:",0,2,APCMPTYP)
 S APCMNODE=14
 S APCMX=0 F  S APCMX=$O(^APCM13OB(APCMIC,APCMNODE,APCMX)) Q:APCMX'=+APCMX!(APCMQUIT)  D
 .I APCMPTYP="P",$Y>(APCMIOSL-4) D HEADER Q:APCMQUIT
 .D W^APCM13EH(^APCM13OB(APCMIC,APCMNODE,APCMX,0),0,1,APCMPTYP)
 Q:APCMQUIT
 I APCMPTYP="P",$Y>(APCMIOSL-4) D HEADER Q:APCMQUIT
 S APCMNODE=16
 D W^APCM13EH("CMS Numerator:",0,2,APCMPTYP)
 S APCMX=0 F  S APCMX=$O(^APCM13OB(APCMIC,APCMNODE,APCMX)) Q:APCMX'=+APCMX!(APCMQUIT)  D
 .I APCMPTYP="P",$Y>(APCMIOSL-4) D HEADER Q:APCMQUIT
 .D W^APCM13EH(^APCM13OB(APCMIC,APCMNODE,APCMX,0),0,1,APCMPTYP)
 Q:APCMQUIT
 I APCMPTYP="P",$Y>(APCMIOSL-4) D HEADER Q:APCMQUIT
 S APCMNODE=18
 D W^APCM13EH("IHS Logic:",0,2,APCMPTYP)
 S APCMX=0 F  S APCMX=$O(^APCM13OB(APCMIC,APCMNODE,APCMX)) Q:APCMX'=+APCMX!(APCMQUIT)  D
 .I APCMPTYP="P",$Y>(APCMIOSL-4) D HEADER Q:APCMQUIT
 .D W^APCM13EH(^APCM13OB(APCMIC,APCMNODE,APCMX,0),0,1,APCMPTYP)
 Q:APCMQUIT
 D W^APCM13EH("",0,1,APCMPTYP)
 D PRNTM
 Q
 ;
SCREEN ;
 S X=0 F  S X=$O(^TMP($J,"APCMDEL",X)) Q:X'=+X  W !,^TMP($J,"APCMDEL",X)
 Q
EXIT ;
 I $E(IOST)="C",IO=IO(0),'$D(ZTQUEUED) W ! S DIR(0)="EO",DIR("A")="End of report.  Press ENTER" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 Q
 ;
CALC(N,O) ;ENTRY POINT
 NEW Z
 S Z=N-O,Z=$FN(Z,"+,",1)
 Q Z
 ;
SB(X) ;EP - Strip 
 NEW %
 X ^DD("FUNC",$O(^DD("FUNC","B","STRIPBLANKS",0)),1)
 Q X
 ;
C(X,X2,X3) ;
 I X'?.N Q $$RBLK^APCLUTL(X,10)
 D COMMA^%DTC
 Q X
 ;
H2 ;EP
 I APCMPTYP="P" D
 .D W^APCM13EH($$C(APCMCYN,0,8),0,0,APCMPTYP,,26)
 .D W^APCM13EH($J(APCMCYP,5,1)_"%",0,0,APCMPTYP,,36)
 .D W^APCM13EH($$C(APCMPRN,0,8),0,0,APCMPTYP,,44)
 .D W^APCM13EH($J(APCMPRP,5,1)_"%",0,0,APCMPTYP,,55)
 .D W^APCM13EH($G(^APCM13OB(APCMIC,13,1,0)),0,0,APCMPTYP,,64)
 I APCMPTYP="D" D
 .S APCMX=""
 .S APCMX=+APCMCYN
 .S $P(APCMX,U,2)=$$SB($J(APCMCYP,5,1))
 .S $P(APCMX,U,3)=+APCMPRN
 .S $P(APCMX,U,4)=$$SB($J(APCMPRP,5,1))
 .S $P(APCMX,U,5)=$G(^APCM13OB(APCMIC,13,1,0))
 .D W^APCM13EH(APCMX,0,0,APCMPTYP,2)
 Q
 ;
H1 ;EP
 D W^APCM13EH("Current",0,2,APCMPTYP,2,26)
 D W^APCM13EH("Previous",0,0,APCMPTYP,4,44)
 D W^APCM13EH("Stage 1",0,0,APCMPTYP,6,64)
 D W^APCM13EH("Period",0,1,APCMPTYP,2,26)
 I $P(^APCM13OB(APCMIC,0),U,6)="R" D W^APCM13EH("%",0,0,APCMPTYP,3,38)
 D W^APCM13EH("Period",0,0,APCMPTYP,4,44)
 I $P(^APCM13OB(APCMIC,0),U,6)="R" D W^APCM13EH("%",0,0,APCMPTYP,5,57)
 D W^APCM13EH("Target",0,0,APCMPTYP,6,64)
 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
 I APCMPTYP="P" S X=$P(^VA(200,DUZ,0),U,2),$E(X,35)=$$FMTE^XLFDT(DT),$E(X,70)="Page "_APCMGPG D W^APCM13EH(X,0,1,APCMPTYP)
 D W^APCM13EH("Indian Health Service RPMS Suite (BCER) v1.0",1,2,APCMPTYP)
 I APCMRPTT=1 D W^APCM13EH("** IHS 2013 Stage 1 Meaningful Use Performance Measure Report for EPs **",1,1,APCMPTYP)
 I APCMRPTT=2 D W^APCM13EH("** IHS 2013 Stage 1 MU Performance Report for Eligible Hospitals/CAHs **",1,1,APCMPTYP)
 I $G(APCMPROV),APCMRPTT=1 S X="Provider Name: "_$$SN^APCM13EH($P(^VA(200,APCMPROV,0),U,1)) D W^APCM13EH(X,1,1,APCMPTYP)
 I $G(APCMPROV),APCMRPTT=2 S X="Facility Name: "_$P(^DIC(4,APCMPROV,0),U,1) D W^APCM13EH(X,1,1,APCMPTYP)
 I $G(APCMTOT) S X="Aggregate Report for all Selected Providers" D W^APCM13EH(X,1,1,APCMPTYP)
 I APCMRPTT=1 S X="Facility Name: "_$P(^DIC(4,DUZ(2),0),U,1) D W^APCM13EH(X,1,1,APCMPTYP)
 S X="Report Period:  "_$$FMTE^XLFDT(APCMBD)_" to "_$$FMTE^XLFDT(APCMED) D W^APCM13EH(X,1,1,APCMPTYP)
 I $G(APCMWPP) S X="Previous Period:  "_$$FMTE^XLFDT(APCMPBD)_" to "_$$FMTE^XLFDT(APCMPED) D W^APCM13EH(X,1,1,APCMPTYP)
 S X=$$REPEAT^XLFSTR("-",80) D W^APCM13EH(X,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 .
 Q $S($G(DUZ):$S($D(^VA(200,DUZ,0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
 ;----------
PRNTM ;print 1 measure
 ;APCMPROV=provider
 ;APCMIC=measure ien
 I APCMPTYP="P",$Y>(APCMIOSL-14) D HEADER Q:APCMQUIT
 D H1
PI1 ;EP
 ;check exclusion field and print value if any and quit
 S APCMDF=$P(^APCM13OB(APCMIC,0),U,8)
 ;get DENOMINATOR value
 S APCMNP=$P(^DD(9001301.0311,APCMDF,0),U,4),N=$P(APCMNP,";"),P=$P(APCMNP,";",2)
 S APCMCYD=$$V(1,APCMRPT,N,P,APCMPROV,$S($G(APCMTOT):"T",1:"I"),APCMRPTT)
 S APCMPRD=$$V(2,APCMRPT,N,P,APCMPROV,$S($G(APCMTOT):"T",1:"I"),APCMRPTT)
 ;write out DENOMINATOR
 K ^UTILITY($J,"W")
 S APCMZ=0
 S DIWL=1,DIWR=20 F  S APCMZ=$O(^APCM13OB(APCMIC,15,APCMZ)) Q:APCMZ'=+APCMZ  D
 .S (X,APCMX)=^APCM13OB(APCMIC,15,APCMZ,0) D ^DIWP
 .Q
 ;
 I APCMPTYP="P" S APCMZ=0 F  S APCMZ=$O(^UTILITY($J,"W",DIWL,APCMZ)) Q:APCMZ'=+APCMZ  D W^APCM13EH(^UTILITY($J,"W",DIWL,APCMZ,0),0,1,APCMPTYP,1)
 I APCMPTYP="D" D W^APCM13EH(APCMX,0,1,APCMPTYP)
 K DIWL,DIWR,DIWF,APCMZ
 K ^UTILITY($J,"W")
 I APCMPTYP="P" D
 .D W^APCM13EH($$C(APCMCYD,0,8),0,0,APCMPTYP,1,26)
 .I $P(^APCM13OB(APCMIC,0),U,6)'="A" D W^APCM13EH($$C(APCMPRD,0,8),0,0,APCMPTYP,1,44)
 .I $P(^APCM13OB(APCMIC,0),U,6)="A" D W^APCM13EH($$C("N/A"),0,0,APCMPTYP,1,44)
 .I $P(^APCM13OB(APCMIC,0),U,6)="A" D W^APCM13EH($G(^APCM13OB(APCMIC,13,1,0)),0,0,APCMPTYP,,64)
 .D W^APCM13EH("",0,1,APCMPTYP)
 I APCMPTYP="D" D
 .I APCMCYD="" S APCMCYD=0
 .I APCMPRD="" S APCMPRD=0
 .S Y=APCMCYD_"^^"_APCMPRD
 .I $P(^APCM13OB(APCMIC,0),U,6)="A" S $P(Y,U,3)="N/A",Y=Y_U_U_$G(^APCM13OB(APCMIC,13,1,0)) D W^APCM13EH(Y,0,0,APCMPTYP,2),W^APCM13EH(" ",0,1,APCMPTYP)
 .I $P(^APCM13OB(APCMIC,0),U,6)'="A" D W^APCM13EH(Y,0,0,APCMPTYP,2)
DENOMO ;
 I $P(^APCM13OB(APCMIC,0),U,6)="A" G EXCL
 S APCMNF=$P(^APCM13OB(APCMIC,0),U,9)
 I APCMNF="" Q
 S APCMNP=$P(^DD(9001301.0311,APCMNF,0),U,4),N=$P(APCMNP,";"),P=$P(APCMNP,";",2)
 D SETN
 ;write header
 K ^UTILITY($J,"W")
 S APCMZ=0
 S DIWL=1,DIWR=20 F  S APCMZ=$O(^APCM13OB(APCMIC,17,APCMZ)) Q:APCMZ'=+APCMZ  D
 .S (X,APCMX)=^APCM13OB(APCMIC,17,APCMZ,0) D ^DIWP
 .Q
 ;
 I APCMPTYP="P" S APCMZ=0 F  S APCMZ=$O(^UTILITY($J,"W",DIWL,APCMZ)) Q:APCMZ'=+APCMZ  D W^APCM13EH(^UTILITY($J,"W",DIWL,APCMZ,0),0,1,APCMPTYP,1)
 I APCMPTYP="D" D W^APCM13EH(APCMX,0,1,APCMPTYP,1)
 K DIWL,DIWR,DIWF,APCMZ
 K ^UTILITY($J,"W")
 D H2
EXCL ;
 S APCMZ=0 F  S APCMZ=$O(APCMADDQ("ANS",APCMIC,APCMZ)) Q:APCMZ'=+APCMZ  D
 .D W^APCM13EH(" ",0,1,APCMPTYP)
 .;S V=$G(APCMADDQ(APCMIC,APCMZ))
 .S APCM1=0 F  S APCM1=$O(^APCM13OB(APCMIC,APCMZ,APCM1)) Q:APCM1'=+APCM1  D
 ..D W^APCM13EH(^APCM13OB(APCMIC,APCMZ,APCM1,0),0,1,APCMPTYP)
 .D W^APCM13EH("  "_APCMADDQ("ANS",APCMIC,APCMZ,APCMPROV),0,0,APCMPTYP,2)
 S APCMEF=$P(^APCM13OB(APCMIC,0),U,11) I APCMEF]"" D
 .;D H1
 .S APCMNP=$P(^DD(9001301.0311,APCMEF,0),U,4),N=$P(APCMNP,";"),P=$P(APCMNP,";",2)
 .S APCMEV=$$V(1,APCMRPT,N,P,APCMPROV,$S($G(APCMTOT):"T",1:"I"),APCMRPTT)
 .I APCMEV]"" D
 ..I APCMPTYP="P",$Y>(APCMIOSL-4) D HEADER Q:APCMQUIT
 ..K ^UTILITY($J,"W")
 ..D W^APCM13EH(" ",0,1,APCMPTYP)
 ..I APCMPTYP="P" D
 ...S DIWL=1,DIWR=78,X=APCMEV
 ...D ^DIWP
 ...S APCMZ=0 F  S APCMZ=$O(^UTILITY($J,"W",DIWL,APCMZ)) Q:APCMZ'=+APCMZ  D W^APCM13EH(^UTILITY($J,"W",DIWL,APCMZ,0),0,1,APCMPTYP,1,0)
 ...K DIWL,DIWR,DIWF,APCMZ
 ..I APCMPTYP="D" D W^APCM13EH(APCMEV,0,1,APCMPTYP,2)
 ..K ^UTILITY($J,"W")
 D W^APCM13EH(" ",0,1,APCMPTYP)
 Q
 ;
SETN ;EP - set numerator fields
 S APCMCYN=$$V(1,APCMRPT,N,P,APCMPROV,$S($G(APCMTOT):"T",1:"I"),APCMRPTT) ;SPDX
 S APCMPRN=$$V(2,APCMRPT,N,P,APCMPROV,$S($G(APCMTOT):"T",1:"I"),APCMRPTT) ;SPDX
 I APCMCYN="" S APCMCYN=0
 I APCMPRN="" S APCMPRN=0
 Q:$P(^APCM13OB(APCMIC,0),U,6)="A"  ;no % on attestation measures
 S APCMCYP=$S(APCMCYD:((APCMCYN/APCMCYD)*100),1:"")
 S APCMPRP=$S(APCMPRD:((APCMPRN/APCMPRD)*100),1:"")
 Q
 ;
V(T,R,N,P,PROV,K,RT) ;EP ;SPDX
 NEW X,Y,Z,I,J
 I RT=1 S I=PROV_";VA(200,"
 I RT=2 S I=PROV_";AUTTLOC("
 I K="T" S I="TOTAL"
 I T=1 D  Q X
 .S J=$O(^APCMM13C(R,$S(K="I":11,1:12),"B",I,0))
 .I 'J S X=0 Q
 .S X=$P($G(^APCMM13C(R,$S(K="I":11,1:12),J,N)),U,P)
 I T=2 D  Q X
 .S J=$O(^APCMM13P(R,$S(K="I":11,1:12),"B",I,0))
 .I 'J S X=0 Q
 .S X=$P($G(^APCMM13P(R,$S(K="I":11,1:12),J,N)),U,P)
 Q ""
SUM ;summary sheet for each provider
 D SUM^APCM13ER
 Q