APCLD61G ; IHS/CMI/LAB - calc indicators 16 Jan 2006 8:13 PM ;
;;2.0;IHS PCC SUITE;;MAY 14, 2009
;
ACTDMPT(DFN,APCLBDAT,APCLEDAT,APCLCOMT,APCLBEN,APCL3YE) ;EP
K APCL365,APCLACUP,APCLACCL,APCLAGEB,APCLAGEE,APCLSEX,APCLDM1,APCLDM2,APCLFDMD,APCL2V,APCL2DMV,APCL1DMV,APCLDMD1,APCLDMD2,APCLDMD3,APCLDMD5
S APCL365=APCLBDAT,APCLDMD2=0
S APCLACUP=$$ACTUP(DFN,APCL3YE,APCLEDAT,APCLCOMT,APCLBEN) ;user pop
I 'APCLACUP Q 0
S APCLACCL=$$ACTCL(DFN,APCL3YE,APCLEDAT) ;active clinical
I 'APCLACCL Q 0 ;not active clinical
S APCLAGEB=$$AGE^AUPNPAT(DFN,APCLBDAT)
S APCLAGEE=$$AGE^AUPNPAT(DFN,APCLEDAT)
S APCLSEX=$P(^DPT(DFN,0),U,2)
S APCLDM1=$$DM(DFN,,APCLEDAT) ;dm diagnosis ever?
S APCLDM2=$$DM(DFN,APCL365,APCLEDAT) ;dm diagnosis in past year
I APCLDM1 D ;set up 4 dm demoninators
.S APCLFDMD=$$FIRSTDM(DFN,APCLEDAT) ;1 OR 0 FIRST DX BEFORE BEG
.S APCL2V=$$V2(DFN,APCL365,APCLEDAT)
.S APCL2DMV=$$V2DM(DFN,$$DOB^AUPNPAT(DFN),APCLEDAT)
.S APCL1DMV=$$V1DM(DFN,APCL365,APCLEDAT)
.S APCLDMD2=0 I APCLFDMD,APCL2V,APCL2DMV,APCLACCL S APCLDMD2=1
K ^TMP($J,"A")
K APCL365,APCLACUP,APCLACCL,APCLAGEB,APCLAGEE,APCLSEX,APCLDM1,APCLDM2,APCLFDMD,APCL2V,APCL2DMV,APCL1DMV,APCLDMD1
Q APCLDMD2
V1DM(P,D,EDATE) ;
I '$G(P) Q ""
I '$D(^AUPNVSIT("AC",P)) Q ""
S PC=$O(^ATXAX("B","APCL PRIMARY CARE CLINICS",0))
I 'PC Q ""
;I 'PP Q ""
K ^TMP($J,"A")
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:'$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^ATXCHK(%,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) ;
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>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)
.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")
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)
.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^ATXCHK(%,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)
K APCLG
S Y="APCLG("
S X=P_"^LAST DX [SURVEILLANCE DIABETES;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE) S E=$$START1^APCLDF(X,Y)
I $D(APCLG(1)) Q 1 ;has a dx
Q 0
;
ACTUP(P,BDATE,EDATE,T,B) ;EP - is this patient in user pop?
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
NEW CL S CL=$O(^APCLCNTL("B","DM AUDIT 2005 CLINIC LIST 1",0))
NEW CL2 S CL2=$O(^APCLCNTL("B","DM AUDIT 2005 CLINIC LIST 2",0))
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)
.S B=$$CLINIC^APCLV(V,"C")
.Q:B=""
.I 'G,$D(^APCLCNTL(CL,11,"B",B)) S G=V ;must be a primary clinic S G=V
.I V'=G,$D(^APCLCNTL(CL2,11,"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 APCLG
S Y="APCLG("
S X=P_"^FIRST DX [SURVEILLANCE DIABETES" S E=$$START1^APCLDF(X,Y)
I '$D(APCLG(1)) Q ""
S X=$$FMDIFF^XLFDT(EDATE,$P(APCLG(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)
.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 ""
APCLD61G ; IHS/CMI/LAB - calc indicators 16 Jan 2006 8:13 PM ;
+1 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
+2 ;
ACTDMPT(DFN,APCLBDAT,APCLEDAT,APCLCOMT,APCLBEN,APCL3YE) ;EP
+1 KILL APCL365,APCLACUP,APCLACCL,APCLAGEB,APCLAGEE,APCLSEX,APCLDM1,APCLDM2,APCLFDMD,APCL2V,APCL2DMV,APCL1DMV,APCLDMD1,APCLDMD2,APCLDMD3,APCLDMD5
+2 SET APCL365=APCLBDAT
SET APCLDMD2=0
+3 ;user pop
SET APCLACUP=$$ACTUP(DFN,APCL3YE,APCLEDAT,APCLCOMT,APCLBEN)
+4 IF 'APCLACUP
QUIT 0
+5 ;active clinical
SET APCLACCL=$$ACTCL(DFN,APCL3YE,APCLEDAT)
+6 ;not active clinical
IF 'APCLACCL
QUIT 0
+7 SET APCLAGEB=$$AGE^AUPNPAT(DFN,APCLBDAT)
+8 SET APCLAGEE=$$AGE^AUPNPAT(DFN,APCLEDAT)
+9 SET APCLSEX=$PIECE(^DPT(DFN,0),U,2)
+10 ;dm diagnosis ever?
SET APCLDM1=$$DM(DFN,,APCLEDAT)
+11 ;dm diagnosis in past year
SET APCLDM2=$$DM(DFN,APCL365,APCLEDAT)
+12 ;set up 4 dm demoninators
IF APCLDM1
Begin DoDot:1
+13 ;1 OR 0 FIRST DX BEFORE BEG
SET APCLFDMD=$$FIRSTDM(DFN,APCLEDAT)
+14 SET APCL2V=$$V2(DFN,APCL365,APCLEDAT)
+15 SET APCL2DMV=$$V2DM(DFN,$$DOB^AUPNPAT(DFN),APCLEDAT)
+16 SET APCL1DMV=$$V1DM(DFN,APCL365,APCLEDAT)
+17 SET APCLDMD2=0
IF APCLFDMD
IF APCL2V
IF APCL2DMV
IF APCLACCL
SET APCLDMD2=1
End DoDot:1
+18 KILL ^TMP($JOB,"A")
+19 KILL APCL365,APCLACUP,APCLACCL,APCLAGEB,APCLAGEE,APCLSEX,APCLDM1,APCLDM2,APCLFDMD,APCL2V,APCL2DMV,APCL1DMV,APCLDMD1
+20 QUIT APCLDMD2
V1DM(P,D,EDATE) ;
+1 IF '$GET(P)
QUIT ""
+2 IF '$DATA(^AUPNVSIT("AC",P))
QUIT ""
+3 SET PC=$ORDER(^ATXAX("B","APCL PRIMARY CARE CLINICS",0))
+4 IF 'PC
QUIT ""
+5 ;I 'PP Q ""
+6 KILL ^TMP($JOB,"A")
+7 SET A="^TMP($J,""A"","
SET B=P_"^ALL VISITS;DURING "_$$FMTE^XLFDT(D)_"-"_$$FMTE^XLFDT(EDATE)
SET E=$$START1^APCLDF(B,A)
+8 IF '$DATA(^TMP($JOB,"A",1))
QUIT ""
+9 SET T=$ORDER(^ATXAX("B","SURVEILLANCE DIABETES",0))
+10 IF 'T
QUIT ""
+11 SET (X,G)=0
FOR
SET X=$ORDER(^TMP($JOB,"A",X))
IF X'=+X!(G>2)
QUIT
SET V=$PIECE(^TMP($JOB,"A",X),U,5)
Begin DoDot:1
+12 IF '$DATA(^AUPNVSIT(V,0))
QUIT
+13 IF '$PIECE(^AUPNVSIT(V,0),U,9)
QUIT
+14 IF $PIECE(^AUPNVSIT(V,0),U,11)
QUIT
+15 IF "SAHO"'[$PIECE(^AUPNVSIT(V,0),U,7)
QUIT
+16 IF '$DATA(^AUPNVPRV("AD",V))
QUIT
+17 ;Q:$P(^AUPNVSIT(V,0),U,6)'=DUZ(2) ;PER TERRY
+18 IF '$DATA(^AUPNVPOV("AD",V))
QUIT
+19 SET (D,Y)=0
FOR
SET Y=$ORDER(^AUPNVPOV("AD",V,Y))
IF Y'=+Y!(D)
QUIT
IF $DATA(^AUPNVPOV(Y,0))
SET %=$PIECE(^AUPNVPOV(Y,0),U)
IF $$ICD^ATXCHK(%,T,9)
SET D=1
+20 IF 'D
QUIT
+21 IF "V"[$PIECE(^AUPNVSIT(V,0),U,3)
QUIT
+22 SET Y=$$PRIMPROV^APCLV(V,"F")
+23 IF 'Y
QUIT
+24 ;Q:'$D(^ATXAX(PP,21,"B",Y))
+25 IF $PIECE($GET(^DIC(7,Y,9999999)),U,3)'="Y"
QUIT
+26 SET Y=$$CLINIC^APCLV(V,"I")
+27 IF 'Y
QUIT
+28 IF '$DATA(^ATXAX(PC,21,"B",Y))
QUIT
+29 SET G=G+1
+30 QUIT
End DoDot:1
+31 QUIT $SELECT(G<1:"",1:1)
+32 ;
V2(P,BDATE,EDATE) ;
+1 IF '$DATA(^AUPNVSIT("AC",P))
QUIT ""
+2 KILL ^TMP($JOB,"A")
+3 SET A="^TMP($J,""A"","
SET B=P_"^ALL VISITS;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE)
SET E=$$START1^APCLDF(B,A)
+4 IF '$DATA(^TMP($JOB,"A",1))
QUIT ""
+5 SET (X,G)=0
FOR
SET X=$ORDER(^TMP($JOB,"A",X))
IF X'=+X!(G>2)
QUIT
SET V=$PIECE(^TMP($JOB,"A",X),U,5)
Begin DoDot:1
+6 IF '$DATA(^AUPNVSIT(V,0))
QUIT
+7 IF '$PIECE(^AUPNVSIT(V,0),U,9)
QUIT
+8 IF $PIECE(^AUPNVSIT(V,0),U,11)
QUIT
+9 IF "SAHO"'[$PIECE(^AUPNVSIT(V,0),U,7)
QUIT
+10 IF "V"[$PIECE(^AUPNVSIT(V,0),U,3)
QUIT
+11 SET G=G+1
+12 QUIT
End DoDot:1
+13 QUIT $SELECT(G<2:"",1:1)
+14 ;
V2DM(P,BDATE,EDATE) ;
+1 IF '$GET(P)
QUIT ""
+2 IF '$DATA(^AUPNVSIT("AC",P))
QUIT ""
+3 KILL ^TMP($JOB,"A")
+4 SET A="^TMP($J,""A"","
SET B=P_"^ALL VISITS;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE)
SET E=$$START1^APCLDF(B,A)
+5 IF '$DATA(^TMP($JOB,"A",1))
QUIT ""
+6 SET T=$ORDER(^ATXAX("B","SURVEILLANCE DIABETES",0))
+7 IF 'T
QUIT ""
+8 SET (X,G)=0
FOR
SET X=$ORDER(^TMP($JOB,"A",X))
IF X'=+X!(G>2)
QUIT
SET V=$PIECE(^TMP($JOB,"A",X),U,5)
Begin DoDot:1
+9 IF '$DATA(^AUPNVSIT(V,0))
QUIT
+10 IF '$PIECE(^AUPNVSIT(V,0),U,9)
QUIT
+11 IF $PIECE(^AUPNVSIT(V,0),U,11)
QUIT
+12 IF "SAHO"'[$PIECE(^AUPNVSIT(V,0),U,7)
QUIT
+13 IF "V"[$PIECE(^AUPNVSIT(V,0),U,3)
QUIT
+14 SET (D,Y)=0
FOR
SET Y=$ORDER(^AUPNVPOV("AD",V,Y))
IF Y'=+Y!(D)
QUIT
IF $DATA(^AUPNVPOV(Y,0))
SET %=$PIECE(^AUPNVPOV(Y,0),U)
IF $$ICD^ATXCHK(%,T,9)
SET D=1
+15 IF 'D
QUIT
+16 SET G=G+1
+17 QUIT
End DoDot:1
+18 QUIT $SELECT(G<2:"",1:1)
+19 ;
DM(P,BDATE,EDATE) ;EP is patient diabetic 1 or 0
+1 IF $GET(BDATE)=""
SET BDATE=$$DOB^AUPNPAT(P)
+2 KILL APCLG
+3 SET Y="APCLG("
+4 SET X=P_"^LAST DX [SURVEILLANCE DIABETES;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE)
SET E=$$START1^APCLDF(X,Y)
+5 ;has a dx
IF $DATA(APCLG(1))
QUIT 1
+6 QUIT 0
+7 ;
ACTUP(P,BDATE,EDATE,T,B) ;EP - is this patient in user pop?
+1 ;must be Indian/Alaskan Native
IF B=1
IF $$BEN^AUPNPAT(P,"C")'="01"
QUIT 0
+2 ;must not be I/A
IF B=2
IF $$BEN^AUPNPAT(P,"C")="01"
QUIT 0
+3 SET DOD=$$DOD^AUPNPAT(P)
IF DOD]""
IF DOD<EDATE
QUIT 0
+4 SET X=$PIECE($GET(^AUPNPAT(P,11)),U,18)
IF X=""
QUIT 0
+5 IF '$DATA(^ATXAX(T,21,"B",($PIECE(^AUPNPAT(P,11),U,18))))
IF '$DATA(^ATXAX(T,21,"AA",$PIECE(^AUPNPAT(P,11),U,18),$PIECE(^AUPNPAT(P,11),U,18)))
QUIT 0
+6 SET X=$$LASTVD(P,BDATE,EDATE)
+7 QUIT $SELECT(X:1,1:0)
+8 ;
ACTCL(P,BDATE,EDATE) ;EP - clinical user
+1 NEW CL
SET CL=$ORDER(^APCLCNTL("B","DM AUDIT 2005 CLINIC LIST 1",0))
+2 NEW CL2
SET CL2=$ORDER(^APCLCNTL("B","DM AUDIT 2005 CLINIC LIST 2",0))
+3 SET (X,G,F,S)=0
FOR
SET X=$ORDER(^TMP($JOB,"A",X))
IF X'=+X!(F)
QUIT
SET V=$PIECE(^TMP($JOB,"A",X),U,5)
Begin DoDot:1
+4 IF '$DATA(^AUPNVSIT(V,0))
QUIT
+5 IF '$PIECE(^AUPNVSIT(V,0),U,9)
QUIT
+6 IF $PIECE(^AUPNVSIT(V,0),U,11)
QUIT
+7 IF '$DATA(^AUPNVPRV("AD",V))
QUIT
+8 IF "SAHO"'[$PIECE(^AUPNVSIT(V,0),U,7)
QUIT
+9 IF "V"[$PIECE(^AUPNVSIT(V,0),U,3)
QUIT
+10 SET B=$$CLINIC^APCLV(V,"C")
+11 IF B=""
QUIT
+12 ;must be a primary clinic S G=V
IF 'G
IF $DATA(^APCLCNTL(CL,11,"B",B))
SET G=V
+13 IF V'=G
IF $DATA(^APCLCNTL(CL2,11,"B",B))
SET S=1
+14 IF G
IF S
SET F=1
+15 QUIT
End DoDot:1
+16 QUIT $SELECT(F:1,1:0)
+17 ;
FIRSTDM(P,EDATE) ;
+1 IF $GET(P)=""
QUIT ""
+2 KILL APCLG
+3 SET Y="APCLG("
+4 SET X=P_"^FIRST DX [SURVEILLANCE DIABETES"
SET E=$$START1^APCLDF(X,Y)
+5 IF '$DATA(APCLG(1))
QUIT ""
+6 SET X=$$FMDIFF^XLFDT(EDATE,$PIECE(APCLG(1),U))
+7 QUIT $SELECT(X>365:1,1:"")
+8 ;
LASTVD(P,BDATE,EDATE) ;
+1 IF '$DATA(^AUPNVSIT("AC",P))
QUIT ""
+2 KILL ^TMP($JOB,"A")
+3 SET A="^TMP($J,""A"","
SET B=P_"^ALL VISITS;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE)
SET E=$$START1^APCLDF(B,A)
+4 IF '$DATA(^TMP($JOB,"A",1))
QUIT ""
+5 SET (X,G)=0
FOR
SET X=$ORDER(^TMP($JOB,"A",X))
IF X'=+X!(G)
QUIT
SET V=$PIECE(^TMP($JOB,"A",X),U,5)
Begin DoDot:1
+6 IF '$DATA(^AUPNVSIT(V,0))
QUIT
+7 IF '$PIECE(^AUPNVSIT(V,0),U,9)
QUIT
+8 IF $PIECE(^AUPNVSIT(V,0),U,11)
QUIT
+9 IF '$DATA(^AUPNVPRV("AD",V))
QUIT
+10 IF "SAHO"'[$PIECE(^AUPNVSIT(V,0),U,7)
QUIT
+11 IF "V"[$PIECE(^AUPNVSIT(V,0),U,3)
QUIT
+12 SET G=1
+13 QUIT
End DoDot:1
+14 QUIT G
+15 ;
LOINC(A,B) ;
+1 NEW %
+2 SET %=$PIECE($GET(^LAB(95.3,A,9999999)),U,2)
+3 IF %]""
IF $DATA(^ATXAX(B,21,"B",%))
QUIT 1
+4 SET %=$PIECE($GET(^LAB(95.3,A,0)),U)_"-"_$PIECE($GET(^LAB(95.3,A,0)),U,15)
+5 IF $DATA(^ATXAX(B,21,"B",%))
QUIT 1
+6 QUIT ""