GMTSLRS ; SLC/JER,KER - Sel Lab Component w/Selection Items ; 01/06/2003
;;2.7;Health Summary;**16,28,47,58**;Oct 20, 1995
;
; External References
; DBIA 67 ^LAB(60
; DBIA 525 ^LR( all fields
; DBIA 10035 ^DPT( field 63 Read w/Fileman
; DBIA 2056 $$GET1^DIQ (file 2)
;
MAIN ; Selected Lab w/Selection Items
N GMTSI,GMW,GMX,LRDFN,MAX,IT,IX,PTEST,TEST,BEGIN,END,CNT,RWIDTH,GMLINE,GMCMNT,GMCFLAG
S RWIDTH=8,LRDFN=+($$GET1^DIQ(2,(+($G(DFN))_","),63,"I")) Q:+LRDFN=0 Q:'$D(^LR(LRDFN))
S MAX=$S(+($G(GMTSNDM))>0:+($G(GMTSNDM)),1:999) Q:'$O(GMTSEG(GMTSEGN,60,0))
S GMCMNT=$S($P($G(^GMT(142.99,1,0)),U,3)="Y":1,1:0)
S GMTSI=0 F S GMTSI=$O(GMTSEG(GMTSEGN,60,GMTSI)) Q:GMTSI'>0 D Q:$D(GMTSQIT)
. S (PTEST,TEST)=GMTSEG(GMTSEGN,60,GMTSI)
. D @$S($L($P(^LAB(60,TEST,0),U,5)):"^GMTSLRSE",1:"PANEL")
Q:'$D(^TMP("LRS",$J)) D WRTHDR Q:$D(GMTSQIT)
S IT=0 F S IT=$O(^TMP("LRS",$J,IT)) Q:+IT'>0 D Q:$D(GMTSQIT)
. S IX="" F S IX=$O(^TMP("LRS",$J,IT,IX)) Q:'IX!(IX>GMTS2) D Q:$D(GMTSQIT)
. . S GMX=^TMP("LRS",$J,IT,IX) D WRT
I +$G(GMCFLAG) D
. D CKP^GMTSUP Q:$D(GMTSQIT) W !
. D CKP^GMTSUP Q:$D(GMTSQIT)
. W "!! Indicates COMMENTS AVAILABLE...Refer to Interim Lab Report.",!
K ^TMP("LRS",$J)
Q
PANEL ; Visits "PANEL" multiple to get pointers to atomic tests
N TEST,GMW,INDX
S INDX=0 F S INDX=$O(^LAB(60,PTEST,2,INDX)) Q:'INDX S TEST=^(INDX,0) S:'$L($P(^LAB(60,TEST,0),U,5)) PTEST=TEST D @$S($L($P(^LAB(60,TEST,0),U,5)):"^GMTSLRSE",1:"PANEL")
Q
WRTHDR ; Prints columnar header
D CKP^GMTSUP Q:$D(GMTSQIT) W "Collection DT",?18,"Specimen"
W ?29,"Test Name",?48,"Result",?58,"Units",?68,"Ref Range",!
W:'$D(GMTSOBJ) !
Q
WRT ; Writes the Lab Record
D CKP^GMTSUP Q:$D(GMTSQIT) D
. D:GMTSNPG WRTHDR N GMTSI
. W $P(GMX,U),?18,$P($P(GMX,U,2),";",2)
. I $D(^TMP("LRS",$J,"C",IX))>9,'+$G(GMCMNT) W ?24,"!! " S GMCFLAG=1
. S GMTSI=$P(GMX,U,8) S:GMTSI="NEGATIVE" GMTSI="NEG"
. W ?29,$E($P($P(GMX,U,3),";",2),1,17),?46,$P(GMX,U,4)," ",$P(GMX,U,5)
. W ?58,$P(GMX,U,6),?68,$J($P(GMX,U,7),4),?73,"-",?74,$J(GMTSI,4),!
I +$G(GMCMNT),$D(^TMP("LRS",$J,"C",IX))>9,'$D(^TMP("LRS",$J,+$O(^TMP("LRS",$J,IT)),IX)) D Q
. S GMLINE=0
. F S GMLINE=$O(^TMP("LRS",$J,"C",IX,GMLINE)) Q:GMLINE'>0 D
. . D CKP^GMTSUP Q:$D(GMTSQIT)
. . W "Comment: ",^TMP("LRS",$J,"C",IX,GMLINE),!
Q
GMTSLRS ; SLC/JER,KER - Sel Lab Component w/Selection Items ; 01/06/2003
+1 ;;2.7;Health Summary;**16,28,47,58**;Oct 20, 1995
+2 ;
+3 ; External References
+4 ; DBIA 67 ^LAB(60
+5 ; DBIA 525 ^LR( all fields
+6 ; DBIA 10035 ^DPT( field 63 Read w/Fileman
+7 ; DBIA 2056 $$GET1^DIQ (file 2)
+8 ;
MAIN ; Selected Lab w/Selection Items
+1 NEW GMTSI,GMW,GMX,LRDFN,MAX,IT,IX,PTEST,TEST,BEGIN,END,CNT,RWIDTH,GMLINE,GMCMNT,GMCFLAG
+2 SET RWIDTH=8
SET LRDFN=+($$GET1^DIQ(2,(+($GET(DFN))_","),63,"I"))
IF +LRDFN=0
QUIT
IF '$DATA(^LR(LRDFN))
QUIT
+3 SET MAX=$SELECT(+($GET(GMTSNDM))>0:+($GET(GMTSNDM)),1:999)
IF '$ORDER(GMTSEG(GMTSEGN,60,0))
QUIT
+4 SET GMCMNT=$SELECT($PIECE($GET(^GMT(142.99,1,0)),U,3)="Y":1,1:0)
+5 SET GMTSI=0
FOR
SET GMTSI=$ORDER(GMTSEG(GMTSEGN,60,GMTSI))
IF GMTSI'>0
QUIT
Begin DoDot:1
+6 SET (PTEST,TEST)=GMTSEG(GMTSEGN,60,GMTSI)
+7 DO @$SELECT($LENGTH($PIECE(^LAB(60,TEST,0),U,5)):"^GMTSLRSE",1:"PANEL")
End DoDot:1
IF $DATA(GMTSQIT)
QUIT
+8 IF '$DATA(^TMP("LRS",$JOB))
QUIT
DO WRTHDR
IF $DATA(GMTSQIT)
QUIT
+9 SET IT=0
FOR
SET IT=$ORDER(^TMP("LRS",$JOB,IT))
IF +IT'>0
QUIT
Begin DoDot:1
+10 SET IX=""
FOR
SET IX=$ORDER(^TMP("LRS",$JOB,IT,IX))
IF 'IX!(IX>GMTS2)
QUIT
Begin DoDot:2
+11 SET GMX=^TMP("LRS",$JOB,IT,IX)
DO WRT
End DoDot:2
IF $DATA(GMTSQIT)
QUIT
End DoDot:1
IF $DATA(GMTSQIT)
QUIT
+12 IF +$GET(GMCFLAG)
Begin DoDot:1
+13 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
WRITE !
+14 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+15 WRITE "!! Indicates COMMENTS AVAILABLE...Refer to Interim Lab Report.",!
End DoDot:1
+16 KILL ^TMP("LRS",$JOB)
+17 QUIT
PANEL ; Visits "PANEL" multiple to get pointers to atomic tests
+1 NEW TEST,GMW,INDX
+2 SET INDX=0
FOR
SET INDX=$ORDER(^LAB(60,PTEST,2,INDX))
IF 'INDX
QUIT
SET TEST=^(INDX,0)
IF '$LENGTH($PIECE(^LAB(60,TEST,0),U,5))
SET PTEST=TEST
DO @$SELECT($LENGTH($PIECE(^LAB(60,TEST,0),U,5)):"^GMTSLRSE",1:"PANEL")
+3 QUIT
WRTHDR ; Prints columnar header
+1 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
WRITE "Collection DT",?18,"Specimen"
+2 WRITE ?29,"Test Name",?48,"Result",?58,"Units",?68,"Ref Range",!
+3 IF '$DATA(GMTSOBJ)
WRITE !
+4 QUIT
WRT ; Writes the Lab Record
+1 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
Begin DoDot:1
+2 IF GMTSNPG
DO WRTHDR
NEW GMTSI
+3 WRITE $PIECE(GMX,U),?18,$PIECE($PIECE(GMX,U,2),";",2)
+4 IF $DATA(^TMP("LRS",$JOB,"C",IX))>9
IF '+$GET(GMCMNT)
WRITE ?24,"!! "
SET GMCFLAG=1
+5 SET GMTSI=$PIECE(GMX,U,8)
IF GMTSI="NEGATIVE"
SET GMTSI="NEG"
+6 WRITE ?29,$EXTRACT($PIECE($PIECE(GMX,U,3),";",2),1,17),?46,$PIECE(GMX,U,4)," ",$PIECE(GMX,U,5)
+7 WRITE ?58,$PIECE(GMX,U,6),?68,$JUSTIFY($PIECE(GMX,U,7),4),?73,"-",?74,$JUSTIFY(GMTSI,4),!
End DoDot:1
+8 IF +$GET(GMCMNT)
IF $DATA(^TMP("LRS",$JOB,"C",IX))>9
IF '$DATA(^TMP("LRS",$JOB,+$ORDER(^TMP("LRS",$JOB,IT)),IX))
Begin DoDot:1
+9 SET GMLINE=0
+10 FOR
SET GMLINE=$ORDER(^TMP("LRS",$JOB,"C",IX,GMLINE))
IF GMLINE'>0
QUIT
Begin DoDot:2
+11 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+12 WRITE "Comment: ",^TMP("LRS",$JOB,"C",IX,GMLINE),!
End DoDot:2
End DoDot:1
QUIT
+13 QUIT