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.v231.message;
009
010 import ca.uhn.hl7v2.model.v231.group.*;
011 import ca.uhn.hl7v2.model.v231.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 PEX_P07 message structure (see chapter ${chapter}). This structure contains the
021 * following elements: </p>
022 * <ul>
023 * <li>1: MSH (MSH - message header segment) <b> </b></li>
024 * <li>2: EVN (EVN - event type segment) <b> </b></li>
025 * <li>3: PID (PID - patient identification segment) <b> </b></li>
026 * <li>4: PD1 (PD1 - patient additional demographic segment) <b>optional </b></li>
027 * <li>5: NTE (NTE - notes and comments segment) <b>optional repeating</b></li>
028 * <li>6: PEX_P07_PV1PV2 (a Group object) <b>optional </b></li>
029 * <li>7: PEX_P07_PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP (a Group object) <b> repeating</b></li>
030 * </ul>
031 */
032 public class PEX_P07 extends AbstractMessage {
033
034 /**
035 * Creates a new PEX_P07 message with DefaultModelClassFactory.
036 */
037 public PEX_P07() {
038 this(new DefaultModelClassFactory());
039 }
040
041 /**
042 * Creates a new PEX_P07 message with custom ModelClassFactory.
043 */
044 public PEX_P07(ModelClassFactory factory) {
045 super(factory);
046 init(factory);
047 }
048
049 private void init(ModelClassFactory factory) {
050 try {
051 this.add(MSH.class, true, false);
052 this.add(EVN.class, true, false);
053 this.add(PID.class, true, false);
054 this.add(PD1.class, false, false);
055 this.add(NTE.class, false, true);
056 this.add(PEX_P07_PV1PV2.class, false, false);
057 this.add(PEX_P07_PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP.class, true, true);
058 } catch(HL7Exception e) {
059 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating PEX_P07 - this is probably a bug in the source code generator.", e);
060 }
061 }
062
063 /**
064 * Returns "2.3.1"
065 */
066 public String getVersion() {
067 return "2.3.1";
068 }
069
070
071
072 /**
073 * Returns
074 * MSH (MSH - message header segment) - creates it if necessary
075 */
076 public MSH getMSH() {
077 MSH ret = null;
078 try {
079 ret = (MSH)this.get("MSH");
080 } catch(HL7Exception e) {
081 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
082 throw new RuntimeException(e);
083 }
084 return ret;
085 }
086
087
088
089
090 /**
091 * Returns
092 * EVN (EVN - event type segment) - creates it if necessary
093 */
094 public EVN getEVN() {
095 EVN ret = null;
096 try {
097 ret = (EVN)this.get("EVN");
098 } catch(HL7Exception e) {
099 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
100 throw new RuntimeException(e);
101 }
102 return ret;
103 }
104
105
106
107
108 /**
109 * Returns
110 * PID (PID - patient identification segment) - creates it if necessary
111 */
112 public PID getPID() {
113 PID ret = null;
114 try {
115 ret = (PID)this.get("PID");
116 } catch(HL7Exception e) {
117 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
118 throw new RuntimeException(e);
119 }
120 return ret;
121 }
122
123
124
125
126 /**
127 * Returns
128 * PD1 (PD1 - patient additional demographic segment) - creates it if necessary
129 */
130 public PD1 getPD1() {
131 PD1 ret = null;
132 try {
133 ret = (PD1)this.get("PD1");
134 } catch(HL7Exception e) {
135 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
136 throw new RuntimeException(e);
137 }
138 return ret;
139 }
140
141
142
143
144 /**
145 * Returns
146 * the first repetition of
147 * NTE (NTE - notes and comments segment) - creates it if necessary
148 */
149 public NTE getNTE() {
150 NTE ret = null;
151 try {
152 ret = (NTE)this.get("NTE");
153 } catch(HL7Exception e) {
154 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
155 throw new RuntimeException(e);
156 }
157 return ret;
158 }
159
160
161 /**
162 * Returns a specific repetition of
163 * NTE (NTE - notes and comments segment) - creates it if necessary
164 *
165 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
166 * @throws HL7Exception if the repetition requested is more than one
167 * greater than the number of existing repetitions.
168 */
169 public NTE getNTE(int rep) {
170 NTE ret = null;
171 try {
172 ret = (NTE)this.get("NTE", rep);
173 } catch(HL7Exception e) {
174 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
175 throw new RuntimeException(e);
176 }
177 return ret;
178 }
179
180 /**
181 * Returns the number of existing repetitions of NTE
182 */
183 public int getNTEReps() {
184 int reps = -1;
185 try {
186 reps = this.getAll("NTE").length;
187 } catch (HL7Exception e) {
188 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
189 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
190 throw new RuntimeException(message);
191 }
192 return reps;
193 }
194
195 /**
196 * Inserts a specific repetition of NTE (NTE - notes and comments segment)
197 * @see AbstractGroup\#insertRepetition(Structure, int)
198 */
199 public void insertNTE(NTE structure, int rep) throws HL7Exception {
200 super.insertRepetition( "NTE", structure, rep);
201 }
202
203
204 /**
205 * Inserts a specific repetition of NTE (NTE - notes and comments segment)
206 * @see AbstractGroup\#insertRepetition(Structure, int)
207 */
208 public NTE insertNTE(int rep) throws HL7Exception {
209 return (NTE)super.insertRepetition("NTE", rep);
210 }
211
212
213 /**
214 * Removes a specific repetition of NTE (NTE - notes and comments segment)
215 * @see AbstractGroup\#removeRepetition(String, int)
216 */
217 public NTE removeNTE(int rep) throws HL7Exception {
218 return (NTE)super.removeRepetition("NTE", rep);
219 }
220
221
222
223 /**
224 * Returns
225 * PV1PV2 (a Group object) - creates it if necessary
226 */
227 public PEX_P07_PV1PV2 getPV1PV2() {
228 PEX_P07_PV1PV2 ret = null;
229 try {
230 ret = (PEX_P07_PV1PV2)this.get("PV1PV2");
231 } catch(HL7Exception e) {
232 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
233 throw new RuntimeException(e);
234 }
235 return ret;
236 }
237
238
239
240
241 /**
242 * Returns
243 * the first repetition of
244 * PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP (a Group object) - creates it if necessary
245 */
246 public PEX_P07_PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP getPESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP() {
247 PEX_P07_PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP ret = null;
248 try {
249 ret = (PEX_P07_PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP)this.get("PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP");
250 } catch(HL7Exception e) {
251 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
252 throw new RuntimeException(e);
253 }
254 return ret;
255 }
256
257
258 /**
259 * Returns a specific repetition of
260 * PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP (a Group object) - creates it if necessary
261 *
262 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
263 * @throws HL7Exception if the repetition requested is more than one
264 * greater than the number of existing repetitions.
265 */
266 public PEX_P07_PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP getPESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP(int rep) {
267 PEX_P07_PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP ret = null;
268 try {
269 ret = (PEX_P07_PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP)this.get("PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP", rep);
270 } catch(HL7Exception e) {
271 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
272 throw new RuntimeException(e);
273 }
274 return ret;
275 }
276
277 /**
278 * Returns the number of existing repetitions of PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP
279 */
280 public int getPESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSPReps() {
281 int reps = -1;
282 try {
283 reps = this.getAll("PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP").length;
284 } catch (HL7Exception e) {
285 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
286 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
287 throw new RuntimeException(message);
288 }
289 return reps;
290 }
291
292 /**
293 * Inserts a specific repetition of PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP (a Group object)
294 * @see AbstractGroup\#insertRepetition(Structure, int)
295 */
296 public void insertPESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP(PEX_P07_PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP structure, int rep) throws HL7Exception {
297 super.insertRepetition( "PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP", structure, rep);
298 }
299
300
301 /**
302 * Inserts a specific repetition of PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP (a Group object)
303 * @see AbstractGroup\#insertRepetition(Structure, int)
304 */
305 public PEX_P07_PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP insertPESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP(int rep) throws HL7Exception {
306 return (PEX_P07_PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP)super.insertRepetition("PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP", rep);
307 }
308
309
310 /**
311 * Removes a specific repetition of PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP (a Group object)
312 * @see AbstractGroup\#removeRepetition(String, int)
313 */
314 public PEX_P07_PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP removePESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP(int rep) throws HL7Exception {
315 return (PEX_P07_PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP)super.removeRepetition("PESPEOPCRRXERXRRXARXRPRBOBXNTENK1RXERXRRXARXRPRBOBXCSRCSP", rep);
316 }
317
318
319
320 }
321