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.v23.segment;
035
036// import ca.uhn.hl7v2.model.v23.group.*;
037import ca.uhn.hl7v2.model.v23.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 CSR message segment (Clinical Study Registration). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>CSR-1: Sponsor Study ID (EI) <b> </b>
052     * <li>CSR-2: Alternate Study ID (EI) <b>optional </b>
053     * <li>CSR-3: Institution Registering the Patient (CE) <b>optional </b>
054     * <li>CSR-4: Sponsor Patient ID (CX) <b> </b>
055     * <li>CSR-5: Alternate Patient ID (CX) <b>optional </b>
056     * <li>CSR-6: Date/Time of Patient Study Registration (TS) <b>optional </b>
057     * <li>CSR-7: Person Performing Study Registration (XCN) <b>optional </b>
058     * <li>CSR-8: Study Authorizing Provider (XCN) <b> </b>
059     * <li>CSR-9: Date/time Patient Study Consent Signed (TS) <b>optional </b>
060     * <li>CSR-10: Patient Study Eligibility Status (CE) <b>optional </b>
061     * <li>CSR-11: Study Randomization Date/time (TS) <b>optional repeating</b>
062     * <li>CSR-12: Study Randomized Arm (CE) <b>optional repeating</b>
063     * <li>CSR-13: Stratum for Study Randomization (CE) <b>optional repeating</b>
064     * <li>CSR-14: Patient Evaluability Status (CE) <b>optional </b>
065     * <li>CSR-15: Date/time Ended Study (TS) <b>optional </b>
066     * <li>CSR-16: Reason Ended Study (CE) <b>optional </b>
067 * </ul>
068 */
069@SuppressWarnings("unused")
070public class CSR extends AbstractSegment {
071
072    /** 
073     * Creates a new CSR segment
074     */
075    public CSR(Group parent, ModelClassFactory factory) {
076       super(parent, factory);
077       init(factory);
078    }
079
080    private void init(ModelClassFactory factory) {
081       try {
082                                  this.add(EI.class, true, 1, 60, new Object[]{ getMessage() }, "Sponsor Study ID");
083                                  this.add(EI.class, false, 1, 60, new Object[]{ getMessage() }, "Alternate Study ID");
084                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Institution Registering the Patient");
085                                  this.add(CX.class, true, 1, 30, new Object[]{ getMessage() }, "Sponsor Patient ID");
086                                  this.add(CX.class, false, 1, 30, new Object[]{ getMessage() }, "Alternate Patient ID");
087                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date/Time of Patient Study Registration");
088                                  this.add(XCN.class, false, 1, 60, new Object[]{ getMessage() }, "Person Performing Study Registration");
089                                  this.add(XCN.class, true, 1, 60, new Object[]{ getMessage() }, "Study Authorizing Provider");
090                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date/time Patient Study Consent Signed");
091                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Patient Study Eligibility Status");
092                                  this.add(TS.class, false, 3, 26, new Object[]{ getMessage() }, "Study Randomization Date/time");
093                                  this.add(CE.class, false, 3, 200, new Object[]{ getMessage() }, "Study Randomized Arm");
094                                  this.add(CE.class, false, 3, 200, new Object[]{ getMessage() }, "Stratum for Study Randomization");
095                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Patient Evaluability Status");
096                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date/time Ended Study");
097                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Reason Ended Study");
098       } catch(HL7Exception e) {
099          log.error("Unexpected error creating CSR - this is probably a bug in the source code generator.", e);
100       }
101    }
102
103
104
105    /**
106     * Returns
107     * CSR-1: "Sponsor Study ID" - creates it if necessary
108     */
109    public EI getSponsorStudyID() { 
110                EI retVal = this.getTypedField(1, 0);
111                return retVal;
112    }
113    
114    /**
115     * Returns
116     * CSR-1: "Sponsor Study ID" - creates it if necessary
117     */
118    public EI getCsr1_SponsorStudyID() { 
119                EI retVal = this.getTypedField(1, 0);
120                return retVal;
121    }
122
123
124
125    /**
126     * Returns
127     * CSR-2: "Alternate Study ID" - creates it if necessary
128     */
129    public EI getAlternateStudyID() { 
130                EI retVal = this.getTypedField(2, 0);
131                return retVal;
132    }
133    
134    /**
135     * Returns
136     * CSR-2: "Alternate Study ID" - creates it if necessary
137     */
138    public EI getCsr2_AlternateStudyID() { 
139                EI retVal = this.getTypedField(2, 0);
140                return retVal;
141    }
142
143
144
145    /**
146     * Returns
147     * CSR-3: "Institution Registering the Patient" - creates it if necessary
148     */
149    public CE getInstitutionRegisteringThePatient() { 
150                CE retVal = this.getTypedField(3, 0);
151                return retVal;
152    }
153    
154    /**
155     * Returns
156     * CSR-3: "Institution Registering the Patient" - creates it if necessary
157     */
158    public CE getCsr3_InstitutionRegisteringThePatient() { 
159                CE retVal = this.getTypedField(3, 0);
160                return retVal;
161    }
162
163
164
165    /**
166     * Returns
167     * CSR-4: "Sponsor Patient ID" - creates it if necessary
168     */
169    public CX getSponsorPatientID() { 
170                CX retVal = this.getTypedField(4, 0);
171                return retVal;
172    }
173    
174    /**
175     * Returns
176     * CSR-4: "Sponsor Patient ID" - creates it if necessary
177     */
178    public CX getCsr4_SponsorPatientID() { 
179                CX retVal = this.getTypedField(4, 0);
180                return retVal;
181    }
182
183
184
185    /**
186     * Returns
187     * CSR-5: "Alternate Patient ID" - creates it if necessary
188     */
189    public CX getAlternatePatientID() { 
190                CX retVal = this.getTypedField(5, 0);
191                return retVal;
192    }
193    
194    /**
195     * Returns
196     * CSR-5: "Alternate Patient ID" - creates it if necessary
197     */
198    public CX getCsr5_AlternatePatientID() { 
199                CX retVal = this.getTypedField(5, 0);
200                return retVal;
201    }
202
203
204
205    /**
206     * Returns
207     * CSR-6: "Date/Time of Patient Study Registration" - creates it if necessary
208     */
209    public TS getDateTimeOfPatientStudyRegistration() { 
210                TS retVal = this.getTypedField(6, 0);
211                return retVal;
212    }
213    
214    /**
215     * Returns
216     * CSR-6: "Date/Time of Patient Study Registration" - creates it if necessary
217     */
218    public TS getCsr6_DateTimeOfPatientStudyRegistration() { 
219                TS retVal = this.getTypedField(6, 0);
220                return retVal;
221    }
222
223
224
225    /**
226     * Returns
227     * CSR-7: "Person Performing Study Registration" - creates it if necessary
228     */
229    public XCN getPersonPerformingStudyRegistration() { 
230                XCN retVal = this.getTypedField(7, 0);
231                return retVal;
232    }
233    
234    /**
235     * Returns
236     * CSR-7: "Person Performing Study Registration" - creates it if necessary
237     */
238    public XCN getCsr7_PersonPerformingStudyRegistration() { 
239                XCN retVal = this.getTypedField(7, 0);
240                return retVal;
241    }
242
243
244
245    /**
246     * Returns
247     * CSR-8: "Study Authorizing Provider" - creates it if necessary
248     */
249    public XCN getStudyAuthorizingProvider() { 
250                XCN retVal = this.getTypedField(8, 0);
251                return retVal;
252    }
253    
254    /**
255     * Returns
256     * CSR-8: "Study Authorizing Provider" - creates it if necessary
257     */
258    public XCN getCsr8_StudyAuthorizingProvider() { 
259                XCN retVal = this.getTypedField(8, 0);
260                return retVal;
261    }
262
263
264
265    /**
266     * Returns
267     * CSR-9: "Date/time Patient Study Consent Signed" - creates it if necessary
268     */
269    public TS getDateTimePatientStudyConsentSigned() { 
270                TS retVal = this.getTypedField(9, 0);
271                return retVal;
272    }
273    
274    /**
275     * Returns
276     * CSR-9: "Date/time Patient Study Consent Signed" - creates it if necessary
277     */
278    public TS getCsr9_DateTimePatientStudyConsentSigned() { 
279                TS retVal = this.getTypedField(9, 0);
280                return retVal;
281    }
282
283
284
285    /**
286     * Returns
287     * CSR-10: "Patient Study Eligibility Status" - creates it if necessary
288     */
289    public CE getPatientStudyEligibilityStatus() { 
290                CE retVal = this.getTypedField(10, 0);
291                return retVal;
292    }
293    
294    /**
295     * Returns
296     * CSR-10: "Patient Study Eligibility Status" - creates it if necessary
297     */
298    public CE getCsr10_PatientStudyEligibilityStatus() { 
299                CE retVal = this.getTypedField(10, 0);
300                return retVal;
301    }
302
303
304    /**
305     * Returns all repetitions of Study Randomization Date/time (CSR-11).
306     */
307    public TS[] getStudyRandomizationDateTime() {
308        TS[] retVal = this.getTypedField(11, new TS[0]);
309        return retVal;
310    }
311
312
313    /**
314     * Returns all repetitions of Study Randomization Date/time (CSR-11).
315     */
316    public TS[] getCsr11_StudyRandomizationDateTime() {
317        TS[] retVal = this.getTypedField(11, new TS[0]);
318        return retVal;
319    }
320
321
322    /**
323     * Returns a count of the current number of repetitions of Study Randomization Date/time (CSR-11).
324     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
325     * it will return zero.
326     */
327    public int getStudyRandomizationDateTimeReps() {
328        return this.getReps(11);
329    }
330
331
332    /**
333     * Returns a specific repetition of
334     * CSR-11: "Study Randomization Date/time" - creates it if necessary
335     *
336     * @param rep The repetition index (0-indexed)
337     */
338    public TS getStudyRandomizationDateTime(int rep) { 
339                TS retVal = this.getTypedField(11, rep);
340                return retVal;
341    }
342
343    /**
344     * Returns a specific repetition of
345     * CSR-11: "Study Randomization Date/time" - creates it if necessary
346     *
347     * @param rep The repetition index (0-indexed)
348     */
349    public TS getCsr11_StudyRandomizationDateTime(int rep) { 
350                TS retVal = this.getTypedField(11, rep);
351                return retVal;
352    }
353
354    /**
355     * Returns a count of the current number of repetitions of Study Randomization Date/time (CSR-11).
356     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
357     * it will return zero.
358     */
359    public int getCsr11_StudyRandomizationDateTimeReps() {
360        return this.getReps(11);
361    }
362
363
364    /**
365     * Inserts a repetition of
366     * CSR-11: "Study Randomization Date/time" at a specific index
367     *
368     * @param rep The repetition index (0-indexed)
369     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
370     */
371    public TS insertStudyRandomizationDateTime(int rep) throws HL7Exception { 
372        return (TS) super.insertRepetition(11, rep);
373    }
374
375
376    /**
377     * Inserts a repetition of
378     * CSR-11: "Study Randomization Date/time" at a specific index
379     *
380     * @param rep The repetition index (0-indexed)
381     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
382     */
383    public TS insertCsr11_StudyRandomizationDateTime(int rep) throws HL7Exception { 
384        return (TS) super.insertRepetition(11, rep);
385    }
386
387
388    /**
389     * Removes a repetition of
390     * CSR-11: "Study Randomization Date/time" at a specific index
391     *
392     * @param rep The repetition index (0-indexed)
393     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
394     */
395    public TS removeStudyRandomizationDateTime(int rep) throws HL7Exception { 
396        return (TS) super.removeRepetition(11, rep);
397    }
398
399
400    /**
401     * Removes a repetition of
402     * CSR-11: "Study Randomization Date/time" at a specific index
403     *
404     * @param rep The repetition index (0-indexed)
405     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
406     */
407    public TS removeCsr11_StudyRandomizationDateTime(int rep) throws HL7Exception { 
408        return (TS) super.removeRepetition(11, rep);
409    }
410
411
412
413    /**
414     * Returns all repetitions of Study Randomized Arm (CSR-12).
415     */
416    public CE[] getStudyRandomizedArm() {
417        CE[] retVal = this.getTypedField(12, new CE[0]);
418        return retVal;
419    }
420
421
422    /**
423     * Returns all repetitions of Study Randomized Arm (CSR-12).
424     */
425    public CE[] getCsr12_StudyRandomizedArm() {
426        CE[] retVal = this.getTypedField(12, new CE[0]);
427        return retVal;
428    }
429
430
431    /**
432     * Returns a count of the current number of repetitions of Study Randomized Arm (CSR-12).
433     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
434     * it will return zero.
435     */
436    public int getStudyRandomizedArmReps() {
437        return this.getReps(12);
438    }
439
440
441    /**
442     * Returns a specific repetition of
443     * CSR-12: "Study Randomized Arm" - creates it if necessary
444     *
445     * @param rep The repetition index (0-indexed)
446     */
447    public CE getStudyRandomizedArm(int rep) { 
448                CE retVal = this.getTypedField(12, rep);
449                return retVal;
450    }
451
452    /**
453     * Returns a specific repetition of
454     * CSR-12: "Study Randomized Arm" - creates it if necessary
455     *
456     * @param rep The repetition index (0-indexed)
457     */
458    public CE getCsr12_StudyRandomizedArm(int rep) { 
459                CE retVal = this.getTypedField(12, rep);
460                return retVal;
461    }
462
463    /**
464     * Returns a count of the current number of repetitions of Study Randomized Arm (CSR-12).
465     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
466     * it will return zero.
467     */
468    public int getCsr12_StudyRandomizedArmReps() {
469        return this.getReps(12);
470    }
471
472
473    /**
474     * Inserts a repetition of
475     * CSR-12: "Study Randomized Arm" at a specific index
476     *
477     * @param rep The repetition index (0-indexed)
478     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
479     */
480    public CE insertStudyRandomizedArm(int rep) throws HL7Exception { 
481        return (CE) super.insertRepetition(12, rep);
482    }
483
484
485    /**
486     * Inserts a repetition of
487     * CSR-12: "Study Randomized Arm" at a specific index
488     *
489     * @param rep The repetition index (0-indexed)
490     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
491     */
492    public CE insertCsr12_StudyRandomizedArm(int rep) throws HL7Exception { 
493        return (CE) super.insertRepetition(12, rep);
494    }
495
496
497    /**
498     * Removes a repetition of
499     * CSR-12: "Study Randomized Arm" at a specific index
500     *
501     * @param rep The repetition index (0-indexed)
502     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
503     */
504    public CE removeStudyRandomizedArm(int rep) throws HL7Exception { 
505        return (CE) super.removeRepetition(12, rep);
506    }
507
508
509    /**
510     * Removes a repetition of
511     * CSR-12: "Study Randomized Arm" at a specific index
512     *
513     * @param rep The repetition index (0-indexed)
514     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
515     */
516    public CE removeCsr12_StudyRandomizedArm(int rep) throws HL7Exception { 
517        return (CE) super.removeRepetition(12, rep);
518    }
519
520
521
522    /**
523     * Returns all repetitions of Stratum for Study Randomization (CSR-13).
524     */
525    public CE[] getStratumForStudyRandomization() {
526        CE[] retVal = this.getTypedField(13, new CE[0]);
527        return retVal;
528    }
529
530
531    /**
532     * Returns all repetitions of Stratum for Study Randomization (CSR-13).
533     */
534    public CE[] getCsr13_StratumForStudyRandomization() {
535        CE[] retVal = this.getTypedField(13, new CE[0]);
536        return retVal;
537    }
538
539
540    /**
541     * Returns a count of the current number of repetitions of Stratum for Study Randomization (CSR-13).
542     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
543     * it will return zero.
544     */
545    public int getStratumForStudyRandomizationReps() {
546        return this.getReps(13);
547    }
548
549
550    /**
551     * Returns a specific repetition of
552     * CSR-13: "Stratum for Study Randomization" - creates it if necessary
553     *
554     * @param rep The repetition index (0-indexed)
555     */
556    public CE getStratumForStudyRandomization(int rep) { 
557                CE retVal = this.getTypedField(13, rep);
558                return retVal;
559    }
560
561    /**
562     * Returns a specific repetition of
563     * CSR-13: "Stratum for Study Randomization" - creates it if necessary
564     *
565     * @param rep The repetition index (0-indexed)
566     */
567    public CE getCsr13_StratumForStudyRandomization(int rep) { 
568                CE retVal = this.getTypedField(13, rep);
569                return retVal;
570    }
571
572    /**
573     * Returns a count of the current number of repetitions of Stratum for Study Randomization (CSR-13).
574     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
575     * it will return zero.
576     */
577    public int getCsr13_StratumForStudyRandomizationReps() {
578        return this.getReps(13);
579    }
580
581
582    /**
583     * Inserts a repetition of
584     * CSR-13: "Stratum for Study Randomization" at a specific index
585     *
586     * @param rep The repetition index (0-indexed)
587     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
588     */
589    public CE insertStratumForStudyRandomization(int rep) throws HL7Exception { 
590        return (CE) super.insertRepetition(13, rep);
591    }
592
593
594    /**
595     * Inserts a repetition of
596     * CSR-13: "Stratum for Study Randomization" at a specific index
597     *
598     * @param rep The repetition index (0-indexed)
599     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
600     */
601    public CE insertCsr13_StratumForStudyRandomization(int rep) throws HL7Exception { 
602        return (CE) super.insertRepetition(13, rep);
603    }
604
605
606    /**
607     * Removes a repetition of
608     * CSR-13: "Stratum for Study Randomization" at a specific index
609     *
610     * @param rep The repetition index (0-indexed)
611     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
612     */
613    public CE removeStratumForStudyRandomization(int rep) throws HL7Exception { 
614        return (CE) super.removeRepetition(13, rep);
615    }
616
617
618    /**
619     * Removes a repetition of
620     * CSR-13: "Stratum for Study Randomization" at a specific index
621     *
622     * @param rep The repetition index (0-indexed)
623     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
624     */
625    public CE removeCsr13_StratumForStudyRandomization(int rep) throws HL7Exception { 
626        return (CE) super.removeRepetition(13, rep);
627    }
628
629
630
631
632    /**
633     * Returns
634     * CSR-14: "Patient Evaluability Status" - creates it if necessary
635     */
636    public CE getPatientEvaluabilityStatus() { 
637                CE retVal = this.getTypedField(14, 0);
638                return retVal;
639    }
640    
641    /**
642     * Returns
643     * CSR-14: "Patient Evaluability Status" - creates it if necessary
644     */
645    public CE getCsr14_PatientEvaluabilityStatus() { 
646                CE retVal = this.getTypedField(14, 0);
647                return retVal;
648    }
649
650
651
652    /**
653     * Returns
654     * CSR-15: "Date/time Ended Study" - creates it if necessary
655     */
656    public TS getDateTimeEndedStudy() { 
657                TS retVal = this.getTypedField(15, 0);
658                return retVal;
659    }
660    
661    /**
662     * Returns
663     * CSR-15: "Date/time Ended Study" - creates it if necessary
664     */
665    public TS getCsr15_DateTimeEndedStudy() { 
666                TS retVal = this.getTypedField(15, 0);
667                return retVal;
668    }
669
670
671
672    /**
673     * Returns
674     * CSR-16: "Reason Ended Study" - creates it if necessary
675     */
676    public CE getReasonEndedStudy() { 
677                CE retVal = this.getTypedField(16, 0);
678                return retVal;
679    }
680    
681    /**
682     * Returns
683     * CSR-16: "Reason Ended Study" - creates it if necessary
684     */
685    public CE getCsr16_ReasonEndedStudy() { 
686                CE retVal = this.getTypedField(16, 0);
687                return retVal;
688    }
689
690
691
692
693
694    /** {@inheritDoc} */   
695    protected Type createNewTypeWithoutReflection(int field) {
696       switch (field) {
697          case 0: return new EI(getMessage());
698          case 1: return new EI(getMessage());
699          case 2: return new CE(getMessage());
700          case 3: return new CX(getMessage());
701          case 4: return new CX(getMessage());
702          case 5: return new TS(getMessage());
703          case 6: return new XCN(getMessage());
704          case 7: return new XCN(getMessage());
705          case 8: return new TS(getMessage());
706          case 9: return new CE(getMessage());
707          case 10: return new TS(getMessage());
708          case 11: return new CE(getMessage());
709          case 12: return new CE(getMessage());
710          case 13: return new CE(getMessage());
711          case 14: return new TS(getMessage());
712          case 15: return new CE(getMessage());
713          default: return null;
714       }
715   }
716
717
718}
719