Search in sources :

Example 6 with Disposition

use of org.openmrs.module.emrapi.disposition.Disposition in project openmrs-module-pihcore by PIH.

the class ApplyDispositionAction method applyDispositionActions.

void applyDispositionActions(FormEntrySession session, DispositionService dispositionService) {
    DispositionDescriptor dispositionDescriptor = dispositionService.getDispositionDescriptor();
    Encounter encounter = session.getEncounter();
    Disposition disposition = null;
    Obs dispositionObsGroup = null;
    for (Obs candidate : encounter.getObsAtTopLevel(false)) {
        if (dispositionDescriptor.isDisposition(candidate)) {
            dispositionObsGroup = candidate;
            disposition = dispositionService.getDispositionFromObsGroup(dispositionObsGroup);
        }
    }
    if (disposition != null && disposition.getActions() != null) {
        for (String actionBeanName : disposition.getActions()) {
            DispositionAction action = getBean(actionBeanName, DispositionAction.class);
            action.action(new EncounterDomainWrapper(encounter), dispositionObsGroup, null);
        }
    }
}
Also used : Obs(org.openmrs.Obs) EncounterDomainWrapper(org.openmrs.module.emrapi.encounter.EncounterDomainWrapper) Disposition(org.openmrs.module.emrapi.disposition.Disposition) Encounter(org.openmrs.Encounter) DispositionDescriptor(org.openmrs.module.emrapi.disposition.DispositionDescriptor) DispositionAction(org.openmrs.module.emrapi.disposition.actions.DispositionAction)

Aggregations

Obs (org.openmrs.Obs)6 Disposition (org.openmrs.module.emrapi.disposition.Disposition)6 DispositionObs (org.openmrs.module.emrapi.disposition.DispositionObs)5 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 Concept (org.openmrs.Concept)4 ConceptBuilder (org.openmrs.module.emrapi.test.builder.ConceptBuilder)4 SimpleObject (org.openmrs.ui.framework.SimpleObject)4 Location (org.openmrs.Location)2 Date (java.util.Date)1 DateTime (org.joda.time.DateTime)1 Encounter (org.openmrs.Encounter)1 Visit (org.openmrs.Visit)1 DispositionDescriptor (org.openmrs.module.emrapi.disposition.DispositionDescriptor)1 DispositionAction (org.openmrs.module.emrapi.disposition.actions.DispositionAction)1 EncounterDomainWrapper (org.openmrs.module.emrapi.encounter.EncounterDomainWrapper)1 VisitDomainWrapper (org.openmrs.module.emrapi.visit.VisitDomainWrapper)1 Element (org.w3c.dom.Element)1