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.v27.segment;
035
036// import ca.uhn.hl7v2.model.v27.group.*;
037import ca.uhn.hl7v2.model.v27.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 GP1 message segment (Grouping/Reimbursement - Visit). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>GP1-1: Type of Bill Code (CWE) <b> </b>
053     * <li>GP1-2: Revenue Code (CWE) <b>optional repeating</b>
054     * <li>GP1-3: Overall Claim Disposition Code (CWE) <b>optional </b>
055     * <li>GP1-4: OCE Edits per Visit Code (CWE) <b>optional repeating</b>
056     * <li>GP1-5: Outlier Cost (CP) <b>optional </b>
057 * </ul>
058 */
059@SuppressWarnings("unused")
060public class GP1 extends AbstractSegment {
061
062    /** 
063     * Creates a new GP1 segment
064     */
065    public GP1(Group parent, ModelClassFactory factory) {
066       super(parent, factory);
067       init(factory);
068    }
069
070    private void init(ModelClassFactory factory) {
071       try {
072                                  this.add(CWE.class, true, 1, 0, new Object[]{ getMessage() }, "Type of Bill Code");
073                                  this.add(CWE.class, false, 0, 0, new Object[]{ getMessage() }, "Revenue Code");
074                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Overall Claim Disposition Code");
075                                  this.add(CWE.class, false, 0, 0, new Object[]{ getMessage() }, "OCE Edits per Visit Code");
076                                  this.add(CP.class, false, 1, 0, new Object[]{ getMessage() }, "Outlier Cost");
077       } catch(HL7Exception e) {
078          log.error("Unexpected error creating GP1 - this is probably a bug in the source code generator.", e);
079       }
080    }
081
082
083
084    /**
085     * Returns
086     * GP1-1: "Type of Bill Code" - creates it if necessary
087     */
088    public CWE getTypeOfBillCode() { 
089                CWE retVal = this.getTypedField(1, 0);
090                return retVal;
091    }
092    
093    /**
094     * Returns
095     * GP1-1: "Type of Bill Code" - creates it if necessary
096     */
097    public CWE getGp11_TypeOfBillCode() { 
098                CWE retVal = this.getTypedField(1, 0);
099                return retVal;
100    }
101
102
103    /**
104     * Returns all repetitions of Revenue Code (GP1-2).
105     */
106    public CWE[] getRevenueCode() {
107        CWE[] retVal = this.getTypedField(2, new CWE[0]);
108        return retVal;
109    }
110
111
112    /**
113     * Returns all repetitions of Revenue Code (GP1-2).
114     */
115    public CWE[] getGp12_RevenueCode() {
116        CWE[] retVal = this.getTypedField(2, new CWE[0]);
117        return retVal;
118    }
119
120
121    /**
122     * Returns a count of the current number of repetitions of Revenue Code (GP1-2).
123     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
124     * it will return zero.
125     */
126    public int getRevenueCodeReps() {
127        return this.getReps(2);
128    }
129
130
131    /**
132     * Returns a specific repetition of
133     * GP1-2: "Revenue Code" - creates it if necessary
134     *
135     * @param rep The repetition index (0-indexed)
136     */
137    public CWE getRevenueCode(int rep) { 
138                CWE retVal = this.getTypedField(2, rep);
139                return retVal;
140    }
141
142    /**
143     * Returns a specific repetition of
144     * GP1-2: "Revenue Code" - creates it if necessary
145     *
146     * @param rep The repetition index (0-indexed)
147     */
148    public CWE getGp12_RevenueCode(int rep) { 
149                CWE retVal = this.getTypedField(2, rep);
150                return retVal;
151    }
152
153    /**
154     * Returns a count of the current number of repetitions of Revenue Code (GP1-2).
155     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
156     * it will return zero.
157     */
158    public int getGp12_RevenueCodeReps() {
159        return this.getReps(2);
160    }
161
162
163    /**
164     * Inserts a repetition of
165     * GP1-2: "Revenue Code" at a specific index
166     *
167     * @param rep The repetition index (0-indexed)
168     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
169     */
170    public CWE insertRevenueCode(int rep) throws HL7Exception { 
171        return (CWE) super.insertRepetition(2, rep);
172    }
173
174
175    /**
176     * Inserts a repetition of
177     * GP1-2: "Revenue Code" at a specific index
178     *
179     * @param rep The repetition index (0-indexed)
180     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
181     */
182    public CWE insertGp12_RevenueCode(int rep) throws HL7Exception { 
183        return (CWE) super.insertRepetition(2, rep);
184    }
185
186
187    /**
188     * Removes a repetition of
189     * GP1-2: "Revenue Code" at a specific index
190     *
191     * @param rep The repetition index (0-indexed)
192     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
193     */
194    public CWE removeRevenueCode(int rep) throws HL7Exception { 
195        return (CWE) super.removeRepetition(2, rep);
196    }
197
198
199    /**
200     * Removes a repetition of
201     * GP1-2: "Revenue Code" at a specific index
202     *
203     * @param rep The repetition index (0-indexed)
204     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
205     */
206    public CWE removeGp12_RevenueCode(int rep) throws HL7Exception { 
207        return (CWE) super.removeRepetition(2, rep);
208    }
209
210
211
212
213    /**
214     * Returns
215     * GP1-3: "Overall Claim Disposition Code" - creates it if necessary
216     */
217    public CWE getOverallClaimDispositionCode() { 
218                CWE retVal = this.getTypedField(3, 0);
219                return retVal;
220    }
221    
222    /**
223     * Returns
224     * GP1-3: "Overall Claim Disposition Code" - creates it if necessary
225     */
226    public CWE getGp13_OverallClaimDispositionCode() { 
227                CWE retVal = this.getTypedField(3, 0);
228                return retVal;
229    }
230
231
232    /**
233     * Returns all repetitions of OCE Edits per Visit Code (GP1-4).
234     */
235    public CWE[] getOCEEditsPerVisitCode() {
236        CWE[] retVal = this.getTypedField(4, new CWE[0]);
237        return retVal;
238    }
239
240
241    /**
242     * Returns all repetitions of OCE Edits per Visit Code (GP1-4).
243     */
244    public CWE[] getGp14_OCEEditsPerVisitCode() {
245        CWE[] retVal = this.getTypedField(4, new CWE[0]);
246        return retVal;
247    }
248
249
250    /**
251     * Returns a count of the current number of repetitions of OCE Edits per Visit Code (GP1-4).
252     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
253     * it will return zero.
254     */
255    public int getOCEEditsPerVisitCodeReps() {
256        return this.getReps(4);
257    }
258
259
260    /**
261     * Returns a specific repetition of
262     * GP1-4: "OCE Edits per Visit Code" - creates it if necessary
263     *
264     * @param rep The repetition index (0-indexed)
265     */
266    public CWE getOCEEditsPerVisitCode(int rep) { 
267                CWE retVal = this.getTypedField(4, rep);
268                return retVal;
269    }
270
271    /**
272     * Returns a specific repetition of
273     * GP1-4: "OCE Edits per Visit Code" - creates it if necessary
274     *
275     * @param rep The repetition index (0-indexed)
276     */
277    public CWE getGp14_OCEEditsPerVisitCode(int rep) { 
278                CWE retVal = this.getTypedField(4, rep);
279                return retVal;
280    }
281
282    /**
283     * Returns a count of the current number of repetitions of OCE Edits per Visit Code (GP1-4).
284     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
285     * it will return zero.
286     */
287    public int getGp14_OCEEditsPerVisitCodeReps() {
288        return this.getReps(4);
289    }
290
291
292    /**
293     * Inserts a repetition of
294     * GP1-4: "OCE Edits per Visit Code" at a specific index
295     *
296     * @param rep The repetition index (0-indexed)
297     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
298     */
299    public CWE insertOCEEditsPerVisitCode(int rep) throws HL7Exception { 
300        return (CWE) super.insertRepetition(4, rep);
301    }
302
303
304    /**
305     * Inserts a repetition of
306     * GP1-4: "OCE Edits per Visit Code" at a specific index
307     *
308     * @param rep The repetition index (0-indexed)
309     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
310     */
311    public CWE insertGp14_OCEEditsPerVisitCode(int rep) throws HL7Exception { 
312        return (CWE) super.insertRepetition(4, rep);
313    }
314
315
316    /**
317     * Removes a repetition of
318     * GP1-4: "OCE Edits per Visit Code" at a specific index
319     *
320     * @param rep The repetition index (0-indexed)
321     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
322     */
323    public CWE removeOCEEditsPerVisitCode(int rep) throws HL7Exception { 
324        return (CWE) super.removeRepetition(4, rep);
325    }
326
327
328    /**
329     * Removes a repetition of
330     * GP1-4: "OCE Edits per Visit Code" at a specific index
331     *
332     * @param rep The repetition index (0-indexed)
333     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
334     */
335    public CWE removeGp14_OCEEditsPerVisitCode(int rep) throws HL7Exception { 
336        return (CWE) super.removeRepetition(4, rep);
337    }
338
339
340
341
342    /**
343     * Returns
344     * GP1-5: "Outlier Cost" - creates it if necessary
345     */
346    public CP getOutlierCost() { 
347                CP retVal = this.getTypedField(5, 0);
348                return retVal;
349    }
350    
351    /**
352     * Returns
353     * GP1-5: "Outlier Cost" - creates it if necessary
354     */
355    public CP getGp15_OutlierCost() { 
356                CP retVal = this.getTypedField(5, 0);
357                return retVal;
358    }
359
360
361
362
363
364    /** {@inheritDoc} */   
365    protected Type createNewTypeWithoutReflection(int field) {
366       switch (field) {
367          case 0: return new CWE(getMessage());
368          case 1: return new CWE(getMessage());
369          case 2: return new CWE(getMessage());
370          case 3: return new CWE(getMessage());
371          case 4: return new CP(getMessage());
372          default: return null;
373       }
374   }
375
376
377}
378