LROR2 ; IHS/DIR/FJE - PRINT THE DATA FOR OR REPORTS 3/29/90 16:43 ;
;;5.2;LR;**1013**;JUL 15, 2002
;
;;5.2;LAB SERVICE;;Sep 27, 1994
;from LROR1
PRINT ;;
S LRAAO=0 F I=0:0 S LRAAO=$O(^TMP("LR",$J,"TP",LRAAO)) Q:LRAAO="" D ORDER Q:LREND
K ^TMP("LR",$J,"TP")
Q
ORDER S LRCDT=0 F I=0:0 S LRCDT=$O(^TMP("LR",$J,"TP",LRAAO,LRCDT)) Q:LRCDT="" D TEST Q:LREND
Q
TEST S LRIDT=9999999-LRCDT,LRSS=$P(^TMP("LR",$J,"TP",LRAAO),U,2),LR0=$S($D(^(LRAAO,LRCDT))#2:^(LRCDT),1:""),LRTC=$P(LR0,U,12)
I LRSS="MI" S LRH=1,(LRONETST,LRONESPC)="",LREND=0 D EN^LROR4 S LRHF=1 K A,Z,LRH,LRONETST,LRONESPC S:LREND LREND=0,LREND=1 Q
Q:'$P(LR0,U,3)
S LRSPEC=+$P(LR0,U,5),X=$P(LR0,U,10) D DOC^LRX
I $Y+LRTC+3>IOSL D C1 Q:LREND
S Y=LRCDT D DD^LRX W !,?30,Y
D HEAD
S LRPO=0 F I=0:0 S LRPO=$O(^TMP("LR",$J,"TP",LRAAO,LRCDT,LRPO)) Q:LRPO="" I $D(^(LRPO))#2 S LRDATA=^(LRPO) D DATA Q:LREND
Q:LREND
I $D(^TMP("LR",$J,"TP",LRAAO,LRCDT,"C")) W !,"Comment: " S LRCMNT=0 F I=0:0 S LRCMNT=+$O(^TMP("LR",$J,"TP",LRAAO,LRCDT,"C",LRCMNT)) Q:LRCMNT<1 W ^(LRCMNT) W:$O(^(LRCMNT)) !?9 D CONT Q:LREND
W ! Q
DATA S LRTSTS=+LRDATA,LRPC=$P(LRDATA,U,5),LRSUB=$P(LRDATA,U,6),X=$P(LRDATA,U,7),LRFFLG=$P(LRDATA,U,8) Q:X=""
W !?5,$S($L($P(LRDATA,U,2))>20:$P(LRDATA,U,3),1:$P(LRDATA,U,2)),?27,@$S(LRPC="":"$J(X,LRCW)",1:LRPC)," ",LRFFLG
S X=$S($D(^LAB(60,LRTSTS,1,LRSPEC,0)):^(0),1:"") Q:'$L(X) S LRTHER=$S($L($P(X,U,11,12))>1:1,1:0) S LRLO=$S(LRTHER:$P(X,U,11),1:$P(X,U,2)),LRHI=$S(LRTHER:$P(X,U,12),1:$P(X,U,3))
S @("LRLO="_$S($L(LRLO):LRLO,1:"""""")),@("LRHI="_$S($L(LRHI):LRHI,1:""""""))
W ?38," ",$P(X,U,7),?51,$J(LRLO,4),$S($L(LRHI):" - "_$J(LRHI,4),1:""),?63,$S(LRTHER:"(Ther. range)",1:"") D CONT Q:LREND
I $O(^TMP("LR",$J,"TP",LRAAO,LRCDT,LRPO,0))>0 S LRINTP=0 F I=0:0 S LRINTP=+$O(^TMP("LR",$J,"TP",LRAAO,LRCDT,LRPO,LRINTP)) Q:LRINTP<1 W !?7,"Eval: ",^(LRINTP) D CONT Q:LREND
Q
CONT Q:$Y+4'>IOSL D C1,HEAD:'LREND
Q
C1 F I=$Y:1:IOSL-5 W !
W !?(IOM-26),"Continued on next page..." I IOST["C-" W !!,"Press return to continue or ""^"" to escape " R X:DTIME S:X="^^" DIROUT=1 I '$T!(X["^") S (OREND,LREND)=1 Q
D EXT^ORUHDR Q:LREND W !?20,">> CONTINUATION OF ",$P(LR0,U,6)," <<",!
Q
HEAD W !?5,"Test name",?30,"Result units",?51,"Ref. range"
Q
LROR2 ; IHS/DIR/FJE - PRINT THE DATA FOR OR REPORTS 3/29/90 16:43 ;
+1 ;;5.2;LR;**1013**;JUL 15, 2002
+2 ;
+3 ;;5.2;LAB SERVICE;;Sep 27, 1994
+4 ;from LROR1
PRINT ;;
+1 SET LRAAO=0
FOR I=0:0
SET LRAAO=$ORDER(^TMP("LR",$JOB,"TP",LRAAO))
IF LRAAO=""
QUIT
DO ORDER
IF LREND
QUIT
+2 KILL ^TMP("LR",$JOB,"TP")
+3 QUIT
ORDER SET LRCDT=0
FOR I=0:0
SET LRCDT=$ORDER(^TMP("LR",$JOB,"TP",LRAAO,LRCDT))
IF LRCDT=""
QUIT
DO TEST
IF LREND
QUIT
+1 QUIT
TEST SET LRIDT=9999999-LRCDT
SET LRSS=$PIECE(^TMP("LR",$JOB,"TP",LRAAO),U,2)
SET LR0=$SELECT($DATA(^(LRAAO,LRCDT))#2:^(LRCDT),1:"")
SET LRTC=$PIECE(LR0,U,12)
+1 IF LRSS="MI"
SET LRH=1
SET (LRONETST,LRONESPC)=""
SET LREND=0
DO EN^LROR4
SET LRHF=1
KILL A,Z,LRH,LRONETST,LRONESPC
IF LREND
SET LREND=0
SET LREND=1
QUIT
+2 IF '$PIECE(LR0,U,3)
QUIT
+3 SET LRSPEC=+$PIECE(LR0,U,5)
SET X=$PIECE(LR0,U,10)
DO DOC^LRX
+4 IF $Y+LRTC+3>IOSL
DO C1
IF LREND
QUIT
+5 SET Y=LRCDT
DO DD^LRX
WRITE !,?30,Y
+6 DO HEAD
+7 SET LRPO=0
FOR I=0:0
SET LRPO=$ORDER(^TMP("LR",$JOB,"TP",LRAAO,LRCDT,LRPO))
IF LRPO=""
QUIT
IF $DATA(^(LRPO))#2
SET LRDATA=^(LRPO)
DO DATA
IF LREND
QUIT
+8 IF LREND
QUIT
+9 IF $DATA(^TMP("LR",$JOB,"TP",LRAAO,LRCDT,"C"))
WRITE !,"Comment: "
SET LRCMNT=0
FOR I=0:0
SET LRCMNT=+$ORDER(^TMP("LR",$JOB,"TP",LRAAO,LRCDT,"C",LRCMNT))
IF LRCMNT<1
QUIT
WRITE ^(LRCMNT)
IF $ORDER(^(LRCMNT))
WRITE !?9
DO CONT
IF LREND
QUIT
+10 WRITE !
QUIT
DATA SET LRTSTS=+LRDATA
SET LRPC=$PIECE(LRDATA,U,5)
SET LRSUB=$PIECE(LRDATA,U,6)
SET X=$PIECE(LRDATA,U,7)
SET LRFFLG=$PIECE(LRDATA,U,8)
IF X=""
QUIT
+1 WRITE !?5,$SELECT($LENGTH($PIECE(LRDATA,U,2))>20:$PIECE(LRDATA,U,3),1:$PIECE(LRDATA,U,2)),?27,@$SELECT(LRPC="":"$J(X,LRCW)",1:LRPC)," ",LRFFLG
+2 SET X=$SELECT($DATA(^LAB(60,LRTSTS,1,LRSPEC,0)):^(0),1:"")
IF '$LENGTH(X)
QUIT
SET LRTHER=$SELECT($LENGTH($PIECE(X,U,11,12))>1:1,1:0)
SET LRLO=$SELECT(LRTHER:$PIECE(X,U,11),1:$PIECE(X,U,2))
SET LRHI=$SELECT(LRTHER:$PIECE(X,U,12),1:$PIECE(X,U,3))
+3 SET @("LRLO="_$SELECT($LENGTH(LRLO):LRLO,1:""""""))
SET @("LRHI="_$SELECT($LENGTH(LRHI):LRHI,1:""""""))
+4 WRITE ?38," ",$PIECE(X,U,7),?51,$JUSTIFY(LRLO,4),$SELECT($LENGTH(LRHI):" - "_$JUSTIFY(LRHI,4),1:""),?63,$SELECT(LRTHER:"(Ther. range)",1:"")
DO CONT
IF LREND
QUIT
+5 IF $ORDER(^TMP("LR",$JOB,"TP",LRAAO,LRCDT,LRPO,0))>0
SET LRINTP=0
FOR I=0:0
SET LRINTP=+$ORDER(^TMP("LR",$JOB,"TP",LRAAO,LRCDT,LRPO,LRINTP))
IF LRINTP<1
QUIT
WRITE !?7,"Eval: ",^(LRINTP)
DO CONT
IF LREND
QUIT
+6 QUIT
CONT IF $Y+4'>IOSL
QUIT
DO C1
IF 'LREND
DO HEAD
+1 QUIT
C1 FOR I=$Y:1:IOSL-5
WRITE !
+1 WRITE !?(IOM-26),"Continued on next page..."
IF IOST["C-"
WRITE !!,"Press return to continue or ""^"" to escape "
READ X:DTIME
IF X="^^"
SET DIROUT=1
IF '$TEST!(X["^")
SET (OREND,LREND)=1
QUIT
+2 DO EXT^ORUHDR
IF LREND
QUIT
WRITE !?20,">> CONTINUATION OF ",$PIECE(LR0,U,6)," <<",!
+3 QUIT
HEAD WRITE !?5,"Test name",?30,"Result units",?51,"Ref. range"
+1 QUIT