Examples of ObsService


Examples of org.openmrs.api.ObsService

            for (PatientProgram patientProgram : submissionActions.getPatientProgramsToUpdate()) {
                Context.getProgramWorkflowService().savePatientProgram(patientProgram);
            }
        }

        ObsService obsService = Context.getObsService();
       
        if (submissionActions.getObsToVoid() != null) {
            for (Obs o : submissionActions.getObsToVoid()) {
                if (log.isDebugEnabled())
                    log.debug("voiding obs: " + o.getObsId());
                obsService.voidObs(o, "htmlformentry");
                // if o was in a group and it has no obs left, void the group
        voidObsGroupIfAllChildObsVoided(o.getObsGroup());
            }
        }

        // If we're in EDIT mode, we have to save the encounter so that any new obs are created.
        // This feels a bit like a hack, but actually it's a good thing to update the encounter's dateChanged in this case. (PS- turns out there's no dateChanged on encounter up to 1.5.)
        // If there is no encounter (impossible at the time of writing this comment) we save the obs manually
        if (context.getMode() == Mode.EDIT) {
            if (encounter != null) {
                if (voidEncounter) {
                    try {
                        HtmlFormEntryUtil.voidEncounter(encounter, htmlForm, "voided via htmlformentry form submission");
                    } catch (Exception ex) {
                        throw new RuntimeException("Unable to void encounter.", ex);
                    }
                }
                Context.getEncounterService().saveEncounter(encounter);
            } else if (submissionActions.getObsToCreate() != null) {
                // this may not work right due to savehandlers (similar error to HTML-135) but this branch is
                // unreachable until html forms are allowed to edit data without an encounter
                for (Obs o : submissionActions.getObsToCreate())
                    obsService.saveObs(o, null);
            }
        }

        /*
           ObsService obsService = Context.getObsService();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.