use of org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareTeamElement in project openEHR_SDK by ehrbase.
the class DefaultRestCompositionEndpointIT method testEpisodeOfCare.
@Test
public void testEpisodeOfCare() {
ehr = openEhrClient.ehrEndpoint().createEhr();
EpisodeOfCareComposition bloodPressureSimpleDeV0 = TestData.buildEpisodeOfCareComposition();
CompositionEndpoint compositionEndpoint = openEhrClient.compositionEndpoint(ehr);
EpisodeOfCareComposition version1 = compositionEndpoint.mergeCompositionEntity(bloodPressureSimpleDeV0);
Optional<EpisodeOfCareComposition> actual = compositionEndpoint.find(version1.getVersionUid().getUuid(), EpisodeOfCareComposition.class);
assertTrue(actual.isPresent());
assertThat(actual.get().getVersionUid()).extracting(v -> v.getUuid().toString(), VersionUid::getVersion).containsExactly(version1.getVersionUid().getUuid().toString(), 1L);
assertThat(actual.get().getFeederAudit()).isNotNull().extracting(feederAudit -> feederAudit.getFeederSystemAudit().getSystemId(), feederAudit1 -> feederAudit1.getOriginatingSystemAudit().getSystemId()).containsExactly("System 1", "System 2");
assertThat(actual.get().getEpisodeofcare()).size().isEqualTo(1);
EpisodeofcareAdminEntry episodeofcareAdminEntry = actual.get().getEpisodeofcare().get(0);
assertThat(episodeofcareAdminEntry.getIdentifier()).extracting(e -> e.getValue().getId()).containsExactlyInAnyOrder("123", "456");
assertThat(episodeofcareAdminEntry.getTeam()).extracting(EpisodeofcareTeamElement::getValue).containsExactlyInAnyOrder(URI.create("https://github.com/ehrbase"));
}
use of org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareTeamElement in project openEHR_SDK by ehrbase.
the class FlattenerTest method testFlattenEpisodeOfCare.
@Test
public void testFlattenEpisodeOfCare() {
Composition composition = (Composition) new Unflattener(new TestDataTemplateProvider()).unflatten(buildEpisodeOfCareComposition());
Flattener cut = new Flattener(new TestDataTemplateProvider());
EpisodeOfCareComposition actual = cut.flatten(composition, EpisodeOfCareComposition.class);
assertThat(actual).isNotNull();
assertThat(actual.getEpisodeofcare()).size().isEqualTo(1);
EpisodeofcareAdminEntry episodeofcareAdminEntry = actual.getEpisodeofcare().get(0);
assertThat(episodeofcareAdminEntry.getIdentifier()).extracting(e -> e.getValue().getId()).containsExactlyInAnyOrder("123", "456");
assertThat(episodeofcareAdminEntry.getTeam()).extracting(EpisodeofcareTeamElement::getValue).containsExactlyInAnyOrder(URI.create("https://github.com/ehrbase"));
}
use of org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareTeamElement in project openEHR_SDK by ehrbase.
the class TestData method buildEpisodeOfCareComposition.
public static EpisodeOfCareComposition buildEpisodeOfCareComposition() {
EpisodeOfCareComposition episode = new EpisodeOfCareComposition();
episode.setComposer(new PartyIdentified(null, "Test", null));
episode.setCategoryDefiningCode(Category.EVENT);
episode.setLanguage(Language.DE);
episode.setTerritory(Territory.DE);
episode.setEpisodeofcare(new ArrayList<>());
episode.setStartTimeValue(OffsetDateTime.now());
episode.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
FeederAudit audit = new FeederAudit();
audit.setFeederSystemAudit(new FeederAuditDetails());
audit.getFeederSystemAudit().setSystemId("System 1");
audit.setOriginatingSystemAudit(new FeederAuditDetails());
audit.getOriginatingSystemAudit().setSystemId("System 2");
episode.setFeederAudit(audit);
EpisodeofcareAdminEntry episodeofcareAdminEntry = new EpisodeofcareAdminEntry();
episodeofcareAdminEntry.setUpperValue(OffsetDateTime.now());
episodeofcareAdminEntry.setLowerValue(OffsetDateTime.now());
episodeofcareAdminEntry.setLanguage(Language.DE);
episodeofcareAdminEntry.setSubject(new PartySelf());
episodeofcareAdminEntry.setIdentifier(new ArrayList<>());
EpisodeofcareIdentifierElement identifierElement = new EpisodeofcareIdentifierElement();
DvIdentifier value = new DvIdentifier();
value.setId("123");
identifierElement.setValue(value);
episodeofcareAdminEntry.getIdentifier().add(identifierElement);
EpisodeofcareIdentifierElement identifierElement2 = new EpisodeofcareIdentifierElement();
DvIdentifier value2 = new DvIdentifier();
value2.setId("456");
identifierElement2.setValue(value2);
episodeofcareAdminEntry.getIdentifier().add(identifierElement2);
episodeofcareAdminEntry.setTeam(new ArrayList<>());
EpisodeofcareTeamElement teamElement1 = new EpisodeofcareTeamElement();
teamElement1.setValue(URI.create("https://github.com/ehrbase"));
episodeofcareAdminEntry.getTeam().add(teamElement1);
episode.getEpisodeofcare().add(episodeofcareAdminEntry);
return episode;
}
Aggregations