source: FOIAVistA/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LA7SM2.m@ 1800

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

initial load of FOIAVistA 6/30/08 version

File size: 8.7 KB
Line 
1LA7SM2 ;DALOI/JMC - Shipping Manifest Options ;5/5/97 14:39
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**46,64**;Sep 27, 1994
3 ;
4REQINFO ; Enter required information prior to shipping.
5 D INIT^LA7SM
6 I LA7QUIT D CLEANUP^LA7SM Q
7 S LA7SM=$$SELSM^LA7SMU(+LA7SCFG,"0,1,3")
8 I LA7SM<0 D Q
9 . D EN^DDIOL($P(LA7SM,"^",2),"","!?5")
10 . D CLEANUP^LA7SM
11 D LOCKSM^LA7SM
12 I LA7QUIT D Q
13 . D EN^DDIOL($P(LA7QUIT,"^",2),"","!?5")
14 . D UNLOCKSM^LA7SM,CLEANUP^LA7SM
15 S LA7SM(0)=$G(^LAHM(62.8,+LA7SM,0))
16 F D INFOEE Q:LA7QUIT
17 D UNLOCKSM^LA7SM
18 I LA7QUIT,$L($P(LA7QUIT,"^",2)) D EN^DDIOL($P(LA7QUIT,"^",2),"","!?5")
19 E D ASK^LA7SMP(LA7SM)
20 D CLEANUP^LA7SM
21 Q
22 ;
23INFOEE ; Required Info Enter/Edit
24 ;
25 N DIR,DIROUT,DIRUT,DTOUT,DUOUT,LA7CDT,LA7I,LA7INFO,LA7J,LA7RINFO,LA7TCNT,LA7X,LA7Y,X,Y
26 ;
27 D SEL^LA7SM
28 I LA7QUIT Q
29 ;
30 S (LA7I,LA7TCNT)=0
31 F S LA7I=$O(^LAHM(62.8,+LA7SM,10,"UID",LA7UID,LA7I)) Q:'LA7I D
32 . F LA7J=0,1,2 S LA7I(LA7J)=$G(^LAHM(62.8,+LA7SM,10,LA7I,LA7J))
33 . I $P(LA7I(0),"^",8)=0 Q ; Previously "removed".
34 . I $P(LA7I(0),"^",8),$P(LA7I(0),"^",8)'=1 S LA7QUIT="1^Accession not pending shipment" Q ; Not pending shipment
35 . S LA7TCNT=LA7TCNT+1
36 . F LA7J=1,4 I $P(LA7I(1),"^",LA7J) D
37 . . I '$P(LA7I(1),"^",LA7J+2) Q ; No units specified
38 . . S LA7X=$S(LA7J=1:1.11,LA7J=4:1.21,1:0)
39 . . S LA7RINFO(LA7X)=$P(LA7I(1),"^",LA7J+1) ; Value
40 . . S $P(LA7RINFO(LA7X),"^",2)=$P(LA7I(1),"^",LA7J+2) ; Units
41 . . S LA7RINFO(LA7X,LA7I)=LA7RINFO(LA7X)_"^"_$P(LA7I(0),"^",2)
42 . F LA7J=1,4,8 I $P(LA7I(2),"^",LA7J) D
43 . . I '($S(LA7J=4:$P(LA7I(2),"^",7),1:$P(LA7I(2),"^",LA7J+2))) Q ; No units specified.
44 . . S LA7X=$S(LA7J=1:2.11,LA7J=4:2.21,LA7J=8:2.31,1:0)
45 . . S LA7RINFO(LA7X)=$P(LA7I(2),"^",LA7J+1) ; Value
46 . . S $P(LA7RINFO(LA7X),"^",2)=$S(LA7J=4:$P(LA7I(2),"^",7),1:$P(LA7I(2),"^",LA7J+2)) ; Units
47 . . S LA7RINFO(LA7X,LA7I)=LA7RINFO(LA7X)_"^"_$P(LA7I(0),"^",2)
48 ;
49 I 'LA7TCNT,'LA7QUIT S LA7QUIT="1^Accession is not on this shipping manifest"
50 I '$O(LA7RINFO(0)),'LA7QUIT S LA7QUIT="1^No test needs required information for shipping"
51 I LA7QUIT Q
52 ;
53 S LA7CDT=+$P($G(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,3)),"^")
54 S LA7Y=0
55 F S LA7Y=$O(LA7RINFO(LA7Y)) Q:'LA7Y D Q:LA7QUIT
56 . N DA,DIR,DIRUT
57 . S DIR(0)="62.801,"_LA7Y
58 . S DIR("A")=$$GET1^DID(62.801,LA7Y,"","LABEL")
59 . I LA7Y=2.21 D
60 . . S DIR("A",1)=" "
61 . . S DIR("A",2)="Specimen Collection Date/time: "_$$FMTE^XLFDT(LA7CDT,"M")
62 . . S $P(DIR(0),"^",3)="I Y<LA7CDT!(Y>$$NOW^XLFDT) K X" ; d/t after specimen collect d/t
63 . I LA7Y'=2.21 D
64 . . N LA7X
65 . . S LA7X=$$GET1^DIQ(64.061,$P(LA7RINFO(LA7Y),"^",2)_",",.01) ; Units
66 . . S DIR("A")=DIR("A")_" (in "_LA7X_")"
67 . I $L($P(LA7RINFO(LA7Y),"^")) D ; Default value
68 . . I LA7Y=2.21 S DIR("B")=$$FMTE^XLFDT($P(LA7RINFO(LA7Y),"^"))
69 . . E S DIR("B")=$P(LA7RINFO(LA7Y),"^")
70 . D ^DIR
71 . I $D(DTOUT)!$D(DUOUT) S LA7QUIT=1 Q
72 . S $P(LA7INFO(LA7Y),"^")=$P(Y,"^") ; New value
73 I LA7QUIT Q
74 ;
75 S LA7Y=0
76 F S LA7Y=$O(LA7RINFO(LA7Y)) Q:'LA7Y D
77 . S LA7I=0
78 . F S LA7I=$O(LA7RINFO(LA7Y,LA7I)) Q:'LA7I D
79 . . I $P(LA7INFO(LA7Y),"^")=$P(LA7RINFO(LA7Y,LA7I),"^") Q ; Value unchanged
80 . . N FDA,LA7628,LA768,LA7DATA
81 . . S LA762801=LA7I_","_+LA7SM_","
82 . . I LA7Y=2.21 D
83 . . . N LA7DURT,LA7UID,LA7UNITS,LA7X
84 . . . S LA7UNITS=$$GET1^DIQ(64.061,+$P(LA7RINFO(LA7Y,LA7I),"^",2)_",",.01,"E")
85 . . . S LA7DURT=$$FMDIFF^XLFDT(LA7INFO(LA7Y),LA7CDT,2) ; Collection duration (in seconds)
86 . . . I LA7UNITS="min" S LA7DURT=$FN(LA7DURT/60,"",0) ; Convert to minutes, rounded to nearest minute.
87 . . . I LA7UNITS="hr" S LA7DURT=$FN(LA7DURT/3600,"",0) ; Convert to hours, rounded to nearest hour.
88 . . . S FDA(62.8,62.801,LA762801,2.22)=LA7DURT
89 . . S FDA(62.8,62.801,LA762801,LA7Y)=$P(LA7INFO(LA7Y),"^") ; New value
90 . . D FILE^DIE("","FDA(62.8)","LA7DIE(2)") ; Update required info
91 . . ; Update event file
92 . . S LA7DATA="SM40^"_$$NOW^XLFDT_"^"_$P(LA7RINFO(LA7Y,LA7I),"^",3)_"^"_$P(LA7SM,"^",2)
93 . . D SEUP^LA7SMU(LA7UID,2,LA7DATA)
94 Q
95 ;
96 ;
97CHKREQI(LA7628,LA762801) ; Check for required info/incomplete setup
98 ; Call with LA7628 = ien of entry in file #62.8
99 ; LA762801 = ien of entry in file #62.8, TEST subfile
100 ;
101 ; If errors sets LA7ERR array with error messages and TMP(LA7ERR",$J)
102 ; with specific tests.
103 ;
104 N LA7FILE,LA7FLD,LA7SCFG,LA7I,LA7J
105 ;
106 S LA7ERR=$G(LA7ERR,0)
107 S LA7628(0)=$G(^LAHM(62.8,LA7628,0))
108 S LA7SCFG=$P(LA7628(0),"^",2)
109 S LA7SCFG(0)=$G(^LAHM(62.9,LA7SCFG,0))
110 ;
111 F LA7J=0,1,2,5 S LA7I(LA7J)=$G(^LAHM(62.8,LA7628,10,LA762801,LA7J))
112 ;
113 S LA7FILE=62.801
114 ;
115 I $P(LA7I(1),"^") D
116 . F LA7J=2,3,7 I '$L($P(LA7I(1),"^",LA7J)) S LA7FLD=$S(LA7J=2:1.11,LA7J=3:1.13,1:1.14) D SETERR
117 ;
118 I $P(LA7I(1),"^",4) D
119 . F LA7J=5,6,8 I '$L($P(LA7I(1),"^",LA7J)) S LA7FLD=$S(LA7J=5:1.21,LA7J=6:1.23,1:1.24) D SETERR
120 ;
121 I $P(LA7I(2),"^") D
122 . F LA7J=2,3,11 I '$L($P(LA7I(2),"^",LA7J)) S LA7FLD=$S(LA7J=2:2.11,LA7J=3:2.13,1:2.14) D SETERR
123 ;
124 I $P(LA7I(2),"^",4) D
125 . F LA7J=5,6,7,12 I '$L($P(LA7I(2),"^",LA7J)) S LA7FLD=$S(LA7J=5:2.21,LA7J=6:2.22,LA7J=7:2.23,1:2.24) D SETERR
126 ;
127 I $P(LA7I(2),"^",8) D
128 . F LA7J=9,10,13 I '$L($P(LA7I(2),"^",LA7J)) S LA7FLD=$S(LA7J=9:2.31,LA7J=10:2.33,1:2.34) D SETERR
129 ;
130 ; Check if using non-VA codes
131 I $P(LA7628(0),"^",5) D
132 . F LA7J=1,2 I '$L($P(LA7I(5),"^",LA7J)) S LA7FLD=$S(LA7J=1:5.1,1:5.2) D SETERR
133 I '$$GET1^DIQ(60,+$P(LA7I(0),"^",2)_",",64,"I") S LA7FILE=60,LA7FLD=64 D SETERR
134 I 'LA7ERR,$O(LA7ERR(""))'="" S LA7ERR=1
135 ;
136 Q
137 ;
138 ;
139SETERR ; Set error log for entries missing values in 62.8
140 ; Called from above.
141 ;
142 S LA7ERR(LA7FILE_":"_LA7FLD)="Missing Required Info - "_$$GET1^DID(LA7FILE,LA7FLD,"","LABEL")
143 S ^TMP("LA7ERR",$J,LA7FILE_":"_LA7FLD,LA7628,$P(LA7I(0),"^",5),$P(LA7I(0),"^",2))=""
144 Q
145 ;
146 ;
147BUILDRI ; Build global with required info to print on manifest.
148 ; Called from LA7SMP
149 ;
150 N LA7I,LA7X
151 ;
152 ; No required info
153 I $G(LA762801(1))="",$G(LA762801(2))="" Q
154 ;
155 F LA7I=1,2 S LA7X(LA7I)=$G(^TMP("LA7SMRI",$J,+$P(LA762801(0),"^",7),+$P(LA762801(0),"^",9),$P(LA762801(0),"^",5),LA7I))
156 ;
157 ; Check for patient required info.
158 F LA7I=1,4 I $P($G(LA762801(1)),"^",LA7I) D
159 . S $P(LA7X(1),"^",LA7I)=$P(LA762801(1),"^",LA7I)
160 . I LA7I=1 S $P(LA7X(1),"^",2,3)=$P(LA762801(1),"^",2,3) Q
161 . I LA7I=4 S $P(LA7X(1),"^",5,6)=$P(LA762801(1),"^",5,6) Q
162 ;
163 ; Check for specimen required info.
164 F LA7I=1,4,8 I $P($G(LA762801(2)),"^",LA7I) D
165 . S $P(LA7X(2),"^",LA7I)=$P(LA762801(2),"^",LA7I)
166 . I LA7I=1 S $P(LA7X(2),"^",2,3)=$P(LA762801(2),"^",2,3) Q
167 . I LA7I=4 S $P(LA7X(2),"^",5,7)=$P(LA762801(2),"^",5,7) Q
168 . I LA7I=8 S $P(LA7X(2),"^",9,10)=$P(LA762801(2),"^",9,10) Q
169 ;
170 ; Store required info for printing
171 F LA7I=1,2 I $L($G(LA7X(LA7I))) S ^TMP("LA7SMRI",$J,+$P(LA762801(0),"^",7),+$P(LA762801(0),"^",9),$P(LA762801(0),"^",5),LA7I)=LA7X(LA7I)
172 ;
173 Q
174 ;
175 ;
176RCI ; Enter/edit relevant clinical information
177 N DA,FDA,LA7628,LA762801,LA7DIR,LA7QUIT,LA7TCNT,LA7Y
178 D INIT^LA7SM
179 I LA7QUIT D CLEANUP^LA7SM Q
180 S LA7SM=$$SELSM^LA7SMU(+LA7SCFG,"0,1,3")
181 I LA7SM<0 D Q
182 . D EN^DDIOL($P(LA7SM,"^",2),"","!?5")
183 . D CLEANUP^LA7SM
184 D LOCKSM^LA7SM
185 I LA7QUIT D Q
186 . D EN^DDIOL($P(LA7QUIT,"^",2),"","!?5")
187 . D UNLOCKSM^LA7SM,CLEANUP^LA7SM
188 S LA7SM(0)=$G(^LAHM(62.8,+LA7SM,0))
189 D SEL^LA7SM
190 I LA7QUIT D UNLOCKSM^LA7SM,CLEANUP^LA7SM Q
191 S (LA7I,LA7TCNT)=0
192 F S LA7I=$O(^LAHM(62.8,+LA7SM,10,"UID",LA7UID,LA7I)) Q:'LA7I D
193 . S LA7I(0)=$G(^LAHM(62.8,+LA7SM,10,LA7I,0))
194 . I $P(LA7I(0),"^",8)=0 Q ; Previously "removed".
195 . I $P(LA7I(0),"^",8),$P(LA7I(0),"^",8)'=1 S LA7QUIT="1^Accession not pending shipment" Q
196 . S LA7TCNT=LA7TCNT+1,LA760(LA7TCNT)=LA7I_"^"_LA7I(0)
197 I 'LA7TCNT,'LA7QUIT S LA7QUIT="1^Accession is not on this shipping manifest"
198 I LA7QUIT D UNLOCKSM^LA7SM,CLEANUP^LA7SM Q
199 S LA7I=0
200 F S LA7I=$O(LA760(LA7I)) Q:'LA7I D EN^DDIOL(LA7I_" "_$P($G(^LAB(60,+$P(LA760(LA7I),"^",3),0)),"^"),"","!?5")
201 S DIR(0)="LO^1:"_LA7TCNT,DIR("A")="Select test(s) to edit clinical info"
202 D ^DIR
203 I $D(DIRUT) S LA7QUIT=1 D UNLOCKSM^LA7SM,CLEANUP^LA7SM Q
204 M LA7YARRY=Y
205 K DIR
206 D FIELD^DID(62.801,.1,,"DESCRIPTION;FIELD LENGTH;HELP-PROMPT","LA7DIR")
207 S LA7X=$P($G(^LAHM(62.9,+$P(LA7SM(0),"^",2),0)),"^",3)
208 I $$NVAF^LA7VHLU2(LA7X)=1 D
209 . S LA7DIR("FIELD LENGTH")=78
210 . S LA7DIR("HELP-PROMPT")="Answer must be 1-78 characters in length."
211 S DIR(0)="FAO^1:"_LA7DIR("FIELD LENGTH"),DIR("A")="Relevant clinical information: "
212 M DIR("?")=LA7DIR("DESCRIPTION"),DIR("?")=LA7DIR("HELP-PROMPT")
213 S LA7Y="",LA7628=+LA7SM,LA7QUIT=0
214 F S LA7Y=$O(LA7YARRY(LA7Y)) Q:LA7Y="" D Q:LA7QUIT
215 . F LA7I=1:1 Q:'$P(LA7YARRY(LA7Y),",",LA7I) D Q:LA7QUIT
216 . . K DA,DIRUT,DUOUT,DTOUT,FDA,LA7DIE
217 . . S LA7X=$P(LA7YARRY(LA7Y),",",LA7I),DA=+LA760(LA7X)
218 . . S LA762801=DA_","_LA7628_","
219 . . W !,"For test: ",$$GET1^DIQ(62.801,LA762801,.02)
220 . . S DIR("B")=$$GET1^DIQ(62.801,LA762801,.1)
221 . . I DIR("B")="" K DIR("B")
222 . . D ^DIR
223 . . I $D(DIRUT),X'="@" S LA7QUIT=1 Q
224 . . I Y="",X="@" S Y="@"
225 . . S FDA(62.8,62.801,LA762801,.1)=Y
226 . . D FILE^DIE("","FDA(62.8)","LA7DIE(1)")
227 ;
228 D UNLOCKSM^LA7SM,CLEANUP^LA7SM
229 Q
Note: See TracBrowser for help on using the repository browser.