public class HibernatePatientDAO extends Object implements PatientDAO
Context
,
PatientDAO
,
PatientService
Constructor and Description |
---|
HibernatePatientDAO() |
Modifier and Type | Method and Description |
---|---|
void |
deletePatient(Patient patient)
Delete patient from database.
|
void |
deletePatientIdentifier(PatientIdentifier patientIdentifier) |
void |
deletePatientIdentifierType(PatientIdentifierType patientIdentifierType) |
List<Patient> |
findPatients(String query,
boolean includeVoided,
Integer start,
Integer length) |
List<Allergy> |
getAllergies(Patient patient)
Gets a list of allergies that a patient has
|
Allergy |
getAllergy(Integer allergyId)
Gets a allergy matching the given allergyId
|
Allergy |
getAllergyByUuid(String uuid)
Gets a allergy matching the given uuid
|
String |
getAllergyStatus(Patient patient)
Gets a patient's allergy status
|
List<PatientIdentifierType> |
getAllPatientIdentifierTypes(boolean includeRetired)
Should not return null when includeRetired is false
Should not return retired when includeRetired is false
Should not return null when includeRetired is true
Should return all when includeRetired is true
Should return ordered
|
List<Patient> |
getAllPatients(boolean includeVoided) |
Long |
getCountOfPatients(String query) |
Long |
getCountOfPatients(String query,
boolean includeVoided) |
List<Patient> |
getDuplicatePatientsByAttributes(List<String> attributes) |
Patient |
getPatient(Integer patientId) |
Patient |
getPatientByUuid(String uuid) |
PatientIdentifier |
getPatientIdentifier(Integer patientIdentifierId) |
List<PatientIdentifier> |
getPatientIdentifierByProgram(PatientProgram patientProgram)
Gets a List of Patient Identifiers associated to a program
|
PatientIdentifier |
getPatientIdentifierByUuid(String uuid) |
List<PatientIdentifier> |
getPatientIdentifiers(String identifier,
List<PatientIdentifierType> patientIdentifierTypes,
List<Location> locations,
List<Patient> patients,
Boolean isPreferred) |
PatientIdentifierType |
getPatientIdentifierType(Integer patientIdentifierTypeId) |
PatientIdentifierType |
getPatientIdentifierTypeByUuid(String uuid) |
List<PatientIdentifierType> |
getPatientIdentifierTypes(String name,
String format,
Boolean required,
Boolean hasCheckDigit) |
List<Patient> |
getPatients(String query,
boolean includeVoided,
Integer start,
Integer length) |
List<Patient> |
getPatients(String query,
Integer start,
Integer length) |
List<Patient> |
getPatients(String query,
List<PatientIdentifierType> identifierTypes,
boolean matchIdentifierExactly,
Integer start,
Integer length) |
boolean |
isIdentifierInUseByAnotherPatient(PatientIdentifier patientIdentifier)
This method uses a SQL query and does not load anything into the hibernate session.
|
Allergies |
saveAllergies(Patient patient,
Allergies allergies)
Saves patient allergies to the database.
|
Allergy |
saveAllergy(Allergy allergy)
Saves an allergy to the database
|
Patient |
savePatient(Patient patient) |
PatientIdentifier |
savePatientIdentifier(PatientIdentifier patientIdentifier) |
PatientIdentifierType |
savePatientIdentifierType(PatientIdentifierType patientIdentifierType) |
void |
setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Set session factory
|
public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
sessionFactory
- public Patient getPatient(Integer patientId)
getPatient
in interface PatientDAO
patientId
- internal patient identifierPatientService.getPatient(java.lang.Integer)
public Patient savePatient(Patient patient) throws DAOException
savePatient
in interface PatientDAO
patient
- patient to be created or updatedDAOException
PatientDAO.savePatient(org.openmrs.Patient)
public List<Patient> getPatients(String query, List<PatientIdentifierType> identifierTypes, boolean matchIdentifierExactly, Integer start, Integer length) throws DAOException
getPatients
in interface PatientDAO
DAOException
PatientService.getPatients(String, String, List, boolean, Integer, Integer)
public List<Patient> getPatients(String query, boolean includeVoided, Integer start, Integer length) throws DAOException
getPatients
in interface PatientDAO
DAOException
Should return exact match first
public List<Patient> getPatients(String query, Integer start, Integer length) throws DAOException
getPatients
in interface PatientDAO
DAOException
PatientDAO.getPatients(String, Integer, Integer)
public List<Patient> getAllPatients(boolean includeVoided) throws DAOException
getAllPatients
in interface PatientDAO
DAOException
PatientDAO.getAllPatients(boolean)
public void deletePatientIdentifierType(PatientIdentifierType patientIdentifierType) throws DAOException
deletePatientIdentifierType
in interface PatientDAO
DAOException
PatientService.purgePatientIdentifierType(org.openmrs.PatientIdentifierType)
,
PatientDAO.deletePatientIdentifierType(org.openmrs.PatientIdentifierType)
public List<PatientIdentifier> getPatientIdentifiers(String identifier, List<PatientIdentifierType> patientIdentifierTypes, List<Location> locations, List<Patient> patients, Boolean isPreferred) throws DAOException
getPatientIdentifiers
in interface PatientDAO
DAOException
PatientService.getPatientIdentifiers(java.lang.String, java.util.List, java.util.List, java.util.List, java.lang.Boolean)
public PatientIdentifierType savePatientIdentifierType(PatientIdentifierType patientIdentifierType) throws DAOException
savePatientIdentifierType
in interface PatientDAO
DAOException
PatientDAO.savePatientIdentifierType(org.openmrs.PatientIdentifierType)
public void deletePatient(Patient patient) throws DAOException
PatientDAO
deletePatient
in interface PatientDAO
patient
- patient to be deletedDAOException
org.openmrs.api.PatientDAO#deletePatient(org.openmrs.Patient)
public PatientIdentifierType getPatientIdentifierType(Integer patientIdentifierTypeId) throws DAOException
getPatientIdentifierType
in interface PatientDAO
DAOException
PatientService.getPatientIdentifierType(java.lang.Integer)
public List<PatientIdentifierType> getAllPatientIdentifierTypes(boolean includeRetired) throws DAOException
getAllPatientIdentifierTypes
in interface PatientDAO
DAOException
PatientDAO.getAllPatientIdentifierTypes(boolean)
public List<PatientIdentifierType> getPatientIdentifierTypes(String name, String format, Boolean required, Boolean hasCheckDigit) throws DAOException
getPatientIdentifierTypes
in interface PatientDAO
DAOException
Should return non retired patient identifier types with given name
Should return non retired patient identifier types with given format
Should return non retired patient identifier types that are not required
Should return non retired patient identifier types that are required
Should return non retired patient identifier types that has checkDigit
Should return non retired patient identifier types that has not CheckDigit
Should return only non retired patient identifier types
Should return non retired patient identifier types ordered by required first
Should return non retired patient identifier types ordered by required and name
Should return non retired patient identifier types ordered by required name and type id
public List<Patient> getDuplicatePatientsByAttributes(List<String> attributes)
getDuplicatePatientsByAttributes
in interface PatientDAO
attributes
- attributes on a Person or Patient object. similar to: [gender, givenName,
middleName, familyName]PatientDAO.getDuplicatePatientsByAttributes(java.util.List)
public Patient getPatientByUuid(String uuid)
getPatientByUuid
in interface PatientDAO
PatientDAO.getPatientByUuid(java.lang.String)
public PatientIdentifier getPatientIdentifierByUuid(String uuid)
getPatientIdentifierByUuid
in interface PatientDAO
public PatientIdentifierType getPatientIdentifierTypeByUuid(String uuid)
getPatientIdentifierTypeByUuid
in interface PatientDAO
PatientDAO.getPatientIdentifierTypeByUuid(java.lang.String)
public boolean isIdentifierInUseByAnotherPatient(PatientIdentifier patientIdentifier)
isIdentifierInUseByAnotherPatient
in interface PatientDAO
PatientDAO.isIdentifierInUseByAnotherPatient(org.openmrs.PatientIdentifier)
public PatientIdentifier getPatientIdentifier(Integer patientIdentifierId) throws DAOException
getPatientIdentifier
in interface PatientDAO
patientIdentifierId
- the patientIdentifier idDAOException
PatientDAO.getPatientIdentifier(java.lang.Integer)
public PatientIdentifier savePatientIdentifier(PatientIdentifier patientIdentifier)
savePatientIdentifier
in interface PatientDAO
patientIdentifier
- patientIndentifier to be created or updatedPatientDAO.savePatientIdentifier(org.openmrs.PatientIdentifier)
public void deletePatientIdentifier(PatientIdentifier patientIdentifier) throws DAOException
deletePatientIdentifier
in interface PatientDAO
DAOException
PatientService.purgePatientIdentifier(org.openmrs.PatientIdentifier)
,
PatientDAO.deletePatientIdentifier(org.openmrs.PatientIdentifier)
public Long getCountOfPatients(String query)
getCountOfPatients
in interface PatientDAO
query
- the string to search onPatientDAO.getCountOfPatients(String)
public Long getCountOfPatients(String query, boolean includeVoided)
getCountOfPatients
in interface PatientDAO
query
- the string to search onincludeVoided
- true/false whether or not to included voided patientsPatientDAO.getCountOfPatients(String, boolean)
public List<Patient> findPatients(String query, boolean includeVoided, Integer start, Integer length)
public List<Allergy> getAllergies(Patient patient)
PatientDAO
getAllergies
in interface PatientDAO
patient
- the patientorg.openmrs..api.db.PatientDAO#getAllergies(org.openmrs.Patient)
public String getAllergyStatus(Patient patient)
PatientDAO
getAllergyStatus
in interface PatientDAO
patient
- the patientPatientDAO.getAllergyStatus(org.openmrs.Patient)
public Allergies saveAllergies(Patient patient, Allergies allergies)
PatientDAO
saveAllergies
in interface PatientDAO
patient
- the patientallergies
- the allergiesorg.openmrs.api.db.PatientDAO#saveAllergies(org.openmrs.Patient,
org.openmrsallergyapi.Allergies)
public Allergy getAllergy(Integer allergyId)
PatientDAO
getAllergy
in interface PatientDAO
allergyId
- of allergy to returnorg.openmrs.PatientDAO#getAllergy(Integer)
public Allergy getAllergyByUuid(String uuid)
PatientDAO
getAllergyByUuid
in interface PatientDAO
uuid
- of allergy to returnorg.openmrs.PatientDAO#getAllergyByUuid(String)
public Allergy saveAllergy(Allergy allergy)
PatientDAO
saveAllergy
in interface PatientDAO
allergy
- the allergy to savePatientDAO.saveAllergy(org.openmrs.Allergy)
public List<PatientIdentifier> getPatientIdentifierByProgram(PatientProgram patientProgram)
PatientDAO
getPatientIdentifierByProgram
in interface PatientDAO
patientProgram
- the program that matches the patientIdentifierPatientDAO.getPatientIdentifierByProgram(org.openmrs.PatientProgram)
Copyright © 2024 OpenMRS Inc.. All rights reserved.