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.v21.segment;
035
036// import ca.uhn.hl7v2.model.v21.group.*;
037import ca.uhn.hl7v2.model.v21.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 PR1 message segment (PROCEDURES). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>PR1-1: SET ID - PROCEDURE (SI) <b> repeating</b>
052     * <li>PR1-2: PROCEDURE CODING METHOD. (ID) <b> </b>
053     * <li>PR1-3: PROCEDURE CODE (ID) <b> </b>
054     * <li>PR1-4: PROCEDURE DESCRIPTION (ST) <b>optional </b>
055     * <li>PR1-5: PROCEDURE DATE/TIME (TS) <b> </b>
056     * <li>PR1-6: PROCEDURE TYPE (ID) <b> </b>
057     * <li>PR1-7: PROCEDURE MINUTES (NM) <b>optional </b>
058     * <li>PR1-8: ANESTHESIOLOGIST (CN) <b>optional </b>
059     * <li>PR1-9: ANESTHESIA CODE (ID) <b>optional </b>
060     * <li>PR1-10: ANESTHESIA MINUTES (NM) <b>optional </b>
061     * <li>PR1-11: SURGEON (CN) <b>optional </b>
062     * <li>PR1-12: RESIDENT CODE (CN) <b>optional </b>
063     * <li>PR1-13: CONSENT CODE (ID) <b>optional </b>
064 * </ul>
065 */
066@SuppressWarnings("unused")
067public class PR1 extends AbstractSegment {
068
069    /** 
070     * Creates a new PR1 segment
071     */
072    public PR1(Group parent, ModelClassFactory factory) {
073       super(parent, factory);
074       init(factory);
075    }
076
077    private void init(ModelClassFactory factory) {
078       try {
079                                  this.add(SI.class, true, 0, 4, new Object[]{ getMessage() }, "SET ID - PROCEDURE");
080                                              this.add(ID.class, true, 1, 2, new Object[]{ getMessage(), new Integer(89) }, "PROCEDURE CODING METHOD.");
081                                              this.add(ID.class, true, 1, 10, new Object[]{ getMessage(), new Integer(88) }, "PROCEDURE CODE");
082                                  this.add(ST.class, false, 1, 40, new Object[]{ getMessage() }, "PROCEDURE DESCRIPTION");
083                                  this.add(TS.class, true, 1, 19, new Object[]{ getMessage() }, "PROCEDURE DATE/TIME");
084                                              this.add(ID.class, true, 1, 2, new Object[]{ getMessage(), new Integer(90) }, "PROCEDURE TYPE");
085                                  this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "PROCEDURE MINUTES");
086                                  this.add(CN.class, false, 1, 60, new Object[]{ getMessage() }, "ANESTHESIOLOGIST");
087                                              this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(19) }, "ANESTHESIA CODE");
088                                  this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "ANESTHESIA MINUTES");
089                                  this.add(CN.class, false, 1, 60, new Object[]{ getMessage() }, "SURGEON");
090                                  this.add(CN.class, false, 1, 60, new Object[]{ getMessage() }, "RESIDENT CODE");
091                                              this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(59) }, "CONSENT CODE");
092       } catch(HL7Exception e) {
093          log.error("Unexpected error creating PR1 - this is probably a bug in the source code generator.", e);
094       }
095    }
096
097
098    /**
099     * Returns all repetitions of SET ID - PROCEDURE (PR1-1).
100     */
101    public SI[] getSETIDPROCEDURE() {
102        SI[] retVal = this.getTypedField(1, new SI[0]);
103        return retVal;
104    }
105
106
107    /**
108     * Returns all repetitions of SET ID - PROCEDURE (PR1-1).
109     */
110    public SI[] getPr11_SETIDPROCEDURE() {
111        SI[] retVal = this.getTypedField(1, new SI[0]);
112        return retVal;
113    }
114
115
116    /**
117     * Returns a count of the current number of repetitions of SET ID - PROCEDURE (PR1-1).
118     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
119     * it will return zero.
120     */
121    public int getSETIDPROCEDUREReps() {
122        return this.getReps(1);
123    }
124
125
126    /**
127     * Returns a specific repetition of
128     * PR1-1: "SET ID - PROCEDURE" - creates it if necessary
129     *
130     * @param rep The repetition index (0-indexed)
131     */
132    public SI getSETIDPROCEDURE(int rep) { 
133                SI retVal = this.getTypedField(1, rep);
134                return retVal;
135    }
136
137    /**
138     * Returns a specific repetition of
139     * PR1-1: "SET ID - PROCEDURE" - creates it if necessary
140     *
141     * @param rep The repetition index (0-indexed)
142     */
143    public SI getPr11_SETIDPROCEDURE(int rep) { 
144                SI retVal = this.getTypedField(1, rep);
145                return retVal;
146    }
147
148    /**
149     * Returns a count of the current number of repetitions of SET ID - PROCEDURE (PR1-1).
150     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
151     * it will return zero.
152     */
153    public int getPr11_SETIDPROCEDUREReps() {
154        return this.getReps(1);
155    }
156
157
158    /**
159     * Inserts a repetition of
160     * PR1-1: "SET ID - PROCEDURE" at a specific index
161     *
162     * @param rep The repetition index (0-indexed)
163     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
164     */
165    public SI insertSETIDPROCEDURE(int rep) throws HL7Exception { 
166        return (SI) super.insertRepetition(1, rep);
167    }
168
169
170    /**
171     * Inserts a repetition of
172     * PR1-1: "SET ID - PROCEDURE" at a specific index
173     *
174     * @param rep The repetition index (0-indexed)
175     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
176     */
177    public SI insertPr11_SETIDPROCEDURE(int rep) throws HL7Exception { 
178        return (SI) super.insertRepetition(1, rep);
179    }
180
181
182    /**
183     * Removes a repetition of
184     * PR1-1: "SET ID - PROCEDURE" at a specific index
185     *
186     * @param rep The repetition index (0-indexed)
187     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
188     */
189    public SI removeSETIDPROCEDURE(int rep) throws HL7Exception { 
190        return (SI) super.removeRepetition(1, rep);
191    }
192
193
194    /**
195     * Removes a repetition of
196     * PR1-1: "SET ID - PROCEDURE" at a specific index
197     *
198     * @param rep The repetition index (0-indexed)
199     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
200     */
201    public SI removePr11_SETIDPROCEDURE(int rep) throws HL7Exception { 
202        return (SI) super.removeRepetition(1, rep);
203    }
204
205
206
207
208    /**
209     * Returns
210     * PR1-2: "PROCEDURE CODING METHOD." - creates it if necessary
211     */
212    public ID getPROCEDURECODINGMETHOD() { 
213                ID retVal = this.getTypedField(2, 0);
214                return retVal;
215    }
216    
217    /**
218     * Returns
219     * PR1-2: "PROCEDURE CODING METHOD." - creates it if necessary
220     */
221    public ID getPr12_PROCEDURECODINGMETHOD() { 
222                ID retVal = this.getTypedField(2, 0);
223                return retVal;
224    }
225
226
227
228    /**
229     * Returns
230     * PR1-3: "PROCEDURE CODE" - creates it if necessary
231     */
232    public ID getPROCEDURECODE() { 
233                ID retVal = this.getTypedField(3, 0);
234                return retVal;
235    }
236    
237    /**
238     * Returns
239     * PR1-3: "PROCEDURE CODE" - creates it if necessary
240     */
241    public ID getPr13_PROCEDURECODE() { 
242                ID retVal = this.getTypedField(3, 0);
243                return retVal;
244    }
245
246
247
248    /**
249     * Returns
250     * PR1-4: "PROCEDURE DESCRIPTION" - creates it if necessary
251     */
252    public ST getPROCEDUREDESCRIPTION() { 
253                ST retVal = this.getTypedField(4, 0);
254                return retVal;
255    }
256    
257    /**
258     * Returns
259     * PR1-4: "PROCEDURE DESCRIPTION" - creates it if necessary
260     */
261    public ST getPr14_PROCEDUREDESCRIPTION() { 
262                ST retVal = this.getTypedField(4, 0);
263                return retVal;
264    }
265
266
267
268    /**
269     * Returns
270     * PR1-5: "PROCEDURE DATE/TIME" - creates it if necessary
271     */
272    public TS getPROCEDUREDATETIME() { 
273                TS retVal = this.getTypedField(5, 0);
274                return retVal;
275    }
276    
277    /**
278     * Returns
279     * PR1-5: "PROCEDURE DATE/TIME" - creates it if necessary
280     */
281    public TS getPr15_PROCEDUREDATETIME() { 
282                TS retVal = this.getTypedField(5, 0);
283                return retVal;
284    }
285
286
287
288    /**
289     * Returns
290     * PR1-6: "PROCEDURE TYPE" - creates it if necessary
291     */
292    public ID getPROCEDURETYPE() { 
293                ID retVal = this.getTypedField(6, 0);
294                return retVal;
295    }
296    
297    /**
298     * Returns
299     * PR1-6: "PROCEDURE TYPE" - creates it if necessary
300     */
301    public ID getPr16_PROCEDURETYPE() { 
302                ID retVal = this.getTypedField(6, 0);
303                return retVal;
304    }
305
306
307
308    /**
309     * Returns
310     * PR1-7: "PROCEDURE MINUTES" - creates it if necessary
311     */
312    public NM getPROCEDUREMINUTES() { 
313                NM retVal = this.getTypedField(7, 0);
314                return retVal;
315    }
316    
317    /**
318     * Returns
319     * PR1-7: "PROCEDURE MINUTES" - creates it if necessary
320     */
321    public NM getPr17_PROCEDUREMINUTES() { 
322                NM retVal = this.getTypedField(7, 0);
323                return retVal;
324    }
325
326
327
328    /**
329     * Returns
330     * PR1-8: "ANESTHESIOLOGIST" - creates it if necessary
331     */
332    public CN getANESTHESIOLOGIST() { 
333                CN retVal = this.getTypedField(8, 0);
334                return retVal;
335    }
336    
337    /**
338     * Returns
339     * PR1-8: "ANESTHESIOLOGIST" - creates it if necessary
340     */
341    public CN getPr18_ANESTHESIOLOGIST() { 
342                CN retVal = this.getTypedField(8, 0);
343                return retVal;
344    }
345
346
347
348    /**
349     * Returns
350     * PR1-9: "ANESTHESIA CODE" - creates it if necessary
351     */
352    public ID getANESTHESIACODE() { 
353                ID retVal = this.getTypedField(9, 0);
354                return retVal;
355    }
356    
357    /**
358     * Returns
359     * PR1-9: "ANESTHESIA CODE" - creates it if necessary
360     */
361    public ID getPr19_ANESTHESIACODE() { 
362                ID retVal = this.getTypedField(9, 0);
363                return retVal;
364    }
365
366
367
368    /**
369     * Returns
370     * PR1-10: "ANESTHESIA MINUTES" - creates it if necessary
371     */
372    public NM getANESTHESIAMINUTES() { 
373                NM retVal = this.getTypedField(10, 0);
374                return retVal;
375    }
376    
377    /**
378     * Returns
379     * PR1-10: "ANESTHESIA MINUTES" - creates it if necessary
380     */
381    public NM getPr110_ANESTHESIAMINUTES() { 
382                NM retVal = this.getTypedField(10, 0);
383                return retVal;
384    }
385
386
387
388    /**
389     * Returns
390     * PR1-11: "SURGEON" - creates it if necessary
391     */
392    public CN getSURGEON() { 
393                CN retVal = this.getTypedField(11, 0);
394                return retVal;
395    }
396    
397    /**
398     * Returns
399     * PR1-11: "SURGEON" - creates it if necessary
400     */
401    public CN getPr111_SURGEON() { 
402                CN retVal = this.getTypedField(11, 0);
403                return retVal;
404    }
405
406
407
408    /**
409     * Returns
410     * PR1-12: "RESIDENT CODE" - creates it if necessary
411     */
412    public CN getRESIDENTCODE() { 
413                CN retVal = this.getTypedField(12, 0);
414                return retVal;
415    }
416    
417    /**
418     * Returns
419     * PR1-12: "RESIDENT CODE" - creates it if necessary
420     */
421    public CN getPr112_RESIDENTCODE() { 
422                CN retVal = this.getTypedField(12, 0);
423                return retVal;
424    }
425
426
427
428    /**
429     * Returns
430     * PR1-13: "CONSENT CODE" - creates it if necessary
431     */
432    public ID getCONSENTCODE() { 
433                ID retVal = this.getTypedField(13, 0);
434                return retVal;
435    }
436    
437    /**
438     * Returns
439     * PR1-13: "CONSENT CODE" - creates it if necessary
440     */
441    public ID getPr113_CONSENTCODE() { 
442                ID retVal = this.getTypedField(13, 0);
443                return retVal;
444    }
445
446
447
448
449
450    /** {@inheritDoc} */   
451    protected Type createNewTypeWithoutReflection(int field) {
452       switch (field) {
453          case 0: return new SI(getMessage());
454          case 1: return new ID(getMessage(), new Integer( 89 ));
455          case 2: return new ID(getMessage(), new Integer( 88 ));
456          case 3: return new ST(getMessage());
457          case 4: return new TS(getMessage());
458          case 5: return new ID(getMessage(), new Integer( 90 ));
459          case 6: return new NM(getMessage());
460          case 7: return new CN(getMessage());
461          case 8: return new ID(getMessage(), new Integer( 19 ));
462          case 9: return new NM(getMessage());
463          case 10: return new CN(getMessage());
464          case 11: return new CN(getMessage());
465          case 12: return new ID(getMessage(), new Integer( 59 ));
466          default: return null;
467       }
468   }
469
470
471}
472