View Javadoc
1   /*
2    * Copyright 2008 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *     
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.openehealth.ipf.modules.hl7.parser.test.hl7v2.def.v25.segment;
17  
18  import org.openehealth.ipf.modules.hl7.HL7v2Exception;
19  
20  import ca.uhn.hl7v2.HL7Exception;
21  import ca.uhn.hl7v2.model.AbstractSegment;
22  import ca.uhn.hl7v2.model.Group;
23  import ca.uhn.hl7v2.model.Message;
24  import ca.uhn.hl7v2.model.v25.datatype.EI;
25  import ca.uhn.hl7v2.model.v25.datatype.ST;
26  import ca.uhn.hl7v2.model.v25.datatype.TS;
27  import ca.uhn.hl7v2.parser.ModelClassFactory;
28  
29  /**
30   * The ZBE segment is intended to be used for information that details ADT
31   * movement information. Each ADT event (i.e. admission, discharge, transfer,
32   * visit) has a unique identifier to allow for updates at a later point in time.
33   * Furthermore, other medical information like diagnoses or documents can refer
34   * to this movement using the identifier as reference.
35   * <p>
36   * The segment is defined by the German Patient Management Profile and extended
37   * by the "Historic Movement" option of the IHE ITI Supplement Patient
38   * Administration Framework (PAM) Integration Profile.
39   * 
40   * @author Christian Ohr
41   */
42  @SuppressWarnings("serial")
43  public class ZBE extends AbstractSegment {
44  
45      /**
46       * @param parent
47       * @param factory
48       */
49      public ZBE(Group parent, ModelClassFactory factory) {
50          super(parent, factory);
51          Message message = getMessage();
52          try {
53              add(EI.class, true, 0, 999, new Object[] { message }, null);
54              add(TS.class, true, 1, 26, new Object[] { message }, null);
55              add(TS.class, false, 1, 26, new Object[] { message }, null);
56              add(ST.class, true, 1, 10, new Object[] { message }, null);
57          } catch (HL7Exception he) {
58              throw new HL7v2Exception(he);
59          }
60      }
61  
62      /**
63       * Returns movement ID (ZBE-1).
64       * 
65       * @param rep index of repeating field
66       * @return movement ID
67       */
68      public EI getMovementID(int rep) {
69          return getTypedField(1, rep);
70      }
71  
72      /**
73       * Returns movement IDs (ZBE-1).
74       * 
75       * @return movement IDs
76       */
77      public EI[] getMovementID() {
78          return getTypedField(1, new EI[0]);
79      }
80  
81      /**
82       * Returns movement start date (ZBE-2).
83       * 
84       * @return movement start date (required)
85       */
86      public TS getStartMovementDateTime() {
87          return getTypedField(2, 0);
88      }
89  
90      /**
91       * Returns movement end date (ZBE-3).
92       * 
93       * @return movement end date (optional)
94       */
95      public TS getStartMovementEndTime() {
96          return getTypedField(3, 0);
97      }
98  
99      /**
100      * Returns movement action (ZBE-4).
101      * 
102      * @return movement action (required, one of INSERT, DELETE, UPDATE, REFERENCE)
103      */
104     public ST getAction() {
105         return getTypedField(4, 0);
106     }
107 
108 }