use of org.hl7.fhir.r4.model.PractitionerRole in project summary-care-record-api by NHSDigital.
the class FindingMapper method mapPerformer.
private void mapPerformer(List<Resource> resources, Encounter encounter, Node performer) {
DateTimeType time = parseDate(xmlUtils.getValueByXPath(performer, FINDING_PARTICIPANT_TIME_XPATH), DateTimeType.class);
participantMapper.map(performer).stream().peek(it -> resources.add(it)).filter(it -> it instanceof PractitionerRole).map(Reference::new).forEach(it -> {
EncounterParticipantComponent participant = new EncounterParticipantComponent();
String modeCode = xmlUtils.getValueByXPath(performer, FINDING_PERFORMER_MODE_CODE_XPATH);
participant.addExtension(PERFORMER_EXTENSION_URL, new CodeableConcept(new Coding().setSystem(ENCOUNTER_PARTICIPATION_MODE_SYSTEM).setCode(modeCode).setDisplay(getParticipationModeDisplay(modeCode))));
encounter.addParticipant(participant.setPeriod(new Period().setStartElement(time)).addType(getParticipationType("PRF", "performer")).setIndividual(it));
});
}
use of org.hl7.fhir.r4.model.PractitionerRole in project summary-care-record-api by NHSDigital.
the class FindingMapper method mapAuthor.
private void mapAuthor(List<Resource> resources, Encounter encounter, Node author) {
DateTimeType time = parseDate(xmlUtils.getValueByXPath(author, FINDING_PARTICIPANT_TIME_XPATH), DateTimeType.class);
participantMapper.map(author).stream().peek(it -> resources.add(it)).filter(it -> it instanceof PractitionerRole).map(Reference::new).forEach(it -> encounter.addParticipant(new EncounterParticipantComponent().setPeriod(new Period().setStartElement(time)).addType(getParticipationType("AUT", "author")).setIndividual(it)));
}
use of org.hl7.fhir.r4.model.PractitionerRole in project elexis-server by elexis.
the class PractitionerRoleTest method getPractitionerProperties.
/**
* Test all properties set by {@link TestDatabaseInitializer#initializeMandant()}.
*/
@Test
public void getPractitionerProperties() {
List<IUser> user = UserServiceHolder.get().getUsersByAssociatedContact(TestDatabaseInitializer.getMandant());
assertFalse(user.isEmpty());
PractitionerRole readPractitionerRole = client.read().resource(PractitionerRole.class).withId(user.get(0).getId()).execute();
assertNotNull(readPractitionerRole);
assertNotNull(readPractitionerRole.getPractitioner());
Practitioner readPractitioner = client.read().resource(Practitioner.class).withId(readPractitionerRole.getPractitioner().getReferenceElement().getIdPart()).execute();
assertNotNull(readPractitioner);
List<HumanName> names = readPractitioner.getName();
assertNotNull(names);
assertFalse(names.isEmpty());
assertEquals(2, names.size());
HumanName name = names.get(0);
assertNotNull(name);
assertEquals(NameUse.OFFICIAL, name.getUse());
assertEquals("Mandant", name.getFamily());
assertEquals("Test", name.getGivenAsSingleString());
HumanName sysName = names.get(1);
assertNotNull(sysName);
assertEquals(NameUse.ANONYMOUS, sysName.getUse());
assertEquals("tst", sysName.getText());
Date dob = readPractitioner.getBirthDate();
assertNotNull(dob);
assertEquals(LocalDate.of(1970, Month.JANUARY, 1), AllTests.getLocalDateTime(dob).toLocalDate());
assertEquals(AdministrativeGender.MALE, readPractitioner.getGender());
List<ContactPoint> telcoms = readPractitioner.getTelecom();
assertNotNull(telcoms);
assertEquals(2, telcoms.size());
assertEquals(1, telcoms.get(0).getRank());
assertEquals("+01555234", telcoms.get(0).getValue());
assertEquals(ContactPointUse.MOBILE, telcoms.get(1).getUse());
assertEquals("+01444234", telcoms.get(1).getValue());
List<Address> addresses = readPractitioner.getAddress();
assertNotNull(addresses);
assertEquals(1, addresses.size());
assertEquals("City", addresses.get(0).getCity());
assertEquals("123", addresses.get(0).getPostalCode());
assertEquals("Street 100", addresses.get(0).getLine().get(0).asStringValue());
List<Identifier> identifiers = readPractitioner.getIdentifier();
boolean eanFound = false;
boolean kskFound = false;
for (Identifier identifier : identifiers) {
if (identifier.getSystem().equals(XidConstants.DOMAIN_EAN)) {
assertEquals("2000000000002", identifier.getValue());
eanFound = true;
}
if (identifier.getSystem().equals("www.xid.ch/id/ksk")) {
assertEquals("C000002", identifier.getValue());
kskFound = true;
}
}
assertTrue(eanFound);
assertTrue(kskFound);
assertTrue(readPractitioner.getActive());
}
use of org.hl7.fhir.r4.model.PractitionerRole in project elexis-server by elexis.
the class PractitionerRoleTest method getPractitionerRole.
@Test
public void getPractitionerRole() {
// search by role
Bundle results = client.search().forResource(PractitionerRole.class).where(PractitionerRole.ROLE.exactly().systemAndCode(org.hl7.fhir.r4.model.codesystems.PractitionerRole.DOCTOR.getSystem(), org.hl7.fhir.r4.model.codesystems.PractitionerRole.DOCTOR.toCode())).returnBundle(Bundle.class).execute();
assertNotNull(results);
List<BundleEntryComponent> entries = results.getEntry();
assertFalse(entries.isEmpty());
PractitionerRole practitionerRole = (PractitionerRole) entries.get(0).getResource();
List<CodeableConcept> roles = practitionerRole.getCode();
boolean doctorRoleFound = false;
for (CodeableConcept role : roles) {
List<Coding> codings = role.getCoding();
for (Coding coding : codings) {
if (coding.getSystem().equals(org.hl7.fhir.r4.model.codesystems.PractitionerRole.DOCTOR.getSystem()) && coding.getCode().equals(org.hl7.fhir.r4.model.codesystems.PractitionerRole.DOCTOR.toCode())) {
doctorRoleFound = true;
}
}
}
assertTrue(doctorRoleFound);
}
use of org.hl7.fhir.r4.model.PractitionerRole in project openmrs-module-fhir2 by openmrs.
the class PractitionerRoleNarrativeTest method shouldGeneratePractitionerRoleNarrative.
/**
* Check that the expected narrative is generated for some example PractitionerRole resource
*
* @throws IOException
*/
@Test
public void shouldGeneratePractitionerRoleNarrative() throws IOException {
PractitionerRole given = parser.parseResource(PractitionerRole.class, getClass().getClassLoader().getResourceAsStream(EXAMPLE_RESOURCE_PATH));
PractitionerRole result = parser.parseResource(PractitionerRole.class, parser.encodeResourceToString(given));
assertThat(result, notNullValue());
assertThat(result.getText(), notNullValue());
assertThat(result.getText().getStatusAsString(), equalTo("generated"));
assertThat(result.getText().getDivAsString(), equalTo(readNarrativeFile(EXPECTED_NARRATIVE_PATH)));
}
Aggregations