コード例 #1
0
  @Test
  public void testObx5WithExpectedComponentUnpexpectedSubcomponentWithinPrimitive2()
      throws HL7Exception {

    // Message is stripped down
    String msgString =
        "MSH|^~\\&\r" // -
            + "OBR|\r" // -
            + "OBX||ST|||F1C1&F1C2\r";

    ORU_R01 msg = new ORU_R01();
    msg.getParser().getParserConfiguration().setEscapeSubcomponentDelimiterInPrimitive(true);
    msg.parse(msgString);

    String encode = msg.encode();
    ourLog.debug("\n\n" + encode);

    Varies observationValue =
        msg.getPATIENT_RESULT(0)
            .getORDER_OBSERVATION(0)
            .getOBSERVATION()
            .getOBX()
            .getObx5_ObservationValue(0);
    ST obx5 = (ST) observationValue.getData();
    assertEquals("F1C1&F1C2", obx5.getValue());

    String expected =
        "MSH|^~\\&\r" // -
            + "OBR|\r" // -
            + "OBX||ST|||F1C1\\T\\F1C2\r";

    assertEquals(expected.trim(), encode.trim());
  }
コード例 #2
0
  /** AD = ST, ST,... */
  @Test
  public void testObx5WithExpectedComponentUnpexpectedSubcomponentWithinPrimitive()
      throws HL7Exception {

    // Message is stripped down
    String msgString =
        "MSH|^~\\&\r" // -
            + "OBR|\r" // -
            + "OBX||ST|||F1C1&F1C2\r";

    System.setProperty(Varies.ESCAPE_SUBCOMPONENT_DELIM_IN_PRIMITIVE, "TRUE");

    ORU_R01 msg = new ORU_R01();
    msg.parse(msgString);

    String encode = msg.encode();
    ourLog.debug("\n\n" + encode);

    Varies observationValue =
        msg.getPATIENT_RESULT(0)
            .getORDER_OBSERVATION(0)
            .getOBSERVATION()
            .getOBX()
            .getObx5_ObservationValue(0);
    ST obx5 = (ST) observationValue.getData();
    assertEquals("F1C1&F1C2", obx5.getValue());

    String expected =
        "MSH|^~\\&\r" // -
            + "OBR|\r" // -
            + "OBX||ST|||F1C1\\T\\F1C2\r";

    assertEquals(expected.trim(), encode.trim());
  }