001/*
002 * This class is an auto-generated source file for a HAPI
003 * HL7 v2.x standard structure class.
004 *
005 * For more information, visit: http://hl7api.sourceforge.net/
006 * 
007 * The contents of this file are subject to the Mozilla Public License Version 1.1 
008 * (the "License"); you may not use this file except in compliance with the License. 
009 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
010 * Software distributed under the License is distributed on an "AS IS" basis, 
011 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
012 * specific language governing rights and limitations under the License. 
013 * 
014 * The Original Code is "[file_name]".  Description: 
015 * "[one_line_description]" 
016 * 
017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
018 * 2012.  All Rights Reserved. 
019 * 
020 * Contributor(s): ______________________________________. 
021 * 
022 * Alternatively, the contents of this file may be used under the terms of the 
023 * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
024 * applicable instead of those above.  If you wish to allow use of your version of this 
025 * file only under the terms of the GPL and not to allow others to use your version 
026 * of this file under the MPL, indicate your decision by deleting  the provisions above 
027 * and replace  them with the notice and other provisions required by the GPL License.  
028 * If you do not delete the provisions above, a recipient may use your version of 
029 * this file under either the MPL or the GPL. 
030 * 
031 */
032
033
034package ca.uhn.hl7v2.model.v21.segment;
035
036// import ca.uhn.hl7v2.model.v21.group.*;
037import ca.uhn.hl7v2.model.v21.datatype.*;
038import ca.uhn.hl7v2.HL7Exception;
039import ca.uhn.hl7v2.parser.ModelClassFactory;
040import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
041import ca.uhn.hl7v2.model.AbstractMessage;
042import ca.uhn.hl7v2.model.Group;
043import ca.uhn.hl7v2.model.Type;
044import ca.uhn.hl7v2.model.AbstractSegment;
045import ca.uhn.hl7v2.model.Varies;
046
047/**
048 *<p>Represents an HL7 OBX message segment (RESULT). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>OBX-1: SET ID - OBSERVATION SIMPLE (SI) <b>optional </b>
052     * <li>OBX-2: VALUE TYPE (ID) <b>optional </b>
053     * <li>OBX-3: OBSERVATION IDENTIFIER (CE) <b> </b>
054     * <li>OBX-4: OBSERVATION SUB-ID (NM) <b>optional </b>
055     * <li>OBX-5: OBSERVATION RESULTS (Varies) <b> </b>
056     * <li>OBX-6: UNITS (ID) <b>optional </b>
057     * <li>OBX-7: REFERENCES RANGE (ST) <b>optional </b>
058     * <li>OBX-8: ABNORMAL FLAGS (ST) <b>optional repeating</b>
059     * <li>OBX-9: PROBABILITY (NM) <b>optional </b>
060     * <li>OBX-10: NATURE OF ABNORMAL TEST (ID) <b>optional </b>
061     * <li>OBX-11: OBSERV RESULT STATUS (ID) <b>optional </b>
062     * <li>OBX-12: DATE LAST OBS NORMAL VALUES (TS) <b>optional </b>
063 * </ul>
064 */
065@SuppressWarnings("unused")
066public class OBX extends AbstractSegment {
067
068    /** 
069     * Creates a new OBX segment
070     */
071    public OBX(Group parent, ModelClassFactory factory) {
072       super(parent, factory);
073       init(factory);
074    }
075
076    private void init(ModelClassFactory factory) {
077       try {
078                                  this.add(SI.class, false, 1, 4, new Object[]{ getMessage() }, "SET ID - OBSERVATION SIMPLE");
079                                              this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(125) }, "VALUE TYPE");
080                                  this.add(CE.class, true, 1, 80, new Object[]{ getMessage() }, "OBSERVATION IDENTIFIER");
081                                  this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "OBSERVATION SUB-ID");
082                                  this.add(Varies.class, true, 1, 65, new Object[]{ getMessage() }, "OBSERVATION RESULTS");
083                                              this.add(ID.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "UNITS");
084                                  this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "REFERENCES RANGE");
085                                  this.add(ST.class, false, 5, 10, new Object[]{ getMessage() }, "ABNORMAL FLAGS");
086                                  this.add(NM.class, false, 1, 5, new Object[]{ getMessage() }, "PROBABILITY");
087                                              this.add(ID.class, false, 1, 5, new Object[]{ getMessage(), new Integer(80) }, "NATURE OF ABNORMAL TEST");
088                                              this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(85) }, "OBSERV RESULT STATUS");
089                                  this.add(TS.class, false, 1, 19, new Object[]{ getMessage() }, "DATE LAST OBS NORMAL VALUES");
090       } catch(HL7Exception e) {
091          log.error("Unexpected error creating OBX - this is probably a bug in the source code generator.", e);
092       }
093    }
094
095
096
097    /**
098     * Returns
099     * OBX-1: "SET ID - OBSERVATION SIMPLE" - creates it if necessary
100     */
101    public SI getSETIDOBSERVATIONSIMPLE() { 
102                SI retVal = this.getTypedField(1, 0);
103                return retVal;
104    }
105    
106    /**
107     * Returns
108     * OBX-1: "SET ID - OBSERVATION SIMPLE" - creates it if necessary
109     */
110    public SI getObx1_SETIDOBSERVATIONSIMPLE() { 
111                SI retVal = this.getTypedField(1, 0);
112                return retVal;
113    }
114
115
116
117    /**
118     * Returns
119     * OBX-2: "VALUE TYPE" - creates it if necessary
120     */
121    public ID getVALUETYPE() { 
122                ID retVal = this.getTypedField(2, 0);
123                return retVal;
124    }
125    
126    /**
127     * Returns
128     * OBX-2: "VALUE TYPE" - creates it if necessary
129     */
130    public ID getObx2_VALUETYPE() { 
131                ID retVal = this.getTypedField(2, 0);
132                return retVal;
133    }
134
135
136
137    /**
138     * Returns
139     * OBX-3: "OBSERVATION IDENTIFIER" - creates it if necessary
140     */
141    public CE getOBSERVATIONIDENTIFIER() { 
142                CE retVal = this.getTypedField(3, 0);
143                return retVal;
144    }
145    
146    /**
147     * Returns
148     * OBX-3: "OBSERVATION IDENTIFIER" - creates it if necessary
149     */
150    public CE getObx3_OBSERVATIONIDENTIFIER() { 
151                CE retVal = this.getTypedField(3, 0);
152                return retVal;
153    }
154
155
156
157    /**
158     * Returns
159     * OBX-4: "OBSERVATION SUB-ID" - creates it if necessary
160     */
161    public NM getOBSERVATIONSUBID() { 
162                NM retVal = this.getTypedField(4, 0);
163                return retVal;
164    }
165    
166    /**
167     * Returns
168     * OBX-4: "OBSERVATION SUB-ID" - creates it if necessary
169     */
170    public NM getObx4_OBSERVATIONSUBID() { 
171                NM retVal = this.getTypedField(4, 0);
172                return retVal;
173    }
174
175
176
177    /**
178     * Returns
179     * OBX-5: "OBSERVATION RESULTS" - creates it if necessary
180     */
181    public Varies getOBSERVATIONRESULTS() { 
182                Varies retVal = this.getTypedField(5, 0);
183                return retVal;
184    }
185    
186    /**
187     * Returns
188     * OBX-5: "OBSERVATION RESULTS" - creates it if necessary
189     */
190    public Varies getObx5_OBSERVATIONRESULTS() { 
191                Varies retVal = this.getTypedField(5, 0);
192                return retVal;
193    }
194
195
196
197    /**
198     * Returns
199     * OBX-6: "UNITS" - creates it if necessary
200     */
201    public ID getUNITS() { 
202                ID retVal = this.getTypedField(6, 0);
203                return retVal;
204    }
205    
206    /**
207     * Returns
208     * OBX-6: "UNITS" - creates it if necessary
209     */
210    public ID getObx6_UNITS() { 
211                ID retVal = this.getTypedField(6, 0);
212                return retVal;
213    }
214
215
216
217    /**
218     * Returns
219     * OBX-7: "REFERENCES RANGE" - creates it if necessary
220     */
221    public ST getREFERENCESRANGE() { 
222                ST retVal = this.getTypedField(7, 0);
223                return retVal;
224    }
225    
226    /**
227     * Returns
228     * OBX-7: "REFERENCES RANGE" - creates it if necessary
229     */
230    public ST getObx7_REFERENCESRANGE() { 
231                ST retVal = this.getTypedField(7, 0);
232                return retVal;
233    }
234
235
236    /**
237     * Returns all repetitions of ABNORMAL FLAGS (OBX-8).
238     */
239    public ST[] getABNORMALFLAGS() {
240        ST[] retVal = this.getTypedField(8, new ST[0]);
241        return retVal;
242    }
243
244
245    /**
246     * Returns all repetitions of ABNORMAL FLAGS (OBX-8).
247     */
248    public ST[] getObx8_ABNORMALFLAGS() {
249        ST[] retVal = this.getTypedField(8, new ST[0]);
250        return retVal;
251    }
252
253
254    /**
255     * Returns a count of the current number of repetitions of ABNORMAL FLAGS (OBX-8).
256     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
257     * it will return zero.
258     */
259    public int getABNORMALFLAGSReps() {
260        return this.getReps(8);
261    }
262
263
264    /**
265     * Returns a specific repetition of
266     * OBX-8: "ABNORMAL FLAGS" - creates it if necessary
267     *
268     * @param rep The repetition index (0-indexed)
269     */
270    public ST getABNORMALFLAGS(int rep) { 
271                ST retVal = this.getTypedField(8, rep);
272                return retVal;
273    }
274
275    /**
276     * Returns a specific repetition of
277     * OBX-8: "ABNORMAL FLAGS" - creates it if necessary
278     *
279     * @param rep The repetition index (0-indexed)
280     */
281    public ST getObx8_ABNORMALFLAGS(int rep) { 
282                ST retVal = this.getTypedField(8, rep);
283                return retVal;
284    }
285
286    /**
287     * Returns a count of the current number of repetitions of ABNORMAL FLAGS (OBX-8).
288     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
289     * it will return zero.
290     */
291    public int getObx8_ABNORMALFLAGSReps() {
292        return this.getReps(8);
293    }
294
295
296    /**
297     * Inserts a repetition of
298     * OBX-8: "ABNORMAL FLAGS" at a specific index
299     *
300     * @param rep The repetition index (0-indexed)
301     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
302     */
303    public ST insertABNORMALFLAGS(int rep) throws HL7Exception { 
304        return (ST) super.insertRepetition(8, rep);
305    }
306
307
308    /**
309     * Inserts a repetition of
310     * OBX-8: "ABNORMAL FLAGS" at a specific index
311     *
312     * @param rep The repetition index (0-indexed)
313     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
314     */
315    public ST insertObx8_ABNORMALFLAGS(int rep) throws HL7Exception { 
316        return (ST) super.insertRepetition(8, rep);
317    }
318
319
320    /**
321     * Removes a repetition of
322     * OBX-8: "ABNORMAL FLAGS" at a specific index
323     *
324     * @param rep The repetition index (0-indexed)
325     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
326     */
327    public ST removeABNORMALFLAGS(int rep) throws HL7Exception { 
328        return (ST) super.removeRepetition(8, rep);
329    }
330
331
332    /**
333     * Removes a repetition of
334     * OBX-8: "ABNORMAL FLAGS" at a specific index
335     *
336     * @param rep The repetition index (0-indexed)
337     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
338     */
339    public ST removeObx8_ABNORMALFLAGS(int rep) throws HL7Exception { 
340        return (ST) super.removeRepetition(8, rep);
341    }
342
343
344
345
346    /**
347     * Returns
348     * OBX-9: "PROBABILITY" - creates it if necessary
349     */
350    public NM getPROBABILITY() { 
351                NM retVal = this.getTypedField(9, 0);
352                return retVal;
353    }
354    
355    /**
356     * Returns
357     * OBX-9: "PROBABILITY" - creates it if necessary
358     */
359    public NM getObx9_PROBABILITY() { 
360                NM retVal = this.getTypedField(9, 0);
361                return retVal;
362    }
363
364
365
366    /**
367     * Returns
368     * OBX-10: "NATURE OF ABNORMAL TEST" - creates it if necessary
369     */
370    public ID getNATUREOFABNORMALTEST() { 
371                ID retVal = this.getTypedField(10, 0);
372                return retVal;
373    }
374    
375    /**
376     * Returns
377     * OBX-10: "NATURE OF ABNORMAL TEST" - creates it if necessary
378     */
379    public ID getObx10_NATUREOFABNORMALTEST() { 
380                ID retVal = this.getTypedField(10, 0);
381                return retVal;
382    }
383
384
385
386    /**
387     * Returns
388     * OBX-11: "OBSERV RESULT STATUS" - creates it if necessary
389     */
390    public ID getOBSERVRESULTSTATUS() { 
391                ID retVal = this.getTypedField(11, 0);
392                return retVal;
393    }
394    
395    /**
396     * Returns
397     * OBX-11: "OBSERV RESULT STATUS" - creates it if necessary
398     */
399    public ID getObx11_OBSERVRESULTSTATUS() { 
400                ID retVal = this.getTypedField(11, 0);
401                return retVal;
402    }
403
404
405
406    /**
407     * Returns
408     * OBX-12: "DATE LAST OBS NORMAL VALUES" - creates it if necessary
409     */
410    public TS getDATELASTOBSNORMALVALUES() { 
411                TS retVal = this.getTypedField(12, 0);
412                return retVal;
413    }
414    
415    /**
416     * Returns
417     * OBX-12: "DATE LAST OBS NORMAL VALUES" - creates it if necessary
418     */
419    public TS getObx12_DATELASTOBSNORMALVALUES() { 
420                TS retVal = this.getTypedField(12, 0);
421                return retVal;
422    }
423
424
425
426
427
428    /** {@inheritDoc} */   
429    protected Type createNewTypeWithoutReflection(int field) {
430       switch (field) {
431          case 0: return new SI(getMessage());
432          case 1: return new ID(getMessage(), new Integer( 125 ));
433          case 2: return new CE(getMessage());
434          case 3: return new NM(getMessage());
435          case 4: return new Varies(getMessage());
436          case 5: return new ID(getMessage(), new Integer( 0 ));
437          case 6: return new ST(getMessage());
438          case 7: return new ST(getMessage());
439          case 8: return new NM(getMessage());
440          case 9: return new ID(getMessage(), new Integer( 80 ));
441          case 10: return new ID(getMessage(), new Integer( 85 ));
442          case 11: return new TS(getMessage());
443          default: return null;
444       }
445   }
446
447
448}
449