Search in sources :

Example 1 with ContactPointDt

use of ca.uhn.fhir.model.dstu2.composite.ContactPointDt in project eCRNow by drajer-health.

the class Dstu2CdaHeaderGenerator method getOrganizationXml.

public static String getOrganizationXml(Organization org, LaunchDetails details) {
    StringBuilder sb = new StringBuilder(200);
    if (org != null) {
        IdentifierDt id = org.getIdentifierFirstRep();
        if (id != null && !id.isEmpty()) {
            sb.append(CdaGeneratorUtils.getXmlForII(details.getAssigningAuthorityId(), id.getValue()));
        } else {
            sb.append(CdaGeneratorUtils.getXmlForII(details.getAssigningAuthorityId(), org.getId().getValue()));
        }
        sb.append(CdaGeneratorUtils.getXmlForText(CdaGeneratorConstants.NAME_EL_NAME, org.getName()));
        sb.append(Dstu2CdaFhirUtilities.getTelecomXml(org.getTelecom()));
        sb.append(Dstu2CdaFhirUtilities.getAddressXml(org.getAddress()));
    } else {
        // ***************
        // NOTE : THIS IS TEMPORARY --------
        // For Connectathon testing add defaults, this needs to be removed after connectathon and
        // replaced with the commented out code.
        // ***************
        sb.append(CdaGeneratorUtils.getXmlForII(details.getAssigningAuthorityId(), "UtahOutpatientClinic"));
        sb.append(CdaGeneratorUtils.getXmlForText(CdaGeneratorConstants.NAME_EL_NAME, "Utah Outpatient Clinic"));
        List<ContactPointDt> cps = new ArrayList<ContactPointDt>();
        ContactPointDt cp = new ContactPointDt();
        cp.setSystem(ContactPointSystemEnum.PHONE);
        cp.setUse(ContactPointUseEnum.HOME);
        cp.setValue("5557770123");
        cps.add(cp);
        sb.append(Dstu2CdaFhirUtilities.getTelecomXml(cps));
        List<AddressDt> addrs = new ArrayList<AddressDt>();
        AddressDt addr = new AddressDt();
        List<StringDt> addrLine = new ArrayList<StringDt>();
        addrLine.add(new StringDt("0987 Facility Drive"));
        addr.setLine(addrLine);
        addr.setCity("alt Lake City");
        addr.setState("UT");
        addr.setCountry("US");
        addr.setPostalCode("84101");
        addr.setUse(AddressUseEnum.WORK);
        addrs.add(addr);
        sb.append(Dstu2CdaFhirUtilities.getAddressXml(addrs));
    /* sb.append(CdaGeneratorUtils.getNFXMLForII(CdaGeneratorConstants.NF_NI));
      sb.append(CdaGeneratorUtils.getXmlForText(CdaGeneratorConstants.NAME_EL_NAME, CdaGeneratorConstants.UNKNOWN_VALUE));

      List<ContactPointDt> cps = null;
      sb.append(CdaFhirUtilities.getTelecomXml(cps));

      List<AddressDt> addrs = null;
      sb.append(CdaFhirUtilities.getAddressXml(addrs)); */
    }
    return sb.toString();
}
Also used : IdentifierDt(ca.uhn.fhir.model.dstu2.composite.IdentifierDt) AddressDt(ca.uhn.fhir.model.dstu2.composite.AddressDt) ArrayList(java.util.ArrayList) StringDt(ca.uhn.fhir.model.primitive.StringDt) ContactPointDt(ca.uhn.fhir.model.dstu2.composite.ContactPointDt)

Example 2 with ContactPointDt

use of ca.uhn.fhir.model.dstu2.composite.ContactPointDt in project synthea by synthetichealth.

the class FhirDstu2 method provider.

/**
 * Map the Provider into a FHIR Organization resource, and add it to the given Bundle.
 *
 * @param bundle
 *          The Bundle to add to
 * @param provider
 *          The Provider
 * @return The added Entry
 */
protected static Entry provider(Bundle bundle, Provider provider) {
    ca.uhn.fhir.model.dstu2.resource.Organization organizationResource = new ca.uhn.fhir.model.dstu2.resource.Organization();
    CodeableConceptDt organizationType = mapCodeToCodeableConcept(new Code("http://hl7.org/fhir/ValueSet/organization-type", "prov", "Healthcare Provider"), "Healthcare Provider");
    organizationResource.addIdentifier().setSystem("https://github.com/synthetichealth/synthea").setValue((String) provider.getResourceID());
    organizationResource.setName(provider.name);
    organizationResource.setType(organizationType);
    AddressDt address = new AddressDt().addLine(provider.address).setCity(provider.city).setPostalCode(provider.zip).setState(provider.state);
    if (COUNTRY_CODE != null) {
        address.setCountry(COUNTRY_CODE);
    }
    organizationResource.addAddress(address);
    if (provider.phone != null && !provider.phone.isEmpty()) {
        ContactPointDt contactPoint = new ContactPointDt().setSystem(ContactPointSystemEnum.PHONE).setValue(provider.phone);
        organizationResource.addTelecom(contactPoint);
    }
    return newEntry(bundle, organizationResource, provider.getResourceID());
}
Also used : Organization(ca.uhn.fhir.model.dstu2.resource.Organization) Organization(ca.uhn.fhir.model.dstu2.resource.Organization) CodeableConceptDt(ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt) AddressDt(ca.uhn.fhir.model.dstu2.composite.AddressDt) ContactPointDt(ca.uhn.fhir.model.dstu2.composite.ContactPointDt) Code(org.mitre.synthea.world.concepts.HealthRecord.Code)

Example 3 with ContactPointDt

use of ca.uhn.fhir.model.dstu2.composite.ContactPointDt in project eCRNow by drajer-health.

