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

BUD7RPTP.m

Go to the documentation of this file.
  1. BUD7RPTP ; IHS/CMI/LAB - UDS REPORT PRINT ;
  1. ;;10.0;IHS/RPMS UNIFORM DATA SYSTEM;;FEB 04, 2016;Build 50
  1. ;
  1. PRINT ;EP
  1. S BUDPG=0
  1. S BUDQUIT=0
  1. S BUD80L="",$P(BUD80L,"_",79)="_"
  1. I $G(BUDTZ) D TZ G:BUDQUIT EOJ
  1. I $G(BUDT3A) D T3A G:BUDQUIT EOJ
  1. I $G(BUDT3B) D T3B G:BUDQUIT EOJ
  1. I $G(BUDT4) D T4 G:BUDQUIT EOJ
  1. I $G(BUDT5) D T5 G:BUDQUIT EOJ
  1. I $G(BUDT6) D T6 G:BUDQUIT EOJ
  1. D PATLISTS
  1. D EOJ
  1. Q
  1. ;
  1. EOJ ;
  1. K ^TMP($J)
  1. K ^XTMP("BUD7RPT1",BUDJ,BUDH)
  1. Q
  1. T4 ;
  1. Q
  1. T3A ;
  1. D HEADER Q:BUDQUIT D T3ASH
  1. ;print out each line
  1. S BUDZ=0 F S BUDZ=$O(^BUDETTA("AC",BUDZ)) Q:BUDZ>38!(BUDQUIT) D
  1. .S BUDC=$O(^BUDETTA("AC",BUDZ,0))
  1. .I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T3ASH
  1. .S BUDY=^BUDETTA(BUDC,0)
  1. .S BUDX=$P(BUDY,U,2) ;column one End control
  1. .W !
  1. .I BUDX<10 W " "
  1. .W $P(BUDY,U,2),?5,$P(BUDY,U,3)
  1. .;I +BUDX=0 Q
  1. .W ?35,$$C($P(BUDTOT("M"),U,BUDX)),?50,$$C($P(BUDTOT("F"),U,BUDX)),?68,$$C($P(BUDTOT("ALL"),U,BUDX))
  1. .I BUDX=20 D
  1. ..I $Y>(IOSL-4) D HEADER Q:BUDQUIT D T3ASH
  1. ..W !!?10,"SUBTOTAL 0-19",?35,$$C(BUD019("M")),?50,$$C(BUD019("F")),?68,$$C(BUD019("ALL")),!
  1. S BUDC=$O(^BUDETTA("B",43,0))
  1. I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T3ASH
  1. W !,$P(^BUDETTA(BUDC,0),U,2),?5,$P(^BUDETTA(BUDC,0),U,3)
  1. S BUDC=$O(^BUDETTA("AC",39,0))
  1. I $Y>(IOSL-2) D HEADER Q:BUDQUIT D T3ASH
  1. S BUDY=^BUDETTA(BUDC,0)
  1. S BUDX=$P(BUDY,U,2) ;column one End control
  1. W !
  1. W $P(BUDY,U,2),?5,$P(BUDY,U,3)
  1. W ?35,$$C($P(BUDTOT("M"),U,BUDX)),?50,$$C($P(BUDTOT("F"),U,BUDX)),?68,$$C($P(BUDTOT("ALL"),U,BUDX))
  1. W !
  1. Q
  1. T3ASH ;
  1. W !,$$CTR($G(^BUDETTA(1,11)),80),!
  1. F Y=2:1:4 S X=$O(^BUDETTA("B",Y,0)) W !,$P(^BUDETTA(X,0),U,2),?5,$P(^BUDETTA(X,0),U,3),?33,$P(^BUDETTA(X,0),U,4),?50,$P(^BUDETTA(X,0),U,5),?68,$P(^BUDETTA(X,0),U,6)
  1. W !,$TR($J("",80)," ","-")
  1. Q
  1. T3BSH ;
  1. W !!,$$CTR("TABLE 3B -",80)
  1. W !,$$CTR("PATIENTS BY RACE/ETHNICITY/LANGUAGE",80),!,BUD80L
  1. ;W !,$TR($J("",80)," ","-")
  1. Q
  1. TZSH ;
  1. W !!,$$CTR("CENTER/GRANTEE PROFILE",80)
  1. W !,$$CTR("COVER SHEET",80),!
  1. ;W !,$TR($J("",80)," ","-")
  1. W !!,$$CTR("PATIENTS BY ZIP CODE",80)
  1. W !,$TR($J("",80)," ","-")
  1. W !!?5,"ZIP CODE",?40,"PATIENTS"
  1. W !,$TR($J("",80)," ","-")
  1. Q
  1. PATLISTS ;
  1. D ^BUD7RPTL
  1. Q
  1. T3B ;
  1. D HEADER Q:BUDQUIT D T3BSH
  1. ;print out each line
  1. W !?66,"NUMBER"
  1. W !,"PATIENTS BY HISPANIC/LATINO IDENTITY",?67,"(a)",!,BUD80L
  1. W !,"NUMBER OF PATIENTS",!,BUD80L
  1. S BUDX=0 F S BUDX=$O(BUDHISP(BUDX)) Q:BUDX'=+BUDX!(BUDQUIT) D
  1. .I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T3BSH
  1. .W !?2,$P(BUDHISP(BUDX),U),?8,$P(BUDHISP(BUDX),U,2)
  1. .I $P(BUDHISP(BUDX),U,4)]"" W !?8,$P(BUDHISP(BUDX),U,4)
  1. .I $P(BUDHISP(BUDX),U,3)]"" W ?65,$$C($P(BUDHISP(BUDX),U,3))
  1. .W !,BUD80L
  1. ;
  1. I $Y>(IOSL-6) D HEADER Q:BUDQUIT D T3BSH
  1. W !!,BUD80L,!?66,"NUMBER"
  1. W !,"PATIENTS BY RACE",?67,"(a)",!,BUD80L
  1. W !,"NUMBER OF PATIENTS",!,BUD80L
  1. F BUDX="5A","5B","5C","5Z",6,7,8,9,10,11 Q:BUDQUIT D
  1. .I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T3BSH
  1. .W !?2,$P(BUDRACET(BUDX),U),?8,$P(BUDRACET(BUDX),U,2)
  1. .I $P(BUDRACET(BUDX),U,4)]"" W !?8,$P(BUDRACET(BUDX),U,4)
  1. .I $P(BUDRACET(BUDX),U,3)]"" W ?65,$$C($P(BUDRACET(BUDX),U,3))
  1. .W !,BUD80L
  1. I $Y>(IOSL-6) D HEADER Q:BUDQUIT D T3BSH
  1. W !!,BUD80L,!?66,"NUMBER"
  1. W !,"PATIENTS BY LANGUAGE",?67,"(a)",!,BUD80L
  1. W !,"NUMBER OF PATIENTS",!,BUD80L
  1. W !?2,"12",?8,"PATIENTS BEST SERVED IN A LANGUAGE OTHER THAN ENGLISH",!,BUD80L
  1. W !
  1. Q
  1. TZ ;
  1. D HEADER Q:BUDQUIT D TZSH
  1. ;print out each line
  1. S BUDZTOT=0
  1. S ^XTMP("BUD7RPT1",BUDJ,BUDH,"ZIP","OTHER ZIP CODES")=0
  1. ;GET TOTAL
  1. S BUDZ="" F S BUDZ=$O(^XTMP("BUD7RPT1",BUDJ,BUDH,"ZIP",BUDZ)) Q:BUDZ="" D
  1. .S BUDY=^XTMP("BUD7RPT1",BUDJ,BUDH,"ZIP",BUDZ)
  1. .S BUDZTOT=BUDZTOT+BUDY
  1. ;CALCULATE "OTHER"
  1. S BUDZ="" F S BUDZ=$O(^XTMP("BUD7RPT1",BUDJ,BUDH,"ZIP",BUDZ)) Q:BUDZ="" D
  1. .Q:BUDZ["OTHER"
  1. .Q:BUDZ["Unknown"
  1. .S BUDY=^XTMP("BUD7RPT1",BUDJ,BUDH,"ZIP",BUDZ)
  1. .S X=BUDY/BUDZTOT I X<.001 K ^XTMP("BUD7RPT1",BUDJ,BUDH,"ZIP",BUDZ) S ^XTMP("BUD7RPT1",BUDJ,BUDH,"ZIP","OTHER ZIP CODES")=^XTMP("BUD7RPT1",BUDJ,BUDH,"ZIP","OTHER ZIP CODES")+BUDY D
  1. ..;now reset the list so the others collate at the end
  1. ..S BUDCOM="" F S BUDCOM=$O(^XTMP("BUD7RPT1",BUDJ,BUDH,"Z",BUDZ,BUDCOM)) Q:BUDCOM="" D
  1. ...S BUDSEX="" F S BUDSEX=$O(^XTMP("BUD7RPT1",BUDJ,BUDH,"Z",BUDZ,BUDCOM,BUDSEX)) Q:BUDSEX="" D
  1. ....S BUDNAME="" F S BUDNAME=$O(^XTMP("BUD7RPT1",BUDJ,BUDH,"Z",BUDZ,BUDCOM,BUDSEX,BUDNAME)) Q:BUDNAME="" D
  1. .....S DFN=0 F S DFN=$O(^XTMP("BUD7RPT1",BUDJ,BUDH,"Z",BUDZ,BUDCOM,BUDSEX,BUDNAME,DFN)) Q:DFN'=+DFN D
  1. ......S X=0 F S X=$O(^XTMP("BUD7RPT1",BUDJ,BUDH,"Z",BUDZ,BUDCOM,BUDSEX,BUDNAME,DFN,X)) Q:X'=+X D
  1. .......S ^XTMP("BUD7RPT1",BUDJ,BUDH,"Z",BUDZ_"*",BUDCOM,BUDSEX,BUDNAME,DFN,X)=""
  1. .......K ^XTMP("BUD7RPT1",BUDJ,BUDH,"Z",BUDZ,BUDCOM,BUDSEX,BUDNAME,DFN,X)
  1. S BUDZ="" F S BUDZ=$O(^XTMP("BUD7RPT1",BUDJ,BUDH,"ZIP",BUDZ)) Q:BUDZ=""!(BUDQUIT) D
  1. .I $Y>(IOSL-4) D HEADER Q:BUDQUIT D TZSH
  1. .S BUDY=^XTMP("BUD7RPT1",BUDJ,BUDH,"ZIP",BUDZ)
  1. .W !?8,BUDZ,?40,$$C(BUDY),!,BUD80L
  1. Q:BUDQUIT
  1. W !!?8,"TOTAL",?40,$$C(BUDZTOT),!
  1. Q
  1. T5 ;print table 5
  1. D HEADER Q:BUDQUIT D T5SH
  1. ;lines 1-8
  1. F BUDL=1:1:7 S BUDY=$O(^BUDETFIV("B",BUDL,0)) Q:BUDQUIT D
  1. .Q:'BUDY
  1. .W !
  1. .I +BUDL<10 W " "
  1. .W BUDL,".",?6,$P(^BUDETFIV(BUDY,0),U,2)
  1. .I $P(^BUDETFIV(BUDY,0),U,3)]"" W !?6,$P(^BUDETFIV(BUDY,0),U,3)
  1. .I $P($G(BUDTAB5(BUDL)),U,1)]"" W ?60,$$C($P(BUDTAB5(BUDL),U,1),$S(BUDL=6:2,1:0)),?71,$$C($P(BUDTAB5(BUDL),U,2),2)
  1. .W !,BUD80L
  1. W !," 8.",?10,"Total Physicians",!?8,"(Lines 1 - 7)",?60,$$C($P(BUDTAB5(8),U,1)),?71,$$C($P(BUDTAB5(8),U,2),2),!,BUD80L
  1. ;print out lines 9-15
  1. F BUDL="9A","9B",10 S BUDY=$O(^BUDETFIV("B",BUDL,0)) Q:BUDQUIT D
  1. .I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. .W !
  1. .I +BUDL<10 W " "
  1. .W BUDL,".",?6,$P(^BUDETFIV(BUDY,0),U,2)
  1. .I $P(^BUDETFIV(BUDY,0),U,3)]"" W !?6,$P(^BUDETFIV(BUDY,0),U,3)
  1. .W ?60,$$C($P(BUDTAB5(BUDL),U,1),0)
  1. .W ?71,$$C($P(BUDTAB5(BUDL),U,2),2)
  1. .W !,BUD80L
  1. W !,"10a.",?10,"Total Midlevel Practitioners",!?8,"(Lines 9a - 10)",?60,$$C($P(BUDTAB5("10A"),U,1)),?71,$$C($P(BUDTAB5("10A"),U,2),2),!,BUD80L
  1. F BUDL=11:1:14 S BUDY=$O(^BUDETFIV("B",BUDL,0)) Q:BUDQUIT D
  1. .I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. .W !,BUDL,".",?6,$P(^BUDETFIV(BUDY,0),U,2) I $P(^BUDETFIV(BUDY,0),U,3)]"" W !?6,$P(^BUDETFIV(BUDY,0),U,3)
  1. .W ?60,$$C($P(BUDTAB5(BUDL),U,1),$S(BUDL=11:0,1:2))
  1. .W ?71,$$C($P(BUDTAB5(BUDL),U,2),2)
  1. .W !,BUD80L
  1. I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. W !,"15.",?10,"Total Medical Care",!?10,"(Lines 8 - 14)",?60,$$C($P(BUDTAB5(15),U,1)),?71,$$C($P(BUDTAB5(15),U,2)),!,BUD80L
  1. F BUDL=16:1:17 S BUDY=$O(^BUDETFIV("B",BUDL,0)) Q:BUDQUIT D
  1. .I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. .W !,BUDL,".",?6,$P(^BUDETFIV(BUDY,0),U,2) I $P(^BUDETFIV(BUDY,0),U,3)]"" W !?6,$P(^BUDETFIV(BUDY,0),U,3)
  1. .W ?60,$$C($P(BUDTAB5(BUDL),U,1),0)
  1. .W ?71,$$C($P(BUDTAB5(BUDL),U,2),2)
  1. .W !,BUD80L
  1. T518 F BUDL=18 S BUDY=$O(^BUDETFIV("B",BUDL,0)) Q:BUDQUIT D
  1. .I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. .W !,BUDL,".",?6,$P(^BUDETFIV(BUDY,0),U,2) I $P(^BUDETFIV(BUDY,0),U,3)]"" W !?6,$P(^BUDETFIV(BUDY,0),U,3)
  1. .W ?60,$$C($P(BUDTAB5(BUDL),U,1),2)
  1. .W ?71,$$C($P(BUDTAB5(BUDL),U,2),2)
  1. .W !,BUD80L
  1. I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. W !,"19.",?10,"Total Dental Services",!?10,"(Lines 16 - 18)",?60,$$C($P(BUDTAB5(19),U,1)),?71,$$C($P(BUDTAB5(19),U,2)),!,BUD80L
  1. ;D HEADER Q:BUDQUIT D T5SH ;force page break before line 20
  1. F BUDL="20A","20B","20C" S BUDY=$O(^BUDETFIV("B",BUDL,0)) Q:BUDQUIT D
  1. .I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. .W !,BUDL,".",?6,$P(^BUDETFIV(BUDY,0),U,2)
  1. .I $P(^BUDETFIV(BUDY,0),U,3)]"" W !?6,$P(^BUDETFIV(BUDY,0),U,3)
  1. .I $P(^BUDETFIV(BUDY,0),U,4)]"" W !?6,$P(^BUDETFIV(BUDY,0),U,4)
  1. .W ?60,$$C($P(BUDTAB5(BUDL),U,1),0)
  1. .W ?71,$$C($P(BUDTAB5(BUDL),U,2),2)
  1. .W !,BUD80L
  1. I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. W !,"20.",?10,"Mental Health Services",!?10,"(Lines 20a - c)",?60,$$C($P(BUDTAB5(20),U,1)),?71,$$C($P(BUDTAB5(20),U,2)),!,BUD80L
  1. F BUDL=21:1:22 S BUDY=$O(^BUDETFIV("B",BUDL,0)) Q:BUDQUIT D
  1. .I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. .W !,BUDL,".",?6,$P(^BUDETFIV(BUDY,0),U,2) I $P(^BUDETFIV(BUDY,0),U,3)]"" W !?6,$P(^BUDETFIV(BUDY,0),U,3)
  1. .W ?60,$$C($P(BUDTAB5(BUDL),U,1),0)
  1. .W ?71,$$C($P(BUDTAB5(BUDL),U,2),0)
  1. .W !,BUD80L
  1. F BUDL=23 S BUDY=$O(^BUDETFIV("B",BUDL,0)) Q:BUDQUIT D
  1. .I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. .W !,BUDL,".",?6,$P(^BUDETFIV(BUDY,0),U,2) I $P(^BUDETFIV(BUDY,0),U,3)]"" W !?6,$P(^BUDETFIV(BUDY,0),U,3)
  1. .W ?60,$$C($P(BUDTAB5(BUDL),U,1),2)
  1. .W ?71,$$C($P(BUDTAB5(BUDL),U,2),2)
  1. .W !,BUD80L
  1. F BUDL=24:1:25 S BUDY=$O(^BUDETFIV("B",BUDL,0)) Q:BUDQUIT D
  1. .I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. .W !,BUDL,".",?6,$P(^BUDETFIV(BUDY,0),U,2) I $P(^BUDETFIV(BUDY,0),U,3)]"" W !?6,$P(^BUDETFIV(BUDY,0),U,3)
  1. .W ?60,$$C($P(BUDTAB5(BUDL),U,1),0)
  1. .W ?71,$$C($P(BUDTAB5(BUDL),U,2),2)
  1. .W !,BUD80L
  1. F BUDL=26,27,"27a",28 S BUDY=$O(^BUDETFIV("B",BUDL,0)) Q:BUDQUIT D
  1. .I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. .W !,BUDL,".",?6,$P(^BUDETFIV(BUDY,0),U,2) I $P(^BUDETFIV(BUDY,0),U,3)]"" W !?6,$P(^BUDETFIV(BUDY,0),U,3)
  1. .W ?60,$$C($P(BUDTAB5(BUDL),U,1),2),?71,$$C($P(BUDTAB5(BUDL),U,2),2)
  1. .;W ?60,$$C($P(BUDTAB5(BUDL),U,1),2)
  1. .;W ?71,$$C($P(BUDTAB5(BUDL),U,2),2)
  1. .W !,BUD80L
  1. I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. W !,"29.",?10,"Total Enabling Services",!?10,"(Lines 24 - 28)",?60,$$C($P(BUDTAB5(29),U,1)),?71,$$C($P(BUDTAB5(29),U,2)),!,BUD80L
  1. F BUDL="29A",30,31,32 S BUDY=$O(^BUDETFIV("B",BUDL,0)) Q:BUDQUIT D
  1. .I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. .W !,BUDL,".",?6,$P(^BUDETFIV(BUDY,0),U,2) I $P(^BUDETFIV(BUDY,0),U,3)]"" W !?6,$P(^BUDETFIV(BUDY,0),U,3)
  1. .W ?60,$$C($P(BUDTAB5(BUDL),U,1),2)
  1. .W ?71,$$C($P(BUDTAB5(BUDL),U,2),2)
  1. .W !,BUD80L
  1. I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. W !,"33.",?10,"TOTAL ADMINISTRATION AND FACILITY",!?10,"(TOTAL LINES 30+31+32)"
  1. W ?60,$$C($P(BUDTAB5(33),U,1),2),?71,$$C($P(BUDTAB5(33),U,2),2),!,BUD80L
  1. I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. W !,"34.",?10,"GRAND TOTAL: (TOTAL LINES",!?10,"(15+19+20+21+22+23+29+29A+33)"
  1. S Y=0 F X=15,19,20,21,22,29 S Y=Y+$P(BUDTAB5(X),U)
  1. W ?60,$$C(Y),?71,$$C(Y,2),!,BUD80L
  1. I $P(BUDTAB5(35),U) D
  1. .I $Y>(IOSL-3) D HEADER Q:BUDQUIT D T5SH
  1. .W !!,$P(BUDTAB5(35),U)," encounters did not fit into any of the above categories",!
  1. W !
  1. Q
  1. T5SH ;
  1. W !,$$CTR("TABLE 5 - STAFFING AND UTILIZATION",80)
  1. ;W !,$$CTR("STAFFING AND UTILIZATION",80),!
  1. W !,$TR($J("",80)," ","-")
  1. W !,?54,"FTEs",?60,"ENCOUNTERS",?71,"PATIENTS"
  1. W !,"PERSONNEL BY MAJOR SERVICE CATEGORY",?54,"(a)",?64,"(b)",?73,"(c)"
  1. W !,$TR($J("",80)," ","-")
  1. Q
  1. T6 ;
  1. D T6^BUD7RPP1
  1. Q
  1. G:'BUDPG HEADER1
  1. K DIR I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S BUDQUIT=1 Q
  1. HEADER1 ;
  1. W:$D(IOF) @IOF S BUDPG=BUDPG+1
  1. S X=$$CTR($P(^DIC(4,BUDSITE,0),U),60),$E(X,3)=$P(^VA(200,DUZ,0),U,2),$E(X,10)="UDS 2007",$E(X,70)="Page ",$E(X,75)=BUDPG W !,X
  1. ;W !?3,$P(^VA(200,DUZ,0),U,2),?10,"UDS 2007",$$CTR($P(^DIC(4,BUDSITE,0),U),80),?70,"Page ",BUDPG
  1. ;W $$CTR($P(^DIC(4,BUDSITE,0),U),80),!
  1. W !,"UDS No. ",$P(^BUDESITE(BUDSITE,0),U,2),?50,"Date Run: ",$$FMTE^XLFDT(DT)
  1. W !,"Reporting Period: ",$$FMTE^XLFDT(BUDBD)," through ",$$FMTE^XLFDT(BUDED)
  1. W !
  1. Q
  1. C(X,Y) ;
  1. I $G(Y)=1,+X=0 Q ""
  1. I $G(Y)=2 Q "********"
  1. S X2=0,X3=8
  1. D COMMA^%DTC
  1. Q X
  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. ;----------