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

BGPMUEP.m

Go to the documentation of this file.
  1. BGPMUEP ; IHS/MSC/MMT - IHS MU PERFORMANCE MEASURE REPORT FRONT-END ;02-Mar-2011 13:57;DU
  1. ;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
  1. ;
  1. ;
  1. W:$D(IOF) @IOF
  1. W !!,$$CTR("IHS Meaningful Use Clinical Quality Measure Report",80)
  1. W !,$$CTR("Report on all Patients regardless of Community of Residence",80),!!
  1. D MUCHECK Q:BGPQUIT
  1. INTRO ;
  1. D XIT
  1. W !,"This will produce a Clinical Quality Measure Report for one or more measures"
  1. W !,"for a period you specify. You will be asked to provide: 1) the length of the"
  1. W !,"reporting period , 2) the desired start date for your reporting period and,"
  1. W !,"3) the baseline period to compare data to."
  1. SETIND ;
  1. D XIT
  1. S BGPINDT=""
  1. S BGPMUYF="90595.11"
  1. S BGPRTYPE=4,BGP0RPTH="A"
  1. S BGPMUT="P"
  1. TP ;get time period
  1. S BGPRTYPE=4,BGP0RPTH="A"
  1. S (BGPBD,BGPED,BGPTP)=""
  1. S DIR(0)="S^1:90-Days;2:One Year;3:User Defined Date Range",DIR("A")="Enter the reporting period length for your report" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) D XIT Q
  1. S BGPANS=Y
  1. S BGPLEN=$S(Y=1:89,Y=2:364,1:"")
  1. S (BGPPER,BGPVDT)=""
  1. I BGPANS=3 D GETBE I BGPBD=""!(BGPED)="" D XIT Q
  1. I BGPANS=3 G BY
  1. W !!,"Enter the reporting period start date."
  1. S DIR(0)="D^::EP"
  1. S DIR("A")="Enter Date"
  1. S DIR("?")="This report is compiled for a period. Enter a valid date."
  1. D ^DIR KILL DIR
  1. I $D(DIRUT) Q
  1. I $D(DUOUT) S DIRUT=1 Q
  1. S BGPVDT=Y
  1. S BGPPER=BGPVDT
  1. I BGPPER="" W !,"Start date not entered.",! G TP
  1. ;Setup: BGPBD - begin date & BGPED - end date
  1. S BGPBD=BGPPER
  1. S:$E(BGPBD,4,7)="0000" $E(BGPBD,4,7)="0101"
  1. S BGPED=$$FMADD^XLFDT(BGPPER,BGPLEN)
  1. ;I BGPLEN=90 S BGPMON=$E(BGPPER,4,5)+3 S:BGPMON<10 BGPMON="0"_BGPMON S BGPED=$E(BGPPER,1,3)_BGPMON_$E(BGPPER,6,7)
  1. ;I BGPLEN=365 S BGPED=($E(BGPPER,1,3)+1)_$E(BGPPER,4,7)
  1. I BGPED>DT D G:BGPDO=1 TP
  1. .W !!,"You have selected Current Report period ",$$FMTE^XLFDT(BGPBD)," through ",$$FMTE^XLFDT(BGPED),"."
  1. .W !,"The end date of this report is in the future; your data will not be",!,"complete.",!
  1. .K DIR S BGPDO=0 S DIR(0)="Y",DIR("A")="Do you want to change your Current Report Dates",DIR("B")="N" KILL DA D ^DIR KILL DIR
  1. .I $D(DIRUT) S BGPDO=1 Q
  1. .I Y S BGPDO=1 Q
  1. .Q
  1. BY ;get previous year
  1. N X1,X2,X
  1. S X1=BGPBD,X2=-365
  1. D C^%DTC
  1. S BGPPBD=X
  1. S X1=BGPED,X2=-365
  1. D C^%DTC
  1. S BGPPED=X
  1. I BGPANS=3 S BGPPBD=($E(BGPBD,1,3)-1)_$E(BGPBD,4,7),BGPPED=($E(BGPED,1,3)-1)_$E(BGPED,4,7)
  1. ;get baseline year
  1. S BGPVDT=""
  1. W !!,"Enter the Baseline Year to compare data to.",!,"Use a 4 digit year, e.g. 1999, 2000"
  1. S DIR(0)="D^::EP"
  1. S DIR("A")="Enter Year (e.g. 2000)"
  1. D ^DIR KILL DIR
  1. I $D(DIRUT) G TP
  1. I $D(DUOUT) S DIRUT=1 G TP
  1. S BGPVDT=Y
  1. I $E(Y,4,7)'="0000" W !!,"Please enter a year only!",! G BY
  1. S X=$E(BGPPER,1,3)-$E(BGPVDT,1,3)
  1. S X=X_"0000"
  1. S BGPBBD=BGPBD-X,BGPBBD=$E(BGPBBD,1,3)_$E(BGPBD,4,7)
  1. S BGPBED=BGPED-X,BGPBED=$E(BGPBED,1,3)_$E(BGPED,4,7)
  1. W !!,"The date ranges for this report are:"
  1. W !?5,"Report Period: ",?31,$$FMTE^XLFDT(BGPBD)," to ",?31,$$FMTE^XLFDT(BGPED)
  1. W !?5,"Previous Year Period: ",?31,$$FMTE^XLFDT(BGPPBD)," to ",?31,$$FMTE^XLFDT(BGPPED)
  1. W !?5,"Baseline Period: ",?31,$$FMTE^XLFDT(BGPBBD)," to ",?31,$$FMTE^XLFDT(BGPBED)
  1. EP ;collect eligible provider to run report for
  1. W !!
  1. S DIC("A")="Which Eligible Provider: ",DIC="^VA(200,",DIC(0)="AEMQ" D ^DIC K DIC,DA
  1. I X="^" D XIT Q
  1. I Y=-1 W !!,"provider is required, use an '^' to exit." G EP
  1. S BGPPROV=+Y S DIR(0)="ST^CM:Core Measures;ACM:Alternate Core Measures;MSM:Menu Set Measures;SEL:Selected Measures (User Defined)"
  1. S DIR("A")="Which set of Measures should be included in this report" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) D XIT Q
  1. S BGPINDT=$E(Y)
  1. I BGPINDT="M" D MI I '$D(BGPIND) G SETIND
  1. I BGPINDT="S" D SI I '$D(BGPIND) G SETIND
  1. GI ;gather all measures
  1. I BGPINDT="C" D CI
  1. I BGPINDT="A" D AI
  1. I '$D(BGPIND) W !!,"no measures selected" G SETIND
  1. COMM ;
  1. ;I BGPINDT'="S" D LISTS
  1. BEN ;
  1. S BGPBEN=""
  1. S DIR(0)="S^1:Indian/Alaskan Native (Classification 01);2:Not Indian Alaskan/Native (Not Classification 01);3:All (both Indian/Alaskan Natives and Non 01)",DIR("A")="Select Beneficiary Population to include in this report"
  1. S DIR("B")="3"
  1. KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G COMM
  1. S BGPBEN=Y
  1. SUM ;display summary of this report
  1. W:$D(IOF) @IOF
  1. W !,$$CTR("SUMMARY OF MEANINGFUL USE CLINICAL QUALITY MEASURE REPORT TO BE GENERATED")
  1. W !!,"The date ranges for this report are:"
  1. W !?5,"Report Period: ",?31,$$FMTE^XLFDT(BGPBD)," to ",?31,$$FMTE^XLFDT(BGPED)
  1. W !?5,"Baseline Period: ",?31,$$FMTE^XLFDT(BGPBBD)," to ",?31,$$FMTE^XLFDT(BGPBED)
  1. W !!,"ALL Patients will be included."
  1. W !!,"These measures will be calculated: " S X=0 F S X=$O(BGPIND(X)) Q:X'=+X W !,?10,$P(^BGPMUIND(BGPMUYF,X,0),U,3)
  1. W !!,"Lists will be produced for these measures: "
  1. S X=0 F S X=$O(BGPLIST(X)) Q:X'=+X W !,?10,$P(^BGPMUIND(BGPMUYF,X,0),U,3)
  1. D PT^BGPMUDSL
  1. I BGPROT="" G LISTS
  1. ZIS ;call to XBDBQUE
  1. ;D REPORT^BGPMUUTL ;- I don't think this is necessary since it seems to only handle data export files
  1. ;I $G(BGPQUIT) D XIT Q
  1. ;I BGPRPT="" D XIT Q
  1. K IOP,%ZIS I (BGPROT="D"!(BGPROT="X")),BGPDELT="F" D NODEV,XIT Q
  1. W !! S %ZIS=$S(BGPDELT'="S":"QM",1:"M") D ^%ZIS
  1. ZIS1 ;
  1. ;I POP W !,"Report Aborted" S DA=BGPRPT,DIK="^BGPGPDCT(" D ^DIK K DIK D XIT Q
  1. ;I POP W !,"Report Aborted" S DA=BGPRPT,DIK="^BGPGPDPT(" D ^DIK K DIK D XIT Q
  1. ;I POP W !,"Report Aborted" S DA=BGPRPT,DIK="^BGPGPDBT(" D ^DIK K DIK D XIT Q
  1. I $D(IO("Q")) G TSKMN
  1. DRIVER ;
  1. K ^TMP($J)
  1. D ^BGPMUEPD ;gather data
  1. U IO
  1. D ^BGPMUPP ;print/export data
  1. D ^%ZISC
  1. K ^TMP($J)
  1. D XIT
  1. Q
  1. ;
  1. NODEV1 ;
  1. D ^BGPMUEPD ;gather data
  1. D ^BGPMUPP ;print/export data
  1. D ^%ZISC
  1. D XIT
  1. Q
  1. CI ;
  1. S X=0 F S X=$O(^BGPMUIND(BGPMUYF,"AMS","C",X)) Q:X'=+X S BGPIND(X)=""
  1. D LISTS
  1. Q
  1. AI ;
  1. S X=0 F S X=$O(^BGPMUIND(BGPMUYF,"AMS","A",X)) Q:X'=+X S BGPIND(X)=""
  1. D LISTS
  1. Q
  1. MI ;
  1. K BGPIND
  1. D ENM^BGPMUDSI
  1. I '$D(BGPIND) Q
  1. D LISTS
  1. Q
  1. SI ;
  1. K BGPIND
  1. D EN^BGPMUDSI
  1. I '$D(BGPIND) Q
  1. D LISTS
  1. Q
  1. LISTS ;any lists with measures?
  1. K BGPLIST
  1. W !!,"PATIENT LISTS"
  1. I '$D(^XUSEC("BGPZ PATIENT LISTS",DUZ)) W !!,"You do not have the security access to print patient lists.",!,"Please see your supervisor or program manager if you feel you should have",!,"the BGPZ PATIENT LISTS security key.",! D Q
  1. .K DIR S DIR(0)="E",DIR("A")="Press enter to continue" D ^DIR K DIR
  1. S DIR(0)="Y",DIR("A")="Do you want patient lists for any of the measures",DIR("B")="N" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT)!(Y="") Q
  1. I Y=0 Q
  1. K BGPLIST
  1. D EN^BGPMUDSL
  1. ;D EN^BGPMUDSI
  1. I '$D(BGPLIST) W !!,"No lists selected.",!
  1. I $D(BGPLIST) D RT^BGPMUDSL I '$D(BGPLIST)!($D(BGPQUIT)) G LISTS ;get report type for each list
  1. Q
  1. TSKMN ;EP ENTRY POINT FROM TASKMAN
  1. S ZTIO=$S($D(ION):ION,1:IO) I $D(IOST)#2,IOST]"" S ZTIO=ZTIO_";"_IOST
  1. I $G(IO("DOC"))]"" S ZTIO=ZTIO_";"_$G(IO("DOC"))
  1. I $D(IOM)#2,IOM S ZTIO=ZTIO_";"_IOM I $D(IOSL)#2,IOSL S ZTIO=ZTIO_";"_IOSL
  1. K ZTSAVE S ZTSAVE("BGP*")=""
  1. S ZTCPU=$G(IOCPU),ZTRTN="DRIVER^BGPMUEP",ZTDTH="",ZTDESC="MU PERF MEASURE REPORT" D ^%ZTLOAD D XIT Q
  1. Q
  1. ;
  1. NODEV ;
  1. S XBRP="",XBRC="NODEV1^BGPMUEP",XBRX="XIT^BGPMUEP",XBNS="BGP"
  1. D ^XBDBQUE
  1. ;D XIT
  1. Q
  1. ;
  1. XIT ;
  1. D ^%ZISC
  1. D EN^XBVK("BGP") I $D(ZTQUEUED) S ZTREQ="@"
  1. K DIRUT,DUOUT,DIR,DOD
  1. K DIADD,DLAYGO
  1. D KILL^AUPNPAT
  1. K X,X1,X2,X3,X4,X5,X6
  1. K A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,V,W,X,Y,Z
  1. K N,N1,N2,N3,N4,N5,N6
  1. K BD,ED
  1. K IOCPU,IOT,ZTREQ,ZTRTN,ZTIO,ZTDTH,ZTDESC,ZTCPT
  1. K XBRC,XBRP,XBRX,XWB,XBGL,XBNS
  1. K VALMBCK,VALMCNT,VALMHDR
  1. D ^XBFMK
  1. Q
  1. MUCHECK ;Site must have EHR 1.1 Patch 8 installed to qualify for MU since that is the certified version
  1. ;S XPXPCH="EHR*1.1*8"
  1. ;S X=$$PATCH^XPDUTL(XPXPCH)
  1. ;Q:X
  1. ;W !!,$$C^XBFUNC("Meaningful Use CQM reporting requires that the certified version be installed.")
  1. ;W !!,$$C^XBFUNC("EHR 1.1 Patch 8 must first be installed.")
  1. N IN,INSTDA,STAT
  1. S BGPQUIT=0
  1. S IN="EHR*1.1*8",INSTDA=""
  1. I '$D(^XPD(9.7,"B",IN)) D Q
  1. .W !!,$$C^XBFUNC("Meaningful Use CQM reporting requires that the certified version be installed.")
  1. .W !!,$$C^XBFUNC("EHR 1.1 Patch 8 must first be installed.") S BGPQUIT=1
  1. S INSTDA=$O(^XPD(9.7,"B",IN,INSTDA),-1)
  1. S STAT=+$P($G(^XPD(9.7,INSTDA,0)),U,9)
  1. I STAT'=3 D Q
  1. .W !!,$$C^XBFUNC("Meaningful Use CQM reporting requires that the certified version be installed.")
  1. .W !!,$$C^XBFUNC("EHR 1.1 Patch 8 must first be installed.")
  1. .S BGPQUIT=1
  1. Q
  1. CTR(X,Y) ;EP - Center X in a field Y wide.
  1. Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
  1. ;----------
  1. EOP ;EP - End of page.
  1. Q:$E(IOST)'="C"
  1. Q:$D(ZTQUEUED)!'(IOT="TRM")!$D(IO("S"))
  1. NEW DIR
  1. K DIR,DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
  1. S DIR(0)="E" D ^DIR KILL DIR
  1. Q
  1. ;----------
  1. USR() ;EP - Return name of current user from ^VA(200.
  1. Q $S($G(DUZ):$S($D(^VA(200,DUZ,0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
  1. ;----------
  1. LOC() ;EP - Return location name from file 4 based on DUZ(2).
  1. Q $S($G(DUZ(2)):$S($D(^DIC(4,DUZ(2),0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")
  1. ;----------
  1. ;
  1. GETBE ;EP
  1. D F
  1. I BGPBD="" Q
  1. D E
  1. Q
  1. F ;report start date
  1. S (BGPPER,BGPVDT,BGPBD)=""
  1. W !!,"Enter the reporting period start date."
  1. S DIR(0)="D^::EP"
  1. S DIR("A")="Enter Start Date"
  1. S DIR("?")="This report is compiled for a period. Enter a valid date."
  1. D ^DIR KILL DIR
  1. I $D(DIRUT) Q
  1. I $D(DUOUT) S DIRUT=1 Q
  1. S BGPVDT=Y
  1. S BGPBD=Y
  1. S BGPPER=BGPVDT
  1. Q
  1. E ;report start date
  1. S (BGPVDT,BGPED)=""
  1. W !!,"Enter the reporting period end date."
  1. S DIR(0)="D^::EP"
  1. S DIR("A")="Enter End Date"
  1. S DIR("?")="This report is compiled for a period. Enter a valid date."
  1. D ^DIR KILL DIR
  1. I $D(DIRUT) Q
  1. I $D(DUOUT) S DIRUT=1 Q
  1. ;S BGPVDT=Y
  1. S BGPED=Y
  1. Q