Пример #1
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;
  }
  private static II extractPatientIdentifier(PRPAIN201305UV02 message) {
    II ii = null;
    String assigningAuthority = null;

    if (message != null
        && message.getControlActProcess() != null
        && NullChecker.isNotNullish(message.getControlActProcess().getAuthorOrPerformer())
        && message.getControlActProcess().getAuthorOrPerformer().get(0) != null
        && message.getControlActProcess().getAuthorOrPerformer().get(0).getAssignedDevice() != null
        && message
                .getControlActProcess()
                .getAuthorOrPerformer()
                .get(0)
                .getAssignedDevice()
                .getValue()
            != null
        && NullChecker.isNotNullish(
            message
                .getControlActProcess()
                .getAuthorOrPerformer()
                .get(0)
                .getAssignedDevice()
                .getValue()
                .getId())
        && message
                .getControlActProcess()
                .getAuthorOrPerformer()
                .get(0)
                .getAssignedDevice()
                .getValue()
                .getId()
                .get(0)
            != null
        && NullChecker.isNotNullish(
            message
                .getControlActProcess()
                .getAuthorOrPerformer()
                .get(0)
                .getAssignedDevice()
                .getValue()
                .getId()
                .get(0)
                .getRoot())) {
      assigningAuthority =
          message
              .getControlActProcess()
              .getAuthorOrPerformer()
              .get(0)
              .getAssignedDevice()
              .getValue()
              .getId()
              .get(0)
              .getRoot();
    }

    if ((message != null)
        && (message.getControlActProcess() != null)
        && (message.getControlActProcess().getQueryByParameter() != null)) {
      JAXBElement<PRPAMT201306UV02QueryByParameter> queryParam =
          message.getControlActProcess().getQueryByParameter();
      PRPAMT201306UV02QueryByParameter queryParam201306 = queryParam.getValue();
      if (queryParam201306.getParameterList() != null
          && queryParam201306.getParameterList().getLivingSubjectId() != null) {
        List<PRPAMT201306UV02LivingSubjectId> livingSubjectIdList =
            queryParam201306.getParameterList().getLivingSubjectId();
        if (NullChecker.isNotNullish(livingSubjectIdList)) {
          for (PRPAMT201306UV02LivingSubjectId livingSubId : livingSubjectIdList) {
            for (II id : livingSubId.getValue()) {
              if (id != null
                  && NullChecker.isNotNullish(id.getExtension())
                  && NullChecker.isNotNullish(id.getRoot())
                  && id.getRoot().equalsIgnoreCase(assigningAuthority)) {
                ii = id;

                // Break out of the inner loop
                break;
              }
            }

            // If the id was found break out of the outer loop
            if (ii != null) {
              break;
            }
          }
        }
      }
    }
    return ii;
  }