use of ca.uhn.fhir.model.dstu2.composite.BoundCodeableConceptDt 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;
}
Aggregations