BGP3ELH ; IHS/CMI/LAB - cover page for ELDER 25 Jun 2010 10:20 AM ;
;;13.0;IHS CLINICAL REPORTING;;NOV 20, 2012;Build 81
;
;
I $G(BGPAREAA) D AREACP Q
;W:$D(IOF) @IOF
W !!,$$CTR("Cover Page",80)
W !!,$$CTR("*** IHS 2013 Elder Care Report ***",80)
W !,$$CTR($$RPTVER^BGP3BAN,80)
W !,$$CTR("Date Report Run: "_$$FMTE^XLFDT(DT),80)
W !,$$CTR("Site where Run: "_$P(^DIC(4,DUZ(2),0),U),80)
W !,$$CTR("Report Generated by: "_$$USR,80)
S X="Report Period: "_$$FMTE^XLFDT(BGPBD)_" to "_$$FMTE^XLFDT(BGPED) W !,$$CTR(X,80)
S X="Previous Year Period: "_$$FMTE^XLFDT(BGPPBD)_" to "_$$FMTE^XLFDT(BGPPED) W !,$$CTR(X,80)
S X="Baseline Period: "_$$FMTE^XLFDT(BGPBBD)_" to "_$$FMTE^XLFDT(BGPBED) W !,$$CTR(X,80)
I BGPZZ="A" W !!,"Measures: Elder Care Performance Measures"
I BGPZZ="S" W !!,"Measures: Selected Elder Care Performance Measures (User Defined)"
W !!,"Population: ",$S(BGPBEN=1:"AI/AN Only (Classification 01)",BGPBEN=2:"non AI/AN Only (Classification NOT 01)",BGPBEN=3:"All (Both AI/AN and non AI/AN)",1:"")
D ENDTIME
D ELDERHDR
I $G(BGPEXPT) W !!,"A file will be created called BG130",$P(^AUTTLOC(DUZ(2),0),U,10)_".EL"_BGPRPT,".",!,"It will reside in the public/export directory.",!,"This file should be sent to your Area Office.",!
I BGPROT'="P",'$D(BGPGUI) W !!,"A delimited output file called ",BGPDELF,!,"has been placed in the "_$$GETDEDIR^BGP3UTL2()_" directory for your use in Excel or some",!,"other software package.",!,"See your site manager to access this file.",!
I $G(BGPALLPT) W !!,"All Communities Included.",!
I '$G(BGPALLPT),'$G(BGPSEAT) W !!?10,"Community Taxonomy Name: ",$P(^ATXAX(BGPTAXI,0),U)
I '$G(BGPALLPT),'$G(BGPSEAT) W !!?10,"The following communities are included in this report:",! D
.S BGPZZ="",N=0,Y="" F S BGPZZ=$O(BGPTAX(BGPZZ)) Q:BGPZZ="" S N=N+1,Y=Y_$S(N=1:"",1:";")_BGPZZ
.S BGPZZ=0,C=0 F BGPZZ=1:3:N D
..I $Y>(BGPIOSL-3) D EOP
..W !?10,$E($P(Y,";",BGPZZ),1,20),?30,$E($P(Y,";",(BGPZZ+1)),1,20),?60,$E($P(Y,";",(BGPZZ+2)),1,20)
..Q
I $G(BGPMFITI) W !!?10,"MFI Visit Location Taxonomy Name: ",$P(^ATXAX(BGPMFITI,0),U)
I $G(BGPMFITI) W !!?10,"The following locations are used for patient visits in this report:",! D
.S BGPZZ="",N=0,Y="" F S BGPZZ=$O(^ATXAX(BGPMFITI,21,"B",BGPZZ)) Q:BGPZZ="" S N=N+1,Y=Y_$S(N=1:"",1:";")_$P($G(^DIC(4,BGPZZ,0)),U)
.S BGPZZ=0,C=0 F BGPZZ=1:3:N D
..I $Y>(BGPIOSL-3) D EOP
..W !?10,$E($P(Y,";",BGPZZ),1,20),?30,$E($P(Y,";",(BGPZZ+1)),1,20),?60,$E($P(Y,";",(BGPZZ+2)),1,20)
..Q
K BGPX,BGPQUIT
Q
ELDERHDR ;
W !
I $G(BGPAREAA) D ELDHDRA Q
S BGPNODEP=$S(BGPCHSO:26,1:22)
S BGPNODEP=$S(BGPURBAN:52,1:BGPNODEP)
S BGPX=$O(^BGPCTRL("B",2013,0))
S BGPY=0 F S BGPY=$O(^BGPCTRL(BGPX,BGPNODEP,BGPY)) Q:BGPY'=+BGPY D
.I $Y>(BGPIOSL-2) D EOP W:$D(IOF) @IOF
.W !,^BGPCTRL(BGPX,BGPNODEP,BGPY,0)
.Q
Q
ENDTIME ;
I $D(BGPET) S BGPTS=(86400*($P(BGPET,",")-$P(BGPBT,",")))+($P(BGPET,",",2)-$P(BGPBT,",",2)),BGPHR=$P(BGPTS/3600,".") S:BGPHR="" BGPHR=0 D
.S BGPTS=BGPTS-(BGPHR*3600),BGPM=$P(BGPTS/60,".") S:BGPM="" BGPM=0 S BGPTS=BGPTS-(BGPM*60),BGPS=BGPTS W !!,"RUN TIME (H.M.S): ",BGPHR,".",BGPM,".",BGPS
Q
AREACP ;EP - area cover page
;
;W:$D(IOF) @IOF
W !!,$$CTR("Cover Page",80)
W !!,$$CTR("*** IHS 2013 Elder Care Report ***",80)
W !,$$CTR("AREA AGGREGATE",80)
W !,$$CTR($$RPTVER^BGP3BAN,80)
W !,$$CTR("Date Report Run: "_$$FMTE^XLFDT(DT),80)
W !,$$CTR("Site where Run: "_$$VAL^XBDIQ1(9999999.06,DUZ(2),.04))
W !,$$CTR("Report Generated by: "_$$USR,80)
S X="Reporting Period: "_$$FMTE^XLFDT(BGPBD)_" to "_$$FMTE^XLFDT(BGPED) W !,$$CTR(X,80)
S X="Previous Year Period: "_$$FMTE^XLFDT(BGPPBD)_" to "_$$FMTE^XLFDT(BGPPED) W !,$$CTR(X,80)
S X="Baseline Period: "_$$FMTE^XLFDT(BGPBBD)_" to "_$$FMTE^XLFDT(BGPBED) W !,$$CTR(X,80)
W !!,"Measures: Elder Care Performance Measures"
W !,"Population: ",$S(BGPBEN=1:"AI/AN Only (Classification 01)",BGPBEN=2:"non AI/AN Only (Classification NOT 01)",BGPBEN=3:"All (Both AI/AN and non AI/AN)",1:"")
D ENDTIME
S BGPCHSO="",X=0 F S X=$O(BGPSUL(X)) Q:X'=+X I $P(^BGPELDCH(X,0),U,17) S BGPCHSO=1
S BGPCHSN="",X=0 F S X=$O(BGPSUL(X)) Q:X'=+X I '$P(^BGPELDCH(X,0),U,17) S BGPCHSN=1
S BGPURBO="",X=0 F S X=$O(BGPSUL(X)) Q:X'=+X I $P(^BGPELDCH(X,0),U,19) S BGPURBO=1
S BGPURBN="",X=0 F S X=$O(BGPSUL(X)) Q:X'=+X I '$P(^BGPELDCH(X,0),U,19) S BGPURBN=1
D ELDERHDR
;I $G(BGPEXPT) W !!,"A file will be created called BG130",$P(^AUTTLOC(DUZ(2),0),U,10)_".EL"_BGPRPT,".",!,"It will reside in the public/export directory.",!,"This file should be sent to your Area Office.",!
I BGPROT'="P",'$D(BGPGUI) W !!,"A delimited output file called ",BGPDELF,!,"has been placed in the "_$$GETDEDIR^BGP3UTL2()_" directory for your use in Excel or some",!,"other software package.",!,"See your site manager to access this file.",!
W !!?1,"Report includes data from the following facilities:"
NEW BGPX
S BGPX="",BGPC=0 F S BGPX=$O(BGPSUL(BGPX)) Q:BGPX="" D
.S BGPC=BGPC+1
.S X=$P(^BGPELDCH(BGPX,0),U,9),X=$O(^AUTTLOC("C",X,0)) S X=$S(X:$P(^DIC(4,X,0),U),1:"?????")
.W !?3,BGPC,". ",$S($P(^BGPELDCH(BGPX,0),U,17):"*",$P(^BGPELDCH(BGPX,0),U,19):"**",1:""),X
W !!?1,"The following communities are included in this report:"
NEW BGPX
S BGPX="",BGPC=0 F S BGPX=$O(BGPSUL(BGPX)) Q:BGPX="" D
.S BGPC=BGPC+1
.S X=$P(^BGPELDCH(BGPX,0),U,9),X=$O(^AUTTLOC("C",X,0)) S X=$S(X:$P(^DIC(4,X,0),U),1:"?????")
.W !!?3,BGPC,". ",$S($P(^BGPELDCH(BGPX,0),U,17):"*",1:""),X
.;W !?5,"Communities: "
.W !?3,"Community Taxonomy Name: ",$P(^BGPELDCH(BGPX,0),U,18)
.;W !?5,"Communities: "
.S BGPXX=0,BGPXN=0,BGPXY="" F S BGPXX=$O(^BGPELDCH(BGPX,9999,BGPXX)) Q:BGPXX'=+BGPXX S BGPXN=BGPXN+1,BGPXY=BGPXY_$S(BGPXN=1:"",1:";")_$P(^BGPELDCH(BGPX,9999,BGPXX,0),U)
.S BGPX1=0,C=0 F BGPX1=1:3:BGPXN D
..W !?10,$E($P(BGPXY,";",BGPX1),1,20),?30,$E($P(BGPXY,";",(BGPX1+1)),1,20),?60,$E($P(BGPXY,";",(BGPX1+2)),1,20)
.I $O(^BGPELDCH(BGPX,1111,0)) D
..W !!?5,"MFI Visit Locations: " S BGPXX=0,BGPXN=0,BGPXY="" F S BGPXX=$O(^BGPELDCH(BGPX,1111,BGPXX)) Q:BGPXX'=+BGPXX S BGPXN=BGPXN+1,BGPXY=BGPXY_$S(BGPXN=1:"",1:";")_$P(^BGPELDCH(BGPX,1111,BGPXX,0),U)
..S BGPX1=0,C=0 F BGPX1=1:3:BGPXN W !?10,$E($P(BGPXY,";",BGPX1),1,18),?30,$E($P(BGPXY,";",(BGPX1+1)),1,20),?60,$E($P(BGPXY,";",(BGPX1+2)),1,18)
.Q
I BGPCHSO D
.;S X=" " D W^BGP3DP(X,0,1,BGPPTYPE)
.W !,"* CHS-only site. Uses Active Clinical CHS Population definition vs. Active Clinical." ;D W^BGP3DP(X,0,1,BGPPTYPE)
I BGPURBO D
.;S X=" " D W^BGP3DP(X,0,1,BGPPTYPE)
.W !,"**Urban Outreach & Referral-only site. Uses Active Clinical Behavioral Health",!,"Population definition vs. Active Clinical." ;D W^BGP3DP(X,0,1,BGPPTYPE)
W ! ;S X=" " D W^BGP3DP(X,0,1,BGPPTYPE)
K BGPX,BGPQUIT
Q
CTR(X,Y) ;EP - Center X in a field Y wide.
Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
;----------
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(0)="E" D ^DIR
Q
;----------
USR() ;EP - Return name of current user from ^VA(200.
Q $S($G(DUZ):$S($D(^VA(200,DUZ,0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
;----------
;;
ELDHDRA ;EP
W !
S BGPX=$O(^BGPCTRL("B",2013,0))
S BGPNODEP=89 D 2
;D W^BGP3DP("",0,1,BGPPTYPE)
I BGPCHSO S BGPTEXT="CHS" F BGPJ1=1:1 S BGPX=$T(@BGPTEXT+BGPJ1) Q:$P(BGPX,";;",2)="QUIT" D
.S BGPT=$P(BGPX,";;",2)
.I BGPPTYPE="P",$Y>(BGPIOSL-2) D EOP
.W !,BGPT
I BGPURBO S BGPTEXT="URB" F BGPJ1=1:1 S BGPX=$T(@BGPTEXT+BGPJ1) Q:$P(BGPX,";;",2)="QUIT" D
.S BGPT=$P(BGPX,";;",2)
.I BGPPTYPE="P",$Y>(BGPIOSL-2) D EOP
.W !,BGPT
S BGPTEXT="UP" F BGPJ1=1:1 S BGPX=$T(@BGPTEXT+BGPJ1) Q:$P(BGPX,";;",2)="QUIT" D
.S BGPT=$P(BGPX,";;",2)
.I BGPPTYPE="P",$Y>(BGPIOSL-2) D EOP
.W !,BGPT
Q
2 S BGPY=0 F S BGPY=$O(^BGPCTRL(BGPX,BGPNODEP,BGPY)) Q:BGPY'=+BGPY D
.I BGPPTYPE="P",$Y>(BGPIOSL-2) D EOP
.W !,^BGPCTRL(BGPX,BGPNODEP,BGPY,0)
.Q
Q
;
CHS ;;
;;
;;ACTIVE CLINICAL CHS POPULATION:
;;1. Must reside in a community specified in the community taxonomy used for
;;this report.
;;2. Must be alive on the last day of the Report period.
;;3. User defines: a) Indian/Alaska Natives Only - based on Classification
;;of 01; b) Non AI/AN (not 01); or c) Both.
;;4. Must have 2 CHS visits in the 3 years prior to the end of the Report period.
;;QUIT
;;
URB ;;
;;
;;ACTIVE BEHAVIORAL HEALTH URBAN OUTREACH & REFERRAL POPULATION:
;;1. Must reside in a community specified in the community taxonomy used for
;;this report.
;;2. Must be alive on the last day of the Report period.
;;3. User defines: a) Indian/Alaska Natives Only - based on Classification
;;of 01; b) Non AI/AN (not 01); or c) Both.
;;4. Must have 2 visits to behavioral health or case management clinics in the
;;3 years prior to the end of the Report period.
;;QUIT
;;
UP ;;
;;
;;USER POPULATION:
;;1. Definitions 1-3 above.
;;2. Must have been seen at least once in the 3 years prior to the end of
;;the Report period, regardless of the clinic type.
;;
;;QUIT
;;
BGP3ELH ; IHS/CMI/LAB - cover page for ELDER 25 Jun 2010 10:20 AM ;
+1 ;;13.0;IHS CLINICAL REPORTING;;NOV 20, 2012;Build 81
+2 ;
+3 ;
+4 IF $GET(BGPAREAA)
DO AREACP
QUIT
+5 ;W:$D(IOF) @IOF
+6 WRITE !!,$$CTR("Cover Page",80)
+7 WRITE !!,$$CTR("*** IHS 2013 Elder Care Report ***",80)
+8 WRITE !,$$CTR($$RPTVER^BGP3BAN,80)
+9 WRITE !,$$CTR("Date Report Run: "_$$FMTE^XLFDT(DT),80)
+10 WRITE !,$$CTR("Site where Run: "_$PIECE(^DIC(4,DUZ(2),0),U),80)
+11 WRITE !,$$CTR("Report Generated by: "_$$USR,80)
+12 SET X="Report Period: "_$$FMTE^XLFDT(BGPBD)_" to "_$$FMTE^XLFDT(BGPED)
WRITE !,$$CTR(X,80)
+13 SET X="Previous Year Period: "_$$FMTE^XLFDT(BGPPBD)_" to "_$$FMTE^XLFDT(BGPPED)
WRITE !,$$CTR(X,80)
+14 SET X="Baseline Period: "_$$FMTE^XLFDT(BGPBBD)_" to "_$$FMTE^XLFDT(BGPBED)
WRITE !,$$CTR(X,80)
+15 IF BGPZZ="A"
WRITE !!,"Measures: Elder Care Performance Measures"
+16 IF BGPZZ="S"
WRITE !!,"Measures: Selected Elder Care Performance Measures (User Defined)"
+17 WRITE !!,"Population: ",$SELECT(BGPBEN=1:"AI/AN Only (Classification 01)",BGPBEN=2:"non AI/AN Only (Classification NOT 01)",BGPBEN=3:"All (Both AI/AN and non AI/AN)",1:"")
+18 DO ENDTIME
+19 DO ELDERHDR
+20 IF $GET(BGPEXPT)
WRITE !!,"A file will be created called BG130",$PIECE(^AUTTLOC(DUZ(2),0),U,10)_".EL"_BGPRPT,".",!,"It will reside in the public/export directory.",!,"This file should be sent to your Area Office.",!
+21 IF BGPROT'="P"
IF '$DATA(BGPGUI)
WRITE !!,"A delimited output file called ",BGPDELF,!,"has been placed in the "_$$GETDEDIR^BGP3UTL2()_" directory for your use in Excel or some",!,"other software package.",!,"See your site manager to access this file.",!
+22 IF $GET(BGPALLPT)
WRITE !!,"All Communities Included.",!
+23 IF '$GET(BGPALLPT)
IF '$GET(BGPSEAT)
WRITE !!?10,"Community Taxonomy Name: ",$PIECE(^ATXAX(BGPTAXI,0),U)
+24 IF '$GET(BGPALLPT)
IF '$GET(BGPSEAT)
WRITE !!?10,"The following communities are included in this report:",!
Begin DoDot:1
+25 SET BGPZZ=""
SET N=0
SET Y=""
FOR
SET BGPZZ=$ORDER(BGPTAX(BGPZZ))
IF BGPZZ=""
QUIT
SET N=N+1
SET Y=Y_$SELECT(N=1:"",1:";")_BGPZZ
+26 SET BGPZZ=0
SET C=0
FOR BGPZZ=1:3:N
Begin DoDot:2
+27 IF $Y>(BGPIOSL-3)
DO EOP
+28 WRITE !?10,$EXTRACT($PIECE(Y,";",BGPZZ),1,20),?30,$EXTRACT($PIECE(Y,";",(BGPZZ+1)),1,20),?60,$EXTRACT($PIECE(Y,";",(BGPZZ+2)),1,20)
+29 QUIT
End DoDot:2
End DoDot:1
+30 IF $GET(BGPMFITI)
WRITE !!?10,"MFI Visit Location Taxonomy Name: ",$PIECE(^ATXAX(BGPMFITI,0),U)
+31 IF $GET(BGPMFITI)
WRITE !!?10,"The following locations are used for patient visits in this report:",!
Begin DoDot:1
+32 SET BGPZZ=""
SET N=0
SET Y=""
FOR
SET BGPZZ=$ORDER(^ATXAX(BGPMFITI,21,"B",BGPZZ))
IF BGPZZ=""
QUIT
SET N=N+1
SET Y=Y_$SELECT(N=1:"",1:";")_$PIECE($GET(^DIC(4,BGPZZ,0)),U)
+33 SET BGPZZ=0
SET C=0
FOR BGPZZ=1:3:N
Begin DoDot:2
+34 IF $Y>(BGPIOSL-3)
DO EOP
+35 WRITE !?10,$EXTRACT($PIECE(Y,";",BGPZZ),1,20),?30,$EXTRACT($PIECE(Y,";",(BGPZZ+1)),1,20),?60,$EXTRACT($PIECE(Y,";",(BGPZZ+2)),1,20)
+36 QUIT
End DoDot:2
End DoDot:1
+37 KILL BGPX,BGPQUIT
+38 QUIT
ELDERHDR ;
+1 WRITE !
+2 IF $GET(BGPAREAA)
DO ELDHDRA
QUIT
+3 SET BGPNODEP=$SELECT(BGPCHSO:26,1:22)
+4 SET BGPNODEP=$SELECT(BGPURBAN:52,1:BGPNODEP)
+5 SET BGPX=$ORDER(^BGPCTRL("B",2013,0))
+6 SET BGPY=0
FOR
SET BGPY=$ORDER(^BGPCTRL(BGPX,BGPNODEP,BGPY))
IF BGPY'=+BGPY
QUIT
Begin DoDot:1
+7 IF $Y>(BGPIOSL-2)
DO EOP
IF $DATA(IOF)
WRITE @IOF
+8 WRITE !,^BGPCTRL(BGPX,BGPNODEP,BGPY,0)
+9 QUIT
End DoDot:1
+10 QUIT
ENDTIME ;
+1 IF $DATA(BGPET)
SET BGPTS=(86400*($PIECE(BGPET,",")-$PIECE(BGPBT,",")))+($PIECE(BGPET,",",2)-$PIECE(BGPBT,",",2))
SET BGPHR=$PIECE(BGPTS/3600,".")
IF BGPHR=""
SET BGPHR=0
Begin DoDot:1
+2 SET BGPTS=BGPTS-(BGPHR*3600)
SET BGPM=$PIECE(BGPTS/60,".")
IF BGPM=""
SET BGPM=0
SET BGPTS=BGPTS-(BGPM*60)
SET BGPS=BGPTS
WRITE !!,"RUN TIME (H.M.S): ",BGPHR,".",BGPM,".",BGPS
End DoDot:1
+3 QUIT
AREACP ;EP - area cover page
+1 ;
+2 ;W:$D(IOF) @IOF
+3 WRITE !!,$$CTR("Cover Page",80)
+4 WRITE !!,$$CTR("*** IHS 2013 Elder Care Report ***",80)
+5 WRITE !,$$CTR("AREA AGGREGATE",80)
+6 WRITE !,$$CTR($$RPTVER^BGP3BAN,80)
+7 WRITE !,$$CTR("Date Report Run: "_$$FMTE^XLFDT(DT),80)
+8 WRITE !,$$CTR("Site where Run: "_$$VAL^XBDIQ1(9999999.06,DUZ(2),.04))
+9 WRITE !,$$CTR("Report Generated by: "_$$USR,80)
+10 SET X="Reporting Period: "_$$FMTE^XLFDT(BGPBD)_" to "_$$FMTE^XLFDT(BGPED)
WRITE !,$$CTR(X,80)
+11 SET X="Previous Year Period: "_$$FMTE^XLFDT(BGPPBD)_" to "_$$FMTE^XLFDT(BGPPED)
WRITE !,$$CTR(X,80)
+12 SET X="Baseline Period: "_$$FMTE^XLFDT(BGPBBD)_" to "_$$FMTE^XLFDT(BGPBED)
WRITE !,$$CTR(X,80)
+13 WRITE !!,"Measures: Elder Care Performance Measures"
+14 WRITE !,"Population: ",$SELECT(BGPBEN=1:"AI/AN Only (Classification 01)",BGPBEN=2:"non AI/AN Only (Classification NOT 01)",BGPBEN=3:"All (Both AI/AN and non AI/AN)",1:"")
+15 DO ENDTIME
+16 SET BGPCHSO=""
SET X=0
FOR
SET X=$ORDER(BGPSUL(X))
IF X'=+X
QUIT
IF $PIECE(^BGPELDCH(X,0),U,17)
SET BGPCHSO=1
+17 SET BGPCHSN=""
SET X=0
FOR
SET X=$ORDER(BGPSUL(X))
IF X'=+X
QUIT
IF '$PIECE(^BGPELDCH(X,0),U,17)
SET BGPCHSN=1
+18 SET BGPURBO=""
SET X=0
FOR
SET X=$ORDER(BGPSUL(X))
IF X'=+X
QUIT
IF $PIECE(^BGPELDCH(X,0),U,19)
SET BGPURBO=1
+19 SET BGPURBN=""
SET X=0
FOR
SET X=$ORDER(BGPSUL(X))
IF X'=+X
QUIT
IF '$PIECE(^BGPELDCH(X,0),U,19)
SET BGPURBN=1
+20 DO ELDERHDR
+21 ;I $G(BGPEXPT) W !!,"A file will be created called BG130",$P(^AUTTLOC(DUZ(2),0),U,10)_".EL"_BGPRPT,".",!,"It will reside in the public/export directory.",!,"This file should be sent to your Area Office.",!
+22 IF BGPROT'="P"
IF '$DATA(BGPGUI)
WRITE !!,"A delimited output file called ",BGPDELF,!,"has been placed in the "_$$GETDEDIR^BGP3UTL2()_" directory for your use in Excel or some",!,"other software package.",!,"See your site manager to access this file.",!
+23 WRITE !!?1,"Report includes data from the following facilities:"
+24 NEW BGPX
+25 SET BGPX=""
SET BGPC=0
FOR
SET BGPX=$ORDER(BGPSUL(BGPX))
IF BGPX=""
QUIT
Begin DoDot:1
+26 SET BGPC=BGPC+1
+27 SET X=$PIECE(^BGPELDCH(BGPX,0),U,9)
SET X=$ORDER(^AUTTLOC("C",X,0))
SET X=$SELECT(X:$PIECE(^DIC(4,X,0),U),1:"?????")
+28 WRITE !?3,BGPC,". ",$SELECT($PIECE(^BGPELDCH(BGPX,0),U,17):"*",$PIECE(^BGPELDCH(BGPX,0),U,19):"**",1:""),X
End DoDot:1
+29 WRITE !!?1,"The following communities are included in this report:"
+30 NEW BGPX
+31 SET BGPX=""
SET BGPC=0
FOR
SET BGPX=$ORDER(BGPSUL(BGPX))
IF BGPX=""
QUIT
Begin DoDot:1
+32 SET BGPC=BGPC+1
+33 SET X=$PIECE(^BGPELDCH(BGPX,0),U,9)
SET X=$ORDER(^AUTTLOC("C",X,0))
SET X=$SELECT(X:$PIECE(^DIC(4,X,0),U),1:"?????")
+34 WRITE !!?3,BGPC,". ",$SELECT($PIECE(^BGPELDCH(BGPX,0),U,17):"*",1:""),X
+35 ;W !?5,"Communities: "
+36 WRITE !?3,"Community Taxonomy Name: ",$PIECE(^BGPELDCH(BGPX,0),U,18)
+37 ;W !?5,"Communities: "
+38 SET BGPXX=0
SET BGPXN=0
SET BGPXY=""
FOR
SET BGPXX=$ORDER(^BGPELDCH(BGPX,9999,BGPXX))
IF BGPXX'=+BGPXX
QUIT
SET BGPXN=BGPXN+1
SET BGPXY=BGPXY_$SELECT(BGPXN=1:"",1:";")_$PIECE(^BGPELDCH(BGPX,9999,BGPXX,0),U)
+39 SET BGPX1=0
SET C=0
FOR BGPX1=1:3:BGPXN
Begin DoDot:2
+40 WRITE !?10,$EXTRACT($PIECE(BGPXY,";",BGPX1),1,20),?30,$EXTRACT($PIECE(BGPXY,";",(BGPX1+1)),1,20),?60,$EXTRACT($PIECE(BGPXY,";",(BGPX1+2)),1,20)
End DoDot:2
+41 IF $ORDER(^BGPELDCH(BGPX,1111,0))
Begin DoDot:2
+42 WRITE !!?5,"MFI Visit Locations: "
SET BGPXX=0
SET BGPXN=0
SET BGPXY=""
FOR
SET BGPXX=$ORDER(^BGPELDCH(BGPX,1111,BGPXX))
IF BGPXX'=+BGPXX
QUIT
SET BGPXN=BGPXN+1
SET BGPXY=BGPXY_$SELECT(BGPXN=1:"",1:";")_$PIECE(^BGPELDCH(BGPX,1111,BGPXX,0),U)
+43 SET BGPX1=0
SET C=0
FOR BGPX1=1:3:BGPXN
WRITE !?10,$EXTRACT($PIECE(BGPXY,";",BGPX1),1,18),?30,$EXTRACT($PIECE(BGPXY,";",(BGPX1+1)),1,20),?60,$EXTRACT($PIECE(BGPXY,";",(BGPX1+2)),1,18)
End DoDot:2
+44 QUIT
End DoDot:1
+45 IF BGPCHSO
Begin DoDot:1
+46 ;S X=" " D W^BGP3DP(X,0,1,BGPPTYPE)
+47 ;D W^BGP3DP(X,0,1,BGPPTYPE)
WRITE !,"* CHS-only site. Uses Active Clinical CHS Population definition vs. Active Clinical."
End DoDot:1
+48 IF BGPURBO
Begin DoDot:1
+49 ;S X=" " D W^BGP3DP(X,0,1,BGPPTYPE)
+50 ;D W^BGP3DP(X,0,1,BGPPTYPE)
WRITE !,"**Urban Outreach & Referral-only site. Uses Active Clinical Behavioral Health",!,"Population definition vs. Active Clinical."
End DoDot:1
+51 ;S X=" " D W^BGP3DP(X,0,1,BGPPTYPE)
WRITE !
+52 KILL BGPX,BGPQUIT
+53 QUIT
CTR(X,Y) ;EP - Center X in a field Y wide.
+1 QUIT $JUSTIFY("",$SELECT($DATA(Y):Y,1:IOM)-$LENGTH(X)\2)_X
+2 ;----------
EOP ;EP - End of page.
+1 IF $EXTRACT(IOST)'="C"
QUIT
+2 IF $DATA(ZTQUEUED)!'(IOT="TRM")!$DATA(IO("S"))
QUIT
+3 NEW DIR
+4 KILL DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
+5 SET DIR(0)="E"
DO ^DIR
+6 QUIT
+7 ;----------
USR() ;EP - Return name of current user from ^VA(200.
+1 QUIT $SELECT($GET(DUZ):$SELECT($DATA(^VA(200,DUZ,0)):$PIECE(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
+2 ;----------
+3 ;;
ELDHDRA ;EP
+1 WRITE !
+2 SET BGPX=$ORDER(^BGPCTRL("B",2013,0))
+3 SET BGPNODEP=89
DO 2
+4 ;D W^BGP3DP("",0,1,BGPPTYPE)
+5 IF BGPCHSO
SET BGPTEXT="CHS"
FOR BGPJ1=1:1
SET BGPX=$TEXT(@BGPTEXT+BGPJ1)
IF $PIECE(BGPX,";;",2)="QUIT"
QUIT
Begin DoDot:1
+6 SET BGPT=$PIECE(BGPX,";;",2)
+7 IF BGPPTYPE="P"
IF $Y>(BGPIOSL-2)
DO EOP
+8 WRITE !,BGPT
End DoDot:1
+9 IF BGPURBO
SET BGPTEXT="URB"
FOR BGPJ1=1:1
SET BGPX=$TEXT(@BGPTEXT+BGPJ1)
IF $PIECE(BGPX,";;",2)="QUIT"
QUIT
Begin DoDot:1
+10 SET BGPT=$PIECE(BGPX,";;",2)
+11 IF BGPPTYPE="P"
IF $Y>(BGPIOSL-2)
DO EOP
+12 WRITE !,BGPT
End DoDot:1
+13 SET BGPTEXT="UP"
FOR BGPJ1=1:1
SET BGPX=$TEXT(@BGPTEXT+BGPJ1)
IF $PIECE(BGPX,";;",2)="QUIT"
QUIT
Begin DoDot:1
+14 SET BGPT=$PIECE(BGPX,";;",2)
+15 IF BGPPTYPE="P"
IF $Y>(BGPIOSL-2)
DO EOP
+16 WRITE !,BGPT
End DoDot:1
+17 QUIT
2 SET BGPY=0
FOR
SET BGPY=$ORDER(^BGPCTRL(BGPX,BGPNODEP,BGPY))
IF BGPY'=+BGPY
QUIT
Begin DoDot:1
+1 IF BGPPTYPE="P"
IF $Y>(BGPIOSL-2)
DO EOP
+2 WRITE !,^BGPCTRL(BGPX,BGPNODEP,BGPY,0)
+3 QUIT
End DoDot:1
+4 QUIT
+5 ;
CHS ;;
+1 ;;
+2 ;;ACTIVE CLINICAL CHS POPULATION:
+3 ;;1. Must reside in a community specified in the community taxonomy used for
+4 ;;this report.
+5 ;;2. Must be alive on the last day of the Report period.
+6 ;;3. User defines: a) Indian/Alaska Natives Only - based on Classification
+7 ;;of 01; b) Non AI/AN (not 01); or c) Both.
+8 ;;4. Must have 2 CHS visits in the 3 years prior to the end of the Report period.
+9 ;;QUIT
+10 ;;
URB ;;
+1 ;;
+2 ;;ACTIVE BEHAVIORAL HEALTH URBAN OUTREACH & REFERRAL POPULATION:
+3 ;;1. Must reside in a community specified in the community taxonomy used for
+4 ;;this report.
+5 ;;2. Must be alive on the last day of the Report period.
+6 ;;3. User defines: a) Indian/Alaska Natives Only - based on Classification
+7 ;;of 01; b) Non AI/AN (not 01); or c) Both.
+8 ;;4. Must have 2 visits to behavioral health or case management clinics in the
+9 ;;3 years prior to the end of the Report period.
+10 ;;QUIT
+11 ;;
UP ;;
+1 ;;
+2 ;;USER POPULATION:
+3 ;;1. Definitions 1-3 above.
+4 ;;2. Must have been seen at least once in the 3 years prior to the end of
+5 ;;the Report period, regardless of the clinic type.
+6 ;;
+7 ;;QUIT
+8 ;;