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.group;
009
010 import ca.uhn.hl7v2.model.v24.segment.*;
011
012 import ca.uhn.log.HapiLogFactory;
013 import ca.uhn.hl7v2.HL7Exception;
014 import ca.uhn.hl7v2.parser.ModelClassFactory;
015 import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
016 import ca.uhn.hl7v2.model.AbstractMessage;
017 import ca.uhn.hl7v2.model.Group;
018 import ca.uhn.hl7v2.model.AbstractGroup;
019 import ca.uhn.hl7v2.model.GenericSegment;
020
021 /**
022 * <p>Represents a DOC_T12_RESULT group structure (a Group object).
023 * A Group is an ordered collection of message segments that can repeat together or be optionally in/excluded together.
024 * This Group contains the following elements:
025 * </p>
026 * <ul>
027 * <li>1: EVN (Event Type) <b>optional </b></li>
028 * <li>2: PID (Patient identification) <b> </b></li>
029 * <li>3: PV1 (Patient visit) <b> </b></li>
030 * <li>4: TXA (Transcription Document Header) <b> </b></li>
031 * <li>5: OBX (Observation/Result) <b>optional repeating</b></li>
032 * </ul>
033 */
034 public class DOC_T12_RESULT extends AbstractGroup {
035
036 /**
037 * Creates a new DOC_T12_RESULT group
038 */
039 public DOC_T12_RESULT(Group parent, ModelClassFactory factory) {
040 super(parent, factory);
041 init(factory);
042 }
043
044 private void init(ModelClassFactory factory) {
045 try {
046 this.add(EVN.class, false, false);
047 this.add(PID.class, true, false);
048 this.add(PV1.class, true, false);
049 this.add(TXA.class, true, false);
050 this.add(OBX.class, false, true);
051 } catch(HL7Exception e) {
052 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating DOC_T12_RESULT - this is probably a bug in the source code generator.", e);
053 }
054 }
055
056 /**
057 * Returns "2.4"
058 */
059 public String getVersion() {
060 return "2.4";
061 }
062
063
064
065 /**
066 * Returns
067 * EVN (Event Type) - creates it if necessary
068 */
069 public EVN getEVN() {
070 EVN ret = null;
071 try {
072 ret = (EVN)this.get("EVN");
073 } catch(HL7Exception e) {
074 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
075 throw new RuntimeException(e);
076 }
077 return ret;
078 }
079
080
081
082
083 /**
084 * Returns
085 * PID (Patient identification) - creates it if necessary
086 */
087 public PID getPID() {
088 PID ret = null;
089 try {
090 ret = (PID)this.get("PID");
091 } catch(HL7Exception e) {
092 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
093 throw new RuntimeException(e);
094 }
095 return ret;
096 }
097
098
099
100
101 /**
102 * Returns
103 * PV1 (Patient visit) - creates it if necessary
104 */
105 public PV1 getPV1() {
106 PV1 ret = null;
107 try {
108 ret = (PV1)this.get("PV1");
109 } catch(HL7Exception e) {
110 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
111 throw new RuntimeException(e);
112 }
113 return ret;
114 }
115
116
117
118
119 /**
120 * Returns
121 * TXA (Transcription Document Header) - creates it if necessary
122 */
123 public TXA getTXA() {
124 TXA ret = null;
125 try {
126 ret = (TXA)this.get("TXA");
127 } catch(HL7Exception e) {
128 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
129 throw new RuntimeException(e);
130 }
131 return ret;
132 }
133
134
135
136
137 /**
138 * Returns
139 * the first repetition of
140 * OBX (Observation/Result) - creates it if necessary
141 */
142 public OBX getOBX() {
143 OBX ret = null;
144 try {
145 ret = (OBX)this.get("OBX");
146 } catch(HL7Exception e) {
147 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
148 throw new RuntimeException(e);
149 }
150 return ret;
151 }
152
153
154 /**
155 * Returns a specific repetition of
156 * OBX (Observation/Result) - creates it if necessary
157 *
158 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
159 * @throws HL7Exception if the repetition requested is more than one
160 * greater than the number of existing repetitions.
161 */
162 public OBX getOBX(int rep) {
163 OBX ret = null;
164 try {
165 ret = (OBX)this.get("OBX", rep);
166 } catch(HL7Exception e) {
167 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
168 throw new RuntimeException(e);
169 }
170 return ret;
171 }
172
173 /**
174 * Returns the number of existing repetitions of OBX
175 */
176 public int getOBXReps() {
177 int reps = -1;
178 try {
179 reps = this.getAll("OBX").length;
180 } catch (HL7Exception e) {
181 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
182 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
183 throw new RuntimeException(message);
184 }
185 return reps;
186 }
187
188 /**
189 * Inserts a specific repetition of OBX (Observation/Result)
190 * @see AbstractGroup#insertRepetition(Structure, int)
191 */
192 public void insertOBX(OBX structure, int rep) throws HL7Exception {
193 super.insertRepetition("OBX", structure, rep);
194 }
195
196
197 /**
198 * Inserts a specific repetition of OBX (Observation/Result)
199 * @see AbstractGroup#insertRepetition(Structure, int)
200 */
201 public OBX insertOBX(int rep) throws HL7Exception {
202 return (OBX)super.insertRepetition("OBX", rep);
203 }
204
205
206 /**
207 * Removes a specific repetition of OBX (Observation/Result)
208 * @see AbstractGroup#removeRepetition(String, int)
209 */
210 public OBX removeOBX(int rep) throws HL7Exception {
211 return (OBX)super.removeRepetition("OBX", rep);
212 }
213
214
215
216 }
217