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);
}
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;
}
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);
}
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;
}
Aggregations