Search in sources :

Example 16 with DvIdentifier

use of com.nedap.archie.rm.datavalues.DvIdentifier 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;
}
Also used : FeederAudit(com.nedap.archie.rm.archetyped.FeederAudit) EpisodeofcareIdentifierElement(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareIdentifierElement) EpisodeofcareTeamElement(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareTeamElement) FeederAuditDetails(com.nedap.archie.rm.archetyped.FeederAuditDetails) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) EpisodeofcareAdminEntry(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.definition.EpisodeofcareAdminEntry) EpisodeOfCareComposition(org.ehrbase.client.classgenerator.examples.episodeofcarecomposition.EpisodeOfCareComposition) PartySelf(com.nedap.archie.rm.generic.PartySelf) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier)

Example 17 with DvIdentifier

use of com.nedap.archie.rm.datavalues.DvIdentifier in project ehrbase by ehrbase.

the class PartyIdentifiersTest method isIdentical.

@Test
public void isIdentical() {
    // set 1
    DvIdentifier dvIdentifier11 = new DvIdentifier();
    dvIdentifier11.setId("A");
    dvIdentifier11.setAssigner("A");
    dvIdentifier11.setIssuer("A");
    dvIdentifier11.setType("A");
    DvIdentifier dvIdentifier12 = new DvIdentifier();
    dvIdentifier12.setId("B");
    dvIdentifier12.setAssigner("B");
    dvIdentifier12.setIssuer("B");
    dvIdentifier12.setType("B");
    List<DvIdentifier> set1 = new ArrayList<>();
    set1.add(dvIdentifier11);
    set1.add(dvIdentifier12);
    // set 2
    DvIdentifier dvIdentifier21 = new DvIdentifier();
    dvIdentifier21.setId("A");
    dvIdentifier21.setAssigner("A");
    dvIdentifier21.setIssuer("A");
    dvIdentifier21.setType("A");
    DvIdentifier dvIdentifier22 = new DvIdentifier();
    dvIdentifier22.setId("B");
    dvIdentifier22.setAssigner("B");
    dvIdentifier22.setIssuer("B");
    dvIdentifier22.setType("B");
    List<DvIdentifier> set2 = new ArrayList<>();
    set2.add(dvIdentifier21);
    set2.add(dvIdentifier22);
    assertTrue(new PartyIdentifiers(null).compare(set1, set2));
    // set 3
    DvIdentifier dvIdentifier31 = new DvIdentifier();
    dvIdentifier31.setId("A");
    dvIdentifier31.setAssigner("A");
    dvIdentifier31.setIssuer("A");
    dvIdentifier31.setType("A");
    DvIdentifier dvIdentifier32 = new DvIdentifier();
    dvIdentifier32.setId("C");
    dvIdentifier32.setAssigner("C");
    dvIdentifier32.setIssuer("C");
    dvIdentifier32.setType("C");
    List<DvIdentifier> set3 = new ArrayList<>();
    set3.add(dvIdentifier31);
    set3.add(dvIdentifier32);
    assertFalse(new PartyIdentifiers(null).compare(set1, set3));
}
Also used : ArrayList(java.util.ArrayList) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier) Test(org.junit.Test)

Example 18 with DvIdentifier

use of com.nedap.archie.rm.datavalues.DvIdentifier in project ehrbase by ehrbase.

the class PartyIdentifiersTest method isIdenticalWithNull.

@Test
public void isIdenticalWithNull() {
    // set 1
    DvIdentifier dvIdentifier11 = new DvIdentifier();
    dvIdentifier11.setId("A");
    DvIdentifier dvIdentifier12 = new DvIdentifier();
    dvIdentifier12.setId("B");
    List<DvIdentifier> set1 = new ArrayList<>();
    set1.add(dvIdentifier11);
    set1.add(dvIdentifier12);
    // set 2
    DvIdentifier dvIdentifier21 = new DvIdentifier();
    dvIdentifier21.setId("A");
    DvIdentifier dvIdentifier22 = new DvIdentifier();
    dvIdentifier22.setId("B");
    List<DvIdentifier> set2 = new ArrayList<>();
    set2.add(dvIdentifier21);
    set2.add(dvIdentifier22);
    assertTrue(new PartyIdentifiers(null).compare(set1, set2));
}
Also used : ArrayList(java.util.ArrayList) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier) Test(org.junit.Test)

Example 19 with DvIdentifier

use of com.nedap.archie.rm.datavalues.DvIdentifier in project ehrbase by ehrbase.

the class PartyIdentifiers method retrieve.

List<DvIdentifier> retrieve(PartyIdentifiedRecord partyIdentifiedRecord) {
    List<DvIdentifier> identifierList = new ArrayList<>();
    domainAccess.getContext().fetch(IDENTIFIER, IDENTIFIER.PARTY.eq(partyIdentifiedRecord.getId())).forEach(record -> {
        DvIdentifier identifier = new DvIdentifier();
        identifier.setIssuer(record.getIssuer());
        identifier.setAssigner(record.getAssigner());
        identifier.setId(record.getIdValue());
        identifier.setType(record.getTypeName());
        identifierList.add(identifier);
    });
    return identifierList;
}
Also used : DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier)

Example 20 with DvIdentifier

use of com.nedap.archie.rm.datavalues.DvIdentifier in project ehrbase by ehrbase.

the class PersistedPartyIdentified method render.

@Override
public PartyProxy render(PartyIdentifiedRecord partyIdentifiedRecord) {
    PartyRef partyRef = null;
    if (partyIdentifiedRecord.getPartyRefType() != null) {
        ObjectId objectID = new PersistedObjectId().fromDB(partyIdentifiedRecord);
        partyRef = new PartyRef(objectID, partyIdentifiedRecord.getPartyRefNamespace(), partyIdentifiedRecord.getPartyRefType());
    }
    List<DvIdentifier> identifierList = new PartyIdentifiers(domainAccess).retrieve(partyIdentifiedRecord);
    PartyIdentified partyIdentified = new PartyIdentified(partyRef, partyIdentifiedRecord.getName(), identifierList.isEmpty() ? null : identifierList);
    return partyIdentified;
}
Also used : PartyRef(com.nedap.archie.rm.support.identification.PartyRef) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) ObjectId(com.nedap.archie.rm.support.identification.ObjectId) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier)

Aggregations

DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)21 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)10 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)6 Composition (com.nedap.archie.rm.composition.Composition)4 Observation (com.nedap.archie.rm.composition.Observation)3 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)3 DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)3 PartySelf (com.nedap.archie.rm.generic.PartySelf)3 GenericId (com.nedap.archie.rm.support.identification.GenericId)3 IOException (java.io.IOException)3 StandardCharsets (java.nio.charset.StandardCharsets)3 OffsetDateTime (java.time.OffsetDateTime)3 ZoneOffset (java.time.ZoneOffset)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 IOUtils (org.apache.commons.io.IOUtils)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 Tuple (org.assertj.core.groups.Tuple)3 PersistedPartyProxy (org.ehrbase.dao.access.jooq.party.PersistedPartyProxy)3