use of org.hl7.fhir.r4.model.PractitionerRole in project synthea by synthetichealth.
the class FhirR4 method practitioner.
/**
* Map the clinician into a FHIR Practitioner resource, and add it to the given Bundle.
* @param rand Source of randomness to use when generating ids etc
* @param bundle The Bundle to add to
* @param clinician The clinician
* @return The added Entry
*/
protected static BundleEntryComponent practitioner(RandomNumberGenerator rand, Bundle bundle, Clinician clinician) {
Practitioner practitionerResource = new Practitioner();
if (USE_US_CORE_IG) {
Meta meta = new Meta();
meta.addProfile("http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner");
practitionerResource.setMeta(meta);
}
practitionerResource.addIdentifier().setSystem("http://hl7.org/fhir/sid/us-npi").setValue(clinician.npi);
practitionerResource.setActive(true);
practitionerResource.addName().setFamily((String) clinician.attributes.get(Clinician.LAST_NAME)).addGiven((String) clinician.attributes.get(Clinician.FIRST_NAME)).addPrefix((String) clinician.attributes.get(Clinician.NAME_PREFIX));
String email = (String) clinician.attributes.get(Clinician.FIRST_NAME) + "." + (String) clinician.attributes.get(Clinician.LAST_NAME) + "@example.com";
practitionerResource.addTelecom().setSystem(ContactPointSystem.EMAIL).setUse(ContactPointUse.WORK).setValue(email);
if (USE_US_CORE_IG) {
practitionerResource.getTelecomFirstRep().addExtension().setUrl("http://hl7.org/fhir/us/core/StructureDefinition/us-core-direct").setValue(new BooleanType(true));
}
Address address = new Address().addLine((String) clinician.attributes.get(Clinician.ADDRESS)).setCity((String) clinician.attributes.get(Clinician.CITY)).setPostalCode((String) clinician.attributes.get(Clinician.ZIP)).setState((String) clinician.attributes.get(Clinician.STATE));
if (COUNTRY_CODE != null) {
address.setCountry(COUNTRY_CODE);
}
practitionerResource.addAddress(address);
if (clinician.attributes.get(Person.GENDER).equals("M")) {
practitionerResource.setGender(AdministrativeGender.MALE);
} else if (clinician.attributes.get(Person.GENDER).equals("F")) {
practitionerResource.setGender(AdministrativeGender.FEMALE);
}
BundleEntryComponent practitionerEntry = newEntry(bundle, practitionerResource, clinician.getResourceID());
if (USE_US_CORE_IG) {
// generate an accompanying PractitionerRole resource
PractitionerRole practitionerRole = new PractitionerRole();
Meta meta = new Meta();
meta.addProfile("http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitionerrole");
practitionerRole.setMeta(meta);
practitionerRole.setPractitioner(new Reference().setIdentifier(new Identifier().setSystem("http://hl7.org/fhir/sid/us-npi").setValue(clinician.npi)).setDisplay(practitionerResource.getNameFirstRep().getNameAsSingleString()));
practitionerRole.setOrganization(new Reference().setIdentifier(new Identifier().setSystem(SYNTHEA_IDENTIFIER).setValue(clinician.getOrganization().getResourceID())).setDisplay(clinician.getOrganization().name));
practitionerRole.addCode(mapCodeToCodeableConcept(new Code("http://nucc.org/provider-taxonomy", "208D00000X", "General Practice"), null));
practitionerRole.addSpecialty(mapCodeToCodeableConcept(new Code("http://nucc.org/provider-taxonomy", "208D00000X", "General Practice"), null));
practitionerRole.addLocation().setIdentifier(new Identifier().setSystem(SYNTHEA_IDENTIFIER).setValue(clinician.getOrganization().getResourceLocationID())).setDisplay(clinician.getOrganization().name);
if (clinician.getOrganization().phone != null && !clinician.getOrganization().phone.isEmpty()) {
practitionerRole.addTelecom(new ContactPoint().setSystem(ContactPointSystem.PHONE).setValue(clinician.getOrganization().phone));
}
practitionerRole.addTelecom(practitionerResource.getTelecomFirstRep());
newEntry(rand, bundle, practitionerRole);
}
return practitionerEntry;
}
use of org.hl7.fhir.r4.model.PractitionerRole in project summary-care-record-api by NHSDigital.
the class ParticipantAgentMapper method mapAuthor1.
public static Participant.Author1 mapAuthor1(Bundle bundle, EncounterParticipantComponent encounterParticipant) {
var author = new Participant.Author1();
author.setTime(formatDateToHl7(encounterParticipant.getPeriod().getStartElement()));
var practitionerRoleReference = encounterParticipant.getIndividual().getReference();
var practitionerRole = getResourceByReference(bundle, practitionerRoleReference, PractitionerRole.class).orElseThrow(() -> new FhirValidationException(String.format("Bundle is missing PractitionerRole %s that is linked to Encounter", practitionerRoleReference)));
if (StringUtils.isNotBlank(practitionerRole.getOrganization().getReference())) {
setAgentDevice(bundle, practitionerRole.getOrganization(), author);
} else if (StringUtils.isNotBlank(practitionerRole.getPractitioner().getReference())) {
setParticipantAgents(bundle, practitionerRole.getPractitioner(), author);
}
return author;
}
use of org.hl7.fhir.r4.model.PractitionerRole in project summary-care-record-api by NHSDigital.
the class AgentPersonMapper method mapPractitionerRole.
private PractitionerRole mapPractitionerRole(Node agentPerson) {
var code = xmlUtils.getValueByXPath(agentPerson, CODE_XPATH);
var display = xmlUtils.getValueByXPath(agentPerson, CODE_DISPLAY_XPATH);
var role = new PractitionerRole().addCode(new CodeableConcept(new Coding().setSystem(JOB_ROLE_NAME_SYSTEM).setCode(code).setDisplay(display)));
role.setId(randomUUID());
return role;
}
use of org.hl7.fhir.r4.model.PractitionerRole in project summary-care-record-api by NHSDigital.
the class AgentPersonMapper method mapPerson.
private void mapPerson(Node agentPerson, PractitionerRole role, List<Resource> resources) {
xmlUtils.detachOptionalNodeByXPath(agentPerson, PERSON_XPATH).ifPresent(person -> {
var practitioner = new Practitioner();
practitioner.setId(randomUUID());
practitioner.addName().setText(xmlUtils.getNodeText(person, PERSON_NAME_XPATH));
role.setPractitioner(new Reference(practitioner));
resources.add(practitioner);
});
}
use of org.hl7.fhir.r4.model.PractitionerRole in project summary-care-record-api by NHSDigital.
the class AgentPersonSdsMapper method map.
@Override
public List<? extends Resource> map(Node agentPersonSds) {
List<Resource> resources = new ArrayList<>();
PractitionerRole role = mapPractitionerRole(agentPersonSds);
var personSds = xmlUtils.getNodeByXpath(agentPersonSds, PERSON_SDS_XPATH);
var practitioner = personSdsMapper.mapPractitioner(personSds);
role.setPractitioner(new Reference(practitioner));
resources.add(role);
resources.add(practitioner);
return resources;
}
Aggregations