LRBLPRA ; IHS/DIR/FJE - BB PT RECORD 2/18/93 09:46 ;
;;5.2;LR;;NOV 01, 1997
;
;;5.2;LAB SERVICE;;Sep 27, 1994
I LR(7),'$O(^LR(A,1.7,0)),'$O(^LR(A,3,0)) Q
S W=^LR(A,0),Y=$P(W,"^",3),P=$P(W,"^",2),X=^DIC(P,0,"GL") Q:'$D(@(X_Y_",0)")) S X=^(0),^TMP("LRBL",$J,P,$P(X,"^"),A)=$P(X,"^",3)_"^"_$P(X,"^",9)_"^"_$P(W,"^",5)_"^"_$P(W,"^",6) Q
;
EN D END S X="BLOOD BANK" D ^LRUTL G:Y=-1 END
W !!?20,"PRINT PATIENT BLOOD BANK RECORDS",!!
W "Print only patients with antibodies/special instructions " S %=1,LR(7)=0 D YN^LRU G:%<1 END I %=1 S LR(7)=1
ASK W !!,"Enter the maximum number of specimens to display",!,"in reverse chronological order for each patient: " R LR(8):DTIME Q:LR(8)=""!(LR(8)[U)
I LR(8)'?1N.N!(LR(8)<0)!(LR(8)>99) W $C(7),!,"ENTER A WHOLE NUMBER FROM 0-99" G ASK
S R !!,"START WITH PATIENT NAME: FIRST// ",X:DTIME G:X[U!'$T END I X="" S P(1)=0,P(2)="z" G T
I X["?"!(X'?1U.E)!($L(X)>30) D H^LRU G S
S P(1)=X I $L(X)>1 S X(1)=$A(X,$L(X))-1,X(1)=$C(X(1)),P(1)=$E(X,1,$L(X)-1)_X(1)
F R !,"GO TO PATIENT NAME: LAST// ",X:DTIME G:X[U!'$T END I X="" S P(2)="z" G T
I X["?"!(X'?1U.E)!($L(X)>30) D H1^LRU G F
S P(2)=X
T S ZTRTN="QUE^LRBLPRA" D BEG^LRUTL G:POP!($D(ZTSK)) END
QUE U IO K ^TMP("LRBL",$J) D L^LRU,S^LRU
F A=0:0 S A=$O(^LR(A)) Q:'A I $D(^(A,1.7))!($D(^(3)))!($D(^("BB"))) D LRBLPRA
D H^LRBLPR S LR("F")=1
F LR=0:0 S LR=$O(^TMP("LRBL",$J,LR)) Q:'LR!(LR("Q")) S LRP=P(1) F LR(1)=0:0 S LRP=$O(^TMP("LRBL",$J,LR,LRP)) Q:LRP=""!(LRP]P(2))!(LR("Q")) D B
K ^TMP("LRBL",$J),^TMP($J) D END^LRUTL,END Q
;
B F LRDFN=0:0 S LRDFN=$O(^TMP("LRBL",$J,LR,LRP,LRDFN)) Q:'LRDFN!(LR("Q")) S LR(4)=^(LRDFN) D W
Q
W ;D:$Y>(IOSL-6) H^LRBLPR Q:LR("Q") S LRDPF=$P(^LR(LRDFN,0),U,2),Y=+LR(4),SSN=$P(LR(4),"^",2) D SSN^LRU,D^LRU W !,LRP,?31,SSN,?43,Y,?56,$J($P(LR(4),"^",3),2),?59,$P(LR(4),"^",4) D ^LRBLPR1 Q
D:$Y>(IOSL-6) H^LRBLPR Q:LR("Q") S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3),Y=+LR(4),SSN=$P(LR(4),"^",2) D SSN^LRU,D^LRU W !,LRP,?31,SSN,?43,Y,?56,$J($P(LR(4),"^",3),2),?59,$P(LR(4),"^",4) D ^LRBLPR1 Q ;IHS/ANMC/CLS 11/1/95
;
END D V^LRU Q
LRBLPRA ; IHS/DIR/FJE - BB PT RECORD 2/18/93 09:46 ;
+1 ;;5.2;LR;;NOV 01, 1997
+2 ;
+3 ;;5.2;LAB SERVICE;;Sep 27, 1994
+4 IF LR(7)
IF '$ORDER(^LR(A,1.7,0))
IF '$ORDER(^LR(A,3,0))
QUIT
+5 SET W=^LR(A,0)
SET Y=$PIECE(W,"^",3)
SET P=$PIECE(W,"^",2)
SET X=^DIC(P,0,"GL")
IF '$DATA(@(X_Y_",0)"))
QUIT
SET X=^(0)
SET ^TMP("LRBL",$JOB,P,$PIECE(X,"^"),A)=$PIECE(X,"^",3)_"^"_$PIECE(X,"^",9)_"^"_$PIECE(W,"^",5)_"^"_$PIECE(W,"^",6)
QUIT
+6 ;
EN DO END
SET X="BLOOD BANK"
DO ^LRUTL
IF Y=-1
GOTO END
+1 WRITE !!?20,"PRINT PATIENT BLOOD BANK RECORDS",!!
+2 WRITE "Print only patients with antibodies/special instructions "
SET %=1
SET LR(7)=0
DO YN^LRU
IF %<1
GOTO END
IF %=1
SET LR(7)=1
ASK WRITE !!,"Enter the maximum number of specimens to display",!,"in reverse chronological order for each patient: "
READ LR(8):DTIME
IF LR(8)=""!(LR(8)[U)
QUIT
+1 IF LR(8)'?1N.N!(LR(8)<0)!(LR(8)>99)
WRITE $CHAR(7),!,"ENTER A WHOLE NUMBER FROM 0-99"
GOTO ASK
S READ !!,"START WITH PATIENT NAME: FIRST// ",X:DTIME
IF X[U!'$TEST
GOTO END
IF X=""
SET P(1)=0
SET P(2)="z"
GOTO T
+1 IF X["?"!(X'?1U.E)!($LENGTH(X)>30)
DO H^LRU
GOTO S
+2 SET P(1)=X
IF $LENGTH(X)>1
SET X(1)=$ASCII(X,$LENGTH(X))-1
SET X(1)=$CHAR(X(1))
SET P(1)=$EXTRACT(X,1,$LENGTH(X)-1)_X(1)
F READ !,"GO TO PATIENT NAME: LAST// ",X:DTIME
IF X[U!'$TEST
GOTO END
IF X=""
SET P(2)="z"
GOTO T
+1 IF X["?"!(X'?1U.E)!($LENGTH(X)>30)
DO H1^LRU
GOTO F
+2 SET P(2)=X
T SET ZTRTN="QUE^LRBLPRA"
DO BEG^LRUTL
IF POP!($DATA(ZTSK))
GOTO END
QUE USE IO
KILL ^TMP("LRBL",$JOB)
DO L^LRU
DO S^LRU
+1 FOR A=0:0
SET A=$ORDER(^LR(A))
IF 'A
QUIT
IF $DATA(^(A,1.7))!($DATA(^(3)))!($DATA(^("BB")))
DO LRBLPRA
+2 DO H^LRBLPR
SET LR("F")=1
+3 FOR LR=0:0
SET LR=$ORDER(^TMP("LRBL",$JOB,LR))
IF 'LR!(LR("Q"))
QUIT
SET LRP=P(1)
FOR LR(1)=0:0
SET LRP=$ORDER(^TMP("LRBL",$JOB,LR,LRP))
IF LRP=""!(LRP]P(2))!(LR("Q"))
QUIT
DO B
+4 KILL ^TMP("LRBL",$JOB),^TMP($JOB)
DO END^LRUTL
DO END
QUIT
+5 ;
B FOR LRDFN=0:0
SET LRDFN=$ORDER(^TMP("LRBL",$JOB,LR,LRP,LRDFN))
IF 'LRDFN!(LR("Q"))
QUIT
SET LR(4)=^(LRDFN)
DO W
+1 QUIT
W ;D:$Y>(IOSL-6) H^LRBLPR Q:LR("Q") S LRDPF=$P(^LR(LRDFN,0),U,2),Y=+LR(4),SSN=$P(LR(4),"^",2) D SSN^LRU,D^LRU W !,LRP,?31,SSN,?43,Y,?56,$J($P(LR(4),"^",3),2),?59,$P(LR(4),"^",4) D ^LRBLPR1 Q
+1 ;IHS/ANMC/CLS 11/1/95
IF $Y>(IOSL-6)
DO H^LRBLPR
IF LR("Q")
QUIT
SET LRDPF=$PIECE(^LR(LRDFN,0),U,2)
SET DFN=$PIECE(^(0),U,3)
SET Y=+LR(4)
SET SSN=$PIECE(LR(4),"^",2)
DO SSN^LRU
DO D^LRU
WRITE !,LRP,?31,SSN,?43,Y,?56,$JUSTIFY($PIECE(LR(4),"^",3),2),?59,$PIECE(LR(4),"^",4)
DO ^LRBLPR1
QUIT
+2 ;
END DO V^LRU
QUIT