BGP8EL1P ; IHS/CMI/LAB - print ind 01 Jul 2010 7:55 PM ;
;;18.1;IHS CLINICAL REPORTING;;MAY 25, 2018;Build 66
;
I1AGE ;EP
S BGPHD1="ACTIVE CLINICAL PTS 65+ w/ no hospice",BGPHD2="Active Clinical Pts 65+",BGPHD3=" w/ no hospice"
D HEADER^BGP8DPH
W !,^BGPELIR(BGPIC,53,1,0)
S X=" " D S(X,1,1)
D H3 S X=" " D S(X,1,1)
K BGPDAC,BGPDAP,BGPDAB
S (C,D,E,F,G,H,I,J,K)=0 S BGPX="D",C=0 F BGPZZZ=1,2,3 D
.S BGPZ=BGPZZZ D I1AGE1
.S BGPP=4,BGPP1=5,BGPZ=BGPZZZ+3 D I1AGE2
.S BGPP=6,BGPP1=7,BGPZ=BGPZZZ+6 D I1AGE2
.S BGPP=8,BGPP1=9,BGPZ=BGPZZZ+9 D I1AGE2
.S BGPP=10,BGPP1=11,BGPZ=BGPZZZ+12 D I1AGE2
.S BGPP=12,BGPP1=13,BGPZ=BGPZZZ+15 D I1AGE2
.S BGPP=14,BGPP1=15,BGPZ=BGPZZZ+18 D I1AGE2
.;S BGPP=16,BGPP1=17,BGPZ=BGPZZZ+21 D I1AGE2
.S BGPP=18,BGPP1=19,BGPZ=BGPZZZ+24 D I1AGE2
.S BGPP=28,BGPP1=29,BGPZ=BGPZZZ+39 D I1AGE2
.S BGPP=40,BGPP1=41,BGPZ=BGPZZZ+57 D I1AGE3
D I1AGEP
;MALE
S BGPHD1="MALE ACTIVE CLINICAL PTS 65+ w/ no hospice",BGPHD2="Male Active Clinical Pts 65+",BGPHD3=" w/ no hospice"
D HEADER^BGP8DPH W !,^BGPELIR(BGPIC,53,1,0) S X=" " D S(X,1,1) D H3 S X=" " D S(X,1,1)
K BGPDAC,BGPDAP,BGPDAB
S (C,D,E,F,G,H,I,J,K)=0 S BGPX="E",C=0 F BGPZZZ=1,2,3 D
.S BGPZ=BGPZZZ D I1AGE1
.S BGPP=4,BGPP1=5,BGPZ=BGPZZZ+3 D I1AGE2
.S BGPP=6,BGPP1=7,BGPZ=BGPZZZ+6 D I1AGE2
.S BGPP=8,BGPP1=9,BGPZ=BGPZZZ+9 D I1AGE2
.S BGPP=10,BGPP1=11,BGPZ=BGPZZZ+12 D I1AGE2
.S BGPP=12,BGPP1=13,BGPZ=BGPZZZ+15 D I1AGE2
.S BGPP=14,BGPP1=15,BGPZ=BGPZZZ+18 D I1AGE2
.;S BGPP=16,BGPP1=17,BGPZ=BGPZZZ+21 D I1AGE2
.S BGPP=18,BGPP1=19,BGPZ=BGPZZZ+24 D I1AGE2
.S BGPP=28,BGPP1=29,BGPZ=BGPZZZ+39 D I1AGE2
.S BGPP=40,BGPP1=41,BGPZ=BGPZZZ+57 D I1AGE3
D I1AGEP
;FEMALE
S BGPHD1="FEMALE ACTIVE CLINICAL PTS 65+ w/ no hospice",BGPHD2="Female Active Clinical Pts 65+",BGPHD3=" w/ no hospice"
D HEADER^BGP8DPH W !,^BGPELIR(BGPIC,53,1,0) S X=" " D S(X,1,1) D H3 S X=" " D S(X,1,1)
K BGPDAC,BGPDAP,BGPDAB
S (C,D,E,F,G,H,I,J,K)=0 S BGPX="F",C=0 F BGPZZZ=1,2,3 D
.S BGPZ=BGPZZZ D I1AGE1
.S BGPP=4,BGPP1=5,BGPZ=BGPZZZ+3 D I1AGE2
.S BGPP=6,BGPP1=7,BGPZ=BGPZZZ+6 D I1AGE2
.S BGPP=8,BGPP1=9,BGPZ=BGPZZZ+9 D I1AGE2
.S BGPP=10,BGPP1=11,BGPZ=BGPZZZ+12 D I1AGE2
.S BGPP=12,BGPP1=13,BGPZ=BGPZZZ+15 D I1AGE2
.S BGPP=14,BGPP1=15,BGPZ=BGPZZZ+18 D I1AGE2
.;S BGPP=16,BGPP1=17,BGPZ=BGPZZZ+21 D I1AGE2
.S BGPP=18,BGPP1=19,BGPZ=BGPZZZ+24 D I1AGE2
.S BGPP=28,BGPP1=29,BGPZ=BGPZZZ+39 D I1AGE2
.S BGPP=40,BGPP1=41,BGPZ=BGPZZZ+57 D I1AGE3
D I1AGEP
Q
I1AGE1 ;
S C=C+1
S BGPF="EDA."_BGPX_"."_BGPZ S BGPPC=$O(^BGPELIIR("C",BGPF,0))
S BGPDF=$P(^BGPELIIR(BGPPC,0),U,8)
S BGPNP=$P(^DD(90561.03,BGPDF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(C),U)=$$V(1,BGPRPT,N,P)
S $P(BGPDAP(C),U)=$$V(2,BGPRPT,N,P)
S $P(BGPDAB(C),U)=$$V(3,BGPRPT,N,P)
;
S BGPNF=$P(^BGPELIIR(BGPPC,0),U,9)
S BGPNP=$P(^DD(90561.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(C),U,2)=$$V(1,BGPRPT,N,P),$P(BGPDAC(C),U,3)=$S($P(BGPDAC(C),U,1):($P(BGPDAC(C),U,2)/$P(BGPDAC(C),U)*100),1:"")
S $P(BGPDAP(C),U,2)=$$V(2,BGPRPT,N,P),$P(BGPDAP(C),U,3)=$S($P(BGPDAP(C),U,1):($P(BGPDAP(C),U,2)/$P(BGPDAP(C),U)*100),1:"")
S $P(BGPDAB(C),U,2)=$$V(3,BGPRPT,N,P),$P(BGPDAB(C),U,3)=$S($P(BGPDAB(C),U,1):($P(BGPDAB(C),U,2)/$P(BGPDAB(C),U)*100),1:"")
Q
I1AGE2 ;
;S D=D+1
S BGPF="EDA."_BGPX_"."_BGPZ S BGPPC=$O(^BGPELIIR("C",BGPF,0))
;
S BGPNF=$P(^BGPELIIR(BGPPC,0),U,9)
S BGPNP=$P(^DD(90561.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(C),U,BGPP)=$$V(1,BGPRPT,N,P),$P(BGPDAC(C),U,BGPP1)=$S($P(BGPDAC(C),U,2):($P(BGPDAC(C),U,BGPP)/$P(BGPDAC(C),U,2)*100),1:"")
S $P(BGPDAP(C),U,BGPP)=$$V(2,BGPRPT,N,P),$P(BGPDAP(C),U,BGPP1)=$S($P(BGPDAP(C),U,2):($P(BGPDAP(C),U,BGPP)/$P(BGPDAP(C),U,2)*100),1:"")
S $P(BGPDAB(C),U,BGPP)=$$V(3,BGPRPT,N,P),$P(BGPDAB(C),U,BGPP1)=$S($P(BGPDAB(C),U,2):($P(BGPDAB(C),U,BGPP)/$P(BGPDAB(C),U,2)*100),1:"")
Q
I1AGE3 ;
;S D=D+1
S BGPF="EDA."_BGPX_"."_BGPZ S BGPPC=$O(^BGPELIIR("C",BGPF,0))
;
S BGPNF=$P(^BGPELIIR(BGPPC,0),U,9)
S BGPNP=$P(^DD(90561.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(C),U,BGPP)=$$V(1,BGPRPT,N,P),$P(BGPDAC(C),U,BGPP1)=$S($P(BGPDAC(C),U,1):($P(BGPDAC(C),U,BGPP)/$P(BGPDAC(C),U,1)*100),1:"")
S $P(BGPDAP(C),U,BGPP)=$$V(2,BGPRPT,N,P),$P(BGPDAP(C),U,BGPP1)=$S($P(BGPDAP(C),U,1):($P(BGPDAP(C),U,BGPP)/$P(BGPDAP(C),U,1)*100),1:"")
S $P(BGPDAB(C),U,BGPP)=$$V(3,BGPRPT,N,P),$P(BGPDAB(C),U,BGPP1)=$S($P(BGPDAB(C),U,1):($P(BGPDAB(C),U,BGPP)/$P(BGPDAB(C),U,1)*100),1:"")
Q
I1AGEP ;
;S X=" " D S(X,1,1)
S X="CURRENT REPORT PERIOD" D S(X,1,1) S X=" " D S(X,1,1)
S X=BGPHD2 D S(X,1,1)
S X=BGPHD3 D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U) S Y=$$C(V,0,6) D S(Y,,X+1)
S X="# w/ Exposure to 1+" D S(X,1,1) S X=" High-Risk Med" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,2) S Y=$$C(V,0,6) D S(Y,,X+1)
S X="% w/ Exposure to 1+" D S(X,1,1) S X=" High-Risk Med" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,3) S Y=$J(V,5,1) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="A. # w/ Anticholinergic Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,4) S Y=$$C(V,0,6) D S(Y,,X+1)
S X="A. % w/ Anticholinergic Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,5) S Y=$J(V,5,1) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="B. # w/ Antithrombotic Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,6) S Y=$$C(V,0,6) D S(Y,,X+1)
S X="B. % w/ Antithrombotic Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,7) S Y=$J(V,5,1) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="C. # w/ Anti-infective Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,8) S Y=$$C(V,0,6) D S(Y,,X+1)
S X="C. % w/ Anti-infective Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,9) S Y=$J(V,5,1) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="D. # w/ Cardiovascular Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,10) S Y=$$C(V,0,6) D S(Y,,X+1)
S X="D. % w/ Cardiovascular Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,11) S Y=$J(V,5,1) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="E. # w/ Central Nervous System Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,12) S Y=$$C(V,0,6) D S(Y,,X+1)
S X="E. % w/ Central Nervous System Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,13) S Y=$J(V,5,1) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="F. # w/ Endocrine Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,14) S Y=$$C(V,0,6) D S(Y,,X+1)
S X="F. % w/ Endocrine Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,15) S Y=$J(V,5,1) D S(Y,,X+1)
D HEADER^BGP8DPH W !,^BGPELIR(BGPIC,53,1,0) S X=" " D S(X,1,1) D H3 S X=" " D S(X,1,1)
S X=" " D S(X,1,1) S X="G. # w/ Pain Med Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,18) S Y=$$C(V,0,6) D S(Y,,X+1)
S X="G. % w/ Pain Med Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,19) S Y=$J(V,5,1) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="H. # w/ Skeletal Muscle Relaxant Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,28) S Y=$$C(V,0,6) D S(Y,,X+1)
S X="H. % w/ Skeletal Muscle Relaxant Rx" D S(X,1,1) S X=" w/ % of Total Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,29) S Y=$J(V,5,1) D S(Y,,X+1)
;D HEADER^BGP8DPH W !,^BGPELIR(BGPIC,53,1,0) S X=" " D S(X,1,1) D H3 S X=" " D S(X,1,1)
;
S X=" " D S(X,1,1) S X="# w/ Exposure to Multiple" D S(X,1,1) S X=" High-Risk Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,40) S Y=$$C(V,0,6) D S(Y,,X+1)
S X="% w/ Exposure to Multiple" D S(X,1,1) S X=" High-Risk Meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,41) S Y=$J(V,5,1) D S(Y,,X+1)
Q:BGPQUIT
D ^BGP8EL1Q
Q
S(Y,F,P) ;set up array
;Q:BGPQUIT
;I $Y>(IOSL-5) D HEADER^BGP8DPH Q:BGPQUIT
;W !,^BGPELIR(BGPIC,53,1,0) S X=" " D S(X,1,1) D H3 S X=" " D S(X,1,1)
I $G(F) F J=1:1:F W !
S T=$S(P=1:1,P=2:38,P=3:50,P=4:62,1:1)
W ?T,Y
Q
CALC(N,O) ;
NEW Z
S Z=N-O,Z=$FN(Z,"+,",1)
Q Z
H3 ;EP
;S X="Drugs to be Avoided in the Elderly" D S(X,1,1) S Y=" " D S(Y,1,1)
S X=BGPHD1 D S(X,1,1) S Y=" " D S(Y,1,1)
S X="Age Distribution" D S(X,1,1) ;S X=" " D S(X,1,1)
S Y="65-74" D S(Y,0,2)
S Y="75-84" D S(Y,0,3)
S Y="85+ yrs" D S(Y,0,4)
Q
SB(X) ;EP
X ^DD("FUNC",$O(^DD("FUNC","B","STRIPBLANKS",0)),1)
Q X
H2 ;
S BGPX="",BGPX=BGPCYN,$P(BGPX,U,2)=$$SB($J(BGPCYP,5,1)),$P(BGPX,U,3)=BGPPRN,$P(BGPX,U,4)=$$SB($J(BGPPRP,5,1)),$P(BGPX,U,5)=$$SB($J($$CALC(BGPCYP,BGPPRP),6)),$P(BGPX,U,6)=BGPBLN,$P(BGPX,U,7)=$$SB($J(BGPBLP,5,1))
S $P(BGPX,U,8)=$$SB($J($$CALC(BGPCYP,BGPBLP),6))
D S(BGPX,,2)
Q
SETN ;set numerator fields
S BGPCYN=$$V(1,BGPRPT,N,P)
S BGPPRN=$$V(2,BGPRPT,N,P)
S BGPBLN=$$V(3,BGPRPT,N,P)
S BGPCYP=$S(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
S BGPPRP=$S(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
S BGPBLP=$S(BGPBLD:((BGPBLN/BGPBLD)*100),1:"")
Q
V(T,R,N,P) ;EP
I $G(BGPAREAA) G VA
I T=1 Q $P($G(^BGPEDLCR(R,N)),U,P)
I T=2 Q $P($G(^BGPEDLPR(R,N)),U,P)
I T=3 Q $P($G(^BGPEDLBR(R,N)),U,P)
Q ""
VA ;
NEW X,V,C S X=0,C="" F S X=$O(BGPSUL(X)) Q:X'=+X D
.I T=1 S C=C+$P($G(^BGPEDLCR(X,N)),U,P)
.I T=2 S C=C+$P($G(^BGPEDLPR(X,N)),U,P)
.I T=3 S C=C+$P($G(^BGPEDLBR(X,N)),U,P)
.Q
Q C
C(X,X2,X3) ;
NEW A,B,C,D,E,F,G,H,I,J,K
D COMMA^%DTC
Q X
BGP8EL1P ; IHS/CMI/LAB - print ind 01 Jul 2010 7:55 PM ;
+1 ;;18.1;IHS CLINICAL REPORTING;;MAY 25, 2018;Build 66
+2 ;
I1AGE ;EP
+1 SET BGPHD1="ACTIVE CLINICAL PTS 65+ w/ no hospice"
SET BGPHD2="Active Clinical Pts 65+"
SET BGPHD3=" w/ no hospice"
+2 DO HEADER^BGP8DPH
+3 WRITE !,^BGPELIR(BGPIC,53,1,0)
+4 SET X=" "
DO S(X,1,1)
+5 DO H3
SET X=" "
DO S(X,1,1)
+6 KILL BGPDAC,BGPDAP,BGPDAB
+7 SET (C,D,E,F,G,H,I,J,K)=0
SET BGPX="D"
SET C=0
FOR BGPZZZ=1,2,3
Begin DoDot:1
+8 SET BGPZ=BGPZZZ
DO I1AGE1
+9 SET BGPP=4
SET BGPP1=5
SET BGPZ=BGPZZZ+3
DO I1AGE2
+10 SET BGPP=6
SET BGPP1=7
SET BGPZ=BGPZZZ+6
DO I1AGE2
+11 SET BGPP=8
SET BGPP1=9
SET BGPZ=BGPZZZ+9
DO I1AGE2
+12 SET BGPP=10
SET BGPP1=11
SET BGPZ=BGPZZZ+12
DO I1AGE2
+13 SET BGPP=12
SET BGPP1=13
SET BGPZ=BGPZZZ+15
DO I1AGE2
+14 SET BGPP=14
SET BGPP1=15
SET BGPZ=BGPZZZ+18
DO I1AGE2
+15 ;S BGPP=16,BGPP1=17,BGPZ=BGPZZZ+21 D I1AGE2
+16 SET BGPP=18
SET BGPP1=19
SET BGPZ=BGPZZZ+24
DO I1AGE2
+17 SET BGPP=28
SET BGPP1=29
SET BGPZ=BGPZZZ+39
DO I1AGE2
+18 SET BGPP=40
SET BGPP1=41
SET BGPZ=BGPZZZ+57
DO I1AGE3
End DoDot:1
+19 DO I1AGEP
+20 ;MALE
+21 SET BGPHD1="MALE ACTIVE CLINICAL PTS 65+ w/ no hospice"
SET BGPHD2="Male Active Clinical Pts 65+"
SET BGPHD3=" w/ no hospice"
+22 DO HEADER^BGP8DPH
WRITE !,^BGPELIR(BGPIC,53,1,0)
SET X=" "
DO S(X,1,1)
DO H3
SET X=" "
DO S(X,1,1)
+23 KILL BGPDAC,BGPDAP,BGPDAB
+24 SET (C,D,E,F,G,H,I,J,K)=0
SET BGPX="E"
SET C=0
FOR BGPZZZ=1,2,3
Begin DoDot:1
+25 SET BGPZ=BGPZZZ
DO I1AGE1
+26 SET BGPP=4
SET BGPP1=5
SET BGPZ=BGPZZZ+3
DO I1AGE2
+27 SET BGPP=6
SET BGPP1=7
SET BGPZ=BGPZZZ+6
DO I1AGE2
+28 SET BGPP=8
SET BGPP1=9
SET BGPZ=BGPZZZ+9
DO I1AGE2
+29 SET BGPP=10
SET BGPP1=11
SET BGPZ=BGPZZZ+12
DO I1AGE2
+30 SET BGPP=12
SET BGPP1=13
SET BGPZ=BGPZZZ+15
DO I1AGE2
+31 SET BGPP=14
SET BGPP1=15
SET BGPZ=BGPZZZ+18
DO I1AGE2
+32 ;S BGPP=16,BGPP1=17,BGPZ=BGPZZZ+21 D I1AGE2
+33 SET BGPP=18
SET BGPP1=19
SET BGPZ=BGPZZZ+24
DO I1AGE2
+34 SET BGPP=28
SET BGPP1=29
SET BGPZ=BGPZZZ+39
DO I1AGE2
+35 SET BGPP=40
SET BGPP1=41
SET BGPZ=BGPZZZ+57
DO I1AGE3
End DoDot:1
+36 DO I1AGEP
+37 ;FEMALE
+38 SET BGPHD1="FEMALE ACTIVE CLINICAL PTS 65+ w/ no hospice"
SET BGPHD2="Female Active Clinical Pts 65+"
SET BGPHD3=" w/ no hospice"
+39 DO HEADER^BGP8DPH
WRITE !,^BGPELIR(BGPIC,53,1,0)
SET X=" "
DO S(X,1,1)
DO H3
SET X=" "
DO S(X,1,1)
+40 KILL BGPDAC,BGPDAP,BGPDAB
+41 SET (C,D,E,F,G,H,I,J,K)=0
SET BGPX="F"
SET C=0
FOR BGPZZZ=1,2,3
Begin DoDot:1
+42 SET BGPZ=BGPZZZ
DO I1AGE1
+43 SET BGPP=4
SET BGPP1=5
SET BGPZ=BGPZZZ+3
DO I1AGE2
+44 SET BGPP=6
SET BGPP1=7
SET BGPZ=BGPZZZ+6
DO I1AGE2
+45 SET BGPP=8
SET BGPP1=9
SET BGPZ=BGPZZZ+9
DO I1AGE2
+46 SET BGPP=10
SET BGPP1=11
SET BGPZ=BGPZZZ+12
DO I1AGE2
+47 SET BGPP=12
SET BGPP1=13
SET BGPZ=BGPZZZ+15
DO I1AGE2
+48 SET BGPP=14
SET BGPP1=15
SET BGPZ=BGPZZZ+18
DO I1AGE2
+49 ;S BGPP=16,BGPP1=17,BGPZ=BGPZZZ+21 D I1AGE2
+50 SET BGPP=18
SET BGPP1=19
SET BGPZ=BGPZZZ+24
DO I1AGE2
+51 SET BGPP=28
SET BGPP1=29
SET BGPZ=BGPZZZ+39
DO I1AGE2
+52 SET BGPP=40
SET BGPP1=41
SET BGPZ=BGPZZZ+57
DO I1AGE3
End DoDot:1
+53 DO I1AGEP
+54 QUIT
I1AGE1 ;
+1 SET C=C+1
+2 SET BGPF="EDA."_BGPX_"."_BGPZ
SET BGPPC=$ORDER(^BGPELIIR("C",BGPF,0))
+3 SET BGPDF=$PIECE(^BGPELIIR(BGPPC,0),U,8)
+4 SET BGPNP=$PIECE(^DD(90561.03,BGPDF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+5 SET $PIECE(BGPDAC(C),U)=$$V(1,BGPRPT,N,P)
+6 SET $PIECE(BGPDAP(C),U)=$$V(2,BGPRPT,N,P)
+7 SET $PIECE(BGPDAB(C),U)=$$V(3,BGPRPT,N,P)
+8 ;
+9 SET BGPNF=$PIECE(^BGPELIIR(BGPPC,0),U,9)
+10 SET BGPNP=$PIECE(^DD(90561.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+11 SET $PIECE(BGPDAC(C),U,2)=$$V(1,BGPRPT,N,P)
SET $PIECE(BGPDAC(C),U,3)=$SELECT($PIECE(BGPDAC(C),U,1):($PIECE(BGPDAC(C),U,2)/$PIECE(BGPDAC(C),U)*100),1:"")
+12 SET $PIECE(BGPDAP(C),U,2)=$$V(2,BGPRPT,N,P)
SET $PIECE(BGPDAP(C),U,3)=$SELECT($PIECE(BGPDAP(C),U,1):($PIECE(BGPDAP(C),U,2)/$PIECE(BGPDAP(C),U)*100),1:"")
+13 SET $PIECE(BGPDAB(C),U,2)=$$V(3,BGPRPT,N,P)
SET $PIECE(BGPDAB(C),U,3)=$SELECT($PIECE(BGPDAB(C),U,1):($PIECE(BGPDAB(C),U,2)/$PIECE(BGPDAB(C),U)*100),1:"")
+14 QUIT
I1AGE2 ;
+1 ;S D=D+1
+2 SET BGPF="EDA."_BGPX_"."_BGPZ
SET BGPPC=$ORDER(^BGPELIIR("C",BGPF,0))
+3 ;
+4 SET BGPNF=$PIECE(^BGPELIIR(BGPPC,0),U,9)
+5 SET BGPNP=$PIECE(^DD(90561.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+6 SET $PIECE(BGPDAC(C),U,BGPP)=$$V(1,BGPRPT,N,P)
SET $PIECE(BGPDAC(C),U,BGPP1)=$SELECT($PIECE(BGPDAC(C),U,2):($PIECE(BGPDAC(C),U,BGPP)/$PIECE(BGPDAC(C),U,2)*100),1:"")
+7 SET $PIECE(BGPDAP(C),U,BGPP)=$$V(2,BGPRPT,N,P)
SET $PIECE(BGPDAP(C),U,BGPP1)=$SELECT($PIECE(BGPDAP(C),U,2):($PIECE(BGPDAP(C),U,BGPP)/$PIECE(BGPDAP(C),U,2)*100),1:"")
+8 SET $PIECE(BGPDAB(C),U,BGPP)=$$V(3,BGPRPT,N,P)
SET $PIECE(BGPDAB(C),U,BGPP1)=$SELECT($PIECE(BGPDAB(C),U,2):($PIECE(BGPDAB(C),U,BGPP)/$PIECE(BGPDAB(C),U,2)*100),1:"")
+9 QUIT
I1AGE3 ;
+1 ;S D=D+1
+2 SET BGPF="EDA."_BGPX_"."_BGPZ
SET BGPPC=$ORDER(^BGPELIIR("C",BGPF,0))
+3 ;
+4 SET BGPNF=$PIECE(^BGPELIIR(BGPPC,0),U,9)
+5 SET BGPNP=$PIECE(^DD(90561.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+6 SET $PIECE(BGPDAC(C),U,BGPP)=$$V(1,BGPRPT,N,P)
SET $PIECE(BGPDAC(C),U,BGPP1)=$SELECT($PIECE(BGPDAC(C),U,1):($PIECE(BGPDAC(C),U,BGPP)/$PIECE(BGPDAC(C),U,1)*100),1:"")
+7 SET $PIECE(BGPDAP(C),U,BGPP)=$$V(2,BGPRPT,N,P)
SET $PIECE(BGPDAP(C),U,BGPP1)=$SELECT($PIECE(BGPDAP(C),U,1):($PIECE(BGPDAP(C),U,BGPP)/$PIECE(BGPDAP(C),U,1)*100),1:"")
+8 SET $PIECE(BGPDAB(C),U,BGPP)=$$V(3,BGPRPT,N,P)
SET $PIECE(BGPDAB(C),U,BGPP1)=$SELECT($PIECE(BGPDAB(C),U,1):($PIECE(BGPDAB(C),U,BGPP)/$PIECE(BGPDAB(C),U,1)*100),1:"")
+9 QUIT
I1AGEP ;
+1 ;S X=" " D S(X,1,1)
+2 SET X="CURRENT REPORT PERIOD"
DO S(X,1,1)
SET X=" "
DO S(X,1,1)
+3 SET X=BGPHD2
DO S(X,1,1)
+4 SET X=BGPHD3
DO S(X,1,1)
+5 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U)
SET Y=$$C(V,0,6)
DO S(Y,,X+1)
+6 SET X="# w/ Exposure to 1+"
DO S(X,1,1)
SET X=" High-Risk Med"
DO S(X,1,1)
+7 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,2)
SET Y=$$C(V,0,6)
DO S(Y,,X+1)
+8 SET X="% w/ Exposure to 1+"
DO S(X,1,1)
SET X=" High-Risk Med"
DO S(X,1,1)
+9 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,3)
SET Y=$JUSTIFY(V,5,1)
DO S(Y,,X+1)
+10 SET X=" "
DO S(X,1,1)
SET X="A. # w/ Anticholinergic Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+11 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,4)
SET Y=$$C(V,0,6)
DO S(Y,,X+1)
+12 SET X="A. % w/ Anticholinergic Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+13 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,5)
SET Y=$JUSTIFY(V,5,1)
DO S(Y,,X+1)
+14 SET X=" "
DO S(X,1,1)
SET X="B. # w/ Antithrombotic Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+15 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,6)
SET Y=$$C(V,0,6)
DO S(Y,,X+1)
+16 SET X="B. % w/ Antithrombotic Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+17 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,7)
SET Y=$JUSTIFY(V,5,1)
DO S(Y,,X+1)
+18 SET X=" "
DO S(X,1,1)
SET X="C. # w/ Anti-infective Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+19 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,8)
SET Y=$$C(V,0,6)
DO S(Y,,X+1)
+20 SET X="C. % w/ Anti-infective Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+21 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,9)
SET Y=$JUSTIFY(V,5,1)
DO S(Y,,X+1)
+22 SET X=" "
DO S(X,1,1)
SET X="D. # w/ Cardiovascular Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+23 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,10)
SET Y=$$C(V,0,6)
DO S(Y,,X+1)
+24 SET X="D. % w/ Cardiovascular Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+25 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,11)
SET Y=$JUSTIFY(V,5,1)
DO S(Y,,X+1)
+26 SET X=" "
DO S(X,1,1)
SET X="E. # w/ Central Nervous System Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+27 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,12)
SET Y=$$C(V,0,6)
DO S(Y,,X+1)
+28 SET X="E. % w/ Central Nervous System Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+29 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,13)
SET Y=$JUSTIFY(V,5,1)
DO S(Y,,X+1)
+30 SET X=" "
DO S(X,1,1)
SET X="F. # w/ Endocrine Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+31 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,14)
SET Y=$$C(V,0,6)
DO S(Y,,X+1)
+32 SET X="F. % w/ Endocrine Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+33 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,15)
SET Y=$JUSTIFY(V,5,1)
DO S(Y,,X+1)
+34 DO HEADER^BGP8DPH
WRITE !,^BGPELIR(BGPIC,53,1,0)
SET X=" "
DO S(X,1,1)
DO H3
SET X=" "
DO S(X,1,1)
+35 SET X=" "
DO S(X,1,1)
SET X="G. # w/ Pain Med Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+36 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,18)
SET Y=$$C(V,0,6)
DO S(Y,,X+1)
+37 SET X="G. % w/ Pain Med Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+38 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,19)
SET Y=$JUSTIFY(V,5,1)
DO S(Y,,X+1)
+39 SET X=" "
DO S(X,1,1)
SET X="H. # w/ Skeletal Muscle Relaxant Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+40 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,28)
SET Y=$$C(V,0,6)
DO S(Y,,X+1)
+41 SET X="H. % w/ Skeletal Muscle Relaxant Rx"
DO S(X,1,1)
SET X=" w/ % of Total Meds"
DO S(X,1,1)
+42 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,29)
SET Y=$JUSTIFY(V,5,1)
DO S(Y,,X+1)
+43 ;D HEADER^BGP8DPH W !,^BGPELIR(BGPIC,53,1,0) S X=" " D S(X,1,1) D H3 S X=" " D S(X,1,1)
+44 ;
+45 SET X=" "
DO S(X,1,1)
SET X="# w/ Exposure to Multiple"
DO S(X,1,1)
SET X=" High-Risk Meds"
DO S(X,1,1)
+46 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,40)
SET Y=$$C(V,0,6)
DO S(Y,,X+1)
+47 SET X="% w/ Exposure to Multiple"
DO S(X,1,1)
SET X=" High-Risk Meds"
DO S(X,1,1)
+48 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,41)
SET Y=$JUSTIFY(V,5,1)
DO S(Y,,X+1)
+49 IF BGPQUIT
QUIT
+50 DO ^BGP8EL1Q
+51 QUIT
S(Y,F,P) ;set up array
+1 ;Q:BGPQUIT
+2 ;I $Y>(IOSL-5) D HEADER^BGP8DPH Q:BGPQUIT
+3 ;W !,^BGPELIR(BGPIC,53,1,0) S X=" " D S(X,1,1) D H3 S X=" " D S(X,1,1)
+4 IF $GET(F)
FOR J=1:1:F
WRITE !
+5 SET T=$SELECT(P=1:1,P=2:38,P=3:50,P=4:62,1:1)
+6 WRITE ?T,Y
+7 QUIT
CALC(N,O) ;
+1 NEW Z
+2 SET Z=N-O
SET Z=$FNUMBER(Z,"+,",1)
+3 QUIT Z
H3 ;EP
+1 ;S X="Drugs to be Avoided in the Elderly" D S(X,1,1) S Y=" " D S(Y,1,1)
+2 SET X=BGPHD1
DO S(X,1,1)
SET Y=" "
DO S(Y,1,1)
+3 ;S X=" " D S(X,1,1)
SET X="Age Distribution"
DO S(X,1,1)
+4 SET Y="65-74"
DO S(Y,0,2)
+5 SET Y="75-84"
DO S(Y,0,3)
+6 SET Y="85+ yrs"
DO S(Y,0,4)
+7 QUIT
SB(X) ;EP
+1 XECUTE ^DD("FUNC",$ORDER(^DD("FUNC","B","STRIPBLANKS",0)),1)
+2 QUIT X
H2 ;
+1 SET BGPX=""
SET BGPX=BGPCYN
SET $PIECE(BGPX,U,2)=$$SB($JUSTIFY(BGPCYP,5,1))
SET $PIECE(BGPX,U,3)=BGPPRN
SET $PIECE(BGPX,U,4)=$$SB($JUSTIFY(BGPPRP,5,1))
SET $PIECE(BGPX,U,5)=$$SB($JUSTIFY($$CALC(BGPCYP,BGPPRP),6))
SET $PIECE(BGPX,U,6)=BGPBLN
SET $PIECE(BGPX,U,7)=$$SB($JUSTIFY(BGPBLP,5,1))
+2 SET $PIECE(BGPX,U,8)=$$SB($JUSTIFY($$CALC(BGPCYP,BGPBLP),6))
+3 DO S(BGPX,,2)
+4 QUIT
SETN ;set numerator fields
+1 SET BGPCYN=$$V(1,BGPRPT,N,P)
+2 SET BGPPRN=$$V(2,BGPRPT,N,P)
+3 SET BGPBLN=$$V(3,BGPRPT,N,P)
+4 SET BGPCYP=$SELECT(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
+5 SET BGPPRP=$SELECT(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
+6 SET BGPBLP=$SELECT(BGPBLD:((BGPBLN/BGPBLD)*100),1:"")
+7 QUIT
V(T,R,N,P) ;EP
+1 IF $GET(BGPAREAA)
GOTO VA
+2 IF T=1
QUIT $PIECE($GET(^BGPEDLCR(R,N)),U,P)
+3 IF T=2
QUIT $PIECE($GET(^BGPEDLPR(R,N)),U,P)
+4 IF T=3
QUIT $PIECE($GET(^BGPEDLBR(R,N)),U,P)
+5 QUIT ""
VA ;
+1 NEW X,V,C
SET X=0
SET C=""
FOR
SET X=$ORDER(BGPSUL(X))
IF X'=+X
QUIT
Begin DoDot:1
+2 IF T=1
SET C=C+$PIECE($GET(^BGPEDLCR(X,N)),U,P)
+3 IF T=2
SET C=C+$PIECE($GET(^BGPEDLPR(X,N)),U,P)
+4 IF T=3
SET C=C+$PIECE($GET(^BGPEDLBR(X,N)),U,P)
+5 QUIT
End DoDot:1
+6 QUIT C
C(X,X2,X3) ;
+1 NEW A,B,C,D,E,F,G,H,I,J,K
+2 DO COMMA^%DTC
+3 QUIT X