Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
05/09/08 10:53:35 (2 months ago)
Author:
bwolfe
Message:

Merging report-api-refactoring to trunk [2696]:[4157]

Files:

Legend:

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

    r4095 r4158  
    1818import java.util.Set; 
    1919 
     20import org.openmrs.Cohort; 
    2021import org.openmrs.Concept; 
    2122import org.openmrs.Encounter; 
     
    2627import org.openmrs.annotation.Authorized; 
    2728import org.openmrs.api.db.ObsDAO; 
    28 import org.openmrs.logic.Aggregation; 
    29 import org.openmrs.logic.Constraint; 
    30 import org.openmrs.reporting.PatientSet; 
    3129import org.openmrs.util.OpenmrsConstants; 
    3230import org.springframework.transaction.annotation.Transactional; 
     
    4745@Transactional 
    4846public interface ObsService { 
    49          
     47 
    5048        public static final Integer PERSON = 1; 
    5149        public static final Integer PATIENT = 2; 
    5250        public static final Integer USER = 4; 
    53          
     51 
    5452        public void setObsDAO(ObsDAO dao); 
    5553 
     
    6260        @Authorized({OpenmrsConstants.PRIV_ADD_OBS}) 
    6361        public void createObs(Obs obs) throws APIException; 
    64          
     62 
    6563        /** 
    6664         * Create a grouping of observations (observations linked by 
     
    7674         * </pre> 
    7775         *  
    78          * @param obs array of observations to be grouped 
     76         * @param obs - array of observations to be grouped 
    7977         * @throws APIException 
    8078         * @deprecated This method should no longer need to be called on the api. This 
     
    9088         * Get an observation 
    9189         *  
    92          * @param integer 
    93          *            obsId of observation desired 
     90         * @param integer obsId of observation desired 
    9491         * @return matching Obs 
    9592         * @throws APIException 
     
    111108         * Equivalent to deleting an observation 
    112109         *  
    113          * @param Obs 
    114          *            obs to void 
    115          * @param String 
    116          *            reason 
     110         * @param Obs obs to void 
     111         * @param String reason 
    117112         * @throws APIException 
    118113         */ 
     
    138133        @Authorized({OpenmrsConstants.PRIV_DELETE_OBS}) 
    139134        public void deleteObs(Obs obs) throws APIException; 
    140          
     135 
    141136        /** 
    142137         * Get all mime types 
     
    151146         * Get mimeType by internal identifier 
    152147         *  
    153          * @param mimeType 
    154          *            id 
     148         * @param mimeType id 
    155149         * @return mimeType with given internal identifier 
    156150         * @throws APIException 
     
    180174         */ 
    181175        @Transactional(readOnly = true) 
    182         public List<Obs> getObservations(Concept c, Location loc, String sort, Integer personType, boolean includeVoided); 
     176        public List<Obs> getObservations(Concept c, Location loc, String sort, 
     177                Integer personType, boolean includeVoided); 
    183178 
    184179        /** 
     
    191186         */ 
    192187        @Transactional(readOnly = true) 
    193         public Set<Obs> getObservations(Person who, Concept question, boolean includeVoided); 
     188        public Set<Obs> getObservations(Person who, Concept question, 
     189                boolean includeVoided); 
    194190 
    195191        /** 
    196192         * e.g. get last 'n' number of observations for a person for given concept 
    197193         *  
    198          * @param n 
    199          *            number of concepts to retrieve 
     194         * @param n number of concepts to retrieve 
    200195         * @param who 
    201196         * @param question 
     
    204199        @Transactional(readOnly = true) 
    205200        public List<Obs> getLastNObservations(Integer n, Person who, 
    206                        Concept question, boolean includeVoided); 
     201                Concept question, boolean includeVoided); 
    207202 
    208203        /** 
    209204         * e.g. get all observations referring to RETURN VISIT DATE 
    210205         *  
    211          * @param question 
    212          *            (Concept: RETURN VISIT DATE) 
    213          * @param sort 
    214          *                        (obsId, obsDatetime, etc) if null, defaults to obsId 
    215          * @param personType 
    216          *  
    217          * @return 
    218          */ 
    219         @Transactional(readOnly = true) 
    220         public List<Obs> getObservations(Concept question, String sort, Integer personType, boolean includeVoided); 
    221  
    222         /** 
    223          * Return all observations that have the given concept as an answer 
    224          * (<code>answer.getConceptId()</code> == value_coded) 
     206         * @param question (Concept: RETURN VISIT DATE) 
     207         * @param sort (obsId, obsDatetime, etc) if null, defaults to obsId 
     208         * @param personType 
     209         *  
     210         * @return 
     211         */ 
     212        @Transactional(readOnly = true) 
     213        public List<Obs> getObservations(Concept question, String sort, 
     214                Integer personType, boolean includeVoided); 
     215 
     216        /** 
     217         * Return all observations that have the given concept as an answer (<code>answer.getConceptId()</code> == 
     218         * value_coded) 
    225219         *  
    226220         * @param concept 
     
    229223         */ 
    230224        @Transactional(readOnly = true) 
    231         public List<Obs> getObservationsAnsweredByConcept(Concept answer, Integer personType, boolean includeVoided); 
    232          
     225        public List<Obs> getObservationsAnsweredByConcept(Concept answer, 
     226                Integer personType, boolean includeVoided); 
     227 
    233228        /** 
    234229         * Return all numeric answer values for the given concept ordered by value 
     
    238233         *  
    239234         * @param concept 
    240          * @param sortByValue true/false if sorting by valueNumeric.  If false, will sort by obsDatetime 
    241          * @param personType 
    242          *  
    243          * @return List<Object[]> [0]=<code>obsId</code>, [1]=<code>obsDatetime</code>, [2]=<code>valueNumeric</code>s 
    244          */ 
    245         @Transactional(readOnly = true) 
    246         public List<Object[]> getNumericAnswersForConcept(Concept answer, Boolean sortByValue, Integer personType, boolean includeVoided); 
    247          
     235         * @param sortByValue true/false if sorting by valueNumeric. If false, will 
     236         *        sort by obsDatetime 
     237         * @param personType 
     238         *  
     239         * @return List<Object[]> [0]=<code>obsId</code>, [1]=<code>obsDatetime</code>, 
     240         *         [2]=<code>valueNumeric</code>s 
     241         */ 
     242        @Transactional(readOnly = true) 
     243        public List<Object[]> getNumericAnswersForConcept(Concept answer, 
     244                Boolean sortByValue, Integer personType, boolean includeVoided); 
     245 
    248246        /** 
    249247         * Get all observations from a specific encounter 
     
    274272         */ 
    275273        @Transactional(readOnly = true) 
    276         public List<Obs> findObservations(String search, boolean includeVoided, Integer personType); 
     274        public List<Obs> findObservations(String search, boolean includeVoided, 
     275                Integer personType); 
    277276 
    278277        /** 
     
    283282         */ 
    284283        @Transactional(readOnly = true) 
    285         public List<String> getDistinctObservationValues(Concept question, Integer personType); 
     284        public List<String> getDistinctObservationValues(Concept question, 
     285                Integer personType); 
    286286 
    287287        /** 
     
    291291        @Transactional(readOnly = true) 
    292292        public List<Obs> findObsByGroupId(Integer obsGroupId); 
    293  
    294         @Transactional(readOnly = true) 
    295         @Authorized( { "View Person" }) 
    296         public List<Obs> getObservations(Person who, Aggregation aggregation, 
    297                         Concept question, Constraint constraint); 
    298293         
    299294        /** 
     
    324319         * Get all Observations for this patient set, for these concepts, between these dates.  Ideal for getting things like recent lab results for a set of patients 
    325320         *  
    326          * @param ps the patientset for which to retrieve data for - null means all patients 
     321         * @param patients the patientset for which to retrieve data for - null means all patients 
    327322         * @param concepts list of the concepts for which to retrieve obs - null means all obs 
    328323         * @param fromDate lower bound for date - null means no lower bound 
     
    331326         */ 
    332327        @Transactional(readOnly=true) 
    333         public List<Obs> getObservations(PatientSet patients, List<Concept> concepts, Date fromDate, Date toDate); 
     328        public List<Obs> getObservations(Cohort patients, List<Concept> concepts, Date fromDate, Date toDate); 
    334329}