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.v23.segment;
035
036// import ca.uhn.hl7v2.model.v23.group.*;
037import ca.uhn.hl7v2.model.v23.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/**
049 *<p>Represents an HL7 OBX message segment (Observation segment). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>OBX-1: Set ID - OBX (SI) <b>optional </b>
053     * <li>OBX-2: Value Type (ID) <b> </b>
054     * <li>OBX-3: Observation Identifier (CE) <b> </b>
055     * <li>OBX-4: Observation Sub-ID (ST) <b>optional </b>
056     * <li>OBX-5: Observation Value (Varies) <b>optional repeating</b>
057     * <li>OBX-6: Units (CE) <b>optional </b>
058     * <li>OBX-7: References Range (ST) <b>optional </b>
059     * <li>OBX-8: Abnormal Flags (ID) <b>optional repeating</b>
060     * <li>OBX-9: Probability (NM) <b>optional </b>
061     * <li>OBX-10: Nature of Abnormal Test (ID) <b>optional </b>
062     * <li>OBX-11: Observ Result Status (ID) <b> </b>
063     * <li>OBX-12: Date Last Obs Normal Values (TS) <b>optional </b>
064     * <li>OBX-13: User Defined Access Checks (ST) <b>optional </b>
065     * <li>OBX-14: Date/Time of the Observation (TS) <b>optional </b>
066     * <li>OBX-15: Producer's ID (CE) <b>optional </b>
067     * <li>OBX-16: Responsible Observer (XCN) <b>optional </b>
068     * <li>OBX-17: Observation Method (CE) <b>optional repeating</b>
069 * </ul>
070 */
071@SuppressWarnings("unused")
072public class OBX extends AbstractSegment {
073
074    /** 
075     * Creates a new OBX segment
076     */
077    public OBX(Group parent, ModelClassFactory factory) {
078       super(parent, factory);
079       init(factory);
080    }
081
082    private void init(ModelClassFactory factory) {
083       try {
084                                  this.add(SI.class, false, 1, 4, new Object[]{ getMessage() }, "Set ID - OBX");
085                                              this.add(ID.class, true, 1, 2, new Object[]{ getMessage(), new Integer(125) }, "Value Type");
086                                  this.add(CE.class, true, 1, 590, new Object[]{ getMessage() }, "Observation Identifier");
087                                  this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "Observation Sub-ID");
088                                  this.add(Varies.class, false, 0, 65536, new Object[]{ getMessage() }, "Observation Value");
089                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Units");
090                                  this.add(ST.class, false, 1, 10, new Object[]{ getMessage() }, "References Range");
091                                              this.add(ID.class, false, 5, 5, new Object[]{ getMessage(), new Integer(78) }, "Abnormal Flags");
092                                  this.add(NM.class, false, 1, 5, new Object[]{ getMessage() }, "Probability");
093                                              this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(80) }, "Nature of Abnormal Test");
094                                              this.add(ID.class, true, 1, 1, new Object[]{ getMessage(), new Integer(85) }, "Observ Result Status");
095                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date Last Obs Normal Values");
096                                  this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "User Defined Access Checks");
097                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date/Time of the Observation");
098                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Producer's ID");
099                                  this.add(XCN.class, false, 1, 80, new Object[]{ getMessage() }, "Responsible Observer");
100                                  this.add(CE.class, false, 0, 80, new Object[]{ getMessage() }, "Observation Method");
101       } catch(HL7Exception e) {
102          log.error("Unexpected error creating OBX - this is probably a bug in the source code generator.", e);
103       }
104    }
105
106
107
108    /**
109     * Returns
110     * OBX-1: "Set ID - OBX" - creates it if necessary
111     */
112    public SI getSetIDOBX() { 
113                SI retVal = this.getTypedField(1, 0);
114                return retVal;
115    }
116    
117    /**
118     * Returns
119     * OBX-1: "Set ID - OBX" - creates it if necessary
120     */
121    public SI getObx1_SetIDOBX() { 
122                SI retVal = this.getTypedField(1, 0);
123                return retVal;
124    }
125
126
127
128    /**
129     * Returns
130     * OBX-2: "Value Type" - creates it if necessary
131     */
132    public ID getValueType() { 
133                ID retVal = this.getTypedField(2, 0);
134                return retVal;
135    }
136    
137    /**
138     * Returns
139     * OBX-2: "Value Type" - creates it if necessary
140     */
141    public ID getObx2_ValueType() { 
142                ID retVal = this.getTypedField(2, 0);
143                return retVal;
144    }
145
146
147
148    /**
149     * Returns
150     * OBX-3: "Observation Identifier" - creates it if necessary
151     */
152    public CE getObservationIdentifier() { 
153                CE retVal = this.getTypedField(3, 0);
154                return retVal;
155    }
156    
157    /**
158     * Returns
159     * OBX-3: "Observation Identifier" - creates it if necessary
160     */
161    public CE getObx3_ObservationIdentifier() { 
162                CE retVal = this.getTypedField(3, 0);
163                return retVal;
164    }
165
166
167
168    /**
169     * Returns
170     * OBX-4: "Observation Sub-ID" - creates it if necessary
171     */
172    public ST getObservationSubID() { 
173                ST retVal = this.getTypedField(4, 0);
174                return retVal;
175    }
176    
177    /**
178     * Returns
179     * OBX-4: "Observation Sub-ID" - creates it if necessary
180     */
181    public ST getObx4_ObservationSubID() { 
182                ST retVal = this.getTypedField(4, 0);
183                return retVal;
184    }
185
186
187    /**
188     * Returns all repetitions of Observation Value (OBX-5).
189     */
190    public Varies[] getObservationValue() {
191        Varies[] retVal = this.getTypedField(5, new Varies[0]);
192        return retVal;
193    }
194
195
196    /**
197     * Returns all repetitions of Observation Value (OBX-5).
198     */
199    public Varies[] getObx5_ObservationValue() {
200        Varies[] retVal = this.getTypedField(5, new Varies[0]);
201        return retVal;
202    }
203
204
205    /**
206     * Returns a count of the current number of repetitions of Observation Value (OBX-5).
207     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
208     * it will return zero.
209     */
210    public int getObservationValueReps() {
211        return this.getReps(5);
212    }
213
214
215    /**
216     * Returns a specific repetition of
217     * OBX-5: "Observation Value" - creates it if necessary
218     *
219     * @param rep The repetition index (0-indexed)
220     */
221    public Varies getObservationValue(int rep) { 
222                Varies retVal = this.getTypedField(5, rep);
223                return retVal;
224    }
225
226    /**
227     * Returns a specific repetition of
228     * OBX-5: "Observation Value" - creates it if necessary
229     *
230     * @param rep The repetition index (0-indexed)
231     */
232    public Varies getObx5_ObservationValue(int rep) { 
233                Varies retVal = this.getTypedField(5, rep);
234                return retVal;
235    }
236
237    /**
238     * Returns a count of the current number of repetitions of Observation Value (OBX-5).
239     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
240     * it will return zero.
241     */
242    public int getObx5_ObservationValueReps() {
243        return this.getReps(5);
244    }
245
246
247    /**
248     * Inserts a repetition of
249     * OBX-5: "Observation Value" at a specific index
250     *
251     * @param rep The repetition index (0-indexed)
252     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
253     */
254    public Varies insertObservationValue(int rep) throws HL7Exception { 
255        return (Varies) super.insertRepetition(5, rep);
256    }
257
258
259    /**
260     * Inserts a repetition of
261     * OBX-5: "Observation Value" at a specific index
262     *
263     * @param rep The repetition index (0-indexed)
264     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
265     */
266    public Varies insertObx5_ObservationValue(int rep) throws HL7Exception { 
267        return (Varies) super.insertRepetition(5, rep);
268    }
269
270
271    /**
272     * Removes a repetition of
273     * OBX-5: "Observation Value" at a specific index
274     *
275     * @param rep The repetition index (0-indexed)
276     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
277     */
278    public Varies removeObservationValue(int rep) throws HL7Exception { 
279        return (Varies) super.removeRepetition(5, rep);
280    }
281
282
283    /**
284     * Removes a repetition of
285     * OBX-5: "Observation Value" at a specific index
286     *
287     * @param rep The repetition index (0-indexed)
288     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
289     */
290    public Varies removeObx5_ObservationValue(int rep) throws HL7Exception { 
291        return (Varies) super.removeRepetition(5, rep);
292    }
293
294
295
296
297    /**
298     * Returns
299     * OBX-6: "Units" - creates it if necessary
300     */
301    public CE getUnits() { 
302                CE retVal = this.getTypedField(6, 0);
303                return retVal;
304    }
305    
306    /**
307     * Returns
308     * OBX-6: "Units" - creates it if necessary
309     */
310    public CE getObx6_Units() { 
311                CE retVal = this.getTypedField(6, 0);
312                return retVal;
313    }
314
315
316
317    /**
318     * Returns
319     * OBX-7: "References Range" - creates it if necessary
320     */
321    public ST getReferencesRange() { 
322                ST retVal = this.getTypedField(7, 0);
323                return retVal;
324    }
325    
326    /**
327     * Returns
328     * OBX-7: "References Range" - creates it if necessary
329     */
330    public ST getObx7_ReferencesRange() { 
331                ST retVal = this.getTypedField(7, 0);
332                return retVal;
333    }
334
335
336    /**
337     * Returns all repetitions of Abnormal Flags (OBX-8).
338     */
339    public ID[] getAbnormalFlags() {
340        ID[] retVal = this.getTypedField(8, new ID[0]);
341        return retVal;
342    }
343
344
345    /**
346     * Returns all repetitions of Abnormal Flags (OBX-8).
347     */
348    public ID[] getObx8_AbnormalFlags() {
349        ID[] retVal = this.getTypedField(8, new ID[0]);
350        return retVal;
351    }
352
353
354    /**
355     * Returns a count of the current number of repetitions of Abnormal Flags (OBX-8).
356     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
357     * it will return zero.
358     */
359    public int getAbnormalFlagsReps() {
360        return this.getReps(8);
361    }
362
363
364    /**
365     * Returns a specific repetition of
366     * OBX-8: "Abnormal Flags" - creates it if necessary
367     *
368     * @param rep The repetition index (0-indexed)
369     */
370    public ID getAbnormalFlags(int rep) { 
371                ID retVal = this.getTypedField(8, rep);
372                return retVal;
373    }
374
375    /**
376     * Returns a specific repetition of
377     * OBX-8: "Abnormal Flags" - creates it if necessary
378     *
379     * @param rep The repetition index (0-indexed)
380     */
381    public ID getObx8_AbnormalFlags(int rep) { 
382                ID retVal = this.getTypedField(8, rep);
383                return retVal;
384    }
385
386    /**
387     * Returns a count of the current number of repetitions of Abnormal Flags (OBX-8).
388     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
389     * it will return zero.
390     */
391    public int getObx8_AbnormalFlagsReps() {
392        return this.getReps(8);
393    }
394
395
396    /**
397     * Inserts a repetition of
398     * OBX-8: "Abnormal Flags" at a specific index
399     *
400     * @param rep The repetition index (0-indexed)
401     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
402     */
403    public ID insertAbnormalFlags(int rep) throws HL7Exception { 
404        return (ID) super.insertRepetition(8, rep);
405    }
406
407
408    /**
409     * Inserts a repetition of
410     * OBX-8: "Abnormal Flags" at a specific index
411     *
412     * @param rep The repetition index (0-indexed)
413     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
414     */
415    public ID insertObx8_AbnormalFlags(int rep) throws HL7Exception { 
416        return (ID) super.insertRepetition(8, rep);
417    }
418
419
420    /**
421     * Removes a repetition of
422     * OBX-8: "Abnormal Flags" at a specific index
423     *
424     * @param rep The repetition index (0-indexed)
425     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
426     */
427    public ID removeAbnormalFlags(int rep) throws HL7Exception { 
428        return (ID) super.removeRepetition(8, rep);
429    }
430
431
432    /**
433     * Removes a repetition of
434     * OBX-8: "Abnormal Flags" at a specific index
435     *
436     * @param rep The repetition index (0-indexed)
437     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
438     */
439    public ID removeObx8_AbnormalFlags(int rep) throws HL7Exception { 
440        return (ID) super.removeRepetition(8, rep);
441    }
442
443
444
445
446    /**
447     * Returns
448     * OBX-9: "Probability" - creates it if necessary
449     */
450    public NM getProbability() { 
451                NM retVal = this.getTypedField(9, 0);
452                return retVal;
453    }
454    
455    /**
456     * Returns
457     * OBX-9: "Probability" - creates it if necessary
458     */
459    public NM getObx9_Probability() { 
460                NM retVal = this.getTypedField(9, 0);
461                return retVal;
462    }
463
464
465
466    /**
467     * Returns
468     * OBX-10: "Nature of Abnormal Test" - creates it if necessary
469     */
470    public ID getNatureOfAbnormalTest() { 
471                ID retVal = this.getTypedField(10, 0);
472                return retVal;
473    }
474    
475    /**
476     * Returns
477     * OBX-10: "Nature of Abnormal Test" - creates it if necessary
478     */
479    public ID getObx10_NatureOfAbnormalTest() { 
480                ID retVal = this.getTypedField(10, 0);
481                return retVal;
482    }
483
484
485
486    /**
487     * Returns
488     * OBX-11: "Observ Result Status" - creates it if necessary
489     */
490    public ID getObservResultStatus() { 
491                ID retVal = this.getTypedField(11, 0);
492                return retVal;
493    }
494    
495    /**
496     * Returns
497     * OBX-11: "Observ Result Status" - creates it if necessary
498     */
499    public ID getObx11_ObservResultStatus() { 
500                ID retVal = this.getTypedField(11, 0);
501                return retVal;
502    }
503
504
505
506    /**
507     * Returns
508     * OBX-12: "Date Last Obs Normal Values" - creates it if necessary
509     */
510    public TS getDateLastObsNormalValues() { 
511                TS retVal = this.getTypedField(12, 0);
512                return retVal;
513    }
514    
515    /**
516     * Returns
517     * OBX-12: "Date Last Obs Normal Values" - creates it if necessary
518     */
519    public TS getObx12_DateLastObsNormalValues() { 
520                TS retVal = this.getTypedField(12, 0);
521                return retVal;
522    }
523
524
525
526    /**
527     * Returns
528     * OBX-13: "User Defined Access Checks" - creates it if necessary
529     */
530    public ST getUserDefinedAccessChecks() { 
531                ST retVal = this.getTypedField(13, 0);
532                return retVal;
533    }
534    
535    /**
536     * Returns
537     * OBX-13: "User Defined Access Checks" - creates it if necessary
538     */
539    public ST getObx13_UserDefinedAccessChecks() { 
540                ST retVal = this.getTypedField(13, 0);
541                return retVal;
542    }
543
544
545
546    /**
547     * Returns
548     * OBX-14: "Date/Time of the Observation" - creates it if necessary
549     */
550    public TS getDateTimeOfTheObservation() { 
551                TS retVal = this.getTypedField(14, 0);
552                return retVal;
553    }
554    
555    /**
556     * Returns
557     * OBX-14: "Date/Time of the Observation" - creates it if necessary
558     */
559    public TS getObx14_DateTimeOfTheObservation() { 
560                TS retVal = this.getTypedField(14, 0);
561                return retVal;
562    }
563
564
565
566    /**
567     * Returns
568     * OBX-15: "Producer's ID" - creates it if necessary
569     */
570    public CE getProducerSID() { 
571                CE retVal = this.getTypedField(15, 0);
572                return retVal;
573    }
574    
575    /**
576     * Returns
577     * OBX-15: "Producer's ID" - creates it if necessary
578     */
579    public CE getObx15_ProducerSID() { 
580                CE retVal = this.getTypedField(15, 0);
581                return retVal;
582    }
583
584
585
586    /**
587     * Returns
588     * OBX-16: "Responsible Observer" - creates it if necessary
589     */
590    public XCN getResponsibleObserver() { 
591                XCN retVal = this.getTypedField(16, 0);
592                return retVal;
593    }
594    
595    /**
596     * Returns
597     * OBX-16: "Responsible Observer" - creates it if necessary
598     */
599    public XCN getObx16_ResponsibleObserver() { 
600                XCN retVal = this.getTypedField(16, 0);
601                return retVal;
602    }
603
604
605    /**
606     * Returns all repetitions of Observation Method (OBX-17).
607     */
608    public CE[] getObservationMethod() {
609        CE[] retVal = this.getTypedField(17, new CE[0]);
610        return retVal;
611    }
612
613
614    /**
615     * Returns all repetitions of Observation Method (OBX-17).
616     */
617    public CE[] getObx17_ObservationMethod() {
618        CE[] retVal = this.getTypedField(17, new CE[0]);
619        return retVal;
620    }
621
622
623    /**
624     * Returns a count of the current number of repetitions of Observation Method (OBX-17).
625     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
626     * it will return zero.
627     */
628    public int getObservationMethodReps() {
629        return this.getReps(17);
630    }
631
632
633    /**
634     * Returns a specific repetition of
635     * OBX-17: "Observation Method" - creates it if necessary
636     *
637     * @param rep The repetition index (0-indexed)
638     */
639    public CE getObservationMethod(int rep) { 
640                CE retVal = this.getTypedField(17, rep);
641                return retVal;
642    }
643
644    /**
645     * Returns a specific repetition of
646     * OBX-17: "Observation Method" - creates it if necessary
647     *
648     * @param rep The repetition index (0-indexed)
649     */
650    public CE getObx17_ObservationMethod(int rep) { 
651                CE retVal = this.getTypedField(17, rep);
652                return retVal;
653    }
654
655    /**
656     * Returns a count of the current number of repetitions of Observation Method (OBX-17).
657     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
658     * it will return zero.
659     */
660    public int getObx17_ObservationMethodReps() {
661        return this.getReps(17);
662    }
663
664
665    /**
666     * Inserts a repetition of
667     * OBX-17: "Observation Method" at a specific index
668     *
669     * @param rep The repetition index (0-indexed)
670     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
671     */
672    public CE insertObservationMethod(int rep) throws HL7Exception { 
673        return (CE) super.insertRepetition(17, rep);
674    }
675
676
677    /**
678     * Inserts a repetition of
679     * OBX-17: "Observation Method" at a specific index
680     *
681     * @param rep The repetition index (0-indexed)
682     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
683     */
684    public CE insertObx17_ObservationMethod(int rep) throws HL7Exception { 
685        return (CE) super.insertRepetition(17, rep);
686    }
687
688
689    /**
690     * Removes a repetition of
691     * OBX-17: "Observation Method" at a specific index
692     *
693     * @param rep The repetition index (0-indexed)
694     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
695     */
696    public CE removeObservationMethod(int rep) throws HL7Exception { 
697        return (CE) super.removeRepetition(17, rep);
698    }
699
700
701    /**
702     * Removes a repetition of
703     * OBX-17: "Observation Method" at a specific index
704     *
705     * @param rep The repetition index (0-indexed)
706     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
707     */
708    public CE removeObx17_ObservationMethod(int rep) throws HL7Exception { 
709        return (CE) super.removeRepetition(17, rep);
710    }
711
712
713
714
715
716
717    /** {@inheritDoc} */   
718    protected Type createNewTypeWithoutReflection(int field) {
719       switch (field) {
720          case 0: return new SI(getMessage());
721          case 1: return new ID(getMessage(), new Integer( 125 ));
722          case 2: return new CE(getMessage());
723          case 3: return new ST(getMessage());
724          case 4: return new Varies(getMessage());
725          case 5: return new CE(getMessage());
726          case 6: return new ST(getMessage());
727          case 7: return new ID(getMessage(), new Integer( 78 ));
728          case 8: return new NM(getMessage());
729          case 9: return new ID(getMessage(), new Integer( 80 ));
730          case 10: return new ID(getMessage(), new Integer( 85 ));
731          case 11: return new TS(getMessage());
732          case 12: return new ST(getMessage());
733          case 13: return new TS(getMessage());
734          case 14: return new CE(getMessage());
735          case 15: return new XCN(getMessage());
736          case 16: return new CE(getMessage());
737          default: return null;
738       }
739   }
740
741
742}
743