Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: LRORDST

LRORDST.m

Go to the documentation of this file.
LRORDST ;SLC/CJS/WTY - SET THE ORDER AND ACCESSION ; 13-Oct-2017 14:04 ;  MKK
 ;;5.2;LAB SERVICE;**1002,1003,1004,1009,100,107,121,1010,1011,1013,1015,153,202,1018,1019,290,291,359,362,1031,1032,1035,1041**;NOV 1, 1997;Build 23
 ;
 ;Called to create orders and accessions from local LROT array
 ;
EP ; EP 
 D DT
 K ZTSK
 ; I $P(LRPARAM,U,4),'$D(LRNOLABL),'$D(LRTJ),LRORDR="" D ^LRLABLIO
 ;-----BEGIN IHS MODIFICATION LR*5.2*1018
 I $P(LRPARAM,U,4),'$D(LRNOLABL),'$D(LRTJ),LRORDR="" D:'$G(BLRGUI) ^LRLABLIO
 ;-----END IHS MODIFICATION
 ;
 F LRSAMP=-1:0 S LRSAMP=$O(LROT(LRSAMP)) Q:LRSAMP=""  F LRSPEC=-1:0 S LRSPEC=$O(LROT(LRSAMP,LRSPEC)) Q:LRSPEC=""  D ZX
 ;
 M ^TMP("LRORDST",$J,"LROT")=LROT      ; IHS/MSC/MKK - LR*5.2*1032
 ;
 D COMPORD^BLRDIAG(LRODT,LRORD)  ;IHS/ITSC/TPF 11/07/02 **1015** DIAGNSOSI/SYMPTOM LAB POV
 ;
 D BUG1034F(LRORD)   ; IHS/MSC/MKK - LR*5.2*1035 - Fix for Major Bug in LR*5.2*1034
 ;
 K ^TMP("LRORDST",$J)                  ; IHS/MSC/MKK - LR*5.2*1032
 ;
 I $D(LRLABLIO),$D(LRLBL) D
 . S ZTRTN="ENT^LRLABLD",ZTDESC="LAB LABELS",ZTDTH=$H
 . S ZTIO=LRLABLIO,ZTSAVE("LRLBL(")=""
 . D ^%ZTLOAD K LRLBL
 ;
 I $D(LRSLIP) F I1=0:0 S I1=$O(LROT(I1)) Q:I1<1  F I2=-1:0 S I2=$O(LROT(I1,I2)) Q:I2=""  S LRSN=LROT(I1,I2,"SN") D WCP
 ;
 K LRLBL,ZTSK
 ;Clean-up CIDC variables
 K LRBEX,LRBEY,LRBEAR,LRBERF
 Q
 ;
 ;
ZX ; EP
 K:$G(LRORDR)'="P" LRCOM,LRTCOM
 N I,COMB,LRCPRS
 I $D(LRGCOM) S LRCCOM=LRGCOM D RCS^LRORD2
 S LRSXN=0,I=0
 F  S I=$O(LROT(LRSAMP,LRSPEC,I)) Q:I<1  S LRSXN=LRSXN+1
 ; L +^LRO(69,LRODT,1)
 L +^LRO(69,LRODT,1):5  ; IHS/MSC/MKK - LR*5.2*1032
 S LRSN=1+$P($G(^LRO(69,LRODT,1,0)),U,3)
 S LRSUM=1+$P($G(^LRO(69,LRODT,1,0)),U,4)
 ;
 ;
