Search in sources :

Example 61 with Identifier

use of org.hl7.fhir.r4.model.Identifier in project cqf-ruler by DBCG.

the class DetectedIssueBuilder method initializeR4.

@Override
protected void initializeR4(T theResource) {
    super.initializeR4(theResource);
    org.hl7.fhir.r4.model.DetectedIssue detectedIssue = (org.hl7.fhir.r4.model.DetectedIssue) theResource;
    List<org.hl7.fhir.r4.model.Identifier> identifier = new ArrayList<>();
    identifier.add(new org.hl7.fhir.r4.model.Identifier().setSystem(getIdentifier().getKey()).setValue(getIdentifier().getValue()));
    detectedIssue.setIdentifier(identifier).setPatient(new org.hl7.fhir.r4.model.Reference(myPatient)).setStatus(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.valueOf(myStatus)).setCode(new CodeableConcept().addCoding(new Coding().setSystem(getCodeSetting().getSystem()).setCode(getCodeSetting().getCode()).setDisplay(getCodeSetting().getDisplay())));
    getEvidenceDetails().forEach(evidence -> detectedIssue.addEvidence(new DetectedIssueEvidenceComponent().addDetail(new org.hl7.fhir.r4.model.Reference(evidence))));
}
Also used : ArrayList(java.util.ArrayList) Identifier(org.hl7.fhir.dstu2016may.model.Identifier) Coding(org.hl7.fhir.r4.model.Coding) DetectedIssueEvidenceComponent(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueEvidenceComponent) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 62 with Identifier

use of org.hl7.fhir.r4.model.Identifier in project cqf-ruler by DBCG.

the class DetectedIssueBuilder method initializeDstu2_1.

@Override
protected void initializeDstu2_1(T theResource) {
    super.initializeDstu2_1(theResource);
    org.hl7.fhir.dstu2016may.model.DetectedIssue detectedIssue = (org.hl7.fhir.dstu2016may.model.DetectedIssue) theResource;
    detectedIssue.setIdentifier(new Identifier().setSystem(getIdentifier().getKey()).setValue(getIdentifier().getValue())).setPatient(new Reference(myPatient));
    getEvidenceDetails().forEach(detectedIssue::setReference);
}
Also used : Identifier(org.hl7.fhir.dstu2016may.model.Identifier) Reference(org.hl7.fhir.dstu2016may.model.Reference)

Example 63 with Identifier

use of org.hl7.fhir.r4.model.Identifier in project cqf-ruler by DBCG.

the class ReportProvider method patientReport.

private Parameters.ParametersParameterComponent patientReport(Patient thePatient, Period thePeriod, String serverBase) {
    String patientId = thePatient.getIdElement().getIdPart();
    final Map<IIdType, IAnyResource> bundleEntries = new HashMap<>();
    bundleEntries.put(thePatient.getIdElement(), thePatient);
    ReferenceParam subjectParam = new ReferenceParam(patientId);
    search(MeasureReport.class, Searches.byParam("subject", subjectParam)).getAllResourcesTyped().forEach(measureReport -> {
        if (measureReport.getPeriod().getEnd().before(thePeriod.getStart()) || measureReport.getPeriod().getStart().after(thePeriod.getEnd())) {
            return;
        }
        bundleEntries.putIfAbsent(measureReport.getIdElement(), measureReport);
        getEvaluatedResources(measureReport).values().forEach(resource -> bundleEntries.putIfAbsent(resource.getIdElement(), resource));
    });
    Bundle patientReportBundle = new Bundle();
    patientReportBundle.setMeta(new Meta().addProfile(PATIENT_REPORT_PROFILE_URL));
    patientReportBundle.setType(Bundle.BundleType.COLLECTION);
    patientReportBundle.setTimestamp(new Date());
    patientReportBundle.setId(patientId + "-report");
    patientReportBundle.setIdentifier(new Identifier().setSystem("urn:ietf:rfc:3986").setValue("urn:uuid:" + UUID.randomUUID().toString()));
    bundleEntries.entrySet().forEach(resource -> patientReportBundle.addEntry(new Bundle.BundleEntryComponent().setResource((Resource) resource.getValue()).setFullUrl(Operations.getFullUrl(serverBase, resource.getValue().fhirType(), resource.getValue().getIdElement().getIdPart()))));
    Parameters.ParametersParameterComponent patientParameter = new Parameters.ParametersParameterComponent();
    patientParameter.setResource(patientReportBundle);
    patientParameter.setId(thePatient.getIdElement().getIdPart() + "-report");
    patientParameter.setName("return");
    return patientParameter;
}
Also used : Meta(org.hl7.fhir.r4.model.Meta) Parameters(org.hl7.fhir.r4.model.Parameters) HashMap(java.util.HashMap) Bundle(org.hl7.fhir.r4.model.Bundle) IAnyResource(org.hl7.fhir.instance.model.api.IAnyResource) Resource(org.hl7.fhir.r4.model.Resource) ReferenceParam(ca.uhn.fhir.rest.param.ReferenceParam) Date(java.util.Date) Identifier(org.hl7.fhir.r4.model.Identifier) IAnyResource(org.hl7.fhir.instance.model.api.IAnyResource) IIdType(org.hl7.fhir.instance.model.api.IIdType)

