Changeset 4358 for openmrs/trunk/src/api/org/openmrs/api/db/PatientDAO.java
- Timestamp:
- 05/24/08 14:37:02 (8 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs/trunk/src/api/org/openmrs/api/db/PatientDAO.java
r4095 r4358 14 14 package org.openmrs.api.db; 15 15 16 import java.util.Collection;17 16 import java.util.List; 18 import java.util.Set;19 17 18 import org.openmrs.Location; 20 19 import org.openmrs.Patient; 21 20 import org.openmrs.PatientIdentifier; 22 21 import org.openmrs.PatientIdentifierType; 23 22 import org.openmrs.Tribe; 24 import org.openmrs.api.APIException;25 23 26 24 /** 27 * Patient-related database functions25 * Database methods for the PatientService 28 26 * 29 * @version 1.0 27 * @see org.openmrs.api.context.Context 28 * @see org.openmrs.api.PatientService 30 29 */ 31 30 public interface PatientDAO { 32 31 33 32 /** 34 * Creates a new patient record 35 * 36 * @param patient to be created 37 * @returns the created patient 38 * @throws DAOException 33 * @see org.openmrs.api.PatientService#savePatient(org.openmrs.Patient) 39 34 */ 40 public Patient createPatient(Patient patient) throws DAOException;35 public Patient savePatient(Patient patient) throws DAOException; 41 36 42 37 /** 43 * Get patient by internal identifier 44 * 45 * @param patientId internal patient identifier 46 * @return patient with given internal identifier 47 * @throws DAOException 38 * @see org.openmrs.api.PatientService#getPatient(Integer) 48 39 */ 49 40 public Patient getPatient(Integer patientId) throws DAOException; 50 41 51 42 /** 52 * Update patient 53 * 54 * @param patient to be updated 55 * @returns the crated patient 56 * @throws DAOException 57 */ 58 public Patient updatePatient(Patient patient) throws DAOException; 59 60 /** 61 * Find all patients with a given identifier 62 * 63 * @param identifier 64 * @return set of patients matching identifier 65 * @throws DAOException 66 */ 67 public Set<Patient> getPatientsByIdentifier(String identifier, boolean includeVoided) throws DAOException; 68 69 /** 70 * Find all patients with a given identifier and use the regex 71 * <code>OpenmrsConstants.PATIENT_IDENTIFIER_REGEX</code> 72 * 73 * Note: Uses NON-STANDARD SQL: "...WHERE identifier REGEXP '...' ..." 74 * 75 * @param identifier 76 * @param includeVoided 77 * @return 78 * @throws DAOException 79 */ 80 public Collection<Patient> getPatientsByIdentifierPattern(String identifier, boolean includeVoided) throws DAOException; 81 82 /** 83 * Find patients by name 84 * 85 * @param name 86 * @return set of patients matching name 87 * @throws DAOException 88 */ 89 public Collection<Patient> getPatientsByName(String name, boolean includeVoided) throws DAOException; 90 91 /** 92 * Delete patient from database. This <b>should not be called</b> 93 * except for testing and administration purposes. Use the void 94 * method instead. 43 * Delete patient from database. This <b>should not be called</b> except 44 * for testing and administration purposes. Use the void method instead 95 45 * 96 46 * @param patient patient to be deleted 97 47 * 98 * @see #voidPatient(Patient, String) 48 * @see org.openmrs.api.PatientService#deletePatient(org.openmrs.Patient) 49 * @see #voidPatient(Patient, String) 99 50 */ 100 51 public void deletePatient(Patient patient) throws DAOException; 101 52 102 53 /** 103 * Get all patientIdentifiers 104 * 105 * @param PatientIdentifierType 106 * @return patientIdentifier list 107 * @throws DAOException 54 * @see org.openmrs.api.PatientService#getAllPatients(boolean) 108 55 */ 109 public List<PatientIdentifier> getPatientIdentifiers(PatientIdentifierType p) throws DAOException;56 public List<Patient> getAllPatients(boolean includeVoided) throws DAOException; 110 57 111 58 /** 112 * Get Patient Identifiers matching the identifier and type 113 * 114 * @param identifier 115 * @param PatientIdentifierType 116 * @return patientIdentifier list 117 * @throws DAOException 59 * @see org.openmrs.api.PatientService#getPatients(java.lang.String, java.lang.String, java.util.List) 118 60 */ 119 public List<PatientIdentifier> getPatientIdentifiers(String identifier, PatientIdentifierType p) throws DAOException; 61 public List<Patient> getPatients(String name, String identifier, List<PatientIdentifierType> identifierTypes) 62 throws DAOException; 63 64 /** 65 * @see org.openmrs.api.PatientService#getPatientIdentifiers(java.lang.String, java.util.List, java.util.List, java.util.List, java.lang.Boolean) 66 */ 67 public List<PatientIdentifier> getPatientIdentifiers(String identifier, 68 List<PatientIdentifierType> patientIdentifierTypes, 69 List<Location> locations, List<Patient> patients, 70 Boolean isPreferred) 71 throws DAOException; 72 73 /** 74 * @see org.openmrs.api.PatientService#savePatientIdentifierType(org.openmrs.PatientIdentifierType) 75 */ 76 public PatientIdentifierType savePatientIdentifierType( 77 PatientIdentifierType patientIdentifierType) throws DAOException; 78 79 /** 80 * @see org.openmrs.api.PatientService#getAllPatientIdentifierTypes(boolean) 81 */ 82 public List<PatientIdentifierType> getAllPatientIdentifierTypes(boolean includeRetired) 83 throws DAOException; 120 84 121 85 122 86 /** 123 * 124 * @param pi 125 * @throws APIException 87 * @see org.openmrs.api.PatientService#getPatientIdentifierTypes(java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean) 126 88 */ 127 public void updatePatientIdentifier(PatientIdentifier pi) throws APIException; 128 129 89 public List<PatientIdentifierType> getPatientIdentifierTypes(String name, 90 String format, Boolean required, Boolean hasCheckDigit) 91 throws DAOException; 130 92 /** 131 * Get all patientIdentifier types 132 * 133 * @return patientIdentifier types list 134 * @throws DAOException 93 * @see org.openmrs.api.PatientService#getPatientIdentifierType(java.lang.Integer) 135 94 */ 136 public List<PatientIdentifierType> getPatientIdentifierTypes() throws DAOException; 95 public PatientIdentifierType getPatientIdentifierType( 96 Integer patientIdentifierTypeId) throws DAOException; 137 97 138 98 /** 139 * Get patientIdentifierType by internal identifier 140 * 141 * @param patientIdentifierType id 142 * @return patientIdentifierType with given internal identifier 143 * @throws DAOException 99 * @see org.openmrs.api.PatientService#purgePatientIdentifierType(org.openmrs.PatientIdentifierType) 144 100 */ 145 public PatientIdentifierType getPatientIdentifierType(Integer patientIdentifierTypeId) throws DAOException; 101 public void deletePatientIdentifierType( 102 PatientIdentifierType patientIdentifierType) throws DAOException; 146 103 147 /**148 * Get patientIdentifierType by name149 *150 * @param name151 * @return patientIdentifierType with given name152 * @throws APIException153 */154 public PatientIdentifierType getPatientIdentifierType(String name) throws DAOException;155 156 104 /** 157 105 * Get tribe by internal tribe identifier … … 160 108 * @param tribeId 161 109 * @throws DAOException 110 * @deprecated tribe will be moved to patient attribute 162 111 */ 163 112 public Tribe getTribe(Integer tribeId) throws DAOException; … … 168 117 * @return non-retired Tribe list 169 118 * @throws DAOException 119 * @deprecated tribe will be moved to patient attribute 170 120 */ 171 121 public List<Tribe> getTribes() throws DAOException; … … 177 127 * @return non-retired Tribe list 178 128 * @throws DAOException 129 * @deprecated tribe will be moved to patient attribute 179 130 */ 180 131 public List<Tribe> findTribes(String s) throws DAOException; 181 132 182 133 /** 183 * Search the database for patients that share the given attributes 184 * attributes similar to: [gender, tribe, givenName, middleName, familyname] 185 * 186 * @param attributes 187 * @return list of patients that match other patients 134 * @see org.openmrs.api.PatientService#getDuplicatePatientsByAttributes(java.util.List) 188 135 */ 189 public List<Patient> findDuplicatePatients(Set<String> attributes);136 public List<Patient> getDuplicatePatientsByAttributes(List<String> attributes) throws DAOException; 190 137 191 138 }