ZSN ; EP
 N I
 F  Q:'$D(^LRO(69,LRODT,1,LRSN,0))  S LRSN=LRSN+1
 S ^LRO(69,LRODT,1,LRSN,0)=LRDFN_"^"_DUZ_"^"_(+LRSAMP)_"^"_$S($L($G(LRLWC)):LRLWC,$L(LRORDR):LRORDR,1:"SP")_"^"_LRNT_"^"_LRPRAC_"^"_LRLLOC_"^"_LRODT_$S(+LRORDTIM:"."_LRORDTIM,1:"")_"^"_LROLLOC_"^^"_$G(LRORIFN)
 S ^LRO(69,LRODT,1,LRSN,2,0)="^69.03PA^"_LRSXN_U_LRSXN
 S ^LRO(69,LRODT,1,0)="^69.01PA^"_LRSN_U_LRSUM
 L -^LRO(69,LRODT,1)
 ;
 S:LRLLOC="" LRLLOC="."                          ; IHS/ANMC/CLS 08/18/96
 S ^LRO(69,LRODT,1,"AA",LRDFN,LRSN)=""
 S ^LRO(69,LRODT,1,"AC",LRLLOC,LRSN)=""
 S LROT(LRSAMP,LRSPEC,"SN")=LRSN
 S ^LRO(69,"D",LRDFN,LRODT,LRSN)=""
 S COMB=$P($G(^LRO(69,LRODT,1,LRSN,1)),"^",7)
 I $S($G(LRORDR)="":1,$G(LRORDR)="P":1,1:0) D
 . S $P(^LRO(69,LRODT,1,LRSN,1),"^")=$P(LRCDT,"^")
 . S $P(^LRO(69,LRODT,1,LRSN,1),"^",2)=$P(LRCDT,"^",2)
 . S $P(^LRO(69,LRODT,1,LRSN,1),"^",4)="C"
 . S $P(^LRO(69,LRODT,1,LRSN,1),"^",8)=DUZ(2)
 . ;S ^LRO(69,LRODT,1,LRSN,1)=LRCDT_"^^C^^^"_COMB_"^"_DUZ(2)
 . I $G(LRORDR)'="P" S ^LRO(69,"AA",+$G(LRORD),LRODT_"|"_LRSN)=""
 . ; PIECE 4 INDICATED COLLECTED (NOTE: LRCDT HAS 2 PIECES)
 ;
 I LRSPEC'="" S ^LRO(69,LRODT,1,LRSN,4,0)="^69.02PA^1^1",^(1,0)=LRSPEC
 S ^LRO(69,LRODT,1,LRSN,.1)=LRORD,^LRO(69,"C",+LRORD,LRODT,LRSN)="",LRJ=0
 F LRTN=1:1 S LRJ=$O(LROT(LRSAMP,LRSPEC,LRJ)) Q:LRJ<1  D ZSN1
 ;
 I $D(LRCOM(LRSAMP,LRSPEC)),LRCOM(LRSAMP,LRSPEC) D
 . N I
 . S X=LRCOM(LRSAMP,LRSPEC)
 . S ^LRO(69,LRODT,1,LRSN,6,0)="^69.04W^"_X_U_X
 . F I=1:1:X S ^LRO(69,LRODT,1,LRSN,6,I,0)=LRCOM(LRSAMP,LRSPEC,I)
 ;
 ; D:BLRLOG ^BLREVTQ("C","O",$G(BLROPT),,LRODT_","_LRSN)     ; IHS/DIR/MJL 09/20/99
 D:+$G(BLRLOG) ^BLREVTQ("C","O",$G(BLROPT),,LRODT_","_LRSN)     ; MSC/MKK - LR*5.2*1041
 ;
 D NEW^LR7OB1(LRODT,LRSN,"SN",$G(LRNATURE),.LRCPRS)
 I LRORDR="LC"!(LRORDR="I") D
 . S ION=$P($G(^LAB(69.9,1,3.5,+DUZ(2),0)),U,2)
 . S:ION="" ION=$P($G(^LAB(69.9,1,3)),U,4)
 . I ION'="",(LRORDR="LC"!(LRORDR="I")) D ^LROW2P
 I LRORDR="I" S ION=$P($G(^LAB(69.9,1,7,DUZ(2),0)),U,3) I ION'="" D ^LROW2P
 ; I $S(LRORDR="":1,LRORDR="P":1,1:0) D ^LRWLST
 ; ----- BEGIN IHS/ITSC/TPF **1015** 'SIGN OR SYMPTOM' LAB POV
 ; ABOVE COMMENTED OUT.
 ; THIS IS TO ACCOMODATE THE EDITING OF THE DIAGNOSIS ENTRY AFTER THE ENTIRE
 ; ORDER IS COMPLETE. THE CALL TO LRWLST IS DONE WITHIN BLRDIAG
 ; ----- END IHS/ITSC/TPF **1015** 'SIGN OR SYMPTOM' LAB POV
 ;
 Q
 ;
 ;
