コード例 #1
0
  /** Test of BuildMessageFromMpiPatient method, of class HL7Parser201306. */
  @Test
  public void testBuildMessageFromMpiPatient() {
    System.out.println("BuildMessageFromMpiPatient");
    II subjectId = new II();
    subjectId.setRoot("2.16.840.1.113883.3.200");
    subjectId.setExtension("1234");

    String firstExpectedName = "Joe";
    String lastExpectedName = "Smith";
    String middleExpectedName = "Middle";
    String expectedTitle = "Title";
    String expectedSuffix = "Suffix";

    PRPAIN201305UV02 query =
        TestHelper.build201305(
            firstExpectedName, lastExpectedName, "M", "March 1, 1956", subjectId);

    Identifier patId = new Identifier();
    patId.setId("1234");
    patId.setOrganizationId("2.16.840.1.113883.3.200");
    Patient patient =
        TestHelper.createMpiPatient(
            firstExpectedName, lastExpectedName, middleExpectedName, "M", "March 1, 1956", patId);

    patient.getName().setSuffix(expectedSuffix);
    patient.getName().setTitle(expectedTitle);

    PRPAIN201306UV02 result = HL7Parser201306.BuildMessageFromMpiPatient(patient, query);
    // TODO review the generated test code and remove the default call to fail.

    PNExplicit pnResult =
        result
            .getControlActProcess()
            .getSubject()
            .get(0)
            .getRegistrationEvent()
            .getSubject1()
            .getPatient()
            .getPatientPerson()
            .getValue()
            .getName()
            .get(0);

    PatientName patientName = extractName(pnResult);

    assertEquals(lastExpectedName, patientName.LastName);
    assertEquals(firstExpectedName, patientName.FirstName);
    assertEquals(middleExpectedName, patientName.MiddleName);
    assertEquals(expectedTitle, patientName.Title);
    assertEquals(expectedSuffix, patientName.Suffix);
  }
コード例 #2
0
  @Test
  public void testBuildMessageFromMpiPatient_MultiPhoneNumber() {
    System.out.println("testBuildMessageFromMpiPatient_MultiPhoneNumber");
    II subjectId = new II();
    subjectId.setRoot("2.16.840.1.113883.3.200");
    subjectId.setExtension("1234");

    String firstExpectedName = "Joe";
    String lastExpectedName = "Smith";
    String middleExpectedName = "Middle";
    String expectedTitle = "Title";
    String expectedSuffix = "Suffix";

    PRPAIN201305UV02 query =
        TestHelper.build201305(
            firstExpectedName, lastExpectedName, "M", "March 1, 1956", subjectId);

    Identifier patId = new Identifier();
    patId.setId("1234");
    patId.setOrganizationId("2.16.840.1.113883.3.200");
    Patient patient =
        TestHelper.createMpiPatient(
            firstExpectedName, lastExpectedName, middleExpectedName, "M", "March 1, 1956", patId);

    patient.getName().setSuffix(expectedSuffix);
    patient.getName().setTitle(expectedTitle);

    patient.getPhoneNumbers().add(new PhoneNumber("7031231234"));
    patient.getPhoneNumbers().add(new PhoneNumber("2021231234"));

    PRPAIN201306UV02 result = HL7Parser201306.BuildMessageFromMpiPatient(patient, query);
    // TODO review the generated test code and remove the default call to fail.

    PRPAMT201310UV02Person person =
        result
            .getControlActProcess()
            .getSubject()
            .get(0)
            .getRegistrationEvent()
            .getSubject1()
            .getPatient()
            .getPatientPerson()
            .getValue();

    assertEquals(2, person.getTelecom().size());
    assertEquals("7031231234", person.getTelecom().get(0).getValue());
    assertEquals("2021231234", person.getTelecom().get(1).getValue());
  }
  private static II extractPatientIdentifier(PRPAIN201306UV02 message) {
    II ii = null;

    if (message != null
        && message.getControlActProcess() != null
        && NullChecker.isNotNullish(message.getControlActProcess().getSubject())
        && message.getControlActProcess().getSubject().get(0) != null
        && message.getControlActProcess().getSubject().get(0).getRegistrationEvent() != null
        && message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1()
            != null
        && message
                .getControlActProcess()
                .getSubject()
                .get(0)
                .getRegistrationEvent()
                .getSubject1()
                .getPatient()
            != null
        && NullChecker.isNotNullish(
            message
                .getControlActProcess()
                .getSubject()
                .get(0)
                .getRegistrationEvent()
                .getSubject1()
                .getPatient()
                .getId())
        && message
                .getControlActProcess()
                .getSubject()
                .get(0)
                .getRegistrationEvent()
                .getSubject1()
                .getPatient()
                .getId()
                .get(0)
            != null) {
      ii =
          message
              .getControlActProcess()
              .getSubject()
              .get(0)
              .getRegistrationEvent()
              .getSubject1()
              .getPatient()
              .getId()
              .get(0);
    }
    return ii;
  }
