use of org.hl7.v3.RCMRMT030101UK04NarrativeStatement in project nia-patient-switching-standard-adaptor by NHSDigital.
the class ResourceFilterUtilTest method testIsDocumentReferenceResource.
@Test
public void testIsDocumentReferenceResource() {
final RCMRMT030101UK04NarrativeStatement narrativeStatement = unmarshallNarrativeStatementElement("document_reference_resource.xml");
assertThat(ResourceFilterUtil.isDocumentReference(narrativeStatement)).isTrue();
}
use of org.hl7.v3.RCMRMT030101UK04NarrativeStatement in project nia-patient-switching-standard-adaptor by NHSDigital.
the class DocumentReferenceMapper method mapDocumentReference.
private DocumentReference mapDocumentReference(RCMRMT030101UK04NarrativeStatement narrativeStatement, RCMRMT030101UK04EhrComposition ehrComposition, Patient patient, RCMRMT030101UK04EhrExtract ehrExtract, List<Encounter> encounterList, Organization organization) {
DocumentReference documentReference = new DocumentReference();
var id = narrativeStatement.getReference().get(0).getReferredToExternalDocument().getId().getRoot();
documentReference.addIdentifier(buildIdentifier(id, organization.getIdentifierFirstRep().getValue()));
documentReference.setId(id);
documentReference.getMeta().addProfile(META_PROFILE);
documentReference.setStatus(DocumentReferenceStatus.CURRENT);
documentReference.setType(getType(narrativeStatement));
documentReference.setSubject(new Reference(patient));
documentReference.setIndexedElement(getIndexed(ehrExtract));
documentReference.setDescription(buildDescription(narrativeStatement));
documentReference.setCustodian(new Reference(organization));
getAuthor(narrativeStatement, ehrComposition).ifPresent(documentReference::addAuthor);
if (narrativeStatement.hasAvailabilityTime() && narrativeStatement.getAvailabilityTime().hasValue()) {
documentReference.setCreatedElement(DateFormatUtil.parseToDateTimeType(narrativeStatement.getAvailabilityTime().getValue()));
}
var encounterReference = encounterList.stream().filter(encounter -> encounter.getId().equals(ehrComposition.getId().getRoot())).findFirst().map(Reference::new);
if (encounterReference.isPresent()) {
DocumentReference.DocumentReferenceContextComponent documentReferenceContextComponent = new DocumentReference.DocumentReferenceContextComponent().setEncounter(encounterReference.get());
documentReference.setContext(documentReferenceContextComponent);
}
setContentAttachments(documentReference, narrativeStatement);
return documentReference;
}
use of org.hl7.v3.RCMRMT030101UK04NarrativeStatement in project nia-patient-switching-standard-adaptor by NHSDigital.
the class ResourceFilterUtilTest method testIsNotDocumentReferenceResource.
@Test
public void testIsNotDocumentReferenceResource() {
final RCMRMT030101UK04NarrativeStatement narrativeStatement = unmarshallNarrativeStatementElement("observation_comment_resource.xml");
assertThat(ResourceFilterUtil.isDocumentReference(narrativeStatement)).isFalse();
}
use of org.hl7.v3.RCMRMT030101UK04NarrativeStatement in project nia-patient-switching-standard-adaptor by NHSDigital.
the class ObservationCommentMapper method mapObservation.
private Observation mapObservation(RCMRMT030101UK04EhrExtract ehrExtract, RCMRMT030101UK04EhrComposition ehrComposition, RCMRMT030101UK04NarrativeStatement narrativeStatement, Patient patient, List<Encounter> encounters, String practiseCode) {
var narrativeStatementId = narrativeStatement.getId();
var observation = new Observation();
observation.setId(narrativeStatement.getId().getRoot());
observation.setMeta(generateMeta(META_URL));
observation.setStatus(FINAL);
observation.setSubject(new Reference(patient));
observation.setIssuedElement(createIssued(ehrExtract, ehrComposition));
observation.setCode(createCodeableConcept());
observation.addPerformer(createPerformer(ehrComposition, narrativeStatement));
observation.addIdentifier(buildIdentifier(narrativeStatementId.getRoot(), practiseCode));
setObservationEffective(observation, narrativeStatement.getAvailabilityTime());
setObservationComment(observation, narrativeStatement.getText());
addContextToObservation(observation, encounters, ehrComposition);
return observation;
}
Aggregations