Search in sources :

Example 1 with ParticipantTypeEnum

use of ca.uhn.fhir.model.dstu2.valueset.ParticipantTypeEnum in project eCRNow by drajer-health.

the class Dstu2CdaFhirUtilities method getPractitioner.

public static Practitioner getPractitioner(List<Entry> entries, Encounter en) {
    List<Participant> participants = en.getParticipant();
    if (participants != null && participants.size() > 0) {
        for (Participant part : participants) {
            if (part.getIndividual().getReference().hasIdPart()) {
                logger.info(" Individual is present ");
                List<BoundCodeableConceptDt<ParticipantTypeEnum>> types = part.getType();
                for (BoundCodeableConceptDt<ParticipantTypeEnum> conc : types) {
                    List<CodingDt> typeCodes = conc.getCoding();
                    for (CodingDt cd : typeCodes) {
                        if (cd.getCode().contentEquals(ParticipantTypeEnum.PPRF.getCode())) {
                            // Found the participant.
                            // Look for the Practitioner.
                            Entry ent = getResourceEntryForId(part.getIndividual().getReference().getIdPart(), "Practitioner", entries);
                            if (ent != null) {
                                logger.info(" Found Practitioner for Id " + part.getIndividual().getReference().getIdPart());
                                return (Practitioner) ent.getResource();
                            } else {
                                logger.info(" Did not find the practitioner for : " + part.getIndividual().getReference().getIdPart());
                            }
                        }
                    }
                }
            }
        }
    }
    logger.info(" Did not find the practitioner for encounter ");
    return null;
}
Also used : Practitioner(ca.uhn.fhir.model.dstu2.resource.Practitioner) Entry(ca.uhn.fhir.model.dstu2.resource.Bundle.Entry) Participant(ca.uhn.fhir.model.dstu2.resource.Encounter.Participant) ParticipantTypeEnum(ca.uhn.fhir.model.dstu2.valueset.ParticipantTypeEnum) CodingDt(ca.uhn.fhir.model.dstu2.composite.CodingDt) BoundCodeableConceptDt(ca.uhn.fhir.model.dstu2.composite.BoundCodeableConceptDt)

Aggregations

BoundCodeableConceptDt (ca.uhn.fhir.model.dstu2.composite.BoundCodeableConceptDt)1 CodingDt (ca.uhn.fhir.model.dstu2.composite.CodingDt)1 Entry (ca.uhn.fhir.model.dstu2.resource.Bundle.Entry)1 Participant (ca.uhn.fhir.model.dstu2.resource.Encounter.Participant)1 Practitioner (ca.uhn.fhir.model.dstu2.resource.Practitioner)1 ParticipantTypeEnum (ca.uhn.fhir.model.dstu2.valueset.ParticipantTypeEnum)1