source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRCE.m@ 1716

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

initial load of WorldVistAEHR

File size: 6.8 KB
Line 
1LRCE ;SLC/RWF/DALOI/JMC - LOOK-UP ON CENTRAL ENTRY # ;8/11/97
2 ;;5.2;LAB SERVICE;**28,76,103,121,153,210,202,263**;Sep 27, 1994
3EN ;
4 S (LRSTOP,LRFLAG1,LRFLG,LRSN1,LRNOP)=0
5 K DIRUT,SSN,LRORD
6 W !!
7 S DIR("A")="Order Number or UID: ",DIR(0)="FOA"
8 S DIR("?",1)="Enter a whole number for the order number, enter the universal identifier"
9 S DIR("?",2)="(UID), or press Return to find the order number by Patient.",DIR("?")="Enter '^' to Exit."
10 D ^DIR
11 I $G(SSN)&(Y="") G END
12 I Y="" D ^LROS G:'$G(SSN) END G EN
13NEXT I $D(DIRUT) G END
14 D UNIV
15 S LRORD=+Y I LRORD?.AP!(LRORD<1) D G EN
16 . W !,"Enter a whole number for the order number."
17 S LRORD=+LRORD
18 K DIR,X,Y,DIRUT
19 IF $O(^LRO(69,"C",LRORD,0))<1 W " NUMBER NOT FOUND" G LRCE
20DIS ;
21 W @IOF
22 I $D(LRADDTST) D
23 . W !!?15,"LISTING OF DATES "
24 . S (CNT,LRODT)=0
25 . F A=0:0 S LRODT=$O(^LRO(69,"C",LRORD,LRODT)) Q:LRODT="" D
26 .. D CHKPAGE Q:$G(LRSTOP)
27 .. S CNT=CNT+1
28 .. W !?5,CNT,?10,$$FMTE^XLFDT(LRODT,"5FM")
29 Q:$G(LRSTOP) K CNT,A
30 S LRODT=0
31 F S LRODT=$O(^LRO(69,"C",LRORD,LRODT)) Q:LRODT<1!($G(LRSTOP)) D I $D(LRADDTST),+LRADDTST Q
32 . D LR2
33 I $D(LRADDTST) G LRCE:LRADDTST="" G END
34 I '$D(LRADDTST) G EN
35 Q
36ADDTST ;
37 S LRADDTST="" D EN
38 S LRRSTAT=160
39 I LRADDTST D ^LRORD
40 D END,ADDEND
41 Q
42ADDEND ;
43 K LRCLCTR,LRCLST,LRDFN,LRDPF,LRDRWTM,LRFLAG1,LRFLG
44 K LRLLOC,LRLOC,LRODT,LROLLOC,LRORDRR,LRPRAC,LRRB
45 K LRRSITE,LRSD,LRDN,LRSTOP,LRTREA,LRSN,LRTSN,LRTSP,PNM,SSN,DOB,SEX
46 K TYPE,LRRSTAT,LRNOP,LRSN1
47 K X,Y,I
48 Q
49LR2 ;
50 Q:$G(LRSTOP)
51 D CHKPAGE
52 Q:$G(LRSTOP)
53 S LRSN=0
54 F S LRSN=+$O(^LRO(69,"C",+$G(LRORD),+$G(LRODT),LRSN)) Q:LRSN<1!($G(LRSTOP)) D PT I $D(LRADDTST),+LRADDTST Q
55 Q
56UNIV ; see if entry is UID
57 N LRAA,LRAD,LRAN I $D(^LRO(68,"C",X)) S LRAA=$O(^LRO(68,"C",X,0)) I LRAA S LRAD=$O(^LRO(68,"C",X,LRAA,0)) I LRAD S LRAN=$O(^LRO(68,"C",X,LRAA,LRAD,0)) I LRAN S Y=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,.1)),"^")
58 Q
59CHKPAGE ;
60 Q:$G(LRSTOP)
61 Q:$Y<(IOSL-2)
62 K DIR
63 S DIR(0)="E"
64 D ^DIR
65 I $D(DUOUT)!($D(DIRUT)) S LRSTOP=1 Q
66 W @IOF
67 W !
68 Q
69PT ;
70 D CHKPAGE
71 Q:$G(LRSTOP)!($G(LRFLG))
72 S LROR=$S($D(^LRO(69,LRODT,1,LRSN,0)):^(0),1:-1)
73 S LRDFN=+LROR
74 I LRDFN<1 W " NO PATIENT" Q
75 S LRWHOE=+$P(LROR,U,2)
76 S LRWHOE=$S($D(^VA(200,LRWHOE,0)):$P(^(0),U),1:"")
77 S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3)
78 D PT^LRX
79 H 1
80HEAD ;
81 D CHKPAGE
82 Q:$G(LRSTOP)
83 W !!,"ORDER #: ",LRORD,?20,"PAT: ",PNM," SSN: ",SSN,!
84 D CHKPAGE
85 Q:$G(LRSTOP)
86 D LRGLIN^LRX
87 W !
88 S LRCTYP=$P(LROR,U,4)
89 I ($L(LRWHOE))!($L(LRCTYP)) D
90 . I $L(LRWHOE) W "WHO ENTERED: ",$E(LRWHOE,1,25) K LRWHOE
91 . W:$L(LRCTYP) ?40,"TYPE OF COLLECTION: ",LRCTYP
92 I $D(^LRO(69,LRODT,1,LRSN,1)) D
93 . S LRCLCTR=$P(^LRO(69,LRODT,1,LRSN,1),U,3),LRCLST=$P(^(1),U,4)
94 . S:$L(LRCLCTR) LRCLCTR=$P($G(^VA(200,+LRCLCTR,0)),U)
95 . W ! D CHKPAGE Q:$G(LRSTOP)
96 . W:$L(LRCLCTR) " COLLECTOR : ",$E(LRCLCTR,1,25)
97 . W:$L(LRCLST) ?40,"COLLECTION STATUS: ",LRCLST
98 Q:$G(LRSTOP) S LRDRWTM=$S($D(^LRO(69,LRODT,1,LRSN,1)):+^(1),1:"")
99 S:LRDRWTM LRDRWTM=$$FMTE^XLFDT(LRDRWTM,"5FM")
100 S LRLOC=+$P(LROR,U,9),LRLOC=$P($G(^SC(LRLOC,0)),U)
101 I ($L(LRDRWTM))!($L(LRLOC)) D
102 . W ! D CHKPAGE Q:$G(LRSTOP)
103 . W:$L(LRDRWTM) " DRAW TIME: ",LRDRWTM
104 . I '$L(LRDRWTM),$P(LROR,"^",8) W "TO BE DRAWN: ",$$FMTE^XLFDT($P(LROR,U,8),"5FM")
105 . W:$L(LRLOC) ?40,"ORDERING LOCATION: ",$E(LRLOC,1,20)
106 Q:$G(LRSTOP) W ! D CHKPAGE Q:$G(LRSTOP)
107 I $G(^LRO(69,LRODT,1,LRSN,3)) W " LAB ARRIVAL: ",$$FMTE^XLFDT(+$G(^(3)),"5FM")
108 I LRDPF=2 W:$L(LRWRD) ?40,"WARD: ",LRWRD
109 W:$P(LROR,U,3) !," SPECIMEN: " D CHKPAGE Q:$G(LRSTOP)
110 W:$P(LROR,U,3) $S($D(^LAB(62,$P(LROR,U,3),0)):$P(^(0),U),1:"??")
111 S L=+$P(^LRO(69,LRODT,1,LRSN,0),U,6) I L D
112 . S LRMD=$S($D(^VA(200,L,0)):$P(^(0),U),1:L)
113 . W ?40,"PROVIDER: ",$E(LRMD,1,30)
114 W:$G(^LRO(69,LRODT,1,LRSN,"PCE")) !,?5,"Visit Number(s): ",$G(^("PCE"))
115 ;
116 S I=0
117TST D CHKPAGE
118 Q:$G(LRSTOP)
119 F S I=$O(^LRO(69,LRODT,1,LRSN,2,I)) Q:I<1 D
120 . D CHKPAGE Q:$G(LRSTOP)
121 . D TEST D CHKPAGE Q:$G(LRSTOP)
122 D CHKPAGE
123 Q:$G(LRSTOP)
124 I $D(^LRO(69,LRODT,1,LRSN,1)),$L($P(^(1),U,6)) D
125 . W !,"COMMENT: ",$P(^LRO(69,LRODT,1,LRSN,1),U,6) D CHKPAGE Q:$G(LRSTOP)
126 S I=0
127 F S I=$O(^LRO(69,LRODT,1,LRSN,6,I)) Q:I<1 W !,?3,^(I,0) D CHKPAGE Q:$G(LRSTOP)
128 Q:$G(LRSTOP)
129NXT S X=$P($G(^LRO(69,LRODT,1,LRSN,1)),U,4)
130 I X="C"!($G(LRNOP)) W !,"Order has already been accessioned."
131 I LRNOP,'$P($G(LRLABKY),U) W !,"Tests have been accessioned, call the lab to add tests to the same order." Q
132 I '$D(LRADDTST) Q
133 I X="M" W !?5,"This Order was Merged " Q
134 I '$G(LRRSTAT) S LRRSTAT=160
135SEL W !,"Is this the one"
136 S %=1,LRNOP=0 K LRORDRR,LRRSITE,LRSD,LRTSP
137 D YN^DICN
138 I %'=1 S (LRFLG1,LRNOP)=0 Q
139 S LRADDTST=$S(%=1:LRORD,1:"")
140 Q:$G(LRSTOP)!('$G(LRADDTST))
141 I %=1 D
142 . N X,X0,I,DIC,DA
143 . S X0=^LRO(69,LRODT,1,LRSN,0),LRLWC=$P(X0,"^",4)
144 . S LRFLG=1
145 . S LRPRAC=$P(X0,"^",6),LRLLOC=$P(X0,"^",7),LROLLOC=$P(X0,U,9)
146 . Q:LRLWC'="R" S LRRSITE("SDT")=$P(X0,U,5)
147 . S DIC("A")="*Select Orginal Ordered Test "
148 . S DA=LRSN,DA(1)=LRODT,DIC("S")="I $G(^(.3))"
149 . S DIC="^LRO(69,"_LRODT_",1,"_LRSN_",2,",DIC(0)="AQEZNM"
150 . D ^DIC I Y<1 S LRADDTST="" Q
151 . S LRTSP=$P(Y,U,2),X=$G(^LRO(69,LRODT,1,LRSN,2,+Y,.3))
152 . Q:'$P(X,U,2) S (LRSD("RPSITE"),LRRSITE("RSITE"))=$P(X,U,2)_U_$P(^LRO(69,LRODT,1,LRSN,0),U,7)
153 . S LRRSITE("RPSITE")=$P(X,U,3)
154 . S LRSD("RUID")=$P(X,U,5)
155 . S LRORDRR="R"
156 Q
157LUPT ;
158 K DFN,DIC S DIC(0)="EMQ"
159 D ^LRDPA
160 Q:DFN<1!$D(DUOUT)
161LU1 ;
162 W !,"Order date to start from: T//" R X:DTIME
163 I '$T!(X["^") QUIT
164 S %DT="E",X=$S(X="":"T",1:X)
165 D ^%DT
166 G:Y<1 LU1 S Y=Y-1
167 S LRODT=Y F S LRODT=$O(^LRO(69,LRODT)) Q:LRODT<1 D FSN
168 Q
169FSN ;
170 S LRSN=0
171 F S LRSN=$O(^LRO(69,LRODT,1,"AA",LRDFN,LRSN)) Q:LRSN<1 D
172 . Q:'$D(^LRO(69,LRODT,1,LRSN,.1)) S LRORD=+^(.1) D PT
173 Q
174TEST ;
175 D CHKPAGE Q:$G(LRSTOP)
176 S X=^LRO(69,LRODT,1,LRSN,2,I,0) S:$P(^(0),U,3) LRNOP=1 W !," TEST: ",$S($D(^LAB(60,+X,0)):$P(^(0),"^"),1:"UNKNOWN"),?28," " S LRURG=+$P(X,U,2) W $E($S($D(^LAB(62.05,LRURG,0)):$P(^(0),U),1:"ROUTINE"),1,15)
177 W ?38," ",$S($D(^LRO(68,+$P(X,"^",4),0)):$P(^(0),"^"),1:""),?50," ",$P(X,"^",5),?55
178 D REF
179 I $P(X,"^",11) W !?3,"Canceled by: "_$P(^VA(200,$P(X,"^",11),0),"^") S I(2)=0 D
180 . F S I(2)=$O(^LRO(69,LRODT,1,LRSN,2,I,1.1,I(2))) Q:I(2)<1 I $D(^(I(2),0)) W !?5,^(0) D CHKPAGE Q:$G(LRSTOP)
181 D CHKPAGE Q:$G(LRSTOP)
182 S I(2)=0 F S I(2)=$O(^LRO(69,LRODT,1,LRSN,2,I,1,I(2))) Q:I(2)<1 I $D(^(I(2),0)) W !?5,^(0) D CHKPAGE Q:$G(LRSTOP)
183 Q
184REF ; if referred test, display status and manifest
185 N LREVNT,LRMAN,LRUID S LRUID=$P($G(^LRO(69,LRODT,1,LRSN,2,I,.3)),"^") Q:'LRUID
186 W " <"_LRUID_">" S LREVNT=$$STATUS^LREVENT(LRUID,+X,"") I LREVNT'="" D
187 .S LRMAN=$P(LREVNT,"^",3) I LRMAN'="" W !,?5,"SHIPPING MANIFEST: "_LRMAN
188 .W !,?5,"REFERRAL STATUS: "_$P(LREVNT,"^")_" ("_$P(LREVNT,"^",2)_")"
189 Q
190END ;
191 K %,%DT,A,DFN,DIC,DIR,DIRUT,DTOUT,DUOUT,I,II,K,L,LRARIV,LRCLCTR,LRCLST
192 K LRCTYP,LRDRWTM,LRFLAG1,LRFLG,LRLOC,LRMD,LRODT,LROR,LRORD
193 K LRPRAC,LRSN,LRSN1,LRSTOP,LRURG,LRW,LRWHOE,LRWRD,VA("BID"),VA("PID")
194 K VAIN,VADM,VAERR,X,X1,X2,Y,Z
195 Q:$G(LR2ORD)
196 K LRNOP
197 Q
Note: See TracBrowser for help on using the repository browser.