Search in sources :

Example 1 with IdentifierDt

use of ca.uhn.fhir.model.dstu2.composite.IdentifierDt in project cqf-ruler by DBCG.

the class CompositionBuilder method initializeDstu2.

@Override
protected void initializeDstu2(T theResource) {
    super.initializeDstu2(theResource);
    ca.uhn.fhir.model.dstu2.resource.Composition composition = (ca.uhn.fhir.model.dstu2.resource.Composition) theResource;
    List<ResourceReferenceDt> author = new ArrayList<>();
    author.add(new ResourceReferenceDt(myAuthor));
    composition.setDate(new DateTimeDt(myDate)).setIdentifier(new IdentifierDt(getIdentifier().getKey(), getIdentifier().getValue())).setStatus(CompositionStatusEnum.forCode(myStatus)).setSubject(new ResourceReferenceDt(mySubject)).setTitle(myTitle).setType(new CodeableConceptDt().addCoding(new CodingDt().setSystem(getTypeSetting().getSystem()).setCode(getTypeSetting().getCode()).setDisplay(getTypeSetting().getDisplay()))).setAuthor(author).setCustodian(new ResourceReferenceDt(myCustodian));
}
Also used : IdentifierDt(ca.uhn.fhir.model.dstu2.composite.IdentifierDt) ResourceReferenceDt(ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt) CodeableConceptDt(ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt) ArrayList(java.util.ArrayList) DateTimeDt(ca.uhn.fhir.model.primitive.DateTimeDt) CodingDt(ca.uhn.fhir.model.dstu2.composite.CodingDt)

Example 2 with IdentifierDt

use of ca.uhn.fhir.model.dstu2.composite.IdentifierDt in project cqf-ruler by DBCG.

the class DetectedIssueBuilder method initializeDstu2.

@Override
protected void initializeDstu2(T theResource) {
    super.initializeDstu2(theResource);
    ca.uhn.fhir.model.dstu2.resource.DetectedIssue detectedIssue = (ca.uhn.fhir.model.dstu2.resource.DetectedIssue) theResource;
    detectedIssue.setIdentifier(new IdentifierDt(getIdentifier().getKey(), getIdentifier().getValue())).setPatient(new ResourceReferenceDt(myPatient));
    getEvidenceDetails().forEach(detectedIssue::setReference);
}
Also used : IdentifierDt(ca.uhn.fhir.model.dstu2.composite.IdentifierDt) ResourceReferenceDt(ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt)

Example 3 with IdentifierDt

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

the class Dstu2CdaHeaderGenerator method getEncompassingEncounter.

public static String getEncompassingEncounter(Encounter en, Practitioner pr, Location loc, Organization org, LaunchDetails details) {
    StringBuilder sb = new StringBuilder(2000);
    sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.COMPONENT_OF_EL_NAME));
    sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.ENCOMPASSING_ENC_EL_NAME));
    if (en != null) {
        sb.append(CdaGeneratorUtils.getXmlForII(details.getAssigningAuthorityId(), en.getId().getIdPart()));
        // Add all the encounter identifiers to the Ids
        List<IdentifierDt> ids = en.getIdentifier();
        if (ids != null) {
            for (IdentifierDt id : ids) {
                if (id.getSystem() != null && id.getValue() != null) {
                    sb.append(CdaGeneratorUtils.getXmlForII(CdaGeneratorUtils.getRootOid(id.getSystem(), details.getAssigningAuthorityId()), id.getValue()));
                }
            }
        }
        sb.append(Dstu2CdaFhirUtilities.getCodeableConceptXml(en.getType(), CdaGeneratorConstants.CODE_EL_NAME, false));
        sb.append(Dstu2CdaFhirUtilities.getPeriodXml(en.getPeriod(), CdaGeneratorConstants.EFF_TIME_EL_NAME));
    } else {
        sb.append(CdaGeneratorUtils.getXmlForIIUsingGuid());
        sb.append(CdaGeneratorUtils.getXmlForNullCD(CdaGeneratorConstants.CODE_EL_NAME, CdaGeneratorConstants.NF_NI));
        sb.append(CdaGeneratorUtils.getXmlForNullEffectiveTime(CdaGeneratorConstants.EFF_TIME_EL_NAME, CdaGeneratorConstants.NF_NI));
    }
    sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.RESP_PARTY_EL_NAME));
    sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.ASSIGNED_ENTITY_EL_NAME));
    sb.append(getPractitionerXml(pr));
    sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.REP_ORG_EL_NAME));
    sb.append(getOrganizationXml(org, details));
    sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.REP_ORG_EL_NAME));
    sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.ASSIGNED_ENTITY_EL_NAME));
    sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.RESP_PARTY_EL_NAME));
    sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.LOCATION_EL_NAME));
    sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.HEALTHCARE_FACILITY_EL_NAME));
    sb.append(getLocationXml(loc));
    sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.SERVICE_PROVIDER_ORG_EL_NAME));
    sb.append(getOrganizationXml(org, details));
    sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.SERVICE_PROVIDER_ORG_EL_NAME));
    sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.HEALTHCARE_FACILITY_EL_NAME));
    sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.LOCATION_EL_NAME));
    sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.ENCOMPASSING_ENC_EL_NAME));
    sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.COMPONENT_OF_EL_NAME));
    return sb.toString();
}
Also used : IdentifierDt(ca.uhn.fhir.model.dstu2.composite.IdentifierDt)

