Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BGP5D1

BGP5D1.m

Go to the documentation of this file.
BGP5D1 ; IHS/CMI/LAB - calc measures  ; 06 Apr 2015  2:35 PM
 ;;15.1;IHS CLINICAL REPORTING;;MAY 06, 2015;Build 143
 ;
PROC ;EP
 S BGPBT=$H
 D JRNL^BGP5UTL
 S BGPJ=$J,BGPH=$H
 K ^XTMP("BGP28CPL",BGPJ,BGPH)
 K ^XTMP("BGP15TAX",$J)
 D UNFOLDTX^BGP5UTL2
 D XTMP^BGP5UTL("BGP28CPL","National GPRA Comp List")
 D XTMP^BGP5UTL("BGP5DNP","National GPRA Patient List")
 D XTMP^BGP5UTL("BGP5D","CRS Local Patient List")
 ;S BGPICDTN=$S($T(ICDDX^ICDEX)]"":1,1:0)
 ;calculate 3 years before end of each time frame
 S BGP3YE=$$FMADD^XLFDT(BGPED,-1096)
 S BGPP3YE=$$FMADD^XLFDT(BGPPED,-1096)
 S BGPB3YE=$$FMADD^XLFDT(BGPBED,-1096)
 ;process each patient
 S DFN=0 F  S DFN=$O(^AUPNPAT(DFN)) Q:DFN'=+DFN  D
 .;I DUZ=2881,'$D(^DIBT(14173,1,DFN)) Q
 .;I DUZ=2881,DFN'=26214 Q  ;599
 .;I DUZ=2881 Q:DFN'=116831
 .;I DUZ=2881 Q:$$HRN^AUPNPAT(DFN,DUZ(2))'=145905
 .Q:'$D(^AUPNPAT(DFN,0))
 .;I $G(BGPDESGP) S P=$$DP(DFN) I P'=BGPDESGP Q
 .Q:'$D(^DPT(DFN,0))
 .Q:$P($G(^DPT(DFN,0)),U)["DEMO,PATIENT"
 .S X=$O(^DIBT("B","RPMS DEMO PATIENT NAMES",0)) I X Q:$D(^DIBT(X,1,DFN))
 .I $O(BGPDESGP(0)) S P=$$DP(DFN) Q:'P  Q:'$D(BGPDESGP(P))  S BGPRPT=$P(BGPDESGP(P),U,1)
 .D PROCCY,PROCPY,PROCBY
N ;
 S BGPET=$H
 K ^XTMP("BGP15TAX",$J)
 Q
 ;
PROCCY ;EP - current time period
 K ^TMP($J)
 S (BGPACTUP,BGPACTCL,BGPDM1,BGPDM2,BGPDMD1,BGPDMD2,BGPDMD3,BGPDMD4,BGPDMD5,BGPIHD,BGPHTN)=""
 K BGPG
 Q:'$D(^DPT(DFN,0))
 Q:$P(^DPT(DFN,0),U,2)=""
 Q:"FM"'[$P(^DPT(DFN,0),U,2)
 S BGPEDATE=BGPED,BGPTIME=1,BGPBDATE=BGPBD,BGPGBL=$S(BGPRTYPE=3:"^BGPHEDCB(",BGPRTYPE=5:"^BGPELDCK(",BGPRTYPE=8:"^BGPEOCB(",1:"^BGPGPDCK(")
 S BGP365=BGPBDATE
 I '$G(BGPALLPT) S BGPACTUP=$$ACTUP(DFN,BGP3YE,BGPEDATE,BGPTAXI,BGPBEN) ;user pop
 I $G(BGPALLPT) S BGPACTUP=$$ACTUPAP(DFN,BGP3YE,BGPEDATE,BGPBEN)
 I 'BGPACTUP,'$G(BGPXPXPX),'$G(BGPIISO) Q
 S BGPACTCL=$$ACTCL(DFN,BGP3YE,BGPEDATE) ;active clinical
 S BGPACTCB=$$ACTCLBH(DFN,BGP3YE,BGPEDATE)  ;active clinical + BH
 S BGPAGEB=$$AGE^AUPNPAT(DFN,BGPBDATE)
 S BGPAGEE=$$AGE^AUPNPAT(DFN,BGPEDATE)
 S BGPSEX=$P(^DPT(DFN,0),U,2)
 I $G(BGPIISO)=1 S BGPACTUP=1,BGPACTCL=1  ;if in scheduling option, everyone is user pop/active clinical
 S BGPDM1=$$DM(DFN,,BGPEDATE) ;dm diagnosis ever?
 S BGPDM2=$$DM(DFN,BGP365,BGPEDATE) ;dm diagnosis in past year
 I BGPDM1 D  ;set up 4 dm demoninators
 .S BGPFDMD=$$FIRSTDM(DFN,BGPEDATE) ;1 OR 0 FIRST DX BEFORE BEG
 .S BGP2V=$$V2(DFN,BGP365,BGPEDATE)
 .S BGP2DMV=$$V2DM(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 .S BGPYDMV=$$V1DM(DFN,BGP365,BGPEDATE)
 .S BGPDMD1=0 I BGPFDMD S BGPDMD1=1
 .S BGPDMD2=0 I BGPFDMD,BGP2V,BGP2DMV,BGPACTCL S BGPDMD2=1
 .S BGPDMD3=0 I BGPFDMD,BGPAGEB>19,BGP2DMV,BGPYDMV,$$CREAT(DFN,BGPEDATE) S BGPDMD3=1
 .S BGPDMD5=0 I BGPFDMD,BGP2DMV,BGPYDMV,$$CREAT(DFN,BGPEDATE) S BGPDMD5=1
 I $G(BGPXPRP) Q  ;stop if in national gpra export
 I $G(BGPIISO) D ISS^BGP5DPA1 K ^TMP($J,"A") Q  ;SCHEDULING OPTION
 D CALCIND
 K ^TMP($J,"A")
 Q
PROCPY ;
 K ^TMP($J),BGPG
 S (BGPACTUP,BGPACTCL,BGPDM1,BGPDM2,BGPDMD1,BGPDMD2,BGPDMD3,BGPDMD4,BGPDMD5,BGPIHD)=""
 Q:'$D(^DPT(DFN,0))
 Q:$P(^DPT(DFN,0),U,2)=""
 Q:"FM"'[$P(^DPT(DFN,0),U,2)
 S BGPEDATE=BGPPED,BGPTIME=2,BGPBDATE=BGPPBD,BGPGBL=$S(BGPRTYPE=3:"^BGPHEDPB(",BGPRTYPE=5:"^BGPELDPK(",BGPRTYPE=8:"^BGPEOPB(",1:"^BGPGPDPK(")
 S BGP365=BGPBDATE
 I '$G(BGPALLPT) S BGPACTUP=$$ACTUP(DFN,BGPP3YE,BGPEDATE,BGPTAXI,BGPBEN) ;user pop
 I $G(BGPALLPT) S BGPACTUP=$$ACTUPAP(DFN,BGPP3YE,BGPEDATE,BGPBEN)
 I 'BGPACTUP Q  ;if not in user pop, don't use patient
 S BGPACTCL=$$ACTCL(DFN,BGPP3YE,BGPEDATE) ;active clinical
 S BGPACTCB=$$ACTCLBH(DFN,BGP3YE,BGPEDATE)  ;active clinical + BH
 S BGPAGEB=$$AGE^AUPNPAT(DFN,BGPBDATE)
 S BGPAGEE=$$AGE^AUPNPAT(DFN,BGPEDATE)
 S BGPSEX=$P(^DPT(DFN,0),U,2)
 ;I $$V2IHD^BGP5D9(DFN,BGP365,BGPEDATE),$$FIRSTIHD^BGP5D9(DFN,BGPEDATE) S BGPIHD=1
 S BGPDM1=$$DM(DFN,,BGPEDATE) ;dm diagnosis ever?
 S BGPDM2=$$DM(DFN,BGP365,BGPEDATE) ;dm diagnosis in past year
 I BGPDM1 D  ;set up 4 dm demoninators
 .S BGPFDMD=$$FIRSTDM(DFN,BGPEDATE) ;1 OR 0 FIRST DX BEFORE BEG
 .S BGP2V=$$V2(DFN,BGP365,BGPEDATE)
 .S BGP2DMV=$$V2DM(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 .S BGPYDMV=$$V1DM(DFN,BGP365,BGPEDATE)
 .S BGPDMD1=0 I BGPFDMD S BGPDMD1=1
 .S BGPDMD2=0 I BGPFDMD,BGP2V,BGP2DMV,BGPACTCL S BGPDMD2=1
 .S BGPDMD3=0 I BGPFDMD,BGPAGEB>19,BGP2DMV,BGPYDMV,$$CREAT(DFN,BGPEDATE) S BGPDMD3=1
 .S BGPDMD5=0 I BGPFDMD,BGP2DMV,BGPYDMV,$$CREAT(DFN,BGPEDATE) S BGPDMD5=1
 D CALCIND
 K ^TMP($J)
 Q
PROCBY ;
 K ^TMP($J),BGPG
 S (BGPACTUP,BGPACTCL,BGPDM1,BGPDM2,BGPDMD1,BGPDMD2,BGPDMD3,BGPDMD4,BGPDMD5,BGPIHD)=""
 Q:'$D(^DPT(DFN,0))
 Q:$P(^DPT(DFN,0),U,2)=""
 Q:"FM"'[$P(^DPT(DFN,0),U,2)
 S BGPEDATE=BGPBED,BGPTIME=3,BGPBDATE=BGPBBD,BGPGBL=$S(BGPRTYPE=3:"^BGPHEDBB(",BGPRTYPE=5:"^BGPELDBK(",BGPRTYPE=8:"^BGPEOBB(",1:"^BGPGPDBK(")
 S BGP365=BGPBDATE
 I '$G(BGPALLPT) S BGPACTUP=$$ACTUP(DFN,BGPB3YE,BGPEDATE,BGPTAXI,BGPBEN) ;user pop
 I $G(BGPALLPT) S BGPACTUP=$$ACTUPAP(DFN,BGPB3YE,BGPEDATE,BGPBEN)
 I 'BGPACTUP Q  ;if not in user pop, don't use patient
 S BGPACTCL=$$ACTCL(DFN,BGPB3YE,BGPEDATE) ;active clinical
 S BGPACTCB=$$ACTCLBH(DFN,BGP3YE,BGPEDATE)  ;active clinical + BH
 S BGPAGEB=$$AGE^AUPNPAT(DFN,BGPBDATE)
 S BGPAGEE=$$AGE^AUPNPAT(DFN,BGPEDATE)
 S BGPSEX=$P(^DPT(DFN,0),U,2)
 S BGPDM1=$$DM(DFN,,BGPEDATE) ;dm diagnosis ever?
 S BGPDM2=$$DM(DFN,BGP365,BGPEDATE) ;dm diagnosis in past year
 I BGPDM1 D  ;set up 4 dm demoninators
 .S BGPFDMD=$$FIRSTDM(DFN,BGPEDATE) ;1 OR 0 FIRST DX BEFORE BEG
 .S BGP2V=$$V2(DFN,BGP365,BGPEDATE)
 .S BGP2DMV=$$V2DM(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 .S BGPYDMV=$$V1DM(DFN,BGP365,BGPEDATE)
 .S BGPDMD1=0 I BGPFDMD S BGPDMD1=1
 .S BGPDMD2=0 I BGPFDMD,BGP2V,BGP2DMV,BGPACTCL S BGPDMD2=1
 .S BGPDMD3=0 I BGPFDMD,BGPAGEB>19,BGP2DMV,BGPYDMV,$$CREAT(DFN,BGPEDATE) S BGPDMD3=1
 .S BGPDMD5=0 I BGPFDMD,BGP2DMV,BGPYDMV,$$CREAT(DFN,BGPEDATE) S BGPDMD5=1
 D CALCIND
 K ^TMP($J)
 Q
CALCIND ;
 I BGPRTYPE=5 D CALCIND^BGP5DCEI Q
 D CALCIND^BGP5DCI
 Q
CREAT(P,EDATE) ;get all creatines all must be <5
 NEW BGPG,%,X,E,R,T,V,J
 S %=P_"^ALL LAB [DM AUDIT CREATININE TAX;DURING "_$$FMTE^XLFDT($$DOB^AUPNPAT(P))_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
 S X=0,E=1 F  S X=$O(BGPG(X)) Q:X'=+X  S R=$P(BGPG(X),U,2) I +R>5,+R<15 S E=""
 I E="" Q E
 S T=$O(^ATXAX("B","BGP CREATININE LOINC CODES",0))
 I 'T Q E
 S X=0 F  S X=$O(^AUPNVLAB("AC",P,X)) Q:X'=+X!(E="")  I $P($G(^AUPNVLAB(X,11)),U,13)]"" D
 .Q:'$D(^AUPNVLAB(X,0))
 .S V=$P(^AUPNVLAB(X,0),U,3),V=$P($G(^AUPNVSIT(V,0)),U,1),V=$P(V,".")
 .Q:V>EDATE
 .S J=$P(^AUPNVLAB(X,11),U,13)
 .Q:'$$LOINC(J,T)
 .Q:$P(^AUPNVLAB(X,0),U,4)=""
 .S R=$P(^AUPNVLAB(X,0),U,4)
 .I +R>5,+R<15 S E=""
 Q E
V1DM(P,D,EDATE) ;
 I '$G(P) Q ""
 I '$D(^AUPNVSIT("AC",P)) Q ""
 S PC=$O(^ATXAX("B","BGP PRIMARY CARE CLINICS",0))
 I 'PC Q ""
 ;I 'PP Q ""
 K ^TMP($J,"A")
 NEW A,B,T,X,G,V,Y
 S A="^TMP($J,""A"",",B=P_"^ALL VISITS;DURING "_$$FMTE^XLFDT(D)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(B,A)
 I '$D(^TMP($J,"A",1)) Q ""
 S T=$O(^ATXAX("B","SURVEILLANCE DIABETES",0))
 I 'T Q ""
 S (X,G)=0 F  S X=$O(^TMP($J,"A",X)) Q:X'=+X!(G>2)  S V=$P(^TMP($J,"A",X),U,5) D
 .Q:'$D(^AUPNVSIT(V,0))
 .Q:'$P(^AUPNVSIT(V,0),U,9)
 .Q:$P(^AUPNVSIT(V,0),U,11)
 .Q:"SAHO"'[$P(^AUPNVSIT(V,0),U,7)
 .Q:$P(^AUPNVSIT(V,0),U,6)=""
 .Q:'$D(^AUPNVPRV("AD",V))
 .;Q:$P(^AUPNVSIT(V,0),U,6)'=DUZ(2) ;PER TERRY
 .Q:'$D(^AUPNVPOV("AD",V))
 .S (D,Y)=0 F  S Y=$O(^AUPNVPOV("AD",V,Y)) Q:Y'=+Y!(D)  I $D(^AUPNVPOV(Y,0)) S %=$P(^AUPNVPOV(Y,0),U) I $$ICD^BGP5UTL2(%,T,9) S D=1
 .Q:'D
 .Q:"V"[$P(^AUPNVSIT(V,0),U,3)
 .S Y=$$PRIMPROV^APCLV(V,"F")
 .Q:'Y
 .;Q:'$D(^ATXAX(PP,21,"B",Y))
 .Q:$P($G(^DIC(7,Y,9999999)),U,3)'="Y"
 .S Y=$$CLINIC^APCLV(V,"I")
 .Q:'Y
 .Q:'$D(^ATXAX(PC,21,"B",Y))
 .S G=G+1
 .Q
 Q $S(G<1:"",1:1)
 ;
V2(P,BDATE,EDATE) ;EP
 I '$D(^AUPNVSIT("AC",P)) Q ""
 K ^TMP($J,"A")
 NEW A,B,X,G,V
 S A="^TMP($J,""A"",",B=P_"^ALL VISITS;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(B,A)
 I '$D(^TMP($J,"A",1)) Q ""
 S (X,G)=0 F  S X=$O(^TMP($J,"A",X)) Q:X'=+X!(G>2)  S V=$P(^TMP($J,"A",X),U,5) D
 .Q:'$D(^AUPNVSIT(V,0))
 .Q:'$P(^AUPNVSIT(V,0),U,9)
 .Q:$P(^AUPNVSIT(V,0),U,11)
 .Q:"SAHO"'[$P(^AUPNVSIT(V,0),U,7)
 .Q:"V"[$P(^AUPNVSIT(V,0),U,3)
 .Q:$P(^AUPNVSIT(V,0),U,6)=""
 .S G=G+1
 .Q
 Q $S(G<2:"",1:1)
 ;
V2DM(P,BDATE,EDATE) ;
 I '$G(P) Q ""
 I '$D(^AUPNVSIT("AC",P)) Q ""
 K ^TMP($J,"A")
 NEW A,B,E,T,G,V,Y
 S A="^TMP($J,""A"",",B=P_"^ALL VISITS;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(B,A)
 I '$D(^TMP($J,"A",1)) Q ""
 S T=$O(^ATXAX("B","SURVEILLANCE DIABETES",0))
 I 'T Q ""
 S (X,G)=0 F  S X=$O(^TMP($J,"A",X)) Q:X'=+X!(G>2)  S V=$P(^TMP($J,"A",X),U,5) D
 .Q:'$D(^AUPNVSIT(V,0))
 .Q:'$P(^AUPNVSIT(V,0),U,9)
 .Q:$P(^AUPNVSIT(V,0),U,11)
 .Q:"SAHO"'[$P(^AUPNVSIT(V,0),U,7)
 .Q:"V"[$P(^AUPNVSIT(V,0),U,3)
 .Q:$P(^AUPNVSIT(V,0),U,6)=""
 .S (D,Y)=0 F  S Y=$O(^AUPNVPOV("AD",V,Y)) Q:Y'=+Y!(D)  I $D(^AUPNVPOV(Y,0)) S %=$P(^AUPNVPOV(Y,0),U) I $$ICD^BGP5UTL2(%,T,9) S D=1
 .Q:'D
 .S G=G+1
 .Q
 Q $S(G<2:"",1:1)
 ;
DM(P,BDATE,EDATE) ;EP is patient diabetic 1 or 0
 I $G(BDATE)="" S BDATE=$$DOB^AUPNPAT(P)
 NEW BGPG
 S Y="BGPG("
 S X=P_"^LAST DX [SURVEILLANCE DIABETES;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE) S E=$$START1^APCLDF(X,Y)
 I $D(BGPG(1)) Q 1  ;has a dx
 Q 0
 ;
ACTUPAP(P,BDATE,EDATE,B) ;EP - is this patient in user pop?
 NEW X
 I B=1,$$BEN^AUPNPAT(P,"C")'="01" Q 0  ;must be Indian/Alaskan Native
 I B=2,$$BEN^AUPNPAT(P,"C")="01" Q 0  ;must not be I/A
 S DOD=$$DOD^AUPNPAT(P) I DOD]"",DOD<EDATE Q 0
 S X=$$LASTVD(P,BDATE,EDATE)
 Q $S(X:1,1:0)
 ;
ACTUP(P,BDATE,EDATE,T,B) ;EP - is this patient in user pop?
 NEW X,DOD
 I B=1,$$BEN^AUPNPAT(P,"C")'="01" Q 0  ;must be Indian/Alaskan Native
 I B=2,$$BEN^AUPNPAT(P,"C")="01" Q 0  ;must not be I/A
 S DOD=$$DOD^AUPNPAT(P) I DOD]"",DOD<EDATE Q 0
 S X=$P($G(^AUPNPAT(P,11)),U,18) I X="" Q 0
 I '$D(^ATXAX(T,21,"B",($P(^AUPNPAT(P,11),U,18)))),'$D(^ATXAX(T,21,"AA",$P(^AUPNPAT(P,11),U,18),$P(^AUPNPAT(P,11),U,18))) Q 0
 S X=$$LASTVD(P,BDATE,EDATE)
 Q $S(X:1,1:0)
 ;
ACTCL(P,BDATE,EDATE) ;EP - clinical user
 S (X,G,F,S)=0 F  S X=$O(^TMP($J,"A",X)) Q:X'=+X!(F)  S V=$P(^TMP($J,"A",X),U,5) D
 .Q:'$D(^AUPNVSIT(V,0))
 .Q:'$P(^AUPNVSIT(V,0),U,9)
 .Q:$P(^AUPNVSIT(V,0),U,11)
 .Q:'$D(^AUPNVPRV("AD",V))
 .Q:"SAHO"'[$P(^AUPNVSIT(V,0),U,7)
 .Q:"V"[$P(^AUPNVSIT(V,0),U,3)
 .Q:$P(^AUPNVSIT(V,0),U,6)=""
 .S B=$$CLINIC^APCLV(V,"C")
 .Q:B=""
 .I 'G,$D(^BGPCTRL($O(^BGPCTRL("B",2015,0)),11,"B",B)) S G=V  ;must be a primary clinic S G=V
 .I V'=G,$D(^BGPCTRL($O(^BGPCTRL("B",2015,0)),12,"B",B)) S S=1
 .I G,S S F=1
 .Q
 Q $S(F:1,1:0)
ACTCLBH(P,BDATE,EDATE) ;EP - clinical user
 S (X,G,F,S)=0 F  S X=$O(^TMP($J,"A",X)) Q:X'=+X!(F)  S V=$P(^TMP($J,"A",X),U,5) D
 .Q:'$D(^AUPNVSIT(V,0))
 .Q:'$P(^AUPNVSIT(V,0),U,9)
 .Q:$P(^AUPNVSIT(V,0),U,11)
 .Q:'$D(^AUPNVPRV("AD",V))
 .Q:"SAHO"'[$P(^AUPNVSIT(V,0),U,7)
 .Q:"V"[$P(^AUPNVSIT(V,0),U,3)
 .Q:$P(^AUPNVSIT(V,0),U,6)=""
 .S B=$$CLINIC^APCLV(V,"C")
 .Q:B=""
 .I 'G,$D(^BGPCTRL($O(^BGPCTRL("B",2015,0)),11,"B",B)) S G=V  ;must be a primary clinic S G=V
 .I V'=G,$D(^BGPCTRL($O(^BGPCTRL("B",2015,0)),95,"B",B)) S S=1
 .I G,S S F=1
 .Q
 Q $S(F:1,1:0)
FIRSTDM(P,EDATE) ;
 I $G(P)="" Q ""
 K BGPG
 S Y="BGPG("
 S X=P_"^FIRST DX [SURVEILLANCE DIABETES" S E=$$START1^APCLDF(X,Y)
 I '$D(BGPG(1)) Q ""
 S X=$$FMDIFF^XLFDT(EDATE,$P(BGPG(1),U))
 Q $S(X>365:1,1:"")
 ;
LASTVD(P,BDATE,EDATE) ;
 I '$D(^AUPNVSIT("AC",P)) Q ""
 K ^TMP($J,"A")
 S A="^TMP($J,""A"",",B=P_"^ALL VISITS;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(B,A)
 I '$D(^TMP($J,"A",1)) Q ""
 S (X,G)=0 F  S X=$O(^TMP($J,"A",X)) Q:X'=+X!(G)  S V=$P(^TMP($J,"A",X),U,5) D
 .Q:'$D(^AUPNVSIT(V,0))
 .Q:'$P(^AUPNVSIT(V,0),U,9)
 .Q:$P(^AUPNVSIT(V,0),U,11)
 .Q:'$D(^AUPNVPRV("AD",V))
 .Q:"SAHO"'[$P(^AUPNVSIT(V,0),U,7)
 .Q:"V"[$P(^AUPNVSIT(V,0),U,3)
 .Q:$P(^AUPNVSIT(V,0),U,6)=""
 .S G=1
 .Q
 Q G
 ;
LOINC(A,B) ;
 NEW %
 S %=$P($G(^LAB(95.3,A,9999999)),U,2)
 I %]"",$D(^ATXAX(B,21,"B",%)) Q 1
 S %=$P($G(^LAB(95.3,A,0)),U)_"-"_$P($G(^LAB(95.3,A,0)),U,15)
 I $D(^ATXAX(B,21,"B",%)) Q 1
 Q ""
DP(P) ;
 I $P(^AUPNPAT(P,0),U,14) Q $P(^AUPNPAT(P,0),U,14)
 I $T(ALLDP^BDPAPI)="" Q ""
 NEW X
 D ALLDP^BDPAPI(P,"DESIGNATED PRIMARY PROVIDER",.X)
 Q $P($G(X("DESIGNATED PRIMARY PROVIDER")),U,2)