Example 64 with Identifier

use of org.hl7.fhir.r4.model.Identifier in project ipf by oehf.

the class Iti67ResourceProvider method documentReferenceSearch.

@SuppressWarnings("unused")
@Search(type = DocumentReference.class)
public IBundleProvider documentReferenceSearch(@RequiredParam(name = DocumentReference.SP_PATIENT, chainWhitelist = { "", Patient.SP_IDENTIFIER }) ReferenceParam patient, @OptionalParam(name = DocumentReference.SP_STATUS) TokenOrListParam status, @OptionalParam(name = DocumentReference.SP_IDENTIFIER) TokenParam identifier, @OptionalParam(name = DocumentReference.SP_DATE) DateRangeParam date, @OptionalParam(name = STU3_INDEXED) DateRangeParam indexed, @OptionalParam(name = DocumentReference.SP_AUTHOR, chainWhitelist = { Practitioner.SP_FAMILY, Practitioner.SP_GIVEN }) ReferenceAndListParam author, @OptionalParam(name = DocumentReference.SP_CATEGORY) TokenOrListParam category, @OptionalParam(name = STU3_CLASS) TokenOrListParam class_, @OptionalParam(name = DocumentReference.SP_TYPE) TokenOrListParam type, @OptionalParam(name = DocumentReference.SP_SETTING) TokenOrListParam setting, @OptionalParam(name = DocumentReference.SP_PERIOD) DateRangeParam period, @OptionalParam(name = DocumentReference.SP_FACILITY) TokenOrListParam facility, @OptionalParam(name = DocumentReference.SP_EVENT) TokenOrListParam event, @OptionalParam(name = DocumentReference.SP_SECURITY_LABEL) TokenOrListParam securityLabel, @OptionalParam(name = STU3_SECURITY_LABEL) TokenOrListParam label, @OptionalParam(name = DocumentReference.SP_FORMAT) TokenOrListParam format, @OptionalParam(name = DocumentReference.SP_RELATED, chainWhitelist = { "", DocumentReference.SP_IDENTIFIER }) ReferenceOrListParam related, // -> related.identifier
@OptionalParam(name = STU3_RELATED_ID) TokenOrListParam relatedId, // -> related
@OptionalParam(name = STU3_RELATED_REF) ReferenceOrListParam relatedRef, // Extension to ITI-67
@OptionalParam(name = IAnyResource.SP_RES_ID) TokenParam resourceId, @Sort SortSpec sortSpec, @IncludeParam Set<Include> includeSpec, RequestDetails requestDetails, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
    // Be graceful and accept STU3 parameters as well
    var dateParam = date != null ? date : indexed;
    var categoryParam = category != null ? category : class_;
    var securityLabelParam = securityLabel != null ? securityLabel : label;
    // Handle "related" parameters
    ReferenceOrListParam relatedParam = new ReferenceOrListParam();
    TokenOrListParam relatedIdParam = new TokenOrListParam();
    if (relatedRef != null) {
        relatedParam = relatedRef;
    } else if (relatedId != null) {
        relatedIdParam = relatedId;
    } else if (related != null) {
        related.getValuesAsQueryTokens().stream().filter(referenceParam -> !DocumentReference.SP_IDENTIFIER.equals(referenceParam.getChain())).forEach(relatedParam::addOr);
        related.getValuesAsQueryTokens().stream().filter(referenceParam -> DocumentReference.SP_IDENTIFIER.equals(referenceParam.getChain())).map(referenceParam -> referenceParam.toTokenParam(getFhirContext())).forEach(relatedIdParam::addOr);
    }
    var searchParameters = Iti67SearchParameters.builder().status(status).identifier(identifier).date(dateParam).category(categoryParam).type(type).setting(setting).period(period).facility(facility).event(event).securityLabel(securityLabelParam).format(format).related(relatedParam).relatedId(relatedIdParam)._id(resourceId).sortSpec(sortSpec).includeSpec(includeSpec).fhirContext(getFhirContext()).build();
    searchParameters.setAuthor(author);
    var patientChain = patient.getChain();
    if (Patient.SP_IDENTIFIER.equals(patientChain)) {
        searchParameters.setPatientIdentifier(patient.toTokenParam(getFhirContext()));
    } else if (patientChain == null || patientChain.isEmpty()) {
        searchParameters.setPatientReference(patient);
    }
    // Run down the route
    return requestBundleProvider(null, searchParameters, ResourceType.DocumentReference.name(), httpServletRequest, httpServletResponse, requestDetails);
}
Also used : IdParam(ca.uhn.fhir.rest.annotation.IdParam) IncludeParam(ca.uhn.fhir.rest.annotation.IncludeParam) AbstractPlainProvider(org.openehealth.ipf.commons.ihe.fhir.AbstractPlainProvider) IBundleProvider(ca.uhn.fhir.rest.api.server.IBundleProvider) IAnyResource(org.hl7.fhir.instance.model.api.IAnyResource) RequiredParam(ca.uhn.fhir.rest.annotation.RequiredParam) HttpServletRequest(javax.servlet.http.HttpServletRequest) RequestDetails(ca.uhn.fhir.rest.api.server.RequestDetails) DateRangeParam(ca.uhn.fhir.rest.param.DateRangeParam) Search(ca.uhn.fhir.rest.annotation.Search) ReferenceParam(ca.uhn.fhir.rest.param.ReferenceParam) Patient(org.hl7.fhir.r4.model.Patient) Read(ca.uhn.fhir.rest.annotation.Read) Practitioner(org.hl7.fhir.r4.model.Practitioner) ReferenceOrListParam(ca.uhn.fhir.rest.param.ReferenceOrListParam) DocumentReference(org.hl7.fhir.r4.model.DocumentReference) Sort(ca.uhn.fhir.rest.annotation.Sort) InvalidRequestException(ca.uhn.fhir.rest.server.exceptions.InvalidRequestException) HttpServletResponse(javax.servlet.http.HttpServletResponse) Set(java.util.Set) ReferenceAndListParam(ca.uhn.fhir.rest.param.ReferenceAndListParam) Include(ca.uhn.fhir.model.api.Include) IdType(org.hl7.fhir.r4.model.IdType) TokenParam(ca.uhn.fhir.rest.param.TokenParam) ResourceType(org.hl7.fhir.r4.model.ResourceType) SortSpec(ca.uhn.fhir.rest.api.SortSpec) TokenOrListParam(ca.uhn.fhir.rest.param.TokenOrListParam) OptionalParam(ca.uhn.fhir.rest.annotation.OptionalParam) TokenOrListParam(ca.uhn.fhir.rest.param.TokenOrListParam) ReferenceOrListParam(ca.uhn.fhir.rest.param.ReferenceOrListParam) Search(ca.uhn.fhir.rest.annotation.Search)

