Changeset 4158 for openmrs/trunk/src/api/org/openmrs/api/ObsService.java
- Timestamp:
- 05/09/08 10:53:35 (2 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs/trunk/src/api/org/openmrs/api/ObsService.java
r4095 r4158 18 18 import java.util.Set; 19 19 20 import org.openmrs.Cohort; 20 21 import org.openmrs.Concept; 21 22 import org.openmrs.Encounter; … … 26 27 import org.openmrs.annotation.Authorized; 27 28 import org.openmrs.api.db.ObsDAO; 28 import org.openmrs.logic.Aggregation;29 import org.openmrs.logic.Constraint;30 import org.openmrs.reporting.PatientSet;31 29 import org.openmrs.util.OpenmrsConstants; 32 30 import org.springframework.transaction.annotation.Transactional; … … 47 45 @Transactional 48 46 public interface ObsService { 49 47 50 48 public static final Integer PERSON = 1; 51 49 public static final Integer PATIENT = 2; 52 50 public static final Integer USER = 4; 53 51 54 52 public void setObsDAO(ObsDAO dao); 55 53 … … 62 60 @Authorized({OpenmrsConstants.PRIV_ADD_OBS}) 63 61 public void createObs(Obs obs) throws APIException; 64 62 65 63 /** 66 64 * Create a grouping of observations (observations linked by … … 76 74 * </pre> 77 75 * 78 * @param obs array of observations to be grouped76 * @param obs - array of observations to be grouped 79 77 * @throws APIException 80 78 * @deprecated This method should no longer need to be called on the api. This … … 90 88 * Get an observation 91 89 * 92 * @param integer 93 * obsId of observation desired 90 * @param integer obsId of observation desired 94 91 * @return matching Obs 95 92 * @throws APIException … … 111 108 * Equivalent to deleting an observation 112 109 * 113 * @param Obs 114 * obs to void 115 * @param String 116 * reason 110 * @param Obs obs to void 111 * @param String reason 117 112 * @throws APIException 118 113 */ … … 138 133 @Authorized({OpenmrsConstants.PRIV_DELETE_OBS}) 139 134 public void deleteObs(Obs obs) throws APIException; 140 135 141 136 /** 142 137 * Get all mime types … … 151 146 * Get mimeType by internal identifier 152 147 * 153 * @param mimeType 154 * id 148 * @param mimeType id 155 149 * @return mimeType with given internal identifier 156 150 * @throws APIException … … 180 174 */ 181 175 @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); 183 178 184 179 /** … … 191 186 */ 192 187 @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); 194 190 195 191 /** 196 192 * e.g. get last 'n' number of observations for a person for given concept 197 193 * 198 * @param n 199 * number of concepts to retrieve 194 * @param n number of concepts to retrieve 200 195 * @param who 201 196 * @param question … … 204 199 @Transactional(readOnly = true) 205 200 public List<Obs> getLastNObservations(Integer n, Person who, 206 Concept question, boolean includeVoided);201 Concept question, boolean includeVoided); 207 202 208 203 /** 209 204 * e.g. get all observations referring to RETURN VISIT DATE 210 205 * 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) 225 219 * 226 220 * @param concept … … 229 223 */ 230 224 @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 233 228 /** 234 229 * Return all numeric answer values for the given concept ordered by value … … 238 233 * 239 234 * @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 248 246 /** 249 247 * Get all observations from a specific encounter … … 274 272 */ 275 273 @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); 277 276 278 277 /** … … 283 282 */ 284 283 @Transactional(readOnly = true) 285 public List<String> getDistinctObservationValues(Concept question, Integer personType); 284 public List<String> getDistinctObservationValues(Concept question, 285 Integer personType); 286 286 287 287 /** … … 291 291 @Transactional(readOnly = true) 292 292 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);298 293 299 294 /** … … 324 319 * 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 325 320 * 326 * @param p s the patientset for which to retrieve data for - null means all patients321 * @param patients the patientset for which to retrieve data for - null means all patients 327 322 * @param concepts list of the concepts for which to retrieve obs - null means all obs 328 323 * @param fromDate lower bound for date - null means no lower bound … … 331 326 */ 332 327 @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); 334 329 }