예제 #1
0
  public static PRPAMT201306UV02ParameterList ExtractHL7QueryParamsFromMessage(
      org.hl7.v3.PRPAIN201305UV02 message) {
    log.debug("Entering HL7Parser201305.ExtractHL7QueryParamsFromMessage method...");
    PRPAMT201306UV02ParameterList queryParamList = null;

    if (message == null) {
      log.warn("input message was null, no query parameters present in message");
      return null;
    }

    PRPAIN201305UV02QUQIMT021001UV01ControlActProcess controlActProcess =
        message.getControlActProcess();
    if (controlActProcess == null) {
      log.info("controlActProcess is null - no query parameters present in message");
      return null;
    }

    if (controlActProcess.getQueryByParameter() != null
        && controlActProcess.getQueryByParameter().getValue() != null) {
      PRPAMT201306UV02QueryByParameter queryParams =
          (PRPAMT201306UV02QueryByParameter) controlActProcess.getQueryByParameter().getValue();

      if (queryParams.getParameterList() != null) {
        queryParamList = queryParams.getParameterList();
      }
    }

    log.debug("Exiting HL7Parser201305.ExtractHL7QueryParamsFromMessage method...");
    return queryParamList;
  }
  public org.hl7.v3.PRPAIN201306UV02 proxyPRPAIN201305UV(
      org.hl7.v3.PRPAIN201305UV02 body, WebServiceContext context) {
    PRPAIN201306UV02 response = null;
    ProxyPRPAIN201305UVProxyRequestType request = new ProxyPRPAIN201305UVProxyRequestType();

    request.setPRPAIN201305UV02(body);
    request.setAssertion(SamlTokenExtractor.GetAssertion(context));

    String homeCommunityId = null;
    if (body != null
        && NullChecker.isNotNullish(body.getReceiver())
        && body.getReceiver().get(0) != null
        && body.getReceiver().get(0).getDevice() != null
        && body.getReceiver().get(0).getDevice().getAsAgent() != null
        && body.getReceiver().get(0).getDevice().getAsAgent().getValue() != null
        && body.getReceiver()
                .get(0)
                .getDevice()
                .getAsAgent()
                .getValue()
                .getRepresentedOrganization()
            != null
        && body.getReceiver()
                .get(0)
                .getDevice()
                .getAsAgent()
                .getValue()
                .getRepresentedOrganization()
                .getValue()
            != null
        && NullChecker.isNotNullish(
            body.getReceiver()
                .get(0)
                .getDevice()
                .getAsAgent()
                .getValue()
                .getRepresentedOrganization()
                .getValue()
                .getId())
        && body.getReceiver()
                .get(0)
                .getDevice()
                .getAsAgent()
                .getValue()
                .getRepresentedOrganization()
                .getValue()
                .getId()
                .get(0)
            != null
        && NullChecker.isNotNullish(
            body.getReceiver()
                .get(0)
                .getDevice()
                .getAsAgent()
                .getValue()
                .getRepresentedOrganization()
                .getValue()
                .getId()
                .get(0)
                .getRoot())) {
      homeCommunityId =
          body.getReceiver()
              .get(0)
              .getDevice()
              .getAsAgent()
              .getValue()
              .getRepresentedOrganization()
              .getValue()
              .getId()
              .get(0)
              .getRoot();
    } else {
      homeCommunityId = SamlTokenExtractorHelper.getHomeCommunityId();
    }

    if (NullChecker.isNotNullish(homeCommunityId)) {
      NhincProxyPatientDiscovery service = new NhincProxyPatientDiscovery();
      NhincProxyPatientDiscoveryPortType port = service.getNhincProxyPatientDiscoveryPort();
      ((javax.xml.ws.BindingProvider) port)
          .getRequestContext()
          .put(
              javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
              SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, SERVICE_NAME));

      response = port.proxyPRPAIN201305UV(request);
    } else {
      response = null;
    }
    return response;
  }
  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;
  }
  protected HomeCommunityType getHomeCommunityFrom201306(PRPAIN201305UV02 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;
  }