コード例 #4
0
  @Test
  public void testBuildMessageFromMpiPatient_MultiAddress() {
    System.out.println("testBuildMessageFromMpiPatient_MultiAddress");
    II subjectId = new II();
    subjectId.setRoot("2.16.840.1.113883.3.200");
    subjectId.setExtension("1234");

    String firstExpectedName = "Joe";
    String lastExpectedName = "Smith";
    String middleExpectedName = "Middle";
    String expectedTitle = "Title";
    String expectedSuffix = "Suffix";

    PRPAIN201305UV02 query =
        TestHelper.build201305(
            firstExpectedName, lastExpectedName, "M", "March 1, 1956", subjectId);

    Identifier patId = new Identifier();
    patId.setId("1234");
    patId.setOrganizationId("2.16.840.1.113883.3.200");
    Patient patient =
        TestHelper.createMpiPatient(
            firstExpectedName, lastExpectedName, middleExpectedName, "M", "March 1, 1956", patId);

    patient.getName().setSuffix(expectedSuffix);
    patient.getName().setTitle(expectedTitle);

    Address add = new Address();
    add.setCity("Chantilly");
    add.setState("VA");
    add.setStreet1("5155 Parkstone Drive");
    add.setStreet2("Att:Developer");
    add.setZip("20151");

    Address add2 = new Address();
    add2.setCity("Melbourne");
    add2.setState("FL");
    add2.setStreet1("1025 West NASA Boulevard");
    add2.setStreet2("Att:Developer");
    add2.setZip("32919-0001");

    patient.getAddresses().add(add);
    patient.getAddresses().add(add2);
    PRPAIN201306UV02 result = HL7Parser201306.BuildMessageFromMpiPatient(patient, query);
    // TODO review the generated test code and remove the default call to fail.

    PRPAMT201310UV02Person person =
        result
            .getControlActProcess()
            .getSubject()
            .get(0)
            .getRegistrationEvent()
            .getSubject1()
            .getPatient()
            .getPatientPerson()
            .getValue();

    assertEquals(2, person.getAddr().size());
    assertEquals(5, person.getAddr().get(0).getContent().size());
    assertEquals(5, person.getAddr().get(1).getContent().size());
    // assertEquals("5155 Parkstone Drive", person.getAddr().get(0).getUse().get(0));
    // assertEquals("1025 West NASA Boulevard", person.getAddr().get(1).getUse().get(0));

  }
  protected HomeCommunityType getHomeCommunityFrom201306(PRPAIN201306UV02 event) {
    HomeCommunityType senderHomeCommunity = new HomeCommunityType();

    if (event != null
        && event.getSender() != null
        && event.getSender().getDevice() != null
        && event.getSender().getDevice().getAsAgent() != null
        && event.getSender().getDevice().getAsAgent().getValue() != null
        && event.getSender().getDevice().getAsAgent().getValue().getRepresentedOrganization()
            != null
        && event
                .getSender()
                .getDevice()
                .getAsAgent()
                .getValue()
                .getRepresentedOrganization()
                .getValue()
            != null
        && NullChecker.isNotNullish(
            event
                .getSender()
                .getDevice()
                .getAsAgent()
                .getValue()
                .getRepresentedOrganization()
                .getValue()
                .getId())
        && event
                .getSender()
                .getDevice()
                .getAsAgent()
                .getValue()
                .getRepresentedOrganization()
                .getValue()
                .getId()
                .get(0)
            != null
        && NullChecker.isNotNullish(
            event
                .getSender()
                .getDevice()
                .getAsAgent()
                .getValue()
                .getRepresentedOrganization()
                .getValue()
                .getId()
                .get(0)
                .getRoot())) {
      senderHomeCommunity.setHomeCommunityId(
          event
              .getSender()
              .getDevice()
              .getAsAgent()
              .getValue()
              .getRepresentedOrganization()
              .getValue()
              .getId()
              .get(0)
              .getRoot());
    }

    return senderHomeCommunity;
  }