Search in sources :

Example 1 with Address

use of org.hl7.fhir.r4b.model.Address in project gpconnect-demonstrator by nhsconnect.

the class LocationResourceProvider method createAddress.

/**
 * Some of the assignments look rather odd but they are deliberate.
 * They result from a change to spec to remove the state attribute from the address
 * See the commit cd26528 by James Cox 6/3/18 see also OrganizationResourceProvider.getValidAddress
 * @param locationDetails
 * @return Address Resource
 */
private Address createAddress(LocationDetails locationDetails) {
    Address address = new Address();
    List<StringType> list = new LinkedList<>();
    list.add(new StringType(locationDetails.getAddressLine()));
    list.add(new StringType(locationDetails.getAddressCity()));
    address.setLine(list);
    address.setCity(locationDetails.getAddressDistrict());
    address.setDistrict(locationDetails.getAddressState());
    address.setPostalCode(locationDetails.getAddressPostalCode());
    address.setCountry(locationDetails.getAddressCountry());
    return address;
}
Also used : Address(org.hl7.fhir.dstu3.model.Address) StringType(org.hl7.fhir.dstu3.model.StringType) LinkedList(java.util.LinkedList)

Example 2 with Address

use of org.hl7.fhir.r4b.model.Address in project gpconnect-demonstrator by nhsconnect.

the class PatientResourceProvider method createContact.

// patientDetailsToMinimalPatient
/**
 * add a set of contact details into the patient record NB these are
 * Contacts (related people etc) not contactpoints (telecoms)
 *
 * @param patient fhirResource object
 */
private void createContact(Patient patient) {
    // relationships
    Patient.ContactComponent contact = new ContactComponent();
    for (String relationship : new String[] { "Emergency contact", "Next of kin", "Daughter" }) {
        CodeableConcept crelationship = new CodeableConcept();
        crelationship.setText(relationship);
        contact.addRelationship(crelationship);
    }
    // contact address
    Address address = new Address();
    address.addLine("Trevelyan Square");
    address.addLine("Boar Ln");
    address.setPostalCode("LS1 6AE");
    address.setType(AddressType.PHYSICAL);
    address.setUse(AddressUse.HOME);
    contact.setAddress(address);
    // gender
    contact.setGender(AdministrativeGender.FEMALE);
    // telecom
    ContactPoint telecom = new ContactPoint();
    telecom.setSystem(ContactPointSystem.PHONE);
    telecom.setUse(ContactPointUse.MOBILE);
    telecom.setValue("07777123123");
    contact.addTelecom(telecom);
    // Name
    HumanName name = new HumanName();
    name.addGiven("Jane");
    name.setFamily("Jackson");
    List<StringType> prefixList = new ArrayList<>();
    prefixList.add(new StringType("Miss"));
    name.setPrefix(prefixList);
    name.setText("JACKSON Jane (Miss)");
    name.setUse(NameUse.OFFICIAL);
    contact.setName(name);
    patient.addContact(contact);
}
Also used : ContactComponent(org.hl7.fhir.dstu3.model.Patient.ContactComponent) ContactComponent(org.hl7.fhir.dstu3.model.Patient.ContactComponent)

Example 3 with Address

use of org.hl7.fhir.r4b.model.Address in project gpconnect-demonstrator by nhsconnect.

the class OrganizationResourceProvider method getValidAddress.

private Address getValidAddress(Organization organization) {
    List<LocationDetails> locationsDetails = locationSearch.findAllLocations();
    LocationDetails location = null;
    for (LocationDetails locationDetails : locationsDetails) {
        if (locationDetails.getOrgOdsCode().equals(organization.getIdentifierFirstRep().getValue())) {
            location = locationDetails;
            break;
        }
    }
    Address orgAddress = null;
    if (location != null) {
        orgAddress = new Address();
        orgAddress.setUse(AddressUse.WORK);
        // #152
        // this looks very odd but is deliberate, there's a similar issue in locationResourceProvider.createAddress
        // They result from a change to spec to remove the state attribute from the address
        // See the commit cd26528 by James Cox 6/3/18
        orgAddress.addLine(location.getAddressLine());
        orgAddress.addLine(location.getAddressCity());
        orgAddress.setCity(location.getAddressDistrict());
        orgAddress.setDistrict(location.getAddressState());
        orgAddress.setPostalCode(location.getAddressPostalCode());
    }
    return orgAddress;
}
Also used : Address(org.hl7.fhir.dstu3.model.Address) LocationDetails(uk.gov.hscic.model.location.LocationDetails)

