Search in sources :

Example 1 with DispositionAction

use of org.openmrs.module.emrapi.disposition.actions.DispositionAction 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

Encounter (org.openmrs.Encounter)1 Obs (org.openmrs.Obs)1 Disposition (org.openmrs.module.emrapi.disposition.Disposition)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