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