Search in sources :

Example 6 with PatientInfo

use of org.hl7.gravity.refimpl.sdohexchange.info.PatientInfo in project beneficiary-fhir-data by CMSgov.

the class AbstractTransformerV2 method getContainedPatient.

protected static Patient getContainedPatient(String mbi, PatientInfo patientInfo) {
    Patient patient = new Patient().setIdentifier(List.of(new Identifier().setType(new CodeableConcept(new Coding(IdentifierType.MC.getSystem(), IdentifierType.MC.getCode(), IdentifierType.MC.getDisplay()))).setSystem(TransformerConstants.CODING_BBAPI_MEDICARE_BENEFICIARY_ID_UNHASHED).setValue(mbi)));
    patient.setId("patient");
    if (patientInfo != null) {
        patient.setName(createHumanNameFrom(patientInfo)).setBirthDate(localDateToDate(patientInfo.getDob())).setGender(patientInfo.getGender() == null ? null : genderMap().get(patientInfo.getGender().toLowerCase()));
    }
    return patient;
}
Also used : Identifier(org.hl7.fhir.r4.model.Identifier) Coding(org.hl7.fhir.r4.model.Coding) Patient(org.hl7.fhir.r4.model.Patient) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 7 with PatientInfo

use of org.hl7.gravity.refimpl.sdohexchange.info.PatientInfo in project Gravity-SDOH-Exchange-RI by FHIR.

the class PatientInfoComposer method compose.

public PatientInfo compose(String patientId) {
    Optional<Patient> foundPatient = patientRepository.find(patientId);
    if (!foundPatient.isPresent()) {
        throw new ResourceNotFoundException(patientId);
    }
    Patient patient = foundPatient.get();
    Observation employmentStatus = FhirUtil.getFromBundle(observationRepository.findPatientEmploymentStatus(patientId), Observation.class).stream().findFirst().orElse(null);
    Observation educationObservation = FhirUtil.getFromBundle(observationRepository.findPatientEducationLevel(patientId), Observation.class).stream().findFirst().orElse(null);
    Bundle payorsBundle = coverageRepository.findPatientPayors(patientId);
    List<IBaseResource> payors = new ArrayList<>();
    payors.addAll(FhirUtil.getFromBundle(payorsBundle, Organization.class));
    payors.addAll(FhirUtil.getFromBundle(payorsBundle, Patient.class));
    payors.addAll(FhirUtil.getFromBundle(payorsBundle, RelatedPerson.class));
    return new PatientInfo(patient, employmentStatus, educationObservation, payors);
}
Also used : Organization(org.hl7.fhir.r4.model.Organization) Bundle(org.hl7.fhir.r4.model.Bundle) Observation(org.hl7.fhir.r4.model.Observation) ArrayList(java.util.ArrayList) Patient(org.hl7.fhir.r4.model.Patient) PatientInfo(org.hl7.gravity.refimpl.sdohexchange.info.PatientInfo) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) RelatedPerson(org.hl7.fhir.r4.model.RelatedPerson)

Example 8 with PatientInfo

use of org.hl7.gravity.refimpl.sdohexchange.info.PatientInfo in project MobileAccessGateway by i4mi.

the class Iti65RequestConverter method transformReferenceToPatientInfo.

/**
 * FHIR Reference to Patient -> XDS PatientInfo
 * @param ref
 * @param container
 * @return
 */
public PatientInfo transformReferenceToPatientInfo(Reference ref, DomainResource container) {
    if (ref == null)
        return null;
    if (!ref.hasReference())
        return null;
    List<Resource> resources = container.getContained();
    for (Resource resource : resources) {
        String targetRef = ref.getReference();
        if (targetRef.equals(resource.getId())) {
            Patient patient = ((Patient) resource);
            PatientInfo patientInfo = new PatientInfo();
            patientInfo.setDateOfBirth(timestampFromDate(patient.getBirthDateElement()));
            Enumerations.AdministrativeGender gender = patient.getGender();
            if (gender != null) {
                switch(gender) {
                    case MALE:
                        patientInfo.setGender("M");
                        break;
                    case FEMALE:
                        patientInfo.setGender("F");
                        break;
                    case OTHER:
                        patientInfo.setGender("A");
                        break;
                    default:
                        patientInfo.setGender("U");
                        break;
                }
            }
            for (HumanName name : patient.getName()) {
                patientInfo.getNames().add(transform(name));
            }
            for (Address address : patient.getAddress()) {
                patientInfo.getAddresses().add(transform(address));
            }
            for (Identifier id : patient.getIdentifier()) {
                patientInfo.getIds().add(transform(id));
            }
            return patientInfo;
        }
    }
    return null;
}
Also used : HumanName(org.hl7.fhir.r4.model.HumanName) Identifier(org.hl7.fhir.r4.model.Identifier) Address(org.hl7.fhir.r4.model.Address) Resource(org.hl7.fhir.r4.model.Resource) ListResource(org.hl7.fhir.r4.model.ListResource) DomainResource(org.hl7.fhir.r4.model.DomainResource) Patient(org.hl7.fhir.r4.model.Patient) PatientInfo(org.openehealth.ipf.commons.ihe.xds.core.metadata.PatientInfo) LocalizedString(org.openehealth.ipf.commons.ihe.xds.core.metadata.LocalizedString) Enumerations(org.hl7.fhir.r4.model.Enumerations)

Aggregations

Patient (org.hl7.fhir.r4.model.Patient)7 Identifier (org.hl7.fhir.r4.model.Identifier)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Coding (org.hl7.fhir.r4.model.Coding)4 Optional (java.util.Optional)3 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)3 Extension (org.hl7.fhir.r4.model.Extension)3 Organization (org.hl7.fhir.r4.model.Organization)3 Reference (org.hl7.fhir.r4.model.Reference)3 Resource (org.hl7.fhir.r4.model.Resource)3 MetricRegistry (com.codahale.metrics.MetricRegistry)2 Timer (com.codahale.metrics.Timer)2 Trace (com.newrelic.api.agent.Trace)2 PreAdjFissClaim (gov.cms.bfd.model.rda.PreAdjFissClaim)2 PreAdjFissPayer (gov.cms.bfd.model.rda.PreAdjFissPayer)2 BBCodingSystems (gov.cms.bfd.server.war.commons.BBCodingSystems)2 C4BBIdentifierType (gov.cms.bfd.server.war.commons.carin.C4BBIdentifierType)2 AbstractTransformerV2 (gov.cms.bfd.server.war.r4.providers.preadj.common.AbstractTransformerV2)2 BadCodeMonkeyException (gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException)2