CIMGAGPW ; CMI/TUCSON/LAB - aberdeen gpra print ; [ 03/14/00 9:49 AM ]
;;1.0;ABERDEEN GPRA REPORT;;JAN 22, 2000
;
;
INJ ;tally injuries
D HEADER Q:CIMQUIT
K ^TMP($J,"INJ")
S T=$P($G(^CIMAGP(CIMRPT,23)),U,11)
I T S X=0 F S X=$O(^CIMAGP(CIMRPT,25,X)) Q:X'=+X S I=$P(^CIMAGP(CIMRPT,25,X,0),U),J="Z"_I,C=$P(^(0),U,2),D=$P(^(0),U,3),$P(^TMP($J,"INJ",J),U)=D,$P(^(J),U,2)=C,$P(^(J),U,3)=((C/T)*100) D
.;set inpt/out/alcohol
.F Y=5:1:9 S A=$P(^CIMAGP(CIMRPT,25,X,0),U,Y) S $P(^TMP($J,"INJ",J),U,$S(Y=5:6,Y=6:8,Y=7:10,Y=8:12,Y=9:14))=A S $P(^TMP($J,"INJ",J),U,$S(Y=5:7,Y=6:9,Y=7:11,Y=8:13,Y=9:15))=((A/C)*100)
.S Y=0 F S Y=$O(^CIMAGP(CIMRPT,25,X,25,Y)) Q:Y'=+Y S E=$P(^CIMAGP(CIMRPT,25,X,25,Y,0),U),Z=$P(^(0),U,2),D=$P(^(0),U,3),$P(^TMP($J,"INJ",J,E),U)=D,$P(^(E),U,2)=Z,$P(^(E),U,3)=((Z/C)*100)
S T=$P($G(^CIMAGP(CIMRPT,22)),U,11)
I T S X=0 F S X=$O(^CIMAGP(CIMRPT,24,X)) Q:X'=+X S I=$P(^CIMAGP(CIMRPT,24,X,0),U),J="Z"_I,C=$P(^(0),U,2),D=$P(^(0),U,3),$P(^TMP($J,"INJ",J),U)=D,$P(^(J),U,4)=C,$P(^(J),U,5)=((C/T)*100) D
.F Y=5:1:9 S A=$P(^CIMAGP(CIMRPT,24,X,0),U,Y),$P(^TMP($J,"INJ",J),U,$S(Y=5:16,Y=6:18,Y=7:20,Y=8:22,Y=9:24))=A,$P(^TMP($J,"INJ",J),U,$S(Y=5:17,Y=6:19,Y=7:21,Y=8:23,Y=9:25))=((A/C)*100)
.S Y=0 F S Y=$O(^CIMAGP(CIMRPT,24,X,24,Y)) Q:Y'=+Y S E=$P(^CIMAGP(CIMRPT,24,X,24,Y,0),U),Z=$P(^(0),U,2),D=$P(^(0),U,3),$P(^TMP($J,"INJ",J,E),U)=D,$P(^(E),U,4)=Z,$P(^(E),U,5)=((Z/C)*100)
INJPP ;
;calc %change and print all
S CIMX=0 F S CIMX=$O(^TMP($J,"INJ",CIMX)) Q:CIMX=""!(CIMQUIT) D
.S D=^TMP($J,"INJ",CIMX)
.I $Y>(IOSL-5) D HEADER Q:CIMQUIT
.W !!?1,$E(CIMX,2,99),?8,$E($P(D,U),1,28)
.W ?36,$$C($P(D,U,2),0,9),?44,$J($P(D,U,3),6,1),?54,$$C($P(D,U,4),0,9),?62,$J($P(D,U,5),6,1)
.W ?72,$J($$CALC($P(D,U,5),$P(D,U,3)),7)
.W !?5,"# Direct Inpatient",?36,$$C($P(D,U,6),0,9),?44,$J($P(D,U,7),6,1),?54,$$C($P(D,U,16),0,9),?62,$J($P(D,U,17),6,1),?72,$J($$CALC($P(D,U,17),$P(D,U,7)),7)
.W !?5,"# Direct Outpatient",?36,$$C($P(D,U,8),0,9),?44,$J($P(D,U,9),6,1),?54,$$C($P(D,U,18),0,9),?62,$J($P(D,U,19),6,1),?72,$J($$CALC($P(D,U,19),$P(D,U,9)),7)
.W !?5,"# Contract Inpatient",?36,$$C($P(D,U,10),0,9),?44,$J($P(D,U,11),6,1),?54,$$C($P(D,U,20),0,9),?62,$J($P(D,U,21),6,1),?72,$J($$CALC($P(D,U,21),$P(D,U,11)),7)
.W !?5,"# Contract Outpatient",?36,$$C($P(D,U,12),0,9),?44,$J($P(D,U,13),6,1),?54,$$C($P(D,U,22),0,9),?62,$J($P(D,U,23),6,1),?72,$J($$CALC($P(D,U,23),$P(D,U,13)),7)
.W !?5,"Alcohol Related",?36,$$C($P(D,U,14),0,9),?44,$J($P(D,U,15),6,1),?54,$$C($P(D,U,24),0,9),?62,$J($P(D,U,25),6,1),?72,$J($$CALC($P(D,U,25),$P(D,U,15)),7)
.;ecode tally
.S CIMY="" F S CIMY=$O(^TMP($J,"INJ",CIMX,CIMY)) Q:CIMY=""!(CIMQUIT) D
..S CIMD=^TMP($J,"INJ",CIMX,CIMY)
..I $Y>(IOSL-3) D HEADER Q:CIMQUIT
..W !?5,CIMY,?12,$E($P(CIMD,U),1,24)
..W ?36,$$C($P(CIMD,U,2),0,9),?44,$J($P(CIMD,U,3),6,1),?54,$$C($P(CIMD,U,4),0,9),?62,$J($P(CIMD,U,5),6,1)
..W ?72,$J($$CALC($P(CIMD,U,5),$P(CIMD,U,3)),7)
.Q
;print list of injuries
D ^CIMGAGPX
Q
CALC(N,O) ;ENTRY POINT
;N is new
;O is old
NEW Z
I O=0!(N=0)!(O="")!(N="") Q "**"
NEW X,X2,X3
S X=N,X2=1,X3=0 D COMMA^%DTC S N=X
S X=O,X2=1,X3=0 D COMMA^%DTC S O=X
I +O=0 Q "**"
S Z=(((N-O)/O)*100),Z=$FN(Z,"+,",1)
Q Z
V(R,N,P) ;
Q $P($G(^CIMAGP(R,N)),U,P)
C(X,X2,X3) ;
D COMMA^%DTC
Q X
G:'CIMGPG HEADER1
K DIR I $E(IOST)="C",IO=IO(0),'$D(ZTQUEUED) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S CIMQUIT=1 Q
W:$D(IOF) @IOF S CIMGPG=CIMGPG+1
W !?3,$P(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",CIMGPG,!
W !,$$CTR("*** ABERDEEN AREA GPRA INDICATORS ***",80),!
W $$CTR($P(^DIC(4,DUZ(2),0),U)),!
S X="Reporting Period: "_$$FMTE^XLFDT(CIMBD)_" to "_$$FMTE^XLFDT(CIMED) W $$CTR(X,80),!
S X="Baseline Period: "_$$FMTE^XLFDT(CIM98B)_" to "_$$FMTE^XLFDT(CIM98E) W $$CTR(X,80),!
W !,$TR($J("",80)," ","-")
W !?38,"BASELINE",?45," %",?56,"REPORT",?64," %",?71,"% CHANGE",!?38,"PERIOD",?56,"PERIOD"
W !,"Injury Diagnoses and E Codes"
Q
CTR(X,Y) ;EP - Center X in a field Y wide.
Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
;----------
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")
;----------
LOC() ;EP - Return location name from file 4 based on DUZ(2).
Q $S($G(DUZ(2)):$S($D(^DIC(4,DUZ(2),0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")
;----------
CIMGAGPW ; CMI/TUCSON/LAB - aberdeen gpra print ; [ 03/14/00 9:49 AM ]
+1 ;;1.0;ABERDEEN GPRA REPORT;;JAN 22, 2000
+2 ;
+3 ;
INJ ;tally injuries
+1 DO HEADER
IF CIMQUIT
QUIT
+2 KILL ^TMP($JOB,"INJ")
+3 SET T=$PIECE($GET(^CIMAGP(CIMRPT,23)),U,11)
+4 IF T
SET X=0
FOR
SET X=$ORDER(^CIMAGP(CIMRPT,25,X))
IF X'=+X
QUIT
SET I=$PIECE(^CIMAGP(CIMRPT,25,X,0),U)
SET J="Z"_I
SET C=$PIECE(^(0),U,2)
SET D=$PIECE(^(0),U,3)
SET $PIECE(^TMP($JOB,"INJ",J),U)=D
SET $PIECE(^(J),U,2)=C
SET $PIECE(^(J),U,3)=((C/T)*100)
Begin DoDot:1
+5 ;set inpt/out/alcohol
+6 FOR Y=5:1:9
SET A=$PIECE(^CIMAGP(CIMRPT,25,X,0),U,Y)
SET $PIECE(^TMP($JOB,"INJ",J),U,$SELECT(Y=5:6,Y=6:8,Y=7:10,Y=8:12,Y=9:14))=A
SET $PIECE(^TMP($JOB,"INJ",J),U,$SELECT(Y=5:7,Y=6:9,Y=7:11,Y=8:13,Y=9:15))=((A/C)*100)
+7 SET Y=0
FOR
SET Y=$ORDER(^CIMAGP(CIMRPT,25,X,25,Y))
IF Y'=+Y
QUIT
SET E=$PIECE(^CIMAGP(CIMRPT,25,X,25,Y,0),U)
SET Z=$PIECE(^(0),U,2)
SET D=$PIECE(^(0),U,3)
SET $PIECE(^TMP($JOB,"INJ",J,E),U)=D
SET $PIECE(^(E),U,2)=Z
SET $PIECE(^(E),U,3)=((Z/C)*100)
End DoDot:1
+8 SET T=$PIECE($GET(^CIMAGP(CIMRPT,22)),U,11)
+9 IF T
SET X=0
FOR
SET X=$ORDER(^CIMAGP(CIMRPT,24,X))
IF X'=+X
QUIT
SET I=$PIECE(^CIMAGP(CIMRPT,24,X,0),U)
SET J="Z"_I
SET C=$PIECE(^(0),U,2)
SET D=$PIECE(^(0),U,3)
SET $PIECE(^TMP($JOB,"INJ",J),U)=D
SET $PIECE(^(J),U,4)=C
SET $PIECE(^(J),U,5)=((C/T)*100)
Begin DoDot:1
+10 FOR Y=5:1:9
SET A=$PIECE(^CIMAGP(CIMRPT,24,X,0),U,Y)
SET $PIECE(^TMP($JOB,"INJ",J),U,$SELECT(Y=5:16,Y=6:18,Y=7:20,Y=8:22,Y=9:24))=A
SET $PIECE(^TMP($JOB,"INJ",J),U,$SELECT(Y=5:17,Y=6:19,Y=7:21,Y=8:23,Y=9:25))=((A/C)*100)
+11 SET Y=0
FOR
SET Y=$ORDER(^CIMAGP(CIMRPT,24,X,24,Y))
IF Y'=+Y
QUIT
SET E=$PIECE(^CIMAGP(CIMRPT,24,X,24,Y,0),U)
SET Z=$PIECE(^(0),U,2)
SET D=$PIECE(^(0),U,3)
SET $PIECE(^TMP($JOB,"INJ",J,E),U)=D
SET $PIECE(^(E),U,4)=Z
SET $PIECE(^(E),U,5)=((Z/C)*100)
End DoDot:1
INJPP ;
+1 ;calc %change and print all
+2 SET CIMX=0
FOR
SET CIMX=$ORDER(^TMP($JOB,"INJ",CIMX))
IF CIMX=""!(CIMQUIT)
QUIT
Begin DoDot:1
+3 SET D=^TMP($JOB,"INJ",CIMX)
+4 IF $Y>(IOSL-5)
DO HEADER
IF CIMQUIT
QUIT
+5 WRITE !!?1,$EXTRACT(CIMX,2,99),?8,$EXTRACT($PIECE(D,U),1,28)
+6 WRITE ?36,$$C($PIECE(D,U,2),0,9),?44,$JUSTIFY($PIECE(D,U,3),6,1),?54,$$C($PIECE(D,U,4),0,9),?62,$JUSTIFY($PIECE(D,U,5),6,1)
+7 WRITE ?72,$JUSTIFY($$CALC($PIECE(D,U,5),$PIECE(D,U,3)),7)
+8 WRITE !?5,"# Direct Inpatient",?36,$$C($PIECE(D,U,6),0,9),?44,$JUSTIFY($PIECE(D,U,7),6,1),?54,$$C($PIECE(D,U,16),0,9),?62,$JUSTIFY($PIECE(D,U,17),6,1),?72,$JUSTIFY($$CALC($PIECE(D,U,17),$PIECE(D,U,7)),7)
+9 WRITE !?5,"# Direct Outpatient",?36,$$C($PIECE(D,U,8),0,9),?44,$JUSTIFY($PIECE(D,U,9),6,1),?54,$$C($PIECE(D,U,18),0,9),?62,$JUSTIFY($PIECE(D,U,19),6,1),?72,$JUSTIFY($$CALC($PIECE(D,U,19),$PIECE(D,U,9)),7)
+10 WRITE !?5,"# Contract Inpatient",?36,$$C($PIECE(D,U,10),0,9),?44,$JUSTIFY($PIECE(D,U,11),6,1),?54,$$C($PIECE(D,U,20),0,9),?62,$JUSTIFY($PIECE(D,U,21),6,1),?72,$JUSTIFY($$CALC($PIECE(D,U,21),$PIECE(D,U,11)),7)
+11 WRITE !?5,"# Contract Outpatient",?36,$$C($PIECE(D,U,12),0,9),?44,$JUSTIFY($PIECE(D,U,13),6,1),?54,$$C($PIECE(D,U,22),0,9),?62,$JUSTIFY($PIECE(D,U,23),6,1),?72,$JUSTIFY($$CALC($PIECE(D,U,23),$PIECE(D,U,13)),7)
+12 WRITE !?5,"Alcohol Related",?36,$$C($PIECE(D,U,14),0,9),?44,$JUSTIFY($PIECE(D,U,15),6,1),?54,$$C($PIECE(D,U,24),0,9),?62,$JUSTIFY($PIECE(D,U,25),6,1),?72,$JUSTIFY($$CALC($PIECE(D,U,25),$PIECE(D,U,15)),7)
+13 ;ecode tally
+14 SET CIMY=""
FOR
SET CIMY=$ORDER(^TMP($JOB,"INJ",CIMX,CIMY))
IF CIMY=""!(CIMQUIT)
QUIT
Begin DoDot:2
+15 SET CIMD=^TMP($JOB,"INJ",CIMX,CIMY)
+16 IF $Y>(IOSL-3)
DO HEADER
IF CIMQUIT
QUIT
+17 WRITE !?5,CIMY,?12,$EXTRACT($PIECE(CIMD,U),1,24)
+18 WRITE ?36,$$C($PIECE(CIMD,U,2),0,9),?44,$JUSTIFY($PIECE(CIMD,U,3),6,1),?54,$$C($PIECE(CIMD,U,4),0,9),?62,$JUSTIFY($PIECE(CIMD,U,5),6,1)
+19 WRITE ?72,$JUSTIFY($$CALC($PIECE(CIMD,U,5),$PIECE(CIMD,U,3)),7)
End DoDot:2
+20 QUIT
End DoDot:1
+21 ;print list of injuries
+22 DO ^CIMGAGPX
+23 QUIT
CALC(N,O) ;ENTRY POINT
+1 ;N is new
+2 ;O is old
+3 NEW Z
+4 IF O=0!(N=0)!(O="")!(N="")
QUIT "**"
+5 NEW X,X2,X3
+6 SET X=N
SET X2=1
SET X3=0
DO COMMA^%DTC
SET N=X
+7 SET X=O
SET X2=1
SET X3=0
DO COMMA^%DTC
SET O=X
+8 IF +O=0
QUIT "**"
+9 SET Z=(((N-O)/O)*100)
SET Z=$FNUMBER(Z,"+,",1)
+10 QUIT Z
V(R,N,P) ;
+1 QUIT $PIECE($GET(^CIMAGP(R,N)),U,P)
C(X,X2,X3) ;
+1 DO COMMA^%DTC
+2 QUIT X
+1 IF 'CIMGPG
GOTO HEADER1
+2 KILL DIR
IF $EXTRACT(IOST)="C"
IF IO=IO(0)
IF '$DATA(ZTQUEUED)
WRITE !
SET DIR(0)="EO"
DO ^DIR
KILL DIR
IF Y=0!(Y="^")!($DATA(DTOUT))
SET CIMQUIT=1
QUIT
+1 IF $DATA(IOF)
WRITE @IOF
SET CIMGPG=CIMGPG+1
+2 WRITE !?3,$PIECE(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",CIMGPG,!
+3 WRITE !,$$CTR("*** ABERDEEN AREA GPRA INDICATORS ***",80),!
+4 WRITE $$CTR($PIECE(^DIC(4,DUZ(2),0),U)),!
+5 SET X="Reporting Period: "_$$FMTE^XLFDT(CIMBD)_" to "_$$FMTE^XLFDT(CIMED)
WRITE $$CTR(X,80),!
+6 SET X="Baseline Period: "_$$FMTE^XLFDT(CIM98B)_" to "_$$FMTE^XLFDT(CIM98E)
WRITE $$CTR(X,80),!
+7 WRITE !,$TRANSLATE($JUSTIFY("",80)," ","-")
+8 WRITE !?38,"BASELINE",?45," %",?56,"REPORT",?64," %",?71,"% CHANGE",!?38,"PERIOD",?56,"PERIOD"
+9 WRITE !,"Injury Diagnoses and E Codes"
+10 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 ;----------
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 ;----------
LOC() ;EP - Return location name from file 4 based on DUZ(2).
+1 QUIT $SELECT($GET(DUZ(2)):$SELECT($DATA(^DIC(4,DUZ(2),0)):$PIECE(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")
+2 ;----------