use of org.hl7.fhir.r4.model.Identifier in project summary-care-record-api by NHSDigital.
the class GpSummaryMapper method map.
@SneakyThrows
public List<Resource> map(Node document) {
var gpSummaryId = xmlUtils.getValueByXPath(document, GP_SUMMARY_ID_XPATH);
var gpSummaryCodeCode = xmlUtils.getValueByXPath(document, GP_SUMMARY_CODE_CODE_XPATH);
var gpSummaryCodeDisplayName = xmlUtils.getValueByXPath(document, GP_SUMMARY_CODE_DISPLAY_NAME_XPATH);
var gpSummaryStatusCode = xmlUtils.getValueByXPath(document, GP_SUMMARY_STATUS_CODE_XPATH);
var gpSummaryEffectiveTime = parseDate(xmlUtils.getValueByXPath(document, GP_SUMMARY_EFFECTIVE_TIME_XPATH), InstantType.class);
var authorTime = parseDate(xmlUtils.getValueByXPath(document, GP_SUMMARY_AUTHOR_TIME_XPATH), DateTimeType.class);
var replacementOfPriorMessageRefIdRoot = xmlUtils.getOptionalValueByXPath(document, REPLACEMENT_OF_PRIOR_MESSAGE_REF_ID_ROOT_XPATH);
var pertinentRootCreTypeCodeCode = xmlUtils.getValueByXPath(document, PERTINENT_ROOT_CRE_TYPE_CODE_CODE_XPATH);
var pertinentRootCreTypeCodeDisplayName = xmlUtils.getValueByXPath(document, PERTINENT_ROOT_CRE_TYPE_CODE_DISPLAY_NAME_XPATH);
var presentationTextValue = xmlUtils.detachOptionalNodeByXPath(document, PRESENTATION_TEXT_VALUE);
var eventId = xmlUtils.getValueByXPath(document, EVENT_ID_XPATH);
List<Resource> resources = new ArrayList<>();
var composition = new Composition();
composition.setId(eventId);
composition.setIdentifier(new Identifier().setValue(gpSummaryId).setSystem("https://tools.ietf.org/html/rfc4122"));
composition.setType(new CodeableConcept().addCoding(new Coding().setCode(gpSummaryCodeCode).setSystem(SNOMED_SYSTEM).setDisplay(gpSummaryCodeDisplayName)));
composition.setMeta(new Meta().setLastUpdatedElement(gpSummaryEffectiveTime));
composition.setStatus(mapCompositionStatus(gpSummaryStatusCode));
composition.setDateElement(authorTime);
replacementOfPriorMessageRefIdRoot.ifPresent(val -> composition.addRelatesTo(new Composition.CompositionRelatesToComponent().setTarget(new Identifier().setValue(val)).setCode(REPLACES)));
composition.addCategory(new CodeableConcept().addCoding(new Coding().setCode(pertinentRootCreTypeCodeCode).setSystem(SNOMED_SYSTEM).setDisplay(pertinentRootCreTypeCodeDisplayName)));
Map<String, List<String>> references = sectionReferences(document);
presentationTextValue.map(htmlParser::parse).map(Collection::stream).ifPresent(it -> it.forEach(section -> {
if (section.getTitle() != null && CODED_ENTRY_RESOURCE_MAP.keySet().contains(section.getTitle()) && references.containsKey(section.getTitle())) {
for (String codedEntryId : references.get(section.getTitle())) {
section.addEntry(new Reference(CODED_ENTRY_RESOURCE_MAP.get(section.getTitle()) + "/" + codedEntryId));
}
}
composition.addSection(section);
}));
resources.add(composition);
addAuthor(document, resources, composition);
return resources;
}
use of org.hl7.fhir.r4.model.Identifier in project summary-care-record-api by NHSDigital.
the class GetScrService method buildPatientResource.
private Patient buildPatientResource(String nhsNumber) {
Patient patient = new Patient();
String patientResourceId = randomUUID();
patient.setId(patientResourceId);
patient.setIdentifier(asList(new Identifier().setSystem(NHS_ID_SYSTEM).setValue(nhsNumber)));
return patient;
}
use of org.hl7.fhir.r4.model.Identifier in project summary-care-record-api by NHSDigital.
the class OrganisationSdsMapper method mapOrganizationSds.
public Organization mapOrganizationSds(Node organisationSds) {
var org = new Organization();
org.setId(randomUUID());
var orgIdentifier = new Identifier().setValue(xmlUtils.getValueByXPath(organisationSds, ORG_SDS_ID_XPATH));
var rootId = xmlUtils.getValueByXPath(organisationSds, ORG_SDS_ID_ROOT_XPATH);
if (HL7_ORG_OID.equals(rootId)) {
orgIdentifier.setSystem(ORG_SDS_SYSTEM);
}
org.addIdentifier(orgIdentifier);
xmlUtils.detachOptionalNodeByXPath(organisationSds, ORG_NAME_XPATH).ifPresent(nameNode -> org.setName(nameNode.getTextContent()));
return org;
}
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;
}
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)));
}
Aggregations