ZSN1 ;
 N LRORIFN
 S LRTSTS=LROT(LRSAMP,LRSPEC,LRJ),LRCPRS(LRTSTS)=""
 ; S ^LRO(69,LRODT,1,LRSN,2,LRTN,0)=LRTSTS_"^"_$S($D(LROT(LRSAMP,LRSPEC,LRJ,1)):LROT(LRSAMP,LRSPEC,LRJ,1),1:LROUTINE)
 ;----- BEGIN IHS MODIFICATION LR*5.2*1018
 S ^LRO(69,LRODT,1,LRSN,2,LRTN,0)=LRTSTS_"^"_$S($D(LROT(LRSAMP,LRSPEC,LRJ,1)):LROT(LRSAMP,LRSPEC,LRJ,1),$G(BLRGUI):LRURG,1:LROUTINE)
 ;----- END IHS MODIFICATION 
 D:+LRDPF=2&($G(LRSS)'="BB")&('$$CHKINP^LRBEBA4(LRDFN,LRODT))  ;CIDC
 .D SACC^LRBEBA2(LRODT,LRSN,LRTN,LRSAMP,LRSPEC,LRTSTS,.LRBEX)
 I $G(LRORIFN) S $P(^LRO(69,LRODT,1,LRSN,2,LRTN,0),"^",7)=LRORIFN ;OE/RR 2.5
 S $P(^LRO(69,LRODT,1,LRSN,2,LRTN,0),"^",9,10)="IP^L"
 S ^LRO(69,LRODT,1,LRSN,2,"B",LRTSTS,LRTN)=""
 S ^LRO(69,"AT",LRDFN,LRTSTS,LRSPEC,LRODT)="",^(-LRODT)=""
 D RCOM:$D(LROT(LRSAMP,LRSPEC,LRJ,2))
 D:$O(LRTCOM(LRTSTS,0)) TCOM^LROW2A(LRTSTS)
 Q
 ;
 ;
