BHSMBN ;IHS/CIA/MGH - Health Summary for V MED file ;01-May-2014 11:09;DU
;;1.0;HEALTH SUMMARY COMPONENTS;**1,2,6,9**;March 17, 2006;Build 16
;===================================================================
;Taken from APCHS77
; IHS/TUCSON/LAB - PART 7 OF BHS -- SUMMARY PRODUCTION COMPONENTS ; [ 04/14/04 3:14 PM ]
;;2.0;IHS RPMS/PCC HEALTH SUMMARY;**11**;SEP 23, 1997
;
;This routine makes health summaries for those medications sorted by name
;Patch 1 changes prescribed at to dispensed at as in IHS patch 15
;Patch 6 for non-VA meds and medication review
;======================================================================
MEDSCURR ; ************** CURRENT MEDICATIONS * 9000010.14 ********
S BHSMTY="CURR" G CONT
MEDSCHRN ; ************* CHRONIC MEDCICATIONS ************
S BHSMTY="CHRONIC" G CONT
MEDSNDUP ; ************* ALL, NON DUPLICATED *************
S BHSMTY="NODUP" G CONT
CONT ; <SETUP>
N BHSPAT,BHSQ,APCHZ
S BHSPAT=DFN
Q:'$D(^AUPNVMED("AC",BHSPAT))
D CKP^GMTSUP Q:$D(GMTSQIT)
; <BUILD>
K ^TMP($J,"BHSMTB"),^TMP($J,"BHSMTP")
S BHSIVD=0 F BHSQ=0:0 S BHSIVD=$O(^AUPNVMED("AA",BHSPAT,BHSIVD)) Q:BHSIVD=""!(BHSIVD>GMTSDLM) S BHSMX=0 F BHSQ=0:0 S BHSMX=$O(^AUPNVMED("AA",BHSPAT,BHSIVD,BHSMX)) Q:BHSMX="" D MEDBLD
; <DISPLAY>
D NONVA^BHSMED ;Patch 6 get all NON-VA meds that didn't pass to PCC
S BHSNAM="" F BHSQ=0:0 S BHSNAM=$O(^TMP($J,"BHSMTP",BHSNAM)) Q:BHSNAM=""!($D(GMTSQIT)) S BHSMX=0 F S BHSMX=$O(^TMP($J,"BHSMTP",BHSNAM,BHSMX)) Q:BHSMX'=+BHSMX!($D(GMTSQIT)) D MEDDSP
D HOLDDSP^BHSMED
;Patch 2 med refusals
S BHST="MEDICATION",BHSFN=50 D DISPREF^BHSRAD
;Patch 6
D MEDRU^BHSMED ;display last date reviewed/updated/nam
K BHST,BHSFN
; <CLEANUP>
MEDX K BHSIVD,BHSMX,BHSMFX,BHSQTY,BHSIG,BHSSGY,BHSEXP,BHSMTS,BHSMED,BHSDTM,BHSDAT,BHSDYS,BHSN,BHSDC,BHSVDF,BHSP,APCHORTS,BHSDCP,BHSNAM,BHSMED
K BHSNFL,BHSNSH,BHSNAB,BHSVSC,BHSITE,BHSRX,BHSDRG,BHSCRN,BHSREF,BHSRFL,BHSALL,BHSTXT,BHSMTY,BHSORD
K ^TMP($J,"BHSMTB"),^TMP($J,"BHSMTP")
K X1,X2,X,Y
Q
MEDBLD ;BUILD ARRAY OF MEDICATIONS
;BHSDC=DATE DISCONTINUED,DYS=DAYS PRESCRIBED,SIG=DIRECTIONS
;VDF=VISIT FILE DATE
Q:'$D(^AUPNVMED(BHSMX,0))
S BHSN=^AUPNVMED(BHSMX,0)
Q:'$D(^PSDRUG($P(BHSN,U,1)))
S BHSDTM=-BHSIVD\1+9999999
S BHSDC=$P(BHSN,U,8),BHSDYS=$P(BHSN,U,7),BHSMFX=$S($P(BHSN,U,4)="":+BHSN,1:$P(BHSN,U,4))
S:BHSDYS="" BHSDYS=30
D @BHSMTY
Q
;
CURR ; current meds only
I $D(^TMP($J,"BHSMTB",BHSMFX)),^TMP($J,"BHSMTB",BHSMFX)="" Q
S X1=DT,X2=BHSDTM D ^%DTC Q:X>60&(X>(2*BHSDYS))
S BHSN=^AUPNVMED(BHSMX,0)
S BHSMED=$S($P(BHSN,U,4)="":$P(^PSDRUG(BHSMFX,0),U,1),1:$P(BHSN,U,4))
S ^TMP($J,"BHSMTB",BHSMFX)=BHSDC,^TMP($J,"BHSMTP",BHSMED,BHSMX)=BHSMX
Q
CHRONIC ;chronic meds only
I $D(^TMP($J,"BHSMTB",BHSMFX)) Q
S X=$S($D(^PSRX("APCC",BHSMX)):$O(^(BHSMX,0)),1:0)
S Y=$S(+X:$D(^PS(55,BHSPAT,"P","CP",X)),1:0)
Q:'Y
I $G(BHSDCP),BHSDC]"" Q ;IHS/CMI/LAB - new component patch 9
S BHSN=^AUPNVMED(BHSMX,0)
S BHSMED=$S($P(BHSN,U,4)="":$P(^PSDRUG(BHSMFX,0),U,1),1:$P(BHSN,U,4))
S ^TMP($J,"BHSMTB",BHSMFX)=BHSDC,^TMP($J,"BHSMTP",BHSMED,BHSMX)=BHSMX
Q
MEDDSP ;DISPLAY MEDICATION
;BHSRX=RX# in FILE 52,CHRN=CHRONIC FLAG,REF=#REFILLS
I $P(^TMP($J,"BHSMTP",BHSNAM,BHSMX),U,1)="" D NVADSP Q
S BHSN=^AUPNVMED(BHSMX,0)
S APCHZ=$P(^AUPNVMED(BHSMX,0),U,3)
S BHSIVD=$P($P(^AUPNVSIT(APCHZ,0),U),".")
S BHSRX=$S($D(^PSRX("APCC",BHSMX)):$O(^(BHSMX,0)),1:0)
S BHSCRN=$S(+BHSRX:$D(^PS(55,BHSPAT,"P","CP",BHSRX)),1:0)
S (X,BHSDTM)=BHSIVD D REGDT4^GMTSU S BHSDAT=X
S BHSDC=$P(BHSN,U,8),BHSDYS=$P(BHSN,U,7),BHSQTY=$P(BHSN,U,6),BHSIG=$P(BHSN,U,5),BHSVDF=$P(BHSN,U,3),BHSMFX=+BHSN
S:BHSDYS="" BHSDYS=30
S X1=DT,X2=BHSDTM D ^%DTC ;Q:X>60&(X>(2*BHSDYS))
S BHSEXP=""
I X>BHSDYS S X1=BHSDTM,X2=BHSDYS D C^%DTC D REGDT4^GMTSU S BHSEXP="-- Ran out "_X
S BHSMED=$S($P(BHSN,U,4)="":$P(^PSDRUG(BHSMFX,0),U,1),1:$P(BHSN,U,4))
I BHSDC S X=BHSDC D REGDT4^GMTSU S BHSEXP="-- D/C "_X
;CHANGE IT AROUND A BIT LOOK FOR RETURNED TO STOCK IHS/OKCAO/POC 2/14/2000
S APCHORTS=$G(^AUPNVMED(BHSMX,11))
I APCHORTS["RETURNED TO STOCK",BHSDC S BHSEXP="--RTS "_Y
;END OF LOCAL CHANGES IHS/OKCAO/POC 2/14/2000
D SIG S BHSIG=BHSSGY
D REF I BHSREF S BHSIG=BHSIG_" "_BHSREF_$S(BHSREF=1:" refill",1:" refills")_" left."
D SITE ;I BHSITE]"" S BHSIG=BHSIG_" ["_BHSITE_"]"
D CKP^GMTSUP Q:$D(GMTSQIT)
W BHSDAT,?10,$S(BHSCRN:"(C)",1:""),?14,BHSMED," #",BHSQTY," (",BHSDYS," days) ",BHSEXP,!
;Patch 8 Add Rxnorm code here
S RXNORM=$$GET1^DIQ(50,BHSMFX,9999999.27)
I RXNORM'="" W ?14,"RxNorm: ",RXNORM,!
I BHSITE]"" W ?14,"Dispensed at: ",BHSITE,!
D CKP^GMTSUP Q:$D(GMTSQIT)
S BHSICL=14,BHSNRQ="",BHSTXT=BHSIG D PRTTXT^BHSUTL K BHSICL,BHSNRQ,BHSP
S BHSORD=$$GET1^DIQ(52,BHSRX,39.3,"I")
I +BHSORD D RECON^BHSMED(BHSORD,"M")
E D
.N NVA
.S NVA=+$P(APCHORTS,U,8)
.I NVA'="" D
..S BHSORD=$P($G(^PS(55,DFN,"NVA",NVA,0)),U,8)
..D RECON^BHSMED(BHSORD,"M")
Q
;
NVADSP ;
S BHSEXP=""
S (X,BHSDTM)=-BHSIVD\1+9999999 D REGDT4^GMTSU S BHSDAT=X
S BHSDC=$P(^TMP($J,"BHSMTP",BHSIVD),U,5)
S BHSMED=$P(^TMP($J,"BHSMTP",BHSIVD),U,3)
I BHSDC S Y=BHSDC D REGDT4^GMTSU S BHSEXP="-- D/C "_Y
S BHSIG=$P(^TMP($J,"BHSMTP",BHSIVD),U,4)
D CKP^GMTSUP Q:$D(GMTSQIT)
W BHSDAT,?14,BHSMED," ",BHSEXP,!
D CKP^GMTSUP Q:$D(GMTSQIT)
S BHSICL=14,BHSNRQ="",BHSTXT=BHSIG_" (EHR OUTSIDE MEDICATION)" D PRTTXT^BHSUTL K BHSICL,BHSNRQ,BHSP
Q
SIG ;CONSTRUCT THE FULL TEXT FROM THE ENCODED SIG
;I $$VALI^XBDIQ1(9001015,BHSTYP,3.5)="S" S BHSSGY=BHSIG Q
S BHSSGY="" F BHSP=1:1:$L(BHSIG," ") S X=$P(BHSIG," ",BHSP) I X]"" D
. S Y=$O(^PS(51,"B",X,0)) I Y>0 S X=$P(^PS(51,Y,0),"^",2) I $D(^(9)) S Y=$P(BHSIG," ",BHSP-1),Y=$E(Y,$L(Y)) S:Y>1 X=$P(^(9),"^",1)
. S BHSSGY=BHSSGY_X_" "
Q
;
REF ;DETERMINE THE NUMBER OF REFILLS REMAINING
I 'BHSRX S BHSREF=0 Q
S BHSRFL=$P($G(^PSRX(BHSRX,0)),U,9) S BHSREF=0 F S BHSREF=$O(^PSRX(BHSRX,1,BHSREF)) Q:'BHSREF S BHSRFL=BHSRFL-1
S BHSREF=BHSRFL
Q
;
SITE ;DETERMINE IF OUTSIDE LOCATION INFO PRESENT
S BHSITE=""
I $D(^AUPNVSIT(BHSVDF,21))#2 S BHSITE=$P(^(21),U) Q
Q:$P(^AUPNVSIT(BHSVDF,0),U,6)=""
I $P(^AUPNVSIT(BHSVDF,0),U,6)'=DUZ(2) S BHSITE=$E($P(^DIC(4,$P(^AUPNVSIT(BHSVDF,0),U,6),0),U),1,30)
Q
BHSMBN ;IHS/CIA/MGH - Health Summary for V MED file ;01-May-2014 11:09;DU
+1 ;;1.0;HEALTH SUMMARY COMPONENTS;**1,2,6,9**;March 17, 2006;Build 16
+2 ;===================================================================
+3 ;Taken from APCHS77
+4 ; IHS/TUCSON/LAB - PART 7 OF BHS -- SUMMARY PRODUCTION COMPONENTS ; [ 04/14/04 3:14 PM ]
+5 ;;2.0;IHS RPMS/PCC HEALTH SUMMARY;**11**;SEP 23, 1997
+6 ;
+7 ;This routine makes health summaries for those medications sorted by name
+8 ;Patch 1 changes prescribed at to dispensed at as in IHS patch 15
+9 ;Patch 6 for non-VA meds and medication review
+10 ;======================================================================
MEDSCURR ; ************** CURRENT MEDICATIONS * 9000010.14 ********
+1 SET BHSMTY="CURR"
GOTO CONT
MEDSCHRN ; ************* CHRONIC MEDCICATIONS ************
+1 SET BHSMTY="CHRONIC"
GOTO CONT
MEDSNDUP ; ************* ALL, NON DUPLICATED *************
+1 SET BHSMTY="NODUP"
GOTO CONT
CONT ; <SETUP>
+1 NEW BHSPAT,BHSQ,APCHZ
+2 SET BHSPAT=DFN
+3 IF '$DATA(^AUPNVMED("AC",BHSPAT))
QUIT
+4 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+5 ; <BUILD>
+6 KILL ^TMP($JOB,"BHSMTB"),^TMP($JOB,"BHSMTP")
+7 SET BHSIVD=0
FOR BHSQ=0:0
SET BHSIVD=$ORDER(^AUPNVMED("AA",BHSPAT,BHSIVD))
IF BHSIVD=""!(BHSIVD>GMTSDLM)
QUIT
SET BHSMX=0
FOR BHSQ=0:0
SET BHSMX=$ORDER(^AUPNVMED("AA",BHSPAT,BHSIVD,BHSMX))
IF BHSMX=""
QUIT
DO MEDBLD
+8 ; <DISPLAY>
+9 ;Patch 6 get all NON-VA meds that didn't pass to PCC
DO NONVA^BHSMED
+10 SET BHSNAM=""
FOR BHSQ=0:0
SET BHSNAM=$ORDER(^TMP($JOB,"BHSMTP",BHSNAM))
IF BHSNAM=""!($DATA(GMTSQIT))
QUIT
SET BHSMX=0
FOR
SET BHSMX=$ORDER(^TMP($JOB,"BHSMTP",BHSNAM,BHSMX))
IF BHSMX'=+BHSMX!($DATA(GMTSQIT))
QUIT
DO MEDDSP
+11 DO HOLDDSP^BHSMED
+12 ;Patch 2 med refusals
+13 SET BHST="MEDICATION"
SET BHSFN=50
DO DISPREF^BHSRAD
+14 ;Patch 6
+15 ;display last date reviewed/updated/nam
DO MEDRU^BHSMED
+16 KILL BHST,BHSFN
+17 ; <CLEANUP>
MEDX KILL BHSIVD,BHSMX,BHSMFX,BHSQTY,BHSIG,BHSSGY,BHSEXP,BHSMTS,BHSMED,BHSDTM,BHSDAT,BHSDYS,BHSN,BHSDC,BHSVDF,BHSP,APCHORTS,BHSDCP,BHSNAM,BHSMED
+1 KILL BHSNFL,BHSNSH,BHSNAB,BHSVSC,BHSITE,BHSRX,BHSDRG,BHSCRN,BHSREF,BHSRFL,BHSALL,BHSTXT,BHSMTY,BHSORD
+2 KILL ^TMP($JOB,"BHSMTB"),^TMP($JOB,"BHSMTP")
+3 KILL X1,X2,X,Y
+4 QUIT
MEDBLD ;BUILD ARRAY OF MEDICATIONS
+1 ;BHSDC=DATE DISCONTINUED,DYS=DAYS PRESCRIBED,SIG=DIRECTIONS
+2 ;VDF=VISIT FILE DATE
+3 IF '$DATA(^AUPNVMED(BHSMX,0))
QUIT
+4 SET BHSN=^AUPNVMED(BHSMX,0)
+5 IF '$DATA(^PSDRUG($PIECE(BHSN,U,1)))
QUIT
+6 SET BHSDTM=-BHSIVD\1+9999999
+7 SET BHSDC=$PIECE(BHSN,U,8)
SET BHSDYS=$PIECE(BHSN,U,7)
SET BHSMFX=$SELECT($PIECE(BHSN,U,4)="":+BHSN,1:$PIECE(BHSN,U,4))
+8 IF BHSDYS=""
SET BHSDYS=30
+9 DO @BHSMTY
+10 QUIT
+11 ;
CURR ; current meds only
+1 IF $DATA(^TMP($JOB,"BHSMTB",BHSMFX))
IF ^TMP($JOB,"BHSMTB",BHSMFX)=""
QUIT
+2 SET X1=DT
SET X2=BHSDTM
DO ^%DTC
IF X>60&(X>(2*BHSDYS))
QUIT
+3 SET BHSN=^AUPNVMED(BHSMX,0)
+4 SET BHSMED=$SELECT($PIECE(BHSN,U,4)="":$PIECE(^PSDRUG(BHSMFX,0),U,1),1:$PIECE(BHSN,U,4))
+5 SET ^TMP($JOB,"BHSMTB",BHSMFX)=BHSDC
SET ^TMP($JOB,"BHSMTP",BHSMED,BHSMX)=BHSMX
+6 QUIT
CHRONIC ;chronic meds only
+1 IF $DATA(^TMP($JOB,"BHSMTB",BHSMFX))
QUIT
+2 SET X=$SELECT($DATA(^PSRX("APCC",BHSMX)):$ORDER(^(BHSMX,0)),1:0)
+3 SET Y=$SELECT(+X:$DATA(^PS(55,BHSPAT,"P","CP",X)),1:0)
+4 IF 'Y
QUIT
+5 ;IHS/CMI/LAB - new component patch 9
IF $GET(BHSDCP)
IF BHSDC]""
QUIT
+6 SET BHSN=^AUPNVMED(BHSMX,0)
+7 SET BHSMED=$SELECT($PIECE(BHSN,U,4)="":$PIECE(^PSDRUG(BHSMFX,0),U,1),1:$PIECE(BHSN,U,4))
+8 SET ^TMP($JOB,"BHSMTB",BHSMFX)=BHSDC
SET ^TMP($JOB,"BHSMTP",BHSMED,BHSMX)=BHSMX
+9 QUIT
MEDDSP ;DISPLAY MEDICATION
+1 ;BHSRX=RX# in FILE 52,CHRN=CHRONIC FLAG,REF=#REFILLS
+2 IF $PIECE(^TMP($JOB,"BHSMTP",BHSNAM,BHSMX),U,1)=""
DO NVADSP
QUIT
+3 SET BHSN=^AUPNVMED(BHSMX,0)
+4 SET APCHZ=$PIECE(^AUPNVMED(BHSMX,0),U,3)
+5 SET BHSIVD=$PIECE($PIECE(^AUPNVSIT(APCHZ,0),U),".")
+6 SET BHSRX=$SELECT($DATA(^PSRX("APCC",BHSMX)):$ORDER(^(BHSMX,0)),1:0)
+7 SET BHSCRN=$SELECT(+BHSRX:$DATA(^PS(55,BHSPAT,"P","CP",BHSRX)),1:0)
+8 SET (X,BHSDTM)=BHSIVD
DO REGDT4^GMTSU
SET BHSDAT=X
+9 SET BHSDC=$PIECE(BHSN,U,8)
SET BHSDYS=$PIECE(BHSN,U,7)
SET BHSQTY=$PIECE(BHSN,U,6)
SET BHSIG=$PIECE(BHSN,U,5)
SET BHSVDF=$PIECE(BHSN,U,3)
SET BHSMFX=+BHSN
+10 IF BHSDYS=""
SET BHSDYS=30
+11 ;Q:X>60&(X>(2*BHSDYS))
SET X1=DT
SET X2=BHSDTM
DO ^%DTC
+12 SET BHSEXP=""
+13 IF X>BHSDYS
SET X1=BHSDTM
SET X2=BHSDYS
DO C^%DTC
DO REGDT4^GMTSU
SET BHSEXP="-- Ran out "_X
+14 SET BHSMED=$SELECT($PIECE(BHSN,U,4)="":$PIECE(^PSDRUG(BHSMFX,0),U,1),1:$PIECE(BHSN,U,4))
+15 IF BHSDC
SET X=BHSDC
DO REGDT4^GMTSU
SET BHSEXP="-- D/C "_X
+16 ;CHANGE IT AROUND A BIT LOOK FOR RETURNED TO STOCK IHS/OKCAO/POC 2/14/2000
+17 SET APCHORTS=$GET(^AUPNVMED(BHSMX,11))
+18 IF APCHORTS["RETURNED TO STOCK"
IF BHSDC
SET BHSEXP="--RTS "_Y
+19 ;END OF LOCAL CHANGES IHS/OKCAO/POC 2/14/2000
+20 DO SIG
SET BHSIG=BHSSGY
+21 DO REF
IF BHSREF
SET BHSIG=BHSIG_" "_BHSREF_$SELECT(BHSREF=1:" refill",1:" refills")_" left."
+22 ;I BHSITE]"" S BHSIG=BHSIG_" ["_BHSITE_"]"
DO SITE
+23 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+24 WRITE BHSDAT,?10,$SELECT(BHSCRN:"(C)",1:""),?14,BHSMED," #",BHSQTY," (",BHSDYS," days) ",BHSEXP,!
+25 ;Patch 8 Add Rxnorm code here
+26 SET RXNORM=$$GET1^DIQ(50,BHSMFX,9999999.27)
+27 IF RXNORM'=""
WRITE ?14,"RxNorm: ",RXNORM,!
+28 IF BHSITE]""
WRITE ?14,"Dispensed at: ",BHSITE,!
+29 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+30 SET BHSICL=14
SET BHSNRQ=""
SET BHSTXT=BHSIG
DO PRTTXT^BHSUTL
KILL BHSICL,BHSNRQ,BHSP
+31 SET BHSORD=$$GET1^DIQ(52,BHSRX,39.3,"I")
+32 IF +BHSORD
DO RECON^BHSMED(BHSORD,"M")
+33 IF '$TEST
Begin DoDot:1
+34 NEW NVA
+35 SET NVA=+$PIECE(APCHORTS,U,8)
+36 IF NVA'=""
Begin DoDot:2
+37 SET BHSORD=$PIECE($GET(^PS(55,DFN,"NVA",NVA,0)),U,8)
+38 DO RECON^BHSMED(BHSORD,"M")
End DoDot:2
End DoDot:1
+39 QUIT
+40 ;
NVADSP ;
+1 SET BHSEXP=""
+2 SET (X,BHSDTM)=-BHSIVD\1+9999999
DO REGDT4^GMTSU
SET BHSDAT=X
+3 SET BHSDC=$PIECE(^TMP($JOB,"BHSMTP",BHSIVD),U,5)
+4 SET BHSMED=$PIECE(^TMP($JOB,"BHSMTP",BHSIVD),U,3)
+5 IF BHSDC
SET Y=BHSDC
DO REGDT4^GMTSU
SET BHSEXP="-- D/C "_Y
+6 SET BHSIG=$PIECE(^TMP($JOB,"BHSMTP",BHSIVD),U,4)
+7 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+8 WRITE BHSDAT,?14,BHSMED," ",BHSEXP,!
+9 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+10 SET BHSICL=14
SET BHSNRQ=""
SET BHSTXT=BHSIG_" (EHR OUTSIDE MEDICATION)"
DO PRTTXT^BHSUTL
KILL BHSICL,BHSNRQ,BHSP
+11 QUIT
SIG ;CONSTRUCT THE FULL TEXT FROM THE ENCODED SIG
+1 ;I $$VALI^XBDIQ1(9001015,BHSTYP,3.5)="S" S BHSSGY=BHSIG Q
+2 SET BHSSGY=""
FOR BHSP=1:1:$LENGTH(BHSIG," ")
SET X=$PIECE(BHSIG," ",BHSP)
IF X]""
Begin DoDot:1
+3 SET Y=$ORDER(^PS(51,"B",X,0))
IF Y>0
SET X=$PIECE(^PS(51,Y,0),"^",2)
IF $DATA(^(9))
SET Y=$PIECE(BHSIG," ",BHSP-1)
SET Y=$EXTRACT(Y,$LENGTH(Y))
IF Y>1
SET X=$PIECE(^(9),"^",1)
+4 SET BHSSGY=BHSSGY_X_" "
End DoDot:1
+5 QUIT
+6 ;
REF ;DETERMINE THE NUMBER OF REFILLS REMAINING
+1 IF 'BHSRX
SET BHSREF=0
QUIT
+2 SET BHSRFL=$PIECE($GET(^PSRX(BHSRX,0)),U,9)
SET BHSREF=0
FOR
SET BHSREF=$ORDER(^PSRX(BHSRX,1,BHSREF))
IF 'BHSREF
QUIT
SET BHSRFL=BHSRFL-1
+3 SET BHSREF=BHSRFL
+4 QUIT
+5 ;
SITE ;DETERMINE IF OUTSIDE LOCATION INFO PRESENT
+1 SET BHSITE=""
+2 IF $DATA(^AUPNVSIT(BHSVDF,21))#2
SET BHSITE=$PIECE(^(21),U)
QUIT
+3 IF $PIECE(^AUPNVSIT(BHSVDF,0),U,6)=""
QUIT
+4 IF $PIECE(^AUPNVSIT(BHSVDF,0),U,6)'=DUZ(2)
SET BHSITE=$EXTRACT($PIECE(^DIC(4,$PIECE(^AUPNVSIT(BHSVDF,0),U,6),0),U),1,30)
+5 QUIT