Search in sources :

Example 16 with PartyRef

use of com.nedap.archie.rm.support.identification.PartyRef in project ehrbase by ehrbase.

the class EventContextFactory method makeDummy.

public EventContext makeDummy() {
    PartyRef partyRef = new PartyRef(new GenericId("123456-123", "EHRBASE-SCHEME"), "DEMOGRAPHIC", "PARTY");
    PartyIdentified healthcareFacility = new PartyIdentified(partyRef, "FACILITY", null);
    DateTime timenow = DateTime.now();
    DvCodedText concept = new DvCodedText("Other Care", new CodePhrase(new TerminologyId("openehr"), "238"));
    return new EventContext(healthcareFacility, new DvDateTime(timenow.toString()), null, null, "TEST LAB", concept, null);
}
Also used : PartyRef(com.nedap.archie.rm.support.identification.PartyRef) EventContext(com.nedap.archie.rm.composition.EventContext) TerminologyId(com.nedap.archie.rm.support.identification.TerminologyId) GenericId(com.nedap.archie.rm.support.identification.GenericId) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) CodePhrase(com.nedap.archie.rm.datatypes.CodePhrase) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) DateTime(org.joda.time.DateTime) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)

Example 17 with PartyRef

use of com.nedap.archie.rm.support.identification.PartyRef 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)

Example 18 with PartyRef

use of com.nedap.archie.rm.support.identification.PartyRef in project ehrbase by ehrbase.

the class PersistedPartyProxy method getOrCreate.

/**
 * Get or create a PartyIdentified instance with the given parameters.
 */
public UUID getOrCreate(String name, String code, String scheme, String namespace, String type, List<DvIdentifier> identifiers) {
    // Check conformance to openEHR spec
    if (identifiers == null || identifiers.isEmpty()) {
        throw new IllegalArgumentException("Can't create PartyIdentified with invalid list of identifiers.");
    }
    identifiers.forEach(dv -> {
        if (!isValidDvIdentifier(dv))
            throw new IllegalArgumentException("Can't create PartyIdentified with an invalid identifier.");
    });
    // Create and persist object
    var partyIdentified = new PartyIdentified(new PartyRef(new GenericId(code, scheme), namespace, type), name, identifiers);
    return getOrCreate(partyIdentified);
}
Also used : PartyRef(com.nedap.archie.rm.support.identification.PartyRef) GenericId(com.nedap.archie.rm.support.identification.GenericId) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified)

Example 19 with PartyRef

use of com.nedap.archie.rm.support.identification.PartyRef in project ehrbase by ehrbase.

the class ContextAccess method getPartyIdentifiedFromRecord.

private static PartyIdentified getPartyIdentifiedFromRecord(PartyIdentifiedRecord partyIdentifiedRecord, List<DvIdentifier> identifiers) {
    PartyIdentified healthCareFacility;
    PartyRef partyRef = null;
    if (partyIdentifiedRecord.getPartyRefValue() != null && partyIdentifiedRecord.getPartyRefScheme() != null) {
        ObjectId objectID = new PersistedObjectId().fromDB(partyIdentifiedRecord);
        partyRef = new PartyRef(objectID, partyIdentifiedRecord.getPartyRefNamespace(), partyIdentifiedRecord.getPartyRefType());
    }
    healthCareFacility = new PartyIdentified(partyRef, partyIdentifiedRecord.getName(), identifiers.isEmpty() ? null : identifiers);
    return healthCareFacility;
}
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) PersistedObjectId(org.ehrbase.dao.access.jooq.party.PersistedObjectId) PersistedObjectId(org.ehrbase.dao.access.jooq.party.PersistedObjectId)

Aggregations

PartyRef (com.nedap.archie.rm.support.identification.PartyRef)19 DvText (com.nedap.archie.rm.datavalues.DvText)9 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)8 PartySelf (com.nedap.archie.rm.generic.PartySelf)8 GenericId (com.nedap.archie.rm.support.identification.GenericId)8 EhrStatus (com.nedap.archie.rm.ehr.EhrStatus)7 HierObjectId (com.nedap.archie.rm.support.identification.HierObjectId)6 ObjectId (com.nedap.archie.rm.support.identification.ObjectId)5 Test (org.junit.Test)4 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)3 EventContext (com.nedap.archie.rm.composition.EventContext)2 ItemTree (com.nedap.archie.rm.datastructures.ItemTree)2 CodePhrase (com.nedap.archie.rm.datatypes.CodePhrase)2 DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)2 DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)2 Participation (com.nedap.archie.rm.generic.Participation)2 TerminologyId (com.nedap.archie.rm.support.identification.TerminologyId)2 URI (java.net.URI)2 UUID (java.util.UUID)2 DateTime (org.joda.time.DateTime)2