Search in sources :

Example 91 with Identifier

use of org.hl7.fhir.r4.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;
}
Also used : Practitioner(org.hl7.fhir.r4.model.Practitioner) HumanName(org.hl7.fhir.r4.model.HumanName) Identifier(org.hl7.fhir.r4.model.Identifier)

Example 92 with Identifier

use of org.hl7.fhir.r4.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)));
}
Also used : TokenOrListParam(ca.uhn.fhir.rest.param.TokenOrListParam) IBundleProvider(ca.uhn.fhir.rest.api.server.IBundleProvider) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) SimpleBundleProvider(ca.uhn.fhir.rest.server.SimpleBundleProvider) TokenAndListParam(ca.uhn.fhir.rest.param.TokenAndListParam) SearchParameterMap(org.openmrs.module.fhir2.api.search.param.SearchParameterMap) Test(org.junit.Test)

Example 93 with Identifier

use of org.hl7.fhir.r4.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)));
}
Also used : TokenOrListParam(ca.uhn.fhir.rest.param.TokenOrListParam) IBundleProvider(ca.uhn.fhir.rest.api.server.IBundleProvider) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) TokenAndListParam(ca.uhn.fhir.rest.param.TokenAndListParam) SearchParameterMap(org.openmrs.module.fhir2.api.search.param.SearchParameterMap) Test(org.junit.Test)

Example 94 with Identifier

use of org.hl7.fhir.r4.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);
}
Also used : Practitioner(org.hl7.fhir.r4.model.Practitioner) User(org.openmrs.User) Identifier(org.hl7.fhir.r4.model.Identifier) Before(org.junit.Before)

Example 95 with Identifier

use of org.hl7.fhir.r4.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);
}
Also used : Practitioner(org.hl7.fhir.r4.model.Practitioner) Identifier(org.hl7.fhir.r4.model.Identifier) SimpleBundleProvider(ca.uhn.fhir.rest.server.SimpleBundleProvider) Provider(org.openmrs.Provider) IBundleProvider(ca.uhn.fhir.rest.api.server.IBundleProvider) SearchQueryBundleProvider(org.openmrs.module.fhir2.api.search.SearchQueryBundleProvider) SimpleBundleProvider(ca.uhn.fhir.rest.server.SimpleBundleProvider) Before(org.junit.Before)

Aggregations

Identifier (org.hl7.fhir.r4.model.Identifier)212 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)143 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)125 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)116 Test (org.junit.Test)109 Test (org.junit.jupiter.api.Test)84 ArrayList (java.util.ArrayList)67 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)66 Reference (org.hl7.fhir.r4.model.Reference)57 Identifier (org.hl7.fhir.dstu3.model.Identifier)55 Patient (org.hl7.fhir.r4.model.Patient)55 Coding (org.hl7.fhir.r4.model.Coding)49 List (java.util.List)47 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)41 Practitioner (org.hl7.fhir.r4.model.Practitioner)41 Date (java.util.Date)40 Collectors (java.util.stream.Collectors)38 Resource (org.hl7.fhir.r4.model.Resource)37 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)36 InvalidRequestException (ca.uhn.fhir.rest.server.exceptions.InvalidRequestException)34