BGP9DPE2 ; IHS/CMI/LAB - calc measures 29 Apr 2008 7:38 PM 14 Nov 2006 5:02 PM ;
;;9.0;IHS CLINICAL REPORTING;;JUL 1, 2009
;
5 ;EP
Q:'$D(^AUPNVPED("AC",DFN)) ;no education so don't bother
K BGPALLED S BGPVALUE=""
K BGPPROVS
S BGPFYCT=$O(^BGPCTRL("B",2009,0))
S Y="BGPALLED("
S X=DFN_"^ALL EDUC;DURING "_$$FMTE^XLFDT(BGPBDATE)_"-"_$$FMTE^XLFDT(BGPEDATE) S E=$$START1^APCLDF(X,Y)
I '$D(BGPALLED(1)) Q
S (X,D,G)=0,%="",T="" F S X=$O(BGPALLED(X)) Q:X'=+X D
.S Y=+$P(BGPALLED(X),U,4)
.S T=$P(^AUPNVPED(+$P(BGPALLED(X),U,4),0),U)
.Q:'T
.Q:'$D(^AUTTEDT(T,0))
.S T=$P(^AUTTEDT(T,0),U,2)
.I T="" Q
.Q:'$$EDUALLOW^BGP9DPE1(BGPFYCT,T)
.;Q:'$D(^BGPCTRL(BGPFYCT,62,"B",T)) ;not an official topic per Chris Lamer's spreadsheet
.Q:$P(^AUPNVPED(Y,0),U,5)="" ;SKIP IF NO PROVIDER DOCUMENTED
.S P=$P(^AUPNVPED(Y,0),U,5)
.S D=$P($G(^VA(200,P,"PS")),U,5)
.I 'D Q ;no discipline to tally
.S BGPT=$P($G(^DIC(7,D,9999999)),U,1)
.Q:BGPT="" ;not standard
.S BGPT1=$P(^DIC(7,D,0),U,1)
.D S(BGPRPT,BGPGBL,11,10,1) ;add to total # of topics
.I BGPTIME=1 D SET51
.I BGPTIME=2 D SET52
.I BGPTIME=3 D SET53
.;set PROVS For this patient
.S BGPPROVS(BGPT1)=$G(BGPPROVS(BGPT1))+1
Q:'$D(BGPPROVS)
S BGPVALUE=""
S X="" F S X=$O(BGPPROVS(X)) Q:X="" S BGPVALUE=BGPVALUE_$S(BGPVALUE]"":";",1:"")_X_"-"_BGPPROVS(X)
D SETLIST
Q
SET51 ;
I '$D(^BGPPEDCN(BGPRPT,15,0)) S ^BGPPEDCN(BGPRPT,15,0)="^90536.1215A^0^0"
S Z=$O(^BGPPEDCN(BGPRPT,15,"B",BGPT,0)) I Z D Q
.S $P(^BGPPEDCN(BGPRPT,15,Z,0),U,3)=$P(^BGPPEDCN(BGPRPT,15,Z,0),U,3)+1
S Z=$P(^BGPPEDCN(BGPRPT,15,0),U,3)+1,$P(^BGPPEDCN(BGPRPT,15,0),U,3)=Z,$P(^BGPPEDCN(BGPRPT,15,0),U,4)=Z
S ^BGPPEDCN(BGPRPT,15,Z,0)=BGPT_U_BGPT1_U_1
S ^BGPPEDCN(BGPRPT,15,"B",BGPT,Z)=""
Q
SET52 ;
I '$D(^BGPPEDPN(BGPRPT,15,0)) S ^BGPPEDPN(BGPRPT,15,0)="^90536.1315A^0^0"
S Z=$O(^BGPPEDPN(BGPRPT,15,"B",BGPT,0)) I Z D Q
.S $P(^BGPPEDPN(BGPRPT,15,Z,0),U,3)=$P(^BGPPEDPN(BGPRPT,15,Z,0),U,3)+1
S Z=$P(^BGPPEDPN(BGPRPT,15,0),U,3)+1,$P(^BGPPEDPN(BGPRPT,15,0),U,3)=Z,$P(^BGPPEDPN(BGPRPT,15,0),U,4)=Z
S ^BGPPEDPN(BGPRPT,15,Z,0)=BGPT_U_BGPT1_U_1
S ^BGPPEDPN(BGPRPT,15,"B",BGPT,Z)=""
Q
SET53 ;
I '$D(^BGPPEDBN(BGPRPT,15,0)) S ^BGPPEDBN(BGPRPT,15,0)="^90536.1515A^0^0"
S Z=$O(^BGPPEDBN(BGPRPT,15,"B",BGPT,0)) I Z D Q
.S $P(^BGPPEDBN(BGPRPT,15,Z,0),U,3)=$P(^BGPPEDBN(BGPRPT,15,Z,0),U,3)+1
S Z=$P(^BGPPEDBN(BGPRPT,15,0),U,3)+1,$P(^BGPPEDBN(BGPRPT,15,0),U,3)=Z,$P(^BGPPEDBN(BGPRPT,15,0),U,4)=Z
S ^BGPPEDBN(BGPRPT,15,Z,0)=BGPT_U_BGPT1_U_1
S ^BGPPEDBN(BGPRPT,15,"B",BGPT,Z)=""
Q
6 ;EP
Q:'$D(^AUPNVPED("AC",DFN)) ;no education so don't bother
K BGPALLED S BGPVALUE=""
K BGPPROVS
S BGPFYCT=$O(^BGPCTRL("B",2009,0))
S Y="BGPALLED("
S X=DFN_"^ALL EDUC;DURING "_$$FMTE^XLFDT(BGPBDATE)_"-"_$$FMTE^XLFDT(BGPEDATE) S E=$$START1^APCLDF(X,Y)
I '$D(BGPALLED(1)) Q
S (X,D,G)=0,%="",T="" F S X=$O(BGPALLED(X)) Q:X'=+X D
.S Y=+$P(BGPALLED(X),U,4)
.S T=$P(^AUPNVPED(+$P(BGPALLED(X),U,4),0),U)
.Q:'T
.Q:'$D(^AUTTEDT(T,0))
.S T=$P(^AUTTEDT(T,0),U,2)
.I T="" Q
.Q:'$$EDUALLOW^BGP9DPE1(BGPFYCT,T)
.;Q:'$D(^BGPCTRL(BGPFYCT,62,"B",T)) ;not an official topic per Chris Lamer's spreadsheet
.D S(BGPRPT,BGPGBL,11,12,1) ;add to total # of topics
.S BGPLEVEL=$P(^AUPNVPED(Y,0),U,6)
.I BGPLEVEL=1 D S(BGPRPT,BGPGBL,11,13,1)
.I BGPLEVEL=2 D S(BGPRPT,BGPGBL,11,14,1)
.I BGPLEVEL=3 D S(BGPRPT,BGPGBL,11,15,1)
.I BGPLEVEL=5 D S(BGPRPT,BGPGBL,11,16,1)
.I BGPLEVEL=4 D S(BGPRPT,BGPGBL,11,17,1)
.I BGPLEVEL="" D S(BGPRPT,BGPGBL,11,18,1)
.;set PROVS For this patient
.I BGPLEVEL="" S BGPLEVEL="BLANK"
.S BGPPROVS(BGPLEVEL)=$G(BGPPROVS(BGPLEVEL))+1
Q:'$D(BGPPROVS)
S BGPVALUE=""
S X="" F S X=$O(BGPPROVS(X)) Q:X="" S BGPVALUE=BGPVALUE_$S(BGPVALUE]"":";",1:"")_$S(X:$$EXTSET^XBFUNC(9000010.16,.06,X),1:"BLANK-NOT RECORDED")_"-"_BGPPROVS(X)
D SETLIST
Q
;
7 ;EP
Q:'$D(^AUPNVPED("AC",DFN)) ;no education so don't bother
K BGPALLED S BGPVALUE=""
K BGPPROVS
S BGPFYCT=$O(^BGPCTRL("B",2009,0))
S Y="BGPALLED("
S X=DFN_"^ALL EDUC;DURING "_$$FMTE^XLFDT(BGPBDATE)_"-"_$$FMTE^XLFDT(BGPEDATE) S E=$$START1^APCLDF(X,Y)
I '$D(BGPALLED(1)) Q
S (X,D,G)=0,%="",T="" F S X=$O(BGPALLED(X)) Q:X'=+X D
.S Y=+$P(BGPALLED(X),U,4)
.S T=$P(^AUPNVPED(+$P(BGPALLED(X),U,4),0),U)
.Q:'T
.Q:'$D(^AUTTEDT(T,0))
.S T=$P(^AUTTEDT(T,0),U,2)
.I T="" Q
.Q:'$$EDUALLOW^BGP9DPE1(BGPFYCT,T)
.S G=1
.S BGPLEVEL=$P(^AUPNVPED(Y,0),U,13)
.Q:BGPLEVEL=""
.S BGPPROVS(BGPLEVEL)=$G(BGPPROVS(BGPLEVEL))+1 ;count up
.;get provider
.S R="",R=$P(^AUPNVPED(Y,0),U,5) D
..Q:R]""
..S R=$P($G(^AUPNVPED(Y,12)),U,2)
..Q:R]""
..S R=$P($G(^AUPNVPED(Y,12)),U,4)
..Q:R]""
..S R=$$PRIMPROV^APCLV($P(^AUPNVPED(Y,0),U,3),"I")
.I R D
..S D=$$VALI^XBDIQ1(200,R,53.5)
..S D=$S(D:$$VAL^XBDIQ1(7,D,9999999.01),1:"")
..I D="" S D="??"
..S BGPPROVS(BGPLEVEL,"PROVS")=$G(BGPPROVS(BGPLEVEL,"PROVS"))_"; "_$$VAL^XBDIQ1(200,R,.01)_"-"_D
;
S BGPVALUE=""
I 'G Q ;no allowable topics
D S(BGPRPT,BGPGBL,11,19,1) ;add to total # of patients with a topic
Q:'$D(BGPPROVS)
I $G(BGPPROVS("GS")) D S(BGPRPT,BGPGBL,11,20,1) S BGPVALUE="GS"_$G(BGPPROVS("GS","PROVS"))
I $G(BGPPROVS("GNS")),'$G(BGPPROVS("GS")) D S(BGPRPT,BGPGBL,11,21,1) S BGPVALUE=BGPVALUE_$S(BGPVALUE]"":", ",1:"")_"GNS"_$G(BGPPROVS("GNS","PROVS"))
I $G(BGPPROVS("GM")) D S(BGPRPT,BGPGBL,11,22,1) S BGPVALUE=BGPVALUE_$S(BGPVALUE]"":", ",1:"")_"GM"_$G(BGPPROVS("GM","PROVS"))
I $G(BGPPROVS("GNM")),'$G(BGPPROVS("GM")) D S(BGPRPT,BGPGBL,11,23,1) S BGPVALUE=BGPVALUE_$S(BGPVALUE]"":", ",1:"")_"GNM"_$G(BGPPROVS("GNM","PROVS"))
D SETLIST
Q
S(R,G,N,P,V,J) ;
I 'V Q ;no value to add
I $G(J) S $P(@(G_R_","_N_")"),U,P)=$P($G(@(G_R_","_N_")")),U,P)=V Q
S $P(@(G_R_","_N_")"),U,P)=$P($G(@(G_R_","_N_")")),U,P)+V
Q
;
SETLIST ;
Q:'$D(BGPLIST(BGPIC))
Q:BGPTIME'=1
I BGPLIST="P",$P(^AUPNPAT(DFN,0),U,14)'=BGPLPRV Q
S BGPLIST(BGPIC)=$G(BGPLIST(BGPIC))+1
S ^XTMP("BGP9PE",BGPJ,BGPH,"LIST",BGPIC,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEB,DFN)=$G(BGPVALUE)
Q
BGP9DPE2 ; IHS/CMI/LAB - calc measures 29 Apr 2008 7:38 PM 14 Nov 2006 5:02 PM ;
+1 ;;9.0;IHS CLINICAL REPORTING;;JUL 1, 2009
+2 ;
5 ;EP
+1 ;no education so don't bother
IF '$DATA(^AUPNVPED("AC",DFN))
QUIT
+2 KILL BGPALLED
SET BGPVALUE=""
+3 KILL BGPPROVS
+4 SET BGPFYCT=$ORDER(^BGPCTRL("B",2009,0))
+5 SET Y="BGPALLED("
+6 SET X=DFN_"^ALL EDUC;DURING "_$$FMTE^XLFDT(BGPBDATE)_"-"_$$FMTE^XLFDT(BGPEDATE)
SET E=$$START1^APCLDF(X,Y)
+7 IF '$DATA(BGPALLED(1))
QUIT
+8 SET (X,D,G)=0
SET %=""
SET T=""
FOR
SET X=$ORDER(BGPALLED(X))
IF X'=+X
QUIT
Begin DoDot:1
+9 SET Y=+$PIECE(BGPALLED(X),U,4)
+10 SET T=$PIECE(^AUPNVPED(+$PIECE(BGPALLED(X),U,4),0),U)
+11 IF 'T
QUIT
+12 IF '$DATA(^AUTTEDT(T,0))
QUIT
+13 SET T=$PIECE(^AUTTEDT(T,0),U,2)
+14 IF T=""
QUIT
+15 IF '$$EDUALLOW^BGP9DPE1(BGPFYCT,T)
QUIT
+16 ;Q:'$D(^BGPCTRL(BGPFYCT,62,"B",T)) ;not an official topic per Chris Lamer's spreadsheet
+17 ;SKIP IF NO PROVIDER DOCUMENTED
IF $PIECE(^AUPNVPED(Y,0),U,5)=""
QUIT
+18 SET P=$PIECE(^AUPNVPED(Y,0),U,5)
+19 SET D=$PIECE($GET(^VA(200,P,"PS")),U,5)
+20 ;no discipline to tally
IF 'D
QUIT
+21 SET BGPT=$PIECE($GET(^DIC(7,D,9999999)),U,1)
+22 ;not standard
IF BGPT=""
QUIT
+23 SET BGPT1=$PIECE(^DIC(7,D,0),U,1)
+24 ;add to total # of topics
DO S(BGPRPT,BGPGBL,11,10,1)
+25 IF BGPTIME=1
DO SET51
+26 IF BGPTIME=2
DO SET52
+27 IF BGPTIME=3
DO SET53
+28 ;set PROVS For this patient
+29 SET BGPPROVS(BGPT1)=$GET(BGPPROVS(BGPT1))+1
End DoDot:1
+30 IF '$DATA(BGPPROVS)
QUIT
+31 SET BGPVALUE=""
+32 SET X=""
FOR
SET X=$ORDER(BGPPROVS(X))
IF X=""
QUIT
SET BGPVALUE=BGPVALUE_$SELECT(BGPVALUE]"":";",1:"")_X_"-"_BGPPROVS(X)
+33 DO SETLIST
+34 QUIT
SET51 ;
+1 IF '$DATA(^BGPPEDCN(BGPRPT,15,0))
SET ^BGPPEDCN(BGPRPT,15,0)="^90536.1215A^0^0"
+2 SET Z=$ORDER(^BGPPEDCN(BGPRPT,15,"B",BGPT,0))
IF Z
Begin DoDot:1
+3 SET $PIECE(^BGPPEDCN(BGPRPT,15,Z,0),U,3)=$PIECE(^BGPPEDCN(BGPRPT,15,Z,0),U,3)+1
End DoDot:1
QUIT
+4 SET Z=$PIECE(^BGPPEDCN(BGPRPT,15,0),U,3)+1
SET $PIECE(^BGPPEDCN(BGPRPT,15,0),U,3)=Z
SET $PIECE(^BGPPEDCN(BGPRPT,15,0),U,4)=Z
+5 SET ^BGPPEDCN(BGPRPT,15,Z,0)=BGPT_U_BGPT1_U_1
+6 SET ^BGPPEDCN(BGPRPT,15,"B",BGPT,Z)=""
+7 QUIT
SET52 ;
+1 IF '$DATA(^BGPPEDPN(BGPRPT,15,0))
SET ^BGPPEDPN(BGPRPT,15,0)="^90536.1315A^0^0"
+2 SET Z=$ORDER(^BGPPEDPN(BGPRPT,15,"B",BGPT,0))
IF Z
Begin DoDot:1
+3 SET $PIECE(^BGPPEDPN(BGPRPT,15,Z,0),U,3)=$PIECE(^BGPPEDPN(BGPRPT,15,Z,0),U,3)+1
End DoDot:1
QUIT
+4 SET Z=$PIECE(^BGPPEDPN(BGPRPT,15,0),U,3)+1
SET $PIECE(^BGPPEDPN(BGPRPT,15,0),U,3)=Z
SET $PIECE(^BGPPEDPN(BGPRPT,15,0),U,4)=Z
+5 SET ^BGPPEDPN(BGPRPT,15,Z,0)=BGPT_U_BGPT1_U_1
+6 SET ^BGPPEDPN(BGPRPT,15,"B",BGPT,Z)=""
+7 QUIT
SET53 ;
+1 IF '$DATA(^BGPPEDBN(BGPRPT,15,0))
SET ^BGPPEDBN(BGPRPT,15,0)="^90536.1515A^0^0"
+2 SET Z=$ORDER(^BGPPEDBN(BGPRPT,15,"B",BGPT,0))
IF Z
Begin DoDot:1
+3 SET $PIECE(^BGPPEDBN(BGPRPT,15,Z,0),U,3)=$PIECE(^BGPPEDBN(BGPRPT,15,Z,0),U,3)+1
End DoDot:1
QUIT
+4 SET Z=$PIECE(^BGPPEDBN(BGPRPT,15,0),U,3)+1
SET $PIECE(^BGPPEDBN(BGPRPT,15,0),U,3)=Z
SET $PIECE(^BGPPEDBN(BGPRPT,15,0),U,4)=Z
+5 SET ^BGPPEDBN(BGPRPT,15,Z,0)=BGPT_U_BGPT1_U_1
+6 SET ^BGPPEDBN(BGPRPT,15,"B",BGPT,Z)=""
+7 QUIT
6 ;EP
+1 ;no education so don't bother
IF '$DATA(^AUPNVPED("AC",DFN))
QUIT
+2 KILL BGPALLED
SET BGPVALUE=""
+3 KILL BGPPROVS
+4 SET BGPFYCT=$ORDER(^BGPCTRL("B",2009,0))
+5 SET Y="BGPALLED("
+6 SET X=DFN_"^ALL EDUC;DURING "_$$FMTE^XLFDT(BGPBDATE)_"-"_$$FMTE^XLFDT(BGPEDATE)
SET E=$$START1^APCLDF(X,Y)
+7 IF '$DATA(BGPALLED(1))
QUIT
+8 SET (X,D,G)=0
SET %=""
SET T=""
FOR
SET X=$ORDER(BGPALLED(X))
IF X'=+X
QUIT
Begin DoDot:1
+9 SET Y=+$PIECE(BGPALLED(X),U,4)
+10 SET T=$PIECE(^AUPNVPED(+$PIECE(BGPALLED(X),U,4),0),U)
+11 IF 'T
QUIT
+12 IF '$DATA(^AUTTEDT(T,0))
QUIT
+13 SET T=$PIECE(^AUTTEDT(T,0),U,2)
+14 IF T=""
QUIT
+15 IF '$$EDUALLOW^BGP9DPE1(BGPFYCT,T)
QUIT
+16 ;Q:'$D(^BGPCTRL(BGPFYCT,62,"B",T)) ;not an official topic per Chris Lamer's spreadsheet
+17 ;add to total # of topics
DO S(BGPRPT,BGPGBL,11,12,1)
+18 SET BGPLEVEL=$PIECE(^AUPNVPED(Y,0),U,6)
+19 IF BGPLEVEL=1
DO S(BGPRPT,BGPGBL,11,13,1)
+20 IF BGPLEVEL=2
DO S(BGPRPT,BGPGBL,11,14,1)
+21 IF BGPLEVEL=3
DO S(BGPRPT,BGPGBL,11,15,1)
+22 IF BGPLEVEL=5
DO S(BGPRPT,BGPGBL,11,16,1)
+23 IF BGPLEVEL=4
DO S(BGPRPT,BGPGBL,11,17,1)
+24 IF BGPLEVEL=""
DO S(BGPRPT,BGPGBL,11,18,1)
+25 ;set PROVS For this patient
+26 IF BGPLEVEL=""
SET BGPLEVEL="BLANK"
+27 SET BGPPROVS(BGPLEVEL)=$GET(BGPPROVS(BGPLEVEL))+1
End DoDot:1
+28 IF '$DATA(BGPPROVS)
QUIT
+29 SET BGPVALUE=""
+30 SET X=""
FOR
SET X=$ORDER(BGPPROVS(X))
IF X=""
QUIT
SET BGPVALUE=BGPVALUE_$SELECT(BGPVALUE]"":";",1:"")_$SELECT(X:$$EXTSET^XBFUNC(9000010.16,.06,X),1:"BLANK-NOT RECORDED")_"-"_BGPPROVS(X)
+31 DO SETLIST
+32 QUIT
+33 ;
7 ;EP
+1 ;no education so don't bother
IF '$DATA(^AUPNVPED("AC",DFN))
QUIT
+2 KILL BGPALLED
SET BGPVALUE=""
+3 KILL BGPPROVS
+4 SET BGPFYCT=$ORDER(^BGPCTRL("B",2009,0))
+5 SET Y="BGPALLED("
+6 SET X=DFN_"^ALL EDUC;DURING "_$$FMTE^XLFDT(BGPBDATE)_"-"_$$FMTE^XLFDT(BGPEDATE)
SET E=$$START1^APCLDF(X,Y)
+7 IF '$DATA(BGPALLED(1))
QUIT
+8 SET (X,D,G)=0
SET %=""
SET T=""
FOR
SET X=$ORDER(BGPALLED(X))
IF X'=+X
QUIT
Begin DoDot:1
+9 SET Y=+$PIECE(BGPALLED(X),U,4)
+10 SET T=$PIECE(^AUPNVPED(+$PIECE(BGPALLED(X),U,4),0),U)
+11 IF 'T
QUIT
+12 IF '$DATA(^AUTTEDT(T,0))
QUIT
+13 SET T=$PIECE(^AUTTEDT(T,0),U,2)
+14 IF T=""
QUIT
+15 IF '$$EDUALLOW^BGP9DPE1(BGPFYCT,T)
QUIT
+16 SET G=1
+17 SET BGPLEVEL=$PIECE(^AUPNVPED(Y,0),U,13)
+18 IF BGPLEVEL=""
QUIT
+19 ;count up
SET BGPPROVS(BGPLEVEL)=$GET(BGPPROVS(BGPLEVEL))+1
+20 ;get provider
+21 SET R=""
SET R=$PIECE(^AUPNVPED(Y,0),U,5)
Begin DoDot:2
+22 IF R]""
QUIT
+23 SET R=$PIECE($GET(^AUPNVPED(Y,12)),U,2)
+24 IF R]""
QUIT
+25 SET R=$PIECE($GET(^AUPNVPED(Y,12)),U,4)
+26 IF R]""
QUIT
+27 SET R=$$PRIMPROV^APCLV($PIECE(^AUPNVPED(Y,0),U,3),"I")
End DoDot:2
+28 IF R
Begin DoDot:2
+29 SET D=$$VALI^XBDIQ1(200,R,53.5)
+30 SET D=$SELECT(D:$$VAL^XBDIQ1(7,D,9999999.01),1:"")
+31 IF D=""
SET D="??"
+32 SET BGPPROVS(BGPLEVEL,"PROVS")=$GET(BGPPROVS(BGPLEVEL,"PROVS"))_"; "_$$VAL^XBDIQ1(200,R,.01)_"-"_D
End DoDot:2
End DoDot:1
+33 ;
+34 SET BGPVALUE=""
+35 ;no allowable topics
IF 'G
QUIT
+36 ;add to total # of patients with a topic
DO S(BGPRPT,BGPGBL,11,19,1)
+37 IF '$DATA(BGPPROVS)
QUIT
+38 IF $GET(BGPPROVS("GS"))
DO S(BGPRPT,BGPGBL,11,20,1)
SET BGPVALUE="GS"_$GET(BGPPROVS("GS","PROVS"))
+39 IF $GET(BGPPROVS("GNS"))
IF '$GET(BGPPROVS("GS"))
DO S(BGPRPT,BGPGBL,11,21,1)
SET BGPVALUE=BGPVALUE_$SELECT(BGPVALUE]"":", ",1:"")_"GNS"_$GET(BGPPROVS("GNS","PROVS"))
+40 IF $GET(BGPPROVS("GM"))
DO S(BGPRPT,BGPGBL,11,22,1)
SET BGPVALUE=BGPVALUE_$SELECT(BGPVALUE]"":", ",1:"")_"GM"_$GET(BGPPROVS("GM","PROVS"))
+41 IF $GET(BGPPROVS("GNM"))
IF '$GET(BGPPROVS("GM"))
DO S(BGPRPT,BGPGBL,11,23,1)
SET BGPVALUE=BGPVALUE_$SELECT(BGPVALUE]"":", ",1:"")_"GNM"_$GET(BGPPROVS("GNM","PROVS"))
+42 DO SETLIST
+43 QUIT
S(R,G,N,P,V,J) ;
+1 ;no value to add
IF 'V
QUIT
+2 IF $GET(J)
SET $PIECE(@(G_R_","_N_")"),U,P)=$PIECE($GET(@(G_R_","_N_")")),U,P)=V
QUIT
+3 SET $PIECE(@(G_R_","_N_")"),U,P)=$PIECE($GET(@(G_R_","_N_")")),U,P)+V
+4 QUIT
+5 ;
SETLIST ;
+1 IF '$DATA(BGPLIST(BGPIC))
QUIT
+2 IF BGPTIME'=1
QUIT
+3 IF BGPLIST="P"
IF $PIECE(^AUPNPAT(DFN,0),U,14)'=BGPLPRV
QUIT
+4 SET BGPLIST(BGPIC)=$GET(BGPLIST(BGPIC))+1
+5 SET ^XTMP("BGP9PE",BGPJ,BGPH,"LIST",BGPIC,$SELECT($PIECE($GET(^AUPNPAT(DFN,11)),U,18)]"":$PIECE(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$PIECE(^DPT(DFN,0),U,2),BGPAGEB,DFN)=$GET(BGPVALUE)
+6 QUIT