Example #1
0
  @Ignore
  @Test
  @DirtiesContext
  public void validHL7IsConvertedAndAckIsSent() throws Exception {
    standardHL7XMLEndpoint.expectedMessageCount(1);
    t5XMLEndpoint.expectedMessageCount(1);

    String hl7Input =
        "MSH|^~\\&|SendingApplication|SendingFacility|ReceivingApplication|ReceivingFacility|20120530112345||ORU^R01^ORU_R01|9879790003|P|2.6|||NE|AL|USA|ASCII|EN^English^ISO639||IHE_PCD_ORU_R01^IHE PCD^1.3.6.1.4.1.19376.1.6.1.1.1^ISO\r"
            + "PID|||HO2009001^^^NIST^PI||Hon^Albert^^^^^L|Adams^^^^^^L|19610101|M|||15 N Saguaro^^Tucson^AZ^85701\r"
            + "PV1||I|ICU^2^23\r"
            + "OBR|1|||44616-1^Pulse oximetry panel ^LN|||20120512031234||||||||||||||||||F|||||||||||||||||||252465000^Pulse oximetry^SCT|7087005^Intermittent^SCT\r"
            + "NTE|1||This comment refers to all the results in the battery\r"
            + "OBX|1|NM|8889-8^Heart Rate by Oximetry^LN^149530^ MDC_PULS_OXIM_PULS_RATE^MDC|1.11.2.3|55|{beats}/min^beats per minute^UCUM|35-125||99||R|||20120530112340|||AMEAS^auto-measurement^MDC|0123456789ABCDEF^Pulse_Oximeter_Vendor_X^0123456789ABCDEF^EUI-64||49521004^left ear structure^SCT\n"
            + "NTE|1||This is a comment about pulse";

    Parser parser = new PipeParser();
    ORU_R01 originalMessage = (ORU_R01) parser.parse(hl7Input);
    String encodedHL7 = parser.encode(originalMessage);

    String response = minaTemplate.requestBody((Object) encodedHL7, String.class);

    ACK responseMessage = (ACK) parser.parse(response);

    assertEquals(
        AcknowledgmentCode.AA.name(), responseMessage.getMSA().getAcknowledgmentCode().getValue());

    standardHL7XMLEndpoint.assertIsSatisfied();
    t5XMLEndpoint.assertIsSatisfied();

    ORU_R01 outputStandardXMLMessage =
        (ORU_R01) parseXMLExchange(standardHL7XMLEndpoint.getReceivedExchanges().get(0));

    assertEquals(
        originalMessage.getMSH().getMessageType().getName(),
        outputStandardXMLMessage.getMSH().getMessageType().getName());
    assertEquals(
        originalMessage.getMSH().getMessageControlID().getValue(),
        outputStandardXMLMessage.getMSH().getMessageControlID().getValue());
  }
Example #2
0
  @Test
  @Ignore
  @DirtiesContext
  public void invalidMessageReutrnsApplicationReject() throws Exception {
    standardHL7XMLEndpoint.expectedMessageCount(1);
    t5XMLEndpoint.expectedMessageCount(1);

    String invalidHL7Input =
        "MSH|^~\\&|SendingApplication|SendingFacility|ReceivingApplication|ReceivingFacility|20120530112345||ORU^R01^ORU_R01|9879790003|P|2.6|||NE|AL|USA|ASCII|EN^English^ISO639||IHE_PCD_ORU_R01^IHE PCD^1.3.6.1.4.1.19376.1.6.1.1.1^ISO\n"
            + "PID|||HO2009001^^^NIST^PI||Hon^Albert^^^^^L|Adams^^^^^^L|19610101|M|||15 N Saguaro^^Tucson^AZ^85701\n"
            + "PV1||I|ICU^2^23\n"
            + "OBR|1|||44616-1^Pulse oximetry panel ^LN|||20120512031234||||||||||||||||||F|||||||||||||||||||252465000^Pulse oximetry^SCT|7087005^Intermittent^SCT\n"
            + "NTE|1||This comment refers to all the results in the battery\n"
            + "OBX||||||35-125||99||R|||20120530112340|||AMEAS^auto-measurement^MDC|0123456789ABCDEF^Pulse_Oximeter_Vendor_X^0123456789ABCDEF^EUI-64||49521004^left ear structure^SCT\n"
            + "NTE|1||This is a comment about pulse";

    String response = minaTemplate.requestBody((Object) invalidHL7Input, String.class);

    Parser parser = new PipeParser();
    ACK responseMessage = (ACK) parser.parse(response);

    assertEquals(
        AcknowledgmentCode.AR.name(), responseMessage.getMSA().getAcknowledgmentCode().getValue());
  }