use of org.openmrs.Condition in project openmrs-core by openmrs.
the class ConditionServiceImplTest method getCondition_shouldFindConditionGivenValidId.
/**
* @see ConditionService#getCondition(Integer)
*/
@Test
public void getCondition_shouldFindConditionGivenValidId() {
Condition condition = conditionService.getCondition(1);
Assert.assertEquals(ConditionClinicalStatus.INACTIVE, condition.getClinicalStatus());
Assert.assertEquals(ConditionVerificationStatus.PROVISIONAL, condition.getVerificationStatus());
Assert.assertEquals("2cc6880e-2c46-15e4-9038-a6c5e4d22fb7", condition.getUuid());
}
use of org.openmrs.Condition in project openmrs-core by openmrs.
the class ConditionServiceImplTest method saveCondition_shouldSaveNewCondition.
/**
* @see ConditionService#saveCondition(Condition)
*/
@Test
public void saveCondition_shouldSaveNewCondition() {
Integer patientId = 2;
String uuid = "08002000-4469-12q3-551f-0339000c9a76";
CodedOrFreeText codedOrFreeText = new CodedOrFreeText();
Condition condition = new Condition();
condition.setCondition(codedOrFreeText);
condition.setClinicalStatus(ConditionClinicalStatus.ACTIVE);
condition.setUuid(uuid);
condition.setPatient(new Patient(patientId));
conditionService.saveCondition(condition);
Condition savedCondition = conditionService.getConditionByUuid(uuid);
Assert.assertEquals(patientId, savedCondition.getPatient().getPatientId());
Assert.assertEquals(uuid, savedCondition.getUuid());
Assert.assertEquals(codedOrFreeText, savedCondition.getCondition());
Assert.assertEquals(ConditionClinicalStatus.ACTIVE, savedCondition.getClinicalStatus());
Assert.assertNotNull(savedCondition.getConditionId());
}
use of org.openmrs.Condition in project openmrs-core by openmrs.
the class ConditionServiceImplTest method getConditionByUuid_shouldFindConditionGivenValidUuid.
/**
* @see ConditionService#getConditionByUuid(String)
*/
@Test
public void getConditionByUuid_shouldFindConditionGivenValidUuid() {
String uuid = "2cc6880e-2c46-15e4-9038-a6c5e4d22fb7";
Condition condition = conditionService.getConditionByUuid(uuid);
Assert.assertEquals(uuid, condition.getUuid());
}
use of org.openmrs.Condition in project openmrs-module-pihcore by PIH.
the class ConditionListVelocityContextContentProvider method getActiveConditionsConcepts.
protected List<Concept> getActiveConditionsConcepts(Patient patient) {
List<Condition> conditionList = getActiveConditions(patient);
List<Concept> conditionListConcepts = new ArrayList<Concept>();
for (Condition condition : conditionList) {
if (condition.getCondition().getCoded() != null) {
conditionListConcepts.add(condition.getCondition().getCoded());
}
}
return conditionListConcepts;
}
use of org.openmrs.Condition in project openmrs-module-pihcore by PIH.
the class ConditionListVelocityContextContentProvider method populateContext.
@Override
public void populateContext(FormEntrySession formEntrySession, VelocityContext velocityContext) {
Patient patient = formEntrySession.getPatient();
List<Condition> conditionList = getActiveConditions(patient);
List<Concept> conditionListConcepts = getActiveConditionsConcepts(patient);
velocityContext.put("conditionList", conditionList);
velocityContext.put("conditionListConcepts", conditionListConcepts);
}
Aggregations