BSDAPI5 ; cmi/anch/maw - PCC API FOR RPMS (con't)[ 03/24/2005 1:44 PM ]
;;5.3;PIMS;**1009,1015**;MAY 28, 2004;Build 21
;
;cmi/anch/maw 06/10/2008 PATCH 1009 requirement 58 added logic to display visits and let user select
;
SELECT(BSDT,BSDV) ; SELECT EXISTING VISIT
W !!,"PATIENT: ",$P(^DPT(BSDT("PAT"),0),U)," has one or more VISITs on this date.",!,"If one of these is your visit, please select it",!
K BSDV1 S (BSDVC,BSDVA,BSDVX)="",BSDV1=0 F S BSDV1=$O(BSDV(BSDV1)) Q:BSDV1'=+BSDV1 D
. S BSDVX=$G(^AUPNVSIT(BSDV1,0)),BSDVX11=$G(^AUPNVSIT(BSDV1,11)) D WRITE
S BSDVC=BSDVC+1 W !,BSDVC," Create New Visit",!
K DIR
S DIR(0)="N^1:"_BSDVC,DIR("A")="Select" KILL DA D ^DIR KILL DIR
I $D(DIRUT) K BSDTMP("CALLER") S BSDIN("FORCE ADD")=1 Q ;kill caller variable so force add happens
I BSDVC=Y K BSDTMP("CALLER") S BSDIN("FORCE ADD")=1 Q ;kill caller variable so force add happens
S BSDR("VIEN")=BSDVX1(Y)
K BSDT,APCDALVR,BSDVX1,BSDVX11 ;ihs/cmi/maw 06/05/2012 added because hanging around
Q
;
WRITE ; WRITE VISITS FOR SELECT
S BSDVC=BSDVC+1,BSDVX1(BSDVC)=BSDV1
S BSDVLT=$P(+BSDVX,".",2),BSDVLT=$S(BSDVLT="":"<NONE>",$L(BSDVLT)=1:BSDVLT_"0:00 ",1:$E(BSDVLT,1,2)_":"_$E(BSDVLT,3,4)_$E("00",1,2-$L($E(BSDVLT,3,4)))_" ")
S BSDVLOC=""
I $P(BSDVX,U,6),$D(^AUTTLOC($P(BSDVX,U,6),0)) S BSDVLOC=$P(^(0),U,7),BSDVLOC=BSDVLOC_$E(" ",1,4-$L(BSDVLOC))
S:BSDVLOC="" BSDVLOC="...."
W !,BSDVC," TIME: ",BSDVLT,"LOC: ",BSDVLOC," TYPE: ",$P(BSDVX,U,3)," CAT: ",$P(BSDVX,U,7)," CLINIC: ",$S($P(BSDVX,U,8)]"":$E($P(^DIC(40.7,$P(BSDVX,U,8),0),U),1,8),1:"<NONE>") D
.W ?57,"DEC: ",$S($P(BSDVX,U,9):$P(BSDVX,U,9),1:0),$S($P(BSDVX11,U,3)]"":" VCN:"_$P(BSDVX11,U,3),1:"")
.I $P(BSDVX,U,22) W !?3,"Hospital Location: ",$P($G(^SC($P(BSDVX,U,22),0)),U)
.S BSDVPRV=$$PRIMPROV^APCLV(BSDV1,"N") I BSDVPRV]"" W !?3,"Provider on Visit: ",BSDVPRV
K BSDVLT,BSDVLOC,BSDVPRV
Q
;
BSDAPI5 ; cmi/anch/maw - PCC API FOR RPMS (con't)[ 03/24/2005 1:44 PM ]
+1 ;;5.3;PIMS;**1009,1015**;MAY 28, 2004;Build 21
+2 ;
+3 ;cmi/anch/maw 06/10/2008 PATCH 1009 requirement 58 added logic to display visits and let user select
+4 ;
SELECT(BSDT,BSDV) ; SELECT EXISTING VISIT
+1 WRITE !!,"PATIENT: ",$PIECE(^DPT(BSDT("PAT"),0),U)," has one or more VISITs on this date.",!,"If one of these is your visit, please select it",!
+2 KILL BSDV1
SET (BSDVC,BSDVA,BSDVX)=""
SET BSDV1=0
FOR
SET BSDV1=$ORDER(BSDV(BSDV1))
IF BSDV1'=+BSDV1
QUIT
Begin DoDot:1
+3 SET BSDVX=$GET(^AUPNVSIT(BSDV1,0))
SET BSDVX11=$GET(^AUPNVSIT(BSDV1,11))
DO WRITE
End DoDot:1
+4 SET BSDVC=BSDVC+1
WRITE !,BSDVC," Create New Visit",!
+5 KILL DIR
+6 SET DIR(0)="N^1:"_BSDVC
SET DIR("A")="Select"
KILL DA
DO ^DIR
KILL DIR
+7 ;kill caller variable so force add happens
IF $DATA(DIRUT)
KILL BSDTMP("CALLER")
SET BSDIN("FORCE ADD")=1
QUIT
+8 ;kill caller variable so force add happens
IF BSDVC=Y
KILL BSDTMP("CALLER")
SET BSDIN("FORCE ADD")=1
QUIT
+9 SET BSDR("VIEN")=BSDVX1(Y)
+10 ;ihs/cmi/maw 06/05/2012 added because hanging around
KILL BSDT,APCDALVR,BSDVX1,BSDVX11
+11 QUIT
+12 ;
WRITE ; WRITE VISITS FOR SELECT
+1 SET BSDVC=BSDVC+1
SET BSDVX1(BSDVC)=BSDV1
+2 SET BSDVLT=$PIECE(+BSDVX,".",2)
SET BSDVLT=$SELECT(BSDVLT="":"<NONE>",$LENGTH(BSDVLT)=1:BSDVLT_"0:00 ",1:$EXTRACT(BSDVLT,1,2)_":"_$EXTRACT(BSDVLT,3,4)_$EXTRACT("00",1,2-$LENGTH($EXTRACT(BSDVLT,3,4)))_" ")
+3 SET BSDVLOC=""
+4 IF $PIECE(BSDVX,U,6)
IF $DATA(^AUTTLOC($PIECE(BSDVX,U,6),0))
SET BSDVLOC=$PIECE(^(0),U,7)
SET BSDVLOC=BSDVLOC_$EXTRACT(" ",1,4-$LENGTH(BSDVLOC))
+5 IF BSDVLOC=""
SET BSDVLOC="...."
+6 WRITE !,BSDVC," TIME: ",BSDVLT,"LOC: ",BSDVLOC," TYPE: ",$PIECE(BSDVX,U,3)," CAT: ",$PIECE(BSDVX,U,7)," CLINIC: ",$SELECT($PIECE(BSDVX,U,8)]"":$EXTRACT($PIECE(^DIC(40.7,$PIECE(BSDVX,U,8),0),U),1,8),1:"<NONE>")
Begin DoDot:1
+7 WRITE ?57,"DEC: ",$SELECT($PIECE(BSDVX,U,9):$PIECE(BSDVX,U,9),1:0),$SELECT($PIECE(BSDVX11,U,3)]"":" VCN:"_$PIECE(BSDVX11,U,3),1:"")
+8 IF $PIECE(BSDVX,U,22)
WRITE !?3,"Hospital Location: ",$PIECE($GET(^SC($PIECE(BSDVX,U,22),0)),U)
+9 SET BSDVPRV=$$PRIMPROV^APCLV(BSDV1,"N")
IF BSDVPRV]""
WRITE !?3,"Provider on Visit: ",BSDVPRV
End DoDot:1
+10 KILL BSDVLT,BSDVLOC,BSDVPRV
+11 QUIT
+12 ;