public static function buildJSJumpLink($objectId, $signingUserId, $objectClass) { $objectClass = 'Labs'; // temporarily hard code objectClass based on MainController::getMainTabs() definitions $labOrder = new LabOrder(); $labOrder->labOrderId = $objectId; $labOrder->populate(); $patientId = $labOrder->patientId; $js = parent::buildJSJumpLink($objectId, $patientId, $objectClass); $js .= <<<EOL mainTabbar.setOnTabContentLoaded(function(tabId){ \tTabState.setParam({"orderId":objectId}); \treloadLabResultsGrid(); }); EOL; return $js; }
public function labResultsAction() { $orderId = (int) $this->_getParam('orderId'); $order = new OrderLabTest(); $order->orderId = $orderId; if (!$order->populate()) { $error = 'Order Id ' . $orderId . ' not found'; trigger_error($error); throw new Exception($error); } $loinc = new ProcedureCodesLOINC(); $loinc->loincNum = $order->labTest; $loinc->populate(); $shortname = $loinc->shortname; if (!strlen($shortname) > 0) { $shortname = $loinc->longCommonName; } $labTest = new LabTest(); $labTest->labOrderId = $order->orderId; $labTest->populateByLabOrderId(); $labOrder = new LabOrder(); $labOrder->labOrderId = $order->orderId; if (!$labOrder->populate()) { $labOrder->labOrderId = $order->orderId; $labOrder->patientId = $order->order->patientId; $labOrder->personId = $order->order->patientId; $labOrder->orderingProvider = $order->order->provider->displayName; $labOrder->manualOrderDate = $order->order->dateTime; $labOrder->orderDescription = $shortname; $labOrder->persist(); $labTest = new LabTest(); $labTest->labOrderId = $labOrder->labOrderId; $labTest->componentCode = $loinc->class; $labTest->service = $shortname; $labTest->orderNum = $order->orderId; $labTest->persist(); $orderObs = strtolower($loinc->orderObs); if ($orderObs == 'both') { // create default lab_results $labResult = new LabResult(); $labResult->description = $order->displayLabTest; $labResult->labTestId = $labTest->labTestId; $labResult->observationTime = date('Y-m-d H:i'); $labResult->units = $loinc->exampleUcumUnits; $labResult->identifier = $loinc->loincNum; $labResult->persist(); } else { if ($orderObs == 'order') { // temporarily do nothing } } } $this->view->order = $order; $form = new WebVista_Form(array('name' => 'labTestId')); $form->setAction(Zend_Registry::get('baseUrl') . 'orders.raw/set-lab-test'); $form->loadORM($labTest, 'LabTest'); $this->view->form = $form; $this->render(); }