use of org.openmrs.Diagnosis in project openmrs-core by openmrs.
the class DiagnosisServiceImplTest method getPrimaryDiagnoses_shouldGetPrimaryDiagnoses.
/**
* @see DiagnosisService#getPrimaryDiagnoses(Encounter)
*/
@Test
public void getPrimaryDiagnoses_shouldGetPrimaryDiagnoses() {
Encounter encounter = encounterService.getEncounterByUuid("y403fafb-e5e4-42d0-9d11-4f52e89d123r");
List<Diagnosis> diagnoses = diagnosisService.getPrimaryDiagnoses(encounter);
Assert.assertEquals(1, diagnoses.size());
Assert.assertEquals("68802cce-6880-17e4-6880-a68804d22fb7", diagnoses.get(0).getUuid());
Assert.assertEquals(ConditionVerificationStatus.CONFIRMED, diagnoses.get(0).getCertainty());
Assert.assertEquals(new Integer(1), diagnoses.get(0).getDiagnosisId());
}
use of org.openmrs.Diagnosis in project openmrs-core by openmrs.
the class DiagnosisServiceImplTest method voidDiagnosis_shouldVoidDiagnosisSuccessfully.
/**
* @see DiagnosisService#voidDiagnosis(Diagnosis, String)
*/
@Test
public void voidDiagnosis_shouldVoidDiagnosisSuccessfully() {
String voidReason = "void reason";
String uuid = "688804ce-6880-8804-6880-a68804d88047";
Diagnosis nonVoidedDiagnosis = diagnosisService.getDiagnosisByUuid(uuid);
Assert.assertFalse(nonVoidedDiagnosis.getVoided());
Assert.assertNull(nonVoidedDiagnosis.getVoidedBy());
Assert.assertNull(nonVoidedDiagnosis.getVoidReason());
diagnosisService.voidDiagnosis(nonVoidedDiagnosis, voidReason);
Diagnosis voidedDiagnosis = diagnosisService.getDiagnosisByUuid(uuid);
Assert.assertTrue(voidedDiagnosis.getVoided());
Assert.assertNotNull(voidedDiagnosis.getVoidedBy());
Assert.assertNotNull(voidedDiagnosis.getDateVoided());
Assert.assertEquals(voidReason, voidedDiagnosis.getVoidReason());
Assert.assertEquals(Context.getAuthenticatedUser(), voidedDiagnosis.getVoidedBy());
}
use of org.openmrs.Diagnosis in project openmrs-core by openmrs.
the class DiagnosisServiceImplTest method getDiagnoses_shouldGetDiagnosesOfPatientWithDate.
/**
* @see DiagnosisService#getDiagnoses(Patient, Date)
*/
@Test
public void getDiagnoses_shouldGetDiagnosesOfPatientWithDate() {
Calendar calendar = new GregorianCalendar(2015, 12, 1, 0, 0, 0);
Patient patient = patientService.getPatient(2);
List<Diagnosis> diagnoses = diagnosisService.getDiagnoses(patient, calendar.getTime());
Assert.assertEquals(2, diagnoses.size());
Assert.assertEquals("68802cce-6880-17e4-6880-a68804d22fb7", diagnoses.get(0).getUuid());
Assert.assertEquals("688804ce-6880-8804-6880-a68804d88047", diagnoses.get(1).getUuid());
}
use of org.openmrs.Diagnosis in project openmrs-core by openmrs.
the class DiagnosisServiceImplTest method getDiagnosisByUuid_shouldFindDiagnosisGivenValidUuid.
/**
* @see DiagnosisService#getDiagnosisByUuid(String) (String)
*/
@Test
public void getDiagnosisByUuid_shouldFindDiagnosisGivenValidUuid() {
String uuid = "68802cce-6880-17e4-6880-a68804d22fb7";
Diagnosis diagnosis = diagnosisService.getDiagnosisByUuid(uuid);
Assert.assertEquals(uuid, diagnosis.getUuid());
}
use of org.openmrs.Diagnosis in project openmrs-core by openmrs.
the class HibernateDiagnosisDAOTest method shouldDeleteDiagnosis.
@Test
public void shouldDeleteDiagnosis() {
String uuid = "4e663d66-6b78-11e0-93c3-18a905e044dc";
Diagnosis diagnosis = diagnosisDAO.getDiagnosisByUuid(uuid);
assertNotNull(diagnosis);
diagnosisDAO.deleteDiagnosis(diagnosis);
assertNull(diagnosisDAO.getDiagnosisByUuid(uuid));
}
Aggregations