LRUPQ1 ;AVAMC/REG - LAB RESULTS BY ACCESSION AREA (COND'T) ;3/8/94 09:03 ;
;;5.2;LAB SERVICE;;Sep 27, 1994
S X=$S($D(^LRO(68,LR,1,LRAD,1,N,5,1,0)):^(0),1:""),C(3)=+X S:'C(3) C(3)=LRU S C(2)=$P(X,"^",2) S:'C(2) C(2)=LRU(1)
Q:'$D(^LRO(68,LR,1,LRAD,1,N,0)) S X=^(0),LRDFN=+X,A(3)=$P(X,"^",3),A(7)=$P(X,"^",7) Q:'$D(^(3)) S X=^(3),LRI=$P(X,"^",5),(Y,A(3))=$S($P(X,"^",3):$P(X,"^",3),1:A(3)) D:Y T S M=Y
I '$D(^LR(LRDFN,0)) W !,$J(N,7),?11,"Entry not in lab results file" Q
S Y=$P(^LR(LRDFN,LR(3),LRI,0),"^",3) D:Y T S M(1)=Y
D:$Y>(IOSL-6) H^LRUPQ Q:LR("Q") W !,$J(N,5) S X=^LR(LRDFN,0),Y=$P(X,"^",3),(LRDPF,X)=$P(X,"^",2),P(0)=$P(^DIC(X,0),"^"),X=^DIC(X,0,"GL")
S X=@(X_Y_",0)"),SSN=$P(X,"^",9),LRP=$P(X,"^") D SSN^LRU
W ?7 W:P(0)'="PATIENT" "#" W $E(LRP,1,20),?28,SSN(1),?34,$E(A(7),1,5)
I '$D(^LR(LRDFN,LR(3),LRI,0)) W ?40,"Not in lab results file" Q
W ?41,$S(C(2)>0&(P(0)="STERILIZER"!(P(0)="ENVIRONMENTAL")):$E($P(^LAB(62,C(2),0),"^"),1,14),$D(^LAB(61,C(3),0)):$E($P(^(0),"^"),1,13),1:""),?56,M,?68,M(1)
W S Z=0 F A=0:1 S Z=$O(^LRO(68,LR,1,LRAD,1,N,4,Z)) Q:'Z!(LR("Q")) W:'A !?7,"Test(s): " S Z(3)=^(Z,0) D:+Z(3) L
F Z=2,3,8,7,6,5,19,18,17,15,4,11,12,10,9,14,13,16 I $D(^LR(LRDFN,"CH",LRI,Z)) S LR(5)=^(Z) D:$Y>(IOSL-6) H Q:LR("Q") W !,$E($P(^DD(63.04,Z,0),"^"),1,20),?21,$J($P(LR(5),"^"),7)
S Z=19 F A=0:1 S Z=$O(^LR(LRDFN,"CH",LRI,Z)) Q:'Z!(LR("Q")) S LR(5)=^(Z) D:$Y>(IOSL-6) H Q:LR("Q") W !,$E($P(^DD(63.04,Z,0),"^"),1,20),?21,$J($P(LR(5),"^"),7)
Q
L W:$X>(IOM-7) ! W " ",$P(^LAB(60,Z,.1),"^") Q
;
H D H^LRUPQ Q:LR("Q") W !,LR(4),!,LRP," ",SSN," (continued from pg ",LRQ-1,")" Q
T S Y=Y_"000",Y=$E(Y,4,5)_"/"_$E(Y,6,7)_" "_$S(Y[".":$E(Y,9,10)_":"_$E(Y,11,12),1:"") Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLRUPQ1 1713 printed Nov 22, 2024@17:32:04 Page 2
LRUPQ1 ;AVAMC/REG - LAB RESULTS BY ACCESSION AREA (COND'T) ;3/8/94 09:03 ;
+1 ;;5.2;LAB SERVICE;;Sep 27, 1994
+2 SET X=$SELECT($DATA(^LRO(68,LR,1,LRAD,1,N,5,1,0)):^(0),1:"")
SET C(3)=+X
if 'C(3)
SET C(3)=LRU
SET C(2)=$PIECE(X,"^",2)
if 'C(2)
SET C(2)=LRU(1)
+3 if '$DATA(^LRO(68,LR,1,LRAD,1,N,0))
QUIT
SET X=^(0)
SET LRDFN=+X
SET A(3)=$PIECE(X,"^",3)
SET A(7)=$PIECE(X,"^",7)
if '$DATA(^(3))
QUIT
SET X=^(3)
SET LRI=$PIECE(X,"^",5)
SET (Y,A(3))=$SELECT($PIECE(X,"^",3):$PIECE(X,"^",3),1:A(3))
if Y
DO T
SET M=Y
+4 IF '$DATA(^LR(LRDFN,0))
WRITE !,$JUSTIFY(N,7),?11,"Entry not in lab results file"
QUIT
+5 SET Y=$PIECE(^LR(LRDFN,LR(3),LRI,0),"^",3)
if Y
DO T
SET M(1)=Y
+6 if $Y>(IOSL-6)
DO H^LRUPQ
if LR("Q")
QUIT
WRITE !,$JUSTIFY(N,5)
SET X=^LR(LRDFN,0)
SET Y=$PIECE(X,"^",3)
SET (LRDPF,X)=$PIECE(X,"^",2)
SET P(0)=$PIECE(^DIC(X,0),"^")
SET X=^DIC(X,0,"GL")
+7 SET X=@(X_Y_",0)")
SET SSN=$PIECE(X,"^",9)
SET LRP=$PIECE(X,"^")
DO SSN^LRU
+8 WRITE ?7
if P(0)'="PATIENT"
WRITE "#"
WRITE $EXTRACT(LRP,1,20),?28,SSN(1),?34,$EXTRACT(A(7),1,5)
+9 IF '$DATA(^LR(LRDFN,LR(3),LRI,0))
WRITE ?40,"Not in lab results file"
QUIT
+10 WRITE ?41,$SELECT(C(2)>0&(P(0)="STERILIZER"!(P(0)="ENVIRONMENTAL")):$EXTRACT($PIECE(^LAB(62,C(2),0),"^"),1,14),$DATA(^LAB(61,C(3),0)):$EXTRACT($PIECE(^(0),"^"),1,13),1:""),?56,M,?68,M(1)
W SET Z=0
FOR A=0:1
SET Z=$ORDER(^LRO(68,LR,1,LRAD,1,N,4,Z))
if 'Z!(LR("Q"))
QUIT
if 'A
WRITE !?7,"Test(s): "
SET Z(3)=^(Z,0)
if +Z(3)
DO L
+1 FOR Z=2,3,8,7,6,5,19,18,17,15,4,11,12,10,9,14,13,16
IF $DATA(^LR(LRDFN,"CH",LRI,Z))
SET LR(5)=^(Z)
if $Y>(IOSL-6)
DO H
if LR("Q")
QUIT
WRITE !,$EXTRACT($PIECE(^DD(63.04,Z,0),"^"),1,20),?21,$JUSTIFY($PIECE(LR(5),"^"),7)
+2 SET Z=19
FOR A=0:1
SET Z=$ORDER(^LR(LRDFN,"CH",LRI,Z))
if 'Z!(LR("Q"))
QUIT
SET LR(5)=^(Z)
if $Y>(IOSL-6)
DO H
if LR("Q")
QUIT
WRITE !,$EXTRACT($PIECE(^DD(63.04,Z,0),"^"),1,20),?21,$JUSTIFY($PIECE(LR(5),"^"),7)
+3 QUIT
L if $X>(IOM-7)
WRITE !
WRITE " ",$PIECE(^LAB(60,Z,.1),"^")
QUIT
+1 ;
H DO H^LRUPQ
if LR("Q")
QUIT
WRITE !,LR(4),!,LRP," ",SSN," (continued from pg ",LRQ-1,")"
QUIT
T SET Y=Y_"000"
SET Y=$EXTRACT(Y,4,5)_"/"_$EXTRACT(Y,6,7)_" "_$SELECT(Y[".":$EXTRACT(Y,9,10)_":"_$EXTRACT(Y,11,12),1:"")
QUIT