Package ca.uhn.hl7v2.model.v24.message

Examples of ca.uhn.hl7v2.model.v24.message.ADT_A01


        return adr.getMessage();
    }

    private static Message createADT01Message() 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");

        // 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.getMessage();
    }
View Full Code Here


        return adr.getMessage();
    }

    private static Message createADT01Message() 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");

        // 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;
View Full Code Here

public class AckExpressionTest extends CamelTestSupport {

    @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());
    }
View Full Code Here

            .getValue());
    }

    @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());
    }
View Full Code Here

            .getValue());
    }

    @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(HL7Exception.APPLICATION_INTERNAL_ERROR), ack.getERR()
            .getErrorCodeAndLocation(0).getCodeIdentifyingError().getIdentifier().getValue());
    }
View Full Code Here

            .getErrorCodeAndLocation(0).getCodeIdentifyingError().getIdentifier().getValue());
    }

    @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(HL7Exception.APPLICATION_INTERNAL_ERROR), ack.getERR()
            .getErrorCodeAndLocation(0).getCodeIdentifyingError().getIdentifier().getValue());
        assertEquals("Problem!", ack.getERR().getErrorCodeAndLocation(0).getCodeIdentifyingError()
            .getAlternateText().getValue());
View Full Code Here

            .getAlternateText().getValue());
    }

    @Test
    public void testNakExpressionWithoutException() throws Exception {
        ADT_A01 a01 = createADT01Message();
        ACK ack = template.requestBody("direct:test5", a01, ACK.class);
        assertEquals("AR", ack.getMSA().getAcknowledgementCode().getValue());
        assertEquals(a01.getMSH().getMessageControlID().getValue(), ack.getMSA().getMessageControlID()
            .getValue());
        assertEquals(String.valueOf(HL7Exception.DATA_TYPE_ERROR), ack.getERR().getErrorCodeAndLocation(0)
            .getCodeIdentifyingError().getIdentifier().getValue());
        assertEquals("Problem!", ack.getERR().getErrorCodeAndLocation(0).getCodeIdentifyingError()
            .getAlternateText().getValue());
View Full Code Here

            }
        };
    }

    private static ADT_A01 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;
View Full Code Here

                return null;
            }

            @Override
            public ValidationException[] test(Message msg) {
                ADT_A01 a01 = (ADT_A01)msg;
                if (a01.getPID().getAdministrativeSex().getValue() == null) {
                    ValidationException[] e = new ValidationException[1];
                    e[0] = new ValidationException("No gender provided!");
                    return e;
                }
                return VALIDATION_OK;
View Full Code Here

            }
        };
    }

    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;
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.model.v24.message.ADT_A01

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.