source: FOIAVistA/trunk/r/LAB_SERVICE-LR-LS/LROS.m@ 677

Last change on this file since 677 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 5.7 KB
Line 
1LROS ;SLC/CJS/DALOI/FHS-LAB ORDER STATUS ;8/11/97
2 ;;5.2;LAB SERVICE;**121,153,202,210,221,263**;Sep 27, 1994
3 N LRLOOKUP S LRLOOKUP=1 ; Variable to indicate to lookup patients, prevent adding new entries in ^LRDPA
4EN K DIC,LRDPAF,%DT("B") S DIC(0)="A"
5 D ^LRDPA G:(LRDFN=-1)!$D(DUOUT)!$D(DTOUT) LREND D L0 G EN
6L0 D ENT S %DT="" D DT^LRX
7L1 S LREND=0,%DT="E",%DT("A")="DATE to begin review: " D DATE^LRWU G LREND:Y<1 S (LRSDT,LRODT)=Y S %DT="",X="T-"_$S($P($G(^LAB(69.9,1,0)),U,9):$P(^(0),U,9),1:30) D ^%DT S LRLDAT=Y
8L2 S LRSN=$O(^LRO(69,LRODT,1,"AA",LRDFN,0)) I LRSN<1 S Y=LRODT D DD^LRX W !,"No orders for ",Y S X1=LRODT,X2=-1 D C^%DTC S LRODT=X I LRODT<LRLDAT W !!,"NO REMAINING ACTIVE ORDERS",! G LREND
9 D WAIT:$Y>18 G LREND:LREND,L2:LRSN<1
10 I LRSDT'=LRODT W !,"Orders for date: " S Y=LRODT D DD^LRX W Y," OK" S %=1 D YN^DICN I %'=1 G LREND
11 D ENTRY G LREND:LREND S X1=LRODT,X2=-1 D C^%DTC S LRODT=X
12 G L2
13ENTRY D HED Q:LREND
14 S LRSN=0 F S LRSN=$O(^LRO(69,LRODT,1,"AA",LRDFN,LRSN)) Q:LRSN<1!($G(LREND)) D ORDER Q:$G(LREND) D HED:$Y>(IOSL-2)
15 Q
16ORDER ;call with LRSN, from LROE, LROE1, LRORD1, LROW2, LROR1
17 K D,LRTT S LREND=0
18 Q:'$D(^LRO(69,LRODT,1,LRSN,0)) S LROD0=^LRO(69,LRODT,1,LRSN,0),LROD1=$S($D(^(1)):^(1),1:""),LROD3=$S($D(^(3)):^(3),1:"")
19 W !?2,"-Lab Order # ",$S($D(^LRO(69,LRODT,1,LRSN,.1)):^(.1),1:"") S X=$P(LROD0,U,6) D DOC^LRX W ?45,"Provider: ",$E(LRDOC,1,25) D WAIT Q:$G(LREND)
20 S X=$P(LROD0,U,3),X=$S(X:$S($D(^LAB(62,+X,0)):$P(^(0),U),1:""),1:""),X4="" I $D(^LRO(69,LRODT,1,LRSN,4,1,0)),+^(0) S X4=+^(0),X4=$S($D(^LAB(61,X4,0)):$P(^(0),U),1:"")
21 I $E($P(LROD1,U,6))="*" W !?3,$P(LROD1,U,6) D WAIT Q:$G(LREND)
22 I $G(^LRO(69,LRODT,1,LRSN,"PCE")) W !,?5,"Visit Number(s): ",$G(^("PCE")) D WAIT Q:$G(LREND)
23 W !?2,X," " W:X'[X4 X4 S I=0 F S I=$O(^LRO(69,LRODT,1,LRSN,6,I)) Q:I<1!($G(LREND)) W !?5,": ",^(I,0) D WAIT Q:$G(LREND)
24 S LRACN=0 F S LRACN=$O(^LRO(69,LRODT,1,LRSN,2,LRACN)) Q:LRACN<1!($G(LREND)) I $D(^(LRACN,0))#2 S LRACN0=^(0) D TEST
25 Q
26TEST N LRY,LRURG
27 S LRROD=$P(LRACN0,U,6),(Y,LRLL,LROT,LROS,LROSD,LRURG)="",X3=0
28 I $P(LRACN0,"^",11) G CANC
29 S X=$P(LROD0,U,4),LROT=$S(X="WC":"Requested (WARD COL)",X="SP":"Requested (SEND PATIENT)",X="LC":"Requested (LAB COL)",X="I":"Requested (IMM LAB COL)",1:"undetermined")
30 S X=$P(LROD1,U,4),(LROOS,LROS)=$S(X="C":"Collected",X="U":"Uncollected, cancelled",1:"On Collection List") S:X="C" LROT=""
31 I '(+LRACN0) W !!,"BAD ORDER ",LRSN,!,$C(7) D WAIT Q
32 G NOTACC:LROD1="" ;,NOTACC:$P(LROD1,"^",4)="U"
33TST1 S X1=+$P(LRACN0,U,4),X2=+$P(LRACN0,U,3),X3=+$P(LRACN0,U,5)
34 G NOTACC:'$D(^LRO(68,X1,1,X2,1,X3,0)),NOTACC:'$D(^(3)) S LRACD=$S($D(^(9)):^(9),1:"")
35 I '$D(LRTT(X1,X2,X3)) S LRTT(X1,X2,X3)="",I=0 F S I=$O(^LRO(68,X1,1,X2,1,X3,4,I)) Q:I<.5!($G(LREND)) S LRACC=^(I,0),LRTSTS=+LRACC D TST2
36 I $E($P(LROD1,U,6))="*" W !,?20,$P(LROD1,U,6) D WAIT
37 Q
38TST2 ;
39 N I
40 S LRURG=+$P(LRACC,U,2) I LRURG>49 Q
41 I 'LRTSTS W !!,"BAD ACCESSION TEST POINTER: ",LRTSTS Q
42 S LROT="",LROS=LROOS,LRLL=$P(LRACC,U,3),Y=$P(LRACC,U,5) I Y S LROS=$S($E($P(LRACC,U,6))="*":$P(LRACC,U,6),1:"Test Complete") D DATE S LROSD=Y D WRITE,COM(1.1),COM(1) Q
43 S Y=$P(LROD3,U) D DATE S LROSD=Y I LRLL S LROS="Testing In Progress"
44 I $P(LROD1,"^",4)="U" S (LROS,LROOS)=""
45 D WRITE,COM(1.1),COM(1)
46 Q
47WRITE ;
48 W !?2,$S($D(^LAB(60,+LRTSTS,0)):$P(^(0),U),1:"BAD TEST POINTER")
49 I $X>20 W ! D WAIT Q:(LREND)
50 W ?20,$S($D(^LAB(62.05,+LRURG,0)):$P(^(0),U),1:"")," " D WAIT Q:$G(LREND)
51 I $X>28 W ! D WAIT Q:$G(LREND)
52 W ?28,LROT," ",LROS,?43," ",LROSD
53 W:X3 ?60," ",$S($D(^LRO(68,X1,1,X2,1,X3,.2)):^(.2),1:"")
54 I LRROD W !?46," See order: ",LRROD D WAIT
55 Q
56COM(LRMMODE) ;
57 ;Write comments
58 ;LRMMODE=comments node to display
59 N LRTSTI
60 S:'$G(LRMMODE) LRMMODE=1
61 S LRTSTI=$O(^LRO(69,LRODT,1,LRSN,2,"B",+LRTSTS,0)) Q:'LRTSTI
62 D COMWRT(LRODT,LRSN,LRTSTI,LRMMODE,3)
63 Q
64COMWRT(LRODT,LRSN,LRTSTI,NODE,TAB) ;
65 ;Write comment node
66 I $S('LRODT:1,'LRSN:1,'LRTSTI:1,'NODE:1,1:0) Q
67 Q:'$D(^LRO(69,LRODT,1,LRSN,2,LRTSTI))
68 S:'$G(TAB) TAB=3
69 N LRI
70 S LRI=0 F S LRI=$O(^LRO(69,LRODT,1,LRSN,2,LRTSTI,NODE,LRI)) Q:LRI<1!($G(LREND)) W:$D(^(LRI,0)) !?TAB,": "_^(0) D WAIT
71 Q
72NOTACC I $G(LROD3)="" S LROS="" G NO2
73 I $P(LROD3,U,2)'="" S LROS=" ",Y=$P(LROD3,U,2) G NO2
74 S Y=$P(LROD3,U) S LROS=" "
75NO2 S:'Y Y=$P(LROD0,U,8) S Y=$S(Y:Y,+LROD3:+LROD3,+LROD1:+LROD1,1:LRODT) D DATE S LROSD=Y
76 S LRTSTS=+LRACN0,LRURG=$P(LRACN0,U,2)
77 S LROS=$S(LRROD:"Combined",1:LROS) S:LROS="" LROS="for: "
78 I LRTSTS D WRITE,COM(1.1),COM(1) ;second call for backward compatibility - can be removed in future years (1/98)
79 I $L($P(LROD1,U,6)) W !,?20,$P(LROD1,U,6) D WAIT
80 Q
81DATE S Y=$$FMTE^XLFDT(Y,"5MZ") Q
82HED D WAIT:$E(IOST,1)="C"&($Y>18) Q:$G(LREND) W @IOF,!," Test",?20,"Urgency",?30,"Status",?64,"Accession"
83ENT ;from LROE, LROE1, LRORD1, LROW2
84 Q
85LREND I $E(IOST)="P" W @IOF
86 S:$D(ZTQUEUED) ZTREQ="@"
87 K LRLDAT,LRURG,LROSD,LRTT,LROS,LROOS,LRROD,X1,X2,X3,%,A,DFN,DIC,I,K,LRACC,LRACN,LRACN0,LRDFN,LRDOC,LRDPF,LREND,LRLL,LROD0,LROD1,LROD3,LRODT,LROT,LRSDT,LRSN,LRTSTS,X,X4,Y,Z,%Y,DIWL,DIWR,DPF,PNM Q
88SHOW ;call with LRSN,LRODT, from LRCENDEL, LRTSTJAN
89 S LREND=0
90 W !,"Order Test",?20,"Urgency",?30,"Status",?64,"Accession" D ORDER Q
91WAIT Q:$Y<(IOSL-3) I $E(IOST)'="C" W @IOF Q
92 W !," PRESS '^' TO STOP " R X:DTIME S:X="" X=1 S LREND=".^"[X Q:$G(LREND) W @IOF
93 Q
94CANC ;For Canceled tests
95 S LRTSTS=+$G(LRACN0),LROT="*Canceled by: "_$P(^VA(200,$P(LRACN0,"^",11),0),U)
96 I LRTSTS D WRITE,COM(1.1),COM(1) ;second call for backward compatitility - can be removed in future years (1/98)
97 Q
98OERR(X) ;Get order status for predefined patient
99 ;X=DFN;DPT( <--ORVP FORMAT
100 I '$G(X) W !!?5,"NO PATIENT SELECTED",! H 2 Q
101 N DFN,LRDPA,LRDFN,LRDT0,VA200
102 S DFN=+X,LRDPF=+$P(@("^"_$P(X,";",2)_"0)"),"^",2)_"^"_$P(X,";",2)
103 D END^LRDPA
104 Q:LRDFN=-1
105 W !,"Lab test status for: "_$P(^DPT(DFN,0),"^")
106 D L0
107 Q
Note: See TracBrowser for help on using the repository browser.