Example 4 with IdentifierDt

use of ca.uhn.fhir.model.dstu2.composite.IdentifierDt 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 5 with IdentifierDt

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

the class Dstu2CdaHeaderGenerator method getPatientDetails.

public static String getPatientDetails(Dstu2FhirData data, Patient p, LaunchDetails details) {
    StringBuilder patientDetails = new StringBuilder();
    patientDetails.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.RECORD_TARGET_EL_NAME));
    patientDetails.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.PATIENT_ROLE_EL_NAME));
    IdentifierDt id = Dstu2CdaFhirUtilities.getIdentifierForType(p.getIdentifier(), IdentifierTypeCodesEnum.MR);
    if (id != null) {
        if (!StringUtils.isEmpty(id.getSystem()) && !StringUtils.isEmpty(id.getValue())) {
            logger.info(" Found Identifier with Type MR ");
            String system = CdaGeneratorUtils.getRootOid(id.getSystem(), details.getAssigningAuthorityId());
            patientDetails.append(CdaGeneratorUtils.getXmlForII(system, id.getValue()));
        } else {
            logger.info(" Using Resource Identifier as id ");
            ;
            patientDetails.append(CdaGeneratorUtils.getXmlForII(details.getAssigningAuthorityId(), p.getId().toString()));
        }
    } else {
        logger.info(" Using Resource Identifier as id ");
        ;
        patientDetails.append(CdaGeneratorUtils.getXmlForII(details.getAssigningAuthorityId(), p.getId().toString()));
    }
    // Add Address.
    patientDetails.append(Dstu2CdaFhirUtilities.getAddressXml(p.getAddress()));
    // Add Telecom
    patientDetails.append(Dstu2CdaFhirUtilities.getTelecomXml(p.getTelecom()));
    // Add patient
    patientDetails.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.PATIENT_EL_NAME));
    patientDetails.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.NAME_EL_NAME));
    patientDetails.append(Dstu2CdaFhirUtilities.getNameXml(p.getName()));
    patientDetails.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.NAME_EL_NAME));
    patientDetails.append(Dstu2CdaFhirUtilities.getGenderXml(p.getGenderElement()));
    patientDetails.append(Dstu2CdaFhirUtilities.getDateTypeXml(p.getBirthDateElement(), CdaGeneratorConstants.BIRTH_TIME_EL_NAME));
    if (p.getDeceased() == null || (p.getDeceased() != null && p.getDeceased().isEmpty())) {
        patientDetails.append(CdaGeneratorUtils.getXmlForValue(CdaGeneratorConstants.SDTC_DECEASED_IND, CdaGeneratorConstants.CCDA_FALSE));
    } else {
        patientDetails.append(CdaGeneratorUtils.getXmlForValue(CdaGeneratorConstants.SDTC_DECEASED_IND, CdaGeneratorConstants.CCDA_TRUE));
        if (p.getDeceased() instanceof DateTimeDt) {
            DateTimeDt d = (DateTimeDt) p.getDeceased();
            patientDetails.append(CdaGeneratorUtils.getXmlForEffectiveTime(CdaGeneratorConstants.SDTC_DECEASED_TIME, d.getValue().toString()));
        } else {
            patientDetails.append(CdaGeneratorUtils.getXmlForNullEffectiveTime(CdaGeneratorConstants.SDTC_DECEASED_TIME, CdaGeneratorConstants.NF_NI));
        }
    }
    CodingDt race = Dstu2CdaFhirUtilities.getCodingExtension(p.getUndeclaredExtensions(), CdaGeneratorConstants.FHIR_ARGO_RACE_EXT_URL, CdaGeneratorConstants.OMB_RACE_CATEGORY_URL);
    if (race != null && race.getCode() != null) {
        patientDetails.append(CdaGeneratorUtils.getXmlForCD(CdaGeneratorConstants.RACE_CODE_EL_NAME, race.getCode(), CdaGeneratorConstants.RACE_CODE_SYSTEM, CdaGeneratorConstants.RACE_CODE_SYSTEM_NAME, race.getDisplay()));
    } else {
        patientDetails.append(CdaGeneratorUtils.getXmlForNullCD(CdaGeneratorConstants.RACE_CODE_EL_NAME, CdaGeneratorConstants.NF_NI));
    }
    CodingDt ethnicity = Dstu2CdaFhirUtilities.getCodingExtension(p.getUndeclaredExtensions(), CdaGeneratorConstants.FHIR_ARGO_ETHNICITY_EXT_URL, CdaGeneratorConstants.OMB_RACE_CATEGORY_URL);
    if (ethnicity != null && ethnicity.getCode() != null) {
        patientDetails.append(CdaGeneratorUtils.getXmlForCD(CdaGeneratorConstants.ETHNIC_CODE_EL_NAME, ethnicity.getCode(), CdaGeneratorConstants.RACE_CODE_SYSTEM, CdaGeneratorConstants.RACE_CODE_SYSTEM_NAME, ethnicity.getDisplay()));
    } else {
        patientDetails.append(CdaGeneratorUtils.getXmlForNullCD(CdaGeneratorConstants.ETHNIC_CODE_EL_NAME, CdaGeneratorConstants.NF_NI));
    }
    // Adding Guardian details for patient
    if (p.getContact() != null && p.getContact().size() > 0) {
        // Add Guardian element
        Contact guardianContact = Dstu2CdaFhirUtilities.getGuardianContact(p.getContact());
        if (guardianContact != null) {
            patientDetails.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.GUARDIAN_EL_NAME));
            // Add Telecom
            patientDetails.append(Dstu2CdaFhirUtilities.getTelecomXml(guardianContact.getTelecom()));
            patientDetails.append(Dstu2CdaFhirUtilities.getEmailXml(guardianContact.getTelecom()));
            // Add Name
            patientDetails.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.GUARDIAN_PERSON_EL_NAME));
            patientDetails.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.NAME_EL_NAME));
            patientDetails.append(Dstu2CdaFhirUtilities.getNameXml(guardianContact.getName()));
            patientDetails.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.NAME_EL_NAME));
            patientDetails.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.GUARDIAN_PERSON_EL_NAME));
            patientDetails.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.GUARDIAN_EL_NAME));
        }
    }
    // Add language communication
    patientDetails.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.LANGUAGE_COMM_EL_NAME));
    CodingDt language = Dstu2CdaFhirUtilities.getLanguage(p.getCommunication());
    if (language != null && language.getCode() != null) {
        patientDetails.append(CdaGeneratorUtils.getXmlForCD(CdaGeneratorConstants.LANGUAGE_CODE_EL_NAME, language.getCode()));
    } else {
        patientDetails.append(CdaGeneratorUtils.getXmlForNullCD(CdaGeneratorConstants.LANGUAGE_CODE_EL_NAME, CdaGeneratorConstants.NF_NI));
    }
    patientDetails.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.LANGUAGE_COMM_EL_NAME));
    patientDetails.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.PATIENT_EL_NAME));
    patientDetails.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.PATIENT_ROLE_EL_NAME));
    patientDetails.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.RECORD_TARGET_EL_NAME));
    return patientDetails.toString();
}
Also used : IdentifierDt(ca.uhn.fhir.model.dstu2.composite.IdentifierDt) DateTimeDt(ca.uhn.fhir.model.primitive.DateTimeDt) CodingDt(ca.uhn.fhir.model.dstu2.composite.CodingDt) Contact(ca.uhn.fhir.model.dstu2.resource.Patient.Contact)

