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

BGP3CL.m

Go to the documentation of this file.
  1. BGP3CL ; IHS/CMI/LAB - IHS GPRA 10 CMS REPORT DRIVER 01 Jul 2010 8:19 PM 30 Mar 2013 6:08 PM ;
  1. ;;13.0;IHS CLINICAL REPORTING;;NOV 20, 2012;Build 81
  1. ;
  1. ;
  1. W:$D(IOF) @IOF
  1. W !!,$$CTR("IHS 2013 CRS - RPMS PATIENT DATA FOR ANNUAL CMS HOSPITAL REPORTING",80)
  1. INTRO ;
  1. D XIT
  1. WARN ;
  1. W !," ***************************"
  1. W !," ****** W A R N I N G ******"
  1. W !," ***************************"
  1. W !
  1. W !,"This report was last updated in April 2009 through the CMS Specifications "
  1. W !,"Manual for discharges effective 4/1/2009, and the CRS CMS Report was included"
  1. W !,"in CRS Version 8.0."
  1. W !
  1. W !,"It is recommended this report NOT be used until it is updated. OIT "
  1. W !,"anticipates this report will be updated with CRS Version 11.0."
  1. W !
  1. W !,"If you decide to use the information included in this report, because the"
  1. W !,"information may be inaccurate you will need to validate the information "
  1. W !,"reported against the current CMS Specifications Manual. The URL for the "
  1. W !,"current manual is listed below."
  1. W !!,"http://www.qualitynet.org/dcs/ContentServer?c=Page&pagename=QnetPublic%2FPage%2FQnetTier2&cid=1141662756099"
  1. W !
  1. S DIR(0)="Y",DIR("A")="Do you want to continue with this report",DIR("B")="Y" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) D XIT Q
  1. I 'Y D XIT Q
  1. S BGPRPTYR=$O(^BGPCTRL("B",2013,0))
  1. S X=0 F S X=$O(^BGPCTRL(BGPRPTYR,42,X)) Q:X'=+X W !,^BGPCTRL(BGPRPTYR,42,X,0)
  1. D PAUSE
  1. GETLOC ;
  1. K DIC S DIC="^AUTTLOC(",DIC(0)="AEMQ",DIC("A")="Enter the name of your Hospital: ",DIC("B")=$P(^DIC(4,DUZ(2),0),U) D ^DIC
  1. I Y=-1 D XIT Q
  1. S BGPHOSP=+Y
  1. SETIND ;
  1. K BGPIND
  1. D EP^BGP3CSI
  1. I '$D(BGPIND) W !!,"No measures selected." D PAUSE,XIT Q
  1. SETLIST ;
  1. K BGPPLST,BGPPLSTL
  1. F BGPXX=0 F S BGPXX=$O(BGPIND(BGPXX)) Q:BGPXX="" D
  1. .W !!,"You will now be asked to select which patient lists you want"
  1. .W !,"within the ",$P(^BGPCMSIB(BGPXX,0),U,3)," topic.",!
  1. .D PAUSE
  1. .D EN^BGP3CSII
  1. .I '$D(BGPPLSTL(BGPXX)) W !!,"No lists selected for topic ",$P(^BGPCMSIB(BGPXX,0),U,3),"." D PAUSE
  1. I '$D(BGPPLSTL) W !!,"No patient lists selected." D PAUSE,XIT Q
  1. D TAXCHK^BGP3CTXC
  1. TP1 S (BGPBD,BGPED,BGPTP)=""
  1. W !
  1. S DIR(0)="S^1:1st Quarter January 1 - March 31;2:2nd Quarter April 1 - June 30;3:3rd Quarter July 1 - September 30;4:4th Quarter October 1 - December 31;5:User-Defined Report Period (enter beginning and ending date)"
  1. S DIR("A")="Enter the date range for your report"
  1. KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) D XIT Q
  1. S BGPQTR=Y
  1. I BGPQTR=5 D ENDDATE
  1. I BGPQTR'=5 D F
  1. I BGPPER="" W !,"Year not entered.",! G TP1
  1. I BGPQTR=1 S BGPBD=$E(BGPPER,1,3)_"0101",BGPED=$E(BGPPER,1,3)_"0331"
  1. I BGPQTR=2 S BGPBD=$E(BGPPER,1,3)_"0401",BGPED=$E(BGPPER,1,3)_"0630"
  1. I BGPQTR=3 S BGPBD=$E(BGPPER,1,3)_"0701",BGPED=$E(BGPPER,1,3)_"0930"
  1. I BGPQTR=4 S BGPBD=$E(BGPPER,1,3)_"1001",BGPED=$E(BGPPER,1,3)_"1231"
  1. I BGPQTR=5 S BGPBD=BGPUDBD,BGPED=BGPPER,BGPPER=$E(BGPED,1,3)_"0000"
  1. I BGPED>DT D G:BGPDO=1 TP1
  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. W !!,"The date range for this report is: ",$$FMTE^XLFDT(BGPBD)," to ",$$FMTE^XLFDT(BGPED),!!
  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" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G TP1
  1. S BGPBEN=Y
  1. TEXT ;
  1. S BGPTEXD=""
  1. W !
  1. S DIR(0)="Y",DIR("A")="Do you want to have the explanatory/logic text printed with your report",DIR("B")="Y" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G BEN
  1. S BGPTEXD=Y
  1. ZIS ;call to XBDBQUE
  1. K IOP,%ZIS
  1. W !! S %ZIS="PQM" D ^%ZIS
  1. I POP D XIT Q
  1. ZIS1 ;
  1. I $D(IO("Q")) G TSKMN
  1. DRIVER ;
  1. I $D(ZTQUEUED) S ZTREQ="@"
  1. D ^BGP3C1
  1. U IO
  1. D ^BGP3CP
  1. D ^%ZISC
  1. D XIT
  1. Q
  1. ;
  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^BGP3CL",ZTDTH="",ZTDESC="CRS 13 CMS REPORT" D ^%ZTLOAD D XIT Q
  1. Q
  1. ;
  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. D KILL^AUPNPAT
  1. D ^XBFMK
  1. Q
  1. ;
  1. PAUSE ;EP - pause
  1. K DIR,DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
  1. S DIR("A")="Press Enter to Continue",DIR(0)="E" D ^DIR KILL DIR
  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. ENDDATE ;
  1. W !!,"When entering dates, if you do not enter a full 4 digit year (e.g. 2013)"
  1. W !,"will assume a year in the past, if you want to put in a future date,"
  1. W !,"remember to enter the full 4 digit year. For example, if today is"
  1. W !,"January 4, 2013 and you type in 6/30/08 the system will assume the year"
  1. W !,"as 1908 since that is a date in the past. You must type 6/30/2013 if you"
  1. W !,"want a date in the future."
  1. S (BGPPER,BGPVDT)=""
  1. DATES ;
  1. S BGPUDBD="",BGPUDED=""
  1. K DIR W ! S DIR(0)="DO^::EXP",DIR("A")="Enter Beginning Date"
  1. D ^DIR Q:Y<1 S BGPUDBD=Y
  1. K DIR S DIR(0)="DO^:DT:EXP",DIR("A")="Enter Ending Date"
  1. D ^DIR Q:Y<1 S (BGPPER,BGPVDT)=Y
  1. ;
  1. I BGPVDT<BGPUDBD D G DATES
  1. . W !!,$C(7),"Sorry, Ending Date MUST not be earlier than Beginning Date."
  1. ;
  1. ;
  1. Q
  1. F ;calendar year
  1. S (BGPPER,BGPVDT)=""
  1. W !!,"Enter the Calendar Year for the report END date. Use a 4 digit",!,"year, e.g. 2013"
  1. S DIR(0)="D^::EP"
  1. S DIR("A")="Enter Year"
  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. I $E(Y,4,7)'="0000" W !!,"Please enter a year only!",! G F
  1. S BGPPER=BGPVDT
  1. Q