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 RXO message segment (PHARMACY PRESCRIPTION ORDER). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>RXO-1: Requested Give Code (CE) <b> </b>
052     * <li>RXO-2: Requested Give Amount - Minimum (NM) <b> </b>
053     * <li>RXO-3: Requested Give Amount - Maximum (NM) <b>optional </b>
054     * <li>RXO-4: Requested Give Units (CE) <b> </b>
055     * <li>RXO-5: Requested Dosage Form (CE) <b>optional </b>
056     * <li>RXO-6: Provider's Pharmacy Instructions (CE) <b>optional repeating</b>
057     * <li>RXO-7: Provider's Administration Instructions (CE) <b>optional repeating</b>
058     * <li>RXO-8: Deliver-to location (CM_LA1) <b>optional </b>
059     * <li>RXO-9: Allow Substitutions (ID) <b>optional </b>
060     * <li>RXO-10: Requested Dispense Code (CE) <b>optional </b>
061     * <li>RXO-11: Requested Dispense Amount (NM) <b>optional </b>
062     * <li>RXO-12: Requested Dispense Units (CE) <b>optional </b>
063     * <li>RXO-13: Number of Refills (NM) <b>optional </b>
064     * <li>RXO-14: Ordering Provider's DEA Number (CN) <b>optional </b>
065     * <li>RXO-15: Pharmacist Verifier ID (CN) <b>optional </b>
066     * <li>RXO-16: Needs Human Review (ID) <b>optional </b>
067     * <li>RXO-17: Requested Give Per (Time Unit) (ST) <b>optional </b>
068 * </ul>
069 */
070@SuppressWarnings("unused")
071public class RXO extends AbstractSegment {
072
073    /** 
074     * Creates a new RXO segment
075     */
076    public RXO(Group parent, ModelClassFactory factory) {
077       super(parent, factory);
078       init(factory);
079    }
080
081    private void init(ModelClassFactory factory) {
082       try {
083                                  this.add(CE.class, true, 1, 100, new Object[]{ getMessage() }, "Requested Give Code");
084                                  this.add(NM.class, true, 1, 20, new Object[]{ getMessage() }, "Requested Give Amount - Minimum");
085                                  this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "Requested Give Amount - Maximum");
086                                  this.add(CE.class, true, 1, 60, new Object[]{ getMessage() }, "Requested Give Units");
087                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Requested Dosage Form");
088                                  this.add(CE.class, false, 0, 200, new Object[]{ getMessage() }, "Provider's Pharmacy Instructions");
089                                  this.add(CE.class, false, 0, 200, new Object[]{ getMessage() }, "Provider's Administration Instructions");
090                                  this.add(CM_LA1.class, false, 1, 12, new Object[]{ getMessage() }, "Deliver-to location");
091                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(161) }, "Allow Substitutions");
092                                  this.add(CE.class, false, 1, 100, new Object[]{ getMessage() }, "Requested Dispense Code");
093                                  this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "Requested Dispense Amount");
094                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Requested Dispense Units");
095                                  this.add(NM.class, false, 1, 3, new Object[]{ getMessage() }, "Number of Refills");
096                                  this.add(CN.class, false, 1, 60, new Object[]{ getMessage() }, "Ordering Provider's DEA Number");
097                                  this.add(CN.class, false, 1, 60, new Object[]{ getMessage() }, "Pharmacist Verifier ID");
098                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(0) }, "Needs Human Review");
099                                  this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "Requested Give Per (Time Unit)");
100       } catch(HL7Exception e) {
101          log.error("Unexpected error creating RXO - this is probably a bug in the source code generator.", e);
102       }
103    }
104
105
106
107    /**
108     * Returns
109     * RXO-1: "Requested Give Code" - creates it if necessary
110     */
111    public CE getRequestedGiveCode() { 
112                CE retVal = this.getTypedField(1, 0);
113                return retVal;
114    }
115    
116    /**
117     * Returns
118     * RXO-1: "Requested Give Code" - creates it if necessary
119     */
120    public CE getRxo1_RequestedGiveCode() { 
121                CE retVal = this.getTypedField(1, 0);
122                return retVal;
123    }
124
125
126
127    /**
128     * Returns
129     * RXO-2: "Requested Give Amount - Minimum" - creates it if necessary
130     */
131    public NM getRequestedGiveAmountMinimum() { 
132                NM retVal = this.getTypedField(2, 0);
133                return retVal;
134    }
135    
136    /**
137     * Returns
138     * RXO-2: "Requested Give Amount - Minimum" - creates it if necessary
139     */
140    public NM getRxo2_RequestedGiveAmountMinimum() { 
141                NM retVal = this.getTypedField(2, 0);
142                return retVal;
143    }
144
145
146
147    /**
148     * Returns
149     * RXO-3: "Requested Give Amount - Maximum" - creates it if necessary
150     */
151    public NM getRequestedGiveAmountMaximum() { 
152                NM retVal = this.getTypedField(3, 0);
153                return retVal;
154    }
155    
156    /**
157     * Returns
158     * RXO-3: "Requested Give Amount - Maximum" - creates it if necessary
159     */
160    public NM getRxo3_RequestedGiveAmountMaximum() { 
161                NM retVal = this.getTypedField(3, 0);
162                return retVal;
163    }
164
165
166
167    /**
168     * Returns
169     * RXO-4: "Requested Give Units" - creates it if necessary
170     */
171    public CE getRequestedGiveUnits() { 
172                CE retVal = this.getTypedField(4, 0);
173                return retVal;
174    }
175    
176    /**
177     * Returns
178     * RXO-4: "Requested Give Units" - creates it if necessary
179     */
180    public CE getRxo4_RequestedGiveUnits() { 
181                CE retVal = this.getTypedField(4, 0);
182                return retVal;
183    }
184
185
186
187    /**
188     * Returns
189     * RXO-5: "Requested Dosage Form" - creates it if necessary
190     */
191    public CE getRequestedDosageForm() { 
192                CE retVal = this.getTypedField(5, 0);
193                return retVal;
194    }
195    
196    /**
197     * Returns
198     * RXO-5: "Requested Dosage Form" - creates it if necessary
199     */
200    public CE getRxo5_RequestedDosageForm() { 
201                CE retVal = this.getTypedField(5, 0);
202                return retVal;
203    }
204
205
206    /**
207     * Returns all repetitions of Provider's Pharmacy Instructions (RXO-6).
208     */
209    public CE[] getProviderSPharmacyInstructions() {
210        CE[] retVal = this.getTypedField(6, new CE[0]);
211        return retVal;
212    }
213
214
215    /**
216     * Returns all repetitions of Provider's Pharmacy Instructions (RXO-6).
217     */
218    public CE[] getRxo6_ProviderSPharmacyInstructions() {
219        CE[] retVal = this.getTypedField(6, new CE[0]);
220        return retVal;
221    }
222
223
224    /**
225     * Returns a count of the current number of repetitions of Provider's Pharmacy Instructions (RXO-6).
226     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
227     * it will return zero.
228     */
229    public int getProviderSPharmacyInstructionsReps() {
230        return this.getReps(6);
231    }
232
233
234    /**
235     * Returns a specific repetition of
236     * RXO-6: "Provider's Pharmacy Instructions" - creates it if necessary
237     *
238     * @param rep The repetition index (0-indexed)
239     */
240    public CE getProviderSPharmacyInstructions(int rep) { 
241                CE retVal = this.getTypedField(6, rep);
242                return retVal;
243    }
244
245    /**
246     * Returns a specific repetition of
247     * RXO-6: "Provider's Pharmacy Instructions" - creates it if necessary
248     *
249     * @param rep The repetition index (0-indexed)
250     */
251    public CE getRxo6_ProviderSPharmacyInstructions(int rep) { 
252                CE retVal = this.getTypedField(6, rep);
253                return retVal;
254    }
255
256    /**
257     * Returns a count of the current number of repetitions of Provider's Pharmacy Instructions (RXO-6).
258     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
259     * it will return zero.
260     */
261    public int getRxo6_ProviderSPharmacyInstructionsReps() {
262        return this.getReps(6);
263    }
264
265
266    /**
267     * Inserts a repetition of
268     * RXO-6: "Provider's Pharmacy Instructions" at a specific index
269     *
270     * @param rep The repetition index (0-indexed)
271     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
272     */
273    public CE insertProviderSPharmacyInstructions(int rep) throws HL7Exception { 
274        return (CE) super.insertRepetition(6, rep);
275    }
276
277
278    /**
279     * Inserts a repetition of
280     * RXO-6: "Provider's Pharmacy Instructions" at a specific index
281     *
282     * @param rep The repetition index (0-indexed)
283     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
284     */
285    public CE insertRxo6_ProviderSPharmacyInstructions(int rep) throws HL7Exception { 
286        return (CE) super.insertRepetition(6, rep);
287    }
288
289
290    /**
291     * Removes a repetition of
292     * RXO-6: "Provider's Pharmacy Instructions" at a specific index
293     *
294     * @param rep The repetition index (0-indexed)
295     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
296     */
297    public CE removeProviderSPharmacyInstructions(int rep) throws HL7Exception { 
298        return (CE) super.removeRepetition(6, rep);
299    }
300
301
302    /**
303     * Removes a repetition of
304     * RXO-6: "Provider's Pharmacy Instructions" at a specific index
305     *
306     * @param rep The repetition index (0-indexed)
307     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
308     */
309    public CE removeRxo6_ProviderSPharmacyInstructions(int rep) throws HL7Exception { 
310        return (CE) super.removeRepetition(6, rep);
311    }
312
313
314
315    /**
316     * Returns all repetitions of Provider's Administration Instructions (RXO-7).
317     */
318    public CE[] getProviderSAdministrationInstructions() {
319        CE[] retVal = this.getTypedField(7, new CE[0]);
320        return retVal;
321    }
322
323
324    /**
325     * Returns all repetitions of Provider's Administration Instructions (RXO-7).
326     */
327    public CE[] getRxo7_ProviderSAdministrationInstructions() {
328        CE[] retVal = this.getTypedField(7, new CE[0]);
329        return retVal;
330    }
331
332
333    /**
334     * Returns a count of the current number of repetitions of Provider's Administration Instructions (RXO-7).
335     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
336     * it will return zero.
337     */
338    public int getProviderSAdministrationInstructionsReps() {
339        return this.getReps(7);
340    }
341
342
343    /**
344     * Returns a specific repetition of
345     * RXO-7: "Provider's Administration Instructions" - creates it if necessary
346     *
347     * @param rep The repetition index (0-indexed)
348     */
349    public CE getProviderSAdministrationInstructions(int rep) { 
350                CE retVal = this.getTypedField(7, rep);
351                return retVal;
352    }
353
354    /**
355     * Returns a specific repetition of
356     * RXO-7: "Provider's Administration Instructions" - creates it if necessary
357     *
358     * @param rep The repetition index (0-indexed)
359     */
360    public CE getRxo7_ProviderSAdministrationInstructions(int rep) { 
361                CE retVal = this.getTypedField(7, rep);
362                return retVal;
363    }
364
365    /**
366     * Returns a count of the current number of repetitions of Provider's Administration Instructions (RXO-7).
367     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
368     * it will return zero.
369     */
370    public int getRxo7_ProviderSAdministrationInstructionsReps() {
371        return this.getReps(7);
372    }
373
374
375    /**
376     * Inserts a repetition of
377     * RXO-7: "Provider's Administration Instructions" at a specific index
378     *
379     * @param rep The repetition index (0-indexed)
380     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
381     */
382    public CE insertProviderSAdministrationInstructions(int rep) throws HL7Exception { 
383        return (CE) super.insertRepetition(7, rep);
384    }
385
386
387    /**
388     * Inserts a repetition of
389     * RXO-7: "Provider's Administration Instructions" at a specific index
390     *
391     * @param rep The repetition index (0-indexed)
392     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
393     */
394    public CE insertRxo7_ProviderSAdministrationInstructions(int rep) throws HL7Exception { 
395        return (CE) super.insertRepetition(7, rep);
396    }
397
398
399    /**
400     * Removes a repetition of
401     * RXO-7: "Provider's Administration Instructions" at a specific index
402     *
403     * @param rep The repetition index (0-indexed)
404     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
405     */
406    public CE removeProviderSAdministrationInstructions(int rep) throws HL7Exception { 
407        return (CE) super.removeRepetition(7, rep);
408    }
409
410
411    /**
412     * Removes a repetition of
413     * RXO-7: "Provider's Administration Instructions" at a specific index
414     *
415     * @param rep The repetition index (0-indexed)
416     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
417     */
418    public CE removeRxo7_ProviderSAdministrationInstructions(int rep) throws HL7Exception { 
419        return (CE) super.removeRepetition(7, rep);
420    }
421
422
423
424
425    /**
426     * Returns
427     * RXO-8: "Deliver-to location" - creates it if necessary
428     */
429    public CM_LA1 getDeliverToLocation() { 
430                CM_LA1 retVal = this.getTypedField(8, 0);
431                return retVal;
432    }
433    
434    /**
435     * Returns
436     * RXO-8: "Deliver-to location" - creates it if necessary
437     */
438    public CM_LA1 getRxo8_DeliverToLocation() { 
439                CM_LA1 retVal = this.getTypedField(8, 0);
440                return retVal;
441    }
442
443
444
445    /**
446     * Returns
447     * RXO-9: "Allow Substitutions" - creates it if necessary
448     */
449    public ID getAllowSubstitutions() { 
450                ID retVal = this.getTypedField(9, 0);
451                return retVal;
452    }
453    
454    /**
455     * Returns
456     * RXO-9: "Allow Substitutions" - creates it if necessary
457     */
458    public ID getRxo9_AllowSubstitutions() { 
459                ID retVal = this.getTypedField(9, 0);
460                return retVal;
461    }
462
463
464
465    /**
466     * Returns
467     * RXO-10: "Requested Dispense Code" - creates it if necessary
468     */
469    public CE getRequestedDispenseCode() { 
470                CE retVal = this.getTypedField(10, 0);
471                return retVal;
472    }
473    
474    /**
475     * Returns
476     * RXO-10: "Requested Dispense Code" - creates it if necessary
477     */
478    public CE getRxo10_RequestedDispenseCode() { 
479                CE retVal = this.getTypedField(10, 0);
480                return retVal;
481    }
482
483
484
485    /**
486     * Returns
487     * RXO-11: "Requested Dispense Amount" - creates it if necessary
488     */
489    public NM getRequestedDispenseAmount() { 
490                NM retVal = this.getTypedField(11, 0);
491                return retVal;
492    }
493    
494    /**
495     * Returns
496     * RXO-11: "Requested Dispense Amount" - creates it if necessary
497     */
498    public NM getRxo11_RequestedDispenseAmount() { 
499                NM retVal = this.getTypedField(11, 0);
500                return retVal;
501    }
502
503
504
505    /**
506     * Returns
507     * RXO-12: "Requested Dispense Units" - creates it if necessary
508     */
509    public CE getRequestedDispenseUnits() { 
510                CE retVal = this.getTypedField(12, 0);
511                return retVal;
512    }
513    
514    /**
515     * Returns
516     * RXO-12: "Requested Dispense Units" - creates it if necessary
517     */
518    public CE getRxo12_RequestedDispenseUnits() { 
519                CE retVal = this.getTypedField(12, 0);
520                return retVal;
521    }
522
523
524
525    /**
526     * Returns
527     * RXO-13: "Number of Refills" - creates it if necessary
528     */
529    public NM getNumberOfRefills() { 
530                NM retVal = this.getTypedField(13, 0);
531                return retVal;
532    }
533    
534    /**
535     * Returns
536     * RXO-13: "Number of Refills" - creates it if necessary
537     */
538    public NM getRxo13_NumberOfRefills() { 
539                NM retVal = this.getTypedField(13, 0);
540                return retVal;
541    }
542
543
544
545    /**
546     * Returns
547     * RXO-14: "Ordering Provider's DEA Number" - creates it if necessary
548     */
549    public CN getOrderingProviderSDEANumber() { 
550                CN retVal = this.getTypedField(14, 0);
551                return retVal;
552    }
553    
554    /**
555     * Returns
556     * RXO-14: "Ordering Provider's DEA Number" - creates it if necessary
557     */
558    public CN getRxo14_OrderingProviderSDEANumber() { 
559                CN retVal = this.getTypedField(14, 0);
560                return retVal;
561    }
562
563
564
565    /**
566     * Returns
567     * RXO-15: "Pharmacist Verifier ID" - creates it if necessary
568     */
569    public CN getPharmacistVerifierID() { 
570                CN retVal = this.getTypedField(15, 0);
571                return retVal;
572    }
573    
574    /**
575     * Returns
576     * RXO-15: "Pharmacist Verifier ID" - creates it if necessary
577     */
578    public CN getRxo15_PharmacistVerifierID() { 
579                CN retVal = this.getTypedField(15, 0);
580                return retVal;
581    }
582
583
584
585    /**
586     * Returns
587     * RXO-16: "Needs Human Review" - creates it if necessary
588     */
589    public ID getNeedsHumanReview() { 
590                ID retVal = this.getTypedField(16, 0);
591                return retVal;
592    }
593    
594    /**
595     * Returns
596     * RXO-16: "Needs Human Review" - creates it if necessary
597     */
598    public ID getRxo16_NeedsHumanReview() { 
599                ID retVal = this.getTypedField(16, 0);
600                return retVal;
601    }
602
603
604
605    /**
606     * Returns
607     * RXO-17: "Requested Give Per (Time Unit)" - creates it if necessary
608     */
609    public ST getRequestedGivePerTimeUnit() { 
610                ST retVal = this.getTypedField(17, 0);
611                return retVal;
612    }
613    
614    /**
615     * Returns
616     * RXO-17: "Requested Give Per (Time Unit)" - creates it if necessary
617     */
618    public ST getRxo17_RequestedGivePerTimeUnit() { 
619                ST retVal = this.getTypedField(17, 0);
620                return retVal;
621    }
622
623
624
625
626
627    /** {@inheritDoc} */   
628    protected Type createNewTypeWithoutReflection(int field) {
629       switch (field) {
630          case 0: return new CE(getMessage());
631          case 1: return new NM(getMessage());
632          case 2: return new NM(getMessage());
633          case 3: return new CE(getMessage());
634          case 4: return new CE(getMessage());
635          case 5: return new CE(getMessage());
636          case 6: return new CE(getMessage());
637          case 7: return new CM_LA1(getMessage());
638          case 8: return new ID(getMessage(), new Integer( 161 ));
639          case 9: return new CE(getMessage());
640          case 10: return new NM(getMessage());
641          case 11: return new CE(getMessage());
642          case 12: return new NM(getMessage());
643          case 13: return new CN(getMessage());
644          case 14: return new CN(getMessage());
645          case 15: return new ID(getMessage(), new Integer( 0 ));
646          case 16: return new ST(getMessage());
647          default: return null;
648       }
649   }
650
651
652}
653