LRBLPTR ; IHS/DIR/FJE - TRANSFUSION DATA REPORT 2/18/93 09:47 ;
;;5.2;LR;;NOV 01, 1997
;
;;5.2;LAB SERVICE;;Sep 27, 1994
D END W !?30,"Transfusion data report"
D B^LRBLU G:Y<0 END S LRSDT=LRSDT-.0001,LRLDT=$S(LRLDT'[".":LRLDT+.99,1:LRLDT),LRG=0
W !!,"Also print transfusions with hematology results " S %=2 D YN^LRU G:%<1 END S:%=1 LRG=1
S ZTRTN="QUE^LRBLPTR" D BEG^LRUTL G:POP!($D(ZTSK)) END
QUE U IO K ^TMP($J),^TMP("LRBL",$J) D L^LRU,S^LRU,H S LR("F")=1
F LRD=LRSDT:0 S LRD=$O(^LRD(65,"AB",LRD)) Q:'LRD!(LRD>LRLDT) F LRI=0:0 S LRI=$O(^LRD(65,"AB",LRD,LRI)) Q:'LRI I $D(^LRD(65,LRI,6)),$P(^(6),"^") S W(6)=^(6),W(4)=^(4),W(0)=^(0),C=$P(W(0),"^",4) D SET
F P=0:0 S P=$O(^TMP($J,P)) Q:'P D PT
;S LRP=0 F S LRP=$O(^TMP($J,"B",LRP)) Q:LRP=""!(LR("Q")) F P=0:0 S P=$O(^TMP($J,"B",LRP,P)) Q:'P!(LR("Q")) S SSN=^(P) D W
S LRP=0 F S LRP=$O(^TMP($J,"B",LRP)) Q:LRP=""!(LR("Q")) F P=0:0 S P=$O(^TMP($J,"B",LRP,P)) Q:'P!(LR("Q")) S HRCN=^(P) D W ;IHS/ANMC/CLS 11/1/95
G:LR("Q") OUT D:$Y>(IOSL-9) H G:LR("Q") OUT W !!,LR("%") F A=0:0 S A=$O(LRC(A)) Q:'A D:$Y>(IOSL-6) H Q:LR("Q") S X=^LAB(66,A,0) W !?2,$P(X,"^",2),?8,"=",$P(X,"^")
OUT D:LRG&('LR("Q")) ^LRBLPTR1 D END,END^LRUTL Q
W ;D:$Y>(IOSL-6) H Q:LR("Q") S (LRE,LRF)="" W !!,"Patient: ",LRP,?41,"SSN: ",SSN D:$O(^LR(P,1.9,0)) B Q:LR("Q")
D:$Y>(IOSL-6) H Q:LR("Q") S (LRE,LRF)="" W !!,"Patient: ",LRP,?41,"HRCN: ",HRCN D:$O(^LR(P,1.9,0)) B Q:LR("Q") ;IHS/ANMC/CLS 11/1/95
F C=0:0 S C=$O(^TMP($J,P,C)) Q:'C!(LR("Q")) S C(1)=$P(^LAB(66,C,0),"^",2),LRC(C)="",LRD=0 F LRJ=0:1 S LRD=$O(^TMP($J,P,C,LRD)) Q:'LRD!(LR("Q")) S:'LRJ LRE=LRD D W1
I LRG S X1=$P(LRE,"."),X2=-1 D C^%DTC S LRE=X,X1=$P(LRF,"."),X2=1 D C^%DTC S ^TMP("LRBL",$J,LRP,P)=LRE_"^"_X
Q
W1 F LRI=0:0 S LRI=$O(^TMP($J,P,C,LRD,LRI)) Q:'LRI!(LR("Q")) S W=^(LRI) D P
I LRG S:LRD<LRE LRE=LRD S:LRD>LRF LRF=LRD
Q
P D:$Y>(IOSL-6) H1 Q:LR("Q") W !,$P(W,"^"),?13,C(1),?18,$P(W,"^",8),?23,$P(W,"^",9),?28,$P(W,"^",2),?43,$P(W,"^",4),?46,$P(W,"^",5),?52,$P(W,"^",6),?62,$P(W,"^",3),?77,$P(W,"^",7)
W:$D(^LAB(65.4,+$P(W,"^",10),0)) !?2,"Transfusion reaction type: ",$P(^(0),"^")
F W=0:0 S W=$O(^LRD(65,LRI,7,W)) Q:'W!(LR("Q")) S W(1)=^(W,0) D:$Y>(IOSL-6) H1 Q:LR("Q") W !?2,W(1)
Q
SET I LRD'=$P(W(4),"^",2) K ^LRD(65,"AB",LRD,LRI) Q
S W(3)=$O(^LRD(65,LRI,3,0)) S:W(3) W(3)=^(W(3),0)
S J=$P(W(3),"^",2),L=$S($P(W(3),"^",4)]"":$E($P(W(3),"^",4),1,9),1:"??"),Y=+W(3) D D S Y(1)=Y,Y=LRD D D S Y(2)=Y,Y=$P(W(3),"^",3) I Y,$D(^VA(200,Y,0)) S Y=$P(^(0),"^",2)
S X=$P(W(6),"^",5),^TMP($J,+W(6),C,LRD,LRI)=$P(W(0),"^")_"^"_Y(1)_"^"_Y(2)_"^"_J_"^"_Y_"^"_L_"^"_$S(X=0:"NO",X=1:"YES",1:"")_"^"_$P(W(4),"^",4)_"^"_$P(W(0),"^",11)_"^"_$P(W(6),"^",8) Q
PT ;S X=^LR(P,0),Y=$P(X,"^",3),LRDPF=$P(X,U,2),X=^DIC(LRDPF,0,"GL"),Y=@(X_Y_",0)"),LRP=$P(Y,"^"),SSN=$P(Y,"^",9) D SSN^LRU S ^TMP($J,"B",LRP,P)=SSN Q
S X=^LR(P,0),(DFN,Y)=$P(X,"^",3),LRDPF=$P(X,U,2),X=^DIC(LRDPF,0,"GL"),Y=@(X_Y_",0)"),LRP=$P(Y,"^"),SSN=$P(Y,"^",9) D SSN^LRU S ^TMP($J,"B",LRP,P)=HRCN Q ;IHS/ANMC/CLS 11/1/95
B S A=0 F C=0:1 S A=$O(^LR(P,1.9,A)) Q:'A!(LR("Q")) S LR(1.9)=^(A,0) D:$Y>(IOSL-6) H1 Q:LR("Q") D:'C L S Y=+LR(1.9) D D^LRU S LRK=Y,LRR=$P($G(^LAB(65.4,+$P(LR(1.9),U,2),0)),U) W !,Y,?21,LRR D A
Q
A F B=0:0 S B=$O(^LR(P,1.9,A,1,B)) Q:'B!(LR("Q")) S B(1)=^(B,0) D:$Y>(IOSL-6) H2 Q:LR("Q") W !,B(1)
Q
;
H I $D(LR("F")),IOST?1"C".E D M^LRU Q:LR("Q")
D F^LRU W !,"TRANSFUSION DATA REPORT FROM ",LRSTR," TO ",LRLST
W !,"Unit ID",?13,"Comp",?19,"(#)",?23,"(ml)",?28,"Relocated",?43,"CK",?46,"By",?52,"Location",?62,"Transfused",?77,"RXN"
W !,LR("%") Q
H1 ;D H Q:LR("Q") W !!,"Patient: ",LRP,?41,"SSN: ",SSN Q
D H Q:LR("Q") W !!,"Patient: ",LRP,?41,"HRCN: ",HRCN Q ;IHS/ANMC/CLS 11/1/95
H2 D H1 Q:LR("Q") D L W !,LRK,?21,LRR Q
L W !,"TRANSFUSION REACTIONS WITHOUT UNIT IDENTIFIED" Q
;
D S:'Y Y="" Q:'Y S Y=Y_"000",Y=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3)_$S(Y[".":" "_$E(Y,9,10)_":"_$E(Y,11,12),1:"") Q
END D V^LRU Q
LRBLPTR ; IHS/DIR/FJE - TRANSFUSION DATA REPORT 2/18/93 09:47 ;
+1 ;;5.2;LR;;NOV 01, 1997
+2 ;
+3 ;;5.2;LAB SERVICE;;Sep 27, 1994
+4 DO END
WRITE !?30,"Transfusion data report"
+5 DO B^LRBLU
IF Y<0
GOTO END
SET LRSDT=LRSDT-.0001
SET LRLDT=$SELECT(LRLDT'[".":LRLDT+.99,1:LRLDT)
SET LRG=0
+6 WRITE !!,"Also print transfusions with hematology results "
SET %=2
DO YN^LRU
IF %<1
GOTO END
IF %=1
SET LRG=1
+7 SET ZTRTN="QUE^LRBLPTR"
DO BEG^LRUTL
IF POP!($DATA(ZTSK))
GOTO END
QUE USE IO
KILL ^TMP($JOB),^TMP("LRBL",$JOB)
DO L^LRU
DO S^LRU
DO H
SET LR("F")=1
+1 FOR LRD=LRSDT:0
SET LRD=$ORDER(^LRD(65,"AB",LRD))
IF 'LRD!(LRD>LRLDT)
QUIT
FOR LRI=0:0
SET LRI=$ORDER(^LRD(65,"AB",LRD,LRI))
IF 'LRI
QUIT
IF $DATA(^LRD(65,LRI,6))
IF $PIECE(^(6),"^")
SET W(6)=^(6)
SET W(4)=^(4)
SET W(0)=^(0)
SET C=$PIECE(W(0),"^",4)
DO SET
+2 FOR P=0:0
SET P=$ORDER(^TMP($JOB,P))
IF 'P
QUIT
DO PT
+3 ;S LRP=0 F S LRP=$O(^TMP($J,"B",LRP)) Q:LRP=""!(LR("Q")) F P=0:0 S P=$O(^TMP($J,"B",LRP,P)) Q:'P!(LR("Q")) S SSN=^(P) D W
+4 ;IHS/ANMC/CLS 11/1/95
SET LRP=0
FOR
SET LRP=$ORDER(^TMP($JOB,"B",LRP))
IF LRP=""!(LR("Q"))
QUIT
FOR P=0:0
SET P=$ORDER(^TMP($JOB,"B",LRP,P))
IF 'P!(LR("Q"))
QUIT
SET HRCN=^(P)
DO W
+5 IF LR("Q")
GOTO OUT
IF $Y>(IOSL-9)
DO H
IF LR("Q")
GOTO OUT
WRITE !!,LR("%")
FOR A=0:0
SET A=$ORDER(LRC(A))
IF 'A
QUIT
IF $Y>(IOSL-6)
DO H
IF LR("Q")
QUIT
SET X=^LAB(66,A,0)
WRITE !?2,$PIECE(X,"^",2),?8,"=",$PIECE(X,"^")
OUT IF LRG&('LR("Q"))
DO ^LRBLPTR1
DO END
DO END^LRUTL
QUIT
W ;D:$Y>(IOSL-6) H Q:LR("Q") S (LRE,LRF)="" W !!,"Patient: ",LRP,?41,"SSN: ",SSN D:$O(^LR(P,1.9,0)) B Q:LR("Q")
+1 ;IHS/ANMC/CLS 11/1/95
IF $Y>(IOSL-6)
DO H
IF LR("Q")
QUIT
SET (LRE,LRF)=""
WRITE !!,"Patient: ",LRP,?41,"HRCN: ",HRCN
IF $ORDER(^LR(P,1.9,0))
DO B
IF LR("Q")
QUIT
+2 FOR C=0:0
SET C=$ORDER(^TMP($JOB,P,C))
IF 'C!(LR("Q"))
QUIT
SET C(1)=$PIECE(^LAB(66,C,0),"^",2)
SET LRC(C)=""
SET LRD=0
FOR LRJ=0:1
SET LRD=$ORDER(^TMP($JOB,P,C,LRD))
IF 'LRD!(LR("Q"))
QUIT
IF 'LRJ
SET LRE=LRD
DO W1
+3 IF LRG
SET X1=$PIECE(LRE,".")
SET X2=-1
DO C^%DTC
SET LRE=X
SET X1=$PIECE(LRF,".")
SET X2=1
DO C^%DTC
SET ^TMP("LRBL",$JOB,LRP,P)=LRE_"^"_X
+4 QUIT
W1 FOR LRI=0:0
SET LRI=$ORDER(^TMP($JOB,P,C,LRD,LRI))
IF 'LRI!(LR("Q"))
QUIT
SET W=^(LRI)
DO P
+1 IF LRG
IF LRD<LRE
SET LRE=LRD
IF LRD>LRF
SET LRF=LRD
+2 QUIT
P IF $Y>(IOSL-6)
DO H1
IF LR("Q")
QUIT
WRITE !,$PIECE(W,"^"),?13,C(1),?18,$PIECE(W,"^",8),?23,$PIECE(W,"^",9),?28,$PIECE(W,"^",2),?43,$PIECE(W,"^",4),?46,$PIECE(W,"^",5),?52,$PIECE(W,"^",6),?62,$PIECE(W,"^",3),?77,$PIECE(W,"^",7)
+1 IF $DATA(^LAB(65.4,+$PIECE(W,"^",10),0))
WRITE !?2,"Transfusion reaction type: ",$PIECE(^(0),"^")
+2 FOR W=0:0
SET W=$ORDER(^LRD(65,LRI,7,W))
IF 'W!(LR("Q"))
QUIT
SET W(1)=^(W,0)
IF $Y>(IOSL-6)
DO H1
IF LR("Q")
QUIT
WRITE !?2,W(1)
+3 QUIT
SET IF LRD'=$PIECE(W(4),"^",2)
KILL ^LRD(65,"AB",LRD,LRI)
QUIT
+1 SET W(3)=$ORDER(^LRD(65,LRI,3,0))
IF W(3)
SET W(3)=^(W(3),0)
+2 SET J=$PIECE(W(3),"^",2)
SET L=$SELECT($PIECE(W(3),"^",4)]"":$EXTRACT($PIECE(W(3),"^",4),1,9),1:"??")
SET Y=+W(3)
DO D
SET Y(1)=Y
SET Y=LRD
DO D
SET Y(2)=Y
SET Y=$PIECE(W(3),"^",3)
IF Y
IF $DATA(^VA(200,Y,0))
SET Y=$PIECE(^(0),"^",2)
+3 SET X=$PIECE(W(6),"^",5)
SET ^TMP($JOB,+W(6),C,LRD,LRI)=$PIECE(W(0),"^")_"^"_Y(1)_"^"_Y(2)_"^"_J_"^"_Y_"^"_L_"^"_$SELECT(X=0:"NO",X=1:"YES",1:"")_"^"_$PIECE(W(4),"^",4)_"^"_$PIECE(W(0),"^",11)_"^"_$PIECE(W(6),"^",8)
QUIT
PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">PT ;S X=^LR(PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P,0),Y=$PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P(X,"^",3),LRDPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">PF=$PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P(X,U,2),X=^DIC(LRDPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">PF,0,"GL"),Y=@(X_Y_",0)"),LRPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P=$PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P(Y,"^"),SSN=$PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P(Y,"^",9) D SSN^LRU S ^TMPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P($J,"B",LRPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P,PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P">PTR_source.html#xP">PTR_source.html#xPTR_source.html#xP">P">PTR_source.html#xP">P)=SSN Q
+1 ;IHS/ANMC/CLS 11/1/95
SET X=^LR(P,0)
SET (DFN,Y)=$PIECE(X,"^",3)
SET LRDPF=$PIECE(X,U,2)
SET X=^DIC(LRDPF,0,"GL")
SET Y=@(X_Y_",0)")
SET LRP=$PIECE(Y,"^")
SET SSN=$PIECE(Y,"^",9)
DO SSN^LRU
SET ^TMP($JOB,"B",LRP,P)=HRCN
QUIT
B SET A=0
FOR C=0:1
SET A=$ORDER(^LR(P,1.9,A))
IF 'A!(LR("Q"))
QUIT
SET LR(1.9)=^(A,0)
IF $Y>(IOSL-6)
DO H1
IF LR("Q")
QUIT
IF 'C
DO L
SET Y=+LR(1.9)
DO D^LRU
SET LRK=Y
SET LRR=$PIECE($GET(^LAB(65.4,+$PIECE(LR(1.9),U,2),0)),U)
WRITE !,Y,?21,LRR
DO A
+1 QUIT
A FOR B=0:0
SET B=$ORDER(^LR(P,1.9,A,1,B))
IF 'B!(LR("Q"))
QUIT
SET B(1)=^(B,0)
IF $Y>(IOSL-6)
DO H2
IF LR("Q")
QUIT
WRITE !,B(1)
+1 QUIT
+2 ;
H IF $DATA(LR("F"))
IF IOST?1"C".E
DO M^LRU
IF LR("Q")
QUIT
+1 DO F^LRU
WRITE !,"TRANSFUSION DATA REPORT FROM ",LRSTR," TO ",LRLST
+2 WRITE !,"Unit ID",?13,"Comp",?19,"(#)",?23,"(ml)",?28,"Relocated",?43,"CK",?46,"By",?52,"Location",?62,"Transfused",?77,"RXN"
+3 WRITE !,LR("%")
QUIT
H1 ;D H Q:LR("Q") W !!,"Patient: ",LRP,?41,"SSN: ",SSN Q
+1 ;IHS/ANMC/CLS 11/1/95
DO H
IF LR("Q")
QUIT
WRITE !!,"Patient: ",LRP,?41,"HRCN: ",HRCN
QUIT
H2 DO H1
IF LR("Q")
QUIT
DO L
WRITE !,LRK,?21,LRR
QUIT
L WRITE !,"TRANSFUSION REACTIONS WITHOUT UNIT IDENTIFIED"
QUIT
+1 ;
D IF 'Y
SET Y=""
IF 'Y
QUIT
SET Y=Y_"000"
SET Y=$EXTRACT(Y,4,5)_"/"_$EXTRACT(Y,6,7)_"/"_$EXTRACT(Y,2,3)_$SELECT(Y[".":" "_$EXTRACT(Y,9,10)_":"_$EXTRACT(Y,11,12),1:"")
QUIT
END DO V^LRU
QUIT