BGP2HEP1 ; IHS/CMI/LAB - print ind 1 ;
;;12.1;IHS CLINICAL REPORTING;;MAY 17, 2012;Build 66
;
;
IP ;EP
I $Y>(BGPIOSL-13)!(BGPIC=1)!(BGPIC=17) D HEADER^BGP2DPH Q:BGPQUIT W !!,^BGPHEIB(BGPIC,53,1,0)
D H1^BGP2DPH
S BGPPC1=$P(^BGPHEIB(BGPIC,0),U,6),BGPNDEN=$P(^BGPHEIB(BGPIC,12),U),BGPNODEN=$P(^BGPHEIB(BGPIC,12),U,2) Q:BGPQUIT D PI
Q
PI ;EP
;S BGPPC3=0 F S BGPPC2=$O(^BGPHEIIB("AB",BGPPC1,BGPPC3)) Q:BGPPC3="" S BGPPC=$O(^BGPHEIIB("ABC",BGPPC1,BGPPC3,0)),BGPPC2=$P(^BGPHEIIB(BGPPC,12),U,4) D PI1
S BGPPC3=0 F S BGPPC3=$O(^BGPHEIIB("AC",BGPPC1,BGPPC3)) Q:BGPPC3="" D
.;BGPPC3=1,2 pieces
.S BGPPC4=0 F S BGPPC4=$O(^BGPHEIIB("AC",BGPPC1,BGPPC3,BGPPC4)) Q:BGPPC4="" D
..S BGPPC=$O(^BGPHEIIB("AC",BGPPC1,BGPPC3,BGPPC4,0))
..S BGPPC2=BGPPC3_"."_BGPPC4
..D PI1
Q
PI1 ;
S BGPDF=$P(^BGPHEIIB(BGPPC,0),U,8)
;get denominator value of measure
S BGPNP=$P(^DD(90546.03,BGPDF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S BGPCYD=$$V(1,BGPRPT,N,P)
S BGPPRD=$$V(2,BGPRPT,N,P)
S BGPBLD=$$V(3,BGPRPT,N,P)
;write out denominator
I $P(BGPPC2,".",3)=1 D ;only on 1st numerator, display denominator
.I $Y>(BGPIOSL-13) D HEADER^BGP2DPH Q:BGPQUIT W !!,^BGPHEIB(BGPIC,53,1,0) D H1^BGP2DPH
.W !!,$P(^BGPHEIIB(BGPPC,0),U,17)
.I $P(^BGPHEIIB(BGPPC,0),U,18)]"" D
..W !,$P(^BGPHEIIB(BGPPC,0),U,18)
.I $P(^BGPHEIIB(BGPPC,0),U,21)]"" D
..W !,$P(^BGPHEIIB(BGPPC,0),U,21)
.W ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
S BGPNF=$P(^BGPHEIIB(BGPPC,0),U,9)
S BGPNP=$P(^DD(90546.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
D SETN
;write header for 1.A.1
W !,$P(^BGPHEIIB(BGPPC,0),U,15)
I $P(^BGPHEIIB(BGPPC,0),U,16)]"" W !?1,$P(^BGPHEIIB(BGPPC,0),U,16)
I $P(^BGPHEIIB(BGPPC,0),U,19)]"" W !?1,$P(^BGPHEIIB(BGPPC,0),U,19)
D H2^BGP2DPH
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
SL(V) ;
I V="" S V=0
Q $$STRIP^XLFSTR($J(V,5,1)," ")
V(T,R,N,P) ;EP
I $G(BGPAREAA) G VA
I T=1 Q $P($G(^BGPHEDCB(R,N)),U,P)
I T=2 Q $P($G(^BGPHEDPB(R,N)),U,P)
I T=3 Q $P($G(^BGPHEDBB(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(^BGPHEDCB(X,N)),U,P)
.I T=2 S C=C+$P($G(^BGPHEDPB(X,N)),U,P)
.I T=3 S C=C+$P($G(^BGPHEDBB(X,N)),U,P)
.Q
Q C
C(X,X2,X3) ;
D COMMA^%DTC
Q X
BGP2HEP1 ; IHS/CMI/LAB - print ind 1 ;
+1 ;;12.1;IHS CLINICAL REPORTING;;MAY 17, 2012;Build 66
+2 ;
+3 ;
IP ;EP
+1 IF $Y>(BGPIOSL-13)!(BGPIC=1)!(BGPIC=17)
DO HEADER^BGP2DPH
IF BGPQUIT
QUIT
WRITE !!,^BGPHEIB(BGPIC,53,1,0)
+2 DO H1^BGP2DPH
+3 SET BGPPC1=$PIECE(^BGPHEIB(BGPIC,0),U,6)
SET BGPNDEN=$PIECE(^BGPHEIB(BGPIC,12),U)
SET BGPNODEN=$PIECE(^BGPHEIB(BGPIC,12),U,2)
IF BGPQUIT
QUIT
DO PI
+4 QUIT
PI ;EP
+1 ;S BGPPC3=0 F S BGPPC2=$O(^BGPHEIIB("AB",BGPPC1,BGPPC3)) Q:BGPPC3="" S BGPPC=$O(^BGPHEIIB("ABC",BGPPC1,BGPPC3,0)),BGPPC2=$P(^BGPHEIIB(BGPPC,12),U,4) D PI1
+2 SET BGPPC3=0
FOR
SET BGPPC3=$ORDER(^BGPHEIIB("AC",BGPPC1,BGPPC3))
IF BGPPC3=""
QUIT
Begin DoDot:1
+3 ;BGPPC3=1,2 pieces
+4 SET BGPPC4=0
FOR
SET BGPPC4=$ORDER(^BGPHEIIB("AC",BGPPC1,BGPPC3,BGPPC4))
IF BGPPC4=""
QUIT
Begin DoDot:2
+5 SET BGPPC=$ORDER(^BGPHEIIB("AC",BGPPC1,BGPPC3,BGPPC4,0))
+6 SET BGPPC2=BGPPC3_"."_BGPPC4
+7 DO PI1
End DoDot:2
End DoDot:1
+8 QUIT
PI1 ;
+1 SET BGPDF=$PIECE(^BGPHEIIB(BGPPC,0),U,8)
+2 ;get denominator value of measure
+3 SET BGPNP=$PIECE(^DD(90546.03,BGPDF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+4 SET BGPCYD=$$V(1,BGPRPT,N,P)
+5 SET BGPPRD=$$V(2,BGPRPT,N,P)
+6 SET BGPBLD=$$V(3,BGPRPT,N,P)
+7 ;write out denominator
+8 ;only on 1st numerator, display denominator
IF $PIECE(BGPPC2,".",3)=1
Begin DoDot:1
+9 IF $Y>(BGPIOSL-13)
DO HEADER^BGP2DPH
IF BGPQUIT
QUIT
WRITE !!,^BGPHEIB(BGPIC,53,1,0)
DO H1^BGP2DPH
+10 WRITE !!,$PIECE(^BGPHEIIB(BGPPC,0),U,17)
+11 IF $PIECE(^BGPHEIIB(BGPPC,0),U,18)]""
Begin DoDot:2
+12 WRITE !,$PIECE(^BGPHEIIB(BGPPC,0),U,18)
End DoDot:2
+13 IF $PIECE(^BGPHEIIB(BGPPC,0),U,21)]""
Begin DoDot:2
+14 WRITE !,$PIECE(^BGPHEIIB(BGPPC,0),U,21)
End DoDot:2
+15 WRITE ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
End DoDot:1
+16 SET BGPNF=$PIECE(^BGPHEIIB(BGPPC,0),U,9)
+17 SET BGPNP=$PIECE(^DD(90546.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+18 DO SETN
+19 ;write header for 1.A.1
+20 WRITE !,$PIECE(^BGPHEIIB(BGPPC,0),U,15)
+21 IF $PIECE(^BGPHEIIB(BGPPC,0),U,16)]""
WRITE !?1,$PIECE(^BGPHEIIB(BGPPC,0),U,16)
+22 IF $PIECE(^BGPHEIIB(BGPPC,0),U,19)]""
WRITE !?1,$PIECE(^BGPHEIIB(BGPPC,0),U,19)
+23 DO H2^BGP2DPH
+24 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
SL(V) ;
+1 IF V=""
SET V=0
+2 QUIT $$STRIP^XLFSTR($JUSTIFY(V,5,1)," ")
V(T,R,N,P) ;EP
+1 IF $GET(BGPAREAA)
GOTO VA
+2 IF T=1
QUIT $PIECE($GET(^BGPHEDCB(R,N)),U,P)
+3 IF T=2
QUIT $PIECE($GET(^BGPHEDPB(R,N)),U,P)
+4 IF T=3
QUIT $PIECE($GET(^BGPHEDBB(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(^BGPHEDCB(X,N)),U,P)
+3 IF T=2
SET C=C+$PIECE($GET(^BGPHEDPB(X,N)),U,P)
+4 IF T=3
SET C=C+$PIECE($GET(^BGPHEDBB(X,N)),U,P)
+5 QUIT
End DoDot:1
+6 QUIT C
C(X,X2,X3) ;
+1 DO COMMA^%DTC
+2 QUIT X