the class Dstu2CdaFhirUtilities method getTelecomXml.

public static String getTelecomXml(List<ContactPointDt> tels) {
    StringBuilder telString = new StringBuilder(200);
    if (tels != null && tels.size() > 0) {
        for (ContactPointDt tel : tels) {
            if (tel.getSystem() != null && tel.getSystemElement().getValueAsEnum() == ContactPointSystemEnum.PHONE && !StringUtils.isEmpty(tel.getValue())) {
                logger.info(" Found Telcom Number ");
                telString.append(CdaGeneratorUtils.getXmlForTelecom(CdaGeneratorConstants.TEL_EL_NAME, tel.getValue(), CdaGeneratorConstants.getCodeForTelecomUse(tel.getUse())));
                break;
            }
        }
    } else {
        logger.info(" Did not find the Telecom ");
        telString.append(CdaGeneratorUtils.getXmlForNFText(CdaGeneratorConstants.TEL_EL_NAME, CdaGeneratorConstants.NF_NI));
    }
    return telString.toString();
}
Also used : ContactPointDt(ca.uhn.fhir.model.dstu2.composite.ContactPointDt)

Example 4 with ContactPointDt

use of ca.uhn.fhir.model.dstu2.composite.ContactPointDt in project eCRNow by drajer-health.

the class Dstu2CdaFhirUtilities method getEmailXml.

public static String getEmailXml(List<ContactPointDt> tels) {
    StringBuilder telString = new StringBuilder(200);
    if (tels != null && tels.size() > 0) {
        for (ContactPointDt tel : tels) {
            if (tel.getSystem() != null && tel.getSystemElement().getValueAsEnum() == ContactPointSystemEnum.EMAIL && !StringUtils.isEmpty(tel.getValue())) {
                logger.info(" Found Email  ");
                telString.append(CdaGeneratorUtils.getXmlForTelecom(CdaGeneratorConstants.TEL_EL_NAME, tel.getValue(), CdaGeneratorConstants.getCodeForTelecomUse(tel.getUse())));
                break;
            }
        }
    } else {
        logger.info(" Did not find the Email ");
        telString.append(CdaGeneratorUtils.getXmlForNFText(CdaGeneratorConstants.TEL_EL_NAME, CdaGeneratorConstants.NF_NI));
    }
    return telString.toString();
}
Also used : ContactPointDt(ca.uhn.fhir.model.dstu2.composite.ContactPointDt)

Example 5 with ContactPointDt

use of ca.uhn.fhir.model.dstu2.composite.ContactPointDt in project eCRNow by drajer-health.

the class Dstu2CdaHeaderGenerator method getPractitionerXml.

public static String getPractitionerXml(Practitioner pr) {
    StringBuilder sb = new StringBuilder(500);
    if (pr != null) {
        IdentifierDt npi = Dstu2CdaFhirUtilities.getIdentifierForSystem(pr.getIdentifier(), CdaGeneratorConstants.FHIR_NPI_URL);
        if (npi != null) {
            sb.append(CdaGeneratorUtils.getXmlForII(CdaGeneratorConstants.AUTHOR_NPI_AA, npi.getValue()));
        } else {
            sb.append(CdaGeneratorUtils.getXmlForII(CdaGeneratorConstants.AUTHOR_NPI_AA));
        }
        sb.append(Dstu2CdaFhirUtilities.getAddressXml(pr.getAddress()));
        sb.append(Dstu2CdaFhirUtilities.getTelecomXml(pr.getTelecom()));
        sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.ASSIGNED_PERSON_EL_NAME));
        sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.NAME_EL_NAME));
        List<HumanNameDt> hns = new ArrayList<HumanNameDt>();
        hns.add(pr.getName());
        sb.append(Dstu2CdaFhirUtilities.getNameXml(hns));
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.NAME_EL_NAME));
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.ASSIGNED_PERSON_EL_NAME));
    } else {
        sb.append(CdaGeneratorUtils.getXmlForII(CdaGeneratorConstants.AUTHOR_NPI_AA));
        List<AddressDt> addrs = null;
        sb.append(Dstu2CdaFhirUtilities.getAddressXml(addrs));
        List<ContactPointDt> cps = null;
        sb.append(Dstu2CdaFhirUtilities.getTelecomXml(cps));
        sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.ASSIGNED_PERSON_EL_NAME));
        sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.NAME_EL_NAME));
        List<HumanNameDt> hns = null;
        sb.append(Dstu2CdaFhirUtilities.getNameXml(hns));
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.NAME_EL_NAME));
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.ASSIGNED_PERSON_EL_NAME));
    }
    return sb.toString();
}
Also used : HumanNameDt(ca.uhn.fhir.model.dstu2.composite.HumanNameDt) IdentifierDt(ca.uhn.fhir.model.dstu2.composite.IdentifierDt) AddressDt(ca.uhn.fhir.model.dstu2.composite.AddressDt) ArrayList(java.util.ArrayList) ContactPointDt(ca.uhn.fhir.model.dstu2.composite.ContactPointDt)

Aggregations

ContactPointDt (ca.uhn.fhir.model.dstu2.composite.ContactPointDt)5 AddressDt (ca.uhn.fhir.model.dstu2.composite.AddressDt)3 IdentifierDt (ca.uhn.fhir.model.dstu2.composite.IdentifierDt)2 ArrayList (java.util.ArrayList)2 CodeableConceptDt (ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt)1 HumanNameDt (ca.uhn.fhir.model.dstu2.composite.HumanNameDt)1 Organization (ca.uhn.fhir.model.dstu2.resource.Organization)1 StringDt (ca.uhn.fhir.model.primitive.StringDt)1 Code (org.mitre.synthea.world.concepts.HealthRecord.Code)1