예제 #1
0
  public static String ExtractGender(PRPAMT201306UV02ParameterList params) {
    log.debug("Entering HL7Parser201305.ExtractGender method...");

    String genderCode = null;

    // Extract the gender from the query parameters - Assume only one was specified
    if (params.getLivingSubjectAdministrativeGender() != null
        && params.getLivingSubjectAdministrativeGender().size() > 0
        && params.getLivingSubjectAdministrativeGender().get(0) != null) {
      PRPAMT201306UV02LivingSubjectAdministrativeGender gender =
          params.getLivingSubjectAdministrativeGender().get(0);

      if (gender.getValue() != null
          && gender.getValue().size() > 0
          && gender.getValue().get(0) != null) {
        CE administrativeGenderCode = gender.getValue().get(0);

        log.info("Found gender in query parameters = " + administrativeGenderCode.getCode());
        genderCode = administrativeGenderCode.getCode();
      } else {
        log.info("query does not contain a gender code");
      }
    } else {
      log.info("query does not contain a gender code");
    }

    log.debug("Exiting HL7Parser201305.ExtractGender method...");
    return genderCode;
  }
예제 #2
0
  public static String ExtractBirthdate(PRPAMT201306UV02ParameterList params) {
    log.debug("Entering HL7Parser201305.ExtractBirthdate method...");

    String birthDate = null;

    // Extract the birth time from the query parameters - Assume only one was specified
    if (params.getLivingSubjectBirthTime() != null
        && params.getLivingSubjectBirthTime().size() > 0
        && params.getLivingSubjectBirthTime().get(0) != null) {
      PRPAMT201306UV02LivingSubjectBirthTime birthTime = params.getLivingSubjectBirthTime().get(0);

      if (birthTime.getValue() != null
          && birthTime.getValue().size() > 0
          && birthTime.getValue().get(0) != null) {
        IVLTSExplicit birthday = birthTime.getValue().get(0);
        log.info("Found birthTime in query parameters = " + birthday.getValue());
        birthDate = birthday.getValue();
      } else {
        log.info("message does not contain a birthtime");
      }
    } else {
      log.info("message does not contain a birthtime");
    }

    log.debug("Exiting HL7Parser201305.ExtractBirthdate method...");
    return birthDate;
  }
예제 #3
0
  public static Identifiers ExtractPersonIdentifiers(PRPAMT201306UV02ParameterList params) {
    log.debug("Entering HL7Parser201305.ExtractPersonIdentifiers method...");

    Identifiers ids = new Identifiers();
    Identifier id = new Identifier();

    if (params.getLivingSubjectId() != null
        && params.getLivingSubjectId().size() > 0
        && params.getLivingSubjectId().get(0) != null) {
      PRPAMT201306UV02LivingSubjectId livingSubjectId = params.getLivingSubjectId().get(0);

      if (livingSubjectId.getValue() != null
          && livingSubjectId.getValue().size() > 0
          && livingSubjectId.getValue().get(0) != null) {
        II subjectId = livingSubjectId.getValue().get(0);

        if (subjectId.getExtension() != null
            && subjectId.getExtension().length() > 0
            && subjectId.getRoot() != null
            && subjectId.getRoot().length() > 0) {
          id.setId(subjectId.getExtension());
          id.setOrganizationId(subjectId.getRoot());
          log.info(
              "Created id from patient identifier [organization="
                  + id.getOrganizationId()
                  + "][id="
                  + id.getId()
                  + "]");
          ids.add(id);
        } else {
          log.info("message does not contain an id");
        }
      } else {
        log.info("message does not contain an id");
      }
    } else {
      log.info("message does not contain an id");
    }

    log.debug("Exiting HL7Parser201305.ExtractPersonIdentifiers method...");
    return ids;
  }
예제 #4
0
  public static PersonName ExtractPersonName(PRPAMT201306UV02ParameterList params) {
    log.debug("Entering HL7Parser201305.ExtractPersonName method...");

    PersonName personname = new PersonName();

    // Extract the name from the query parameters - Assume only one was specified
    if (params.getLivingSubjectName() != null
        && params.getLivingSubjectName().size() > 0
        && params.getLivingSubjectName().get(0) != null) {
      PRPAMT201306UV02LivingSubjectName name = params.getLivingSubjectName().get(0);

      if (name.getValue() != null && name.getValue().size() > 0 && name.getValue().get(0) != null) {
        List<Serializable> choice = name.getValue().get(0).getContent();

        log.info("choice.size()=" + choice.size());

        Iterator<Serializable> iterSerialObjects = choice.iterator();

        String nameString = "";
        EnExplicitFamily lastname = null;
        EnExplicitGiven firstname = null;

        while (iterSerialObjects.hasNext()) {
          log.info("in iterSerialObjects.hasNext() loop");

          Serializable contentItem = iterSerialObjects.next();

          if (contentItem instanceof String) {
            log.info("contentItem is string");
            String strValue = (String) contentItem;

            if (nameString != null) {
              nameString += strValue;
            } else {
              nameString = strValue;
            }
            log.info("nameString=" + nameString);
          } else if (contentItem instanceof JAXBElement) {
            log.info("contentItem is JAXBElement");

            JAXBElement oJAXBElement = (JAXBElement) contentItem;

            if (oJAXBElement.getValue() instanceof EnExplicitFamily) {
              lastname = new EnExplicitFamily();
              lastname = (EnExplicitFamily) oJAXBElement.getValue();
              log.info("found lastname element; content=" + lastname.getContent());
            } else if (oJAXBElement.getValue() instanceof EnExplicitGiven) {
              if (firstname == null) {
                firstname = new EnExplicitGiven();
                firstname = (EnExplicitGiven) oJAXBElement.getValue();
                log.info("found firstname element; content=" + firstname.getContent());
              } else {
                // this would be where to add handle for middlename
              }
            } else {
              log.info("other name part=" + (ENXPExplicit) oJAXBElement.getValue());
            }
          } else {
            log.info("contentItem is other");
          }
        }

        // If text string in patient name, then set in name
        // else set in element.
        boolean namefound = false;
        if (lastname != null && lastname.getContent() != null) {
          personname.setLastName(lastname.getContent());
          log.info("FamilyName : " + personname.getLastName());
          namefound = true;
        }

        if (firstname != null && firstname.getContent() != null) {
          personname.setFirstName(firstname.getContent());
          log.info("GivenName : " + personname.getFirstName());
          namefound = true;
        }

        if (!namefound && !nameString.trim().contentEquals("")) {
          log.info("setting name by nameString " + nameString);
          personname.setLastName(nameString);
        }
      } else {
        log.info("message does not contain a subject name");
      }
    } else {
      log.info("message does not contain a subject name");
    }

    log.debug("Exiting HL7Parser201305.ExtractPersonName method...");
    return personname;
  }