LRVR4 ;DALOI/CJS/DALOI/FHS - LAB ROUTINE DATA VERIFICATION ;11/23/11 12:19
;;5.2;LAB SERVICE;**14,42,121,153,221,263,279,283,287,286,330,350**;Sep 27, 1994;Build 230
;
I $D(LRSBCOM) D
. N LRX
. S LRX=0
. F S LRX=$O(LRSBCOM(LRX)) Q:LRX="" S ^LAH(LRLL,1,LRSQ,1,LRX)=LRSBCOM(LRX)
K %,LRSBCOM
D LOOP
Q
;
;
LOOP ;
S LRLCT=0
W !!,PNM," SSN: ",SSN," "
I LRDPF=2 W " LOC: ",$S(LRWRD'="":LRWRD,1:$S($L($P(^LRO(68,LRAA,1,LRAD,1,LRAN,0),U,7)):$P(^(0),U,7),1:"??"))
W !,"Pat Info: ",$P($G(^LR(LRDFN,.091)),U)
W ?34," Sex: ",$S(SEX="M":"MALE",SEX="F":"FEMALE",1:SEX)
W ?48," Age: ",$$CALCAGE^LRRPU(DOB,LRCDT)," as of ",$$FMTE^XLFDT(LRCDT,"1D")
S LRPRAC=$P(^LRO(68,LRAA,1,LRAD,1,LRAN,0),U,8)
I LRPRAC>0,LRPRAC=+LRPRAC D GETS^DIQ(200,LRPRAC_",",".01;.132;.137;.138","E","LRPRAC(LRPRAC)","LRERR")
W !,"Provider: "
S LRLCT=LRLCT+3
I LRPRAC'="",'$D(LRPRAC(LRPRAC,200)) W LRPRAC
I LRPRAC,$D(LRPRAC(LRPRAC,200)) D
. W LRPRAC(LRPRAC,200,LRPRAC_",",.01,"E"),?40," Voice pager: ",LRPRAC(LRPRAC,200,LRPRAC_",",.137,"E")
. W !," Phone: ",LRPRAC(LRPRAC,200,LRPRAC_",",.132,"E"),?38," Digital pager: ",LRPRAC(LRPRAC,200,LRPRAC_",",.138,"E")
. S LRLCT=LRLCT+1
;
N PRAC,PR
D PRAC^LR7OMERG(LRAA,LRAD,LRAN,.PRAC)
I $O(PRAC(0)) D
. S PR=0
. F S PR=$O(PRAC(PR)) Q:PR<1 I $D(^VA(200,PR,0)) W !?14,$P(^(0),"^") S LRLCT=LRLCT+1
;
W ! S LRNX=0,LRVRM=1,Z=LRCDT,LRLCT=LRLCT+1
I $P(Z1,U,7)'="" W !,"VOLUME: ",$P(Z1,U,7) S LRLCT=LRLCT+1
S LRACC=$P(Z1,U,6)
W !,"ACCESSION:",?30,$P(Z2,U,6),?44," ",LRACC_" ["_LRUID,"]"
W !,LRPANEL,?30,LRDAT(2),?44," ",LRDAT
S LRLCT=LRLCT+2
I $D(LRALERT),LRALERT<($P(LRPARAM,U,20)+1) D
. W !?15 W:$E(IOST,1,2)="C-" @LRVIDO
. W "Test ordered "_$P($G(^LAB(62.05,+LRALERT,0)),U)
. W:$E(IOST,1,2)="C-" @LRVIDOF,$C(7)
. S LRLCT=LRLCT+1
I $D(LRGVP) D V20 Q
I ($O(LRSB(0))<1!$D(LRPER))&'$D(LRNUF) D LRSBCOM G EDIT
K LRNUF
D V20:'$D(LRPER) Q:$O(LRSB(1))<1 G:LREDIT EDIT
V36 ;
S LRTEC=$S($D(^LRO(68,LRAA,1,LRAD,2)):$P(^(2),U),1:$S($D(LRUSI):LRUSI,1:"")),LREDIT=0
;
V3 ;
D LRSBCOM,DCOM^LRVERA
;
; If entering reference lab results only allow editing comments/workload
K DIR
S LRLCT=0
I $G(LRDUZ(2)),DUZ(2)'=LRDUZ(2) D
. S DIR(0)="SAO^C:Comments;W:Workload"
. S DIR("A")="SELECT ('C' for Comments, 'W' Workload): "
E D
. S DIR(0)="SAO^E:Edit;C:Comments;W:Workload"
. S DIR("A")="SELECT ('E' to Edit, 'C' for Comments, 'W' Workload): "
D ^DIR
I $D(DIRUT) S X="^" G V37
S X=Y
S:$E(X)="E" LREDIT=1,X=""
I X="C" D COM G LOOP
;
I $E(X)="W" D G LOOP
. I $P(LRPARAM,U,14),$P($G(^LRO(68,LRAA,0)),U,16) D STD^LRCAPV,EN^LRCAPV S LREND=0 Q
. W !?10,"Workload is not activated. "
;
S X=$S(X="@":"",X="":LRTEC,1:X),LRTEC=X
S:'$D(^LRO(68,LRAA,1,LRAD,2)) ^(2)="" S ^(2)=X_U_$P(^(2),U,2,99)
G EDIT:LREDIT
V37 Q ;LEAVE LRVR4, BACK TO LRVR3
;
;
V25 ;
I LRVF K LRSB(LRSB),LRM(LRSB) Q
I '$D(LRSB(LRSB)) S LRSB(LRSB)=^LR(LRDFN,LRSS,LRIDT,LRSB) Q
Q
;
;
V20 S LRNX=$O(LRORD(LRNX)) G V35:LRNX<1 D SUBS G V20:'LRTS
I $D(^LR(LRDFN,LRSS,LRIDT,LRSB)),$P(^LR(LRDFN,LRSS,LRIDT,LRSB),"^")'="",^(LRSB)'["pending" D V25 G:LRVF V20
I "CH"'=LRSS G V20
D V25^LRVR5
W !,$P(^LAB(60,+LRTS,0),U)
S X1=""
I $D(^LR(LRDFN,LRSS,LRLDT,LRSB)) D
. S X1=$P(^(LRSB),U),(LRDL,X)=X1
. I $$GET1^DID(63.04,LRSB,"","TYPE","","LRERR")="SET" D
. . S X=$$EXTERNAL^DILFD(63.04,LRSB,"",X1)
. . I X="" S X=X1
. W:X'="" ?30,@LRFP
S X="",LRFLG=""
I $D(LRSB(LRSB)),$P(LRSB(LRSB),U)'="" D
. N LRX
. K LRNOVER(LRSB)
. S (LRDL,LRX,X)=$P(LRSB(LRSB),U)
. I $$GET1^DID(63.04,LRSB,"","TYPE","","LRERR")="SET" D
. . S X=$$EXTERNAL^DILFD(63.04,LRSB,"",LRX)
. . I X="" S X=LRX
. W ?44," ",@LRFP," "
. S X=LRX,Y=0
. K LRQ
. I X="" Q
. I (X="canc")!(X="comment")!(X="pending") D Q
. . D NR
. . W LRFLG,?56," ",$P(LRNG,U,7)
. . S LREDIT=0
. I LRDEL'="" S LRQ=1,LRVRM=11 D XDELTACK^LRVERA S LRVRM=1 K LRQ
. D RANGE
. W LRFLG,?56," ",$P(LRNG,U,7) S:X'="" LREDIT=0
I '$D(LRNUF) S LRLCT=LRLCT+1 S:$X>80 LRLCT=LRLCT+1 D:LRLCT>22 WT G:$G(Y)'="^" V20
;
V35 ;
D LRCFL:LRCFL]""
K LRNUF
Q
;
;
LRCFL ;
S LREXEC=LRCFL D ^LREXEC:LRCFL[""
D:LRLCT>22 WT
Q
;
;
EDIT ;
S LROUT=1 D ^LRVR5
S LRVRM=1,LREDIT=0
G LRCFL:LROUT!$D(LRPER),LOOP
;
;
RANGE ;
; If results from another system, use flags returned with results
; and set LRNG,LRNGS with normals from message.
; Check for LRDUZ(2) set for performing lab or performing lab set (piece 9) in LRSB(LRSB) array.
I $G(LRDUZ(2)),DUZ(2)'=LRDUZ(2) S Y=X D PLNR,CKPLNR,RQ Q
I $P(LRSB(LRSB),"^",9),DUZ(2)'=$P(LRSB(LRSB),"^",9) S Y=X D PLNR,CKPLNR,RQ Q
;
D RANGE^LRVER4,RQ
Q
;
;
RQ S X=Y
NR I $D(LRSB(LRSB))#2 D
. N I,LRX,LRY
. I $P(X,U)="" S LRSB(LRSB)="" Q
. S $P(LRSB(LRSB),U)=X
. S $P(LRSB(LRSB),U,2)=LRFLG
. S $P(LRSB(LRSB),U,4)=$S($G(LRDUZ):LRDUZ,1:$G(DUZ))
. I $P(LRSB(LRSB),U,9)="" S $P(LRSB(LRSB),U,9)=$S($G(LRDUZ(2)):LRDUZ(2),$G(DUZ(2)):DUZ(2),1:"")
. S LRX=$$TMPSB^LRVER1(LRSB),LRY=$P(LRSB(LRSB),U,3)
. F I=1:1:$L(LRX,"!") I $P(LRY,"!",I)="" S $P(LRY,"!",I)=$P(LRX,"!",I)
. S $P(LRSB(LRSB),U,3)=LRY
. I $P($P(LRSB(LRSB),U,3),"!")="" D RONLT^LRVER3
. S LRX=LRNGS,LRY=$P(LRSB(LRSB),U,5)
. F I=1:1:$L(LRX,U) I $P(LRY,"!",I)="" S $P(LRY,"!",I)=$P(LRX,U,I)
. S $P(LRSB(LRSB),U,5)=LRY
;
Q
;
;
PLNR ; Performing lab normal ranges, use instead of current local ranges
; Retrieve from results when "NPC" node = 2 or greater
; and set LRNG and LRNGS with normals from HL7 message/interface.
N I,LRY
I +$G(^LR(LRDFN,LRSS,LRIDT,"NPC"))<2 Q
S LRY=$P($G(LRSB(LRSB)),"^",5)
S $P(LRNGS,"^")=$P(LRY,"!")
F I=2:1:5,11,12 D
. ; enclose in quotes if not numeric
. I I<6,$P(LRY,"!",I)'?.N.1".".N S $P(LRY,"!",I)=$C(34)_$P(LRY,"!",I)_$C(34)
. S $P(LRNGS,"^",I)=$P(LRY,"!",I),$P(LRNG,"^",I)=$P(LRY,"!",I),@("LRNG"_I)=$P(LRY,"!",I)
S $P(LRNG,"^",7)=$P(LRY,"!",7),$P(LRNGS,"^",7)=$P(LRY,"!",7)
Q
;
;
CKPLNR ; Check performing lab normal ranges and set abnormal flag
; based on HL7 messages/interface.
S LRFLG=$P(LRSB(LRSB),"^",2)
I '$D(LRQ),$E(LRFLG,2)="*" D DISPFLG^LRVER4
Q
;
;
SUBS D SUBS^LRVER4
Q
;
;
WT D WT^LRVER4
Q
;
;
COM ;from LRVR5
Q:$D(LRGVP)!('$D(LRLABKY))
D DCOM^LRVERA
K DR,DA,DIE
S DIE="^LR("_LRDFN_",""CH"",",DA=LRIDT,DA(1)=LRDFN,DR=.99 D ^DIE
Q
;
;
LRSBCOM ;Display/store comments from the instrument
N LRSBCOM,LRI
S LRI=0
F S LRI=$O(^LAH(LRLL,1,LRSQ,1,LRI)) Q:LRI="" D
. S LRSBCOM=^LAH(LRLL,1,LRSQ,1,LRI)
. I $P(LRSBCOM,"^",2) Q ; Already been processed
. D LRSBCOM1
. S $P(^LAH(LRLL,1,LRSQ,1,LRI),U,2)=1 ; Mark as processed
I $G(LRQUIET) Q
W !
S LRLCT=$G(LRLCT)+1 D:LRLCT>22 WT
Q
;
;
LRSBCOM1 ; Store instrument comments in file #63
; Check for duplicate comments in ^LAH and ^LR globals
N LRDUP,LRERR,LRI,LRNOECHO,LRNOEXPD,LRX,LRY
;
; Don't echo comments/don't expand comment using lab description file.
; Used by LRNUM - called from input transform of #.01 field.
S LRNOECHO=0,LRNOEXPD=1
;
; Check for duplicates - comment stripped if spaces, force to upper case unless
; flag set to store duplicates (Field #2.2 of PROFILE multiple in file #68.2)
S LRDUP=0
I '$P($G(^LRO(68.2,LRLL,10,+$G(LRPROF),0)),U,4) D
. S LRI=0,LRY=$TR(LRSBCOM," ",""),LRY=$$UP^XLFSTR(LRY)
. F S LRI=$O(^LR(LRDFN,"CH",LRIDT,1,LRI)) Q:'LRI D Q:LRDUP
. . S LRX=$P($G(^LR(LRDFN,"CH",LRIDT,1,LRI,0)),U)
. . S LRX=$TR(LRX," ",""),LRX=$$UP^XLFSTR(LRX)
. . I LRX=LRY S LRDUP=1
I LRDUP=1 Q ; Duplicate comment
D FILECOM(LRDFN,LRIDT,LRSBCOM)
I $G(LRQUIET) Q
W !,"Inst Comments: "_LRSBCOM
S LRLCT=$G(LRLCT)+1 D:LRLCT>10 WT
Q
;
;
FILECOM(LRDFN,LRIDT,LRCMT) ; File comment in field #99
; Call with LRDFN = ien of patient in file #63
; LRIDT = ien of specimen date/time
; LRCMT = comment to store
;
N LRFDA,LRERR
S LRFDA(2,63.041,"+2,"_LRIDT_","_LRDFN_",",.01)=LRCMT
D UPDATE^DIE("","LRFDA(2)","","LRERR(2)")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLRVR4 8036 printed Nov 22, 2024@17:32:45 Page 2
LRVR4 ;DALOI/CJS/DALOI/FHS - LAB ROUTINE DATA VERIFICATION ;11/23/11 12:19
+1 ;;5.2;LAB SERVICE;**14,42,121,153,221,263,279,283,287,286,330,350**;Sep 27, 1994;Build 230
+2 ;
+3 IF $DATA(LRSBCOM)
Begin DoDot:1
+4 NEW LRX
+5 SET LRX=0
+6 FOR
SET LRX=$ORDER(LRSBCOM(LRX))
if LRX=""
QUIT
SET ^LAH(LRLL,1,LRSQ,1,LRX)=LRSBCOM(LRX)
End DoDot:1
+7 KILL %,LRSBCOM
+8 DO LOOP
+9 QUIT
+10 ;
+11 ;
LOOP ;
+1 SET LRLCT=0
+2 WRITE !!,PNM," SSN: ",SSN," "
+3 IF LRDPF=2
WRITE " LOC: ",$SELECT(LRWRD'="":LRWRD,1:$SELECT($LENGTH($PIECE(^LRO(68,LRAA,1,LRAD,1,LRAN,0),U,7)):$PIECE(^(0),U,7),1:"??"))
+4 WRITE !,"Pat Info: ",$PIECE($GET(^LR(LRDFN,.091)),U)
+5 WRITE ?34," Sex: ",$SELECT(SEX="M":"MALE",SEX="F":"FEMALE",1:SEX)
+6 WRITE ?48," Age: ",$$CALCAGE^LRRPU(DOB,LRCDT)," as of ",$$FMTE^XLFDT(LRCDT,"1D")
+7 SET LRPRAC=$PIECE(^LRO(68,LRAA,1,LRAD,1,LRAN,0),U,8)
+8 IF LRPRAC>0
IF LRPRAC=+LRPRAC
DO GETS^DIQ(200,LRPRAC_",",".01;.132;.137;.138","E","LRPRAC(LRPRAC)","LRERR")
+9 WRITE !,"Provider: "
+10 SET LRLCT=LRLCT+3
+11 IF LRPRAC'=""
IF '$DATA(LRPRAC(LRPRAC,200))
WRITE LRPRAC
+12 IF LRPRAC
IF $DATA(LRPRAC(LRPRAC,200))
Begin DoDot:1
+13 WRITE LRPRAC(LRPRAC,200,LRPRAC_",",.01,"E"),?40," Voice pager: ",LRPRAC(LRPRAC,200,LRPRAC_",",.137,"E")
+14 WRITE !," Phone: ",LRPRAC(LRPRAC,200,LRPRAC_",",.132,"E"),?38," Digital pager: ",LRPRAC(LRPRAC,200,LRPRAC_",",.138,"E")
+15 SET LRLCT=LRLCT+1
End DoDot:1
+16 ;
+17 NEW PRAC,PR
+18 DO PRAC^LR7OMERG(LRAA,LRAD,LRAN,.PRAC)
+19 IF $ORDER(PRAC(0))
Begin DoDot:1
+20 SET PR=0
+21 FOR
SET PR=$ORDER(PRAC(PR))
if PR<1
QUIT
IF $DATA(^VA(200,PR,0))
WRITE !?14,$PIECE(^(0),"^")
SET LRLCT=LRLCT+1
End DoDot:1
+22 ;
+23 WRITE !
SET LRNX=0
SET LRVRM=1
SET Z=LRCDT
SET LRLCT=LRLCT+1
+24 IF $PIECE(Z1,U,7)'=""
WRITE !,"VOLUME: ",$PIECE(Z1,U,7)
SET LRLCT=LRLCT+1
+25 SET LRACC=$PIECE(Z1,U,6)
+26 WRITE !,"ACCESSION:",?30,$PIECE(Z2,U,6),?44," ",LRACC_" ["_LRUID,"]"
+27 WRITE !,LRPANEL,?30,LRDAT(2),?44," ",LRDAT
+28 SET LRLCT=LRLCT+2
+29 IF $DATA(LRALERT)
IF LRALERT<($PIECE(LRPARAM,U,20)+1)
Begin DoDot:1
+30 WRITE !?15
if $EXTRACT(IOST,1,2)="C-"
WRITE @LRVIDO
+31 WRITE "Test ordered "_$PIECE($GET(^LAB(62.05,+LRALERT,0)),U)
+32 if $EXTRACT(IOST,1,2)="C-"
WRITE @LRVIDOF,$CHAR(7)
+33 SET LRLCT=LRLCT+1
End DoDot:1
+34 IF $DATA(LRGVP)
DO V20
QUIT
+35 IF ($ORDER(LRSB(0))<1!$DATA(LRPER))&'$DATA(LRNUF)
DO LRSBCOM
GOTO EDIT
+36 KILL LRNUF
+37 if '$DATA(LRPER)
DO V20
if $ORDER(LRSB(1))<1
QUIT
if LREDIT
GOTO EDIT
V36 ;
+1 SET LRTEC=$SELECT($DATA(^LRO(68,LRAA,1,LRAD,2)):$PIECE(^(2),U),1:$SELECT($DATA(LRUSI):LRUSI,1:""))
SET LREDIT=0
+2 ;
V3 ;
+1 DO LRSBCOM
DO DCOM^LRVERA
+2 ;
+3 ; If entering reference lab results only allow editing comments/workload
+4 KILL DIR
+5 SET LRLCT=0
+6 IF $GET(LRDUZ(2))
IF DUZ(2)'=LRDUZ(2)
Begin DoDot:1
+7 SET DIR(0)="SAO^C:Comments;W:Workload"
+8 SET DIR("A")="SELECT ('C' for Comments, 'W' Workload): "
End DoDot:1
+9 IF '$TEST
Begin DoDot:1
+10 SET DIR(0)="SAO^E:Edit;C:Comments;W:Workload"
+11 SET DIR("A")="SELECT ('E' to Edit, 'C' for Comments, 'W' Workload): "
End DoDot:1
+12 DO ^DIR
+13 IF $DATA(DIRUT)
SET X="^"
GOTO V37
+14 SET X=Y
+15 if $EXTRACT(X)="E"
SET LREDIT=1
SET X=""
+16 IF X="C"
DO COM
GOTO LOOP
+17 ;
+18 IF $EXTRACT(X)="W"
Begin DoDot:1
+19 IF $PIECE(LRPARAM,U,14)
IF $PIECE($GET(^LRO(68,LRAA,0)),U,16)
DO STD^LRCAPV
DO EN^LRCAPV
SET LREND=0
QUIT
+20 WRITE !?10,"Workload is not activated. "
End DoDot:1
GOTO LOOP
+21 ;
+22 SET X=$SELECT(X="@":"",X="":LRTEC,1:X)
SET LRTEC=X
+23 if '$DATA(^LRO(68,LRAA,1,LRAD,2))
SET ^(2)=""
SET ^(2)=X_U_$PIECE(^(2),U,2,99)
+24 if LREDIT
GOTO EDIT
V37 ;LEAVE LRVR4, BACK TO LRVR3
QUIT
+1 ;
+2 ;
V25 ;
+1 IF LRVF
KILL LRSB(LRSB),LRM(LRSB)
QUIT
+2 IF '$DATA(LRSB(LRSB))
SET LRSB(LRSB)=^LR(LRDFN,LRSS,LRIDT,LRSB)
QUIT
+3 QUIT
+4 ;
+5 ;
V20 SET LRNX=$ORDER(LRORD(LRNX))
if LRNX<1
GOTO V35
DO SUBS
if 'LRTS
GOTO V20
+1 IF $DATA(^LR(LRDFN,LRSS,LRIDT,LRSB))
IF $PIECE(^LR(LRDFN,LRSS,LRIDT,LRSB),"^")'=""
IF ^(LRSB)'["pending"
DO V25
if LRVF
GOTO V20
+2 IF "CH"'=LRSS
GOTO V20
+3 DO V25^LRVR5
+4 WRITE !,$PIECE(^LAB(60,+LRTS,0),U)
+5 SET X1=""
+6 IF $DATA(^LR(LRDFN,LRSS,LRLDT,LRSB))
Begin DoDot:1
+7 SET X1=$PIECE(^(LRSB),U)
SET (LRDL,X)=X1
+8 IF $$GET1^DID(63.04,LRSB,"","TYPE","","LRERR")="SET"
Begin DoDot:2
+9 SET X=$$EXTERNAL^DILFD(63.04,LRSB,"",X1)
+10 IF X=""
SET X=X1
End DoDot:2
+11 if X'=""
WRITE ?30,@LRFP
End DoDot:1
+12 SET X=""
SET LRFLG=""
+13 IF $DATA(LRSB(LRSB))
IF $PIECE(LRSB(LRSB),U)'=""
Begin DoDot:1
+14 NEW LRX
+15 KILL LRNOVER(LRSB)
+16 SET (LRDL,LRX,X)=$PIECE(LRSB(LRSB),U)
+17 IF $$GET1^DID(63.04,LRSB,"","TYPE","","LRERR")="SET"
Begin DoDot:2
+18 SET X=$$EXTERNAL^DILFD(63.04,LRSB,"",LRX)
+19 IF X=""
SET X=LRX
End DoDot:2
+20 WRITE ?44," ",@LRFP," "
+21 SET X=LRX
SET Y=0
+22 KILL LRQ
+23 IF X=""
QUIT
+24 IF (X="canc")!(X="comment")!(X="pending")
Begin DoDot:2
+25 DO NR
+26 WRITE LRFLG,?56," ",$PIECE(LRNG,U,7)
+27 SET LREDIT=0
End DoDot:2
QUIT
+28 IF LRDEL'=""
SET LRQ=1
SET LRVRM=11
DO XDELTACK^LRVERA
SET LRVRM=1
KILL LRQ
+29 DO RANGE
+30 WRITE LRFLG,?56," ",$PIECE(LRNG,U,7)
if X'=""
SET LREDIT=0
End DoDot:1
+31 IF '$DATA(LRNUF)
SET LRLCT=LRLCT+1
if $X>80
SET LRLCT=LRLCT+1
if LRLCT>22
DO WT
if $GET(Y)'="^"
GOTO V20
+32 ;
V35 ;
+1 if LRCFL]""
DO LRCFL
+2 KILL LRNUF
+3 QUIT
+4 ;
+5 ;
LRCFL ;
+1 SET LREXEC=LRCFL
if LRCFL[""
DO ^LREXEC
+2 if LRLCT>22
DO WT
+3 QUIT
+4 ;
+5 ;
EDIT ;
+1 SET LROUT=1
DO ^LRVR5
+2 SET LRVRM=1
SET LREDIT=0
+3 if LROUT!$DATA(LRPER)
GOTO LRCFL
GOTO LOOP
+4 ;
+5 ;
RANGE ;
+1 ; If results from another system, use flags returned with results
+2 ; and set LRNG,LRNGS with normals from message.
+3 ; Check for LRDUZ(2) set for performing lab or performing lab set (piece 9) in LRSB(LRSB) array.
+4 IF $GET(LRDUZ(2))
IF DUZ(2)'=LRDUZ(2)
SET Y=X
DO PLNR
DO CKPLNR
DO RQ
QUIT
+5 IF $PIECE(LRSB(LRSB),"^",9)
IF DUZ(2)'=$PIECE(LRSB(LRSB),"^",9)
SET Y=X
DO PLNR
DO CKPLNR
DO RQ
QUIT
+6 ;
+7 DO RANGE^LRVER4
DO RQ
+8 QUIT
+9 ;
+10 ;
RQ SET X=Y
NR IF $DATA(LRSB(LRSB))#2
Begin DoDot:1
+1 NEW I,LRX,LRY
+2 IF $PIECE(X,U)=""
SET LRSB(LRSB)=""
QUIT
+3 SET $PIECE(LRSB(LRSB),U)=X
+4 SET $PIECE(LRSB(LRSB),U,2)=LRFLG
+5 SET $PIECE(LRSB(LRSB),U,4)=$SELECT($GET(LRDUZ):LRDUZ,1:$GET(DUZ))
+6 IF $PIECE(LRSB(LRSB),U,9)=""
SET $PIECE(LRSB(LRSB),U,9)=$SELECT($GET(LRDUZ(2)):LRDUZ(2),$GET(DUZ(2)):DUZ(2),1:"")
+7 SET LRX=$$TMPSB^LRVER1(LRSB)
SET LRY=$PIECE(LRSB(LRSB),U,3)
+8 FOR I=1:1:$LENGTH(LRX,"!")
IF $PIECE(LRY,"!",I)=""
SET $PIECE(LRY,"!",I)=$PIECE(LRX,"!",I)
+9 SET $PIECE(LRSB(LRSB),U,3)=LRY
+10 IF $PIECE($PIECE(LRSB(LRSB),U,3),"!")=""
DO RONLT^LRVER3
+11 SET LRX=LRNGS
SET LRY=$PIECE(LRSB(LRSB),U,5)
+12 FOR I=1:1:$LENGTH(LRX,U)
IF $PIECE(LRY,"!",I)=""
SET $PIECE(LRY,"!",I)=$PIECE(LRX,U,I)
+13 SET $PIECE(LRSB(LRSB),U,5)=LRY
End DoDot:1
+14 ;
+15 QUIT
+16 ;
+17 ;
PLNR ; Performing lab normal ranges, use instead of current local ranges
+1 ; Retrieve from results when "NPC" node = 2 or greater
+2 ; and set LRNG and LRNGS with normals from HL7 message/interface.
+3 NEW I,LRY
+4 IF +$GET(^LR(LRDFN,LRSS,LRIDT,"NPC"))<2
QUIT
+5 SET LRY=$PIECE($GET(LRSB(LRSB)),"^",5)
+6 SET $PIECE(LRNGS,"^")=$PIECE(LRY,"!")
+7 FOR I=2:1:5,11,12
Begin DoDot:1
+8 ; enclose in quotes if not numeric
+9 IF I<6
IF $PIECE(LRY,"!",I)'?.N.1".".N
SET $PIECE(LRY,"!",I)=$CHAR(34)_$PIECE(LRY,"!",I)_$CHAR(34)
+10 SET $PIECE(LRNGS,"^",I)=$PIECE(LRY,"!",I)
SET $PIECE(LRNG,"^",I)=$PIECE(LRY,"!",I)
SET @("LRNG"_I)=$PIECE(LRY,"!",I)
End DoDot:1
+11 SET $PIECE(LRNG,"^",7)=$PIECE(LRY,"!",7)
SET $PIECE(LRNGS,"^",7)=$PIECE(LRY,"!",7)
+12 QUIT
+13 ;
+14 ;
CKPLNR ; Check performing lab normal ranges and set abnormal flag
+1 ; based on HL7 messages/interface.
+2 SET LRFLG=$PIECE(LRSB(LRSB),"^",2)
+3 IF '$DATA(LRQ)
IF $EXTRACT(LRFLG,2)="*"
DO DISPFLG^LRVER4
+4 QUIT
+5 ;
+6 ;
SUBS DO SUBS^LRVER4
+1 QUIT
+2 ;
+3 ;
WT DO WT^LRVER4
+1 QUIT
+2 ;
+3 ;
COM ;from LRVR5
+1 if $DATA(LRGVP)!('$DATA(LRLABKY))
QUIT
+2 DO DCOM^LRVERA
+3 KILL DR,DA,DIE
+4 SET DIE="^LR("_LRDFN_",""CH"","
SET DA=LRIDT
SET DA(1)=LRDFN
SET DR=.99
DO ^DIE
+5 QUIT
+6 ;
+7 ;
LRSBCOM ;Display/store comments from the instrument
+1 NEW LRSBCOM,LRI
+2 SET LRI=0
+3 FOR
SET LRI=$ORDER(^LAH(LRLL,1,LRSQ,1,LRI))
if LRI=""
QUIT
Begin DoDot:1
+4 SET LRSBCOM=^LAH(LRLL,1,LRSQ,1,LRI)
+5 ; Already been processed
IF $PIECE(LRSBCOM,"^",2)
QUIT
+6 DO LRSBCOM1
+7 ; Mark as processed
SET $PIECE(^LAH(LRLL,1,LRSQ,1,LRI),U,2)=1
End DoDot:1
+8 IF $GET(LRQUIET)
QUIT
+9 WRITE !
+10 SET LRLCT=$GET(LRLCT)+1
if LRLCT>22
DO WT
+11 QUIT
+12 ;
+13 ;
LRSBCOM1 ; Store instrument comments in file #63
+1 ; Check for duplicate comments in ^LAH and ^LR globals
+2 NEW LRDUP,LRERR,LRI,LRNOECHO,LRNOEXPD,LRX,LRY
+3 ;
+4 ; Don't echo comments/don't expand comment using lab description file.
+5 ; Used by LRNUM - called from input transform of #.01 field.
+6 SET LRNOECHO=0
SET LRNOEXPD=1
+7 ;
+8 ; Check for duplicates - comment stripped if spaces, force to upper case unless
+9 ; flag set to store duplicates (Field #2.2 of PROFILE multiple in file #68.2)
+10 SET LRDUP=0
+11 IF '$PIECE($GET(^LRO(68.2,LRLL,10,+$GET(LRPROF),0)),U,4)
Begin DoDot:1
+12 SET LRI=0
SET LRY=$TRANSLATE(LRSBCOM," ","")
SET LRY=$$UP^XLFSTR(LRY)
+13 FOR
SET LRI=$ORDER(^LR(LRDFN,"CH",LRIDT,1,LRI))
if 'LRI
QUIT
Begin DoDot:2
+14 SET LRX=$PIECE($GET(^LR(LRDFN,"CH",LRIDT,1,LRI,0)),U)
+15 SET LRX=$TRANSLATE(LRX," ","")
SET LRX=$$UP^XLFSTR(LRX)
+16 IF LRX=LRY
SET LRDUP=1
End DoDot:2
if LRDUP
QUIT
End DoDot:1
+17 ; Duplicate comment
IF LRDUP=1
QUIT
+18 DO FILECOM(LRDFN,LRIDT,LRSBCOM)
+19 IF $GET(LRQUIET)
QUIT
+20 WRITE !,"Inst Comments: "_LRSBCOM
+21 SET LRLCT=$GET(LRLCT)+1
if LRLCT>10
DO WT
+22 QUIT
+23 ;
+24 ;
FILECOM(LRDFN,LRIDT,LRCMT) ; File comment in field #99
+1 ; Call with LRDFN = ien of patient in file #63
+2 ; LRIDT = ien of specimen date/time
+3 ; LRCMT = comment to store
+4 ;
+5 NEW LRFDA,LRERR
+6 SET LRFDA(2,63.041,"+2,"_LRIDT_","_LRDFN_",",.01)=LRCMT
+7 DO UPDATE^DIE("","LRFDA(2)","","LRERR(2)")
+8 QUIT