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

BUDCRPT2.m

Go to the documentation of this file.
  1. BUDCRPT2 ; IHS/CMI/LAB - UDS REPORT DRIVER ;
  1. ;;10.0;IHS/RPMS UNIFORM DATA SYSTEM;;FEB 04, 2016;Build 50
  1. ;
  1. ;
  1. Q ;not at top
  1. ;
  1. EN ;EP
  1. D EOJ
  1. EN1 ;
  1. S BUDSITE=""
  1. W ! S DIC="^BUDCSITE(",DIC(0)="AEMQ",DIC("A")="Enter your site: " D ^DIC
  1. I Y=-1 D EOJ Q
  1. S BUDSITE=+Y
  1. I '$O(^BUDCSITE(BUDSITE,11,0)) W !!,"Warning: There are no locations defined in the site parameter file for this",!,"site. Report will not be accurate!" G EN
  1. D TAXCHK^BUDCXTCH
  1. D YEAR
  1. I BUDYEAR="" W !!,"Year not entered.",! D EOJ Q
  1. D QUARTER ;get time period
  1. I BUDQTR="" W !,"Time period not entered." D EOJ Q
  1. ;get indian or not
  1. S BUDCEN=""
  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")="1" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) W !!,"Classification not entered." D EOJ Q
  1. S BUDCEN=Y
  1. W !!,"Depending on the size of your database, this report may take 2-4 hours to run"
  1. W !,"and produce patient reports that are hundreds of pages long. It is recommended"
  1. W !,"that these reports be run at night and printed to an electronic file, rather "
  1. W !,"than directly to a printer."
  1. W !
  1. S DIR(0)="Y",DIR("A")="Do you want to exit this program now",DIR("B")="N" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) D EOJ Q
  1. I Y D EOJ Q
  1. ;S XBRP="PRINT^BUDCRPTP",XBRC="PROC^BUDCRPTC",XBRX="EOJ^BUDCRPT2",XBNS="BUD"
  1. ;D ^XBDBQUE
  1. ;D EOJ
  1. D PT^BUDCRPTE
  1. I BUDROT="" G EN1
  1. ZIS ;call to XBDBQUE
  1. K IOP,%ZIS I BUDROT="D",BUDDELT="F" D NODEV,EOJ Q
  1. W !! S %ZIS=$S(BUDDELT'="S":"PQM",1:"PM") D ^%ZIS
  1. ZIS1 ;
  1. I POP W !,"Report Aborted" D EOJ Q
  1. I $D(IO("Q")) G TSKMN
  1. DRIVER ;
  1. D PROC^BUDCRPTC
  1. U IO
  1. D PRINT^BUDCRPTP
  1. D ^%ZISC
  1. S:$D(ZTQUEUED) ZTREQ="@"
  1. D EOJ
  1. Q
  1. NODEV ;
  1. S XBRP="",XBRC="NODEV1^BUDCRPT2",XBRX="EOJ^BUDCRPT2",XBNS="BUD"
  1. D ^XBDBQUE
  1. Q
  1. NODEV1 ;
  1. D PROC^BUDCRPTC
  1. D PRINT^BUDCRPTP
  1. D ^%ZISC
  1. D EOJ
  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("BUD*")=""
  1. S ZTCPU=$G(IOCPU),ZTRTN="DRIVER^BUDCRPT2",ZTDTH="",ZTDESC="UDS 15 REPORT" D ^%ZTLOAD D EOJ Q
  1. Q
  1. M ;EP - called from option
  1. D EOJ
  1. D GENI
  1. K BUDT3A,BUDT3B,BUDT5,BUDT5L,BUDT5L1,BUDT6,BUDT6L,BUDT5L2,BUDT5L3
  1. W "UDS Patient and Provider List Selection"
  1. W !!?5,"1 All Patients w/Visits by ZIP Code and Insurance Source"
  1. W !?5,"2 All Patients w/Visits, by Age & Gender (Tables 3A)"
  1. W !?5,"3 All Patients w/Visits, by Hispanic or Latino Identity & Race (Table 3B)"
  1. W !?5,"4 Income Percent of Poverty Level (Table 4)"
  1. W !?5,"5 Principle Third Party Medical Insurance Source (Table 4)"
  1. W !?5,"6 Characteristics of Special Populations (Table 4)"
  1. W !?5,"7 Provider/Staff List (Table 5 col A)"
  1. W !?5,"8 All patients by Service Category (Table 5 col B&C)"
  1. W !?5,"9 All Visits w/Uncategorized Primary Prov (Table 5 col B&C)"
  1. W !?5,"10 All Patients by Diagnosis (Table 6A)"
  1. W !?5,"11 ALL Patient Lists for LST1 -Sub Menu"
  1. S DIR(0)="L^1:11",DIR("A")="Include which Lists",DIR("B")=1 KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) D EOJ Q
  1. F X=1:1 S Z=$P(Y,",",X) Q:Z="" D
  1. .I Z=11 S (BUDT3A,BUDT3B,BUDT3BRL,BUDT4,BUDT4IPP,BUDT4PMI,BUDT4CHA,BUDT5,BUDT6,BUDT3AL,BUDT5L,BUDT5L1,BUDT6L,BUDTZ,BUDTZL,BUDT5L2)=1
  1. .I Z=2 S (BUDT3A,BUDT3AL)=1
  1. .I Z=3 S (BUDT3B,BUDT3BRL)=1
  1. .I Z=4 S (BUDT4,BUDT4IPP)=1
  1. .I Z=5 S (BUDT4,BUDT4PMI)=1
  1. .I Z=6 S (BUDT4,BUDT4CHA)=1
  1. .I Z=7 S (BUDT5,BUDT5L1)=1
  1. .I Z=8 S (BUDT5,BUDT5L)=1
  1. .I Z=9 S (BUDT5,BUDT5L2)=1
  1. .I Z=10 S (BUDT6,BUDT6L)=1
  1. .I Z=1 S (BUDTZ,BUDTZL)=1
  1. G EN1
  1. Q
  1. ;
  1. T3A ;EP - entry point for Table 3A only
  1. D EOJ
  1. S (BUDT3A,BUDT3AL)=1
  1. D GENI
  1. D T3AI
  1. G EN1
  1. ;
  1. T4IPPL ;EP - called from option
  1. D EOJ
  1. S BUDT4IPP=1,BUDT4=1
  1. D GENI
  1. D T4IPPLI
  1. G EN1
  1. ;
  1. ;
  1. T4IPPLI ;intro for table 3A
  1. W !!,"INCOME PERCENT OF POVERTY LEVEL (TABLE 4)"
  1. W !,"This report provides a list of all patients with an income percent "
  1. W !,"of poverty level (=<100%, 101-150%, 151-200% >200%, Unknown) during"
  1. W !,"the report period."
  1. W !
  1. Q
  1. ;
  1. T4PMIS ;EP - called from option
  1. D EOJ
  1. S BUDT4PMI=1,BUDT4=1
  1. D GENI
  1. D T4IPMIS
  1. G EN1
  1. ;
  1. ;
  1. T4IPMIS ;intro for table 4 PMIS
  1. W !!,"PRINCIPLE THIRD PARTY MEDICAL INSURANCE SOURCE (TABLE 4)"
  1. W !,"This report will provide a list of all patients and the type of medical"
  1. W !,"insurance the patient had as of the patient's last visit during the"
  1. W !,"report period."
  1. W !
  1. Q
  1. T4CHAR ;EP - called from option
  1. D EOJ
  1. S BUDT4CHA=1,BUDT4=1
  1. D GENI
  1. D T4ICHAR
  1. G EN1
  1. ;
  1. ;
  1. T4ICHAR ;intro for table 4 CHAR
  1. W !!,"CHARACTERISTICS OF SPECIAL POPULATIONS (TABLE 4)"
  1. W !,"This report provides a list of all patients who are migrant workers,"
  1. W !,"seasonal workers, homeless, school based health center patients, or"
  1. W !,"a veteran during the report period."
  1. W !
  1. Q
  1. TUSVE ;EP
  1. D EOJ
  1. S (BUDT3B,BUDT3BEL)=1
  1. D GENI
  1. D T3BEI
  1. G EN1
  1. ;
  1. TUSVR ;EP
  1. D EOJ
  1. S (BUDT3B,BUDT3BRL)=1
  1. D GENI
  1. D T3BRI
  1. G EN1
  1. ;
  1. T3AI ;intro for table 3A
  1. W !!,"ALL PATIENTS BY AGE & GENDER (Tables 3A)"
  1. W !,"This report lists all patients who have at least one visit for the specified"
  1. W !,"time period that meets the visit definition criteria. Sorted by community, "
  1. W !,"age, and gender and lists all visits that fit the definition. Age is "
  1. W !,"calculated as of June 30th of the report year."
  1. Q
  1. T3BRI ;intro for table 3B - RACE
  1. W !!,"ALL PATIENTS BY HISPANIC IDENTITY & RACE (Tables 3B)"
  1. W !,"This report lists all patients by Hispanic or Latino Identity/Race/Language"
  1. W !,"who have at least one visit for the specified time period that meets the "
  1. W !,"visit definition criteria. Sorted by race/Hispanic identity, age, gender, "
  1. W !,"and community and lists all visits that fit the definition. Age is calculated"
  1. W !,"as of June 30th of the report year."
  1. Q
  1. T3BEI ;intro for table 3B - RACE
  1. W !!,"ALL PATIENTS BY ETHNICITY (TABLE 3B)"
  1. W !,"This report lists all patients who have at least on visit for the specified"
  1. W !,"time period that meet the above criteria. Sorted by ethncicity, age, sex "
  1. W !,"and community."
  1. W !,"Lists all visits that fit the definition. Age is calculated as of June 30th"
  1. W !,"of the report year."
  1. Q
  1. TZ ;EP - entry point for Table 3A only
  1. D EOJ
  1. S (BUDTZ,BUDTZL)=1
  1. D GENI
  1. D TZAI
  1. G EN1
  1. TZAI ;intro for table Z
  1. W !!,"Patients by Zip Code and Insurance Source"
  1. W !,"The Patient Zip Code by Insurance Source table reports the number of patients"
  1. W !,"by their most recent (last) zip code as entered in patient registration and"
  1. W !,"their primary health insurance source as of the last visit during the "
  1. W !,"report period."
  1. Q
  1. T5 ;EP
  1. D EOJ
  1. S BUDT5=1,BUDT5L=1
  1. D GENI
  1. D T5I
  1. G EN1
  1. ;
  1. T5I ;
  1. W !,"ALL PATIENTS BY SERVICE CATEGORY (Table 5, columns b and c)"
  1. W !,"This report lists all patients and related visits as defined above, categorized"
  1. W !,"by UDS-defined service categories (primary provider code). Sorted by"
  1. W !,"community, age and gender. See UDS User Manual for how UDS disciplines are"
  1. W !,"mapped to RPMS provider codes."
  1. Q
  1. T5B ;EP
  1. D EOJ
  1. S BUDT5=1,BUDT5L2=1
  1. D GENI
  1. D T5BI
  1. G EN1
  1. ;
  1. T5BI ;
  1. W !,"ALL PATIENTS FOR UNCATEGORIZED PROVIDER VISITS (Table 5, columns b and c)"
  1. W !,"This report lists all patients and related visits as defined above, that"
  1. W !,"are not counted toward Table 5 because the primary provider code could not "
  1. W !,"be categorized by UDS-defined service categories. Sorted by community, age"
  1. W !,"and gender. See UDS User Manual for how UDS disciplines are mapped to RPMS"
  1. W !,"provider codes."
  1. Q
  1. T6 ;EP - entry point for Table 6A only
  1. D EOJ
  1. S (BUDT6,BUDT6L)=1
  1. D GENI
  1. D T6I
  1. G EN1
  1. ;
  1. T6I ;intro for table 6
  1. W !,"ALL PATIENTS BY DIAGNOSIS (Table 6A)"
  1. W !,"This report lists all patients and related visits as defined above, categorized"
  1. W !,"by specific UDS-defined diagnoses or tests/screenings. Sorted by"
  1. W !,"community, age and gender."
  1. Q
  1. T5A ;EP - called from option
  1. D EOJ
  1. S (BUDT5,BUDT5L1)=1
  1. D GENI
  1. D T5AI
  1. G EN1
  1. T5AI ;
  1. W !,"PROVIDER/STAFF LIST (Table 5 column a)"
  1. W !,"This report provides a list of all Providers and other facility staff who are"
  1. W !,"documented in RPMS categorized by UDS-defined service categories. Use this"
  1. W !,"list to manually calculate FTEs for each staff category to document in Table"
  1. W !,"5 column a (FTEs)."
  1. Q
  1. TOL ;EP
  1. D EOJ
  1. S (BUDT6,BUDTOL)=1
  1. D GENI
  1. D TOLI
  1. G EN1
  1. TOLI ;
  1. W !,"This report will list any visit that is incomplete but has a service",!,"relevant to lines 21 through 26 of Table 6A attached to it."
  1. W !,"Incomplete visits are not looked at when generating this report so ",!,"this list will provide you with a list of visits that potentially should be "
  1. W !,"completed or merged to a complete visit in order to be counted in Table 6A"
  1. Q
  1. ;
  1. T5C ;EP
  1. D EOJ
  1. S BUDT5=1,BUDT5L3=1
  1. D GENI
  1. D T5CI
  1. G EN1
  1. ;
  1. T5CI ;
  1. W !,"ALL PATIENTS W/MULTIPLE VISIS IN SVC CATS (TABLE 5 COL B&C)"
  1. W !,"This report provides a list of patients who had more than one visit on"
  1. W !,"a single day for any of the six BPHC Service Categories. Per the BPHC "
  1. W !,"Uniform Data System Manual, 2007 Revision, page 6 each patient may have, "
  1. W !,"at a maximum:"
  1. W !,"- One medical visit (Line 15)"
  1. W !,"- One dental visit (Line 19)"
  1. W !,"- One mental health visit (Line 20)"
  1. W !,"- One substance abuse visit (Line 21)"
  1. W !,"- One 'other health' visit for each type of 'other health' provider"
  1. W !," (e.g. nutritionist, podiatrist, speech therapist, acupuncturist, "
  1. W !," optometrist) (Line 22)"
  1. W !,"- One enabling service visit for each type of enabling provider"
  1. W !," (e.g. case management or health education) (Line 29)"
  1. Q
  1. QUARTER ;
  1. S BUDQTR=""
  1. S DIR("?",1)="Choose the time period to report on"
  1. S DIR("?",2)=" 1 January 1 - March 31"
  1. S DIR("?",3)=" 2 April 1 - June 30"
  1. S DIR("?",4)=" 3 July 1 - September 30"
  1. S DIR("?",5)=" 4 October 1 - December 31"
  1. S DIR("?",6)=" F Full Calender Year January 1 - December 31"
  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);F:Full Calendar Year (January 1 - December 31)"
  1. S DIR("A")="Choose the time period to report on",DIR("B")="F" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT)!(Y="") S BUDQUIT="" Q
  1. S BUDQTR=Y
  1. I Y=1 S BUDBD=$E(BUDYEAR,1,3)_"0101",BUDED=$E(BUDYEAR,1,3)_"0331"
  1. I Y=2 S BUDBD=$E(BUDYEAR,1,3)_"0401",BUDED=$E(BUDYEAR,1,3)_"0630"
  1. I Y=3 S BUDBD=$E(BUDYEAR,1,3)_"0701",BUDED=$E(BUDYEAR,1,3)_"0930"
  1. I Y=4 S BUDBD=$E(BUDYEAR,1,3)_"1001",BUDED=$E(BUDYEAR,1,3)_"1231"
  1. I Y="F" S BUDBD=$E(BUDYEAR,1,3)_"0101",BUDED=$E(BUDYEAR,1,3)_"1231"
  1. W !!,"Your report will be run for the time period: ",$$FMTE^XLFDT(BUDBD)," to ",$$FMTE^XLFDT(BUDED)
  1. Q
  1. YEAR ;
  1. S BUDYEAR=""
  1. W !
  1. W !,"Enter the Calendar Year. Use a 4 digit year, e.g. 2015"
  1. S DIR(0)="D^::EP"
  1. S DIR("A")="Enter Calendar Year"
  1. S DIR("?")="This report is compiled for a period. Enter a valid date."
  1. D ^DIR KILL DIR
  1. K DIC
  1. I $D(DUOUT) S DIRUT=1 Q
  1. I $D(DIRUT) Q
  1. I $E(Y,4,7)'="0000" W !!,"Please enter a year only!",! G YEAR
  1. S BUDYEAR=Y,BUDBD=$E(BUDYEAR,1,3)_"0101",BUDED=$E(BUDYEAR,1,3)_"1231"
  1. S BUDCAD=$E(BUDYEAR,1,3)_"0630"
  1. Q
  1. EOJ ;
  1. D EN^XBVK("BUD")
  1. Q
  1. GENI ;general introductions
  1. W:$D(IOF) @IOF
  1. W !,$$CTR($$LOC,80)
  1. W !,$$CTR("UDS 2015",80)
  1. W !,"NOTE: Patient lists may be hundreds of pages long, depending on the size of your"
  1. W !,"patient population. It is recommended that you run these reports at night and"
  1. W !,"print to an electronic file, not directly to a printer.",!
  1. K DIR S DIR(0)="E",DIR("A")="Press Enter to Continue" D ^DIR K DIR
  1. W !!,"The Patient List option documents the individual patients and visits"
  1. W !,"that are counted and summarized on each Table report (main menu"
  1. W !,"option REP). The summary Table report is included at the beginning of each"
  1. W !,"List report."
  1. W !,"UDS searches your database to find all visits and related patients"
  1. W !,"during the time period selected. Based on the UDS definition, to be counted"
  1. W !,"as a patient, the patient must have had at least one visit meeting the "
  1. W !,"following criteria:"
  1. W !?4,"- must be to a location specified in your visit location setup"
  1. W !?4,"- must be to Service Category Ambulatory (A), Hospitalization (H), Day"
  1. W !?6,"Surgery (S), Observation (O), Telemedicine (M), Nursing home visit (R), "
  1. W !?6,"or In-Hospital (I) visit"
  1. W !?4,"- must NOT have an excluded clinic code (see User Manual for a list)"
  1. W !?4,"- must have a primary provider and a coded purpose of visit"
  1. W !?4,"- the patient must NOT have a gender of 'Unknown'"
  1. W !
  1. Q
  1. ;
  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. 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. ;----------