RCOM ; Required comment
 N LRTSTN,LRTEST
 S LRTSTN=1,LRTEST(LRTSTN)=LRTSTS
 ; S LRCCOM="~For Test: "_$P(^LAB(60,LRTSTS,0),U)_"   "_$P(^LAB(62,LRSAMP,0),U) S:$P(^(0),U)'=$P(^LAB(61,LRSPEC,0),U) LRCCOM=LRCCOM_"   "_$P(^LAB(61,LRSPEC,0),U) I $S('$D(DUZ("AG")):1,"ARMYAFN"'[DUZ("AG"):1,1:0) W !,LRCCOM
 ;----- BEGIN IHS MODIFICATION LR*5.2*1018
 S LRCCOM="~For Test: "_$P(^LAB(60,LRTSTS,0),U)_"   "_$P(^LAB(62,LRSAMP,0),U) S:$P(^(0),U)'=$P(^LAB(61,LRSPEC,0),U) LRCCOM=LRCCOM_"   "_$P(^LAB(61,LRSPEC,0),U) I $S('$D(DUZ("AG")):1,"ARMYAFN"'[DUZ("AG"):1,1:0) W:'$G(BLRGUI) !,LRCCOM
 ;----- END IHS MODIFICATION
 S LREXP=LROT(LRSAMP,LRSPEC,LRJ,2)
 D RCS^LRORD2,RCOM^LRORD2
 I $G(LRKIL) S DA(1)=LRODT,DA=LRSN,DIK="^LRO(69,"_DA(1)_",1," D ^DIK Q
 I LRCCOM="",$D(LRCOM(LRSAMP,LRSPEC)) S X=+LRCOM(LRSAMP,LRSPEC) I $D(LRCOM(LRSAMP,LRSPEC,X)),LRCOM(LRSAMP,LRSPEC,X)["~For Test:" K LRCOM(LRSAMP,LRSPEC,X) S LRCOM(LRSAMP,LRSPEC)=X-1
 Q
 ;
 ;
OLD ; to allow unchanged routines to still work, from LROE1, LRPHSET1
 N LRNT
 D DT,NOW^%DTC
 S LRNT=%
 I $P(LRPARAM,U,4),'$D(LRNOLABL),'$D(LRTJ) D ^LRLABLIO
 D ^LRWLST
 Q
 ;
 ;
WCP Q:$D(LRNCWL)
 S:$D(LRORDER) ION=LRORDER
 ; I '$D(LRORDER) K %ZIS S IOP="HOME",%ZIS="NQ" D ^%ZIS G:POP WCP1 S X=ION,DIC(0)="EQ",DIC=3.5 D ^DIC G:Y<1 WCP1 G:'$D(^%ZIS(1,+Y,99)) WCP1 G:'$L($P(^(99),U)) WCP1 S IOP=$P(^%ZIS(1,$P(^(99),U),0),U),%ZIS="NQ" D ^%ZIS G:POP WCP1 K %ZIS,IOP
 ;----- BEGIN IHS/OIT/MKK MODIFICATION LR*5.2*1019 -- DIC(0)="EQX" fix
 I '$D(LRORDER) K %ZIS S IOP="HOME",%ZIS="NQ" D ^%ZIS G:POP WCP1 S X=ION,DIC(0)="EQX",DIC=3.5 D ^DIC G:Y<1 WCP1 G:'$D(^%ZIS(1,+Y,99)) WCP1 G:'$L($P(^(99),U)) WCP1 S IOP=$P(^%ZIS(1,$P(^(99),U),0),U),%ZIS="NQ" D ^%ZIS G:POP WCP1 K %ZIS,IOP
 ;----- END IHS MODIFICATION LR*5.2*1019
WCP2 S LRORDER=ION
 I IO(0)=IO R !!,"Press RETURN to continue...",X:DTIME S IOP=LRORDER,%ZIS="" D ^%ZIS D ENT2^LROW2P Q
 I IO'=IO(0) D ^LROW2P Q
 Q
 ;
 ;
DT S DT=$$DT^XLFDT()
 Q
 ;
 ;
WCP1 S %ZIS="NQ",%ZIS("A")="ORDER COPY DEVICE:"
 D ^%ZIS
 Q:POP
 G WCP2
 ;
 ;
OR ;OE/RR 2.5
 ; Q  ;Following logic not required - 2.5 is obsolete version
 I $$VER^LR7OU1>2.5 Q   ; OE/RR 2.5 Logic put back in -- IHS/MSC/MKK - LR*5.2*1031
 N LRORDR
 Q:$G(LRORDRR)="R"
 S LRY=$S($D(LROT(LRSAMP,LRSPEC,LRJ,1)):LROT(LRSAMP,LRSPEC,LRJ,1),1:LROUTINE),LRI=1,LRTEST(LRI)=LRTSTS_"^"_LRY,LRORDR=$S($L($G(LRLWC)):LRLWC,1:"")
 D SET^LROR
 Q
 ;
 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1035
 ; There was a major bug regarding Multipurpose accessioning in LR*5.2*1034.
 ; This code is the fix, but it's not known, at this time, what change caused the problem.
 ; It deals with the improper SPECIMEN TYPE being stored into the Lab Data file during
 ; accessioning, even though the Accession file has the correct SPECIMEN.
BUG1034F(LRORD) ; EP
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,LRORD,U,XPARSYS,XQXFLG)
 ;
 S LRODT=0
 F  S LRODT=$O(^LRO(69,"C",LRORD,LRODT))  Q:LRODT<1  D
 . S LRSP=0
 . F  S LRSP=$O(^LRO(69,"C",LRORD,LRODT,LRSP))  Q:LRSP<1  D
 .. S LROT=0
 .. F  S LROT=$O(^LRO(69,LRODT,1,LRSP,2,LROT))  Q:LROT<1  D
 ... S STR=$G(^LRO(69,LRODT,1,LRSP,2,LROT,0))
 ... S LRAD=+$P(STR,U,3),LRAA=+$P(STR,U,4),LRAN=+$P(STR,U,5)
 ... S LRSS=$P($G(^LRO(68,LRAA,0)),U,2)
 ... S LRDFN=+$G(^LRO(68,LRAA,1,LRAD,1,LRAN,0)),LRIDT=+$P($G(^(3)),U,5)
 ... S LRSPEC=+$G(^LRO(68,LRAA,1,LRAD,1,LRAN,5,1,0))
 ... S COLLSAMP=+$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,5,1,0)),U,2)
 ... Q:LRSS'="BB"&(LRSS'="CH")&(LRSS'="MI")
 ... I LRSPEC,LRDFN,LRIDT,$L(LRSS) D
 .... S $P(^LR(LRDFN,LRSS,LRIDT,0),U,5)=LRSPEC
 .... S:LRSS="MI"!(LRSS="BB") $P(^LR(LRDFN,LRSS,LRIDT,0),U,11)=$S(COLLSAMP:COLLSAMP,1:"")
 Q