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
008 package ca.uhn.hl7v2.model.v24.message;
009
010 import ca.uhn.hl7v2.model.v24.group.*;
011 import ca.uhn.hl7v2.model.v24.segment.*;
012
013 import ca.uhn.log.HapiLogFactory;
014 import ca.uhn.hl7v2.HL7Exception;
015 import ca.uhn.hl7v2.parser.ModelClassFactory;
016 import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
017 import ca.uhn.hl7v2.model.AbstractMessage;
018
019 /**
020 * <p>Represents a ADT_A03 message structure (see chapter 3). This structure contains the
021 * following elements: </p>
022 * <ul>
023 * <li>1: MSH (Message Header) <b> </b></li>
024 * <li>2: EVN (Event Type) <b> </b></li>
025 * <li>3: PID (Patient identification) <b> </b></li>
026 * <li>4: PD1 (patient additional demographic) <b>optional </b></li>
027 * <li>5: ROL (Role) <b>optional repeating</b></li>
028 * <li>6: PV1 (Patient visit) <b> </b></li>
029 * <li>7: PV2 (Patient visit - additional information) <b>optional </b></li>
030 * <li>8: ROL (Role) <b>optional repeating</b></li>
031 * <li>9: DB1 (Disability) <b>optional repeating</b></li>
032 * <li>10: DG1 (Diagnosis) <b>optional repeating</b></li>
033 * <li>11: DRG (Diagnosis Related Group) <b>optional </b></li>
034 * <li>12: ADT_A03_PROCEDURE (a Group object) <b>optional repeating</b></li>
035 * <li>13: OBX (Observation/Result) <b>optional repeating</b></li>
036 * <li>14: PDA (Patient death and autopsy) <b>optional </b></li>
037 * </ul>
038 */
039 public class ADT_A03 extends AbstractMessage {
040
041 /**
042 * Creates a new ADT_A03 message with DefaultModelClassFactory.
043 */
044 public ADT_A03() {
045 this(new DefaultModelClassFactory());
046 }
047
048 /**
049 * Creates a new ADT_A03 message with custom ModelClassFactory.
050 */
051 public ADT_A03(ModelClassFactory factory) {
052 super(factory);
053 init(factory);
054 }
055
056 private void init(ModelClassFactory factory) {
057 try {
058 this.add(MSH.class, true, false);
059 this.add(EVN.class, true, false);
060 this.add(PID.class, true, false);
061 this.add(PD1.class, false, false);
062 this.add(ROL.class, false, true);
063 this.add(PV1.class, true, false);
064 this.add(PV2.class, false, false);
065 this.add(ROL.class, false, true);
066 this.add(DB1.class, false, true);
067 this.add(DG1.class, false, true);
068 this.add(DRG.class, false, false);
069 this.add(ADT_A03_PROCEDURE.class, false, true);
070 this.add(OBX.class, false, true);
071 this.add(PDA.class, false, false);
072 } catch(HL7Exception e) {
073 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating ADT_A03 - this is probably a bug in the source code generator.", e);
074 }
075 }
076
077 /**
078 * Returns "2.4"
079 */
080 public String getVersion() {
081 return "2.4";
082 }
083
084
085
086 /**
087 * Returns
088 * MSH (Message Header) - creates it if necessary
089 */
090 public MSH getMSH() {
091 MSH ret = null;
092 try {
093 ret = (MSH)this.get("MSH");
094 } catch(HL7Exception e) {
095 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
096 throw new RuntimeException(e);
097 }
098 return ret;
099 }
100
101
102
103
104 /**
105 * Returns
106 * EVN (Event Type) - creates it if necessary
107 */
108 public EVN getEVN() {
109 EVN ret = null;
110 try {
111 ret = (EVN)this.get("EVN");
112 } catch(HL7Exception e) {
113 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
114 throw new RuntimeException(e);
115 }
116 return ret;
117 }
118
119
120
121
122 /**
123 * Returns
124 * PID (Patient identification) - creates it if necessary
125 */
126 public PID getPID() {
127 PID ret = null;
128 try {
129 ret = (PID)this.get("PID");
130 } catch(HL7Exception e) {
131 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
132 throw new RuntimeException(e);
133 }
134 return ret;
135 }
136
137
138
139
140 /**
141 * Returns
142 * PD1 (patient additional demographic) - creates it if necessary
143 */
144 public PD1 getPD1() {
145 PD1 ret = null;
146 try {
147 ret = (PD1)this.get("PD1");
148 } catch(HL7Exception e) {
149 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
150 throw new RuntimeException(e);
151 }
152 return ret;
153 }
154
155
156
157
158 /**
159 * Returns
160 * the first repetition of
161 * ROL (Role) - creates it if necessary
162 */
163 public ROL getROL() {
164 ROL ret = null;
165 try {
166 ret = (ROL)this.get("ROL");
167 } catch(HL7Exception e) {
168 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
169 throw new RuntimeException(e);
170 }
171 return ret;
172 }
173
174
175 /**
176 * Returns a specific repetition of
177 * ROL (Role) - creates it if necessary
178 *
179 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
180 * @throws HL7Exception if the repetition requested is more than one
181 * greater than the number of existing repetitions.
182 */
183 public ROL getROL(int rep) {
184 ROL ret = null;
185 try {
186 ret = (ROL)this.get("ROL", rep);
187 } catch(HL7Exception e) {
188 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
189 throw new RuntimeException(e);
190 }
191 return ret;
192 }
193
194 /**
195 * Returns the number of existing repetitions of ROL
196 */
197 public int getROLReps() {
198 int reps = -1;
199 try {
200 reps = this.getAll("ROL").length;
201 } catch (HL7Exception e) {
202 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
203 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
204 throw new RuntimeException(message);
205 }
206 return reps;
207 }
208
209 /**
210 * Inserts a specific repetition of ROL (Role)
211 * @see AbstractGroup\#insertRepetition(Structure, int)
212 */
213 public void insertROL(ROL structure, int rep) throws HL7Exception {
214 super.insertRepetition( "ROL", structure, rep);
215 }
216
217
218 /**
219 * Inserts a specific repetition of ROL (Role)
220 * @see AbstractGroup\#insertRepetition(Structure, int)
221 */
222 public ROL insertROL(int rep) throws HL7Exception {
223 return (ROL)super.insertRepetition("ROL", rep);
224 }
225
226
227 /**
228 * Removes a specific repetition of ROL (Role)
229 * @see AbstractGroup\#removeRepetition(String, int)
230 */
231 public ROL removeROL(int rep) throws HL7Exception {
232 return (ROL)super.removeRepetition("ROL", rep);
233 }
234
235
236
237 /**
238 * Returns
239 * PV1 (Patient visit) - creates it if necessary
240 */
241 public PV1 getPV1() {
242 PV1 ret = null;
243 try {
244 ret = (PV1)this.get("PV1");
245 } catch(HL7Exception e) {
246 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
247 throw new RuntimeException(e);
248 }
249 return ret;
250 }
251
252
253
254
255 /**
256 * Returns
257 * PV2 (Patient visit - additional information) - creates it if necessary
258 */
259 public PV2 getPV2() {
260 PV2 ret = null;
261 try {
262 ret = (PV2)this.get("PV2");
263 } catch(HL7Exception e) {
264 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
265 throw new RuntimeException(e);
266 }
267 return ret;
268 }
269
270
271
272
273 /**
274 * Returns
275 * the first repetition of
276 * ROL2 (Role) - creates it if necessary
277 */
278 public ROL getROL2() {
279 ROL ret = null;
280 try {
281 ret = (ROL)this.get("ROL2");
282 } catch(HL7Exception e) {
283 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
284 throw new RuntimeException(e);
285 }
286 return ret;
287 }
288
289
290 /**
291 * Returns a specific repetition of
292 * ROL2 (Role) - creates it if necessary
293 *
294 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
295 * @throws HL7Exception if the repetition requested is more than one
296 * greater than the number of existing repetitions.
297 */
298 public ROL getROL2(int rep) {
299 ROL ret = null;
300 try {
301 ret = (ROL)this.get("ROL2", rep);
302 } catch(HL7Exception e) {
303 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
304 throw new RuntimeException(e);
305 }
306 return ret;
307 }
308
309 /**
310 * Returns the number of existing repetitions of ROL2
311 */
312 public int getROL2Reps() {
313 int reps = -1;
314 try {
315 reps = this.getAll("ROL2").length;
316 } catch (HL7Exception e) {
317 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
318 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
319 throw new RuntimeException(message);
320 }
321 return reps;
322 }
323
324 /**
325 * Inserts a specific repetition of ROL2 (Role)
326 * @see AbstractGroup\#insertRepetition(Structure, int)
327 */
328 public void insertROL2(ROL structure, int rep) throws HL7Exception {
329 super.insertRepetition( "ROL2", structure, rep);
330 }
331
332
333 /**
334 * Inserts a specific repetition of ROL2 (Role)
335 * @see AbstractGroup\#insertRepetition(Structure, int)
336 */
337 public ROL insertROL2(int rep) throws HL7Exception {
338 return (ROL)super.insertRepetition("ROL2", rep);
339 }
340
341
342 /**
343 * Removes a specific repetition of ROL2 (Role)
344 * @see AbstractGroup\#removeRepetition(String, int)
345 */
346 public ROL removeROL2(int rep) throws HL7Exception {
347 return (ROL)super.removeRepetition("ROL2", rep);
348 }
349
350
351
352 /**
353 * Returns
354 * the first repetition of
355 * DB1 (Disability) - creates it if necessary
356 */
357 public DB1 getDB1() {
358 DB1 ret = null;
359 try {
360 ret = (DB1)this.get("DB1");
361 } catch(HL7Exception e) {
362 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
363 throw new RuntimeException(e);
364 }
365 return ret;
366 }
367
368
369 /**
370 * Returns a specific repetition of
371 * DB1 (Disability) - creates it if necessary
372 *
373 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
374 * @throws HL7Exception if the repetition requested is more than one
375 * greater than the number of existing repetitions.
376 */
377 public DB1 getDB1(int rep) {
378 DB1 ret = null;
379 try {
380 ret = (DB1)this.get("DB1", rep);
381 } catch(HL7Exception e) {
382 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
383 throw new RuntimeException(e);
384 }
385 return ret;
386 }
387
388 /**
389 * Returns the number of existing repetitions of DB1
390 */
391 public int getDB1Reps() {
392 int reps = -1;
393 try {
394 reps = this.getAll("DB1").length;
395 } catch (HL7Exception e) {
396 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
397 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
398 throw new RuntimeException(message);
399 }
400 return reps;
401 }
402
403 /**
404 * Inserts a specific repetition of DB1 (Disability)
405 * @see AbstractGroup\#insertRepetition(Structure, int)
406 */
407 public void insertDB1(DB1 structure, int rep) throws HL7Exception {
408 super.insertRepetition( "DB1", structure, rep);
409 }
410
411
412 /**
413 * Inserts a specific repetition of DB1 (Disability)
414 * @see AbstractGroup\#insertRepetition(Structure, int)
415 */
416 public DB1 insertDB1(int rep) throws HL7Exception {
417 return (DB1)super.insertRepetition("DB1", rep);
418 }
419
420
421 /**
422 * Removes a specific repetition of DB1 (Disability)
423 * @see AbstractGroup\#removeRepetition(String, int)
424 */
425 public DB1 removeDB1(int rep) throws HL7Exception {
426 return (DB1)super.removeRepetition("DB1", rep);
427 }
428
429
430
431 /**
432 * Returns
433 * the first repetition of
434 * DG1 (Diagnosis) - creates it if necessary
435 */
436 public DG1 getDG1() {
437 DG1 ret = null;
438 try {
439 ret = (DG1)this.get("DG1");
440 } catch(HL7Exception e) {
441 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
442 throw new RuntimeException(e);
443 }
444 return ret;
445 }
446
447
448 /**
449 * Returns a specific repetition of
450 * DG1 (Diagnosis) - creates it if necessary
451 *
452 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
453 * @throws HL7Exception if the repetition requested is more than one
454 * greater than the number of existing repetitions.
455 */
456 public DG1 getDG1(int rep) {
457 DG1 ret = null;
458 try {
459 ret = (DG1)this.get("DG1", rep);
460 } catch(HL7Exception e) {
461 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
462 throw new RuntimeException(e);
463 }
464 return ret;
465 }
466
467 /**
468 * Returns the number of existing repetitions of DG1
469 */
470 public int getDG1Reps() {
471 int reps = -1;
472 try {
473 reps = this.getAll("DG1").length;
474 } catch (HL7Exception e) {
475 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
476 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
477 throw new RuntimeException(message);
478 }
479 return reps;
480 }
481
482 /**
483 * Inserts a specific repetition of DG1 (Diagnosis)
484 * @see AbstractGroup\#insertRepetition(Structure, int)
485 */
486 public void insertDG1(DG1 structure, int rep) throws HL7Exception {
487 super.insertRepetition( "DG1", structure, rep);
488 }
489
490
491 /**
492 * Inserts a specific repetition of DG1 (Diagnosis)
493 * @see AbstractGroup\#insertRepetition(Structure, int)
494 */
495 public DG1 insertDG1(int rep) throws HL7Exception {
496 return (DG1)super.insertRepetition("DG1", rep);
497 }
498
499
500 /**
501 * Removes a specific repetition of DG1 (Diagnosis)
502 * @see AbstractGroup\#removeRepetition(String, int)
503 */
504 public DG1 removeDG1(int rep) throws HL7Exception {
505 return (DG1)super.removeRepetition("DG1", rep);
506 }
507
508
509
510 /**
511 * Returns
512 * DRG (Diagnosis Related Group) - creates it if necessary
513 */
514 public DRG getDRG() {
515 DRG ret = null;
516 try {
517 ret = (DRG)this.get("DRG");
518 } catch(HL7Exception e) {
519 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
520 throw new RuntimeException(e);
521 }
522 return ret;
523 }
524
525
526
527
528 /**
529 * Returns
530 * the first repetition of
531 * PROCEDURE (a Group object) - creates it if necessary
532 */
533 public ADT_A03_PROCEDURE getPROCEDURE() {
534 ADT_A03_PROCEDURE ret = null;
535 try {
536 ret = (ADT_A03_PROCEDURE)this.get("PROCEDURE");
537 } catch(HL7Exception e) {
538 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
539 throw new RuntimeException(e);
540 }
541 return ret;
542 }
543
544
545 /**
546 * Returns a specific repetition of
547 * PROCEDURE (a Group object) - creates it if necessary
548 *
549 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
550 * @throws HL7Exception if the repetition requested is more than one
551 * greater than the number of existing repetitions.
552 */
553 public ADT_A03_PROCEDURE getPROCEDURE(int rep) {
554 ADT_A03_PROCEDURE ret = null;
555 try {
556 ret = (ADT_A03_PROCEDURE)this.get("PROCEDURE", rep);
557 } catch(HL7Exception e) {
558 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
559 throw new RuntimeException(e);
560 }
561 return ret;
562 }
563
564 /**
565 * Returns the number of existing repetitions of PROCEDURE
566 */
567 public int getPROCEDUREReps() {
568 int reps = -1;
569 try {
570 reps = this.getAll("PROCEDURE").length;
571 } catch (HL7Exception e) {
572 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
573 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
574 throw new RuntimeException(message);
575 }
576 return reps;
577 }
578
579 /**
580 * Inserts a specific repetition of PROCEDURE (a Group object)
581 * @see AbstractGroup\#insertRepetition(Structure, int)
582 */
583 public void insertPROCEDURE(ADT_A03_PROCEDURE structure, int rep) throws HL7Exception {
584 super.insertRepetition( "PROCEDURE", structure, rep);
585 }
586
587
588 /**
589 * Inserts a specific repetition of PROCEDURE (a Group object)
590 * @see AbstractGroup\#insertRepetition(Structure, int)
591 */
592 public ADT_A03_PROCEDURE insertPROCEDURE(int rep) throws HL7Exception {
593 return (ADT_A03_PROCEDURE)super.insertRepetition("PROCEDURE", rep);
594 }
595
596
597 /**
598 * Removes a specific repetition of PROCEDURE (a Group object)
599 * @see AbstractGroup\#removeRepetition(String, int)
600 */
601 public ADT_A03_PROCEDURE removePROCEDURE(int rep) throws HL7Exception {
602 return (ADT_A03_PROCEDURE)super.removeRepetition("PROCEDURE", rep);
603 }
604
605
606
607 /**
608 * Returns
609 * the first repetition of
610 * OBX (Observation/Result) - creates it if necessary
611 */
612 public OBX getOBX() {
613 OBX ret = null;
614 try {
615 ret = (OBX)this.get("OBX");
616 } catch(HL7Exception e) {
617 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
618 throw new RuntimeException(e);
619 }
620 return ret;
621 }
622
623
624 /**
625 * Returns a specific repetition of
626 * OBX (Observation/Result) - creates it if necessary
627 *
628 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
629 * @throws HL7Exception if the repetition requested is more than one
630 * greater than the number of existing repetitions.
631 */
632 public OBX getOBX(int rep) {
633 OBX ret = null;
634 try {
635 ret = (OBX)this.get("OBX", rep);
636 } catch(HL7Exception e) {
637 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
638 throw new RuntimeException(e);
639 }
640 return ret;
641 }
642
643 /**
644 * Returns the number of existing repetitions of OBX
645 */
646 public int getOBXReps() {
647 int reps = -1;
648 try {
649 reps = this.getAll("OBX").length;
650 } catch (HL7Exception e) {
651 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
652 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
653 throw new RuntimeException(message);
654 }
655 return reps;
656 }
657
658 /**
659 * Inserts a specific repetition of OBX (Observation/Result)
660 * @see AbstractGroup\#insertRepetition(Structure, int)
661 */
662 public void insertOBX(OBX structure, int rep) throws HL7Exception {
663 super.insertRepetition( "OBX", structure, rep);
664 }
665
666
667 /**
668 * Inserts a specific repetition of OBX (Observation/Result)
669 * @see AbstractGroup\#insertRepetition(Structure, int)
670 */
671 public OBX insertOBX(int rep) throws HL7Exception {
672 return (OBX)super.insertRepetition("OBX", rep);
673 }
674
675
676 /**
677 * Removes a specific repetition of OBX (Observation/Result)
678 * @see AbstractGroup\#removeRepetition(String, int)
679 */
680 public OBX removeOBX(int rep) throws HL7Exception {
681 return (OBX)super.removeRepetition("OBX", rep);
682 }
683
684
685
686 /**
687 * Returns
688 * PDA (Patient death and autopsy) - creates it if necessary
689 */
690 public PDA getPDA() {
691 PDA ret = null;
692 try {
693 ret = (PDA)this.get("PDA");
694 } catch(HL7Exception e) {
695 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
696 throw new RuntimeException(e);
697 }
698 return ret;
699 }
700
701
702
703
704 }
705