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