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