Aggregations

IdentifierDt (ca.uhn.fhir.model.dstu2.composite.IdentifierDt)9 ArrayList (java.util.ArrayList)5 AddressDt (ca.uhn.fhir.model.dstu2.composite.AddressDt)3 CodingDt (ca.uhn.fhir.model.dstu2.composite.CodingDt)3 CodeableConceptDt (ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt)2 ContactPointDt (ca.uhn.fhir.model.dstu2.composite.ContactPointDt)2 ResourceReferenceDt (ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt)2 DateTimeDt (ca.uhn.fhir.model.primitive.DateTimeDt)2 StringDt (ca.uhn.fhir.model.primitive.StringDt)2 HumanNameDt (ca.uhn.fhir.model.dstu2.composite.HumanNameDt)1 Entry (ca.uhn.fhir.model.dstu2.resource.Bundle.Entry)1 EntryRequest (ca.uhn.fhir.model.dstu2.resource.Bundle.EntryRequest)1 Encounter (ca.uhn.fhir.model.dstu2.resource.Encounter)1 Organization (ca.uhn.fhir.model.dstu2.resource.Organization)1 Contact (ca.uhn.fhir.model.dstu2.resource.Patient.Contact)1 Practitioner (ca.uhn.fhir.model.dstu2.resource.Practitioner)1 HashMap (java.util.HashMap)1