@Transactional public class HL7ServiceImpl extends BaseOpenmrsService implements HL7Service
Context
HL7Service
Modifier and Type | Method and Description |
---|---|
Integer |
countHL7InArchive(int messageState,
String query)
the total count of all HL7InArchive objects in the database
|
Integer |
countHL7InError(String query)
the total count of all HL7InError objects in the database
|
Integer |
countHL7InQueue(int messageState,
String query)
the total count of all HL7InQueue objects in the database
|
Person |
createPersonFromNK1(ca.uhn.hl7v2.model.v25.segment.NK1 nk1)
creates a Person from information held in an NK1 segment; if valid PatientIdentifiers exist,
a Patient will be created and returned
|
void |
garbageCollect()
Clean up the current memory consumption
|
List<HL7InArchive> |
getAllHL7InArchives()
Get all archive hl7 queue items from the database
|
List<HL7InError> |
getAllHL7InErrors()
Get all
HL7InError items from the database |
List<HL7InQueue> |
getAllHL7InQueues()
Return a list of all hl7 in queues in the database
|
List<HL7Source> |
getAllHL7Sources()
Get all of the hl7 source objects from the database.
|
HL7InArchive |
getHL7InArchive(Integer hl7InArchiveId)
Get the archive item with the given id, If hl7 archives were moved to the file system, you
can't do a look up by hl7ArchiveId, instead call
HL7Service.getHL7InArchiveByUuid(String) |
List<HL7InArchive> |
getHL7InArchiveBatch(int start,
int length,
int messageState,
String query)
Return a list of all hl7 in archives based on batch settings and a query string
|
List<HL7InArchive> |
getHL7InArchiveByState(Integer state)
If hl7 migration has been run and the state matches that of processed items, the method
returns a list of all archives in the file system, for any other state , it returns an empty
list, this is because all archives would have a status of 'processed' after migration and all
deleted archives moved back into the queue with a status of 'deleted' otherwise it returns
archives with a matching state if migration hasn't yet been run.
|
HL7InArchive |
getHL7InArchiveByUuid(String uuid)
Get the archive item with the given uuid
|
HL7InError |
getHL7InError(Integer hl7InErrorId)
Get the error item with the given id
|
List<HL7InError> |
getHL7InErrorBatch(int start,
int length,
String query)
Return a list of all hl7 in errors based on batch settings and a query string
|
HL7InError |
getHL7InErrorByUuid(String uuid)
Get the error item with the given uuid
|
HL7InQueue |
getHL7InQueue(Integer hl7InQueueId)
Get the hl7 queue item with the given primary key id
|
List<HL7InQueue> |
getHL7InQueueBatch(int start,
int length,
int messageState,
String query)
Return a list of all hl7 in queues based on batch settings and a query string
|
List<HL7InQueue> |
getHL7InQueueByState(Integer state)
Get the queue items given a state (deleted, error, pending, processing, processed).
|
HL7InQueue |
getHL7InQueueByUuid(String uuid)
Get the hl7 queue item with the given uuid
|
HL7QueueItem |
getHl7QueueItemByUuid(String uuid)
Get
HL7QueueItem with the given uuid. |
HL7Source |
getHL7Source(Integer hl7SourceId)
Auto generated method comment
|
HL7Source |
getHL7SourceByName(String name)
Get the hl7 source object from the database that has the given name
|
static HL7ServiceImpl |
getInstance()
Singleton Factory method
|
HL7InQueue |
getNextHL7InQueue()
Get the first queue item in the database
|
String |
getUuidFromIdentifiers(ca.uhn.hl7v2.model.v25.datatype.CX[] identifiers)
finds a UUID from an array of identifiers
|
void |
loadHL7InArchiveData(HL7InArchive archive)
Loads HL7 data from the filesystem for an archived HL7InArchive
|
void |
loadHL7InArchiveData(List<HL7InArchive> archives)
Loads data for a list of HL7 archives from the filesystem
|
void |
migrateHl7InArchivesToFileSystem(Map<String,Integer> progressStatusMap)
Method is called by the archives migration thread to transfer hl7 in archives from the
hl7_in_archives database table to the file system
|
ca.uhn.hl7v2.model.Message |
parseHL7String(String hl7Message)
Parses the given string and returns the resulting
Message |
HL7InQueue |
processHL7InQueue(HL7InQueue hl7InQueue)
Process the given
HL7InQueue item. |
ca.uhn.hl7v2.model.Message |
processHL7Message(ca.uhn.hl7v2.model.Message message)
Parses the given
Message and saves the resulting content to the database |
void |
purgeHL7InArchive(HL7InArchive hl7InArchive)
Completely delete the hl7 in archive item from the database
|
void |
purgeHL7InError(HL7InError hl7InError)
Completely remove this error item from the database
|
void |
purgeHL7InQueue(HL7InQueue hl7InQueue)
Completely delete the hl7 in queue item from the database.
|
void |
purgeHL7Source(HL7Source hl7Source)
Completely remove the source from the database.
|
Integer |
resolveLocationId(ca.uhn.hl7v2.model.v25.datatype.PL pl)
Resolves location from person location object, and if location id is specified then returns
correspond internal identifier of the specified location.
|
Integer |
resolvePatientId(ca.uhn.hl7v2.model.v25.segment.PID pid) |
Person |
resolvePersonFromIdentifiers(ca.uhn.hl7v2.model.v25.datatype.CX[] identifiers)
determines a person (or patient) based on identifiers from a CX array, as found in a PID or
NK1 segment; the first resolving identifier in the list wins
|
Integer |
resolvePersonId(ca.uhn.hl7v2.model.v25.datatype.XCN xcn) |
Integer |
resolveUserId(ca.uhn.hl7v2.model.v25.datatype.XCN xcn) |
HL7Source |
retireHL7Source(HL7Source hl7Source)
Mark the given
hl7Source as no longer active |
HL7InArchive |
saveHL7InArchive(HL7InArchive hl7InArchive)
Save the given hl7 in archive to the database
|
HL7InError |
saveHL7InError(HL7InError hl7InError)
Save the given error item to the database
|
HL7InQueue |
saveHL7InQueue(HL7InQueue hl7InQueue)
Save the given
hl7InQueue to the database |
HL7Source |
saveHL7Source(HL7Source hl7Source)
Save the given
hl7Source to the database |
void |
setHL7DAO(HL7DAO dao)
Auto generated method comment
|
void |
setHL7Handlers(Map<String,ca.uhn.hl7v2.app.Application> handlers)
Sets the given handlers as router applications that are available to HAPI when it is parsing
an hl7 message.
|
void |
setParser(ca.uhn.hl7v2.parser.GenericParser parser)
Used by spring to inject the parser
|
void |
setRouter(ca.uhn.hl7v2.app.MessageTypeRouter router)
Used by spring to inject the router
|
onShutdown, onStartup
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onShutdown, onStartup
protected HL7DAO dao
public static HL7ServiceImpl getInstance()
public void setHL7DAO(HL7DAO dao)
HL7Service
setHL7DAO
in interface HL7Service
HL7Service.setHL7DAO(org.openmrs.hl7.db.HL7DAO)
public void setParser(ca.uhn.hl7v2.parser.GenericParser parser)
parser
- the parser to usepublic void setRouter(ca.uhn.hl7v2.app.MessageTypeRouter router)
router
- the router to usepublic HL7Source saveHL7Source(HL7Source hl7Source) throws APIException
HL7Service
hl7Source
to the databasesaveHL7Source
in interface HL7Service
hl7Source
- the source to saveAPIException
HL7Service.saveHL7Source(org.openmrs.hl7.HL7Source)
public void purgeHL7Source(HL7Source hl7Source) throws APIException
HL7Service
HL7Service.retireHL7Source(HL7Source)
purgeHL7Source
in interface HL7Service
APIException
HL7Service.purgeHL7Source(org.openmrs.hl7.HL7Source)
public HL7Source retireHL7Source(HL7Source hl7Source) throws APIException
HL7Service
hl7Source
as no longer activeretireHL7Source
in interface HL7Service
hl7Source
- the source to retireAPIException
HL7Service.retireHL7Source(org.openmrs.hl7.HL7Source)
@Transactional(readOnly=true) public HL7Source getHL7Source(Integer hl7SourceId)
HL7Service
getHL7Source
in interface HL7Service
HL7Source
object for given identifierHL7Service.getHL7Source(java.lang.Integer)
@Transactional(readOnly=true) public List<HL7Source> getAllHL7Sources() throws APIException
HL7Service
getAllHL7Sources
in interface HL7Service
APIException
HL7Service.getAllHL7Sources()
@Transactional(readOnly=true) public HL7Source getHL7SourceByName(String name) throws APIException
HL7Service
getHL7SourceByName
in interface HL7Service
name
- string to 'search' onAPIException
HL7Service.getHL7SourceByName(java.lang.String)
@Transactional(readOnly=true) public List<HL7InQueue> getAllHL7InQueues() throws APIException
HL7Service
getAllHL7InQueues
in interface HL7Service
APIException
HL7Service.getAllHL7InQueues()
@Transactional(readOnly=true) public List<HL7InQueue> getHL7InQueueBatch(int start, int length, int messageState, String query) throws APIException
HL7Service
getHL7InQueueBatch
in interface HL7Service
start
- beginning indexlength
- size of the batchmessageState
- status of the HL7InQueue messagequery
- search stringAPIException
HL7Service.getHL7InQueueBatch(int, int, int, String)
@Transactional(readOnly=true) public List<HL7InError> getHL7InErrorBatch(int start, int length, String query) throws APIException
HL7Service
getHL7InErrorBatch
in interface HL7Service
start
- beginning indexlength
- size of the batchquery
- search stringAPIException
HL7Service.getHL7InErrorBatch(int, int, java.lang.String)
@Transactional(readOnly=true) public List<HL7InArchive> getHL7InArchiveBatch(int start, int length, int messageState, String query) throws APIException
HL7Service
getHL7InArchiveBatch
in interface HL7Service
start
- beginning indexlength
- size of the batchmessageState
- status of the HL7InArchive messagequery
- search stringAPIException
HL7Service.getHL7InArchiveBatch(int, int, int, String)
@Transactional(readOnly=true) public Integer countHL7InQueue(int messageState, String query) throws APIException
HL7Service
countHL7InQueue
in interface HL7Service
messageState
- HL7InQueue statusquery
- search stringAPIException
HL7Service.countHL7InQueue(int, java.lang.String)
@Transactional(readOnly=true) public Integer countHL7InError(String query) throws APIException
HL7Service
countHL7InError
in interface HL7Service
query
- search stringAPIException
HL7Service.countHL7InError(java.lang.String)
@Transactional(readOnly=true) public Integer countHL7InArchive(int messageState, String query) throws APIException
HL7Service
countHL7InArchive
in interface HL7Service
messageState
- status of the HL7InArchive messagequery
- search stringAPIException
HL7Service.countHL7InArchive(int, java.lang.String)
public void purgeHL7InQueue(HL7InQueue hl7InQueue)
HL7Service
purgeHL7InQueue
in interface HL7Service
HL7Service.purgeHL7InQueue(org.openmrs.hl7.HL7InQueue)
public HL7InQueue saveHL7InQueue(HL7InQueue hl7InQueue) throws APIException
HL7Service
hl7InQueue
to the databasesaveHL7InQueue
in interface HL7Service
hl7InQueue
- the queue item to saveAPIException
HL7Service.saveHL7InQueue(org.openmrs.hl7.HL7InQueue)
@Transactional(readOnly=true) public HL7InQueue getHL7InQueue(Integer hl7InQueueId)
HL7Service
getHL7InQueue
in interface HL7Service
hl7InQueueId
- the id to search onHL7Service.getHL7InQueue(java.lang.Integer)
@Transactional(readOnly=true) public HL7InQueue getHL7InQueueByUuid(String uuid) throws APIException
HL7Service
getHL7InQueueByUuid
in interface HL7Service
null
APIException
@Transactional(readOnly=true) public HL7InQueue getNextHL7InQueue()
HL7Service
getNextHL7InQueue
in interface HL7Service
HL7Service.getNextHL7InQueue()
@Transactional(readOnly=true) public List<HL7InArchive> getHL7InArchiveByState(Integer state) throws APIException
HL7Service
getHL7InArchiveByState
in interface HL7Service
APIException
HL7Service.getHL7InArchiveByState(java.lang.Integer)
@Transactional(readOnly=true) public List<HL7InQueue> getHL7InQueueByState(Integer state) throws APIException
HL7Service
getHL7InQueueByState
in interface HL7Service
APIException
HL7Service.getHL7InQueueByState(java.lang.Integer)
@Transactional(readOnly=true) public List<HL7InArchive> getAllHL7InArchives() throws APIException
HL7Service
getAllHL7InArchives
in interface HL7Service
APIException
HL7Service.getAllHL7InArchives()
public void purgeHL7InArchive(HL7InArchive hl7InArchive) throws APIException
HL7Service
purgeHL7InArchive
in interface HL7Service
hl7InArchive
- the archived item to deleteAPIException
HL7Service.purgeHL7InArchive(org.openmrs.hl7.HL7InArchive)
public HL7InArchive saveHL7InArchive(HL7InArchive hl7InArchive) throws APIException
HL7Service
saveHL7InArchive
in interface HL7Service
hl7InArchive
- the archive to saveAPIException
HL7Service.saveHL7InArchive(org.openmrs.hl7.HL7InArchive)
@Transactional(readOnly=true) public HL7InArchive getHL7InArchive(Integer hl7InArchiveId)
HL7Service
HL7Service.getHL7InArchiveByUuid(String)
getHL7InArchive
in interface HL7Service
hl7InArchiveId
- the id to search onHL7Service.getHL7InArchive(java.lang.Integer)
@Transactional(readOnly=true) public List<HL7InError> getAllHL7InErrors() throws APIException
HL7Service
HL7InError
items from the databasegetAllHL7InErrors
in interface HL7Service
HL7InError
items from the databaseAPIException
HL7Service.getAllHL7InErrors()
public void purgeHL7InError(HL7InError hl7InError) throws APIException
HL7Service
purgeHL7InError
in interface HL7Service
hl7InError
- the item to removeAPIException
HL7Service.purgeHL7InError(org.openmrs.hl7.HL7InError)
public HL7InError saveHL7InError(HL7InError hl7InError) throws APIException
HL7Service
saveHL7InError
in interface HL7Service
hl7InError
- the item to saveAPIException
HL7Service.saveHL7InError(org.openmrs.hl7.HL7InError)
@Transactional(readOnly=true) public HL7InError getHL7InError(Integer hl7InErrorId)
HL7Service
getHL7InError
in interface HL7Service
hl7InErrorId
- the id to search onHL7Service.getHL7InError(java.lang.Integer)
@Transactional(readOnly=true) public HL7InError getHL7InErrorByUuid(String uuid) throws APIException
HL7Service
getHL7InErrorByUuid
in interface HL7Service
null
APIException
@Transactional(readOnly=true) public Integer resolveUserId(ca.uhn.hl7v2.model.v25.datatype.XCN xcn) throws ca.uhn.hl7v2.HL7Exception
resolveUserId
in interface HL7Service
xcn
- HL7 component of data type XCN (extended composite ID number and name for persons)
(see HL7 2.5 manual Ch.2A.86)ca.uhn.hl7v2.HL7Exception
@Transactional(readOnly=true) public Integer resolvePersonId(ca.uhn.hl7v2.model.v25.datatype.XCN xcn) throws ca.uhn.hl7v2.HL7Exception
resolvePersonId
in interface HL7Service
xcn
- HL7 component of data type XCN (extended composite ID number and name for persons)
(see HL7 2.5 manual Ch.2A.86)ca.uhn.hl7v2.HL7Exception
HL7Service.resolvePersonId(ca.uhn.hl7v2.model.v25.datatype.XCN)
@Transactional(readOnly=true) public Integer resolveLocationId(ca.uhn.hl7v2.model.v25.datatype.PL pl) throws ca.uhn.hl7v2.HL7Exception
HL7Service
resolveLocationId
in interface HL7Service
pl
- HL7 component of data type PL (person location) (see Ch 2.A.53)ca.uhn.hl7v2.HL7Exception
@Transactional(readOnly=true) public Integer resolvePatientId(ca.uhn.hl7v2.model.v25.segment.PID pid) throws ca.uhn.hl7v2.HL7Exception
resolvePatientId
in interface HL7Service
pid
- A PID segment of an hl7 messageca.uhn.hl7v2.HL7Exception
@Transactional(readOnly=true) public Person resolvePersonFromIdentifiers(ca.uhn.hl7v2.model.v25.datatype.CX[] identifiers) throws ca.uhn.hl7v2.HL7Exception
HL7Service
resolvePersonFromIdentifiers
in interface HL7Service
identifiers
- CX identifier list from an identifier (either PID or NK1)ca.uhn.hl7v2.HL7Exception
public void garbageCollect()
HL7Service
garbageCollect
in interface HL7Service
HL7Service.garbageCollect()
public HL7InQueue processHL7InQueue(HL7InQueue hl7InQueue) throws ca.uhn.hl7v2.HL7Exception
HL7Service
HL7InQueue
item. HL7InError
is created and saved. HL7InArchive
is created and saved.HL7InQueue
is removed from the hl7 in queue table regardless of success or
failure of the processing.processHL7InQueue
in interface HL7Service
hl7InQueue
- the HL7InQueue
to parse and save all encounters/obs to the dbHL7InQueue
Should create HL7InArchive after successful parsing
Should create HL7InError after failed parsing
Should fail if given inQueue is already marked as processing
Should parse oru r01 message using overridden parser provided by a moduleca.uhn.hl7v2.HL7Exception
HL7Service.processHL7InQueue(org.openmrs.hl7.HL7InQueue)
public ca.uhn.hl7v2.model.Message parseHL7String(String hl7Message) throws ca.uhn.hl7v2.HL7Exception
HL7Service
Message
parseHL7String
in interface HL7Service
hl7Message
- the hl7 string to parse and saveMessage
that the given hl7 string representsca.uhn.hl7v2.HL7Exception
HL7Service.parseHL7String(String)
@Transactional(readOnly=true) public HL7InArchive getHL7InArchiveByUuid(String uuid) throws APIException
HL7Service
getHL7InArchiveByUuid
in interface HL7Service
uuid
- to search onAPIException
HL7Service.getHL7InArchiveByUuid(java.lang.String)
public ca.uhn.hl7v2.model.Message processHL7Message(ca.uhn.hl7v2.model.Message message) throws ca.uhn.hl7v2.HL7Exception
HL7Service
Message
and saves the resulting content to the databaseprocessHL7Message
in interface HL7Service
message
- the Message
to process and save to the db.ca.uhn.hl7v2.HL7Exception
HL7Service.processHL7Message(ca.uhn.hl7v2.model.Message)
public void setHL7Handlers(Map<String,ca.uhn.hl7v2.app.Application> handlers)
handlers
- a map from MessageName to Application objectpublic Person createPersonFromNK1(ca.uhn.hl7v2.model.v25.segment.NK1 nk1) throws ca.uhn.hl7v2.HL7Exception
HL7Service
createPersonFromNK1
in interface HL7Service
nk1
- the NK1 segment with person informationca.uhn.hl7v2.HL7Exception
- Should return a saved new person
Should return a Patient if valid patient identifiers exist
Should fail if a person with the same UUID exists
Should fail on an invalid gender
Should fail if no gender specified
Should fail if no birthdate specifiedHL7Service.createPersonFromNK1(ca.uhn.hl7v2.model.v25.segment.NK1)
public String getUuidFromIdentifiers(ca.uhn.hl7v2.model.v25.datatype.CX[] identifiers) throws ca.uhn.hl7v2.HL7Exception
HL7Service
getUuidFromIdentifiers
in interface HL7Service
ca.uhn.hl7v2.HL7Exception
- Should return null if no UUID found
Should find a UUID in any position of the array
Should not fail if multiple similar UUIDs exist in identifiers
Should not fail if no assigning authority is found
Should fail if multiple different UUIDs exist in identifiersHL7Service.getUuidFromIdentifiers(ca.uhn.hl7v2.model.v25.datatype.CX[])
public void loadHL7InArchiveData(List<HL7InArchive> archives) throws APIException
HL7Service
loadHL7InArchiveData
in interface HL7Service
APIException
HL7Service.loadHL7InArchiveData(List)
public void loadHL7InArchiveData(HL7InArchive archive) throws APIException
HL7Service
loadHL7InArchiveData
in interface HL7Service
APIException
HL7Service.loadHL7InArchiveData(HL7InArchive)
public void migrateHl7InArchivesToFileSystem(Map<String,Integer> progressStatusMap) throws APIException
HL7Service
migrateHl7InArchivesToFileSystem
in interface HL7Service
progressStatusMap
- the map holding the number of archives transferred and failed
transfersAPIException
HL7Service.migrateHl7InArchivesToFileSystem(Map)
@Transactional(readOnly=true) public HL7QueueItem getHl7QueueItemByUuid(String uuid) throws APIException
HL7Service
HL7QueueItem
with the given uuid.
It calls HL7Service.getHL7InQueueByUuid(String)
, HL7Service.getHL7InArchiveByUuid(String)
and
HL7Service.getHL7InErrorByUuid(String)
consecutively and returns the first non-null result.
getHl7QueueItemByUuid
in interface HL7Service
null
APIException
Copyright © 2024 OpenMRS Inc.. All rights reserved.