source: WorldVistAEHR/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LA7UTL1A.m@ 1742

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

initial load of WorldVistAEHR

File size: 8.8 KB
Line 
1LA7UTL1A ;HOIFO/BH - Microbiology Query Utility ; 3/11/03 10:45am
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**69**;Sep 27, 1994
3 ;
4 ;
5GETDATA(LRDFN,LASDT,LAEDT,LASEARCH,RESULTS) ;
6 ;
7 ; Input:
8 ;
9 ; LRDFN - Lab DFN
10 ; LASDT - Search Start Date
11 ; LAEDT - Search End Date
12 ; LASEARCH - Set to CD (collection date) or RAD (completion date).
13 ; RESULTS - Closed root destination array reference
14 ;
15 ; Output:
16 ; If an error is found with the input variables one for the
17 ; strings will be returned.
18 ;
19 ; -1^Start date is after end date
20 ; -2^No return array global
21 ; -3^Global array only
22 ; -4^No Patient lab DFN
23 ; -5^No Start Date Range
24 ; -6^No End Date Range
25 ;
26 ; If there are no errors with the input variables the processing
27 ; will return '1'. If there is no data in the passed in global
28 ; there was no data available for the patient.
29 ;
30 ; If there is data available for the patient the routine will pass
31 ; back the following data (the example assumes the passed in closed
32 ; root global was "^TMP($J)"):
33 ;
34 ; Fields .01 (Accession date),.05 (Site Specimen),.055 (Sample Type),
35 ; .06 (Accession #),11.51 (Sterility Control),11.57 (Urine Screen),
36 ; 11.58 (Sputum Screen), 22 (TB RPT Date Approved), 23 (TB RPT Status),
37 ; 24 (ACID Fast Stain), 25 (Quantity) and .99 (Specimen Comment) from
38 ; the top node in the following format;
39 ;
40 ; ^TMP($J,LRDFN,Record_IEN,"0",Field #,"E" or "I")=Field Data
41 ;
42 ; Field .01 of sub file 63.29 - Gram Stain - in the following format
43 ;
44 ; ^TMP($J,LRDFN,Record_IEN,"2",Sub File IEN,"0",Field #,"E" or "I")=Data
45 ;
46 ; Field .01 (Organism) and 1 (Quantity) of sub file 63.3 in the
47 ; following format;
48 ;
49 ; ^TMP($J,LRDFN,Record_IEN,"3",Sub File IEN,"0",Field #,"E" or "I")=Data
50 ;
51 ; Within the Organism data there is an antibiotic multiple. The
52 ; routine returns the antibiotic (.01) along with the Mic (field #1)
53 ; and Mbc (field #2) from the sub file 63.32 in the following format;
54 ;
55 ; ^TMP($J,LRDFN,Record_IEN,"3",Sub File IEN,"3",Sub-Sub File IEN,"0"
56 ; ,Field #,"E" or "I")=Data
57 ;
58 ;
59 ; Organisms can potentially have specific antibiotics associated with
60 ; them. This API pulls any of the Antibiotics (along with their
61 ; interpretation and screen) that have been entered in the antibiotic
62 ; fields that exist within the standard Lab DD. Within this sub file
63 ; these fields are numbered between 5 and 160.2 and have node numbers
64 ; that begin with the numbers 2.00.
65 ; It is also possible for sites to enter their own specific named
66 ; antibiotics within this multiple using a lab option. This option
67 ; creates a new node number for the new antibiotic entry that is
68 ; comprised in the
69 ; following way "2.00"_site #_n (where n is an incremented number).
70 ; This node number also becomes the field number for this antibiotic.
71 ; The interpretation and screen values of these antibiotics should
72 ; follow a pattern where interpretation field number is comprised as
73 ; follows "2.00"_site #_n_1 and the screen is "2.00"_site #_n_2.
74 ;
75 ; However only antibiotics have been entered in the standard Organism
76 ; DD will get extracted. Any antibiotics entered into the site
77 ; specified fields will not get extracted.
78 ;
79 ; ^TMP($J,LRDFN,Record_IEN,"3",Sub File IEN,"0",Field #,"I")=data
80 ; ^TMP($J,LRDFN,Record_IEN,"3",Sub File IEN,"0",Field #,"E")=field name
81 ; ^data
82 ;
83 ; Note the "E" node contains the field name and it's related data.
84 ;
85 ;
86 ; Within the Organism data there is a comment multiple which the
87 ; routine also returns.
88 ; Field .01 Comment of sub file 63.31 in the following format;
89 ;
90 ; ^TMP($J,LRDFN,Record_IEN,"3",Sub File IEN,"1",Sub-Sub File IEN,"0"
91 ; ,Field #,"E" or "I")=Data
92 ;
93 ; Field .01 Bact RPT Remark of sub file 63.33 in the following format;
94 ;
95 ; ^TMP($J,LRDFN,Record_IEN,"4",Sub File IEN,"0",Field #,"E" or "I")=Data
96 ;
97 ; Field .01 Parasite of sub file 63.34 in the following format;
98 ;
99 ; ^TMP($J,LRDFN,Record_IEN,"6",Sub File IEN,"0",Field #,"E" or "I")=Data
100 ;
101 ; Within Parasite data there is a stage code multiple that the routine
102 ; also returns.
103 ; Fields .01 Stage code and 1 Quantity of sub file 63.35 in the
104 ; following format;
105 ;
106 ; ^TMP($J,LRDFN,Record_IEN,"6",Sub File IEN,"1",Sub-Sub File IEN,"0"
107 ; ,Field #,"E" or "I")=Data
108 ;
109 ; Within the Stage Code multiple there can be a Stage Code Comment
110 ; multiple that this routine also returns;
111 ; Field .01 of the Stage Code Comment Multiple 63.351 in the
112 ; following format;
113 ;
114 ;
115 ; ^TMP($J,LRDFN,Record_IEN,"6",Sub File IEN,"1",Sub-Sub File IEN,"1"
116 ; ,Sub Sub Sub File IEN,"0",Field #,"E" or "I")=Data)
117 ;
118 ; Field .01 Parasite RPT Remark 63.36 in the following format;
119 ;
120 ; ^TMP($J,LRDFN,Record_IEN,"7",Sub File IEN,"0",Field #,"E" or "I")=Data
121 ;
122 ; Field .01 Fungus/Yeast and field 1 Quantity of sub file 63.37 in the
123 ; following format;
124 ;
125 ; ^TMP($J,LRDFN,Record_IEN,"9",Sub File IEN,"0",Field #,"E" or "I")=Data
126 ;
127 ; Within the Fungus/Yeast data there is a comment multiple which the
128 ; routine also returns.
129 ; Field .01 Comment of sub file 63.372 in the following format;
130 ;
131 ; ^TMP($J,LRDFN,Record_IEN,"9",Sub File IEN,"1",Sub-Sub File IEN,"0"
132 ; ,Field #,"E" or "I")=Data
133 ;
134 ;
135 ; Field .01 Mycobacterium and field 1 Quantity of sub file 63.39 in
136 ; the following format;
137 ;
138 ; ^TMP($J,LRDFN,Record_IEN,"12",Sub File IEN,"0",Field #,"E" or "I")
139 ; =Data
140 ; Mycobacterium can potentially have antibiotics associated with them.
141 ; This API pulls any of the Antibiotics that have been entered in the
142 ; antibiotic
143 ; fields that exist within the standard Lab DD. Within this sub file
144 ; these fields are numbered between 5 and 55).
145 ; It is also possible for sites to enter their own antibiotics
146 ; within this multiple using a lab option. This option creates a new
147 ; node number for the new antibiotic entry that is comprised in the
148 ; following way "2.00"_site #_n (where n is an incremented number).
149 ; This node number also becomes the field number for this antibiotic.
150 ;
151 ; However only antibiotics have been entered in the standard
152 ; Mycobacterium antibiotic DD will get extracted. Any antibiotics
153 ; entered into the site specified fields will not get extracted.
154 ;
155 ; ^TMP($J,LRDFN,Record_IEN,"12",Sub File IEN,"0",Field #,"I")=data
156 ; ^TMP($J,LRDFN,Record_IEN,"12",Sub File IEN,"0",Field #,"E")
157 ; =field name^data
158 ;
159 ; Note the "E" node contains the field name and it's related data.
160 ;
161 ;
162 ;
163 ; Within the Mycobacterium data there is a comment multiple which the
164 ; routine also returns.
165 ; Field .01 Comment of sub file 63.4 in the following format;
166 ;
167 ; ^TMP($J,LRDFN,Record_IEN,"12",Sub File IEN,"1",Sub-Sub File IEN,"0"
168 ; ,Field #,"E" or "I")=Data
169 ;
170 ; Field .01 BACT Smear/Prep of sub file 63.291 in the following format;
171 ;
172 ; ^TMP($J,LRDFN,Record_IEN,"25",Sub File IEN,"0",Field #,"E" or "I")
173 ; = Data
174 ;
175 ; Field .01 PARA Smear/Prep of sub file 63.341 in the following format;
176 ;
177 ; ^TMP($J,LRDFN,Record_IEN,"24",Sub File IEN,"0",Field #,"E" or "I")
178 ; =Data
179 ;
180 ; Field .01 VIRUS of sub file 63.43 in the following format;
181 ;
182 ; ^TMP($J,LRDFN,Record_IEN,"17",Sub File IEN,"0",Field #,"E" or "I")
183 ; =Data
184 ;
185 ;
186 ; ---------------------------------------------------------------------
187 ;
188 N LAARRAY,LAINX,LATYP,LAFILE,LAARRET,LACD,LACDFLD,LACDTYP,LADATA,LASET,LASUB,LA763,LATYPE
189 ;
190 I LASDT>LAEDT Q "-1^Start date is after end date"
191 I '$D(RESULTS) Q "-2^No return array global"
192 I $E(RESULTS,1,1)'="^" Q "-3^Global array only"
193 I '+$G(LRDFN) Q "-4^No Patient lab DFN"
194 I '$G(LASDT) Q "-5^No Start Date Range"
195 I '$G(LAEDT) Q "-6^No End Date Range"
196 S LAFILE=63.05,LATYPE="MI"
197 ;
198 ; - Used for internal processing
199 S LAARRAY="^XTMP(""LA7UTL1A"",$J)"
200 ; - Passed in global reference, returns results
201 S LAARRET=$S($G(RESULTS)'="":RESULTS,1:"^TMP(""LA7UTL1A"","_$J_")")
202 K @LAARRAY,@LAARRET
203 I LASEARCH="RAD" D RAD
204 I LASEARCH="CD" D CD
205 ;
206 Q 1
207 ;
208CD ; Search by collection date
209 ;
210 N LRIDT,LRSS,LANSDT,LANEDT
211 ;
212 I LASDT S LANSDT=9999999-LASDT
213 I LAEDT S LANEDT=9999999-LAEDT
214 ;
215 S LRIDT=LANSDT
216 F S LRIDT=$O(^LR(LRDFN,LATYPE,LRIDT),-1) Q:LRIDT=""!(LRIDT<LANEDT) D
217 . D MI^LA7UTL1C(LRDFN,LRIDT,LAARRAY),ARRANGE^LA7UTL1B(LAARRAY,LAARRET)
218 ;
219 Q
220 ;
221RAD ; Search by completion date.
222 ;
223 N LRIDT
224 S LRIDT=0
225 F S LRIDT=$O(^LR(LRDFN,LATYPE,LRIDT)) Q:'LRIDT D
226 . S LA763(0)=$G(^LR(LRDFN,LATYPE,LRIDT,0))
227 . I $P(LA763(0),"^",3)>LASDT,$P(LA763(0),"^",3)<LAEDT D MI^LA7UTL1C(LRDFN,LRIDT,LAARRAY),ARRANGE^LA7UTL1B(LAARRAY,LAARRET)
228 Q
229 ;
230 ;
231 ;
Note: See TracBrowser for help on using the repository browser.