Example 65 with Identifier

use of org.hl7.fhir.r4.model.Identifier in project BridgeServer2 by Sage-Bionetworks.

the class CRCControllerTest method makeProcedureRequest.

private String makeProcedureRequest() {
    ProcedureRequest procedure = new ProcedureRequest();
    Identifier id = new Identifier();
    id.setSystem(USER_ID_VALUE_NS);
    id.setValue(TEST_USER_ID);
    Reference ref = new Reference();
    ref.setIdentifier(id);
    procedure.setSubject(ref);
    return FHIR_CONTEXT.newJsonParser().encodeResourceToString(procedure);
}
Also used : Identifier(org.hl7.fhir.dstu3.model.Identifier) Reference(org.hl7.fhir.dstu3.model.Reference) ProcedureRequest(org.hl7.fhir.dstu3.model.ProcedureRequest)

Aggregations

Identifier (org.hl7.fhir.r4.model.Identifier)212 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)143 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)125 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)116 Test (org.junit.Test)109 Test (org.junit.jupiter.api.Test)84 ArrayList (java.util.ArrayList)67 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)66 Reference (org.hl7.fhir.r4.model.Reference)57 Identifier (org.hl7.fhir.dstu3.model.Identifier)55 Patient (org.hl7.fhir.r4.model.Patient)55 Coding (org.hl7.fhir.r4.model.Coding)49 List (java.util.List)47 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)41 Practitioner (org.hl7.fhir.r4.model.Practitioner)41 Date (java.util.Date)40 Collectors (java.util.stream.Collectors)38 Resource (org.hl7.fhir.r4.model.Resource)37 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)36 InvalidRequestException (ca.uhn.fhir.rest.server.exceptions.InvalidRequestException)34