use of org.hl7.fhir.r4b.model.Identifier in project summary-care-record-api by NHSDigital.
the class PersonSdsMapper method mapPractitioner.
public Practitioner mapPractitioner(Node personSds) {
var practitioner = new Practitioner();
practitioner.setId(randomUUID());
practitioner.addIdentifier(new Identifier().setSystem(SDS_USER_ID).setValue(xmlUtils.getValueByXPath(personSds, ID_EXTENSION_XPATH)));
var name = xmlUtils.getOptionalValueByXPath(personSds, PERSON_NAME_XPATH);
if (name.isPresent()) {
practitioner.addName(new HumanName().setText(name.get()));
}
return practitioner;
}
use of org.hl7.fhir.r4b.model.Identifier in project openmrs-module-fhir2 by openmrs.
the class FhirPractitionerServiceImplTest method shouldSearchForPractitionersByIdentifier.
@Test
public void shouldSearchForPractitionersByIdentifier() {
TokenAndListParam identifier = new TokenAndListParam().addAnd(new TokenOrListParam().add(IDENTIFIER));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.IDENTIFIER_SEARCH_HANDLER, identifier);
when(practitionerDao.getSearchResultUuids(any())).thenReturn(Collections.singletonList(UUID));
when(practitionerDao.getSearchResults(any(), any())).thenReturn(Collections.singletonList(provider));
when(searchQuery.getQueryResults(any(), any(), any(), any())).thenReturn(new SearchQueryBundleProvider<>(theParams, practitionerDao, practitionerTranslator, globalPropertyService, searchQueryInclude));
when(searchQueryInclude.getIncludedResources(any(), any())).thenReturn(Collections.emptySet());
when(practitionerTranslator.toFhirResource(provider)).thenReturn(practitioner);
when(userService.searchForUsers(any())).thenReturn(new SimpleBundleProvider());
IBundleProvider results = practitionerService.searchForPractitioners(identifier, null, null, null, null, null, null, null, null, null, null);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, not(empty()));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
}
use of org.hl7.fhir.r4b.model.Identifier in project openmrs-module-fhir2 by openmrs.
the class FhirUserServiceImplTest method shouldsearchForUsersByIdentifier.
@Test
public void shouldsearchForUsersByIdentifier() {
TokenAndListParam identifier = new TokenAndListParam().addAnd(new TokenOrListParam().add(USER_SYSTEM_ID));
SearchParameterMap theParams = new SearchParameterMap().addParameter(IDENTIFIER_SEARCH_HANDLER, identifier);
when(dao.getSearchResultUuids(any())).thenReturn(singletonList(USER_UUID));
when(dao.getSearchResults(any(), any())).thenReturn(singletonList(user));
when(searchQuery.getQueryResults(any(), any(), any(), any())).thenReturn(new SearchQueryBundleProvider<>(theParams, dao, translator, globalPropertyService, searchQueryInclude));
when(translator.toFhirResource(user)).thenReturn(practitioner);
when(searchQueryInclude.getIncludedResources(any(), any())).thenReturn(Collections.emptySet());
IBundleProvider results = userService.searchForUsers(theParams);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, not(empty()));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
}
use of org.hl7.fhir.r4b.model.Identifier in project openmrs-module-fhir2 by openmrs.
the class FhirUserServiceImplTest method setup.
@Before
public void setup() {
userService = new FhirUserServiceImpl();
userService.setDao(dao);
userService.setTranslator(translator);
userService.setSearchQuery(searchQuery);
userService.setSearchQueryInclude(searchQueryInclude);
user = new User();
user.setUuid(USER_UUID);
user.setRetired(false);
user.setUsername(USER_NAME);
user.setSystemId(USER_SYSTEM_ID);
practitioner = new Practitioner();
practitioner.setId(USER_UUID);
practitioner.setIdentifier(Collections.singletonList(new Identifier().setValue(USER_SYSTEM_ID)));
practitioner.setActive(false);
}
use of org.hl7.fhir.r4b.model.Identifier in project openmrs-module-fhir2 by openmrs.
the class FhirPractitionerServiceImplTest method setUp.
@Before
public void setUp() {
when(userService.searchForUsers(any())).thenReturn(new SimpleBundleProvider());
practitionerService = new FhirPractitionerServiceImpl();
practitionerService.setDao(practitionerDao);
practitionerService.setTranslator(practitionerTranslator);
practitionerService.setSearchQuery(searchQuery);
practitionerService.setUserService(userService);
practitionerService.setSearchQueryInclude(searchQueryInclude);
practitionerService.setGlobalPropertyService(globalPropertyService);
provider = new Provider();
provider.setUuid(UUID);
provider.setRetired(false);
provider.setName(NAME);
provider.setIdentifier(IDENTIFIER);
practitioner = new Practitioner();
practitioner.setId(UUID);
practitioner.setIdentifier(Collections.singletonList(new Identifier().setValue(IDENTIFIER)));
practitioner.setActive(false);
practitioner2 = new Practitioner();
practitioner2.setId(UUID2);
practitioner2.setIdentifier(Collections.singletonList(new Identifier().setValue(USER_SYSTEM_ID)));
practitioner2.setActive(false);
}
Aggregations