@Override protected PatientIdentifierType getObjectByUuid(String uuid) { return Context.getPatientService().getPatientIdentifierTypeByUuid(uuid); } }
/** * @see org.openmrs.api.PatientService#getPatients(java.lang.String, java.lang.String, * java.util.List, boolean) */ @Override // TODO - search for usage with non-empty list of patient identifier types @Transactional(readOnly = true) public List<Patient> getPatients(String name, String identifier, List<PatientIdentifierType> identifierTypes, boolean matchIdentifierExactly) throws APIException { return Context.getPatientService().getPatients(name, identifier, identifierTypes, matchIdentifierExactly, 0, null); }
/** * @see org.openmrs.api.PatientService#getPatients(java.lang.String) */ @Override @Transactional(readOnly = true) public List<Patient> getPatients(String query) throws APIException { return Context.getPatientService().getPatients(query, 0, null); }
/** * @see PatientService#getPatientIdentifierTypeByUuid(String) */ @Test public void getPatientIdentifierTypeByUuid_shouldFetchPatientIdentifierTypeWithGivenUuid() throws Exception { PatientIdentifierType identifierType = Context.getPatientService().getPatientIdentifierTypeByUuid( "1a339fe9-38bc-4ab3-b180-320988c0b968"); Assert.assertNotNull(identifierType); Assert.assertTrue(identifierType.getClass().isAssignableFrom(PatientIdentifierType.class)); }
@Before public void setup (){ if(conditionService == null){ conditionService = Context.getConditionService(); } if(patientService == null){ patientService = Context.getPatientService(); } executeDataSet(CONDITION_XML); }
/** * @see PatientService#getPatient(Integer) */ @Test public void getPatient_shouldReturnNullWhenPatientWithGivenPatientIdDoesNotExist() throws Exception { Patient patient = Context.getPatientService().getPatient(10000); Assert.assertNull(patient); }
/** * @see PatientService#getPatientByUuid(String) */ @Test public void getPatientByUuid_shouldReturnNullIfNoObjectFoundWithGivenUuid() throws Exception { Assert.assertNull(Context.getPatientService().getPatientByUuid("some invalid uuid")); }
/** * @see PatientService#getPatientIdentifierByUuid(String) */ @Test public void getPatientIdentifierByUuid_shouldReturnNullIfNoObjectFoundWithGivenUuid() throws Exception { Assert.assertNull(Context.getPatientService().getPatientIdentifierByUuid("some invalid uuid")); }
/** * @see PatientService#getPatientIdentifierTypeByName(String) */ @Test public void getPatientIdentifierTypeByName_shouldReturnNullWhenPatientIdentifierTypeWithGivenNameDoesNotExist() throws Exception { PatientIdentifierType identifierType = Context.getPatientService().getPatientIdentifierTypeByName( "Invalid Identifier Example"); Assert.assertNull(identifierType); }
/** * @see PatientServiceImpl#mergePatients(Patient,Patient) */ @Test(expected = APIException.class) public void mergePatients_shouldNotMergePatientWithItself() throws Exception { Context.getPatientService().mergePatients(new Patient(2), new Patient(2)); }
/** * @see PatientService#getPatientIdentifierByUuid(String) */ @Test public void getPatientIdentifierByUuid_shouldFindObjectGivenValidUuid() throws Exception { String uuid = "ff41928c-3bca-48d9-a4dc-9198f6b2873b"; PatientIdentifier patientIdentifier = Context.getPatientService().getPatientIdentifierByUuid(uuid); Assert.assertEquals(1, (int) patientIdentifier.getPatientIdentifierId()); }
/** * @see PatientService#getPatientByUuid(String) */ @Test public void getPatientByUuid_shouldFetchPatientWithGivenUuid() throws Exception { String uuid = "da7f524f-27ce-4bb2-86d6-6d1d05312bd5"; Patient patient = Context.getPatientService().getPatientByUuid(uuid); Assert.assertEquals(2, (int) patient.getPatientId()); }
/** * @see PatientService#getPatientIdentifierByUuid(String) */ @Test public void getPatientIdentifierByUuid_shouldFetchPatientIdentifierWithGivenUuid() throws Exception { String uuid = "ff41928c-3bca-48d9-a4dc-9198f6b2873b"; PatientIdentifier patientIdentifier = Context.getPatientService().getPatientIdentifierByUuid(uuid); Assert.assertEquals(1, (int) patientIdentifier.getPatientIdentifierId()); }
@Test(expected = PatientIdentifierTypeLockedException.class) public void purgePatientIdentifierType_shouldThrowErrorWhenTryingToDeleteAPatientIdentifierTypeWhilePatientIdentifierTypesAreLocked() throws Exception { PatientService ps = Context.getPatientService(); createPatientIdentifierTypeLockedGPAndSetValue("true"); PatientIdentifierType pit = ps.getPatientIdentifierType(1); ps.purgePatientIdentifierType(pit); }
/** * @see OrderService#getOrderHistoryByConcept(Patient, Concept) */ @Test public void getOrderHistoryByConcept_shouldReturnEmptyListForConceptWithoutOrders() { Concept concept = Context.getConceptService().getConcept(21); Patient patient = Context.getPatientService().getPatient(2); List<Order> orders = orderService.getOrderHistoryByConcept(patient, concept); Assert.assertEquals(0, orders.size()); }
/** * @see PersonValidator#validate(Object,Errors) */ @Test public void validate_shouldFailValidationIfPersonDoesNotHaveAtleastOneNonVoidedName() { Patient pa = Context.getPatientService().getPatient(2); pa.getNames().clear(); Errors errors = new BindException(pa, "patient"); validator.validate(pa, errors); Assert.assertTrue(errors.hasFieldErrors("names")); }
@Test public void removePatientFromCohort_shouldSaveCohortAfterRemovingPatient() { executeDataSet(COHORT_XML); Cohort cohort = service.getCohort(2); Integer patientId = cohort.getMemberships().iterator().next().getPatientId(); Patient patient = Context.getPatientService().getPatient(patientId); service.removePatientFromCohort(cohort, patient); assertFalse(cohort.contains(patientId)); }
/** * @see VisitValidator#validate(Object,Errors) */ @Test public void validate_shouldFailIfVisitTypeIsNotSet() { Visit visit = new Visit(); visit.setPatient(Context.getPatientService().getPatient(2)); visit.setStartDatetime(new Date()); Errors errors = new BindException(visit, "visit"); new VisitValidator().validate(visit, errors); assertTrue(errors.hasFieldErrors("visitType")); }
@Before public void setUp() { validator = new CohortValidator(); executeDataSet(COHORT_XML); cohort = Context.getCohortService().getCohort(2); patient = Context.getPatientService().getPatient(7); cohortMembership = new CohortMembership(patient.getPatientId()); cohort.addMembership(cohortMembership); errors = new BindException(cohort, "cohort"); }
private Encounter buildEncounter() { // First, create a new Encounter Encounter enc = new Encounter(); enc.setLocation(Context.getLocationService().getLocation(1)); enc.setEncounterType(Context.getEncounterService().getEncounterType(1)); enc.setEncounterDatetime(new Date()); enc.setPatient(Context.getPatientService().getPatient(3)); enc.addProvider(Context.getEncounterService().getEncounterRole(1), Context.getProviderService().getProvider(1)); return enc; }