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 RXD message segment (PHARMACY DISPENSE). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>RXD-1: Dispense Sub-ID Counter (NM) <b>optional </b>
052     * <li>RXD-2: Dispense / give code (CE) <b> </b>
053     * <li>RXD-3: Date / time dispensed (TS) <b>optional </b>
054     * <li>RXD-4: Actual Dispense Amount (NM) <b> </b>
055     * <li>RXD-5: Actual Dispense Units (CE) <b>optional </b>
056     * <li>RXD-6: Actual Dosage Form (CE) <b>optional </b>
057     * <li>RXD-7: Prescription Number (ST) <b> </b>
058     * <li>RXD-8: Number of Refills Remaining (NM) <b>optional </b>
059     * <li>RXD-9: Dispense Notes (ST) <b>optional repeating</b>
060     * <li>RXD-10: Dispensing Provider (CN) <b>optional </b>
061     * <li>RXD-11: Substitution Status (ID) <b>optional </b>
062     * <li>RXD-12: Total Daily Dose (CQ_QUANTITY) <b>optional </b>
063     * <li>RXD-13: Deliver-to location (CM_LA1) <b>optional </b>
064     * <li>RXD-14: Needs Human Review (ID) <b>optional </b>
065     * <li>RXD-15: Pharmacy Special Dispensing Instructions (CE) <b>optional </b>
066 * </ul>
067 */
068@SuppressWarnings("unused")
069public class RXD extends AbstractSegment {
070
071    /** 
072     * Creates a new RXD segment
073     */
074    public RXD(Group parent, ModelClassFactory factory) {
075       super(parent, factory);
076       init(factory);
077    }
078
079    private void init(ModelClassFactory factory) {
080       try {
081                                  this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Dispense Sub-ID Counter");
082                                  this.add(CE.class, true, 1, 100, new Object[]{ getMessage() }, "Dispense / give code");
083                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date / time dispensed");
084                                  this.add(NM.class, true, 1, 20, new Object[]{ getMessage() }, "Actual Dispense Amount");
085                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Actual Dispense Units");
086                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Actual Dosage Form");
087                                  this.add(ST.class, true, 1, 20, new Object[]{ getMessage() }, "Prescription Number");
088                                  this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "Number of Refills Remaining");
089                                  this.add(ST.class, false, 0, 200, new Object[]{ getMessage() }, "Dispense Notes");
090                                  this.add(CN.class, false, 1, 200, new Object[]{ getMessage() }, "Dispensing Provider");
091                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(167) }, "Substitution Status");
092                                  this.add(CQ_QUANTITY.class, false, 1, 10, new Object[]{ getMessage() }, "Total Daily Dose");
093                                  this.add(CM_LA1.class, false, 1, 12, new Object[]{ getMessage() }, "Deliver-to location");
094                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(0) }, "Needs Human Review");
095                                  this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Pharmacy Special Dispensing Instructions");
096       } catch(HL7Exception e) {
097          log.error("Unexpected error creating RXD - this is probably a bug in the source code generator.", e);
098       }
099    }
100
101
102
103    /**
104     * Returns
105     * RXD-1: "Dispense Sub-ID Counter" - creates it if necessary
106     */
107    public NM getDispenseSubIDCounter() { 
108                NM retVal = this.getTypedField(1, 0);
109                return retVal;
110    }
111    
112    /**
113     * Returns
114     * RXD-1: "Dispense Sub-ID Counter" - creates it if necessary
115     */
116    public NM getRxd1_DispenseSubIDCounter() { 
117                NM retVal = this.getTypedField(1, 0);
118                return retVal;
119    }
120
121
122
123    /**
124     * Returns
125     * RXD-2: "Dispense / give code" - creates it if necessary
126     */
127    public CE getDispenseGiveCode() { 
128                CE retVal = this.getTypedField(2, 0);
129                return retVal;
130    }
131    
132    /**
133     * Returns
134     * RXD-2: "Dispense / give code" - creates it if necessary
135     */
136    public CE getRxd2_DispenseGiveCode() { 
137                CE retVal = this.getTypedField(2, 0);
138                return retVal;
139    }
140
141
142
143    /**
144     * Returns
145     * RXD-3: "Date / time dispensed" - creates it if necessary
146     */
147    public TS getDateTimeDispensed() { 
148                TS retVal = this.getTypedField(3, 0);
149                return retVal;
150    }
151    
152    /**
153     * Returns
154     * RXD-3: "Date / time dispensed" - creates it if necessary
155     */
156    public TS getRxd3_DateTimeDispensed() { 
157                TS retVal = this.getTypedField(3, 0);
158                return retVal;
159    }
160
161
162
163    /**
164     * Returns
165     * RXD-4: "Actual Dispense Amount" - creates it if necessary
166     */
167    public NM getActualDispenseAmount() { 
168                NM retVal = this.getTypedField(4, 0);
169                return retVal;
170    }
171    
172    /**
173     * Returns
174     * RXD-4: "Actual Dispense Amount" - creates it if necessary
175     */
176    public NM getRxd4_ActualDispenseAmount() { 
177                NM retVal = this.getTypedField(4, 0);
178                return retVal;
179    }
180
181
182
183    /**
184     * Returns
185     * RXD-5: "Actual Dispense Units" - creates it if necessary
186     */
187    public CE getActualDispenseUnits() { 
188                CE retVal = this.getTypedField(5, 0);
189                return retVal;
190    }
191    
192    /**
193     * Returns
194     * RXD-5: "Actual Dispense Units" - creates it if necessary
195     */
196    public CE getRxd5_ActualDispenseUnits() { 
197                CE retVal = this.getTypedField(5, 0);
198                return retVal;
199    }
200
201
202
203    /**
204     * Returns
205     * RXD-6: "Actual Dosage Form" - creates it if necessary
206     */
207    public CE getActualDosageForm() { 
208                CE retVal = this.getTypedField(6, 0);
209                return retVal;
210    }
211    
212    /**
213     * Returns
214     * RXD-6: "Actual Dosage Form" - creates it if necessary
215     */
216    public CE getRxd6_ActualDosageForm() { 
217                CE retVal = this.getTypedField(6, 0);
218                return retVal;
219    }
220
221
222
223    /**
224     * Returns
225     * RXD-7: "Prescription Number" - creates it if necessary
226     */
227    public ST getPrescriptionNumber() { 
228                ST retVal = this.getTypedField(7, 0);
229                return retVal;
230    }
231    
232    /**
233     * Returns
234     * RXD-7: "Prescription Number" - creates it if necessary
235     */
236    public ST getRxd7_PrescriptionNumber() { 
237                ST retVal = this.getTypedField(7, 0);
238                return retVal;
239    }
240
241
242
243    /**
244     * Returns
245     * RXD-8: "Number of Refills Remaining" - creates it if necessary
246     */
247    public NM getNumberOfRefillsRemaining() { 
248                NM retVal = this.getTypedField(8, 0);
249                return retVal;
250    }
251    
252    /**
253     * Returns
254     * RXD-8: "Number of Refills Remaining" - creates it if necessary
255     */
256    public NM getRxd8_NumberOfRefillsRemaining() { 
257                NM retVal = this.getTypedField(8, 0);
258                return retVal;
259    }
260
261
262    /**
263     * Returns all repetitions of Dispense Notes (RXD-9).
264     */
265    public ST[] getDispenseNotes() {
266        ST[] retVal = this.getTypedField(9, new ST[0]);
267        return retVal;
268    }
269
270
271    /**
272     * Returns all repetitions of Dispense Notes (RXD-9).
273     */
274    public ST[] getRxd9_DispenseNotes() {
275        ST[] retVal = this.getTypedField(9, new ST[0]);
276        return retVal;
277    }
278
279
280    /**
281     * Returns a count of the current number of repetitions of Dispense Notes (RXD-9).
282     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
283     * it will return zero.
284     */
285    public int getDispenseNotesReps() {
286        return this.getReps(9);
287    }
288
289
290    /**
291     * Returns a specific repetition of
292     * RXD-9: "Dispense Notes" - creates it if necessary
293     *
294     * @param rep The repetition index (0-indexed)
295     */
296    public ST getDispenseNotes(int rep) { 
297                ST retVal = this.getTypedField(9, rep);
298                return retVal;
299    }
300
301    /**
302     * Returns a specific repetition of
303     * RXD-9: "Dispense Notes" - creates it if necessary
304     *
305     * @param rep The repetition index (0-indexed)
306     */
307    public ST getRxd9_DispenseNotes(int rep) { 
308                ST retVal = this.getTypedField(9, rep);
309                return retVal;
310    }
311
312    /**
313     * Returns a count of the current number of repetitions of Dispense Notes (RXD-9).
314     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
315     * it will return zero.
316     */
317    public int getRxd9_DispenseNotesReps() {
318        return this.getReps(9);
319    }
320
321
322    /**
323     * Inserts a repetition of
324     * RXD-9: "Dispense Notes" at a specific index
325     *
326     * @param rep The repetition index (0-indexed)
327     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
328     */
329    public ST insertDispenseNotes(int rep) throws HL7Exception { 
330        return (ST) super.insertRepetition(9, rep);
331    }
332
333
334    /**
335     * Inserts a repetition of
336     * RXD-9: "Dispense Notes" at a specific index
337     *
338     * @param rep The repetition index (0-indexed)
339     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
340     */
341    public ST insertRxd9_DispenseNotes(int rep) throws HL7Exception { 
342        return (ST) super.insertRepetition(9, rep);
343    }
344
345
346    /**
347     * Removes a repetition of
348     * RXD-9: "Dispense Notes" at a specific index
349     *
350     * @param rep The repetition index (0-indexed)
351     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
352     */
353    public ST removeDispenseNotes(int rep) throws HL7Exception { 
354        return (ST) super.removeRepetition(9, rep);
355    }
356
357
358    /**
359     * Removes a repetition of
360     * RXD-9: "Dispense Notes" at a specific index
361     *
362     * @param rep The repetition index (0-indexed)
363     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
364     */
365    public ST removeRxd9_DispenseNotes(int rep) throws HL7Exception { 
366        return (ST) super.removeRepetition(9, rep);
367    }
368
369
370
371
372    /**
373     * Returns
374     * RXD-10: "Dispensing Provider" - creates it if necessary
375     */
376    public CN getDispensingProvider() { 
377                CN retVal = this.getTypedField(10, 0);
378                return retVal;
379    }
380    
381    /**
382     * Returns
383     * RXD-10: "Dispensing Provider" - creates it if necessary
384     */
385    public CN getRxd10_DispensingProvider() { 
386                CN retVal = this.getTypedField(10, 0);
387                return retVal;
388    }
389
390
391
392    /**
393     * Returns
394     * RXD-11: "Substitution Status" - creates it if necessary
395     */
396    public ID getSubstitutionStatus() { 
397                ID retVal = this.getTypedField(11, 0);
398                return retVal;
399    }
400    
401    /**
402     * Returns
403     * RXD-11: "Substitution Status" - creates it if necessary
404     */
405    public ID getRxd11_SubstitutionStatus() { 
406                ID retVal = this.getTypedField(11, 0);
407                return retVal;
408    }
409
410
411
412    /**
413     * Returns
414     * RXD-12: "Total Daily Dose" - creates it if necessary
415     */
416    public CQ_QUANTITY getTotalDailyDose() { 
417                CQ_QUANTITY retVal = this.getTypedField(12, 0);
418                return retVal;
419    }
420    
421    /**
422     * Returns
423     * RXD-12: "Total Daily Dose" - creates it if necessary
424     */
425    public CQ_QUANTITY getRxd12_TotalDailyDose() { 
426                CQ_QUANTITY retVal = this.getTypedField(12, 0);
427                return retVal;
428    }
429
430
431
432    /**
433     * Returns
434     * RXD-13: "Deliver-to location" - creates it if necessary
435     */
436    public CM_LA1 getDeliverToLocation() { 
437                CM_LA1 retVal = this.getTypedField(13, 0);
438                return retVal;
439    }
440    
441    /**
442     * Returns
443     * RXD-13: "Deliver-to location" - creates it if necessary
444     */
445    public CM_LA1 getRxd13_DeliverToLocation() { 
446                CM_LA1 retVal = this.getTypedField(13, 0);
447                return retVal;
448    }
449
450
451
452    /**
453     * Returns
454     * RXD-14: "Needs Human Review" - creates it if necessary
455     */
456    public ID getNeedsHumanReview() { 
457                ID retVal = this.getTypedField(14, 0);
458                return retVal;
459    }
460    
461    /**
462     * Returns
463     * RXD-14: "Needs Human Review" - creates it if necessary
464     */
465    public ID getRxd14_NeedsHumanReview() { 
466                ID retVal = this.getTypedField(14, 0);
467                return retVal;
468    }
469
470
471
472    /**
473     * Returns
474     * RXD-15: "Pharmacy Special Dispensing Instructions" - creates it if necessary
475     */
476    public CE getPharmacySpecialDispensingInstructions() { 
477                CE retVal = this.getTypedField(15, 0);
478                return retVal;
479    }
480    
481    /**
482     * Returns
483     * RXD-15: "Pharmacy Special Dispensing Instructions" - creates it if necessary
484     */
485    public CE getRxd15_PharmacySpecialDispensingInstructions() { 
486                CE retVal = this.getTypedField(15, 0);
487                return retVal;
488    }
489
490
491
492
493
494    /** {@inheritDoc} */   
495    protected Type createNewTypeWithoutReflection(int field) {
496       switch (field) {
497          case 0: return new NM(getMessage());
498          case 1: return new CE(getMessage());
499          case 2: return new TS(getMessage());
500          case 3: return new NM(getMessage());
501          case 4: return new CE(getMessage());
502          case 5: return new CE(getMessage());
503          case 6: return new ST(getMessage());
504          case 7: return new NM(getMessage());
505          case 8: return new ST(getMessage());
506          case 9: return new CN(getMessage());
507          case 10: return new ID(getMessage(), new Integer( 167 ));
508          case 11: return new CQ_QUANTITY(getMessage());
509          case 12: return new CM_LA1(getMessage());
510          case 13: return new ID(getMessage(), new Integer( 0 ));
511          case 14: return new CE(getMessage());
512          default: return null;
513       }
514   }
515
516
517}
518