Search in sources :

Example 1 with ConditionClinicalStatus

use of org.openmrs.ConditionClinicalStatus in project openmrs-core by openmrs.

the class HibernateConditionDAOTest method shouldSaveCondition.

@Test
public void shouldSaveCondition() {
    CodedOrFreeText codedOrFreeText = new CodedOrFreeText(new Concept(4), new ConceptName(5089), "non coded");
    ConditionClinicalStatus clinicalStatus = ConditionClinicalStatus.ACTIVE;
    ConditionVerificationStatus verificationStatus = ConditionVerificationStatus.CONFIRMED;
    Patient patient = new Patient(2);
    Date onsetDate = new Date();
    Date endDate = new Date();
    Condition previousVersion = dao.getConditionByUuid("2cc6880e-2c46-15e4-9038-a6c5e4d22fb7");
    String additionalDetail = "additionalDetail";
    int conditionId = 20;
    Condition condition = new Condition();
    condition.setConditionId(conditionId);
    condition.setCondition(codedOrFreeText);
    condition.setClinicalStatus(clinicalStatus);
    condition.setVerificationStatus(verificationStatus);
    condition.setPreviousVersion(previousVersion);
    condition.setAdditionalDetail(additionalDetail);
    condition.setOnsetDate(onsetDate);
    condition.setEndDate(endDate);
    condition.setPatient(patient);
    dao.saveCondition(condition);
    Condition savedCondition = dao.getCondition(conditionId);
    assertEquals(additionalDetail, savedCondition.getAdditionalDetail());
    assertEquals(conditionId, (int) savedCondition.getConditionId());
    assertEquals(onsetDate, savedCondition.getOnsetDate());
    assertEquals(endDate, savedCondition.getEndDate());
    assertEquals(clinicalStatus, savedCondition.getClinicalStatus());
    assertEquals(verificationStatus, savedCondition.getVerificationStatus());
    assertEquals(previousVersion, savedCondition.getPreviousVersion());
    assertEquals(patient, savedCondition.getPatient());
}
Also used : Concept(org.openmrs.Concept) Condition(org.openmrs.Condition) ConditionVerificationStatus(org.openmrs.ConditionVerificationStatus) ConditionClinicalStatus(org.openmrs.ConditionClinicalStatus) ConceptName(org.openmrs.ConceptName) Patient(org.openmrs.Patient) CodedOrFreeText(org.openmrs.CodedOrFreeText) Date(java.util.Date) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Example 2 with ConditionClinicalStatus

use of org.openmrs.ConditionClinicalStatus in project openmrs-core by openmrs.

the class HibernateConditionDAOTest method shouldGetCondition.

@Test
public void shouldGetCondition() {
    int id = 1;
    ConditionClinicalStatus expectedClinicalStatus = ConditionClinicalStatus.INACTIVE;
    ConditionVerificationStatus expectedVerificationStatus = ConditionVerificationStatus.PROVISIONAL;
    Condition condition = dao.getCondition(id);
    assertEquals(expectedClinicalStatus, condition.getClinicalStatus());
    assertEquals(expectedVerificationStatus, condition.getVerificationStatus());
    assertEquals(1, (int) condition.getId());
    assertEquals(null, condition.getEndDate());
    assertEquals(1, (int) condition.getCreator().getId());
}
Also used : Condition(org.openmrs.Condition) ConditionVerificationStatus(org.openmrs.ConditionVerificationStatus) ConditionClinicalStatus(org.openmrs.ConditionClinicalStatus) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Example 3 with ConditionClinicalStatus

use of org.openmrs.ConditionClinicalStatus in project openmrs-core by openmrs.

the class HibernateConditionDAOTest method shouldGetConditionByUuid.

@Test
public void shouldGetConditionByUuid() {
    String uuid = "2cc6880e-2c46-15e4-9038-a6c5e4d22fb7";
    ConditionClinicalStatus expectedClinicalStatus = ConditionClinicalStatus.INACTIVE;
    ConditionVerificationStatus expectedVerificationStatus = ConditionVerificationStatus.PROVISIONAL;
    Condition condition = dao.getConditionByUuid(uuid);
    assertEquals(condition.getClinicalStatus(), expectedClinicalStatus);
    assertEquals(condition.getVerificationStatus(), expectedVerificationStatus);
    assertEquals(1, (int) condition.getId());
    assertEquals(null, condition.getEndDate());
    assertEquals(1, (int) condition.getCreator().getId());
}
Also used : Condition(org.openmrs.Condition) ConditionVerificationStatus(org.openmrs.ConditionVerificationStatus) ConditionClinicalStatus(org.openmrs.ConditionClinicalStatus) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Aggregations

Test (org.junit.Test)3 Condition (org.openmrs.Condition)3 ConditionClinicalStatus (org.openmrs.ConditionClinicalStatus)3 ConditionVerificationStatus (org.openmrs.ConditionVerificationStatus)3 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)3 Date (java.util.Date)1 CodedOrFreeText (org.openmrs.CodedOrFreeText)1 Concept (org.openmrs.Concept)1 ConceptName (org.openmrs.ConceptName)1 Patient (org.openmrs.Patient)1