* @param obj
* @param order
* @return
*/
private SimpleObject createObjectFromOrder(Order order) {
SimpleObject newOrderObject = new SimpleObject();
newOrderObject.add("uuid", order.getUuid());
if (order.getOrderType() != null) {
SimpleObject orderType = new SimpleObject();
orderType.add("uuid", order.getOrderType().getUuid());
orderType.add("display", order.getOrderType().getName());
newOrderObject.add("orderType", orderType);
}
SimpleObject orderConcept = new SimpleObject();
orderConcept.add("uuid", order.getConcept().getUuid());
orderConcept.add("display", order.getConcept().getName().getName());
newOrderObject.add("concept", orderConcept);
if (order.isDrugOrder()) {
DrugOrder currentDrugOrder = (DrugOrder) order;
newOrderObject.add("instructions", currentDrugOrder.getInstructions());
newOrderObject.add("startDate", currentDrugOrder.getStartDate().toString());
newOrderObject.add("autoExpireDate", currentDrugOrder.getAutoExpireDate().toString());
newOrderObject.add("dose", currentDrugOrder.getDose());
newOrderObject.add("units", currentDrugOrder.getUnits());
newOrderObject.add("frequency", currentDrugOrder.getFrequency());
newOrderObject.add("quantity", currentDrugOrder.getQuantity());
SimpleObject drugObj = new SimpleObject();
drugObj.add("uuid", currentDrugOrder.getDrug().getUuid());
drugObj.add("display", currentDrugOrder.getDrug().getName());
newOrderObject.add("drug", drugObj);
}
return newOrderObject;
}