Example 4 with Address

use of org.hl7.fhir.r4b.model.Address in project wildfly-camel by wildfly-extras.

the class FhirXmlIntegrationTest method createPatient.

private Patient createPatient() {
    Patient patient = new Patient();
    patient.addName(new HumanName().addGiven("Sherlock").setFamily("Holmes")).addAddress(new Address().addLine("221b Baker St, Marylebone, London NW1 6XE, UK"));
    return patient;
}
Also used : HumanName(org.hl7.fhir.dstu3.model.HumanName) Address(org.hl7.fhir.dstu3.model.Address) Patient(org.hl7.fhir.dstu3.model.Patient)

Example 5 with Address

use of org.hl7.fhir.r4b.model.Address in project beneficiary-fhir-data by CMSgov.

the class HHAClaimTransformer method transformClaim.

/**
 * @param claimGroup the CCW {@link HHAClaim} to transform
 * @return a FHIR {@link ExplanationOfBenefit} resource that represents the specified {@link
 *     HHAClaim}
 */
private static ExplanationOfBenefit transformClaim(HHAClaim claimGroup) {
    ExplanationOfBenefit eob = new ExplanationOfBenefit();
    // Common group level fields between all claim types
    TransformerUtils.mapEobCommonClaimHeaderData(eob, claimGroup.getClaimId(), claimGroup.getBeneficiaryId(), ClaimType.HHA, claimGroup.getClaimGroupId().toPlainString(), MedicareSegment.PART_B, Optional.of(claimGroup.getDateFrom()), Optional.of(claimGroup.getDateThrough()), Optional.of(claimGroup.getPaymentAmount()), claimGroup.getFinalAction());
    TransformerUtils.mapEobWeeklyProcessDate(eob, claimGroup.getWeeklyProcessDate());
    // map eob type codes into FHIR
    TransformerUtils.mapEobType(eob, ClaimType.HHA, Optional.of(claimGroup.getNearLineRecordIdCode()), Optional.of(claimGroup.getClaimTypeCode()));
    // set the provider number which is common among several claim types
    TransformerUtils.setProviderNumber(eob, claimGroup.getProviderNumber());
    // Common group level fields between Inpatient, Outpatient Hospice, HHA and SNF
    TransformerUtils.mapEobCommonGroupInpOutHHAHospiceSNF(eob, claimGroup.getOrganizationNpi(), claimGroup.getClaimFacilityTypeCode(), claimGroup.getClaimFrequencyCode(), claimGroup.getClaimNonPaymentReasonCode(), claimGroup.getPatientDischargeStatusCode(), claimGroup.getClaimServiceClassificationTypeCode(), claimGroup.getClaimPrimaryPayerCode(), claimGroup.getAttendingPhysicianNpi(), claimGroup.getTotalChargeAmount(), claimGroup.getPrimaryPayerPaidAmount(), claimGroup.getFiscalIntermediaryNumber(), claimGroup.getFiDocumentClaimControlNumber(), claimGroup.getFiOriginalClaimControlNumber());
    for (Diagnosis diagnosis : TransformerUtils.extractDiagnoses1Thru12(claimGroup.getDiagnosisPrincipalCode(), claimGroup.getDiagnosisPrincipalCodeVersion(), claimGroup.getDiagnosis1Code(), claimGroup.getDiagnosis1CodeVersion(), claimGroup.getDiagnosis2Code(), claimGroup.getDiagnosis2CodeVersion(), claimGroup.getDiagnosis3Code(), claimGroup.getDiagnosis3CodeVersion(), claimGroup.getDiagnosis4Code(), claimGroup.getDiagnosis4CodeVersion(), claimGroup.getDiagnosis5Code(), claimGroup.getDiagnosis5CodeVersion(), claimGroup.getDiagnosis6Code(), claimGroup.getDiagnosis6CodeVersion(), claimGroup.getDiagnosis7Code(), claimGroup.getDiagnosis7CodeVersion(), claimGroup.getDiagnosis8Code(), claimGroup.getDiagnosis8CodeVersion(), claimGroup.getDiagnosis9Code(), claimGroup.getDiagnosis9CodeVersion(), claimGroup.getDiagnosis10Code(), claimGroup.getDiagnosis10CodeVersion(), claimGroup.getDiagnosis11Code(), claimGroup.getDiagnosis11CodeVersion(), claimGroup.getDiagnosis12Code(), claimGroup.getDiagnosis12CodeVersion())) TransformerUtils.addDiagnosisCode(eob, diagnosis);
    for (Diagnosis diagnosis : TransformerUtils.extractDiagnoses13Thru25(claimGroup.getDiagnosis13Code(), claimGroup.getDiagnosis13CodeVersion(), claimGroup.getDiagnosis14Code(), claimGroup.getDiagnosis14CodeVersion(), claimGroup.getDiagnosis15Code(), claimGroup.getDiagnosis15CodeVersion(), claimGroup.getDiagnosis16Code(), claimGroup.getDiagnosis16CodeVersion(), claimGroup.getDiagnosis17Code(), claimGroup.getDiagnosis17CodeVersion(), claimGroup.getDiagnosis18Code(), claimGroup.getDiagnosis18CodeVersion(), claimGroup.getDiagnosis19Code(), claimGroup.getDiagnosis19CodeVersion(), claimGroup.getDiagnosis20Code(), claimGroup.getDiagnosis20CodeVersion(), claimGroup.getDiagnosis21Code(), claimGroup.getDiagnosis21CodeVersion(), claimGroup.getDiagnosis22Code(), claimGroup.getDiagnosis22CodeVersion(), claimGroup.getDiagnosis23Code(), claimGroup.getDiagnosis23CodeVersion(), claimGroup.getDiagnosis24Code(), claimGroup.getDiagnosis24CodeVersion(), claimGroup.getDiagnosis25Code(), claimGroup.getDiagnosis25CodeVersion())) TransformerUtils.addDiagnosisCode(eob, diagnosis);
    for (Diagnosis diagnosis : TransformerUtils.extractExternalDiagnoses1Thru12(claimGroup.getDiagnosisExternalFirstCode(), claimGroup.getDiagnosisExternalFirstCodeVersion(), claimGroup.getDiagnosisExternal1Code(), claimGroup.getDiagnosisExternal1CodeVersion(), claimGroup.getDiagnosisExternal2Code(), claimGroup.getDiagnosisExternal2CodeVersion(), claimGroup.getDiagnosisExternal3Code(), claimGroup.getDiagnosisExternal3CodeVersion(), claimGroup.getDiagnosisExternal4Code(), claimGroup.getDiagnosisExternal4CodeVersion(), claimGroup.getDiagnosisExternal5Code(), claimGroup.getDiagnosisExternal5CodeVersion(), claimGroup.getDiagnosisExternal6Code(), claimGroup.getDiagnosisExternal6CodeVersion(), claimGroup.getDiagnosisExternal7Code(), claimGroup.getDiagnosisExternal7CodeVersion(), claimGroup.getDiagnosisExternal8Code(), claimGroup.getDiagnosisExternal8CodeVersion(), claimGroup.getDiagnosisExternal9Code(), claimGroup.getDiagnosisExternal9CodeVersion(), claimGroup.getDiagnosisExternal10Code(), claimGroup.getDiagnosisExternal10CodeVersion(), claimGroup.getDiagnosisExternal11Code(), claimGroup.getDiagnosisExternal11CodeVersion(), claimGroup.getDiagnosisExternal12Code(), claimGroup.getDiagnosisExternal12CodeVersion())) TransformerUtils.addDiagnosisCode(eob, diagnosis);
    if (claimGroup.getClaimLUPACode().isPresent()) {
        TransformerUtils.addInformationWithCode(eob, CcwCodebookVariable.CLM_HHA_LUPA_IND_CD, CcwCodebookVariable.CLM_HHA_LUPA_IND_CD, claimGroup.getClaimLUPACode());
    }
    if (claimGroup.getClaimReferralCode().isPresent()) {
        TransformerUtils.addInformationWithCode(eob, CcwCodebookVariable.CLM_HHA_RFRL_CD, CcwCodebookVariable.CLM_HHA_RFRL_CD, claimGroup.getClaimReferralCode());
    }
    BenefitComponent clmHhaTotVisitCntFinancial = TransformerUtils.addBenefitBalanceFinancial(eob, BenefitCategory.MEDICAL, CcwCodebookVariable.CLM_HHA_TOT_VISIT_CNT);
    clmHhaTotVisitCntFinancial.setUsed(new UnsignedIntType(claimGroup.getTotalVisitCount().intValue()));
    // Common group level fields between Inpatient, HHA, Hospice and SNF
    TransformerUtils.mapEobCommonGroupInpHHAHospiceSNF(eob, claimGroup.getCareStartDate(), Optional.empty(), Optional.empty());
    for (HHAClaimLine claimLine : claimGroup.getLines()) {
        ItemComponent item = eob.addItem();
        item.setSequence(claimLine.getLineNumber().intValue());
        item.setLocation(new Address().setState((claimGroup.getProviderStateCode())));
        if (claimLine.getRevCntr1stAnsiCd().isPresent()) {
            item.addAdjudication().setCategory(TransformerUtils.createAdjudicationCategory(CcwCodebookVariable.REV_CNTR_1ST_ANSI_CD)).setReason(TransformerUtils.createCodeableConcept(eob, CcwCodebookVariable.REV_CNTR_1ST_ANSI_CD, claimLine.getRevCntr1stAnsiCd()));
        }
        TransformerUtils.mapHcpcs(eob, item, Optional.empty(), claimLine.getHcpcsCode(), Arrays.asList(claimLine.getHcpcsInitialModifierCode(), claimLine.getHcpcsSecondModifierCode()));
        // Common item level fields between Inpatient, Outpatient, HHA, Hospice and SNF
        TransformerUtils.mapEobCommonItemRevenue(item, eob, claimLine.getRevenueCenterCode(), claimLine.getRateAmount(), claimLine.getTotalChargeAmount(), claimLine.getNonCoveredChargeAmount(), claimLine.getUnitCount(), claimLine.getNationalDrugCodeQuantity(), claimLine.getNationalDrugCodeQualifierCode(), claimLine.getRevenueCenterRenderingPhysicianNPI());
        // Common item level fields between Outpatient, HHA and Hospice
        TransformerUtils.mapEobCommonItemRevenueOutHHAHospice(item, claimLine.getRevenueCenterDate(), claimLine.getPaymentAmount());
        // set revenue center status indicator codes for the claim
        item.getRevenue().addExtension(TransformerUtils.createExtensionCoding(eob, CcwCodebookVariable.REV_CNTR_STUS_IND_CD, claimLine.getStatusCode()));
        // Common group level fields between Inpatient, HHA, Hospice and SNF
        TransformerUtils.mapEobCommonGroupInpHHAHospiceSNFCoinsurance(eob, item, claimLine.getDeductibleCoinsuranceCd());
    }
    TransformerUtils.setLastUpdated(eob, claimGroup.getLastUpdated());
    return eob;
}
Also used : Address(org.hl7.fhir.dstu3.model.Address) ItemComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent) UnsignedIntType(org.hl7.fhir.dstu3.model.UnsignedIntType) Diagnosis(gov.cms.bfd.server.war.commons.Diagnosis) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) HHAClaimLine(gov.cms.bfd.model.rif.HHAClaimLine) BenefitComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitComponent)

Aggregations

Address (org.hl7.fhir.r4.model.Address)75 Test (org.junit.Test)47 Patient (org.hl7.fhir.r4.model.Patient)30 Test (org.junit.jupiter.api.Test)30 PersonAddress (org.openmrs.PersonAddress)27 HumanName (org.hl7.fhir.r4.model.HumanName)24 Identifier (org.hl7.fhir.r4.model.Identifier)23 ArrayList (java.util.ArrayList)22 Address (org.hl7.fhir.dstu3.model.Address)22 Path (javax.ws.rs.Path)20 Produces (javax.ws.rs.Produces)20 NotImplementedException (org.apache.commons.lang3.NotImplementedException)19 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)19 Location (org.hl7.fhir.r4.model.Location)13 Organization (org.hl7.fhir.r4.model.Organization)13 InputStream (java.io.InputStream)12 IdType (org.hl7.fhir.dstu3.model.IdType)12 Patient (org.hl7.fhir.dstu3.model.Patient)12 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)12 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)12