use of ca.uhn.hl7v2.model.v24.message.ADT_A01 in project camel by apache.
the class HL7MLLPNettyCodecByteArrayRouteTest 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 AckExpressionTest method testAckExpressionWithCode.
@Test
public void testAckExpressionWithCode() throws Exception {
ADT_A01 a01 = createADT01Message();
ACK ack = template.requestBody("direct:test2", a01, ACK.class);
assertEquals("CA", 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 testNakExpression.
@Test
public void testNakExpression() throws Exception {
ADT_A01 a01 = createADT01Message();
ACK ack = template.requestBody("direct:test3", a01, ACK.class);
assertEquals("AE", 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());
}