Пример #1
0
 public function postCart()
 {
     date_default_timezone_set('Asia/Shanghai');
     $orders = DB::table('orders')->select('id')->get();
     foreach ($orders as $p) {
         $number = (int) Input::get($p->id);
         if ($number > 0) {
             $items = Orders::where('id', '=', $p->id)->update(array('PCount' => $number, 'status' => 'ordered', 'SendDate' => date('Y-m-d H:i:s')));
         }
     }
     return Redirect::route('hospital-list')->with('global', '已成功确认订单,并给代理商发送邮件');
     $orders = Orders::where('orderNum', '=', Input::get('id'))->groupBy('SId')->get(['SId']);
     foreach ($orders as $order) {
         $email = User::where('id', '=', $order->SId)->first(['email']);
         $stuff = Orders::where('orderNum', '=', Input::get('id'))->where('SId', '=', $order->SId)->get();
         Mail::send('email', array('stuffs' => $stuff, 'email'), function ($message) use($email, $stuff) {
             $message->from('*****@*****.**', 'Laravel');
             $message->to($email->email, 'John Smith')->subject('订单: ' . $stuff[0]->orderNum);
         });
         echo $stuff;
     }
     return Redirect::route('hospital-list')->with('global', '已成功确认订单,并给代理商发送邮件');
 }
Пример #2
0
 public function postScan()
 {
     $input = Input::get();
     $barcode = $input['product'];
     $type = '';
     date_default_timezone_set('Asia/Shanghai');
     if (array_key_exists('mac', $input)) {
         $scanner = DB::table('scanner')->where('mac', '=', $input['mac'])->first();
         $id = $scanner->userId;
         $username = $scanner->username;
     } else {
         $id = Cache::get('id');
         $username = Cache::get('username');
     }
     if (strcmp(substr($barcode, 0, 2), '01') == 0) {
         $type = 'GS1-128-primary';
     } else {
         if (strcmp(substr($barcode, 0, 2), '17') == 0) {
             $type = 'GS1-128-secondary';
         } else {
             if ($barcode[0] == '+') {
                 $type = 'HIBC';
             } else {
                 if (strlen($barcode) == 13 && $barcode[0] == '6') {
                     $type = 'EAN-13';
                 }
             }
         }
     }
     if (strcmp($type, 'GS1-128-primary') == 0) {
         Cache::put('PBarPrimary', $barcode, 10);
         $a = array('Mcode' => substr($barcode, 3, 8), 'huohao' => substr($barcode, 12, 4));
     } else {
         if (strcmp($type, 'GS1-128-secondary') == 0) {
             $PBarPrimary = Cache::get('PBarPrimary');
             Cache::forget('PBarPrimary');
             $order = Orders::where('PBarcode', '=', $PBarPrimary)->where('SId', '=', $id)->first();
             if ((int) $order->PCount <= (int) $order->actual) {
                 //Scanner Cannot go into Redirect without proper Cookies
                 if (!array_key_exists('mac', $input)) {
                     return Redirect::to(URL::route('incomplete'));
                 } else {
                     return;
                 }
             }
             $date_start = strpos($barcode, '17') + 2;
             $date_length = 6;
             $date = date_create_from_format('Ymd H:i:s', '20' . substr($barcode, $date_start, $date_length) . ' 00:00:00');
             $lot_start = strpos($barcode, '10') + 2;
             if (strpos($barcode, '91') || strpos($barcode, '21')) {
                 if (strpos($barcode, '91')) {
                     $lot_length = strpos($barcode, '91') - strpos($barcode, '10') - 2;
                     $lot = substr($barcode, $lot_start, $lot_length);
                     $serial_start = strpos($barcode, '91') + 2;
                     $serial = substr($barcode, $serial_start);
                 } else {
                     $lot_length = strpos($barcode, '21') - strpos($barcode, '10') - 2;
                     $lot = substr($barcode, $lot_start, $lot_length);
                     $serial_start = strpos($barcode, '21') + 2;
                     $serial = substr($barcode, $serial_start);
                 }
             } else {
                 $lot = substr($barcode, $lot_start);
                 $serial = ' ';
             }
             SecondaryBar::create(array('orderNum' => $order->orderNum, 'PBarcode' => $order->PBarcode, 'PBarSecondary' => $barcode, 'expire' => date_format($date, 'Y-m-d H:i:s'), 'lot' => $lot, 'SerialNum' => $serial));
             $order->SUser = $username;
             $order->actual = $order->actual + 1;
             $order->save();
         } else {
             if (strcmp($type, 'HIBC') == 0) {
                 if (strcmp(substr($barcode, 0, 2), '+H') == 0) {
                     Cache::put('PBarPrimary', $barcode, 10);
                 } else {
                     $PBarPrimary = Cache::get('PBarPrimary');
                     Cache::forget('PBarPrimary');
                     $order = Orders::where('PBarcode', '=', $PBarPrimary)->where('SId', '=', $id)->first();
                     if ((int) $order->PCount <= (int) $order->actual) {
                         //Scanner Cannot go into Redirect without proper Cookies
                         if (!array_key_exists('mac', $input)) {
                             return Redirect::to(URL::route('incomplete'));
                         } else {
                             return;
                         }
                     }
                     $exp = '0000-00-00 00:00:00';
                     if ($barcode[1] != '$') {
                         $len = strlen($barcode) - 8;
                         $exp = date_create_from_format('z Y', substr($barcode, 3, 3) . ' 20' . substr($barcode, 1, 2));
                         $lot = substr($barcode, 6, $len);
                     } else {
                         if ($barcode[1] == '$' && $barcode[2] != '$') {
                             $len = strlen($barcode) - 4;
                             $lot = substr($barcode, 2, $len);
                         } else {
                             if ($barcode[1] == '$' && $barcode[2] == '$' && $barcode[3] != '+') {
                                 switch ($barcode[3]) {
                                     case '2':
                                         $len = strlen($barcode) - 12;
                                         $exp = date_create_from_format('Y-m-d', '20' . substr($barcode, 8, 2) . '-' . substr($barcode, 4, 2) . '-' . substr($barcode, 6, 2));
                                         $lot = substr($barcode, 10, $len);
                                         break;
                                     case '3':
                                         $len = strlen($barcode) - 12;
                                         $exp = date_create_from_format('Y-m-d', '20' . substr($barcode, 4, 2) . '-' . substr($barcode, 6, 2) . '-' . substr($barcode, 8, 2));
                                         $lot = substr($barcode, 10, $len);
                                         break;
                                     case '4':
                                         $len = strlen($barcode) - 14;
                                         $exp = date_create_from_format('Y-m-d H', '20' . substr($barcode, 4, 2) . '-' . substr($barcode, 6, 2) . '-' . substr($barcode, 8, 2) . ' ' . substr($barcode, 10, 2));
                                         $lot = substr($barcode, 12, $len);
                                         break;
                                     case '5':
                                         $len = strlen($barcode) - 11;
                                         $exp = date_create_from_format('z Y', substr($barcode, 6, 3) . ' 20' . substr($barcode, 4, 2));
                                         $lot = substr($barcode, 9, $len);
                                         break;
                                     case '6':
                                         $len = strlen($barcode) - 13;
                                         $exp = date_create_from_format('z Y H', substr($barcode, 6, 3) . ' 20' . substr($barcode, 4, 2) . ' ' . substr($barcode, 9, 2));
                                         $lot = substr($barcode, 11, $len);
                                         break;
                                     case '7':
                                         $len = strlen($barcode) - 6;
                                         $lot = substr($barcode, 4, $len);
                                         break;
                                     case '8':
                                         switch ($barcode[6]) {
                                             case '2':
                                                 $len = strlen($barcode) - 15;
                                                 $exp = date_create_from_format('Y-m-d', '20' . substr($barcode, 11, 2) . '-' . substr($barcode, 7, 2) . '-' . substr($barcode, 9, 2));
                                                 $lot = substr($barcode, 13, $len);
                                                 break;
                                             case '3':
                                                 $len = strlen($barcode) - 15;
                                                 $exp = date_create_from_format('Y-m-d', '20' . substr($barcode, 7, 2) . '-' . substr($barcode, 9, 2) . '-' . substr($barcode, 11, 2));
                                                 $lot = substr($barcode, 13, $len);
                                                 break;
                                             case '4':
                                                 $len = strlen($barcode) - 17;
                                                 $exp = date_create_from_format('Y-m-d H', '20' . substr($barcode, 7, 2) . '-' . substr($barcode, 9, 2) . '-' . substr($barcode, 11, 2) . ' ' . substr($barcode, 13, 2));
                                                 $lot = substr($barcode, 15, $len);
                                                 break;
                                             case '5':
                                                 $len = strlen($barcode) - 14;
                                                 $exp = date_create_from_format('z Y', substr($barcode, 9, 3) . ' 20' . substr($barcode, 7, 2));
                                                 $lot = substr($barcode, 12, $len);
                                                 break;
                                             case '6':
                                                 $len = strlen($barcode) - 16;
                                                 $exp = date_create_from_format('z Y H', substr($barcode, 9, 3) . ' 20' . substr($barcode, 7, 2) . ' ' . substr($barcode, 12, 2));
                                                 $lot = substr($barcode, 14, $len);
                                                 break;
                                             case '7':
                                                 $len = strlen($barcode) - 9;
                                                 $lot = substr($barcode, 7, $len);
                                                 break;
                                             default:
                                                 $len = strlen($barcode) - 12;
                                                 $exp = date_create_from_format('Y-m-d', '20' . substr($barcode, 8, 2) . '-' . substr($barcode, 6, 2) . '-1');
                                                 $lot = substr($barcode, 10, $len);
                                         }
                                         break;
                                     case '9':
                                         switch ($barcode[9]) {
                                             case '2':
                                                 $len = strlen($barcode) - 18;
                                                 $exp = date_create_from_format('Y-m-d', '20' . substr($barcode, 14, 2) . '-' . substr($barcode, 10, 2) . '-' . substr($barcode, 12, 2));
                                                 $lot = substr($barcode, 16, $len);
                                                 break;
                                             case '3':
                                                 $len = strlen($barcode) - 18;
                                                 $exp = date_create_from_format('Y-m-d', '20' . substr($barcode, 10, 2) . '-' . substr($barcode, 12, 2) . '-' . substr($barcode, 14, 2));
                                                 $lot = substr($barcode, 16, $len);
                                                 break;
                                             case '4':
                                                 $len = strlen($barcode) - 20;
                                                 $exp = date_create_from_format('Y-m-d H', '20' . substr($barcode, 10, 2) . '-' . substr($barcode, 12, 2) . '-' . substr($barcode, 14, 2) . ' ' . substr($barcode, 16, 2));
                                                 $lot = substr($barcode, 18, $len);
                                                 break;
                                             case '5':
                                                 $len = strlen($barcode) - 17;
                                                 $exp = date_create_from_format('z Y', substr($barcode, 12, 3) . ' 20' . substr($barcode, 10, 2));
                                                 $lot = substr($barcode, 15, $len);
                                                 break;
                                             case '6':
                                                 $len = strlen($barcode) - 19;
                                                 $exp = date_create_from_format('z Y H', substr($barcode, 12, 3) . ' 20' . substr($barcode, 10, 2) . ' ' . substr($barcode, 15, 2));
                                                 $lot = substr($barcode, 17, $len);
                                                 break;
                                             case '7':
                                                 $len = strlen($barcode) - 12;
                                                 $lot = substr($barcode, 10, $len);
                                                 break;
                                             default:
                                                 $len = strlen($barcode) - 15;
                                                 $exp = date_create_from_format('Y-m-d', '20' . substr($barcode, 11, 2) . '-' . substr($barcode, 9, 2) . '-1');
                                                 $lot = substr($barcode, 13, $len);
                                         }
                                         break;
                                     default:
                                         $len = strlen($barcode) - 9;
                                         $exp = date_create_from_format('Y-m-d', '20' . substr($barcode, 5, 2) . '-' . substr($barcode, 3, 2) . '-1');
                                         $lot = substr($barcode, 7, $len);
                                 }
                             } else {
                                 dd('HIBC Secondary $$+');
                             }
                         }
                     }
                     SecondaryBar::create(array('orderNum' => $order->orderNum, 'PBarcode' => $order->PBarcode, 'PBarSecondary' => $barcode, 'expire' => $exp, 'lot' => $lot));
                     $order->SUser = $username;
                     $order->actual = $order->actual + 1;
                     $order->save();
                 }
             } else {
                 if (strcmp($type, 'EAN-13') == 0) {
                     dd($type);
                 }
             }
         }
     }
     //Scanner Cannot go into Redirect without proper Cookies
     if (!array_key_exists('mac', $input)) {
         return Redirect::to(URL::route('incomplete'));
     }
 }
Пример #3
0
 public function address(Request $request, $id = 0)
 {
     header("Content-Type:text/html;charset=utf-8");
     if ($id == 0) {
         echo "参数错误,没有找到订单";
         exit;
     }
     //这个地方,需要判断一下有没有tendree的权限
     //  echo "userid=".Auth::user()->id;
     $order = Orders::where("id", "=", $id)->where("userid", "=", Auth::user()->id)->where("step", "=", 2)->first();
     //只有支付到了第二段才有可能去选地址
     if ($order == null) {
         echo "参数错误,没有找到订单";
         exit;
     }
     $uid = Auth::user()->id;
     $useraddrs = Address::where("user_id", "=", $uid)->get();
     $provices = Area::whereRaw('parent_id=1')->orderby('id', 'asc')->get();
     $areas = Area::whereRaw('1=1')->orderBy('id', 'desc')->get();
     $order = Orders::findOrFail($id);
     $data = array('order' => $order, 'areas' => $areas, 'provices' => $provices, 'useraddrs' => $useraddrs);
     return view('pay.address', $data);
 }
Пример #4
0
 protected function encounters_view($eid, $pid, $practice_id, $modal = false, $addendum = false)
 {
     $encounterInfo = Encounters::find($eid);
     $data['patientInfo'] = Demographics::find($pid);
     $data['eid'] = $eid;
     $data['encounter_DOS'] = date('F jS, Y; h:i A', $this->human_to_unix($encounterInfo->encounter_DOS));
     $data['encounter_provider'] = $encounterInfo->encounter_provider;
     $data['date_signed'] = date('F jS, Y; h:i A', $this->human_to_unix($encounterInfo->date_signed));
     $data['age1'] = $encounterInfo->encounter_age;
     $data['dob'] = date('F jS, Y', $this->human_to_unix($data['patientInfo']->DOB));
     $data['age'] = $this->current_age($pid);
     if ($data['patientInfo']->sex == 'm') {
         $data['gender'] = 'Male';
     }
     if ($data['patientInfo']->sex == 'f') {
         $data['gender'] = 'Female';
     }
     if ($data['patientInfo']->sex == 'u') {
         $data['gender'] = 'Undifferentiated';
     }
     $data['encounter_cc'] = nl2br($encounterInfo->encounter_cc);
     $practiceInfo = Practiceinfo::find($practice_id);
     $hpiInfo = Hpi::find($eid);
     if ($hpiInfo) {
         if (!is_null($hpiInfo->hpi) && $hpiInfo->hpi != '') {
             $data['hpi'] = '<br><h4>History of Present Illness:</h4><p class="view">';
             $data['hpi'] .= nl2br($hpiInfo->hpi);
             $data['hpi'] .= '</p>';
         }
         if (!is_null($hpiInfo->situation) && $hpiInfo->situation != '') {
             $data['hpi'] = '<br><h4>Situation:</h4><p class="view">';
             $data['hpi'] .= nl2br($hpiInfo->situation);
             $data['hpi'] .= '</p>';
         }
     } else {
         $data['hpi'] = '';
     }
     $rosInfo = Ros::find($eid);
     if ($rosInfo) {
         $data['ros'] = '<br><h4>Review of Systems:</h4><p class="view">';
         if ($rosInfo->ros_gen != '') {
             $data['ros'] .= '<strong>General: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_gen);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_eye != '') {
             $data['ros'] .= '<strong>Eye: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_eye);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_ent != '') {
             $data['ros'] .= '<strong>Ears, Nose, Throat: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_ent);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_resp != '') {
             $data['ros'] .= '<strong>Respiratory: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_resp);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_cv != '') {
             $data['ros'] .= '<strong>Cardiovascular: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_cv);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_gi != '') {
             $data['ros'] .= '<strong>Gastrointestinal: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_gi);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_gu != '') {
             $data['ros'] .= '<strong>Genitourinary: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_gu);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_mus != '') {
             $data['ros'] .= '<strong>Musculoskeletal: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_mus);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_neuro != '') {
             $data['ros'] .= '<strong>Neurological: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_neuro);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_psych != '') {
             $data['ros'] .= '<strong>Psychological: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_psych);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_heme != '') {
             $data['ros'] .= '<strong>Hematological, Lymphatic: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_heme);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_endocrine != '') {
             $data['ros'] .= '<strong>Endocrine: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_endocrine);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_skin != '') {
             $data['ros'] .= '<strong>Skin: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_skin);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_wcc != '') {
             $data['ros'] .= '<strong>Well Child Check: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_wcc);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_psych1 != '') {
             $data['ros'] .= '<strong>Depression: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_psych1);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_psych2 != '') {
             $data['ros'] .= '<strong>Anxiety: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_psych2);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_psych3 != '') {
             $data['ros'] .= '<strong>Bipolar: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_psych3);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_psych4 != '') {
             $data['ros'] .= '<strong>Mood Disorders: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_psych4);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_psych5 != '') {
             $data['ros'] .= '<strong>ADHD: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_psych5);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_psych6 != '') {
             $data['ros'] .= '<strong>PTSD: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_psych6);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_psych7 != '') {
             $data['ros'] .= '<strong>Substance Related Disorder: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_psych7);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_psych8 != '') {
             $data['ros'] .= '<strong>Obsessive Compulsive Disorder: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_psych8);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_psych9 != '') {
             $data['ros'] .= '<strong>Social Anxiety Disorder: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_psych9);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_psych10 != '') {
             $data['ros'] .= '<strong>Autistic Disorder: </strong>';
             $data['ros'] .= nl2br($rosInfo->ros_psych10);
             $data['ros'] .= '<br /><br />';
         }
         if ($rosInfo->ros_psych11 != '') {
             $data['ros'] .= "<strong>Asperger's Disorder: </strong>";
             $data['ros'] .= nl2br($rosInfo->ros_psych11);
             $data['ros'] .= '<br /><br />';
         }
         $data['ros'] .= '</p>';
     } else {
         $data['ros'] = '';
     }
     $ohInfo = DB::table('other_history')->where('eid', '=', $eid)->first();
     if ($ohInfo) {
         $data['oh'] = '<br><h4>Other Pertinent History:</h4><p class="view">';
         if ($ohInfo->oh_pmh != '') {
             $data['oh'] .= '<strong>Past Medical History: </strong>';
             $data['oh'] .= nl2br($ohInfo->oh_pmh);
             $data['oh'] .= '<br /><br />';
         }
         if ($ohInfo->oh_psh != '') {
             $data['oh'] .= '<strong>Past Surgical History: </strong>';
             $data['oh'] .= nl2br($ohInfo->oh_psh);
             $data['oh'] .= '<br /><br />';
         }
         if ($ohInfo->oh_fh != '') {
             $data['oh'] .= '<strong>Family History: </strong>';
             $data['oh'] .= nl2br($ohInfo->oh_fh);
             $data['oh'] .= '<br /><br />';
         }
         if ($ohInfo->oh_sh != '') {
             $data['oh'] .= '<strong>Social History: </strong>';
             $data['oh'] .= nl2br($ohInfo->oh_sh);
             $data['oh'] .= '<br /><br />';
         }
         if ($ohInfo->oh_etoh != '') {
             $data['oh'] .= '<strong>Alcohol Use: </strong>';
             $data['oh'] .= nl2br($ohInfo->oh_etoh);
             $data['oh'] .= '<br /><br />';
         }
         if ($ohInfo->oh_tobacco != '') {
             $data['oh'] .= '<strong>Tobacco Use: </strong>';
             $data['oh'] .= nl2br($ohInfo->oh_tobacco);
             $data['oh'] .= '<br /><br />';
         }
         if ($ohInfo->oh_drugs != '') {
             $data['oh'] .= '<strong>Illicit Drug Use: </strong>';
             $data['oh'] .= nl2br($ohInfo->oh_drugs);
             $data['oh'] .= '<br /><br />';
         }
         if ($ohInfo->oh_employment != '') {
             $data['oh'] .= '<strong>Employment: </strong>';
             $data['oh'] .= nl2br($ohInfo->oh_employment);
             $data['oh'] .= '<br /><br />';
         }
         if ($ohInfo->oh_psychosocial != '') {
             $data['oh'] .= '<strong>Psychosocial: </strong>';
             $data['oh'] .= nl2br($ohInfo->oh_psychosocial);
             $data['oh'] .= '<br /><br />';
         }
         if ($ohInfo->oh_developmental != '') {
             $data['oh'] .= '<strong>Developmental: </strong>';
             $data['oh'] .= nl2br($ohInfo->oh_developmental);
             $data['oh'] .= '<br /><br />';
         }
         if ($ohInfo->oh_medtrials != '') {
             $data['oh'] .= '<strong>Past Medication Trials: </strong>';
             $data['oh'] .= nl2br($ohInfo->oh_medtrials);
             $data['oh'] .= '<br /><br />';
         }
         if ($ohInfo->oh_meds != '') {
             $data['oh'] .= '<strong>Medications: </strong>';
             $data['oh'] .= nl2br($ohInfo->oh_meds);
             $data['oh'] .= '<br /><br />';
         }
         if ($ohInfo->oh_supplements != '') {
             $data['oh'] .= '<strong>Supplements: </strong>';
             $data['oh'] .= nl2br($ohInfo->oh_supplements);
             $data['oh'] .= '<br /><br />';
         }
         if ($ohInfo->oh_allergies != '') {
             $data['oh'] .= '<strong>Allergies: </strong>';
             $data['oh'] .= nl2br($ohInfo->oh_allergies);
             $data['oh'] .= '<br /><br />';
         }
         if ($ohInfo->oh_results != '') {
             $data['oh'] .= '<strong>Reviewed Results: </strong>';
             $data['oh'] .= nl2br($ohInfo->oh_results);
             $data['oh'] .= '<br /><br />';
         }
         $data['oh'] .= '</p>';
     } else {
         $data['oh'] = '';
     }
     $vitalsInfo1 = Vitals::where('eid', '=', $eid)->get();
     if (count($vitalsInfo1) > 0) {
         foreach ($vitalsInfo1 as $vitalsInfo) {
             $data['vitals'] = '<br><h4>Vital Signs:</h4><p class="view">';
             $data['vitals'] .= '<strong>Date/Time:</strong>';
             $data['vitals'] .= $vitalsInfo->vitals_date . '<br>';
             if ($vitalsInfo->weight != '') {
                 $data['vitals'] .= '<strong>Weight: </strong>';
                 $data['vitals'] .= $vitalsInfo->weight . ' ' . $practiceInfo->weight_unit . '<br>';
             } else {
                 $data['vitals'] .= '';
             }
             if ($vitalsInfo->height != '') {
                 $data['vitals'] .= '<strong>Height: </strong>';
                 $data['vitals'] .= $vitalsInfo->height . ' ' . $practiceInfo->height_unit . '<br>';
             } else {
                 $data['vitals'] .= '';
             }
             if ($vitalsInfo->headcircumference != '') {
                 $data['vitals'] .= '<strong>Head Circumference: </strong>';
                 $data['vitals'] .= $vitalsInfo->headcircumference . ' ' . $practiceInfo->hc_unit . '<br>';
             } else {
                 $data['vitals'] .= '';
             }
             if ($vitalsInfo->BMI != '') {
                 $data['vitals'] .= '<strong>Body Mass Index: </strong>';
                 $data['vitals'] .= $vitalsInfo->BMI . '<br>';
             } else {
                 $data['vitals'] .= '';
             }
             if ($vitalsInfo->temp != '') {
                 $data['vitals'] .= '<strong>Temperature: </strong>';
                 $data['vitals'] .= $vitalsInfo->temp . ' ' . $practiceInfo->temp_unit . ', ' . $vitalsInfo->temp_method . '<br>';
             } else {
                 $data['vitals'] .= '';
             }
             if ($vitalsInfo->bp_systolic != '' && $vitalsInfo->bp_diastolic != '') {
                 $data['vitals'] .= '<strong>Blood Pressure: </strong>';
                 $data['vitals'] .= $vitalsInfo->bp_systolic . '/' . $vitalsInfo->bp_diastolic . ', ' . $vitalsInfo->bp_position . '<br>';
             } else {
                 $data['vitals'] .= '';
             }
             if ($vitalsInfo->pulse != '') {
                 $data['vitals'] .= '<strong>Pulse: </strong>';
                 $data['vitals'] .= $vitalsInfo->pulse . '<br>';
             } else {
                 $data['vitals'] .= '';
             }
             if ($vitalsInfo->respirations != '') {
                 $data['vitals'] .= '<strong>Respirations: </strong>';
                 $data['vitals'] .= $vitalsInfo->respirations . '<br>';
             } else {
                 $data['vitals'] .= '';
             }
             if ($vitalsInfo->o2_sat != '') {
                 $data['vitals'] .= '<strong>Oxygen Saturations: </strong>';
                 $data['vitals'] .= $vitalsInfo->o2_sat . '<br>';
             } else {
                 $data['vitals'] .= '';
             }
             if ($vitalsInfo->vitals_other != '') {
                 $data['vitals'] .= '<strong>Notes: </strong>';
                 $data['vitals'] .= nl2br($vitalsInfo->vitals_other) . '<br>';
             }
             $data['vitals'] .= '</p>';
         }
     } else {
         $data['vitals'] = '';
     }
     $peInfo = Pe::find($eid);
     if ($peInfo) {
         $data['pe'] = '<br><h4>Physical Exam:</h4><p class="view">';
         if ($peInfo->pe_gen1 != '') {
             $data['pe'] .= '<strong>General: </strong>';
             $data['pe'] .= nl2br($peInfo->pe_gen1);
             $data['pe'] .= '<br /><br />';
         }
         if ($peInfo->pe_eye1 != '' || $peInfo->pe_eye2 != '' || $peInfo->pe_eye3 != '') {
             $data['pe'] .= '<strong>Eye:</strong>';
             if ($peInfo->pe_eye1 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_eye1);
             }
             if ($peInfo->pe_eye2 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_eye2);
             }
             if ($peInfo->pe_eye3 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_eye3);
             }
             $data['pe'] .= '<br /><br />';
         }
         if ($peInfo->pe_ent1 != '' || $peInfo->pe_ent2 != '' || $peInfo->pe_ent3 != '' || $peInfo->pe_ent4 != '' || $peInfo->pe_ent5 != '' || $peInfo->pe_ent6 != '') {
             $data['pe'] .= '<strong>Ears, Nose, Throat:</strong>';
             if ($peInfo->pe_ent1 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ent1);
             }
             if ($peInfo->pe_ent2 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ent2);
             }
             if ($peInfo->pe_ent3 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ent3);
             }
             if ($peInfo->pe_ent4 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ent4);
             }
             if ($peInfo->pe_ent5 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ent5);
             }
             if ($peInfo->pe_ent6 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ent6);
             }
             $data['pe'] .= '<br /><br />';
         }
         if ($peInfo->pe_neck1 != '' || $peInfo->pe_neck2 != '') {
             $data['pe'] .= '<strong>Neck:</strong>';
             if ($peInfo->pe_neck1 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_neck1);
             }
             if ($peInfo->pe_neck2 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_neck2);
             }
             $data['pe'] .= '<br /><br />';
         }
         if ($peInfo->pe_resp1 != '' || $peInfo->pe_resp2 != '' || $peInfo->pe_resp3 != '' || $peInfo->pe_resp4 != '') {
             $data['pe'] .= '<strong>Respiratory:</strong>';
             if ($peInfo->pe_resp1 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_resp1);
             }
             if ($peInfo->pe_resp2 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_resp2);
             }
             if ($peInfo->pe_resp3 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_resp3);
             }
             if ($peInfo->pe_resp4 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_resp4);
             }
             $data['pe'] .= '<br /><br />';
         }
         if ($peInfo->pe_cv1 != '' || $peInfo->pe_cv2 != '' || $peInfo->pe_cv3 != '' || $peInfo->pe_cv4 != '' || $peInfo->pe_cv5 != '' || $peInfo->pe_cv6 != '') {
             $data['pe'] .= '<strong>Cardiovascular:</strong>';
             if ($peInfo->pe_cv1 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_cv1);
             }
             if ($peInfo->pe_cv2 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_cv2);
             }
             if ($peInfo->pe_cv3 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_cv3);
             }
             if ($peInfo->pe_cv4 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_cv4);
             }
             if ($peInfo->pe_cv5 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_cv5);
             }
             if ($peInfo->pe_cv6 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_cv6);
             }
             $data['pe'] .= '<br /><br />';
         }
         if ($peInfo->pe_ch1 != '' || $peInfo->pe_ch2 != '') {
             $data['pe'] .= '<strong>Chest:</strong>';
             if ($peInfo->pe_ch1 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ch1);
             }
             if ($peInfo->pe_ch2 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ch2);
             }
             $data['pe'] .= '<br /><br />';
         }
         if ($peInfo->pe_gi1 != '' || $peInfo->pe_gi2 != '' || $peInfo->pe_gi3 != '' || $peInfo->pe_gi4 != '') {
             $data['pe'] .= '<strong>Gastrointestinal:</strong>';
             if ($peInfo->pe_gi1 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_gi1);
             }
             if ($peInfo->pe_gi2 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_gi2);
             }
             if ($peInfo->pe_gi3 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_gi3);
             }
             if ($peInfo->pe_gi4 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_gi4);
             }
             $data['pe'] .= '<br /><br />';
         }
         if ($peInfo->pe_gu1 != '' || $peInfo->pe_gu2 != '' || $peInfo->pe_gu3 != '' || $peInfo->pe_gu4 != '' || $peInfo->pe_gu5 != '' || $peInfo->pe_gu6 != '' || $peInfo->pe_gu7 != '' || $peInfo->pe_gu8 != '' || $peInfo->pe_gu9 != '') {
             $data['pe'] .= '<strong>Genitourinary:</strong>';
             if ($peInfo->pe_gu1 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_gu1);
             }
             if ($peInfo->pe_gu2 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_gu2);
             }
             if ($peInfo->pe_gu3 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_gu3);
             }
             if ($peInfo->pe_gu4 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_gu4);
             }
             if ($peInfo->pe_gu5 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_gu5);
             }
             if ($peInfo->pe_gu6 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_gu6);
             }
             if ($peInfo->pe_gu7 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_gu7);
             }
             if ($peInfo->pe_gu8 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_gu8);
             }
             if ($peInfo->pe_gu9 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_gu9);
             }
             $data['pe'] .= '<br /><br />';
         }
         if ($peInfo->pe_lymph1 != '' || $peInfo->pe_lymph2 != '' || $peInfo->pe_lymph3 != '') {
             $data['pe'] .= '<strong>Lymphatic:</strong>';
             if ($peInfo->pe_lymph1 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_lymph1);
             }
             if ($peInfo->pe_lymph2 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_lymph2);
             }
             if ($peInfo->pe_lymph3 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_lymph3);
             }
             $data['pe'] .= '<br /><br />';
         }
         if ($peInfo->pe_ms1 != '' || $peInfo->pe_ms2 != '' || $peInfo->pe_ms3 != '' || $peInfo->pe_ms4 != '' || $peInfo->pe_ms5 != '' || $peInfo->pe_ms6 != '' || $peInfo->pe_ms7 != '' || $peInfo->pe_ms8 != '' || $peInfo->pe_ms9 != '' || $peInfo->pe_ms10 != '' || $peInfo->pe_ms11 != '' || $peInfo->pe_ms12 != '') {
             $data['pe'] .= '<strong>Musculoskeletal:</strong>';
             if ($peInfo->pe_ms1 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ms1);
             }
             if ($peInfo->pe_ms2 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ms2);
             }
             if ($peInfo->pe_ms3 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ms3);
             }
             if ($peInfo->pe_ms4 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ms4);
             }
             if ($peInfo->pe_ms5 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ms5);
             }
             if ($peInfo->pe_ms6 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ms6);
             }
             if ($peInfo->pe_ms7 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ms7);
             }
             if ($peInfo->pe_ms8 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ms8);
             }
             if ($peInfo->pe_ms9 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ms9);
             }
             if ($peInfo->pe_ms10 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ms10);
             }
             if ($peInfo->pe_ms11 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ms11);
             }
             if ($peInfo->pe_ms12 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_ms12);
             }
             $data['pe'] .= '<br /><br />';
         }
         if ($peInfo->pe_skin1 != '' || $peInfo->pe_skin2 != '') {
             $data['pe'] .= '<strong>Skin:</strong>';
             if ($peInfo->pe_skin1 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_skin1);
             }
             if ($peInfo->pe_skin2 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_skin2);
             }
             $data['pe'] .= '<br /><br />';
         }
         if ($peInfo->pe_neuro1 != '' || $peInfo->pe_neuro2 != '' || $peInfo->pe_neuro3 != '') {
             $data['pe'] .= '<strong>Neurologic:</strong>';
             if ($peInfo->pe_neuro1 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_neuro1);
             }
             if ($peInfo->pe_neuro2 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_neuro2);
             }
             if ($peInfo->pe_neuro3 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_neuro3);
             }
             $data['pe'] .= '<br /><br />';
         }
         if ($peInfo->pe_psych1 != '' || $peInfo->pe_psych2 != '' || $peInfo->pe_psych3 != '' || $peInfo->pe_psych4 != '') {
             $data['pe'] .= '<strong>Psychiatric:</strong>';
             if ($peInfo->pe_psych1 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_psych1);
             }
             if ($peInfo->pe_psych2 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_psych2);
             }
             if ($peInfo->pe_psych3 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_psych3);
             }
             if ($peInfo->pe_psych4 != '') {
                 $data['pe'] .= ' ' . nl2br($peInfo->pe_psych4);
             }
             $data['pe'] .= '<br /><br />';
         }
         if ($peInfo->pe_constitutional1 != '') {
             $data['pe'] .= '<strong>Constitutional: </strong>';
             $data['pe'] .= nl2br($peInfo->pe_constitutional1);
             $data['pe'] .= '<br /><br />';
         }
         if ($peInfo->pe_mental1 != '') {
             $data['pe'] .= '<strong>Mental Status Examination: </strong>';
             $data['pe'] .= nl2br($peInfo->pe_mental1);
             $data['pe'] .= '<br /><br />';
         }
         $data['pe'] .= '</p>';
     } else {
         $data['pe'] = '';
     }
     $imagesInfo = DB::table('image')->where('eid', '=', $eid)->get();
     $html = '';
     if ($imagesInfo) {
         $data['images'] = '<br><h4>Images:</h4><p class="view">';
         $k = 0;
         foreach ($imagesInfo as $imagesInfo_row) {
             $directory = $practiceInfo->documents_dir . $pid . "/";
             $new_directory = __DIR__ . '/../../public/temp/';
             $new_directory1 = '/temp/';
             $file_path = str_replace($directory, $new_directory, $imagesInfo_row->image_location);
             $file_path1 = str_replace($directory, $new_directory1, $imagesInfo_row->image_location);
             copy($imagesInfo_row->image_location, $file_path);
             if ($k != 0) {
                 $data['images'] .= '<br><br>';
             }
             $data['images'] .= HTML::image($file_path1, 'Image', array('border' => '0'));
             if ($imagesInfo_row->image_description != '') {
                 $data['images'] .= '<br>' . $imagesInfo_row->image_description . '<br>';
             }
             $k++;
         }
     } else {
         $data['images'] = '';
     }
     $labsInfo = Labs::find($eid);
     if ($labsInfo) {
         $data['labs'] = '<br><h4>Laboratory Testing:</h4><p class="view">';
         if ($labsInfo->labs_ua_urobili != '' || $labsInfo->labs_ua_bilirubin != '' || $labsInfo->labs_ua_ketones != '' || $labsInfo->labs_ua_glucose != '' || $labsInfo->labs_ua_protein != '' || $labsInfo->labs_ua_nitrites != '' || $labsInfo->labs_ua_leukocytes != '' || $labsInfo->labs_ua_blood != '' || $labsInfo->labs_ua_ph != '' || $labsInfo->labs_ua_spgr != '' || $labsInfo->labs_ua_color != '' || $labsInfo->labs_ua_clarity != '') {
             $data['labs'] .= '<strong>Dipstick Urinalysis:</strong><br /><table>';
             if ($labsInfo->labs_ua_urobili != '') {
                 $data['labs'] .= '<tr><th align=\\"left\\">Urobilinogen:</th><td align=\\"left\\">' . $labsInfo->labs_ua_urobili . '</td></tr>';
             }
             if ($labsInfo->labs_ua_bilirubin != '') {
                 $data['labs'] .= '<tr><th align=\\"left\\">Bilirubin:</th><td align=\\"left\\">' . $labsInfo->labs_ua_bilirubin . '</td></tr>';
             }
             if ($labsInfo->labs_ua_ketones != '') {
                 $data['labs'] .= '<tr><th align=\\"left\\">Ketones:</th><td align=\\"left\\">' . $labsInfo->labs_ua_ketones . '</td></tr>';
             }
             if ($labsInfo->labs_ua_glucose != '') {
                 $data['labs'] .= '<tr><th align=\\"left\\">Glucose:</th><td align=\\"left\\">' . $labsInfo->labs_ua_glucose . '</td></tr>';
             }
             if ($labsInfo->labs_ua_protein != '') {
                 $data['labs'] .= '<tr><th align=\\"left\\">Protein:</th><td align=\\"left\\">' . $labsInfo->labs_ua_protein . '</td></tr>';
             }
             if ($labsInfo['labs_ua_nitrites'] != '') {
                 $data['labs'] .= '<tr><th align=\\"left\\">Nitrites:</th><td align=\\"left\\">' . $labsInfo->labs_ua_nitrites . '</td></tr>';
             }
             if ($labsInfo->labs_ua_leukocytes != '') {
                 $data['labs'] .= '<tr><th align=\\"left\\">Leukocytes:</th><td align=\\"left\\">' . $labsInfo->labs_ua_leukocytes . '</td></tr>';
             }
             if ($labsInfo->labs_ua_blood != '') {
                 $data['labs'] .= '<tr><th align=\\"left\\">Blood:</th><td align=\\"left\\">' . $labsInfo->labs_ua_blood . '</td></tr>';
             }
             if ($labsInfo->labs_ua_ph != '') {
                 $data['labs'] .= '<tr><th align=\\"left\\">pH:</th><td align=\\"left\\">' . $labsInfo->labs_ua_ph . '</td></tr>';
             }
             if ($labsInfo->labs_ua_spgr != '') {
                 $data['labs'] .= '<tr><th align=\\"left\\">Specific gravity:</th><td align=\\"left\\">' . $labsInfo->labs_ua_spgr . '</td></tr>';
             }
             if ($labsInfo->labs_ua_color != '') {
                 $data['labs'] .= '<tr><th align=\\"left\\">Color:</th><td align=\\"left\\">' . $labsInfo->labs_ua_color . '</td></tr>';
             }
             if ($labsInfo->labs_ua_clarity != '') {
                 $data['labs'] .= '<tr><th align=\\"left\\">Clarity:</th><td align=\\"left\\">' . $labsInfo->labs_ua_clarity . '</td></tr>';
             }
             $data['labs'] .= '</table>';
         }
         if ($labsInfo->labs_upt != '') {
             $data['labs'] .= '<strong>Urine HcG: </strong>';
             $data['labs'] .= $labsInfo->labs_upt;
             $data['labs'] .= '<br /><br />';
         }
         if ($labsInfo->labs_strep != '') {
             $data['labs'] .= '<strong>Rapid Strep: </strong>';
             $data['labs'] .= $labsInfo->labs_strep;
             $data['labs'] .= '<br /><br />';
         }
         if ($labsInfo->labs_mono != '') {
             $data['labs'] .= '<strong>Mono Spot: </strong>';
             $data['labs'] .= $labsInfo->labs_mono;
             $data['labs'] .= '<br>';
         }
         if ($labsInfo->labs_flu != '') {
             $data['labs'] .= '<strong>Rapid Influenza: </strong>';
             $data['labs'] .= $labsInfo->labs_flu;
             $data['labs'] .= '<br /><br />';
         }
         if ($labsInfo->labs_microscope != '') {
             $data['labs'] .= '<strong>Micrscopy: </strong>';
             $data['labs'] .= nl2br($labsInfo->labs_microscope);
             $data['labs'] .= '<br /><br />';
         }
         if ($labsInfo->labs_glucose != '') {
             $data['labs'] .= '<strong>Fingerstick Glucose: </strong>';
             $data['labs'] .= $labsInfo->labs_glucose;
             $data['labs'] .= '<br /><br />';
         }
         if ($labsInfo->labs_other != '') {
             $data['labs'] .= '<strong>Other: </strong>';
             $data['labs'] .= nl2br($labsInfo->labs_other);
             $data['labs'] .= '<br /><br />';
         }
         $data['labs'] .= '</p>';
     } else {
         $data['labs'] = '';
     }
     $procedureInfo = Procedure::find($eid);
     if ($procedureInfo) {
         $data['procedure'] = '<br><h4>Procedures:</h4><p class="view">';
         if ($procedureInfo->proc_type != '') {
             $data['procedure'] .= '<strong>Procedure: </strong>';
             $data['procedure'] .= nl2br($procedureInfo->proc_type);
             $data['procedure'] .= '<br /><br />';
         }
         if ($procedureInfo->proc_description != '') {
             $data['procedure'] .= '<strong>Description of Procedure: </strong>';
             $data['procedure'] .= nl2br($procedureInfo->proc_description);
             $data['procedure'] .= '<br /><br />';
         }
         if ($procedureInfo->proc_complications != '') {
             $data['procedure'] .= '<strong>Complications: </strong>';
             $data['procedure'] .= nl2br($procedureInfo->proc_complications);
             $data['procedure'] .= '<br /><br />';
         }
         if ($procedureInfo->proc_ebl != '') {
             $data['procedure'] .= '<strong>Estimated Blood Loss: </strong>';
             $data['procedure'] .= nl2br($procedureInfo->proc_ebl);
             $data['procedure'] .= '<br /><br />';
         }
         $data['procedure'] .= '</p>';
     } else {
         $data['procedure'] = '';
     }
     $assessmentInfo = Assessment::find($eid);
     if ($assessmentInfo) {
         $data['assessment'] = '<br><h4>Assessment:</h4><p class="view">';
         if ($assessmentInfo->assessment_1 != '') {
             $data['assessment'] .= '<strong>' . $assessmentInfo->assessment_1 . '</strong><br />';
             if ($assessmentInfo->assessment_2 == '') {
                 $data['assessment'] .= '<br />';
             }
         }
         if ($assessmentInfo->assessment_2 != '') {
             $data['assessment'] .= '<strong>' . $assessmentInfo->assessment_2 . '</strong><br />';
             if ($assessmentInfo->assessment_3 == '') {
                 $data['assessment'] .= '<br />';
             }
         }
         if ($assessmentInfo->assessment_3 != '') {
             $data['assessment'] .= '<strong>' . $assessmentInfo->assessment_3 . '</strong><br />';
             if ($assessmentInfo->assessment_4 == '') {
                 $data['assessment'] .= '<br />';
             }
         }
         if ($assessmentInfo->assessment_4 != '') {
             $data['assessment'] .= '<strong>' . $assessmentInfo->assessment_4 . '</strong><br />';
             if ($assessmentInfo->assessment_5 == '') {
                 $data['assessment'] .= '<br />';
             }
         }
         if ($assessmentInfo->assessment_5 != '') {
             $data['assessment'] .= '<strong>' . $assessmentInfo->assessment_5 . '</strong><br />';
             if ($assessmentInfo->assessment_6 == '') {
                 $data['assessment'] .= '<br />';
             }
         }
         if ($assessmentInfo->assessment_6 != '') {
             $data['assessment'] .= '<strong>' . $assessmentInfo->assessment_6 . '</strong><br />';
             if ($assessmentInfo->assessment_7 == '') {
                 $data['assessment'] .= '<br />';
             }
         }
         if ($assessmentInfo->assessment_7 != '') {
             $data['assessment'] .= '<strong>' . $assessmentInfo->assessment_7 . '</strong><br />';
             if ($assessmentInfo->assessment_8 == '') {
                 $data['assessment'] .= '<br />';
             }
         }
         if ($assessmentInfo->assessment_8 != '') {
             $data['assessment'] .= '<strong>' . $assessmentInfo->assessment_8 . '</strong><br /><br />';
         }
         if ($assessmentInfo->assessment_other != '') {
             if ($encounterInfo->encounter_template == 'standardmtm') {
                 $data['assessment'] .= '<strong>SOAP Note: </strong>';
             } else {
                 $data['assessment'] .= '<strong>Additional Diagnoses: </strong>';
             }
             $data['assessment'] .= nl2br($assessmentInfo->assessment_other);
             $data['assessment'] .= '<br /><br />';
         }
         if ($assessmentInfo->assessment_ddx != '') {
             if ($encounterInfo->encounter_template == 'standardmtm') {
                 $data['assessment'] .= '<strong>MAP2: </strong>';
             } else {
                 $data['assessment'] .= '<strong>Differential Diagnoses Considered: </strong>';
             }
             $data['assessment'] .= nl2br($assessmentInfo->assessment_ddx);
             $data['assessment'] .= '<br /><br />';
         }
         if ($assessmentInfo->assessment_notes != '') {
             if ($encounterInfo->encounter_template == 'standardmtm') {
                 $data['assessment'] .= '<strong>Pharmacist Note: </strong>';
             } else {
                 $data['assessment'] .= '<strong>Assessment Discussion: </strong>';
             }
             $data['assessment'] .= nl2br($assessmentInfo->assessment_notes);
             $data['assessment'] .= '<br /><br />';
         }
         $data['assessment'] .= '</p>';
     } else {
         $data['assessment'] = '';
     }
     $ordersInfo1 = Orders::where('eid', '=', $eid)->get();
     if (count($ordersInfo1) > 0) {
         $data['orders'] = '<br><h4>Orders:</h4><p class="view">';
         $orders_lab_array = array();
         $orders_radiology_array = array();
         $orders_cp_array = array();
         $orders_referrals_array = array();
         foreach ($ordersInfo1 as $ordersInfo) {
             $address_row1 = Addressbook::find($ordersInfo->address_id);
             if ($address_row1) {
                 $orders_displayname = $address_row1->displayname;
             } else {
                 $orders_displayname = 'Unknown';
             }
             if ($ordersInfo->orders_labs != '') {
                 $orders_lab_array[] = 'Orders sent to ' . $orders_displayname . ': ' . nl2br($ordersInfo->orders_labs) . '<br />';
             }
             if ($ordersInfo->orders_radiology != '') {
                 $orders_radiology_array[] = 'Orders sent to ' . $orders_displayname . ': ' . nl2br($ordersInfo->orders_radiology) . '<br />';
             }
             if ($ordersInfo->orders_cp != '') {
                 $orders_cp_array[] = 'Orders sent to ' . $orders_displayname . ': ' . nl2br($ordersInfo->orders_cp) . '<br />';
             }
             if ($ordersInfo->orders_referrals != '') {
                 $orders_referrals_array[] = 'Referral sent to ' . $orders_displayname . ': ' . nl2br($ordersInfo->orders_referrals) . '<br />';
             }
         }
         if (count($orders_lab_array) > 0) {
             $data['orders'] .= '<strong>Labs: </strong>';
             foreach ($orders_lab_array as $lab_item) {
                 $data['orders'] .= $lab_item;
             }
         }
         if (count($orders_radiology_array) > 0) {
             $data['orders'] .= '<strong>Imaging: </strong>';
             foreach ($orders_radiology_array as $radiology_item) {
                 $data['orders'] .= $radiology_item;
             }
         }
         if (count($orders_cp_array) > 0) {
             $data['orders'] .= '<strong>Cardiopulmonary: </strong>';
             foreach ($orders_cp_array as $cp_item) {
                 $data['orders'] .= $cp_item;
             }
         }
         if (count($orders_referrals_array) > 0) {
             $data['orders'] .= '<strong>Referrals: </strong>';
             foreach ($orders_referrals_array as $referrals_item) {
                 $data['orders'] .= $referrals_item;
             }
         }
         $data['orders'] .= '</p>';
     } else {
         $data['orders'] = '';
     }
     $rxInfo = Rx::find($eid);
     if ($rxInfo) {
         $data['rx'] = '<br><h4>Prescriptions and Immunizations:</h4><p class="view">';
         if ($rxInfo->rx_rx != '') {
             $data['rx'] .= '<strong>Prescriptions Given: </strong>';
             $data['rx'] .= nl2br($rxInfo->rx_rx);
             $data['rx'] .= '<br /><br />';
         }
         if ($rxInfo->rx_supplements != '') {
             $data['rx'] .= '<strong>Supplements Recommended: </strong>';
             $data['rx'] .= nl2br($rxInfo->rx_supplements);
             $data['rx'] .= '<br /><br />';
         }
         if ($rxInfo->rx_immunizations != '') {
             $data['rx'] .= '<strong>Immunizations Given: </strong>';
             $data['rx'] .= 'CDC Vaccine Information Sheets given for each immunization and consent obtained.<br />';
             $data['rx'] .= nl2br($rxInfo->rx_immunizations);
             $data['rx'] .= '<br /><br />';
         }
         $data['rx'] .= '</p>';
     } else {
         $data['rx'] = '';
     }
     $planInfo = Plan::find($eid);
     if ($planInfo) {
         $data['plan'] = '<br><h4>Plan:</h4><p class="view">';
         if ($planInfo->plan != '') {
             $data['plan'] .= '<strong>Recommendations: </strong>';
             $data['plan'] .= nl2br($planInfo->plan);
             $data['plan'] .= '<br /><br />';
         }
         if ($planInfo->followup != '') {
             $data['plan'] .= '<strong>Followup: </strong>';
             $data['plan'] .= nl2br($planInfo->followup);
             $data['plan'] .= '<br /><br />';
         }
         if ($planInfo->goals != '') {
             $data['plan'] .= '<strong>Goals/Measures: </strong>';
             $data['plan'] .= nl2br($planInfo->goals);
             $data['plan'] .= '<br /><br />';
         }
         if ($planInfo->tp != '') {
             $data['plan'] .= '<strong>Treatment Plan Notes: </strong>';
             $data['plan'] .= nl2br($planInfo->tp);
             $data['plan'] .= '<br /><br />';
         }
         if ($planInfo->duration != '') {
             $data['plan'] .= 'Counseling and face-to-face time consists of more than 50 percent of the visit.  Total face-to-face time is ';
             $data['plan'] .= $planInfo->duration . ' minutes.';
             $data['plan'] .= '<br /><br />';
         }
         $data['plan'] .= '</p>';
     } else {
         $data['plan'] = '';
     }
     $billing_query = Billing_core::where('eid', '=', $eid)->get();
     if ($billing_query) {
         $data['billing'] = '<p class="view">';
         $billing_count = 0;
         foreach ($billing_query as $billing_row) {
             if ($billing_count > 0) {
                 $data['billing'] .= ',' . $billing_row->cpt;
             } else {
                 $data['billing'] .= '<strong>CPT Codes: </strong>';
                 $data['billing'] .= $billing_row->cpt;
             }
             $billing_count++;
         }
         if ($encounterInfo->bill_complex != '') {
             $data['billing'] .= '<br><strong>Medical Complexity: </strong>';
             $data['billing'] .= nl2br($encounterInfo->bill_complex);
             $data['billing'] .= '<br /><br />';
         }
         $data['billing'] .= '</p>';
     } else {
         $data['billing'] = '';
     }
     if ($modal == true) {
         if ($encounterInfo->encounter_signed == 'No') {
             $data['status'] = 'Draft';
         } else {
             $data['status'] = 'Signed on ' . date('F jS, Y', $this->human_to_unix($encounterInfo->date_signed)) . '.';
         }
         if ($addendum == true) {
             $data['addendum'] = true;
         } else {
             $data['addendum'] = false;
         }
         return View::make('modal_view', $data);
     } else {
         return View::make('encounter_view', $data);
     }
 }
Пример #5
0
 static function getOrderDetailsbyPaydueId($paydueId)
 {
     return Orders::where('payment_dues_id', '=', $paydueId)->get();
 }
Пример #6
0
 public function printBdayOrder($oid)
 {
     $orderid = Crypt::decrypt($oid);
     $order_data = Orders::where('orders.id', '=', $orderid)->get();
     $customer_data = Customers::where('id', '=', $order_data[0]['customer_id'])->get();
     $birthday_data = BirthdayParties::where('id', '=', $order_data[0]['birthday_id'])->get();
     $student_data = Students::where('id', '=', $order_data[0]['student_id'])->get();
     $order_data = $order_data[0];
     if (isset($order_data['payment_dues_id'])) {
         $payment_due_data = PaymentDues::where('id', '=', $order_data['payment_dues_id'])->get();
         $payment_due_data = $payment_due_data[0];
         if (isset($payment_due_data->membership_id)) {
             $membershipData = CustomerMembership::find($payment_due_data->membership_id);
             $membershipTypeData = MembershipTypes::getMembershipTypeByID($membershipData->membership_type_id);
             $payment_due_data->description = $membershipTypeData->description;
         }
     }
     $customer_data = $customer_data[0];
     $birthday_data = $birthday_data[0];
     $student_data = $student_data[0];
     $data = array('order_data', 'customer_data', 'birthday_data', 'student_data', 'payment_due_data');
     // print_r($data);
     return View::make('pages.orders.bdayprintorder', compact($data));
 }
Пример #7
0
 public function getSumAllOrders($packageID, $dateFrom, $dateTo)
 {
     $order = Orders::where('order_packageid', $packageID)->where('order_datefrom', $dateFrom)->where('order_dateto', $dateTo)->count();
     return $order;
 }