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.v22.segment;
035
036// import ca.uhn.hl7v2.model.v22.group.*;
037import ca.uhn.hl7v2.model.v22.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 (OBSERVATION RESULT). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>OBX-1: Set ID - Observational Simple (SI) <b>optional </b>
052     * <li>OBX-2: Value Type (ID) <b> </b>
053     * <li>OBX-3: Observation Identifier (CE) <b> </b>
054     * <li>OBX-4: Observation Sub-ID (ST) <b>optional </b>
055     * <li>OBX-5: Observation Value (Varies) <b>optional </b>
056     * <li>OBX-6: Units (CE) <b>optional </b>
057     * <li>OBX-7: References Range (ST) <b>optional </b>
058     * <li>OBX-8: Abnormal Flags (ID) <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: Observation result status (ID) <b> </b>
062     * <li>OBX-12: Effective date last observation normal values (TS) <b>optional </b>
063     * <li>OBX-13: User Defined Access Checks (ST) <b>optional </b>
064     * <li>OBX-14: Date / time of the observation (TS) <b>optional </b>
065     * <li>OBX-15: Producer's ID (CE) <b>optional </b>
066     * <li>OBX-16: Responsible Observer (CN) <b>optional </b>
067 * </ul>
068 */
069@SuppressWarnings("unused")
070public class OBX extends AbstractSegment {
071
072    /** 
073     * Creates a new OBX segment
074     */
075    public OBX(Group parent, ModelClassFactory factory) {
076       super(parent, factory);
077       init(factory);
078    }
079
080    private void init(ModelClassFactory factory) {
081       try {
082                                  this.add(SI.class, false, 1, 4, new Object[]{ getMessage() }, "Set ID - Observational Simple");
083                                              this.add(ID.class, true, 1, 2, new Object[]{ getMessage(), new Integer(125) }, "Value Type");
084                                  this.add(CE.class, true, 1, 80, new Object[]{ getMessage() }, "Observation Identifier");
085                                  this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "Observation Sub-ID");
086                                  this.add(Varies.class, false, 1, 65536, new Object[]{ getMessage() }, "Observation Value");
087                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Units");
088                                  this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "References Range");
089                                              this.add(ID.class, false, 5, 10, new Object[]{ getMessage(), new Integer(78) }, "Abnormal Flags");
090                                  this.add(NM.class, false, 1, 5, new Object[]{ getMessage() }, "Probability");
091                                              this.add(ID.class, false, 1, 5, new Object[]{ getMessage(), new Integer(80) }, "Nature of Abnormal Test");
092                                              this.add(ID.class, true, 1, 2, new Object[]{ getMessage(), new Integer(85) }, "Observation result status");
093                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Effective date last observation normal values");
094                                  this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "User Defined Access Checks");
095                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date / time of the observation");
096                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Producer's ID");
097                                  this.add(CN.class, false, 1, 60, new Object[]{ getMessage() }, "Responsible Observer");
098       } catch(HL7Exception e) {
099          log.error("Unexpected error creating OBX - this is probably a bug in the source code generator.", e);
100       }
101    }
102
103
104
105    /**
106     * Returns
107     * OBX-1: "Set ID - Observational Simple" - creates it if necessary
108     */
109    public SI getSetIDObservationalSimple() { 
110                SI retVal = this.getTypedField(1, 0);
111                return retVal;
112    }
113    
114    /**
115     * Returns
116     * OBX-1: "Set ID - Observational Simple" - creates it if necessary
117     */
118    public SI getObx1_SetIDObservationalSimple() { 
119                SI retVal = this.getTypedField(1, 0);
120                return retVal;
121    }
122
123
124
125    /**
126     * Returns
127     * OBX-2: "Value Type" - creates it if necessary
128     */
129    public ID getValueType() { 
130                ID retVal = this.getTypedField(2, 0);
131                return retVal;
132    }
133    
134    /**
135     * Returns
136     * OBX-2: "Value Type" - creates it if necessary
137     */
138    public ID getObx2_ValueType() { 
139                ID retVal = this.getTypedField(2, 0);
140                return retVal;
141    }
142
143
144
145    /**
146     * Returns
147     * OBX-3: "Observation Identifier" - creates it if necessary
148     */
149    public CE getObservationIdentifier() { 
150                CE retVal = this.getTypedField(3, 0);
151                return retVal;
152    }
153    
154    /**
155     * Returns
156     * OBX-3: "Observation Identifier" - creates it if necessary
157     */
158    public CE getObx3_ObservationIdentifier() { 
159                CE retVal = this.getTypedField(3, 0);
160                return retVal;
161    }
162
163
164
165    /**
166     * Returns
167     * OBX-4: "Observation Sub-ID" - creates it if necessary
168     */
169    public ST getObservationSubID() { 
170                ST retVal = this.getTypedField(4, 0);
171                return retVal;
172    }
173    
174    /**
175     * Returns
176     * OBX-4: "Observation Sub-ID" - creates it if necessary
177     */
178    public ST getObx4_ObservationSubID() { 
179                ST retVal = this.getTypedField(4, 0);
180                return retVal;
181    }
182
183
184
185    /**
186     * Returns
187     * OBX-5: "Observation Value" - creates it if necessary
188     */
189    public Varies getObservationValue() { 
190                Varies retVal = this.getTypedField(5, 0);
191                return retVal;
192    }
193    
194    /**
195     * Returns
196     * OBX-5: "Observation Value" - creates it if necessary
197     */
198    public Varies getObx5_ObservationValue() { 
199                Varies retVal = this.getTypedField(5, 0);
200                return retVal;
201    }
202
203
204
205    /**
206     * Returns
207     * OBX-6: "Units" - creates it if necessary
208     */
209    public CE getUnits() { 
210                CE retVal = this.getTypedField(6, 0);
211                return retVal;
212    }
213    
214    /**
215     * Returns
216     * OBX-6: "Units" - creates it if necessary
217     */
218    public CE getObx6_Units() { 
219                CE retVal = this.getTypedField(6, 0);
220                return retVal;
221    }
222
223
224
225    /**
226     * Returns
227     * OBX-7: "References Range" - creates it if necessary
228     */
229    public ST getReferencesRange() { 
230                ST retVal = this.getTypedField(7, 0);
231                return retVal;
232    }
233    
234    /**
235     * Returns
236     * OBX-7: "References Range" - creates it if necessary
237     */
238    public ST getObx7_ReferencesRange() { 
239                ST retVal = this.getTypedField(7, 0);
240                return retVal;
241    }
242
243
244    /**
245     * Returns all repetitions of Abnormal Flags (OBX-8).
246     */
247    public ID[] getAbnormalFlags() {
248        ID[] retVal = this.getTypedField(8, new ID[0]);
249        return retVal;
250    }
251
252
253    /**
254     * Returns all repetitions of Abnormal Flags (OBX-8).
255     */
256    public ID[] getObx8_AbnormalFlags() {
257        ID[] retVal = this.getTypedField(8, new ID[0]);
258        return retVal;
259    }
260
261
262    /**
263     * Returns a count of the current number of repetitions of Abnormal Flags (OBX-8).
264     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
265     * it will return zero.
266     */
267    public int getAbnormalFlagsReps() {
268        return this.getReps(8);
269    }
270
271
272    /**
273     * Returns a specific repetition of
274     * OBX-8: "Abnormal Flags" - creates it if necessary
275     *
276     * @param rep The repetition index (0-indexed)
277     */
278    public ID getAbnormalFlags(int rep) { 
279                ID retVal = this.getTypedField(8, rep);
280                return retVal;
281    }
282
283    /**
284     * Returns a specific repetition of
285     * OBX-8: "Abnormal Flags" - creates it if necessary
286     *
287     * @param rep The repetition index (0-indexed)
288     */
289    public ID getObx8_AbnormalFlags(int rep) { 
290                ID retVal = this.getTypedField(8, rep);
291                return retVal;
292    }
293
294    /**
295     * Returns a count of the current number of repetitions of Abnormal Flags (OBX-8).
296     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
297     * it will return zero.
298     */
299    public int getObx8_AbnormalFlagsReps() {
300        return this.getReps(8);
301    }
302
303
304    /**
305     * Inserts a repetition of
306     * OBX-8: "Abnormal Flags" at a specific index
307     *
308     * @param rep The repetition index (0-indexed)
309     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
310     */
311    public ID insertAbnormalFlags(int rep) throws HL7Exception { 
312        return (ID) super.insertRepetition(8, rep);
313    }
314
315
316    /**
317     * Inserts a repetition of
318     * OBX-8: "Abnormal Flags" at a specific index
319     *
320     * @param rep The repetition index (0-indexed)
321     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
322     */
323    public ID insertObx8_AbnormalFlags(int rep) throws HL7Exception { 
324        return (ID) super.insertRepetition(8, rep);
325    }
326
327
328    /**
329     * Removes a repetition of
330     * OBX-8: "Abnormal Flags" at a specific index
331     *
332     * @param rep The repetition index (0-indexed)
333     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
334     */
335    public ID removeAbnormalFlags(int rep) throws HL7Exception { 
336        return (ID) super.removeRepetition(8, rep);
337    }
338
339
340    /**
341     * Removes a repetition of
342     * OBX-8: "Abnormal Flags" at a specific index
343     *
344     * @param rep The repetition index (0-indexed)
345     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
346     */
347    public ID removeObx8_AbnormalFlags(int rep) throws HL7Exception { 
348        return (ID) super.removeRepetition(8, rep);
349    }
350
351
352
353
354    /**
355     * Returns
356     * OBX-9: "Probability" - creates it if necessary
357     */
358    public NM getProbability() { 
359                NM retVal = this.getTypedField(9, 0);
360                return retVal;
361    }
362    
363    /**
364     * Returns
365     * OBX-9: "Probability" - creates it if necessary
366     */
367    public NM getObx9_Probability() { 
368                NM retVal = this.getTypedField(9, 0);
369                return retVal;
370    }
371
372
373
374    /**
375     * Returns
376     * OBX-10: "Nature of Abnormal Test" - creates it if necessary
377     */
378    public ID getNatureOfAbnormalTest() { 
379                ID retVal = this.getTypedField(10, 0);
380                return retVal;
381    }
382    
383    /**
384     * Returns
385     * OBX-10: "Nature of Abnormal Test" - creates it if necessary
386     */
387    public ID getObx10_NatureOfAbnormalTest() { 
388                ID retVal = this.getTypedField(10, 0);
389                return retVal;
390    }
391
392
393
394    /**
395     * Returns
396     * OBX-11: "Observation result status" - creates it if necessary
397     */
398    public ID getObservationResultStatus() { 
399                ID retVal = this.getTypedField(11, 0);
400                return retVal;
401    }
402    
403    /**
404     * Returns
405     * OBX-11: "Observation result status" - creates it if necessary
406     */
407    public ID getObx11_ObservationResultStatus() { 
408                ID retVal = this.getTypedField(11, 0);
409                return retVal;
410    }
411
412
413
414    /**
415     * Returns
416     * OBX-12: "Effective date last observation normal values" - creates it if necessary
417     */
418    public TS getEffectiveDateLastObservationNormalValues() { 
419                TS retVal = this.getTypedField(12, 0);
420                return retVal;
421    }
422    
423    /**
424     * Returns
425     * OBX-12: "Effective date last observation normal values" - creates it if necessary
426     */
427    public TS getObx12_EffectiveDateLastObservationNormalValues() { 
428                TS retVal = this.getTypedField(12, 0);
429                return retVal;
430    }
431
432
433
434    /**
435     * Returns
436     * OBX-13: "User Defined Access Checks" - creates it if necessary
437     */
438    public ST getUserDefinedAccessChecks() { 
439                ST retVal = this.getTypedField(13, 0);
440                return retVal;
441    }
442    
443    /**
444     * Returns
445     * OBX-13: "User Defined Access Checks" - creates it if necessary
446     */
447    public ST getObx13_UserDefinedAccessChecks() { 
448                ST retVal = this.getTypedField(13, 0);
449                return retVal;
450    }
451
452
453
454    /**
455     * Returns
456     * OBX-14: "Date / time of the observation" - creates it if necessary
457     */
458    public TS getDateTimeOfTheObservation() { 
459                TS retVal = this.getTypedField(14, 0);
460                return retVal;
461    }
462    
463    /**
464     * Returns
465     * OBX-14: "Date / time of the observation" - creates it if necessary
466     */
467    public TS getObx14_DateTimeOfTheObservation() { 
468                TS retVal = this.getTypedField(14, 0);
469                return retVal;
470    }
471
472
473
474    /**
475     * Returns
476     * OBX-15: "Producer's ID" - creates it if necessary
477     */
478    public CE getProducerSID() { 
479                CE retVal = this.getTypedField(15, 0);
480                return retVal;
481    }
482    
483    /**
484     * Returns
485     * OBX-15: "Producer's ID" - creates it if necessary
486     */
487    public CE getObx15_ProducerSID() { 
488                CE retVal = this.getTypedField(15, 0);
489                return retVal;
490    }
491
492
493
494    /**
495     * Returns
496     * OBX-16: "Responsible Observer" - creates it if necessary
497     */
498    public CN getResponsibleObserver() { 
499                CN retVal = this.getTypedField(16, 0);
500                return retVal;
501    }
502    
503    /**
504     * Returns
505     * OBX-16: "Responsible Observer" - creates it if necessary
506     */
507    public CN getObx16_ResponsibleObserver() { 
508                CN retVal = this.getTypedField(16, 0);
509                return retVal;
510    }
511
512
513
514
515
516    /** {@inheritDoc} */   
517    protected Type createNewTypeWithoutReflection(int field) {
518       switch (field) {
519          case 0: return new SI(getMessage());
520          case 1: return new ID(getMessage(), new Integer( 125 ));
521          case 2: return new CE(getMessage());
522          case 3: return new ST(getMessage());
523          case 4: return new Varies(getMessage());
524          case 5: return new CE(getMessage());
525          case 6: return new ST(getMessage());
526          case 7: return new ID(getMessage(), new Integer( 78 ));
527          case 8: return new NM(getMessage());
528          case 9: return new ID(getMessage(), new Integer( 80 ));
529          case 10: return new ID(getMessage(), new Integer( 85 ));
530          case 11: return new TS(getMessage());
531          case 12: return new ST(getMessage());
532          case 13: return new TS(getMessage());
533          case 14: return new CE(getMessage());
534          case 15: return new CN(getMessage());
535          default: return null;
536       }
537   }
538
539
540}
541