Package org.ehrbase.api.service
Interface EhrService
-
- All Superinterfaces:
BaseService
public interface EhrService extends BaseService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidadminDeleteEhr(UUID ehrId)Admin method to delete an EHR from the DB.voidadminDeleteOrphanHistory()voidadminPurgePartyIdentified()UUIDcreate(com.nedap.archie.rm.ehr.EhrStatus status, UUID ehrId)Creates new EHR instance, with default settings and values when no status or ID is supplied.booleandoesEhrExist(UUID ehrId)Checks if there is an ehr entry existing for specified ehrId.Optional<UUID>findBySubject(String subjectId, String nameSpace)com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTimegetCreationTime(UUID ehrId)UUIDgetDirectoryId(UUID ehrId)Reads the EHR entry from database and returns the ID of the root directory entry.Optional<com.nedap.archie.rm.ehr.EhrStatus>getEhrStatus(UUID ehrUuid)Gets latest EHR_STATUS of the given EHR.Optional<com.nedap.archie.rm.changecontrol.OriginalVersion<com.nedap.archie.rm.ehr.EhrStatus>>getEhrStatusAtVersion(UUID ehrUuid, UUID versionedObjectUid, int version)Gets particular EHR_STATUS matching the given version Uid.Optional<org.ehrbase.response.ehrscape.EhrStatusDto>getEhrStatusEhrScape(UUID ehrUuid, org.ehrbase.response.ehrscape.CompositionFormat format)Deprecated.IntegergetEhrStatusVersionByTimestamp(UUID ehrUid, Timestamp timestamp)Get version number of EHR_STATUS associated with given EHR UID at given timestamp.UUIDgetEhrStatusVersionedObjectUidByEhr(UUID ehrUid)Helper to get (Versioned Object) Uid of EHR_STATUS of given EHR.StringgetLatestVersionUidOfStatus(UUID ehrId)Get latest version UID of an EHR_STATUS by given associated EHR UID.com.nedap.archie.rm.generic.RevisionHistorygetRevisionHistoryOfVersionedEhrStatus(UUID ehrUid)Gets revision history of EhrStatus associated with given EHR.StringgetSubjectExtRef(String ehrId)Helper to directly get the external subject reference form the linked subject to given EHR.UUIDgetSubjectUuid(String ehrId)Helper to directly get the linked subject ID to given EHR.com.nedap.archie.rm.ehr.VersionedEhrStatusgetVersionedEhrStatus(UUID ehrUid)Gets version container EhrStatus associated with given EHR.booleanhasEhr(UUID ehrId)Return True if a EHR with identifier ehrId exists.booleanhasStatus(UUID statusId)Return True if a EHR_STATUS with identifier statusId exists.booleanremoveDirectory(UUID ehrId)Removes the directory information from EHR table entry after deletion of the corresponding folder from folders table.Optional<com.nedap.archie.rm.ehr.EhrStatus>updateStatus(UUID ehrId, com.nedap.archie.rm.ehr.EhrStatus status, UUID contribution)Update the EHR_STATUS linked to the given EHR-
Methods inherited from interface org.ehrbase.api.service.BaseService
getServerConfig, getSystemUuid
-
-
-
-
Method Detail
-
create
UUID create(com.nedap.archie.rm.ehr.EhrStatus status, UUID ehrId)
Creates new EHR instance, with default settings and values when no status or ID is supplied.- Parameters:
status- Optional, sets custom statusehrId- Optional, sets custom ID- Returns:
- UUID of new EHR instance
- Throws:
DuplicateObjectException- when given party/subject already has an EHRInternalServerException- when unspecified error occurs
-
getEhrStatusEhrScape
@Deprecated Optional<org.ehrbase.response.ehrscape.EhrStatusDto> getEhrStatusEhrScape(UUID ehrUuid, org.ehrbase.response.ehrscape.CompositionFormat format)
Deprecated.
-
getEhrStatus
Optional<com.nedap.archie.rm.ehr.EhrStatus> getEhrStatus(UUID ehrUuid)
Gets latest EHR_STATUS of the given EHR.- Parameters:
ehrUuid- EHR subject- Returns:
- Latest EHR_STATUS or empty
-
getEhrStatusAtVersion
Optional<com.nedap.archie.rm.changecontrol.OriginalVersion<com.nedap.archie.rm.ehr.EhrStatus>> getEhrStatusAtVersion(UUID ehrUuid, UUID versionedObjectUid, int version)
Gets particular EHR_STATUS matching the given version Uid.- Parameters:
ehrUuid- Root EHRversionedObjectUid- Given Uid of EHR_STATUSversion- Given version of EHR_STATUS- Returns:
- Matching EHR_STATUS or empty
-
updateStatus
Optional<com.nedap.archie.rm.ehr.EhrStatus> updateStatus(UUID ehrId, com.nedap.archie.rm.ehr.EhrStatus status, UUID contribution)
Update the EHR_STATUS linked to the given EHR- Parameters:
ehrId- ID of linked EHRstatus- input EHR_STATUScontribution- Optional ID of custom contribution. Can be null.- Returns:
Optionalcontaining the updated status on success- Throws:
ObjectNotFoundException- when given ehrId cannot be foundInvalidApiParameterException- when given status is invalid, e.g. not a valid openEHR RM object
-
doesEhrExist
boolean doesEhrExist(UUID ehrId)
Checks if there is an ehr entry existing for specified ehrId.- Parameters:
ehrId- - Target EHR identified- Returns:
- EHR with id exists
-
getLatestVersionUidOfStatus
String getLatestVersionUidOfStatus(UUID ehrId)
Get latest version UID of an EHR_STATUS by given associated EHR UID.- Parameters:
ehrId- EHR ID- Returns:
- EHR_STATUS version UID
-
getCreationTime
com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime getCreationTime(UUID ehrId)
-
getEhrStatusVersionByTimestamp
Integer getEhrStatusVersionByTimestamp(UUID ehrUid, Timestamp timestamp)
Get version number of EHR_STATUS associated with given EHR UID at given timestamp.- Parameters:
ehrUid- EHR UIDtimestamp- Timestamp of point in time- Returns:
- version number
-
hasEhr
boolean hasEhr(UUID ehrId)
Return True if a EHR with identifier ehrId exists. Implements has_ehr from the openEHR Platform Abstract Service Model.- Parameters:
ehrId- identifier to test- Returns:
- True when existing, false if not
-
hasStatus
boolean hasStatus(UUID statusId)
Return True if a EHR_STATUS with identifier statusId exists.- Parameters:
statusId- identifier to test- Returns:
- True when existing, false if not
-
getEhrStatusVersionedObjectUidByEhr
UUID getEhrStatusVersionedObjectUidByEhr(UUID ehrUid)
Helper to get (Versioned Object) Uid of EHR_STATUS of given EHR.- Parameters:
ehrUid- Uid of EHR- Returns:
- UUID of corresponding EHR_STATUS
-
getVersionedEhrStatus
com.nedap.archie.rm.ehr.VersionedEhrStatus getVersionedEhrStatus(UUID ehrUid)
Gets version container EhrStatus associated with given EHR.- Parameters:
ehrUid- Given EHR ID- Returns:
- Version container object
-
getRevisionHistoryOfVersionedEhrStatus
com.nedap.archie.rm.generic.RevisionHistory getRevisionHistoryOfVersionedEhrStatus(UUID ehrUid)
Gets revision history of EhrStatus associated with given EHR.- Parameters:
ehrUid- Given EHR ID- Returns:
- Revision history object
-
getDirectoryId
UUID getDirectoryId(UUID ehrId)
Reads the EHR entry from database and returns the ID of the root directory entry.- Parameters:
ehrId- - EHR id to find the directory for- Returns:
- UUID of the root directory if existing
-
removeDirectory
boolean removeDirectory(UUID ehrId)
Removes the directory information from EHR table entry after deletion of the corresponding folder from folders table. If there were no such folder it will return a successful deletion.- Parameters:
ehrId- - Target EHR id- Returns:
- Directory entry is now 'null'
-
adminDeleteEhr
void adminDeleteEhr(UUID ehrId)
Admin method to delete an EHR from the DB. See EHRbase Admin API specification for details.- Parameters:
ehrId- EHR to delete
-
adminPurgePartyIdentified
void adminPurgePartyIdentified()
-
adminDeleteOrphanHistory
void adminDeleteOrphanHistory()
-
getSubjectUuid
UUID getSubjectUuid(String ehrId)
Helper to directly get the linked subject ID to given EHR.- Parameters:
ehrId- Given EHR ID- Returns:
- Linked subject ID or null
-
-