source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LR7OSOS.m@ 1042

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

initial load of WorldVistAEHR

File size: 4.1 KB
Line 
1LR7OSOS ;slc/dcm - Lab order status for OE/RR ;8/11/97
2 ;;5.2;LAB SERVICE;**121,201,187,230**;Sep 27, 1994
3EN(OMEGA,ALPHA) ;'...the last shall be first...the first shall be last'
4 N LRODT,LRSN,LREND
5 U IO
6 S LRODT=$S($G(ALPHA):ALPHA,1:""),LREND=0
7 F S LRODT=$O(^LRO(69,"D",LRDFN,LRODT),-1) Q:LRODT<1!(LRODT<OMEGA) D ENTRY Q:LREND
8 Q
9ENTRY D HED
10 S LRSN=0
11 F S LRSN=$O(^LRO(69,"D",LRDFN,LRODT,LRSN)) Q:LRSN<1 D ORDER,HED:$Y>(IOSL-3) Q:LREND
12 Q
13ORDER ;call with LRODT,LRSN
14 N LROD0,LROD1,LROD3,X,LRDOC,X4,I,LRACN,LRACN0
15 K D,LRTT 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:"")
16 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)
17 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:"")
18 W !?2,X," " W:X'[X4 X4 S I=0 F S I=$O(^LRO(69,LRODT,1,LRSN,6,I)) Q:I<1 W !?5,": ",^(I,0)
19 S LRACN=0 F S LRACN=$O(^LRO(69,LRODT,1,LRSN,2,LRACN)) Q:LRACN<1 I $D(^(LRACN,0))#2 S LRACN0=^(0) D TEST
20 Q
21TEST ;
22 N LRY,LRURG,LRROD,Y,LRLL,LROT,LROS,LROOS,LROSD,LRURG,X3,X,X1,X2,LRACD,LRACC,LRTSTS
23 S LRROD=$P(LRACN0,U,6),(Y,LRLL,LROT,LROS,LROSD,LRURG)="",X3=0
24 I $P(LRACN0,"^",11) G CANC
25 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")
26 S X=$P(LROD1,U,4),(LROOS,LROS)=$S(X="C":"Collected",X="U":"Uncollected, cancelled",1:"On Collection List") S:X="C" LROT="" I '(+LRACN0) W !!,"BAD ORDER ",LRSN,!,$C(7) Q
27 G NOTACC:LROD1=""
28TST1 S X1=+$P(LRACN0,U,4),X2=+$P(LRACN0,U,3),X3=+$P(LRACN0,U,5)
29 G NOTACC:'$D(^LRO(68,X1,1,X2,1,X3,0)),NOTACC:'$D(^(3)) S LRACD=$S($D(^(9)):^(9),1:"")
30 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 S LRACC=^(I,0),LRTSTS=+LRACC D TST2
31 W:$L($P(LROD1,U,6)) !,?20,$P(LROD1,U,6)
32 Q
33TST2 ;
34 N I,LRURG,LROT,LROS,LRLL,Y,LROSD
35 S LRURG=+$P(LRACC,U,2) I LRURG>49 Q
36 I 'LRTSTS W !!,"BAD ACCESSION TEST POINTER: ",LRTSTS Q
37 S LROT="",LROS=LROOS,LRLL=$P(LRACC,U,3),Y=$P(LRACC,U,5) I Y S LROS="Test Complete" D DATE S LROSD=Y D WRITE,COM(1) Q
38 S Y=$P(LROD3,U) D DATE S LROSD=Y I LRLL S LROS="Testing In Progress"
39 I $P(LROD1,"^",4)="U" S (LROS,LROOS)=""
40 D WRITE,COM(1)
41 Q
42WRITE ;
43 W !?2,$S($D(^LAB(60,+LRTSTS,0)):$P(^(0),U),1:"BAD TEST POINTER") W:$X>20 ! W ?20,$S($D(^LAB(62.05,+LRURG,0)):$P(^(0),U),1:"")," "
44 W:$X>28 ! W ?28,LROT," ",LROS,?48," ",LROSD
45 W:X3 ?62," ",$S($D(^LRO(68,X1,1,X2,1,X3,.2)):^(.2),1:"") W:LRROD !?46," See order: ",LRROD
46 Q
47COM(COMNODE) ;Write comment
48 ;COMNODE=Comment node to write
49 S:'$G(COMNODE) COMNODE=1
50 I LRTSTS=+LRACN0 S I=0 F S I=$O(^LRO(69,LRODT,1,LRSN,2,LRACN,COMNODE,I)) Q:I<1 W !?3,": "_^(I,0)
51 Q
52NOTACC I LROD3="" S LROS="" G NO2
53 I $P(LROD3,U,2)'="" S LROS=" ",Y=$P(LROD3,U,2) G NO2
54 S Y=$P(LROD3,U) S LROS=" "
55NO2 S:'Y Y=$P(LROD0,U,8) S Y=$S(Y:Y,+LROD3:+LROD3,+LROD1:+LROD1,1:LRODT) D DATE S LROSD=Y
56 S LRTSTS=+LRACN0,LRURG=$P(LRACN0,U,2)
57 S LROS=$S(LRROD:"Combined",1:LROS) S:LROS="" LROS="for: "
58 D WRITE:LRTSTS,COM(1)
59 W:$L($P(LROD1,U,6)) !,?20,$P(LROD1,U,6)
60 Q
61DATE S Y=$$FMTE^XLFDT($P(Y,"."),"5Z")_$S(Y#1:" "_$E(Y_0,9,10)_":"_$E(Y_"000",11,12),1:"") Q
62HED D WAIT:$E(IOST,1)="C"&($Y>21) Q:LREND
63 I $O(^LRO(69,"D",LRDFN,LRODT,0)) W !!,"Orders for date: " S Y=LRODT D DD^LRX W Y
64 W @IOF," Test",?20,"Urgency",?30,"Status",?64,"Accession"
65 Q
66WAIT W !," PRESS '^' TO STOP " R X:DTIME S:X="" X=1 S LREND=".^"[X
67 Q
68CANC ;For Canceled tests
69 N LRTSTS
70 S LRTSTS=+LRACN0,LROT="Canceled by: "_$P(^VA(200,$P(LRACN0,"^",11),0),"^")
71 D WRITE:LRTSTS,COM(1.1),COM(1) ;second call for backward compatibility - can be removed in future years (1/98)
72 Q
73OERR(X,ALPHA,OMEGA) ;Get order status for predefined patient
74 ;X=DFN;DPT( <--ORVP FORMAT
75 ;ALPHA=start date
76 ;OMEGA=end date
77 I '$G(X) W !!?5,"NO PATIENT SELECTED",! H 2 Q
78 Q:'$G(ALPHA) Q:'$G(OMEGA)
79 N DFN,LRDFN,LRDPF,LRDT0,VA200
80 S DFN=+X,LRDPF=+$P(@("^"_$P(X,";",2)_"0)"),"^",2)_"^"_$P(X,";",2),LRDFN=$$LRDFN^LR7OR1(DFN)
81 Q:'LRDFN
82 W !,"Lab test status for: "_$P(^DPT(DFN,0),"^")
83 D EN(ALPHA,OMEGA)
84 Q
Note: See TracBrowser for help on using the repository browser.