VistA-WorldVistAEHR/r/LAB_SERVICE-LR-LS/LROW.m

57 lines
3.0 KiB
Mathematica

LROW ;SLC/CJS/JAH - LAB ORDER ENTRY, WARD ;8/10/04
;;5.2;LAB SERVICE;**100,121,291**;Sep 27, 1994
;
W10 ;
K LRBEOT,LRBEQT,LRBEVT,LRBETS,LRBEX,LRBEY,LRBEZ,LRBETYP,LRBEODT,LRBERF
D ^LRPARAM K X3,LRNATURE S U="^" D DT^LRX I $D(LRADDTST) Q:LRADDTST=""
D NOW^%DTC S LRCDT=% I $G(DFN) D EN2^LRDPA(DFN,0,0)
K LRSN,LRCOM,DTOUT,LRTCOM W !! S (LRSN,LRMOR,LRNN)=0 I $D(LRADDTST),$P(LRADDTST,U,2)'="OUT" G MORE
K DIC,DFN,LRXST,X3 S DIC(0)="EMQZ",PNM="" D ^LRDPA G LREND^LROW4:(LRDFN=-1)!$D(DUOUT)!$D(DTOUT)
D EN2^LRDPA(DFN,1,1) I 'Y G W10
S LRDPF=$P(^LR(LRDFN,0),U,2)
Q12 D LOC^LRWU G W10:LREND
D L5 G LREND^LROW4:LREND
G PRAC
Q12A S S=$S($D(^LRO(69,LRODT,1,DA,4,1,0)):+^(0),1:0) S I=0 F S I=$O(^LRO(69,LRODT,1,DA,2,I)) Q:I<1 S T(+^(I,0),DA)=S,X=+^(0) S:'$D(TT(X,S)) TT(X,S)=0 S TT(X,S)=TT(X,S)+1
Q
PRAC D PRAC^LRWU1 I LREND W !!,$C(7),"ORDER CANCELED",!! G W10
F I=0:0 K LROUTINE,DIC,LRY,LRURG W !,"Will the urgency for all tests ordered for this patient at this time be",!,$P(^LAB(62.05,+$P(^LAB(69.9,1,3),U,2),0),U) S %=1 D YN^DICN Q:% W " Answer 'Y'es or 'N'o."
I %<0 S LREND=1 W !!,$C(7),"ORDER CANCELED",!! G W10
I %'=2 S LROUTINE=$P(^LAB(69.9,1,3),U,2)
MORE ;from LROR
K T,TT,LRCOM,LRTCOM,LROT,LRTMAX,LRDTST,LRDMAX,LRBEX
S DA=0 F S DA=$O(^LRO(69,LRODT,1,"AA",LRDFN,DA)) Q:DA<1 I $S($D(^LRO(69,LRODT,1,DA,1)):$P(^(1),U,4)'="U",1:1) S LRSAMP=$P(^(0),U,3) D Q12A
S LRCCOM="" D ^LROW1
S LRBEY=1 I +LRDPF=2&($G(LRSS)'="BB")&('$$CHKINP^LRBEBA4(LRDFN,LRODT)) D G LEND:'LRBEY
.D BALROW^LRBEBA3(LRODT,LRSN,.LRTEST)
Q:$D(DIROUT) I $D(LRADDTST),$P(LRADDTST,U,2)="OUT" G NOMORE
G W10:LRTSTN=0
NOMORE ;from LROR
S LRSNO=LRDFN_"^"_DUZ_"^^"_LRLWC_"^"_LRCDT_"^"_LRPRAC_"^"_LRLLOC_"^"_LRODT_$S(+LRORDTIM:"."_LRORDTIM,1:"")
D ^LROW3 I %["N"!$D(DTOUT)!(%["^")!'$D(LRXST) D W20 G LREND^LROW4:$D(LRADDTST),W10
D LROW^LRORDD
D REST^LROW2 K LRBEX,LRORIFN Q:$D(LRADDTST)
S DIR(0)="Y",DIR("A")="Do you want to place another order for this patient",DIR("B")="NO" D ^DIR K DIR
G W10:Y'=1
K X3,LRY,LRURG,LROUTINE D @$S(LRLWC="I":"^LRORDIM",1:"NEXTCOL^LROW5") G W10:LREND,MORE
W20 ;from LROE1
K LRSNO,LRLLOC,LROLLOC,LRTREA,LRCDT,LRSN,LRSTATUS W:$D(LRXST) !!,$C(7),$S($D(LRADDTST):"ADDITIONAL ",1:""),"ORDER DELETED",! K LRXST Q
L5 ;from LROR, LROR4
;S LREND=0 W !," (S)END patient to lab",!," (W)ARD collect & deliver",!," (B)LOOD orders for lab draw",!," (I)MMED Lab Collect ",!
L5A ;R !,"Select: ",X:DTIME G LEND:X["^"!'$T,L5:X="" S X=$E(X,1)
;I "SBWI"'[X W !,"Enter 'S' for SEND TO LAB",!?6,"'W' for WARD COLLECT",!?6,"'B' for BLOOD COLLECTED BY LAB.",!?6,"'I' for Immediate Lab Collect",!?6,"'^' to Exit." G L5A
;S LRLWC=$S(X["W":"WC",X["S":"SP",X["I":"I",1:"LC")
L5B ;
D COLTY^LRWU Q:LREND
I LRLWC="I" D ^LRORDIM S:'$D(LRCDT) LREND=1 Q:LREND S ^LRO(69,LRODT,0)=LRODT,^LRO(69,"B",LRODT,LRODT)="" Q
D NEXTCOL^LROW5 Q:LREND S ^LRO(69,LRODT,0)=LRODT,^LRO(69,"B",LRODT,LRODT)="" Q
LEND ;from LROW5
S LREND=1 Q
TIME ;from LROW5
S Z=$S(+$E(Y,1,2)>11:"PM",1:"AM"),Y=$E(Y_0,1,2)-$S($E(Y_0,1,2)=12:0,Z="PM":12,1:0)_":"_$E(Y_"000",3,4)_Z
W Y
Q
ADD ;from LRAD2ORD
Q:LRADDTST="" D DT^LRX D W10
Q