- 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/PatientSetService.java
r4095 r4158 19 19 import java.util.Map; 20 20 21 import org.openmrs.Cohort; 21 22 import org.openmrs.Concept; 22 23 import org.openmrs.Drug; … … 41 42 import org.openmrs.api.db.DAOException; 42 43 import org.openmrs.api.db.PatientSetDAO; 43 import org.openmrs.reporting.PatientAnalysis;44 import org.openmrs.reporting.PatientSet;45 44 import org.springframework.transaction.annotation.Transactional; 46 45 … … 55 54 */ 56 55 @Transactional(readOnly=true) 57 public String exportXml( PatientSet ps);56 public String exportXml(Cohort ps); 58 57 59 58 @Transactional(readOnly=true) … … 61 60 62 61 @Transactional(readOnly=true) 63 public PatientSet getAllPatients() throws DAOException;64 65 @Transactional(readOnly=true) 66 public PatientSet getPatientsByCharacteristics(String gender,62 public Cohort getAllPatients() throws DAOException; 63 64 @Transactional(readOnly=true) 65 public Cohort getPatientsByCharacteristics(String gender, 67 66 Date minBirthdate, Date maxBirthdate) throws DAOException; 68 67 69 68 @Transactional(readOnly=true) 70 public PatientSet getPatientsByCharacteristics(String gender,69 public Cohort getPatientsByCharacteristics(String gender, 71 70 Date minBirthdate, Date maxBirthdate, Integer minAge, 72 71 Integer maxAge, Boolean aliveOnly, Boolean deadOnly) 73 72 throws DAOException; 74 75 @Transactional(readOnly=true) 76 public PatientSet getPatientsHavingNumericObs(Integer conceptId, 73 74 @Transactional(readOnly=true) 75 public Cohort getPatientsByCharacteristics(String gender, 76 Date minBirthdate, Date maxBirthdate, Integer minAge, 77 Integer maxAge, Boolean aliveOnly, Boolean deadOnly, Date effectiveDate) 78 throws DAOException; 79 80 @Transactional(readOnly=true) 81 public Cohort getPatientsHavingNumericObs(Integer conceptId, 77 82 TimeModifier timeModifier, PatientSetService.Modifier modifier, 78 83 Number value, Date fromDate, Date toDate); 79 84 80 85 @Transactional(readOnly=true) 81 public PatientSet getPatientsHavingObs(Integer conceptId,86 public Cohort getPatientsHavingObs(Integer conceptId, 82 87 TimeModifier timeModifier, Modifier modifier, Object value, 83 88 Date fromDate, Date toDate); 84 89 85 90 @Transactional(readOnly=true) 86 public PatientSet getPatientsHavingEncounters(EncounterType encounterType, Location location, Form form, Date fromDate, Date toDate, Integer minCount, Integer maxCount);87 88 @Transactional(readOnly=true) 89 public PatientSet getPatientsHavingEncounters(List<EncounterType> encounterTypeList, Location location, Form form, Date fromDate, Date toDate, Integer minCount, Integer maxCount);90 91 @Transactional(readOnly=true) 92 public PatientSet getPatientsByProgramAndState(Program program, List<ProgramWorkflowState> stateList, Date fromDate, Date toDate);93 94 @Transactional(readOnly=true) 95 public PatientSet getPatientsInProgram(Program program, Date fromDate, Date toDate);96 97 @Transactional(readOnly=true) 98 public PatientSet getPatientsHavingDateObs(Integer conceptId, Date startTime, Date endTime);99 100 @Transactional(readOnly=true) 101 public PatientSet getPatientsHavingTextObs(Concept concept, String value, TimeModifier timeModifier);102 103 @Transactional(readOnly=true) 104 public PatientSet getPatientsHavingTextObs(Integer conceptId, String value, TimeModifier timeModifier);105 106 @Transactional(readOnly=true) 107 public PatientSet getPatientsHavingLocation(Location loc);108 109 @Transactional(readOnly=true) 110 public PatientSet getPatientsHavingLocation(Location loc, PatientLocationMethod method);111 112 @Transactional(readOnly=true) 113 public PatientSet getPatientsHavingLocation(Integer locationId);114 115 @Transactional(readOnly=true) 116 public PatientSet getPatientsHavingLocation(Integer locationId, PatientLocationMethod method);117 118 /** 119 * Returns a PatientSet of patient who had drug orders for a set of drugs active on a certain date.91 public Cohort getPatientsHavingEncounters(EncounterType encounterType, Location location, Form form, Date fromDate, Date toDate, Integer minCount, Integer maxCount); 92 93 @Transactional(readOnly=true) 94 public Cohort getPatientsHavingEncounters(List<EncounterType> encounterTypeList, Location location, Form form, Date fromDate, Date toDate, Integer minCount, Integer maxCount); 95 96 @Transactional(readOnly=true) 97 public Cohort getPatientsByProgramAndState(Program program, List<ProgramWorkflowState> stateList, Date fromDate, Date toDate); 98 99 @Transactional(readOnly=true) 100 public Cohort getPatientsInProgram(Program program, Date fromDate, Date toDate); 101 102 @Transactional(readOnly=true) 103 public Cohort getPatientsHavingDateObs(Integer conceptId, Date startTime, Date endTime); 104 105 @Transactional(readOnly=true) 106 public Cohort getPatientsHavingTextObs(Concept concept, String value, TimeModifier timeModifier); 107 108 @Transactional(readOnly=true) 109 public Cohort getPatientsHavingTextObs(Integer conceptId, String value, TimeModifier timeModifier); 110 111 @Transactional(readOnly=true) 112 public Cohort getPatientsHavingLocation(Location loc); 113 114 @Transactional(readOnly=true) 115 public Cohort getPatientsHavingLocation(Location loc, PatientLocationMethod method); 116 117 @Transactional(readOnly=true) 118 public Cohort getPatientsHavingLocation(Integer locationId); 119 120 @Transactional(readOnly=true) 121 public Cohort getPatientsHavingLocation(Integer locationId, PatientLocationMethod method); 122 123 /** 124 * Returns a Cohort of patient who had drug orders for a set of drugs active on a certain date. 120 125 * Can also be used to find patient with no drug orders on that date. 121 126 * @param patientIds Collection of patientIds you're interested in. NULL means all patients. … … 124 129 */ 125 130 @Transactional(readOnly=true) 126 public PatientSet getPatientsHavingDrugOrder(131 public Cohort getPatientsHavingDrugOrder( 127 132 Collection<Integer> patientIds, Collection<Integer> takingIds, 128 133 Date onDate); 129 134 130 135 /** 131 * Returns a PatientSet of patient who had drug orders for a set of drugs active between a pair of dates.136 * Returns a Cohort of patient who had drug orders for a set of drugs active between a pair of dates. 132 137 * Can also be used to find patient with no drug orders on that date. 133 138 * @param patientIds Collection of patientIds you're interested in. NULL means all patients. … … 138 143 */ 139 144 @Transactional(readOnly=true) 140 public PatientSet getPatientsHavingDrugOrder(145 public Cohort getPatientsHavingDrugOrder( 141 146 Collection<Integer> patientIds, Collection<Integer> drugIds, GroupMethod groupMethod, 142 147 Date fromDate, Date toDate); 143 148 144 149 /** 145 * @return A PatientSet of patients who had drug order for particular drugs or generics, with start dates within a range, with end dates within a range, and a reason for discontinuation.146 */ 147 @Transactional(readOnly=true) 148 public PatientSet getPatientsHavingDrugOrder(150 * @return A Cohort of patients who had drug order for particular drugs or generics, with start dates within a range, with end dates within a range, and a reason for discontinuation. 151 */ 152 @Transactional(readOnly=true) 153 public Cohort getPatientsHavingDrugOrder( 149 154 List<Drug> drug, List<Concept> drugConcept, 150 155 Date startDateFrom, Date startDateTo, … … 156 161 * @param attribute if not null, look for this attribute 157 162 * @param value if not null, look for this value 158 * @return PatientSet of patients who have a person attribute (optionally) with attributeType of attribute and (optionally) value of value.159 */ 160 @Transactional(readOnly=true) 161 public PatientSet getPatientsHavingPersonAttribute(PersonAttributeType attribute, String value);163 * @return Cohort of patients who have a person attribute (optionally) with attributeType of attribute and (optionally) value of value. 164 */ 165 @Transactional(readOnly=true) 166 public Cohort getPatientsHavingPersonAttribute(PersonAttributeType attribute, String value); 162 167 163 168 @Transactional(readOnly=true) … … 166 171 167 172 @Transactional(readOnly=true) 168 public Map<Integer, List<Obs>> getObservations( PatientSet patients,173 public Map<Integer, List<Obs>> getObservations(Cohort patients, 169 174 Concept concept); 170 175 … … 173 178 */ 174 179 @Transactional(readOnly=true) 175 public Map<Integer, List<Obs>> getObservations( PatientSet patients,180 public Map<Integer, List<Obs>> getObservations(Cohort patients, 176 181 Concept concept, Date fromDate, Date toDate); 177 182 … … 185 190 */ 186 191 @Transactional(readOnly=true) 187 public Map<Integer, List<List<Object>>> getObservationsValues( PatientSet patients, Concept c);192 public Map<Integer, List<List<Object>>> getObservationsValues(Cohort patients, Concept c); 188 193 189 194 /** … … 199 204 */ 200 205 @Transactional(readOnly=true) 201 public Map<Integer, List<List<Object>>> getObservationsValues( PatientSet patients, Concept c, List<String> attributes);206 public Map<Integer, List<List<Object>>> getObservationsValues(Cohort patients, Concept c, List<String> attributes); 202 207 203 208 /** … … 208 213 */ 209 214 @Transactional(readOnly=true) 210 public Map<Integer, Encounter> getEncountersByType( PatientSet patients, EncounterType encType);215 public Map<Integer, Encounter> getEncountersByType(Cohort patients, EncounterType encType); 211 216 212 217 /** … … 217 222 * @return 218 223 */ 219 public Map<Integer, Object> getEncounterAttrsByType( PatientSet patients, List<EncounterType> encTypes, String attr);224 public Map<Integer, Object> getEncounterAttrsByType(Cohort patients, List<EncounterType> encTypes, String attr); 220 225 221 226 /** … … 226 231 */ 227 232 @Transactional(readOnly=true) 228 public Map<Integer, Encounter> getEncountersByType( PatientSet patients, List<EncounterType> encType);229 230 231 232 /** 233 * 234 * @param patients 235 * @return 236 */ 237 @Transactional(readOnly=true) 238 public Map<Integer, Encounter> getEncounters( PatientSet patients);233 public Map<Integer, Encounter> getEncountersByType(Cohort patients, List<EncounterType> encType); 234 235 236 237 /** 238 * 239 * @param patients 240 * @return 241 */ 242 @Transactional(readOnly=true) 243 public Map<Integer, Encounter> getEncounters(Cohort patients); 239 244 240 245 /** … … 246 251 @Transactional(readOnly=true) 247 252 public Map<Integer, Encounter> getFirstEncountersByType( 248 PatientSet patients, EncounterType encType);253 Cohort patients, EncounterType encType); 249 254 250 255 /** … … 255 260 */ 256 261 @Transactional(readOnly=true) 257 public Map<Integer, Encounter> getFirstEncountersByType( PatientSet patients, List<EncounterType> types);262 public Map<Integer, Encounter> getFirstEncountersByType(Cohort patients, List<EncounterType> types); 258 263 259 264 … … 266 271 */ 267 272 @Transactional(readOnly=true) 268 public Map<Integer, Object> getFirstEncounterAttrsByType( PatientSet patients, List<EncounterType> encTypes, String attr);273 public Map<Integer, Object> getFirstEncounterAttrsByType(Cohort patients, List<EncounterType> encTypes, String attr); 269 274 270 275 … … 278 283 */ 279 284 @Transactional(readOnly=true) 280 public Map<Integer, Object> getPatientAttributes( PatientSet patients,285 public Map<Integer, Object> getPatientAttributes(Cohort patients, 281 286 String className, String property, boolean returnAll); 282 287 … … 289 294 */ 290 295 @Transactional(readOnly=true) 291 public Map<Integer, Object> getPatientAttributes( PatientSet patients,296 public Map<Integer, Object> getPatientAttributes(Cohort patients, 292 297 String classNameDotProperty, boolean returnAll); 293 298 … … 302 307 * @return 303 308 */@Transactional(readOnly=true) 304 public Map<Integer, Object> getPersonAttributes( PatientSet patients,309 public Map<Integer, Object> getPersonAttributes(Cohort patients, 305 310 String attributeName, String joinClass, String joinProperty, String outputColumn, boolean returnAll); 306 311 … … 312 317 @Transactional(readOnly=true) 313 318 public Map<Integer, Map<String, Object>> getCharacteristics( 314 PatientSet patients);319 Cohort patients); 315 320 316 321 /** … … 321 326 */ 322 327 @Transactional(readOnly=true) 323 public Map<Integer, PatientIdentifier> getPatientIdentifiersByType( PatientSet patients, PatientIdentifierType type);328 public Map<Integer, PatientIdentifier> getPatientIdentifiersByType(Cohort patients, PatientIdentifierType type); 324 329 325 330 … … 330 335 */ 331 336 @Transactional(readOnly=true) 332 public PatientSet convertPatientIdentifier(List<String> identifiers);337 public Cohort convertPatientIdentifier(List<String> identifiers); 333 338 334 339 /** … … 344 349 * @param ps 345 350 */ 346 public void setMyPatientSet( PatientSet ps);347 348 /** 349 * 350 * @return 351 */ 352 @Transactional(readOnly=true) 353 public PatientSet getMyPatientSet();351 public void setMyPatientSet(Cohort ps); 352 353 /** 354 * 355 * @return 356 */ 357 @Transactional(readOnly=true) 358 public Cohort getMyPatientSet(); 354 359 355 360 /** … … 368 373 369 374 @Transactional(readOnly=true) 370 public Map<Integer, PatientState> getCurrentStates( PatientSet ps,375 public Map<Integer, PatientState> getCurrentStates(Cohort ps, 371 376 ProgramWorkflow wf); 372 377 373 378 @Transactional(readOnly=true) 374 379 public Map<Integer, PatientProgram> getCurrentPatientPrograms( 375 PatientSet ps, Program program);376 377 @Transactional(readOnly=true) 378 public Map<Integer, PatientProgram> getPatientPrograms( PatientSet ps,380 Cohort ps, Program program); 381 382 @Transactional(readOnly=true) 383 public Map<Integer, PatientProgram> getPatientPrograms(Cohort ps, 379 384 Program program); 380 385 381 386 @Transactional(readOnly=true) 382 public Map<Integer, List<Relationship>> getRelationships( PatientSet ps, RelationshipType relType);383 384 @Transactional(readOnly=true) 385 public Map<Integer, List<Person>> getRelatives( PatientSet ps, RelationshipType relType, boolean forwards);387 public Map<Integer, List<Relationship>> getRelationships(Cohort ps, RelationshipType relType); 388 389 @Transactional(readOnly=true) 390 public Map<Integer, List<Person>> getRelatives(Cohort ps, RelationshipType relType, boolean forwards); 386 391 387 392 /** … … 389 394 */ 390 395 @Transactional(readOnly=true) 391 public Map<Integer, List<DrugOrder>> getCurrentDrugOrders( PatientSet ps,396 public Map<Integer, List<DrugOrder>> getCurrentDrugOrders(Cohort ps, 392 397 Concept drugSet); 393 398 … … 396 401 */ 397 402 @Transactional(readOnly=true) 398 public Map<Integer, List<DrugOrder>> getDrugOrders( PatientSet ps,403 public Map<Integer, List<DrugOrder>> getDrugOrders(Cohort ps, 399 404 Concept drugSet); 400 401 public void setMyPatientAnalysis(PatientAnalysis pa);402 403 @Transactional(readOnly=true)404 public PatientAnalysis getMyPatientAnalysis();405 405 406 406 /** … … 411 411 */ 412 412 @Transactional(readOnly=true) 413 public List<Encounter> getEncountersByForm(PatientSet patients, List<Form> form); 414 415 413 public List<Encounter> getEncountersByForm(Cohort patients, List<Form> form); 416 414 417 415