1 /* 2 * Copyright 2015 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.commons.ihe.hl7v2.definitions.pam.v25.segment; 17 18 import ca.uhn.hl7v2.HL7Exception; 19 import ca.uhn.hl7v2.model.AbstractSegment; 20 import ca.uhn.hl7v2.model.Group; 21 import ca.uhn.hl7v2.model.Message; 22 import ca.uhn.hl7v2.model.v25.datatype.*; 23 import ca.uhn.hl7v2.parser.ModelClassFactory; 24 import org.openehealth.ipf.modules.hl7.HL7v2Exception; 25 26 /** 27 * The ZBE segment is intended to be used for information that details ADT 28 * movement information. Each ADT event (i.e. admission, discharge, transfer, 29 * visit) has a unique identifier to allow for updates at a later point in time. 30 * Furthermore, other medical information like diagnoses or documents can refer 31 * to this movement using the identifier as reference. 32 * <p> 33 * The segment is defined by the German Patient Management Profile and extended 34 * by the "Historic Movement" option of the IHE ITI Supplement Patient 35 * Administration Framework (PAM) Integration Profile. 36 * 37 * @author Christian Ohr 38 */ 39 @SuppressWarnings("serial") 40 public class ZBE extends AbstractSegment { 41 42 /** 43 * @param parent 44 * @param factory 45 */ 46 public ZBE(Group parent, ModelClassFactory factory) { 47 super(parent, factory); 48 Message message = getMessage(); 49 try { 50 add(EI.class, true, 0, 999, new Object[] { message }, "Movement ID"); 51 add(TS.class, true, 1, 26, new Object[] { message }, "Start Movement Date/Time"); 52 add(TS.class, false, 1, 26, new Object[] { message }, "End Movement Date/Time"); 53 add(ST.class, true, 1, 10, new Object[] { message }, "Movement Action"); 54 add(ID.class, true, 1, 1, new Object[] { message }, "Historical Movement Indicator"); 55 add(ID.class, false, 1, 10, new Object[] { message }, "Original trigger event code"); 56 add(XON.class, false, 1, 999, new Object[] { message }, "Responsible Ward"); 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 getMovementAction() { 105 return getTypedField(4, 0); 106 } 107 108 /** 109 * Returns historical movement indicator (ZBE-5). 110 * 111 * @return historical movement indicator (required, one of Y, N) 112 */ 113 public ID getHistoricalMovementIndicator() { 114 return getTypedField(5, 0); 115 } 116 117 /** 118 * Returns original trigger event code (ZBE-6). In the case of an UPDATE of the movement 119 * (trigger A08), this field conveys the original trigger event that was sent with the INSERT 120 * 121 * @return original trigger event code 122 */ 123 public ID getOriginalTriggerEventCode() { 124 return getTypedField(6, 0); 125 } 126 127 /** 128 * Returns responsible ward (ZBE-7), (Medical or Nursing Ward, depending of the trigger event of the message) 129 * 130 * @return responsible ward 131 */ 132 public XON getResponsibleWard() { 133 return getTypedField(7, 0); 134 } 135 }