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.v25.segment;
035
036// import ca.uhn.hl7v2.model.v25.group.*;
037import ca.uhn.hl7v2.model.v25.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 GP2 message segment (Grouping/Reimbursement - Procedure Line Item). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>GP2-1: Revenue Code (IS) <b>optional </b>
053     * <li>GP2-2: Number of Service Units (NM) <b>optional </b>
054     * <li>GP2-3: Charge (CP) <b>optional </b>
055     * <li>GP2-4: Reimbursement Action Code (IS) <b>optional </b>
056     * <li>GP2-5: Denial or Rejection Code (IS) <b>optional </b>
057     * <li>GP2-6: OCE Edit Code (IS) <b>optional repeating</b>
058     * <li>GP2-7: Ambulatory Payment Classification Code (CE) <b>optional </b>
059     * <li>GP2-8: Modifier Edit Code (IS) <b>optional repeating</b>
060     * <li>GP2-9: Payment Adjustment Code (IS) <b>optional </b>
061     * <li>GP2-10: Packaging Status Code (IS) <b>optional </b>
062     * <li>GP2-11: Expected CMS Payment Amount (CP) <b>optional </b>
063     * <li>GP2-12: Reimbursement Type Code (IS) <b>optional </b>
064     * <li>GP2-13: Co-Pay Amount (CP) <b>optional </b>
065     * <li>GP2-14: Pay Rate per Service Unit (NM) <b>optional </b>
066 * </ul>
067 */
068@SuppressWarnings("unused")
069public class GP2 extends AbstractSegment {
070
071    /** 
072     * Creates a new GP2 segment
073     */
074    public GP2(Group parent, ModelClassFactory factory) {
075       super(parent, factory);
076       init(factory);
077    }
078
079    private void init(ModelClassFactory factory) {
080       try {
081                                              this.add(IS.class, false, 1, 3, new Object[]{ getMessage(), new Integer(456) }, "Revenue Code");
082                                  this.add(NM.class, false, 1, 7, new Object[]{ getMessage() }, "Number of Service Units");
083                                  this.add(CP.class, false, 1, 12, new Object[]{ getMessage() }, "Charge");
084                                              this.add(IS.class, false, 1, 1, new Object[]{ getMessage(), new Integer(459) }, "Reimbursement Action Code");
085                                              this.add(IS.class, false, 1, 1, new Object[]{ getMessage(), new Integer(460) }, "Denial or Rejection Code");
086                                              this.add(IS.class, false, 0, 3, new Object[]{ getMessage(), new Integer(458) }, "OCE Edit Code");
087                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Ambulatory Payment Classification Code");
088                                              this.add(IS.class, false, 0, 1, new Object[]{ getMessage(), new Integer(467) }, "Modifier Edit Code");
089                                              this.add(IS.class, false, 1, 1, new Object[]{ getMessage(), new Integer(468) }, "Payment Adjustment Code");
090                                              this.add(IS.class, false, 1, 1, new Object[]{ getMessage(), new Integer(469) }, "Packaging Status Code");
091                                  this.add(CP.class, false, 1, 12, new Object[]{ getMessage() }, "Expected CMS Payment Amount");
092                                              this.add(IS.class, false, 1, 2, new Object[]{ getMessage(), new Integer(470) }, "Reimbursement Type Code");
093                                  this.add(CP.class, false, 1, 12, new Object[]{ getMessage() }, "Co-Pay Amount");
094                                  this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Pay Rate per Service Unit");
095       } catch(HL7Exception e) {
096          log.error("Unexpected error creating GP2 - this is probably a bug in the source code generator.", e);
097       }
098    }
099
100
101
102    /**
103     * Returns
104     * GP2-1: "Revenue Code" - creates it if necessary
105     */
106    public IS getRevenueCode() { 
107                IS retVal = this.getTypedField(1, 0);
108                return retVal;
109    }
110    
111    /**
112     * Returns
113     * GP2-1: "Revenue Code" - creates it if necessary
114     */
115    public IS getGp21_RevenueCode() { 
116                IS retVal = this.getTypedField(1, 0);
117                return retVal;
118    }
119
120
121
122    /**
123     * Returns
124     * GP2-2: "Number of Service Units" - creates it if necessary
125     */
126    public NM getNumberOfServiceUnits() { 
127                NM retVal = this.getTypedField(2, 0);
128                return retVal;
129    }
130    
131    /**
132     * Returns
133     * GP2-2: "Number of Service Units" - creates it if necessary
134     */
135    public NM getGp22_NumberOfServiceUnits() { 
136                NM retVal = this.getTypedField(2, 0);
137                return retVal;
138    }
139
140
141
142    /**
143     * Returns
144     * GP2-3: "Charge" - creates it if necessary
145     */
146    public CP getCharge() { 
147                CP retVal = this.getTypedField(3, 0);
148                return retVal;
149    }
150    
151    /**
152     * Returns
153     * GP2-3: "Charge" - creates it if necessary
154     */
155    public CP getGp23_Charge() { 
156                CP retVal = this.getTypedField(3, 0);
157                return retVal;
158    }
159
160
161
162    /**
163     * Returns
164     * GP2-4: "Reimbursement Action Code" - creates it if necessary
165     */
166    public IS getReimbursementActionCode() { 
167                IS retVal = this.getTypedField(4, 0);
168                return retVal;
169    }
170    
171    /**
172     * Returns
173     * GP2-4: "Reimbursement Action Code" - creates it if necessary
174     */
175    public IS getGp24_ReimbursementActionCode() { 
176                IS retVal = this.getTypedField(4, 0);
177                return retVal;
178    }
179
180
181
182    /**
183     * Returns
184     * GP2-5: "Denial or Rejection Code" - creates it if necessary
185     */
186    public IS getDenialOrRejectionCode() { 
187                IS retVal = this.getTypedField(5, 0);
188                return retVal;
189    }
190    
191    /**
192     * Returns
193     * GP2-5: "Denial or Rejection Code" - creates it if necessary
194     */
195    public IS getGp25_DenialOrRejectionCode() { 
196                IS retVal = this.getTypedField(5, 0);
197                return retVal;
198    }
199
200
201    /**
202     * Returns all repetitions of OCE Edit Code (GP2-6).
203     */
204    public IS[] getOCEEditCode() {
205        IS[] retVal = this.getTypedField(6, new IS[0]);
206        return retVal;
207    }
208
209
210    /**
211     * Returns all repetitions of OCE Edit Code (GP2-6).
212     */
213    public IS[] getGp26_OCEEditCode() {
214        IS[] retVal = this.getTypedField(6, new IS[0]);
215        return retVal;
216    }
217
218
219    /**
220     * Returns a count of the current number of repetitions of OCE Edit Code (GP2-6).
221     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
222     * it will return zero.
223     */
224    public int getOCEEditCodeReps() {
225        return this.getReps(6);
226    }
227
228
229    /**
230     * Returns a specific repetition of
231     * GP2-6: "OCE Edit Code" - creates it if necessary
232     *
233     * @param rep The repetition index (0-indexed)
234     */
235    public IS getOCEEditCode(int rep) { 
236                IS retVal = this.getTypedField(6, rep);
237                return retVal;
238    }
239
240    /**
241     * Returns a specific repetition of
242     * GP2-6: "OCE Edit Code" - creates it if necessary
243     *
244     * @param rep The repetition index (0-indexed)
245     */
246    public IS getGp26_OCEEditCode(int rep) { 
247                IS retVal = this.getTypedField(6, rep);
248                return retVal;
249    }
250
251    /**
252     * Returns a count of the current number of repetitions of OCE Edit Code (GP2-6).
253     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
254     * it will return zero.
255     */
256    public int getGp26_OCEEditCodeReps() {
257        return this.getReps(6);
258    }
259
260
261    /**
262     * Inserts a repetition of
263     * GP2-6: "OCE Edit Code" at a specific index
264     *
265     * @param rep The repetition index (0-indexed)
266     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
267     */
268    public IS insertOCEEditCode(int rep) throws HL7Exception { 
269        return (IS) super.insertRepetition(6, rep);
270    }
271
272
273    /**
274     * Inserts a repetition of
275     * GP2-6: "OCE Edit Code" at a specific index
276     *
277     * @param rep The repetition index (0-indexed)
278     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
279     */
280    public IS insertGp26_OCEEditCode(int rep) throws HL7Exception { 
281        return (IS) super.insertRepetition(6, rep);
282    }
283
284
285    /**
286     * Removes a repetition of
287     * GP2-6: "OCE Edit Code" at a specific index
288     *
289     * @param rep The repetition index (0-indexed)
290     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
291     */
292    public IS removeOCEEditCode(int rep) throws HL7Exception { 
293        return (IS) super.removeRepetition(6, rep);
294    }
295
296
297    /**
298     * Removes a repetition of
299     * GP2-6: "OCE Edit Code" at a specific index
300     *
301     * @param rep The repetition index (0-indexed)
302     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
303     */
304    public IS removeGp26_OCEEditCode(int rep) throws HL7Exception { 
305        return (IS) super.removeRepetition(6, rep);
306    }
307
308
309
310
311    /**
312     * Returns
313     * GP2-7: "Ambulatory Payment Classification Code" - creates it if necessary
314     */
315    public CE getAmbulatoryPaymentClassificationCode() { 
316                CE retVal = this.getTypedField(7, 0);
317                return retVal;
318    }
319    
320    /**
321     * Returns
322     * GP2-7: "Ambulatory Payment Classification Code" - creates it if necessary
323     */
324    public CE getGp27_AmbulatoryPaymentClassificationCode() { 
325                CE retVal = this.getTypedField(7, 0);
326                return retVal;
327    }
328
329
330    /**
331     * Returns all repetitions of Modifier Edit Code (GP2-8).
332     */
333    public IS[] getModifierEditCode() {
334        IS[] retVal = this.getTypedField(8, new IS[0]);
335        return retVal;
336    }
337
338
339    /**
340     * Returns all repetitions of Modifier Edit Code (GP2-8).
341     */
342    public IS[] getGp28_ModifierEditCode() {
343        IS[] retVal = this.getTypedField(8, new IS[0]);
344        return retVal;
345    }
346
347
348    /**
349     * Returns a count of the current number of repetitions of Modifier Edit Code (GP2-8).
350     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
351     * it will return zero.
352     */
353    public int getModifierEditCodeReps() {
354        return this.getReps(8);
355    }
356
357
358    /**
359     * Returns a specific repetition of
360     * GP2-8: "Modifier Edit Code" - creates it if necessary
361     *
362     * @param rep The repetition index (0-indexed)
363     */
364    public IS getModifierEditCode(int rep) { 
365                IS retVal = this.getTypedField(8, rep);
366                return retVal;
367    }
368
369    /**
370     * Returns a specific repetition of
371     * GP2-8: "Modifier Edit Code" - creates it if necessary
372     *
373     * @param rep The repetition index (0-indexed)
374     */
375    public IS getGp28_ModifierEditCode(int rep) { 
376                IS retVal = this.getTypedField(8, rep);
377                return retVal;
378    }
379
380    /**
381     * Returns a count of the current number of repetitions of Modifier Edit Code (GP2-8).
382     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
383     * it will return zero.
384     */
385    public int getGp28_ModifierEditCodeReps() {
386        return this.getReps(8);
387    }
388
389
390    /**
391     * Inserts a repetition of
392     * GP2-8: "Modifier Edit Code" at a specific index
393     *
394     * @param rep The repetition index (0-indexed)
395     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
396     */
397    public IS insertModifierEditCode(int rep) throws HL7Exception { 
398        return (IS) super.insertRepetition(8, rep);
399    }
400
401
402    /**
403     * Inserts a repetition of
404     * GP2-8: "Modifier Edit Code" at a specific index
405     *
406     * @param rep The repetition index (0-indexed)
407     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
408     */
409    public IS insertGp28_ModifierEditCode(int rep) throws HL7Exception { 
410        return (IS) super.insertRepetition(8, rep);
411    }
412
413
414    /**
415     * Removes a repetition of
416     * GP2-8: "Modifier Edit Code" at a specific index
417     *
418     * @param rep The repetition index (0-indexed)
419     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
420     */
421    public IS removeModifierEditCode(int rep) throws HL7Exception { 
422        return (IS) super.removeRepetition(8, rep);
423    }
424
425
426    /**
427     * Removes a repetition of
428     * GP2-8: "Modifier Edit Code" at a specific index
429     *
430     * @param rep The repetition index (0-indexed)
431     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
432     */
433    public IS removeGp28_ModifierEditCode(int rep) throws HL7Exception { 
434        return (IS) super.removeRepetition(8, rep);
435    }
436
437
438
439
440    /**
441     * Returns
442     * GP2-9: "Payment Adjustment Code" - creates it if necessary
443     */
444    public IS getPaymentAdjustmentCode() { 
445                IS retVal = this.getTypedField(9, 0);
446                return retVal;
447    }
448    
449    /**
450     * Returns
451     * GP2-9: "Payment Adjustment Code" - creates it if necessary
452     */
453    public IS getGp29_PaymentAdjustmentCode() { 
454                IS retVal = this.getTypedField(9, 0);
455                return retVal;
456    }
457
458
459
460    /**
461     * Returns
462     * GP2-10: "Packaging Status Code" - creates it if necessary
463     */
464    public IS getPackagingStatusCode() { 
465                IS retVal = this.getTypedField(10, 0);
466                return retVal;
467    }
468    
469    /**
470     * Returns
471     * GP2-10: "Packaging Status Code" - creates it if necessary
472     */
473    public IS getGp210_PackagingStatusCode() { 
474                IS retVal = this.getTypedField(10, 0);
475                return retVal;
476    }
477
478
479
480    /**
481     * Returns
482     * GP2-11: "Expected CMS Payment Amount" - creates it if necessary
483     */
484    public CP getExpectedCMSPaymentAmount() { 
485                CP retVal = this.getTypedField(11, 0);
486                return retVal;
487    }
488    
489    /**
490     * Returns
491     * GP2-11: "Expected CMS Payment Amount" - creates it if necessary
492     */
493    public CP getGp211_ExpectedCMSPaymentAmount() { 
494                CP retVal = this.getTypedField(11, 0);
495                return retVal;
496    }
497
498
499
500    /**
501     * Returns
502     * GP2-12: "Reimbursement Type Code" - creates it if necessary
503     */
504    public IS getReimbursementTypeCode() { 
505                IS retVal = this.getTypedField(12, 0);
506                return retVal;
507    }
508    
509    /**
510     * Returns
511     * GP2-12: "Reimbursement Type Code" - creates it if necessary
512     */
513    public IS getGp212_ReimbursementTypeCode() { 
514                IS retVal = this.getTypedField(12, 0);
515                return retVal;
516    }
517
518
519
520    /**
521     * Returns
522     * GP2-13: "Co-Pay Amount" - creates it if necessary
523     */
524    public CP getCoPayAmount() { 
525                CP retVal = this.getTypedField(13, 0);
526                return retVal;
527    }
528    
529    /**
530     * Returns
531     * GP2-13: "Co-Pay Amount" - creates it if necessary
532     */
533    public CP getGp213_CoPayAmount() { 
534                CP retVal = this.getTypedField(13, 0);
535                return retVal;
536    }
537
538
539
540    /**
541     * Returns
542     * GP2-14: "Pay Rate per Service Unit" - creates it if necessary
543     */
544    public NM getPayRatePerServiceUnit() { 
545                NM retVal = this.getTypedField(14, 0);
546                return retVal;
547    }
548    
549    /**
550     * Returns
551     * GP2-14: "Pay Rate per Service Unit" - creates it if necessary
552     */
553    public NM getGp214_PayRatePerServiceUnit() { 
554                NM retVal = this.getTypedField(14, 0);
555                return retVal;
556    }
557
558
559
560
561
562    /** {@inheritDoc} */   
563    protected Type createNewTypeWithoutReflection(int field) {
564       switch (field) {
565          case 0: return new IS(getMessage(), new Integer( 456 ));
566          case 1: return new NM(getMessage());
567          case 2: return new CP(getMessage());
568          case 3: return new IS(getMessage(), new Integer( 459 ));
569          case 4: return new IS(getMessage(), new Integer( 460 ));
570          case 5: return new IS(getMessage(), new Integer( 458 ));
571          case 6: return new CE(getMessage());
572          case 7: return new IS(getMessage(), new Integer( 467 ));
573          case 8: return new IS(getMessage(), new Integer( 468 ));
574          case 9: return new IS(getMessage(), new Integer( 469 ));
575          case 10: return new CP(getMessage());
576          case 11: return new IS(getMessage(), new Integer( 470 ));
577          case 12: return new CP(getMessage());
578          case 13: return new NM(getMessage());
579          default: return null;
580       }
581   }
582
583
584}
585