| 1 |
/** |
|---|
| 2 |
* The contents of this file are subject to the OpenMRS Public License |
|---|
| 3 |
* Version 1.0 (the "License"); you may not use this file except in |
|---|
| 4 |
* compliance with the License. You may obtain a copy of the License at |
|---|
| 5 |
* http://license.openmrs.org |
|---|
| 6 |
* |
|---|
| 7 |
* Software distributed under the License is distributed on an "AS IS" |
|---|
| 8 |
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|---|
| 9 |
* License for the specific language governing rights and limitations |
|---|
| 10 |
* under the License. |
|---|
| 11 |
* |
|---|
| 12 |
* Copyright (C) OpenMRS, LLC. All Rights Reserved. |
|---|
| 13 |
*/ |
|---|
| 14 |
package org.openmrs.api.db; |
|---|
| 15 |
|
|---|
| 16 |
import java.util.List; |
|---|
| 17 |
|
|---|
| 18 |
import org.openmrs.Location; |
|---|
| 19 |
import org.openmrs.Patient; |
|---|
| 20 |
import org.openmrs.PatientIdentifier; |
|---|
| 21 |
import org.openmrs.PatientIdentifierType; |
|---|
| 22 |
import org.openmrs.Tribe; |
|---|
| 23 |
|
|---|
| 24 |
/** |
|---|
| 25 |
* Database methods for the PatientService |
|---|
| 26 |
* |
|---|
| 27 |
* @see org.openmrs.api.context.Context |
|---|
| 28 |
* @see org.openmrs.api.PatientService |
|---|
| 29 |
*/ |
|---|
| 30 |
public interface PatientDAO { |
|---|
| 31 |
|
|---|
| 32 |
/** |
|---|
| 33 |
* @see org.openmrs.api.PatientService#savePatient(org.openmrs.Patient) |
|---|
| 34 |
*/ |
|---|
| 35 |
public Patient savePatient(Patient patient) throws DAOException; |
|---|
| 36 |
|
|---|
| 37 |
/** |
|---|
| 38 |
* @see org.openmrs.api.PatientService#getPatient(Integer) |
|---|
| 39 |
*/ |
|---|
| 40 |
public Patient getPatient(Integer patientId) throws DAOException; |
|---|
| 41 |
|
|---|
| 42 |
/** |
|---|
| 43 |
* Delete patient from database. This <b>should not be called</b> except |
|---|
| 44 |
* for testing and administration purposes. Use the void method instead |
|---|
| 45 |
* |
|---|
| 46 |
* @param patient patient to be deleted |
|---|
| 47 |
* |
|---|
| 48 |
* @see org.openmrs.api.PatientService#deletePatient(org.openmrs.Patient) |
|---|
| 49 |
* @see #voidPatient(Patient, String) |
|---|
| 50 |
*/ |
|---|
| 51 |
public void deletePatient(Patient patient) throws DAOException; |
|---|
| 52 |
|
|---|
| 53 |
/** |
|---|
| 54 |
* @see org.openmrs.api.PatientService#getAllPatients(boolean) |
|---|
| 55 |
*/ |
|---|
| 56 |
public List<Patient> getAllPatients(boolean includeVoided) throws DAOException; |
|---|
| 57 |
|
|---|
| 58 |
/** |
|---|
| 59 |
* @see org.openmrs.api.PatientService#getPatients(java.lang.String, java.lang.String, java.util.List, boolean) |
|---|
| 60 |
*/ |
|---|
| 61 |
public List<Patient> getPatients(String name, String identifier, List<PatientIdentifierType> identifierTypes, boolean matchIdentifierExactly) |
|---|
| 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; |
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
/** |
|---|
| 87 |
* @see org.openmrs.api.PatientService#getPatientIdentifierTypes(java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean) |
|---|
| 88 |
*/ |
|---|
| 89 |
public List<PatientIdentifierType> getPatientIdentifierTypes(String name, |
|---|
| 90 |
String format, Boolean required, Boolean hasCheckDigit) |
|---|
| 91 |
throws DAOException; |
|---|
| 92 |
/** |
|---|
| 93 |
* @see org.openmrs.api.PatientService#getPatientIdentifierType(java.lang.Integer) |
|---|
| 94 |
*/ |
|---|
| 95 |
public PatientIdentifierType getPatientIdentifierType( |
|---|
| 96 |
Integer patientIdentifierTypeId) throws DAOException; |
|---|
| 97 |
|
|---|
| 98 |
/** |
|---|
| 99 |
* @see org.openmrs.api.PatientService#purgePatientIdentifierType(org.openmrs.PatientIdentifierType) |
|---|
| 100 |
*/ |
|---|
| 101 |
public void deletePatientIdentifierType( |
|---|
| 102 |
PatientIdentifierType patientIdentifierType) throws DAOException; |
|---|
| 103 |
|
|---|
| 104 |
/** |
|---|
| 105 |
* Get tribe by internal tribe identifier |
|---|
| 106 |
* |
|---|
| 107 |
* @return Tribe |
|---|
| 108 |
* @param tribeId |
|---|
| 109 |
* @throws DAOException |
|---|
| 110 |
* @deprecated tribe will be moved to patient attribute |
|---|
| 111 |
*/ |
|---|
| 112 |
public Tribe getTribe(Integer tribeId) throws DAOException; |
|---|
| 113 |
|
|---|
| 114 |
/** |
|---|
| 115 |
* Get list of tribes that are not retired |
|---|
| 116 |
* |
|---|
| 117 |
* @return non-retired Tribe list |
|---|
| 118 |
* @throws DAOException |
|---|
| 119 |
* @deprecated tribe will be moved to patient attribute |
|---|
| 120 |
*/ |
|---|
| 121 |
public List<Tribe> getTribes() throws DAOException; |
|---|
| 122 |
|
|---|
| 123 |
/** |
|---|
| 124 |
* Get tribes by partial name lookup |
|---|
| 125 |
* |
|---|
| 126 |
* @param Search string |
|---|
| 127 |
* @return non-retired Tribe list |
|---|
| 128 |
* @throws DAOException |
|---|
| 129 |
* @deprecated tribe will be moved to patient attribute |
|---|
| 130 |
*/ |
|---|
| 131 |
public List<Tribe> findTribes(String s) throws DAOException; |
|---|
| 132 |
|
|---|
| 133 |
/** |
|---|
| 134 |
* @see org.openmrs.api.PatientService#getDuplicatePatientsByAttributes(java.util.List) |
|---|
| 135 |
*/ |
|---|
| 136 |
public List<Patient> getDuplicatePatientsByAttributes(List<String> attributes) throws DAOException; |
|---|
| 137 |
|
|---|
| 138 |
} |
|---|