OpenMRSPatientService¶
-
public interface
OpenMRSPatientService
¶ Interface for handling patients on the OpenMRS server.
Methods¶
createPatient¶
-
Patient
createPatient
(String configName, Patient patient)¶ Creates the given
patient
on the OpenMRS server. Configuration with the givenconfigName
will be used while performing this action.Parameters: - configName – the name of the configuration
- patient – the patient to be created
Returns: the created patient
deceasePatient¶
-
void
deceasePatient
(String configName, String motechId, Concept causeOfDeath, Date dateOfDeath, String comment)¶ Marks a patient with the given
motechId
as dead with the givendateOfDeath
,causeOfDeath
and acomment
. Configuration with the givenconfigName
will be used while performing this action.Parameters: - configName – the name of the configuration
- motechId – the MOTECH ID of the patient
- causeOfDeath – the cause of death
- dateOfDeath – the date of death
- comment – the additional information for the cause of death
Throws: - PatientNotFoundException – if the patient with the given MOTECH ID doesn’t exist
deletePatient¶
-
void
deletePatient
(String configName, String uuid)¶ Deletes the patient with the given
uuid
. Configuration with the givenconfigName
will be used while performing this action.Parameters: - configName – the name of the configuration
- uuid – the UUID of the patient
Throws: - PatientNotFoundException – if the patient with the given UUID doesn’t exist
getPatientByIdentifier¶
-
Patient
getPatientByIdentifier
(String configName, String identifierId, String identifierName)¶ Returns the patient with the given
identifierName
andidentifierId
. Configuration with the givenconfigName
will be used while performing this action.Parameters: - configName – the name of the configuration
- identifierId – the identifier id of the patient
- identifierName – the identifier name of the patient
Returns: the patient with the given identifier, null if the patient doesn’t exist
getPatientByMotechId¶
-
Patient
getPatientByMotechId
(String configName, String motechId)¶ Returns the patient with the given
motechId
. Configuration with the givenconfigName
will be used while performing this action.Parameters: - configName – the name of the configuration
- motechId – the MOTECH ID of the patient
Returns: the patient with the given MOTECH ID, null if the patient doesn’t exist
getPatientByUuid¶
-
Patient
getPatientByUuid
(String configName, String uuid)¶ Returns the patient with the given
uuid
. Configuration with the givenconfigName
will be used while performing this action.Parameters: - configName – the name of the configuration
- uuid – the UUID of the patient
Returns: the patient with the given UUID, null if the patient doesn’t exist
search¶
-
List<Patient>
search
(String configName, String name, String motechId)¶ If the
motechId
is null this method will return a list of patients with givenname
, else it will return a list with a single patient that has the givenname
andmotechId
. If there are no matching patients an empty list will be returned. Configuration with the givenconfigName
will be used while performing this action.Parameters: - configName – the name of the configuration
- name – the name of the patient to be searched for
- motechId – the MOTECH ID of the patient to be searched for
Returns: list of matched patients
updatePatient¶
-
Patient
updatePatient
(String configName, Patient patient, String currentMotechId)¶ Updates the patient with the given
currentMotechId
with the information stored in the givenpatient
(including the new MOTECH ID passed in the givenpatient
). Configuration with the givenconfigName
will be used while performing this action.Parameters: - configName – the name of the configuration
- patient – the patient to be used as an update source
- currentMotechId – the current MOTECH ID of the patient to update (used for searching)
Returns: the updated patient
updatePatient¶
-
Patient
updatePatient
(String configName, Patient patient)¶ Updates the patient with the information stored in the given
patient
. Configuration with the givenconfigName
will be used while performing this action.Parameters: - configName – the name of the configuration
- patient – the patient to be used as an update source
Returns: the updated patient
updatePatientIdentifiers¶
-
Patient
updatePatientIdentifiers
(String configName, Patient patient)¶ Updates the patient’s identifier with the information stored in the given
patient
. Configuration with the givenconfigName
will be used while performing this action.Parameters: - configName – the name of the configuration
- patient – the patient to be used as an update source
Returns: the updated patient