use of ca.uhn.hl7v2.model.v24.message.ADT_A01 in project camel by apache.
the class AckExpressionTest method testAckExpression.
@Test
public void testAckExpression() throws Exception {
ADT_A01 a01 = createADT01Message();
ACK ack = template.requestBody("direct:test1", a01, ACK.class);
assertEquals("AA", ack.getMSA().getAcknowledgementCode().getValue());
assertEquals(a01.getMSH().getMessageControlID().getValue(), ack.getMSA().getMessageControlID().getValue());
}
use of ca.uhn.hl7v2.model.v24.message.ADT_A01 in project camel by apache.
the class AckExpressionTest method testNakExpressionWithParameters.
@Test
public void testNakExpressionWithParameters() throws Exception {
ADT_A01 a01 = createADT01Message();
ACK ack = template.requestBody("direct:test4", a01, ACK.class);
assertEquals("AR", ack.getMSA().getAcknowledgementCode().getValue());
assertEquals(a01.getMSH().getMessageControlID().getValue(), ack.getMSA().getMessageControlID().getValue());
assertEquals(String.valueOf(ErrorCode.APPLICATION_INTERNAL_ERROR.getCode()), ack.getERR().getErrorCodeAndLocation(0).getCodeIdentifyingError().getIdentifier().getValue());
assertEquals("Problem!", ack.getERR().getErrorCodeAndLocation(0).getCodeIdentifyingError().getAlternateText().getValue());
}
use of ca.uhn.hl7v2.model.v24.message.ADT_A01 in project camel by apache.
the class HL7ByteArrayRouteTest method createADT01Message.
private static Message createADT01Message(String msgId) throws Exception {
ADT_A01 adt = new ADT_A01();
// Populate the MSH Segment
MSH mshSegment = adt.getMSH();
mshSegment.getFieldSeparator().setValue("|");
mshSegment.getEncodingCharacters().setValue("^~\\&");
mshSegment.getDateTimeOfMessage().getTimeOfAnEvent().setValue("200701011539");
mshSegment.getSendingApplication().getNamespaceID().setValue("MYSENDER");
mshSegment.getSequenceNumber().setValue("123");
mshSegment.getMessageType().getMessageType().setValue("ADT");
mshSegment.getMessageType().getTriggerEvent().setValue("A01");
mshSegment.getCharacterSet(0).setValue("UNICODE UTF-8");
// Populate the PID Segment
PID pid = adt.getPID();
pid.getPatientName(0).getFamilyName().getSurname().setValue("Döe");
pid.getPatientName(0).getGivenName().setValue("John");
pid.getPatientIdentifierList(0).getID().setValue(msgId);
return adt;
}
use of ca.uhn.hl7v2.model.v24.message.ADT_A01 in project camel by apache.
the class MessageValidatorTest method createADT01Message.
private static Message createADT01Message() throws Exception {
ADT_A01 adt = new ADT_A01();
adt.initQuickstart("ADT", "A01", "P");
// Populate the PID Segment
PID pid = adt.getPID();
pid.getPatientName(0).getFamilyName().getSurname().setValue("Doe");
pid.getPatientName(0).getGivenName().setValue("John");
pid.getPatientIdentifierList(0).getID().setValue("123456");
return adt;
}
use of ca.uhn.hl7v2.model.v24.message.ADT_A01 in project camel by apache.
the class TerserExpressionTest method createADT01Message.
private static Message createADT01Message() throws Exception {
ADT_A01 adt = new ADT_A01();
adt.initQuickstart("ADT", "A01", "P");
// Populate the PID Segment
PID pid = adt.getPID();
pid.getPatientName(0).getFamilyName().getSurname().setValue("Doe");
pid.getPatientName(0).getGivenName().setValue("John");
pid.getPatientIdentifierList(0).getID().setValue(PATIENT_ID);
return adt;
}