darius
(Darius Jazayeri)
January 6, 2016, 9:02pm
2
This should be a javascript expression that will be evaluated against
“appContextModel” as built here:
model.addAttribute("app", app);
Location visitLocation = null;
try {
visitLocation = adtService.getLocationThatSupportsVisits(sessionContext.getSessionLocation());
}
catch (IllegalArgumentException ex) {
// location does not support visits
}
VisitDomainWrapper activeVisit = null;
if (visitLocation != null) {
activeVisit = adtService.getActiveVisit(patient, visitLocation);
}
model.addAttribute("activeVisit", activeVisit);
AppContextModel contextModel = sessionContext.generateAppContextModel();
contextModel.put("patient", new PatientContextModel(patient));
contextModel.put("visit", activeVisit == null ? null : new VisitContextModel(activeVisit));
model.addAttribute("appContextModel", contextModel);
At present the VisitContextModel class it uses (see
package org.openmrs.module.coreapps.contextmodel;
import org.openmrs.VisitType;
import org.openmrs.module.emrapi.visit.VisitDomainWrapper;
import org.openmrs.module.webservices.rest.web.ConversionUtil;
import org.openmrs.module.webservices.rest.web.representation.Representation;
import org.openmrs.module.webservices.rest.SimpleObject;
import java.util.Date;
/**
* A very simple view of a visit, suitable for use in an app contextModel.
*/
public class VisitContextModel {
private int id;
private String uuid;
private boolean active;
private boolean admitted;
private Long stopDatetimeInMilliseconds;
This file has been truncated. show original
) does not include the VisitType, but you are pre-approved to add it to
that class (ideally in a way that is consistent with what the JSON REST
representation of a visit’s visit type would be, e.g. as an object with
uuid and name properties).