This response about XML from James tweeked my interest in relation to
the problem I have with the un-escaped delimiters, so I used the code to
parse the message and look at the XML. The XML looked promising, so I
created a new terser, and did my tersing tests again. This time they
worked. Interesting.
So, I think I have a problem with how I built my ZAE segment, and how I
built my Z-Segment testing message. Code of the ZAE and the Z-PACK are
below.
Note that I am still able to produce a result that is not ideal, if
multiple delimiters exist with no data in between, or if there are
trailing delimiters.
HAPI 2.1 was used for this checking.
Thanks
Ian
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package au.gov.qld.health.sit.hl7;
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.model.AbstractSegment;
import ca.uhn.hl7v2.model.Group;
import ca.uhn.hl7v2.model.Message;
import ca.uhn.hl7v2.model.Type;
import ca.uhn.hl7v2.model.v24.datatype.*;
import ca.uhn.hl7v2.parser.ModelClassFactory;
/**
*
* @author vowlesi
*/
public class ZAE extends AbstractSegment {
public ZAE(Group parent, ModelClassFactory factory) throws
HL7Exception {
super(parent, factory);
Message message = getMessage();
Object[] constructorArgs = new Object[]{message};
Class<? extends Type> type;
boolean required;
int maxReps; // only 1 rep
int maxLength;
String fieldName;
// For each in the segment, call this.add()
// ZAE-1-Date Time Seen, TS, O
type = TS.class;
required = false;
maxReps = 1; // only 1 rep
maxLength = 0;
fieldName = "Date Time Seen";
this.add(type, required, maxReps, maxLength, constructorArgs,
fieldName);
// ZAE-2-Location Group, ST, O
type = ST.class;
required = false;
maxReps = 1; // only 1 rep
maxLength = 0;
fieldName = "Location Group";
this.add(type, required, maxReps, maxLength, constructorArgs,
fieldName);
// ZAE-3-Arrival Transport Code, ST, O
type = ST.class;
required = false;
maxReps = 1; // only 1 rep
maxLength = 0;
fieldName = "Arrival Transport Code";
this.add(type, required, maxReps, maxLength, constructorArgs,
fieldName);
// ZAE-4-Ambulance Number, ST, O
type = ST.class;
required = false;
maxReps = 1; // only 1 rep
maxLength = 0;
fieldName = "Ambulance Number";
this.add(type, required, maxReps, maxLength, constructorArgs,
fieldName);
// ZAE-5-Not Used 1, ST, O
type = ST.class;
required = false;
maxReps = 1; // only 1 rep
maxLength = 0;
fieldName = "Not Used 1";
this.add(type, required, maxReps, maxLength, constructorArgs,
fieldName);
// ZAE-6-Not Used 2, ST, O
type = ST.class;
required = false;
maxReps = 1; // only 1 rep
maxLength = 0;
fieldName = "Not Used 2";
this.add(type, required, maxReps, maxLength, constructorArgs,
fieldName);
// ZAE-7-Not Used 3, ST, O
type = ST.class;
required = false;
maxReps = 1; // only 1 rep
maxLength = 0;
fieldName = "Not Used 3";
this.add(type, required, maxReps, maxLength, constructorArgs,
fieldName);
// ZAE-8-Presenting Problem, ST, O
type = ST.class;
required = false;
maxReps = 1; // only 1 rep
maxLength = 0;
fieldName = "Presenting Problem";
this.add(type, required, maxReps, maxLength, constructorArgs,
fieldName);
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public TS getDateTimeSeen() throws HL7Exception {
return (TS) super.getField(1, 0); // 1 - field num( numbered
from 1)
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public TS getZAE1_DateTimeSeen() throws HL7Exception {
return (TS) super.getField(1,0); // 1 - field num( numbered
from 1)
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public ST getLocationGroup() throws HL7Exception {
return (ST) super.getField(2, 0); // 2 - field num( numbered
from 1)
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public ST getZAE2_LocationGroup() throws HL7Exception {
return (ST) super.getField(2,0); // 2 - field num( numbered
from 1)
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public ST getArrivalTransportCode() throws HL7Exception {
return (ST) super.getField(3, 0); // 3 - field num( numbered
from 1)
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public ST getZAE3_ArrivalTransportCode() throws HL7Exception {
return (ST) super.getField(3,0); // 3 - field num( numbered
from 1)
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public ST getAmbulanceNumber() throws HL7Exception {
return (ST) super.getField(4, 0); // 4 - field num( numbered
from 1)
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public ST getZAE4_AmbulanceNumber() throws HL7Exception {
return (ST) super.getField(4,0); // 4 - field num( numbered
from 1)
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public ST getNotUsed1() throws HL7Exception {
return (ST) super.getField(5, 0); // 5 - field num( numbered
from 1)
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public ST getZAE5_NotUsed1() throws HL7Exception {
return (ST) super.getField(5,0); // 5 - field num( numbered
from 1)
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public ST getNotUsed2() throws HL7Exception {
return (ST) super.getField(6, 0); // 6 - field num( numbered
from 1)
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public ST getZAE6_NotUsed2() throws HL7Exception {
return (ST) super.getField(6,0); // 6 - field num( numbered
from 1)
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public ST getNotUsed3() throws HL7Exception {
return (ST) super.getField(7, 0); // 7 - field num( numbered
from 1)
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public ST getZAE7_NotUsed3() throws HL7Exception {
return (ST) super.getField(7,0); // 7 - field num( numbered
from 1)
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public ST getPresentingProblem() throws HL7Exception {
return (ST) super.getField(8, 0); // 8 - field num( numbered
from 1)
}
/**
* Create an accessor for each field
* @return
* @throws HL7Exception
*/
public ST getZAE8_PresentingProblem() throws HL7Exception {
return (ST) super.getField(8,0); // 8 - field num( numbered
from 1)
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package au.gov.qld.health.sit.hl7;
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.model.AbstractMessage;
import ca.uhn.hl7v2.model.v24.segment.EVN;
import ca.uhn.hl7v2.model.v24.segment.MSH;
import ca.uhn.hl7v2.parser.ModelClassFactory;
/**
*
* @author vowlesi
*/
public class QH_ZPACK extends AbstractMessage {
public QH_ZPACK(ModelClassFactory factory) throws HL7Exception {
super(factory);
Class<MSH> addMsh = MSH.class;
this.add(addMsh,true,false);
Class<ZAE> addZae = ZAE.class;
this.add(addZae, true, false);
Class<ZAL> addZal = ZAL.class;
this.add(addZal, true, false);
Class<ZAP> addZap = ZAP.class;
this.add(addZap, true, false);
Class<ZBD> addZbd = ZBD.class;
this.add(addZbd, true, false);
Class<ZCD> addZcd = ZCD.class;
this.add(addZcd, true, false);
Class<ZEI> addZei = ZEI.class;
this.add(addZei, true, false);
Class<ZMR> addZmr = ZMR.class;
this.add(addZmr, true, false);
Class<ZMV> addZmv = ZMV.class;
this.add(addZmv, true, false);
Class<ZPD> addZpd = ZPD.class;
this.add(addZpd, true, false);
Class<ZPX> addZpx = ZPX.class;
this.add(addZpx, true, false);
Class<ZRC> addZrc = ZRC.class;
this.add(addZrc, true, false);
Class<ZTD> addZtd = ZTD.class;
this.add(addZtd, true, false);
Class<ZV1> addZv1 = ZV1.class;
this.add(addZv1, true, false);
Class<ZVX> addZvx = ZVX.class;
this.add(addZvx, true, false);
Class<ZWL> addZwl = ZWL.class;
this.add(addZwl, true, false);
}
public MSH getMSH() throws HL7Exception {
return (MSH) get("MSH");
}
public PATIENT getPATIENT() throws HL7Exception {
return (PATIENT) get ("PATIENT");
}
public ZAE getZAE() throws HL7Exception {
return (ZAE) get ("ZAE");
}
public ZAL getZAL() throws HL7Exception {
return (ZAL) get ("ZAL");
}
public ZAP getZAP() throws HL7Exception {
return (ZAP) get ("ZAP");
}
public ZBD getZBD() throws HL7Exception {
return (ZBD) get ("ZBD");
}
public ZCD getZCD() throws HL7Exception {
return (ZCD) get ("ZCD");
}
public ZEI getZEI() throws HL7Exception {
return (ZEI) get ("ZEI");
}
public ZMR getZMR() throws HL7Exception {
return (ZMR) get ("ZMR");
}
public ZMV getZMV() throws HL7Exception {
return (ZMV) get ("ZMV");
}
public ZPD getZPD() throws HL7Exception {
return (ZPD) get ("ZPD");
}
public ZPX getZPX() throws HL7Exception {
return (ZPX) get ("ZPX");
}
public ZRC getZRC() throws HL7Exception {
return (ZRC) get ("ZRC");
}
public ZTD getZTD() throws HL7Exception {
return (ZTD) get ("ZTD");
}
public ZV1 getZV1() throws HL7Exception {
return (ZV1) get ("ZV1");
}
public ZVX getZVX() throws HL7Exception {
return (ZVX) get ("ZVX");
}
public ZWL getZWL() throws HL7Exception {
return (ZWL) get ("ZWL");
}
}
>>> James Agnew <[email protected]> 03/05/13 6:44 >>>
Hi Ryan,
Converting a message from ER7 (pipes) to XML is quite easy:
Message msg = ctx.getPipeParser().parse(stringEr7Message);
String stringXmlMessage = ctx.getXmlParser().encode(msg);
Cheers,
James
On Thu, May 2, 2013 at 1:20 PM, Ternier, Ryan <[email protected]>
wrote:
I*m translating a health request from a system into a K22 HL7v2
response. I have sample responses from their system, and I*m trying to
see if there*s a way either through the HAPI tool or through Java code
to take the K22 string I have, and turn that into the XML counterpart.
Is this possible? I can easily do it with the request.
Cheers,
Ryan
------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for
Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel
********************************************************************************
This email, including any attachments sent with it, is confidential and for the
sole use of the intended recipient(s). This confidentiality is not waived or
lost, if you receive it and you are not the intended recipient(s), or if it is
transmitted/received in error.
Any unauthorised use, alteration, disclosure, distribution or review of this
email is strictly prohibited. The information contained in this email,
including any attachment sent with it, may be subject to a statutory duty of
confidentiality if it relates to health service matters.
If you are not the intended recipient(s), or if you have received this email in
error, you are asked to immediately notify the sender by telephone collect on
Australia +61 1800 198 175 or by return email. You should also delete this
email, and any copies, from your computer system network and destroy any hard
copies produced.
If not an intended recipient of this email, you must not copy, distribute or
take any action(s) that relies on it; any form of disclosure, modification,
distribution and/or publication of this email is also prohibited.
Although Queensland Health takes all reasonable steps to ensure this email does
not contain malicious software, Queensland Health does not accept
responsibility for the consequences if any person's computer inadvertently
suffers any disruption to services, loss of information, harm or is infected
with a virus, other malicious computer programme or code that may occur as a
consequence of receiving this email.
Unless stated otherwise, this email represents only the views of the sender and
not the views of the Queensland Government.
**********************************************************************************
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel