/**
  * Return all documents that belong to a category
  *
  * @param DocumentCategory $category
  * @return array
  */
 function findByCategory($category)
 {
     return Documents::find(array('conditions' => array('category_id = ?', $category->getId()), 'order' => 'name'));
 }
 public function postPrintQueue($id)
 {
     $pid = Session::get('pid');
     $page = Input::get('page');
     $limit = Input::get('rows');
     $sidx = Input::get('sidx');
     $sord = Input::get('sord');
     $query = DB::table('hippa')->where('other_hippa_id', '=', $id)->get();
     if ($query) {
         $count = count($query);
         $total_pages = ceil($count / $limit);
     } else {
         $count = 0;
         $total_pages = 0;
     }
     if ($page > $total_pages) {
         $page = $total_pages;
     }
     $start = $limit * $page - $limit;
     if ($start < 0) {
         $start = 0;
     }
     $query1 = DB::table('hippa')->where('other_hippa_id', '=', $id)->orderBy($sidx, $sord)->skip($start)->take($limit)->get();
     $response['page'] = $page;
     $response['total'] = $total_pages;
     $response['records'] = $count;
     $i = 0;
     foreach ($query1 as $row1) {
         $row = (array) $row1;
         if (isset($row['eid'])) {
             $result1 = Encounters::find($row['eid']);
             $row['description'] = $result1->encounter_cc;
             $row['date'] = $result1->encounter_DOS;
             $row['type'] = 'Encounter';
         }
         if (isset($row['t_messages_id'])) {
             $result2 = T_messages::find($row['t_messages_id']);
             $row['description'] = $result2->t_messages_subject;
             $row['date'] = $result2->t_messages_dos;
             $row['type'] = 'Telephone Messages';
         }
         if (isset($row['documents_id'])) {
             $result3 = Documents::find($row['documents_id']);
             $row['description'] = $result3->documents_desc . ' from ' . $result3->documents_from;
             $row['date'] = $result3->documents_date;
             $row['type'] = $result3->documents_type;
         }
         $response['rows'][$i]['id'] = $row['hippa_id'];
         $response['rows'][$i]['cell'] = array($row['hippa_id'], $row['date'], $row['type'], $row['description']);
         $i++;
     }
     echo json_encode($response);
 }
 public function postDocumentsView($id, $pid)
 {
     $result = Documents::find($id);
     $file_path = $result->documents_url;
     $data1 = array('documents_viewed' => Session::get('displayname'));
     DB::table('documents')->where('documents_id', '=', $id)->update($data);
     $this->audit('Update');
     $name = time() . '_' . $pid . '.pdf';
     $data['filepath'] = '/var/www/nosh/temp' . $name;
     copy($file_path, $data['filepath']);
     while (!file_exists($data['filepath'])) {
         sleep(2);
     }
     $data['html'] = '<iframe src="' . asset('temp/' . $name) . '" width="770" height="425" style="border: none;"></iframe>';
     $data['id'] = $id;
     echo json_encode($data);
 }
예제 #4
0
 public function bluebutton($id)
 {
     $result = Documents::find($id);
     $file_path = $result->documents_url;
     $data['ccda'] = File::get($file_path);
     $data['js'] = File::get(__DIR__ . '/../../public/js/bluebutton1.js');
     return View::make('bluebutton', $data);
 }
예제 #5
0
 public function view_documents($id)
 {
     $result = Documents::find($id);
     $file_path = $result->documents_url;
     $data = array('documents_viewed' => Session::get('displayname'));
     DB::table('documents')->where('documents_id', '=', $id)->update($data);
     $this->audit('Update');
     return Response::download($file_path);
 }