Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
05/24/08 14:37:02 (8 months ago)
Author:
bwolfe
Message:

Merging api-refactoring to trunk [3595]:[4355]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs/trunk/src/api/org/openmrs/api/db/PatientDAO.java

    r4095 r4358  
    1414package org.openmrs.api.db; 
    1515 
    16 import java.util.Collection; 
    1716import java.util.List; 
    18 import java.util.Set; 
    1917 
     18import org.openmrs.Location; 
    2019import org.openmrs.Patient; 
    2120import org.openmrs.PatientIdentifier; 
    2221import org.openmrs.PatientIdentifierType; 
    2322import org.openmrs.Tribe; 
    24 import org.openmrs.api.APIException; 
    2523 
    2624/** 
    27  * Patient-related database functions 
     25 * Database methods for the PatientService 
    2826 * 
    29  * @version 1.0 
     27 * @see org.openmrs.api.context.Context 
     28 * @see org.openmrs.api.PatientService 
    3029 */ 
    3130public interface PatientDAO { 
    3231 
    3332        /** 
    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) 
    3934         */ 
    40         public Patient createPatient(Patient patient) throws DAOException; 
     35        public Patient savePatient(Patient patient) throws DAOException; 
    4136 
    4237        /** 
    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) 
    4839         */ 
    4940        public Patient getPatient(Integer patientId) throws DAOException; 
    5041 
    5142        /** 
    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 
    9545         *  
    9646         * @param patient patient to be deleted 
    9747         *  
    98          * @see #voidPatient(Patient, String)  
     48         * @see org.openmrs.api.PatientService#deletePatient(org.openmrs.Patient) 
     49         * @see #voidPatient(Patient, String) 
    9950         */ 
    10051        public void deletePatient(Patient patient) throws DAOException; 
    10152         
    10253        /** 
    103          * Get all patientIdentifiers 
    104          *  
    105          * @param PatientIdentifierType 
    106          * @return patientIdentifier list 
    107          * @throws DAOException 
     54     * @see org.openmrs.api.PatientService#getAllPatients(boolean) 
    10855         */ 
    109        public List<PatientIdentifier> getPatientIdentifiers(PatientIdentifierType p) throws DAOException; 
     56    public List<Patient> getAllPatients(boolean includeVoided) throws DAOException; 
    11057         
    11158        /** 
    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) 
    11860         */ 
    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; 
    12084         
    12185         
    12286        /** 
    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) 
    12688         */ 
    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; 
    13092        /** 
    131          * Get all patientIdentifier types 
    132          *  
    133          * @return patientIdentifier types list 
    134          * @throws DAOException 
     93         * @see org.openmrs.api.PatientService#getPatientIdentifierType(java.lang.Integer) 
    13594         */ 
    136         public List<PatientIdentifierType> getPatientIdentifierTypes() throws DAOException; 
     95        public PatientIdentifierType getPatientIdentifierType( 
     96                Integer patientIdentifierTypeId) throws DAOException; 
    13797 
    13898        /** 
    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) 
    144100         */ 
    145         public PatientIdentifierType getPatientIdentifierType(Integer patientIdentifierTypeId) throws DAOException; 
     101        public void deletePatientIdentifierType( 
     102                PatientIdentifierType patientIdentifierType) throws DAOException; 
    146103 
    147         /** 
    148          * Get patientIdentifierType by name 
    149          *  
    150          * @param name 
    151          * @return patientIdentifierType with given name 
    152          * @throws APIException 
    153          */ 
    154         public PatientIdentifierType getPatientIdentifierType(String name) throws DAOException; 
    155          
    156104        /** 
    157105         * Get tribe by internal tribe identifier 
     
    160108         * @param tribeId  
    161109         * @throws DAOException 
     110         * @deprecated tribe will be moved to patient attribute 
    162111         */ 
    163112        public Tribe getTribe(Integer tribeId) throws DAOException; 
     
    168117         * @return non-retired Tribe list 
    169118         * @throws DAOException 
     119         * @deprecated tribe will be moved to patient attribute 
    170120         */ 
    171121        public List<Tribe> getTribes() throws DAOException; 
     
    177127         * @return non-retired Tribe list 
    178128         * @throws DAOException 
     129         * @deprecated tribe will be moved to patient attribute 
    179130         */ 
    180131        public List<Tribe> findTribes(String s) throws DAOException; 
    181132         
    182133        /** 
    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) 
    188135         */ 
    189        public List<Patient> findDuplicatePatients(Set<String> attributes)
     136    public List<Patient> getDuplicatePatientsByAttributes(List<String> attributes) throws DAOException
    190137         
    191138}