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;
}
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);
}
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;
}
Aggregations