EVOLUTION-NINJA
Edit File: Reports.php
<?php namespace App\Controllers\cnb; use CodeIgniter\RESTful\ResourceController; use CodeIgniter\API\ResponseTrait; use App\Models\ApiModel; use App\Models\OrganisationModel; class Reports extends ResourceController { use ResponseTrait; public function index() { // report analytics return view('flowD/reports'); } public function reports_home() { $name = session()->get('name'); // $z = $_POST['from_date']; // print_r($z);die(); // print_r($audit);die(); // if($_POST['from_date'] && $_POST['to_date']){ // $builder->where('created_at >=',$_POST['from_date']); // $builder->where('created_at <=', $_POST['to_date']); // } // else // { // echo "Please select date"; // } return view('cnb/reports/cnb-reports'); } public function consolidated() { $name = session()->get('name'); $model8 = new OrganisationModel(); $details = $model8->get()->getResultArray(); $data['org'] = $details; return view('admin/consolidated_reports',$data); } public function z() { $db = \Config\Database::connect(); $name = session()->get('name'); $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($_POST['from_date']))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($_POST['to_date']))); $query = $builder->get(); $record = $query->getResult(); // $builder = $db->table('cnb_postop'); // $query = $builder->select("COUNT(id) as count"); // $query = $builder->where('procedure_date >=',date('Y-m-d',strtotime($_POST['from_date']))); // $query = $builder->where('procedure_date <=',date('Y-m-d',strtotime($_POST['to_date']))); // $query = $builder->get(); // $record = $query->getResult(); $total = $record[0]->count; $audit = array( 'from_date' => $_POST['from_date'], 'to_date' => $_POST['to_date'], 'total' => $total ); session()->set($audit); return json_encode( array( 'result' => 1, 'message' => 'session created.....' ) ); } public function procedure_success() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); if (session()->get('e_total') > 1) { $e_total = session()->get('e_total'); } else { $e_total = 1; } if (session()->get('s_total') > 1) { $s_total = session()->get('s_total'); } else { $s_total = 1; } if (session()->get('cse_total') > 1) { $cse_total = session()->get('cse_total'); } else { $cse_total = 1; } if (session()->get('csa_total') > 1) { $csa_total = session()->get('csa_total'); } else { $csa_total = 1; } $total_s = 0; $total_e = 0; $total_cse = 0; $total_csa = 0; // --------------------SPINAL------------------- // --------------------SPINAL COMPLETE------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_spinal.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_spinal.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('procedure_spinal.success_status ', 'Complete Success'); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_s += floatval($row->count); $s_complete = floatval($row->count); } // --------------------SPINAL PARTIAL------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_spinal.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_spinal.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('procedure_spinal.success_status ', 'Partial Success'); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_s += floatval($row->count); $s_partial = floatval($row->count); } // --------------------SPINAL FAILURE------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_spinal.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_spinal.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('procedure_spinal.success_status ', 'Failure'); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_s += floatval($row->count); $s_failure = floatval($row->count); } // --------------------CSE------------------- // --------------------CSE COMPLETE------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('procedure_cse.success', 'Complete Success'); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_cse += floatval($row->count); $cse_complete = floatval($row->count); } // --------------------CSE PARTIAL------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('procedure_cse.success', 'Partial Success'); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_cse += floatval($row->count); $cse_partial = floatval($row->count); } // --------------------CSE FAILURE------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('procedure_cse.success', 'Failure'); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_cse += floatval($row->count); $cse_failure = floatval($row->count); } // --------------------CSA------------------- // --------------------CSA COMPLETE------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_csa.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_csa.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('procedure_csa.success', 'Complete Success'); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_csa += floatval($row->count); $csa_complete = floatval($row->count); } // --------------------CSA PARTIAL------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_csa.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_csa.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('procedure_csa.success', 'Partial Success'); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_csa += floatval($row->count); $csa_partial = floatval($row->count); } // --------------------CSA FAILURE------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_csa.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_csa.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('procedure_csa.success', 'Failure'); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_csa += floatval($row->count); $csa_failure = floatval($row->count); } // --------------------EPIDURAL------------------- // --------------------EPIDURAL COMPLETE------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_epidural.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_epidural.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('procedure_epidural.success_status ', 'Complete Success'); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_e += floatval($row->count); $e_complete = floatval($row->count); } // --------------------EPIDURAL PARTIAL------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_epidural.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_epidural.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('procedure_epidural.success_status ', 'Partial Success'); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_e += floatval($row->count); $e_partial = floatval($row->count); } // --------------------EPIDURAL FAILURE------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_epidural.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_epidural.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('procedure_epidural.success_status ', 'Failure'); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_e += floatval($row->count); $e_failure += floatval($row->count); } $all_total = $e_total + $s_total + $cse_total + $csa_total; $complete_total = $e_complete + $s_complete + $csa_complete + $cse_complete; $partial_total = $e_partial + $s_partial + $cse_partial + $csa_partial; $failure_total = $e_failure + $s_failure + $csa_failure + $cse_failure; $success_status[] = array( 'day' => 'Complete Success', 'sell' => $complete_total, // 'perc' =>number_format((float)(($complete_total/$all_total)*100), 1, '.', '')."%", ); $success_status[] = array( 'day' => 'Partial Success', 'sell' => $partial_total, // 'perc' =>number_format((float)(($partial_total/$all_total)*100), 1, '.', '')."%", ); $success_status[] = array( 'day' => 'Failure', 'sell' => $failure_total, // 'perc' =>number_format((float)(($failure_total/$all_total)*100), 1, '.', '')."%", ); $all_success[] = array( 'name' => 'Combined Spinal Epidural', 'n' => $total_cse, 'complete' => $cse_complete, 'partial' => $cse_partial, 'failure' => $cse_failure, 'total' => $cse_total, ); $all_success[] = array( 'name' => 'Epidural alone', 'n' => $total_e, 'complete' => $e_complete, 'partial' => $e_partial, 'failure' => $e_failure, 'total' => $e_total, ); $all_success[] = array( 'name' => 'Spinal alone', 'n' => $total_s, 'complete' => $s_complete, 'partial' => $s_partial, 'failure' => $s_failure, 'total' => $s_total, ); $all_success[] = array( 'name' => 'CSA - Continuous Spinal Anaesthesia', 'n' => $total_csa, 'complete' => $csa_complete, 'partial' => $csa_partial, 'failure' => $csa_failure, 'total' => $csa_total, ); $data['products'] = ($products); $data['success_status'] = $success_status; $data['all_success'] = $all_success; $data['total'] = $total; return view('cnb/reports/procedure_success', $data); } else { return redirect()->route("n_report"); } } public function asa() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $asa = []; $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.asa', 'ASA 1'); $query = $builder->groupBy('asa'); $query = $builder->get(); $record = $query->getResult(); // $db = \Config\Database::connect(); //$query = $db->getLastQuery(); //echo $query; //die(); if ($record) { foreach ($record as $row) { $asa[] = array( 'day' => 'ASA 1', 'sell' => floatval($row->count) ); } } else { $asa[] = array( 'day' => 'ASA 1', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.asa', 'ASA 2'); $query = $builder->groupBy('asa'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $asa[] = array( 'day' => 'ASA 2', 'sell' => floatval($row->count) ); } } else { $asa[] = array( 'day' => 'ASA 2', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.asa', 'ASA 3'); $query = $builder->groupBy('asa'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $asa[] = array( 'day' => 'ASA 3', 'sell' => floatval($row->count) ); } } else { $asa[] = array( 'day' => 'ASA 3', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.asa', 'ASA 4'); $query = $builder->groupBy('asa'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $asa[] = array( 'day' => 'ASA 4', 'sell' => floatval($row->count) ); } } else { $asa[] = array( 'day' => 'ASA 4', 'sell' => 0 ); } $data['asa'] = ($asa); $data['total'] = $total; return view('cnb/reports/asa_v', $data); } else { return redirect()->route("n_report"); } } public function demography() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $data['total_n'] = $total; $builder = $db->table('cnb_postop'); // $query = $builder->select("AVG(cnb_patient_details.age) as average, STDDEV(cnb_patient_details.age) as std, MAX(cnb_patient_details.age) as maxage,MIN(cnb_patient_details.age) as minage,MAX(cnb_patient_details.weight_kg) as maxweight,MIN(cnb_patient_details.weight_kg) as minweight,AVG(cnb_patient_details.weight_kg) as weight_average, STDDEV(cnb_patient_details.weight_kg) as weight_std,cnb_patient_details.weight_kg, cnb_patient_details.age"); $query = $builder->select("cnb_patient_details.weight_kg, cnb_patient_details.age"); $builder->join('cnb_patient_details', 'cnb_patient_details.id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); $weig_arr =[]; $age_arr =[]; foreach ($record as $row) { // $max_age = $row->maxage; // $min_age = $row->minage; // $maxweight = $row->maxweight; // $minweight = $row->minweight; // $average = $row->average; // $std = $row->std; // $weight_average = $row->weight_average; // $weight_std = $row->weight_std; if($row->weight_kg == ''){ array_push($weig_arr,0); }else{ array_push($weig_arr,$row->weight_kg); } if($row->age == ''){ array_push($age_arr,0); }else{ array_push($age_arr,$row->age); } } // print_r(sort($weig_arr)); // print_r('<br>'); // print_r(max($weig_arr)); // print_r('<br>'); // print_r(min($weig_arr)); // print_r('<br>'); // print_r($weig_arr); // die(); if($record){ $max_age = max($age_arr); $min_age = min($age_arr); $maxweight = max($weig_arr); $minweight = min($weig_arr); $weig_mean = array_sum($weig_arr) / count($weig_arr); $weig_sum_of_squared_differences = 0; foreach ($weig_arr as $number) { $difference = $number - $weig_mean; $weig_sum_of_squared_differences += $difference * $difference; } $weig_standard_deviation = sqrt($weig_sum_of_squared_differences / count($weig_arr)); $age_mean = array_sum($age_arr) / count($age_arr); $age_sum_of_squared_differences = 0; foreach ($age_arr as $number) { $difference1 = $number - $age_mean; $age_sum_of_squared_differences += $difference1 * $difference1; } $age_standard_deviation = sqrt($age_sum_of_squared_differences / count($age_arr)); }else{ $weig_mean = 0; $weig_standard_deviation = 0; $age_mean = 0; $age_standard_deviation = 0; $max_age = 0; $min_age = 0; $maxweight = 0; $minweight = 0; } $builder = $db->table('cnb_postop'); $query = $builder->select("count(cnb_postop.id) as female"); $builder->join('cnb_patient_details', 'cnb_patient_details.id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('cnb_patient_details.gender', 'Female'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $female = $row->female; } $products[] = array( 'day' => 'Female', 'sell' => $female ); $builder = $db->table('cnb_postop'); $query = $builder->select("count(cnb_postop.id) as male"); $builder->join('cnb_patient_details', 'cnb_patient_details.id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('cnb_patient_details.gender', 'Male'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $male = $row->male; } $products[] = array( 'day' => 'Male', 'sell' => $male ); $bmi = []; $builder = $db->table('cnb_postop'); $query = $builder->select("count(cnb_postop.id) as bmi"); $builder->join('cnb_patient_details', 'cnb_patient_details.id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('cnb_patient_details.bmi >=', '30'); $query = $builder->where('cnb_patient_details.bmi <=', '34.99'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $bmi1 = $row->bmi; $bmi[] = array( 'day' => 'bmi >= 30', 'sell' => $bmi1 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("count(cnb_postop.id) as bmi"); $builder->join('cnb_patient_details', 'cnb_patient_details.id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('cnb_patient_details.bmi >=', '35'); $query = $builder->where('cnb_patient_details.bmi <=', '39.99'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $bmi2 = $row->bmi; $bmi[] = array( 'day' => 'bmi >= 35', 'sell' => $bmi2 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("count(cnb_postop.id) as bmi"); $builder->join('cnb_patient_details', 'cnb_patient_details.id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('cnb_patient_details.bmi >=', '40'); $query = $builder->where('cnb_patient_details.bmi <=', '39.99'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $bmi3 = $row->bmi; $bmi[] = array( 'day' => 'bmi >= 40', 'sell' => $bmi3 ); } $data['bmi1'] = $bmi1; $data['bmi2'] = $bmi2; $data['bmi3'] = $bmi3; $data['total_n'] = $total; $data['max_age'] = $max_age; $data['min_age'] = $min_age; $data['female'] = $female; $data['male'] = $male; $data['maxweight'] = $maxweight; $data['minweight'] = $minweight; $data['average'] = number_format((float) $age_mean, 1, '.', ''); $data['std'] = number_format((float) $age_standard_deviation, 1, '.', ''); $data['weight_average'] = number_format((float) $weig_mean, 1, '.', ''); $data['weight_std'] = number_format((float) $weig_standard_deviation, 1, '.', ''); $data['products'] = ($products); $data['bmi'] = ($bmi); return view('cnb/reports/demography_v', $data); } else { return redirect()->route("n_report"); } } public function late_complication() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $products = []; $postdural_puncture = 0; $backache_epidural = 0; $perst_sensory = 0; $perst_motor = 0; $none = 0; $asep_meningi = 0; $bacterial_meningi = 0; $epidural_abs = 0; $perm_neuro_compli = 0; $catheter = 0; $epidural_haema = 0; $others = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, cnb_followup.postdural_puncture,cnb_followup.backache_epidural,cnb_followup.perst_motor,cnb_followup.perst_sensory,cnb_followup.asep_meningi,cnb_followup.bacterial_meningi,cnb_followup.epidural_abs,cnb_followup.perm_neuro_compli,cnb_followup.catheter,cnb_followup.epidural_haema,cnb_followup.others"); $builder->join('cnb_followup', 'cnb_followup.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->postdural_puncture != 'Yes' && $row->backache_epidural != 'Yes' && $row->perst_sensory != 'Yes' && $row->perst_motor != 'Yes' && $row->asep_meningi != 'Yes' && $row->bacterial_meningi != 'Yes' && $row->epidural_abs != 'Yes' && $row->perm_neuro_compli != 'Yes' && $row->catheter != 'Yes' && $row->epidural_haema != 'Yes' && $row->others != 'Yes') { $none = $none + 1; } if ($row->postdural_puncture == 'Yes') { $postdural_puncture = $postdural_puncture + 1; } if ($row->backache_epidural == 'Yes') { $backache_epidural = $backache_epidural + 1; } if ($row->perst_sensory == 'Yes') { $perst_sensory = $perst_sensory + 1; } if ($row->perst_motor == 'Yes') { $perst_motor = $perst_motor + 1; } if ($row->asep_meningi == 'Yes') { $asep_meningi = $asep_meningi + 1; } if ($row->bacterial_meningi == 'Yes') { $bacterial_meningi = $bacterial_meningi + 1; } if ($row->epidural_abs == 'Yes') { $epidural_abs = $epidural_abs + 1; } if ($row->perm_neuro_compli == 'Yes') { $perm_neuro_compli = $perm_neuro_compli + 1; } if ($row->catheter == 'Yes') { $catheter = $catheter + 1; } if ($row->epidural_haema == 'Yes') { $epidural_haema = $epidural_haema + 1; } if ($row->others == 'Yes') { $others = $others + 1; } } } $products[] = array( 'day' => 'None', 'sell' => $none ); $products[] = array( 'day' => 'Post-Dural Puncture Headachedural', 'sell' => $postdural_puncture ); $products[] = array( 'day' => 'Backache at Epidural Site', 'sell' => $backache_epidural ); $products[] = array( 'day' => 'Persistent Motor Deficit', 'sell' => $perst_motor ); $products[] = array( 'day' => 'Persistent Sensory Deficit', 'sell' => $perst_sensory ); $products[] = array( 'day' => 'Aseptic Meningitis', 'sell' => $asep_meningi ); $products[] = array( 'day' => 'Bacterial Meningitis', 'sell' => $bacterial_meningi ); $products[] = array( 'day' => 'Epidural Abscess', 'sell' => $epidural_abs ); $products[] = array( 'day' => 'Permanent Neurological Complication', 'sell' => $perm_neuro_compli ); $products[] = array( 'day' => 'Catheter Related Issues', 'sell' => $catheter ); $products[] = array( 'day' => 'Epidural Haematoma', 'sell' => $epidural_haema ); $products[] = array( 'day' => 'Others', 'sell' => $others ); // $postdural_puncture = 0; // $backache_epidural = 0; // $perst_sensory = 0; // $perst_motor = 0; // $none = 0; // $asep_meningi = 0; // $bacterial_meningi = 0; // $epidural_abs = 0; // $perm_neuro_compli = 0; // $catheter = 0; // $epidural_haema = 0; // $others = 0; $data['products'] = ($products); $data['total'] = $total; $data['total_n'] = $postdural_puncture + $backache_epidural + $perst_sensory + $perst_motor + $none + $asep_meningi + $bacterial_meningi + $perm_neuro_compli + $catheter + $epidural_haema + $others; return view('cnb/reports/late_complication_v', $data); } else { return redirect()->route("n_report"); } } public function n_report() { $db = \Config\Database::connect(); $dr_id = session()->get('dr_id'); if ($dr_id != '') { $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); $count = session()->get('total'); if ($from_date == '' && $to_date == '') { return view('includes/reports-date-header'); } // else if($from_date != '' && $to_date != '' && $count <= 0){ // return view('includes/reports-date-header'); // } else { $total = 0; $products = []; $total_nc = 0; // csa $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_csa.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_csa.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total += floatval($row->count); $csa_total = floatval($row->count); } // cse $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total += floatval($row->count); $cse_total = floatval($row->count); } // procedure_epidural $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_epidural.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_epidural.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); // print_r($record);die(); foreach ($record as $row) { $total += floatval($row->count); $e_total = floatval($row->count); } // procedure_spinal $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id', 'left'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_spinal.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_spinal.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total += floatval($row->count); $s_total = floatval($row->count); } // $db = \Config\Database::connect(); // $query = $db->getLastQuery(); // echo $query; // die(); $products[] = array( 'day' => 'N`', 'sell' => $total ); // nc csa $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('manual_feedback', 'manual_feedback.patient_id = cnb_postop.patient_id'); $builder->join('cnb_followup', 'cnb_followup.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_csa.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_csa.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_nc += floatval($row->count); } //nc cse $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('manual_feedback', 'manual_feedback.patient_id = cnb_postop.patient_id'); $builder->join('cnb_followup', 'cnb_followup.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_nc += floatval($row->count); } // nc epidural $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('manual_feedback', 'manual_feedback.patient_id = cnb_postop.patient_id'); $builder->join('cnb_followup', 'cnb_followup.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_epidural.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_epidural.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_nc += floatval($row->count); } // nc spinal $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('manual_feedback', 'manual_feedback.patient_id = cnb_postop.patient_id'); $builder->join('cnb_followup', 'cnb_followup.patient_id = cnb_postop.patient_id'); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('procedure_spinal.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_spinal.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_nc += floatval($row->count); } $products[] = array( 'day' => 'Nc', 'sell' => $total_nc ); // $e_number = (($e_total/$total)*100); // $s_number = (($s_total/$total)*100); // $csa_number = (($csa_total/$total)*100); // $cse_number = (($cse_total/$total)*100); // echo number_format((float)$number, 2, '.', '')."%"; // print_r($e_number);die(); $s_products[] = array( 'day' => 'Ns', 'sell' => $s_total ); $cse_products[] = array( 'day' => 'Ncse', 'sell' => $cse_total ); $csa_products[] = array( 'day' => 'Ncsa', 'sell' => $csa_total ); $e_products[] = array( 'day' => 'Ne', 'sell' => $e_total ); $data['products'] = ($products); $data['s_products'] = ($s_products); $data['cse_products'] = ($cse_products); $data['csa_products'] = ($csa_products); $data['e_products'] = ($e_products); $data['total'] = $total; $data['total_nc'] = $total_nc; $data['products'] = ($products); $data['s_total'] = ($s_total); $data['cse_total'] = ($cse_total); $data['csa_total'] = ($csa_total); $data['e_total'] = ($e_total); $n_value = array( 'n' => $total, 'nc' => $total_nc, 's_total' => $s_total, 'e_total' => $e_total, 'cse_total' => $cse_total, 'csa_total' => $csa_total ); session()->set($n_value); // $data['e_perc'] = number_format((float)$e_number, 1, '.', '')."%"; // $data['s_perc'] = number_format((float)$s_number, 1, '.', '')."%"; // $data['csa_perc'] = number_format((float)$csa_number, 1, '.', '')."%"; // $data['cse_perc'] = number_format((float)$cse_number, 1, '.', '')."%"; // $data['e_total'] = $e_total; // $data['s_total'] = $s_total; // $data['csa_total'] = $csa_total; // $data['cse_total'] = $cse_total; return view('cnb/reports/n_report', $data); } } else { return redirect()->route("admin/login"); } } public function bar() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('cnb_preop'); $query = $builder->select("COUNT(id) as count, COUNT(asa) as s,asa as day"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('asa'); $query = $builder->get(); $data['products'] = $query->getResult(); $data['products'] = $query->getResult(); return view('cnb/reports/bar', $data); } else { return redirect()->route("n_report"); } } //------------------------ procedure---------------// public function surgical() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(id) as count"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total += floatval($row->count); } $data['total_n'] = $total; $builder = $db->table('cnb_preop'); $query = $builder->select("COUNT(id) as count, category as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('category'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $products = []; foreach ($record as $row) { $products[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } //$query = $db->getLastQuery(); //echo (string)$query; //print_r($products); $data['products'] = ($products); $data['total'] = $total; //$query = $db->getLastQuery(); return view('cnb/reports/surgical_v', $data); } else { return redirect()->route("n_report"); } } public function speciality() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $products = []; $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.speciality', 'General Surgery'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'General Surgery', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'General Surgery', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.speciality', 'Gynaecology'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Gynaecology', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Gynaecology', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.speciality', 'Orthopaedics'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Orthopaedics', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'ASA 3', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.speciality', 'Plastic surgery'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Plastic surgery', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Plastic surgery', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.speciality', 'Cardiothoracic surgery'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Cardiothoracic surgery', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Cardiothoracic surgery', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.speciality', 'Vascular Surgery'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Vascular Surgery', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Vascular Surgery', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.speciality', 'Neuro-spine'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Neuro-spine', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Neuro-spine', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.speciality', 'Urology'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Urology', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Urology', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.speciality', 'Other'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Other', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Other', 'sell' => 0 ); } $data['products'] = ($products); $data['total_n'] = $total; return view('cnb/reports/speciality_v', $data); } else { return redirect()->route("n_report"); } } public function location() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $products = []; $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.surgery_location', 'Thorax'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Thorax', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Thorax', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.surgery_location', 'Spine and Spinal Cord'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Spine and Spinal Cord', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Spine and Spinal Cord', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.surgery_location', 'Upper Abdomen'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Upper Abdomen', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Upper Abdomen', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.surgery_location', 'Lower Abdomen'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Lower Abdomen', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Lower Abdomen', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.surgery_location', 'Perineum'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Perineum', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Perineum', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.surgery_location', 'Pelvis (Except Hip)'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Pelvis (Except Hip)', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Pelvis (Except Hip)', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.surgery_location', 'Upper Leg (Except Knee)'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Upper Leg (Except Knee)', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Upper Leg (Except Knee)', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.surgery_location', 'Knee and Popliteal Area'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Knee and Popliteal Area', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Knee and Popliteal Area', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.surgery_location', 'Lower Leg (Below Knee)'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Lower Leg (Below Knee)', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Lower Leg (Below Knee)', 'sell' => 0 ); } $data['products'] = ($products); $data['total_n'] = $total; return view('cnb/reports/location_v', $data); } else { return redirect()->route("n_report"); } } public function purpose() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $products = []; $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.purpose', 'Sole/Primary Anaesthetic'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'Sole/Primary Anaesthetic', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'Sole/Primary Anaesthetic', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.purpose', 'For Analgesia only'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $products[] = array( 'day' => 'For Analgesia only', 'sell' => floatval($row->count) ); } } else { $products[] = array( 'day' => 'For Analgesia only', 'sell' => 0 ); } $data['products'] = ($products); $data['total_n'] = $total; return view('cnb/reports/purpose_v', $data); } else { return redirect()->route("n_report"); } } public function consultant() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(id) as count"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total += floatval($row->count); } $data['total_n'] = $total; $builder = $db->table('cnb_patient_details'); $query = $builder->select("COUNT(id) as count, cnb_done_by2 as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('cnb_done_by2'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $products = []; foreach ($record as $row) { $products[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $builder = $db->table('cnb_patient_details'); $query = $builder->select("COUNT(id) as count, supervision as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('supervision'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $supervision = []; foreach ($record as $row) { $supervision[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } //$query = $db->getLastQuery(); //echo (string)$query; //print_r($products); $data['products'] = ($products); $data['supervision'] = ($supervision); $data['total'] = $total; //$query = $db->getLastQuery(); return view('cnb/reports/consultant_v', $data); } else { return redirect()->route("n_report"); } } public function patient_status() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $patient_position = []; $awake = 0; $sedation = 0; $ga = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.patient_status as patient_status"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->patient_status == 'Awake') { $awake = $awake + 1; } else if (substr($row->patient_status, 0, 8) == 'Sedation') { $sedation = $sedation + 1; } else if ($row->patient_status == 'GA') { $ga = $ga + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.patient_status as patient_status"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->patient_status == 'Awake') { $awake = $awake + 1; } else if (substr($row->patient_status, 0, 8) == 'Sedation') { $sedation = $sedation + 1; } else if ($row->patient_status == 'GA') { $ga = $ga + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.patient_status as patient_status"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->patient_status == 'Awake') { $awake = $awake + 1; } else if (substr($row->patient_status, 0, 8) == 'Sedation') { $sedation = $sedation + 1; } else if ($row->patient_status == 'GA') { $ga = $ga + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.patient_status as patient_status"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->patient_status == 'Awake') { $awake = $awake + 1; } else if (substr($row->patient_status, 0, 8) == 'Sedation') { $sedation = $sedation + 1; } else if ($row->patient_status == 'GA') { $ga = $ga + 1; } } } $patient_position[] = array( 'day' => 'Awake', 'sell' => $awake ); $patient_position[] = array( 'day' => 'Sedation', 'sell' => $sedation ); $patient_position[] = array( 'day' => 'GA', 'sell' => $ga ); //$query = $db->getLastQuery(); //echo (string)$query; //print_r($products); $data['products'] = ($patient_position); $data['patient_position'] = ($patient_position); $data['total'] = $total; $data['total_n'] = $total; //$query = $db->getLastQuery(); return view('cnb/reports/patient_status_v', $data); } else { return redirect()->route("n_report"); } } public function sterility_features() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $products = []; $other = []; $complete_aspesis = 0; $wearing_mask = 0; $hand_washing = 0; $sterile_gown = 0; $sterile_draping = 0; $Alcohol = 0; $Chlorhexidine = 0; $Betadine = 0; $Combinations = 0; $Other = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.wearing_mask,procedure_csa.hand_washing,procedure_csa.sterile_gown,procedure_csa.sterile_draping,procedure_csa.skin_prep"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->wearing_mask == 'Yes' && $row->hand_washing == 'Yes' && $row->sterile_gown == 'Yes' && $row->sterile_draping == 'Yes') { $complete_aspesis = $complete_aspesis + 1; } if ($row->wearing_mask == 'Yes') { $wearing_mask = $wearing_mask + 1; } if ($row->hand_washing == 'Yes') { $hand_washing = $hand_washing + 1; } if ($row->sterile_gown == 'Yes') { $sterile_gown = $sterile_gown + 1; } if ($row->sterile_draping == 'Yes') { $sterile_draping = $sterile_draping + 1; } if ($row->skin_prep == 'Alcohol') { $Alcohol = $Alcohol + 1; } else if ($row->skin_prep == 'Chlorhexidine') { $Chlorhexidine = $Chlorhexidine + 1; } else if ($row->skin_prep == 'Betadine') { $Betadine = $Betadine + 1; } else if ($row->skin_prep == 'Combinations') { $Combinations = $Combinations + 1; } else if (substr($row->skin_prep, 0, 4) == 'Other') { $Other = $Other + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.wearing_mask,procedure_spinal.hand_washing,procedure_spinal.sterile_gown,procedure_spinal.sterile_draping,procedure_spinal.skin_prepartion"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->wearing_mask == 'Yes' && $row->hand_washing == 'Yes' && $row->sterile_gown == 'Yes' && $row->sterile_draping == 'Yes') { $complete_aspesis = $complete_aspesis + 1; } if ($row->wearing_mask == 'Yes') { $wearing_mask = $wearing_mask + 1; } if ($row->hand_washing == 'Yes') { $hand_washing = $hand_washing + 1; } if ($row->sterile_gown == 'Yes') { $sterile_gown = $sterile_gown + 1; } if ($row->sterile_draping == 'Yes') { $sterile_draping = $sterile_draping + 1; } if ($row->skin_prepartion == 'Alcohol') { $Alcohol = $Alcohol + 1; } else if ($row->skin_prepartion == 'Chlorhexidine') { $Chlorhexidine = $Chlorhexidine + 1; } else if ($row->skin_prepartion == 'Betadine') { $Betadine = $Betadine + 1; } else if ($row->skin_prepartion == 'Combinations') { $Combinations = $Combinations + 1; } else if (substr($row->skin_prepartion, 0, 4) == 'Other') { $Other = $Other + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.wearing_mask,procedure_cse.hand_washing,procedure_cse.sterile_gown,procedure_cse.sterile_draping,procedure_cse.skin_prepartion"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->wearing_mask == 'Yes' && $row->hand_washing == 'Yes' && $row->sterile_gown == 'Yes' && $row->sterile_draping == 'Yes') { $complete_aspesis = $complete_aspesis + 1; } if ($row->wearing_mask == 'Yes') { $wearing_mask = $wearing_mask + 1; } if ($row->hand_washing == 'Yes') { $hand_washing = $hand_washing + 1; } if ($row->sterile_gown == 'Yes') { $sterile_gown = $sterile_gown + 1; } if ($row->sterile_draping == 'Yes') { $sterile_draping = $sterile_draping + 1; } if ($row->skin_prepartion == 'Alcohol') { $Alcohol = $Alcohol + 1; } else if ($row->skin_prepartion == 'Chlorhexidine') { $Chlorhexidine = $Chlorhexidine + 1; } else if ($row->skin_prepartion == 'Betadine') { $Betadine = $Betadine + 1; } else if ($row->skin_prepartion == 'Combinations') { $Combinations = $Combinations + 1; } else if (substr($row->skin_prepartion, 0, 4) == 'Other') { $Other = $Other + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.wearing_mask,procedure_epidural.hand_washing,procedure_epidural.sterile_gown,procedure_epidural.sterile_draping,procedure_epidural.skin_prepartion"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->wearing_mask == 'Yes' && $row->hand_washing == 'Yes' && $row->sterile_gown == 'Yes' && $row->sterile_draping == 'Yes') { $complete_aspesis = $complete_aspesis + 1; } if ($row->wearing_mask == 'Yes') { $wearing_mask = $wearing_mask + 1; } if ($row->hand_washing == 'Yes') { $hand_washing = $hand_washing + 1; } if ($row->sterile_gown == 'Yes') { $sterile_gown = $sterile_gown + 1; } if ($row->sterile_draping == 'Yes') { $sterile_draping = $sterile_draping + 1; } if ($row->skin_prepartion == 'Alcohol') { $Alcohol = $Alcohol + 1; } else if ($row->skin_prepartion == 'Chlorhexidine') { $Chlorhexidine = $Chlorhexidine + 1; } else if ($row->skin_prepartion == 'Betadine') { $Betadine = $Betadine + 1; } else if ($row->skin_prepartion == 'Combinations') { $Combinations = $Combinations + 1; } else if (substr($row->skin_prepartion, 0, 4) == 'Other') { $Other = $Other + 1; } } } $products[] = array( 'day' => 'Complete Aspesis', 'sell' => $complete_aspesis ); $products[] = array( 'day' => 'Wearing Cap & Mask', 'sell' => $wearing_mask ); $products[] = array( 'day' => 'Hand Washing', 'sell' => $hand_washing ); $products[] = array( 'day' => 'Sterile Gown', 'sell' => $sterile_gown ); $products[] = array( 'day' => 'Sterile Draping', 'sell' => $sterile_draping ); $other[] = array( 'day' => 'Alcohol', 'sell' => $Alcohol ); $other[] = array( 'day' => 'Chlorhexidine', 'sell' => $Chlorhexidine ); $other[] = array( 'day' => 'Betadine', 'sell' => $Betadine ); $other[] = array( 'day' => 'Combinations', 'sell' => $Combinations ); $other[] = array( 'day' => 'Other', 'sell' => $Other ); $data['products'] = ($products); $data['other'] = ($other); $data['total'] = $total; $data['total_n'] = $total; return view('cnb/reports/sterility_features_v', $data); } else { return redirect()->route("n_report"); } } public function anatomical() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); $dr_id = session()->get('dr_id'); $n = session()->get('n'); $n_type = gettype($n); if ($from_date && $to_date) { $total = session()->get('n'); $patient_position = []; $landmark1 = 0; $landmark2 = 0; $landmark3 = 0; $approach1 = 0; $approach2 = 0; $avg_csa = 0; $avg_cse = 0; $avg_spianl = 0; $avg_epidural = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.anatomical_landmark,procedure_csa.approach,procedure_csa.no_attempts"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); // $query = $builder->where('cnb_postop.dr_id ',$dr_id); $query = $builder->get(); if ($record) { foreach ($record as $row) { if ($row->anatomical_landmark == 'Easily Palpable') { $landmark1 = $landmark1 + 1; } else if ($row->anatomical_landmark == 'Poorly Palpable') { $landmark2 = $landmark2 + 1; } else if ($row->anatomical_landmark == 'Non-Palpable') { $landmark3 = $landmark3 + 1; } if ($row->approach == 'Midline') { $approach1 = $approach1 + 1; } else if ($row->approach == 'Paramedian') { $approach2 = $approach2 + 1; } if ((int) $row->no_attempts != '') { $avg_csa += $row->no_attempts; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.anatomical_landmark,procedure_cse.approach,procedure_cse.no_attempts"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); //$query = $builder->where('cnb_postop.dr_id ',$dr_id); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->anatomical_landmark == 'Easily Palpable') { $landmark1 = $landmark1 + 1; } else if ($row->anatomical_landmark == 'Poorly Palpable') { $landmark2 = $landmark2 + 1; } else if ($row->anatomical_landmark == 'Non-Palpable') { $landmark3 = $landmark3 + 1; } if ($row->approach == 'Midline') { $approach1 = $approach1 + 1; } else if ($row->approach == 'Paramedian') { $approach2 = $approach2 + 1; } if ((int) $row->no_attempts != '') { $avg_cse += $row->no_attempts; } // $avg_cse += $row->no_attempts; } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.anatomical_landmark,procedure_spinal.approach,procedure_spinal.no_attempts"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); //$query = $builder->where('cnb_postop.dr_id ',$dr_id); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { // echo $row->anatomical_landmark; if ($row->anatomical_landmark == 'Easily Palpable') { $landmark1 = $landmark1 + 1; } else if ($row->anatomical_landmark == 'Poorly Palpable') { $landmark2 = $landmark2 + 1; } else if ($row->anatomical_landmark == 'Non-Palpable') { $landmark3 = $landmark3 + 1; } if ($row->approach == 'Midline') { $approach1 = $approach1 + 1; } else if ($row->approach == 'Paramedian') { $approach2 = $approach2 + 1; } if ((int) $row->no_attempts != '') { $avg_spinal += $row->no_attempts; } // $avg_spinal += $row->no_attempts; } } // $db = \Config\Database::connect(); // $query = $db->getLastQuery(); // echo $query; // die(); $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.anatomical_landmark,procedure_epidural.approach,procedure_epidural.no_attempts"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); //$query = $builder->where('cnb_postop.dr_id ',$dr_id); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->anatomical_landmark == 'Easily Palpable') { $landmark1 = $landmark1 + 1; } else if ($row->anatomical_landmark == 'Poorly Palpable') { $landmark2 = $landmark2 + 1; } else if ($row->anatomical_landmark == 'Non-Palpable') { $landmark3 = $landmark3 + 1; } if ($row->approach == 'Midline') { $approach1 = $approach1 + 1; } else if ($row->approach == 'Paramedian') { $approach2 = $approach2 + 1; } if ((int) $row->no_attempts != '') { $avg_epidural += $row->no_attempts; } // $avg_epidural += $row->no_attempts; } } $products[] = array( 'day' => 'Easily Palpable', 'sell' => $landmark1 ); $products[] = array( 'day' => 'Poorly Palpable', 'sell' => $landmark2 ); $products[] = array( 'day' => 'Non-Palpable', 'sell' => $landmark3 ); $approach[] = array( 'day' => 'Midline', 'sell' => $approach1 ); $approach[] = array( 'day' => 'Paramedian', 'sell' => $approach2 ); $attempts[] = array( 'day' => 'Combined Spinal Epidural', 'sell' => $avg_cse ); $attempts[] = array( 'day' => 'Epidural alone', 'sell' => $avg_epidural ); $attempts[] = array( 'day' => 'Spinal alone', 'sell' => $avg_spinal ); $attempts[] = array( 'day' => 'CSA - Continuous SpinalAnaesthesia', 'sell' => $avg_csa ); //$query = $db->getLastQuery(); //echo (string)$query; //print_r($products); $data['products'] = ($products); $data['approach'] = ($approach); $data['attempts'] = ($attempts); $data['total'] = $landmark1 + $landmark2 + $landmark3; $data['total_n'] = $landmark1 + $landmark2 + $landmark3; //$query = $db->getLastQuery(); return view('cnb/reports/anatomical_v', $data); } else { return redirect()->route("n_report"); } } public function ultra_sound() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $yes = 0; $no = 0; $poor = 0; $avg = 0; $good = 0; $total_num = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.ultra_sound as ultrasound,procedure_csa.image_quality"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); // $query = $db->getLastQuery(); // echo $query; if ($record) { foreach ($record as $row) { if ($row->ultrasound == 'Yes') { $yes = $yes + 1; $total_num = $total_num + 1; } else if ($row->ultrasound == 'No') { $no = $no + 1; $total_num = $total_num + 1; } if ($row->image_quality == 'Poor') { $poor = $poor + 1; } else if ($row->image_quality == 'Good') { $good = $good + 1; } else if ($row->image_quality == 'Average') { $avg = $avg + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.ultrasound,procedure_cse.image_quality"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->ultrasound == 'Yes') { $yes = $yes + 1; $total_num = $total_num + 1; } else if ($row->ultrasound == 'No') { $no = $no + 1; $total_num = $total_num + 1; } if ($row->image_quality == 'Poor') { $poor = $poor + 1; } else if ($row->image_quality == 'Good') { $good = $good + 1; } else if ($row->image_quality == 'Average') { $avg = $avg + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.ultra_sound,procedure_spinal.image_quality"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); // $db = \Config\Database::connect(); // $query = $db->getLastQuery(); // echo $query; if ($record) { foreach ($record as $row) { // echo $row->ultra_sound; if ($row->ultra_sound == 'Yes') { $yes = $yes + 1; $total_num = $total_num + 1; } else if ($row->ultra_sound == 'No') { $no = $no + 1; // echo 'no'; $total_num = $total_num + 1; } if ($row->image_quality == 'Poor') { $poor = $poor + 1; } else if ($row->image_quality == 'Good') { $good = $good + 1; } else if ($row->image_quality == 'Average') { $avg = $avg + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.ultrasound,procedure_epidural.image_quality"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->ultrasound == 'Yes') { $yes = $yes + 1; $total_num = $total_num + 1; } else if ($row->ultrasound == 'No') { $no = $no + 1; $total_num = $total_num + 1; } if ($row->image_quality == 'Poor') { $poor = $poor + 1; } else if ($row->image_quality == 'Good') { $good = $good + 1; } else if ($row->image_quality == 'Average') { $avg = $avg + 1; } } } $products[] = array( 'day' => 'Yes', 'sell' => $yes ); $products[] = array( 'day' => 'No', 'sell' => $no ); $image_quality[] = array( 'day' => 'Poor', 'sell' => $poor ); $image_quality[] = array( 'day' => 'Average', 'sell' => $avg ); $image_quality[] = array( 'day' => 'Good', 'sell' => $good ); $data['products'] = ($products); $data['image_quality'] = ($image_quality); $data['total_n'] = $total_num; $data['i_total_n'] = $poor + $avg + $good; //echo $total_num; //die(); //$query = $db->getLastQuery(); return view('cnb/reports/ultra_sound_v', $data); } else { return redirect()->route("n_report"); } } public function needle_brand() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $products = []; $needle_brand = 0; $B_Braun = 0; $Vygon = 0; $Polymed = 0; $Portex = 0; $Top = 0; $BD = 0; $Pajunk = 0; $Romsons = 0; $Other = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.needle_brand"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->needle_brand == 'B-Braun') { $B_Braun = $B_Braun + 1; } else if ($row->needle_brand == 'Vygon') { $Vygon = $Vygon + 1; } else if ($row->needle_brand == 'Polymed') { $Polymed = $Polymed + 1; } else if ($row->needle_brand == 'Portex') { $Portex = $Portex + 1; } else if ($row->needle_brand == 'Top') { $Top = $Top + 1; } else if ($row->needle_brand == 'BD') { $BD = $BD + 1; } else if ($row->needle_brand == 'Pajunk') { $Pajunk = $Pajunk + 1; } else if ($row->needle_brand == 'Romsons') { $Romsons = $Romsons + 1; } else if (substr($row->needle_brand, 0, 4) == 'Other') { $Other = $Other + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.needle_brand"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->needle_brand == 'B-Braun') { $B_Braun = $B_Braun + 1; } else if ($row->needle_brand == 'Vygon') { $Vygon = $Vygon + 1; } else if ($row->needle_brand == 'Polymed') { $Polymed = $Polymed + 1; } else if ($row->needle_brand == 'Portex') { $Portex = $Portex + 1; } else if ($row->needle_brand == 'Top') { $Top = $Top + 1; } else if ($row->needle_brand == 'BD') { $BD = $BD + 1; } else if ($row->needle_brand == 'Pajunk') { $Pajunk = $Pajunk + 1; } else if ($row->needle_brand == 'Romsons') { $Romsons = $Romsons + 1; } else if (substr($row->needle_brand, 0, 4) == 'Other') { $Other = $Other + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.needle_brand"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->needle_brand == 'B-Braun') { $B_Braun = $B_Braun + 1; } else if ($row->needle_brand == 'Vygon') { $Vygon = $Vygon + 1; } else if ($row->needle_brand == 'Polymed') { $Polymed = $Polymed + 1; } else if ($row->needle_brand == 'Portex') { $Portex = $Portex + 1; } else if ($row->needle_brand == 'Top') { $Top = $Top + 1; } else if ($row->needle_brand == 'BD') { $BD = $BD + 1; } else if ($row->needle_brand == 'Pajunk') { $Pajunk = $Pajunk + 1; } else if ($row->needle_brand == 'Romsons') { $Romsons = $Romsons + 1; } else if (substr($row->needle_brand, 0, 4) == 'Other') { $Other = $Other + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.needle_brand"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->needle_brand == 'B-Braun') { $B_Braun = $B_Braun + 1; } else if ($row->needle_brand == 'Vygon') { $Vygon = $Vygon + 1; } else if ($row->needle_brand == 'Polymed') { $Polymed = $Polymed + 1; } else if ($row->needle_brand == 'Portex') { $Portex = $Portex + 1; } else if ($row->needle_brand == 'Top') { $Top = $Top + 1; } else if ($row->needle_brand == 'BD') { $BD = $BD + 1; } else if ($row->needle_brand == 'Pajunk') { $Pajunk = $Pajunk + 1; } else if ($row->needle_brand == 'Romsons') { $Romsons = $Romsons + 1; } else if (substr($row->needle_brand, 0, 4) == 'Other') { $Other = $Other + 1; } } } $products[] = array( 'day' => 'B-Braun', 'sell' => $B_Braun ); $products[] = array( 'day' => 'Vygon', 'sell' => $Vygon ); $products[] = array( 'day' => 'Polymed', 'sell' => $Polymed ); $products[] = array( 'day' => 'Portex', 'sell' => $Portex ); $products[] = array( 'day' => 'Top', 'sell' => $Top ); $products[] = array( 'day' => 'BD', 'sell' => $BD ); $products[] = array( 'day' => 'Pajunk', 'sell' => $Pajunk ); $products[] = array( 'day' => 'Romsons', 'sell' => $Romsons ); $products[] = array( 'day' => 'Other', 'sell' => $Other ); $data['products'] = ($products); $data['total'] = $B_Braun + $Vygon + $Polymed + $Portex + $Top + $BD + $Pajunk + $Romsons + $Other; $data['total_n'] = $B_Braun + $Vygon + $Polymed + $Portex + $Top + $BD + $Pajunk + $Romsons + $Other; return view('cnb/reports/needle_brand_v', $data); } else { return redirect()->route("n_report"); } } public function cse_technique() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $total_rows = 0; $products = []; $single = 0; $double = 0; $dpe = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.cse_technique as cse_technique"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $total_rows = $total_rows + 1; if ($row->cse_technique == 'Single Interspace Technique (Needle through Needle)') { $single = $single + 1; } else if ($row->cse_technique == 'Double Interspace Technique') { $double = $double + 1; } else if ($row->cse_technique == 'DPE:Dural Puncture Epidural Technique') { $dpe = $dpe + 1; } } } $products[] = array( 'day' => 'Single Interspace Technique (Needle through Needle)', 'sell' => $single ); $products[] = array( 'day' => 'Double Interspace Technique', 'sell' => $double ); $products[] = array( 'day' => 'DPE:Dural Puncture Epidural Technique', 'sell' => $dpe ); $data['products'] = ($products); $data['total_n'] = $total_rows; $data['total'] = $total_rows; return view('cnb/reports/cse_technique_v', $data); } else { return redirect()->route("n_report"); } } public function csa_technique() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $products = []; $total_rows = 0; $intentional = 0; $accidental = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.csa as csa"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $total_rows = $total_rows + 1; if ($row->csa == 'Intentional') { $intentional = $intentional + 1; } else if ($row->csa == 'Accidental') { $accidental = $accidental + 1; } } } $products[] = array( 'day' => 'Accidental', 'sell' => $accidental ); $products[] = array( 'day' => 'Intentional', 'sell' => $intentional ); $data['products'] = ($products); $data['total_n'] = $total_rows; $data['total'] = $total_rows; $data['products'] = ($products); return view('cnb/reports/csa_technique_v', $data); } else { return redirect()->route("n_report"); } } public function stay_duration() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); $dr_id = session()->get('dr_id'); if ($from_date && $to_date) { $total = 0; $builder = $db->table('cnb_followup'); $query = $builder->select("duration"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_followup.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_followup.patient_id'); $query = $builder->where('procedure_csa.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_csa.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('duration!=', ''); $query = $builder->get(); $record = $query->getResult(); $csa_arr =[]; // print_r($record);die(); foreach ($record as $row) { if($row->duration == ''){ array_push($csa_arr,0); }else{ array_push($csa_arr,$row->duration); } } if($record){ $total += 1; $csa_mean = array_sum($csa_arr) / count($csa_arr); $csa_sum_of_squared_differences = 0; foreach ($csa_arr as $number) { $difference = $number - $csa_mean; $csa_sum_of_squared_differences += $difference * $difference; } $csa_standard_deviation = sqrt($csa_sum_of_squared_differences / count($csa_arr)); }else{ $csa_mean = 0; $csa_sum_of_squared_differences = 0; } $builder = $db->table('cnb_followup'); $query = $builder->select("duration"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_followup.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_followup.patient_id'); $query = $builder->where('procedure_epidural.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_epidural.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('duration!=', ''); $query = $builder->get(); $record = $query->getResult(); $epidural_arr =[]; foreach ($record as $row) { if($row->duration == ''){ array_push($epidural_arr,0); }else{ array_push($epidural_arr,$row->duration); } } if($record){ $total += 1; $epidural_mean = array_sum($epidural_arr) / count($epidural_arr); $epidural_sum_of_squared_differences = 0; foreach ($epidural_arr as $number) { $difference = $number - $epidural_mean; $epidural_sum_of_squared_differences += $difference * $difference; } $epidural_standard_deviation = sqrt($epidural_sum_of_squared_differences / count($epidural_arr)); }else{ $epidural_mean = 0; $epidural_standard_deviation = 0; } $builder = $db->table('cnb_followup'); $query = $builder->select("duration"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_followup.patient_id','left'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_followup.patient_id' ); $query = $builder->where('procedure_spinal.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_spinal.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('duration !=', ''); $query = $builder->get(); $record = $query->getResult(); $spinal_arr =[]; foreach ($record as $row) { if($row->duration == ''){ array_push($spinal_arr,0); }else{ array_push($spinal_arr,$row->duration); } } if($record){ $total += 1; $spinal_mean = array_sum($spinal_arr) / count($spinal_arr); $spinal_sum_of_squared_differences = 0; foreach ($spinal_arr as $number) { $difference = $number - $spinal_mean; $spinal_sum_of_squared_differences += $difference * $difference; } $spinal_standard_deviation = sqrt($spinal_sum_of_squared_differences / count($spinal_arr)); }else{ $spinal_mean = 0; $spinal_standard_deviation = 0; } $builder = $db->table('cnb_followup'); $query = $builder->select("duration"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_followup.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_followup.patient_id'); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('duration!=', ''); $query = $builder->get(); $record = $query->getResult(); $cse_arr =[]; foreach ($record as $row) { if($row->duration == ''){ array_push($cse_arr,0); }else{ array_push($cse_arr,$row->duration); } } if($record){ $total += 1; $cse_mean = array_sum($cse_arr) / count($cse_arr); $cse_sum_of_squared_differences = 0; foreach ($cse_arr as $number) { $difference = $number - $cse_mean; $cse_sum_of_squared_differences += $difference * $difference; } $cse_standard_deviation = sqrt($cse_sum_of_squared_differences / count($cse_arr)); }else{ $cse_mean = 0; $cse_standard_deviation = 0; } // ----------------------------------ALL PRODECURE------------------------ if($total > 0){ $all_arr = array_merge($cse_arr,$spinal_arr,$epidural_arr,$csa_arr); $all_mean = array_sum($all_arr) / count($all_arr); $all_sum_of_squared_differences = 0; foreach ($all_arr as $number) { $difference = $number - $all_mean; $all_sum_of_squared_differences += $difference * $difference; } $all_standard_deviation = sqrt($all_sum_of_squared_differences / count($all_arr)); }else{ $all_mean = 0; $all_standard_deviation = 0; $all_arr=[]; }; $duration[] = array( 'day' => 'All procedures', 'sell' => "(" .number_format((float) $all_mean, 2, '.', '') . "±" . number_format((float) $all_standard_deviation, 2, '.', '') . ")", 'total'=> count($all_arr) ); $duration[] = array( 'day' => 'CSE', 'sell' => "(" .number_format((float) $cse_mean, 2, '.', '') . "±" . number_format((float) $cse_standard_deviation, 2, '.', '') . ")", 'total'=> count($cse_arr) ); $duration[] = array( 'day' => 'Epidural', 'sell' => "(" . number_format((float) $epidural_mean, 2, '.', '') . "±" . number_format((float) $epidural_standard_deviation, 2, '.', '') . ")", 'total'=> count($epidural_arr) ); $duration[] = array( 'day' => 'Spinal', 'sell' => "(" . number_format((float) $spinal_mean, 2, '.', '') . "±" . number_format((float) $spinal_standard_deviation, 2, '.', '') . ")", 'total'=> count($spinal_arr) ); $duration[] = array( 'day' => 'CSA', 'sell' => "(" . number_format((float) $csa_mean, 2, '.', '') . "±" . number_format((float) $csa_standard_deviation, 2, '.', '') . ")", 'total'=> count($csa_arr) ); $data['total2'] = $duration; $data['total'] = $total; return view('cnb/reports/stay_duration_v', $data); } else { return redirect()->route("n_report"); } } public function stay_duration_feb() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); $dr_id = session()->get('dr_id'); if ($from_date && $to_date) { $total_du = 0; $builder = $db->table('cnb_followup'); $query = $builder->select("cnb_followup.duration as du"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_followup.patient_id'); $query = $builder->where('cnb_followup.created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_followup.created_at <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total_du = $total_du + 1; } $total_csa = 0; $total_cse = 0; $total_spinal = 0; $total_epidural = 0; $count_csa = 0; $count_cse = 0; $count_spinal = 0; $count_epidural = 0; $builder = $db->table('cnb_followup'); $query = $builder->select("COUNT(cnb_followup.id) as count,STDDEV(cnb_followup.duration) as std,AVG(cnb_followup.duration) as avg,duration"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_followup.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_followup.patient_id'); $query = $builder->where('procedure_csa.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_csa.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('duration!=', ''); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { if ($row->duration > 0) { $total_csa += $row->duration; $count_csa = $count_csa + 1; } $total1 += floatval($row->count); $csa_total_std = floatval($row->std); $csa_total_avg = floatval($row->avg); } $builder = $db->table('cnb_followup'); $query = $builder->select("COUNT(cnb_followup.id) as count,STDDEV(cnb_followup.duration) as std,AVG(cnb_followup.duration) as avg,duration"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_followup.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_followup.patient_id'); $query = $builder->where('procedure_epidural.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_epidural.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('duration!=', ''); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { if ($row->duration > 0) { $total_epidural += $row->duration; $count_epidural = $count_epidural + 1; } $total2 += floatval($row->count); $epidural_total_std = floatval($row->std); $epidural_total_avg = floatval($row->avg); } $builder = $db->table('cnb_followup'); $query = $builder->select("COUNT(cnb_followup.id) as count,STDDEV(cnb_followup.duration) as std,AVG(cnb_followup.duration) as avg,duration"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_followup.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_followup.patient_id'); $query = $builder->where('procedure_spinal.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_spinal.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('duration !=', ''); $query = $builder->get(); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { if ($row->duration > 0) { $total_spinal += $row->duration; $count_spinal = $count_spinal + 1; } $total3 += floatval($row->count); $spinal_total_std = floatval($row->std); $spinal_total_avg = floatval($row->avg); } $builder = $db->table('cnb_followup'); $query = $builder->select("COUNT(cnb_followup.id) as count,STDDEV(cnb_followup.duration) as std,AVG(cnb_followup.duration) as avg,duration"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_followup.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_followup.patient_id'); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('duration!=', ''); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { if ($row->duration > 0) { $total_cse += $row->duration; $count_cse = $count_cse + 1; } $total4 += floatval($row->count); $cse_total_std = floatval($row->std); $cse_total_avg = floatval($row->avg); } $duration = []; $t_std = $csa_total_std + $epidural_total_std + $spinal_total_std + $cse_total_std; $t_avg = $csa_total_avg + $epidural_total_avg + $spinal_total_avg + $cse_total_avg; $t_std = number_format((float) $t_std, 2, '.', ''); $csa_total_std = number_format((float) $csa_total_std, 2, '.', ''); $epidural_total_std = number_format((float) $epidural_total_std, 2, '.', ''); $spinal_total_std = number_format((float) $spinal_total_std, 2, '.', ''); $cse_total_std = number_format((float) $cse_total_std, 2, '.', ''); $t_avg = number_format((float) $t_avg, 2, '.', ''); $csa_total_avg = number_format((float) $csa_total_avg, 2, '.', ''); $epidural_total_avg = number_format((float) $epidural_total_avg, 2, '.', ''); $spinal_total_avg = number_format((float) $spinal_total_avg, 2, '.', ''); $cse_total_avg = number_format((float) $cse_total_avg, 2, '.', ''); $duration[] = array( 'day' => 'All Procedure', 'sell' => "(" . $t_std . "±" . $t_avg . ")" ); $duration[] = array( 'day' => 'CSE', 'sell' => "(" . $cse_total_std . "±" . $cse_total_avg . ")" ); $duration[] = array( 'day' => 'Epidural', 'sell' => "(" . $epidural_total_std . "±" . $epidural_total_avg . ")" ); $duration[] = array( 'day' => 'Spinal', 'sell' => "(" . $spinal_total_std . "±" . $spinal_total_avg . ")" ); $duration[] = array( 'day' => 'CSA', 'sell' => "(" . $csa_total_std . "±" . $csa_total_avg . ")" ); $duration1[] = array( 'day' => 'CSE', 'sum' => $total_cse, 'count'=> $count_cse ); $duration1[] = array( 'day' => 'Epidural', 'sum' => $total_epidural, 'count'=> $count_epidural ); $duration1[] = array( 'day' => 'Spinal', 'sum' => $total_spinal, 'count'=> $count_spinal ); $duration1[] = array( 'day' => 'CSA', 'sum' => $total_csa, 'count'=> $count_csa ); $data['total2'] = $duration1; // print_r("hello");die(); $data['total'] = $total1 + $total2 + $total3 + $total4; return view('cnb/reports/stay_duration_v', $data); } else { return redirect()->route("n_report"); } } public function stay_duration_old() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('cnb_followup'); $query = $builder->select("COUNT(id) as count"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record = $query->getResult(); $total = 0; $id = []; foreach ($record as $row) { $total += floatval($row->count); } $data['total_n'] = $total; $builder = $db->table('cnb_followup'); $query = $builder->select("COUNT(id) as count, duration as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('duration'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $products = []; foreach ($record as $row) { $products[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['total'] = $total; // print_r($data);die(); return view('cnb/reports/stay_duration_v', $data); } else { return redirect()->route("n_report"); } } //3.1 started // public function Procedure_Outcomes() { // $db = \Config\Database::connect(); // return view('cnb/reports/Procedure_Outcomes_v', $data); // } public function technical_problems() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $none = 0; $equipment = 0; $multipal = 0; $second = 0; $technique = 0; $catheter = 0; $failure = 0; $others = 0; // ------------------------------SPINAL------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.tc_equipment, procedure_spinal.tc_multiple, procedure_spinal.tc_2_anaestsetist, procedure_spinal.tc_abondoned,procedure_spinal.tc_other,"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->tc_equipment == 'Yes') { $equipment = $equipment + 1; } if ($row->tc_2_anaestsetist == 'Yes') { $second = $second + 1; } if ($row->tc_abondoned == 'Yes') { $technique = $technique + 1; } if ($row->tc_multiple == 'Yes') { $multipal = $multipal + 1; } if ($row->tc_other == 'Yes') { $others = $others + 1; } if ($row->tc_equipment != 'Yes' && $row->tc_2_anaestsetist != 'Yes' && $row->tc_abondoned != 'Yes' && $row->tc_multiple != 'Yes' && $row->tc_other != 'Yes') { $none = $none + 1; } } } // ------------------------------EPIDURAL------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.tc_equipment, procedure_epidural.tc_multiple, procedure_epidural.tc_2_anaestsetist, procedure_epidural.tc_abondoned,procedure_epidural.tc_catheter,procedure_epidural.tc_other,"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->tc_equipment == 'Yes') { $equipment = $equipment + 1; } if ($row->tc_2_anaestsetist == 'Yes') { $second = $second + 1; } if ($row->tc_abondoned == 'Yes') { $technique = $technique + 1; } if ($row->tc_multiple == 'Yes') { $multipal = $multipal + 1; } if ($row->tc_catheter == 'Yes') { $catheter = $catheter + 1; } if ($row->tc_other == 'Yes') { $others = $others + 1; } if ($row->tc_equipment != 'Yes' && $row->tc_2_anaestsetist != 'Yes' && $row->tc_abondoned != 'Yes' && $row->tc_multiple != 'Yes' && $row->tc_catheter != 'Yes' && $row->tc_other != 'Yes') { $none = $none + 1; } } } // ------------------------------CSA------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.tc_equipment, procedure_csa.tc_multiple_attempts, procedure_csa.tc_2_anaesthetist, procedure_csa.tc_failure_space,procedure_csa.tc_catheter_related,procedure_csa.tc_other"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->tc_equipment == 'Yes') { $equipment = $equipment + 1; } if ($row->tc_2_anaestsetist == 'Yes') { $second = $second + 1; } if ($row->tc_failure_space == 'Yes') { $technique = $technique + 1; } if ($row->tc_multiple_attempts == 'Yes') { $multipal = $multipal + 1; } if ($row->tc_catheter_related == 'Yes') { $catheter = $catheter + 1; } if ($row->tc_other == 'Yes') { $others = $others + 1; } if ($row->tc_equipment != 'Yes' && $row->tc_2_anaestsetist != 'Yes' && $row->tc_failure_space != 'Yes' && $row->tc_multiple_attempts != 'Yes' && $row->tc_catheter_related != 'Yes' && $row->tc_other != 'Yes') { $none = $none + 1; } } } // ------------------------------CSE------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.tc_equipment, procedure_cse.tc_multiple_attempts, procedure_cse.tc_2nd_anaesthetist, procedure_cse.tc_failure_space,procedure_cse.tc_catheter_related,procedure_cse.tc_other"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); // print_r($record);die(); if ($record) { foreach ($record as $row) { if ($row->tc_equipment == 'Yes') { $equipment = $equipment + 1; } if ($row->tc_2nd_anaesthetist == 'Yes') { $second = $second + 1; } if ($row->tc_failure_space == 'Yes') { $technique = $technique + 1; } if ($row->tc_multiple_attempts == 'Yes') { $multipal = $multipal + 1; } if ($row->tc_catheter_related == 'Yes') { $catheter = $catheter + 1; } if ($row->tc_other == 'Yes') { $others = $others + 1; } if ($row->tc_equipment != 'Yes' && $row->tc_2nd_anaesthetist != 'Yes' && $row->tc_failure_space != 'Yes' && $row->tc_multiple_attempts != 'Yes' && $row->tc_catheter_related != 'Yes' && $row->tc_other != 'Yes') { $none = $none + 1; } } } $total = session()->get('n'); $no = 0; $no = $total - $equipment + $multipal + $second + $technique + $catheter + $failure + $others; // $products[] = array( // 'day' => 'None', // 'sell' => $none, // 'perc' => number_format((float)(($none/$total)*100), 1, '.', '')."%", // ); $products[] = array( 'day' => 'None', 'sell' => $none, // 'perc' => number_format((float)(($none/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Equipment related', 'sell' => $equipment, // 'perc' => number_format((float)(($equipment/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Multiple Attempts', 'sell' => $multipal, // 'perc' => number_format((float)(($multipal/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Second Anaesthetist', 'sell' => $second, // 'perc' => number_format((float)(($second/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Technique Abandoned/failure to find space', 'sell' => $technique, // 'perc' => number_format((float)(($technique/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Catheter Related', 'sell' => $catheter, // 'perc' => number_format((float)(($catheter/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Failure of spinal component of CSE', 'sell' => $failure, // 'perc' => number_format((float)(($failure/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Other', 'sell' => $others, // 'perc' => number_format((float)(($others/$total)*100), 1, '.', '')."%", ); // print_r($none); // print_r("<br>"); // print_r($equipment); // print_r("<br>"); // print_r($multipal); // print_r("<br>"); // print_r($second); // print_r("<br>"); // print_r($technique); // print_r("<br>"); // print_r($catheter); // print_r("<br>"); // print_r($failure); // print_r("<br>"); // print_r($products); // print_r("<br>"); // die(); $data['products'] = $products; $data['total'] = $total; return view('cnb/reports/technical-problems_v', $data); } else { return redirect()->route("n_report"); } } public function acute_problems() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $none = 0; $epidural = 0; $last = 0; $respiratory = 0; $cardiac = 0; $radicular = 0; $paresthesia = 0; $bloody = 0; $wettap = 0; $hypotension = 0; $nausea = 0; $vomiting = 0; $subdural = 0; $high = 0; $intrathecal = 0; $totalSpinal = 0; $accidental = 0; $others = 0; // ------------------------------SPINAL------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.ac_re_arrest, procedure_spinal.ac_ca_arrest, procedure_spinal.ac_radi_pain, procedure_spinal.ac_parestsesia,procedure_spinal.ac_bloody_tap,procedure_spinal.ac_hypoten,procedure_spinal.ac_nausea,procedure_spinal.ac_vomit,procedure_spinal.ac_high_block,procedure_spinal.ac_sb_block,procedure_spinal.ac_totla_spinal,procedure_spinal.ac_other,procedure_spinal.ac_none,"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->ac_re_arrest == 'Yes') { $respiratory = $respiratory + 1; } if ($row->ac_ca_arrest == 'Yes') { $cardiac = $cardiac + 1; } if ($row->ac_radi_pain == 'Yes') { $radicular = $radicular + 1; } if ($row->ac_parestsesia == 'Yes') { $paresthesia = $paresthesia + 1; } if ($row->ac_bloody_tap == 'Yes') { $bloody = $bloody + 1; } if ($row->ac_hypoten == 'Yes') { $hypotension = $hypotension + 1; } if ($row->ac_nausea == 'Yes') { $nausea = $nausea + 1; } if ($row->ac_vomit == 'Yes') { $vomiting = $vomiting + 1; } if ($row->ac_high_block == 'Yes') { $high = $high + 1; } if ($row->ac_sb_block == 'Yes') { $subdural = $subdural + 1; } if ($row->ac_totla_spinal == 'Yes') { $totalSpinal = $totalSpinal + 1; } if ($row->ac_other == 'Yes') { $others = $others + 1; } if ($row->ac_none == 'No') { $none = $none + 1; } } } // ------------------------------CSA------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.ac_last, procedure_csa.ac_respiratory_arrest, procedure_csa.ac_cardiac_arrest, procedure_csa.ac_radicular_pain,procedure_csa.ac_paresthesia_pain,procedure_csa.ac_bloody_tap,procedure_csa.ac_hypotension,procedure_csa.ac_nausea,procedure_csa.ac_vomiting,procedure_csa.ac_high_block,procedure_csa.ac_subdural_block,procedure_csa.ac_total_spinal,procedure_csa.ac_other,procedure_csa.ac_none"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->ac_last == 'Yes') { $last = $last + 1; } if ($row->ac_respiratory_arrest == 'Yes') { $respiratory = $respiratory + 1; } if ($row->ac_cardiac_arrest == 'Yes') { $cardiac = $cardiac + 1; } if ($row->ac_radicular_pain == 'Yes') { $radicular = $radicular + 1; } if ($row->ac_paresthesia_pain == 'Yes') { $paresthesia = $paresthesia + 1; } if ($row->ac_bloody_tap == 'Yes') { $bloody = $bloody + 1; } if ($row->ac_hypotension == 'Yes') { $hypotension = $hypotension + 1; } if ($row->ac_nausea == 'Yes') { $nausea = $nausea + 1; } if ($row->ac_vomiting == 'Yes') { $vomiting = $vomiting + 1; } if ($row->ac_high_block == 'Yes') { $high = $high + 1; } if ($row->ac_subdural_block == 'Yes') { $subdural = $subdural + 1; } if ($row->ac_total_spinal == 'Yes') { $totalSpinal = $totalSpinal + 1; } if ($row->ac_other == 'Yes') { $others = $others + 1; } if ($row->ac_none == 'No') { $none = $none + 1; } } } // ------------------------------EPIDURAL------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.ac_last, procedure_epidural.ac_re_arrest, procedure_epidural.ac_ca_arrest, procedure_epidural.ac_radi_pain,procedure_epidural.ac_parestsesia,procedure_epidural.ac_bloody_tap,procedure_epidural.ac_intra_cath,procedure_epidural.ac_hypoten,procedure_epidural.ac_nausea,procedure_epidural.ac_vomit,procedure_epidural.ac_high_block,procedure_epidural.ac_sb_block,procedure_epidural.ac_totla_spinal,procedure_epidural.ac_other,procedure_epidural.ac_none"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->ac_last == 'Yes') { $last = $last + 1; } if ($row->ac_re_arrest == 'Yes') { $respiratory = $respiratory + 1; } if ($row->ac_ca_arrest == 'Yes') { $cardiac = $cardiac + 1; } if ($row->ac_radi_pain == 'Yes') { $radicular = $radicular + 1; } if ($row->ac_parestsesia == 'Yes') { $paresthesia = $paresthesia + 1; } if ($row->ac_bloody_tap == 'Yes') { $bloody = $bloody + 1; } if ($row->ac_hypoten == 'Yes') { $hypotension = $hypotension + 1; } if ($row->ac_nausea == 'Yes') { $nausea = $nausea + 1; } if ($row->ac_vomit == 'Yes') { $vomiting = $vomiting + 1; } if ($row->ac_high_block == 'Yes') { $high = $high + 1; } if ($row->ac_sb_block == 'Yes') { $subdural = $subdural + 1; } if ($row->ac_totla_spinal == 'Yes') { $totalSpinal = $totalSpinal + 1; } if ($row->ac_other == 'Yes') { $others = $others + 1; } if ($row->ac_intra_cath == 'Yes') { $intrathecal = $intrathecal + 1; } if ($row->ac_none == 'No') { $none = $none + 1; } } } // ------------------------------CSE------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.ac_epidural_resited, procedure_cse.ac_local_anaesthetic, procedure_cse.ac_respiratory_arrest, procedure_cse.ac_cardiac_arrest, procedure_cse.ac_radicular_pain,procedure_cse.ac_paresthesia_pain,procedure_cse.ac_bloody_tap,procedure_cse.ac_hypotension,procedure_cse.ac_nausea,procedure_cse.ac_vomiting,procedure_cse.ac_high_block,procedure_cse.ac_subdural_block,procedure_cse.ac_tatal_spinal,procedure_cse.ac_other,procedure_cse.ac_none,procedure_cse.ac_intrathecal_epi_catheter"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->ac_epidural_resited == 'Yes') { $epidural = $epidural + 1; } if ($row->ac_local_anaesthetic == 'Yes') { $last = $last + 1; } if ($row->ac_respiratory_arrest == 'Yes') { $respiratory = $respiratory + 1; } if ($row->ac_cardiac_arrest == 'Yes') { $cardiac = $cardiac + 1; } if ($row->ac_radicular_pain == 'Yes') { $radicular = $radicular + 1; } if ($row->ac_paresthesia_pain == 'Yes') { $paresthesia = $paresthesia + 1; } if ($row->ac_bloody_tap == 'Yes') { $bloody = $bloody + 1; } if ($row->ac_hypotension == 'Yes') { $hypotension = $hypotension + 1; } if ($row->ac_nausea == 'Yes') { $nausea = $nausea + 1; } if ($row->ac_vomiting == 'Yes') { $vomiting = $vomiting + 1; } if ($row->ac_high_block == 'Yes') { $high = $high + 1; } if ($row->ac_subdural_block == 'Yes') { $subdural = $subdural + 1; } if ($row->ac_tatal_spinal == 'Yes') { $totalSpinal = $totalSpinal + 1; } if ($row->ac_other == 'Yes') { $others = $others + 1; } if ($row->ac_intrathecal_epi_catheter == 'Yes') { $intrathecal = $intrathecal + 1; } if ($row->ac_none == 'No') { $none = $none + 1; } } } $total = session()->get('n'); $no = 0; $no = $total - $epidural + $last + $respiratory + $cardiac + $radicular + $paresthesia + $bloody + $wettap + $hypotension + $nausea + $vomiting + $subdural + $high + $intrathecal + $totalSpinal + $accidental + $others; $products[] = array( 'day' => 'None', 'sell' => $none, // 'perc' => number_format((float)(($no/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Epidural re-sited', 'sell' => $epidural, // 'perc' => number_format((float)(($epidural/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Local Anaesthetic systemic toxicity (LAST)', 'sell' => $last, // 'perc' => number_format((float)(($last/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Respiratory Arrest', 'sell' => $respiratory, // 'perc' => number_format((float)(($respiratory/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Cardiac Arrest', 'sell' => $cardiac, // 'perc' => number_format((float)(($cardiac/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Radicular Pain (needle/catheter)', 'sell' => $radicular, // 'perc' => number_format((float)(($radicular/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Paresthesia (needle/catheter)', 'sell' => $paresthesia, // 'perc' => number_format((float)(($paresthesia/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Bloody Tap ( needle/catheter)', 'sell' => $bloody, // 'perc' => number_format((float)(($bloody/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Wet Tap/Dural puncture (Needle/Catheter)', 'sell' => $wettap, // 'perc' => number_format((float)(($wettap/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Hypotension', 'sell' => $hypotension, // 'perc' => number_format((float)(($hypotension/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Nausea', 'sell' => $nausea, // 'perc' => number_format((float)(($nausea/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Vomiting', 'sell' => $vomiting, // 'perc' => number_format((float)(($vomiting/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'High block', 'sell' => $high, // 'perc' => number_format((float)(($high/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Subdural Block', 'sell' => $subdural, // 'perc' => number_format((float)(($subdural/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Intrathecal migration of epidural catheter', 'sell' => $intrathecal, // 'perc' => number_format((float)(($intrathecal/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Total Spinal', 'sell' => $totalSpinal, // 'perc' => number_format((float)(($totalSpinal/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Accidental Dural Puncture', 'sell' => $accidental, // 'perc' => number_format((float)(($accidental/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Other', 'sell' => $others, // 'perc' => number_format((float)(($others/$total)*100), 1, '.', '')."%", ); $data['products'] = $products; $data['total'] = $total; // print_r($total);die(); return view('cnb/reports/acute_problems_v', $data); } else { return redirect()->route("n_report"); } } public function OP_Analgesia() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $none = 0; $inhalation = 0; $IV = 0; $opioids = 0; $paracetamol = 0; $ketamine = 0; $others = 0; // ------------------------------CSE------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.in_analgesia, procedure_cse.asr_iv_analgesia, procedure_cse.asr_opioids, procedure_cse.asr_multi_modal, procedure_cse.asr_ketamine,procedure_cse.asr_other"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->in_analgesia == 'Yes') { $inhalation = $inhalation + 1; } if ($row->asr_iv_analgesia == 'Yes') { $IV = $IV + 1; } if ($row->asr_opioids == 'Yes') { $opioids = $opioids + 1; } if ($row->asr_multi_modal == 'Yes') { $paracetamol = $paracetamol + 1; } if ($row->asr_ketamine == 'Yes') { $ketamine = $ketamine + 1; } if ($row->asr_other == 'Yes') { $others = $others + 1; } } } // ------------------------------SPINAL------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.in_analgesia, procedure_spinal.asr_iv_analgesia, procedure_spinal.opioids, procedure_spinal.asr_multimode, procedure_spinal.asr_ketamine,procedure_spinal.asr_other_iv_name"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->in_analgesia == 'Yes') { $inhalation = $inhalation + 1; } if ($row->asr_iv_analgesia == 'Yes') { $IV = $IV + 1; } if ($row->opioids == 'Yes') { $opioids = $opioids + 1; } if ($row->asr_multimode == 'Yes') { $paracetamol = $paracetamol + 1; } if ($row->asr_ketamine == 'Yes') { $ketamine = $ketamine + 1; } if ($row->asr_other_iv_name != '') { $others = $others + 1; } } } // ------------------------------EPIDURAL------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.in_analgesia, procedure_epidural.asr_iv_analgesia, procedure_epidural.opioids, procedure_epidural.asr_multimode, procedure_epidural.asr_ketamine,procedure_epidural.asr_other_iv_name"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->in_analgesia == 'Yes') { $inhalation = $inhalation + 1; } if ($row->asr_iv_analgesia == 'Yes') { $IV = $IV + 1; } if ($row->opioids == 'Yes') { $opioids = $opioids + 1; } if ($row->asr_multimode == 'Yes') { $paracetamol = $paracetamol + 1; } if ($row->asr_ketamine == 'Yes') { $ketamine = $ketamine + 1; } if ($row->asr_other_iv_name != '') { $others = $others + 1; } } } // ------------------------------CSA------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.asr_inhalation, procedure_csa.asr_iv_analgesia, procedure_csa.asr_multi_model, procedure_csa.asr_ketamine, procedure_csa.asr_opioid_name_dose, procedure_csa.asr_other_name_dose"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->asr_inhalation == 'Yes') { $inhalation = $inhalation + 1; } if ($row->asr_iv_analgesia == 'Yes') { $IV = $IV + 1; } $asr_opioid_name_dose = json_decode($row->asr_opioid_name_dose); $op_name = 0; foreach ($asr_opioid_name_dose as $val) { if ($val->name != '') { $op_name += 1; } } if ($op_name > 0) { $opioids = $opioids + 1; } if ($row->asr_multimode == 'Yes') { $paracetamol = $paracetamol + 1; } if ($row->asr_ketamine == 'Yes') { $ketamine = $ketamine + 1; } $asr_other_name_dose = json_decode($row->asr_other_name_dose); $other_name = 0; foreach ($asr_other_name_dose as $val) { if ($val->name != '') { $other_name += 1; } } if ($other_name > 0) { $others = $others + 1; } } } $total = session()->get('n'); $no = 0; $no = $total - ($inhalation + $IV); $total_iv = $opioids + $paracetamol + $ketamine + $others; $products[] = array( 'day' => 'None', 'sell' => $no, // 'perc' => number_format((float)(($no/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Inhalation Analgesia', 'sell' => $inhalation, // 'perc' => number_format((float)(($inhalation/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'IV analgesia', 'sell' => $IV, // 'perc' => number_format((float)(($IV/$total)*100), 1, '.', '')."%", ); $products1[] = array( 'day' => 'Opioids', 'sell' => $opioids, // 'perc' => number_format((float)(($opioids/$total_iv)*100), 1, '.', '')."%", ); $products1[] = array( 'day' => 'Paracetamol / Anti-Inflammatories', 'sell' => $paracetamol, // 'perc' => number_format((float)(($paracetamol/$total_iv)*100), 1, '.', '')."%", ); $products1[] = array( 'day' => 'Ketamine', 'sell' => $ketamine, // 'perc' => number_format((float)(($ketamine/$total_iv)*100), 1, '.', '')."%", ); $products1[] = array( 'day' => 'Others', 'sell' => $others, // 'perc' => number_format((float)(($others/$total_iv)*100), 1, '.', '')."%", ); $data['products'] = $products; $data['products1'] = $products1; $data['total'] = $total; $data['total_iv'] = $total_iv; $data['iv'] = $IV; return view('cnb/reports/OP_Analgesia_v', $data); } else { return redirect()->route("n_report"); } } public function IV_Supplements() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, la_regimen as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('la_regimen'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $la_regimen = []; foreach ($record as $row) { $la_regimen[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['la_regimen'] = $la_regimen; $data['total'] = $total; return view('cnb/reports/IV_Supplements_v', $data); } else { return redirect()->route("n_report"); } } public function Outcome_characteristics() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); $total = session()->get('n'); if ($from_date && $to_date) { $timing = 0; $duration = 0; $bloodLose = 0; $vasopressor = 0; $e_vasopressor = 0; $s_vasopressor = 0; $cse_vasopressor = 0; $csa_vasopressor = 0; $v_total = 0; // ------------------------------CSE------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, STDDEV(procedure_cse.onset_of_surgical) as cse_timing, STDDEV(procedure_cse.duration_surgery) as cse_duration, STDDEV(procedure_cse.blood_loss) as cse_blood, STDDEV(procedure_cse.vasopressor_use) as cse_vasopressor,AVG(procedure_cse.onset_of_surgical) as cse_timing_avg, AVG(procedure_cse.duration_surgery) as cse_duration_avg, AVG(procedure_cse.blood_loss) as cse_blood_avg, AVG(procedure_cse.vasopressor_use) as cse_vasopressor_avg,vasopressor_use"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $cse_timing = $row->cse_timing; $cse_duration = $row->cse_duration; $cse_blood = $row->cse_blood; $cse_vasopressor = $row->cse_vasopressor; $cse_timing_avg = $row->cse_timing_avg; $cse_duration_avg = $row->cse_duration_avg; $cse_blood_avg = $row->cse_blood_avg; $cse_vasopressor_avg = $row->cse_vasopressor_avg; if ($row->vasopressor_use == 'Yes') { $cse_vasopressor = $cse_vasopressor + 1; } // $v_total = $v_total + 1; if ($row->vasopressor_use == 'Yes' || $row->vasopressor_use == 'No') { $v_total = $v_total + 1; } } } // ------------------------------CSA------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, STDDEV(procedure_csa.onset_surgical_anaesthesia) as csa_timing, STDDEV(procedure_csa.duration_surgery) as csa_duration, STDDEV(procedure_csa.blood_loss) as csa_blood, STDDEV(procedure_csa.vasopressor_use) as csa_vasopressor, AVG(procedure_csa.onset_surgical_anaesthesia) as csa_timing_avg, AVG(procedure_csa.duration_surgery) as csa_duration_avg, AVG(procedure_csa.blood_loss) as csa_blood_avg, AVG(procedure_csa.vasopressor_use) as csa_vasopressor_avg ,vasopressor_use"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $csa_timing = number_format((float) $row->csa_timing, 2, '.', ''); $csa_duration = number_format((float) $row->csa_duration, 2, '.', ''); $csa_blood = number_format((float) $row->csa_blood, 2, '.', ''); $csa_vasopressor = number_format((float) $row->csa_vasopressor, 2, '.', ''); $csa_timing_avg = number_format((float) $row->csa_timing_avg, 2, '.', ''); $csa_duration_avg = number_format((float) $row->csa_duration_avg, 2, '.', ''); $csa_blood_avg = number_format((float) $row->csa_blood_avg, 2, '.', ''); $csa_vasopressor_avg = number_format((float) $row->csa_vasopressor_avg, 2, '.', ''); if ($row->vasopressor_use == 'Yes') { $csa_vasopressor = $csa_vasopressor + 1; } // $v_total = $v_total + 1; if ($row->vasopressor_use == 'Yes' || $row->vasopressor_use == 'No') { $v_total = $v_total + 1; } } } // ------------------------------SPINAL------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, STDDEV(procedure_spinal.surgical_anaesthesia) as s_timing, STDDEV(procedure_spinal.surgery_duration) as s_duration, STDDEV(procedure_spinal.blood_loss) as s_blood, STDDEV(procedure_spinal.vasopressor_use) as s_vasopressor,AVG(procedure_spinal.surgical_anaesthesia) as s_timing_avg, AVG(procedure_spinal.surgery_duration) as s_duration_avg, AVG(procedure_spinal.blood_loss) as s_blood_avg, AVG(procedure_spinal.vasopressor_use) as s_vasopressor_avg,vasopressor_use"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); // $db = \Config\Database::connect(); // $query = $db->getLastQuery(); // echo $query; // die(); if ($record) { foreach ($record as $row) { $s_timing = number_format((float) $row->s_timing, 2, '.', ''); $s_duration = number_format((float) $row->s_duration, 2, '.', ''); $s_blood = number_format((float) $row->s_blood, 2, '.', ''); $s_vasopressor = number_format((float) $row->s_vasopressor, 2, '.', ''); $s_timing_avg = number_format((float) $row->s_timing_avg, 2, '.', ''); $s_duration_avg = number_format((float) $row->s_duration_avg, 2, '.', ''); $s_blood_avg = number_format((float) $row->s_blood_avg, 2, '.', ''); $s_vasopressor_avg = number_format((float) $row->s_vasopressor_avg, 2, '.', ''); if ($row->vasopressor_use == 'Yes') { $s_vasopressor = $s_vasopressor + 1; } // $v_total = $v_total + 1; if ($row->vasopressor_use == 'Yes' || $row->vasopressor_use == 'No') { $v_total = $v_total + 1; } } } // ------------------------------EPIDURAL------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, STDDEV(procedure_epidural.surgical_anaesthesia) as e_timing, STDDEV(procedure_epidural.surgery_duration) as e_duration, STDDEV(procedure_epidural.blood_loss) as e_blood, STDDEV(procedure_epidural.vasopressor_use) as e_vasopressor,AVG(procedure_epidural.surgical_anaesthesia) as e_timing_avg, AVG(procedure_epidural.surgery_duration) as e_duration_avg, AVG(procedure_epidural.blood_loss) as e_blood_avg, AVG(procedure_epidural.vasopressor_use) as e_vasopressor_avg,vasopressor_use"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $e_timing = number_format((float) $row->e_timing, 2, '.', ''); $e_duration = number_format((float) $row->e_duration, 2, '.', ''); $e_blood = number_format((float) $row->e_blood, 2, '.', ''); $e_vasopressor = number_format((float) $row->e_vasopressor, 2, '.', ''); $e_timing_avg = number_format((float) $row->e_timing_avg, 2, '.', ''); $e_duration_avg = number_format((float) $row->e_duration_avg, 2, '.', ''); $e_blood_avg = number_format((float) $row->e_blood_avg, 2, '.', ''); $e_vasopressor_avg = number_format((float) $row->e_vasopressor_avg, 2, '.', ''); if ($row->vasopressor_use == 'Yes') { $e_vasopressor = $e_vasopressor + 1; } if ($row->vasopressor_use == 'Yes' || $row->vasopressor_use == 'No') { $v_total = $v_total + 1; } // $v_total = $v_total + 1; } } $products[] = array( 'name' => 'Time to surgical anaesthesia (mins)', 'cse' => "(" . number_format((float) $cse_timing_avg, 1, '.', '') . "±" . number_format((float) $cse_timing, 1, '.', '') . ")", 'epidural' => "(" . number_format((float) $e_timing_avg, 1, '.', '') . "±" . number_format((float) $e_timing, 1, '.', '') . ")", 'spinal' => "(" . number_format((float) $s_timing_avg, 1, '.', '') . "±" . number_format((float) $s_timing, 1, '.', '') . ")", 'csa' => "(" . number_format((float) $csa_timing_avg, 1, '.', '') . "±" . number_format((float) $csa_timing, 1, '.', '') . ")", ); $products[] = array( 'name' => 'Duration of surgery (mins) ', 'cse' => "(" . number_format((float) $cse_duration_avg, 1, '.', '') . "±" . number_format((float) $cse_duration, 1, '.', '') . ")", 'epidural' => "(" . number_format((float) $e_duration_avg, 1, '.', '') . "±" . number_format((float) $e_duration, 1, '.', '') . ")", 'spinal' => "(" . number_format((float) $s_duration_avg, 1, '.', '') . "±" . number_format((float) $s_duration, 1, '.', '') . ")", 'csa' => "(" . number_format((float) $csa_duration_avg, 1, '.', '') . "±" . number_format((float) $csa_duration, 1, '.', '') . ")", ); $products[] = array( 'name' => 'Blood loss ml', 'cse' => "(" . number_format((float) $cse_blood_avg, 1, '.', '') . "±" . number_format((float) $cse_blood, 1, '.', '') . ")", 'epidural' => "(" . number_format((float) $e_blood_avg, 1, '.', '') . "±" . number_format((float) $e_blood, 1, '.', '') . ")", 'spinal' => "(" . number_format((float) $s_blood_avg, 1, '.', '') . "±" . number_format((float) $s_blood, 1, '.', '') . ")", 'csa' => "(" . number_format((float) $csa_blood_avg, 1, '.', '') . "±" . number_format((float) $csa_blood, 1, '.', '') . ")", ); $products[] = array( 'name' => 'Vasopressor use', // 'cse' => number_format((float)(($cse_vasopressor/$v_total)*100), 1, '.', '')."%", // 'epidural' => number_format((float)(($e_vasopressor/$v_total)*100), 1, '.', '')."%", // 'spinal' => number_format((float)(($s_vasopressor/$v_total)*100), 1, '.', '')."%", // 'csa' => number_format((float)(($csa_vasopressor/$v_total)*100), 1, '.', '')."%", 'cse' => $cse_vasopressor, 'epidural' => $e_vasopressor, 'spinal' => $s_vasopressor, 'csa' => $csa_vasopressor, 'total' => $v_total ); // print_r($products);die(); $data['products'] = $products; $data['total'] = session()->get('n'); return view('cnb/reports/Outcome_characteristics_v', $data); } else { return redirect()->route("n_report"); } } public function Pain_Score() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); // print_r($from_date); // print_r($to_date);die(); $total = session()->get('n'); // print_r($total);die(); $products = []; $products1 = []; $products2 = []; $a1 = 0; $a2 = 0; $a3 = 0; $a4 = 0; $a5 = 0; $ps_30mins1 = 0; $ps_30mins2 = 0; $ps_30mins3 = 0; $ps_30mins4 = 0; $ps_30mins5 = 0; $ps_1hr1 = 0; $ps_1hr2 = 0; $ps_1hr3 = 0; $ps_1hr4 = 0; $ps_1hr5 = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count,cnb_postop.ps_postproc"); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->ps_postproc >= 0 && $row->ps_postproc <= 4) { $a1 = $a1 + 1; } else if ($row->ps_postproc >= 5 && $row->ps_postproc <= 7) { $a2 = $a2 + 1; } else if ($row->ps_postproc >= 8 && $row->ps_postproc <= 10) { $a3 = $a3 + 1; } else if ($row->ps_postproc == 'Unable to score') { $a4 = $a4 + 1; } else if ($row->ps_postproc == '') { $a5 = $a5 + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count,cnb_postop.ps_30mins"); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->ps_30mins >= 0 && $row->ps_30mins <= 4) { $ps_30mins1 = $ps_30mins1 + 1; } else if ($row->ps_30mins >= 5 && $row->ps_30mins <= 7) { $ps_30mins2 = $ps_30mins2 + 1; } else if ($row->ps_30mins >= 8 && $row->ps_30mins <= 10) { $ps_30mins3 = $ps_30mins3 + 1; } else if ($row->ps_30mins == 'Unable to score') { $ps_30mins4 = $ps_30mins4 + 1; } else if ($row->ps_30mins == '') { $ps_30mins5 = $ps_30mins5 + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count,cnb_postop.ps_1hr"); $query = $builder->join("cnb_preop", "cnb_preop.patient_id = cnb_postop.patient_id"); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->ps_1hr >= 0 && $row->ps_1hr <= 4) { $ps_1hr1 = $ps_1hr1 + 1; } else if ($row->ps_1hr >= 5 && $row->ps_1hrs <= 7) { $ps_1hr2 = $ps_1hr2 + 1; } else if ($row->ps_1hr >= 8 && $row->ps_1hr <= 10) { $ps_1hr3 = $ps_1hr3 + 1; } else if ($row->ps_1hr == 'Unable to score') { $ps_1hr4 = $ps_1hr4 + 1; } else if ($row->ps_1hr == '') { $ps_1hr5 = $ps_1hr5 + 1; } } } $products[] = array( 'day' => 'Mild(0-4)', 'sell' => $a1, 'sell1' => $ps_30mins1, 'sell2' => $ps_1hr1, ); $products[] = array( 'day' => 'Moderate(5-6)', 'sell' => $a2, 'sell1' => $ps_30mins2, 'sell2' => $ps_1hr2, ); $products[] = array( 'day' => 'Severe(8-10)', 'sell' => $a3, 'sell1' => $ps_30mins3, 'sell2' => $ps_1hr3, ); $products[] = array( 'day' => 'Unable to score', 'sell' => $a4, 'sell1' => $ps_30mins4, 'sell2' => $ps_1hr4, ); $products[] = array( 'day' => 'None', 'sell' => $a5, 'sell1' => $ps_30mins5, 'sell2' => $ps_1hr5, ); $data['products'] = ($products); $data['total_n'] = $total; return view('cnb/reports/Pain_Score_v', $data); } public function Nausea() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); // print_r($from_date); // print_r($to_date);die(); $total = session()->get('n'); // print_r($total);die(); $products = []; $products1 = []; $products2 = []; $nvs_postproc1 = 0; $nvs_postproc2 = 0; $nvs_postproc3 = 0; $nvs_postproc4 = 0; $nvs_postproc5 = 0; $nvs_30mins1 = 0; $nvs_30mins2 = 0; $nvs_30mins3 = 0; $nvs_30mins4 = 0; $nvs_30mins5 = 0; $nvs_1hr1 = 0; $nvs_1hr2 = 0; $nvs_1hr3 = 0; $nvs_1hr4 = 0; $nvs_1hr5 = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count,cnb_postop.nvs_postproc"); // $builder->join('cnb_postop', 'cnb_postop.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->nvs_postproc == '0-No Nausea' ) { $nvs_postproc1 = $nvs_postproc1 + 1; } else if ($row->nvs_postproc == '1-Mild Nausea not requiring treatment') { $nvs_postproc2 = $nvs_postproc2 + 1; } else if ($row->nvs_postproc == '2-Vomiting') { $nvs_postproc3 = $nvs_postproc3 + 1; } else if ($row->nvs_postproc == 'Unable to score') { $nvs_postproc4 = $nvs_postproc4 + 1; } else if ($row->nvs_postproc == '') { $nvs_postproc5 = $nvs_postproc5 + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count,cnb_postop.nvs_30mins"); // $builder->join('cnb_postop', 'cnb_postop.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->nvs_30mins == '0-No Nausea' ) { $nvs_30mins1 = $nvs_30mins1 + 1; } else if ($row->nvs_30mins == '1-Mild Nausea not requiring treatment') { $nvs_30mins2 = $nvs_30mins2 + 1; } else if ($row->nvs_30mins == '2-Vomiting') { $nvs_30mins3 = $nvs_30mins3 + 1; } else if ($row->nvs_30mins == 'Unable to score') { $nvs_30mins4 = $nvs_30mins4 + 1; } else if ($row->nvs_30mins == '') { $nvs_30mins5 = $nvs_30mins5 + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count,cnb_postop.nvs_1hr"); // $builder->join('cnb_postop', 'cnb_postop.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->nvs_1hr == '0-No Nausea' ) { $nvs_1hr1 = $nvs_1hr1 + 1; } else if ($row->nvs_1hr == '1-Mild Nausea not requiring treatment') { $nvs_1hr2 = $nvs_1hr2 + 1; } else if ($row->nvs_1hr == '2-Vomiting') { $nvs_1hr3 = $nvs_1hr3 + 1; } else if ($row->nvs_1hr == 'Unable to score') { $nvs_1hr4 = $nvs_1hr4 + 1; } else if ($row->nvs_1hr == '') { $nvs_1hr5 = $nvs_1hr5 + 1; } } } $products[] = array( 'day' => '0 - No Nausea', 'sell' => $nvs_postproc1, 'sell1' => $nvs_30mins1, 'sell2' => $nvs_1hr1 ); $products[] = array( 'day' => '1 - Mild Nausea not requiring treatment', 'sell' => $nvs_postproc2, 'sell1' => $nvs_30mins2, 'sell2' => $nvs_1hr2 ); $products[] = array( 'day' => '2 - Vomiting', 'sell' => $nvs_postproc3, 'sell1' => $nvs_30mins3, 'sell2' => $nvs_1hr3 ); $products[] = array( 'day' => 'Unable to score', 'sell' => $nvs_postproc4, 'sell1' => $nvs_30mins4, 'sell2' => $nvs_1hr4 ); $products[] = array( 'day' => 'None', 'sell' => $nvs_postproc5, 'sell1' => $nvs_30mins5, 'sell2' => $nvs_1hr5 ); $data['products'] = ($products); $data['total_n'] = $total; return view('cnb/reports/Nausea_v', $data); } public function Sedation_Scores() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $a1 = 0; $a2 = 0; $a3 = 0; $a4 = 0; $a5 = 0; $a6 = 0; $b1 = 0; $b2 = 0; $b3 = 0; $b4 = 0; $b5 = 0; $b6 = 0; $c1 = 0; $c2 = 0; $c3 = 0; $c4 = 0; $c5 = 0; $c6 = 0; $total = session()->get('n'); $products = []; $total_entered = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.ss_postproc,cnb_postop.ss_30mins,cnb_postop.ss_1hr"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->ss_postproc == '0-Awake') { $a1 = $a1 + 1; } else if ($row->ss_postproc == '1-Mild, easy to rouse') { $a2 = $a2 + 1; } else if ($row->ss_postproc == '2-Moderate, easy to rouse, unable to remain') { $a3 = $a3 + 1; } else if ($row->ss_postproc == '3-Difficult to rouse') { $a4 = $a4 + 1; } else if ($row->ss_postproc == 'Unable to score') { $a5 = $a5 + 1; } else if ($row->ss_postproc == '') { $a6 = $a6 + 1; } if ($row->ss_30mins == '0-Awake') { $b1 = $b1 + 1; } else if ($row->ss_30mins == '1-Mild, easy to rouse') { $b2 = $b2 + 1; } else if ($row->ss_30mins == '2-Moderate, easy to rouse, unable to remain') { $b3 = $b3 + 1; } else if ($row->ss_30mins == '3-Difficult to rouse') { $b4 = $b4 + 1; } else if ($row->ss_30mins == 'Unable to score') { $b5 = $b5 + 1; } else if ($row->ss_30mins == '') { $b6 = $b6 + 1; } if ($row->ss_1hr == '0-Awake') { $c1 = $c1 + 1; } else if ($row->ss_1hr == '1-Mild, easy to rouse') { $c2 = $c2 + 1; } else if ($row->ss_1hr == '2-Moderate, easy to rouse, unable to remain') { $c3 = $c3 + 1; } else if ($row->ss_1hr == '3-Difficult to rouse') { $c4 = $c4 + 1; } else if ($row->ss_1hr == 'Unable to score') { $c5 = $c5 + 1; } else if ($row->ss_1hr == '') { $c6 = $c6 + 1; } } } $products[] = array( 'day' => '0-Awake', 'sell' => $a1, 'sell1' => $b1, 'sell2' => $c1, ); $products[] = array( 'day' => '1-Mild, easy to rouse', 'sell' => $a2, 'sell1' => $b2, 'sell2' => $c2 ); $products[] = array( 'day' => '2-Moderate, easy to rouse, unable to remain', 'sell' => $a3, 'sell1' => $b3, 'sell2' => $c3 ); $products[] = array( 'day' => '3-Difficult to rouse', 'sell' => $a4, 'sell1' => $b4, 'sell2' => $c4 ); $products[] = array( 'day' => 'Unable to score', 'sell' => $a5, 'sell1' => $b5, 'sell2' => $c5 ); $products[] = array( 'day' => 'None', 'sell' => $a6, 'sell1' => $b6, 'sell2' => $c6 ); $data['products'] = ($products); $data['total'] = $total; $data['total_n'] = $total; return view('cnb/reports/Sedation_Scores_v', $data); } else { return redirect()->route("n_report"); } } public function Recovery_old() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total_ts = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.time_spent as s"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $builder->where('cnb_postop.created_at >=', date('Y-m-d', strtotime($from_date))); $builder->where('cnb_postop.created_at <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { if ($row->s) { $total_ts = $total_ts + 1; } } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count,STDDEV(cnb_postop.time_spent) as std,AVG(cnb_postop.time_spent) as avg,time_spent"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_csa.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_csa.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total += floatval($row->count); $csa_total_std = floatval($row->std); $csa_total_avg = floatval($row->avg); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count,STDDEV(cnb_postop.time_spent) as std,AVG(cnb_postop.time_spent) as avg,time_spent"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_epidural.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_epidural.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total += floatval($row->count); $epidural_total_std = floatval($row->std); $epidural_total_avg = floatval($row->avg); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count,STDDEV(cnb_postop.time_spent) as std,AVG(cnb_postop.time_spent) as avg,time_spent"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_spinal.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_spinal.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total += floatval($row->count); $spinal_total_std = floatval($row->std); $spinal_total_avg = floatval($row->avg); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count,STDDEV(cnb_postop.time_spent) as std,AVG(cnb_postop.time_spent) as avg,time_spent"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_csa.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_csa.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total += floatval($row->count); $cse_total_std = floatval($row->std); $cse_total_avg = floatval($row->avg); } $time_spent = []; $csa_total_std = number_format((float) $csa_total_std, 2, '.', ''); $epidural_total_std = number_format((float) $epidural_total_std, 2, '.', ''); $spinal_total_std = number_format((float) $spinal_total_std, 2, '.', ''); $cse_total_std = number_format((float) $cse_total_std, 2, '.', ''); $csa_total_avg = number_format((float) $csa_total_avg, 2, '.', ''); $epidural_total_avg = number_format((float) $epidural_total_avg, 2, '.', ''); $spinal_total_avg = number_format((float) $spinal_total_avg, 2, '.', ''); $cse_total_avg = number_format((float) $cse_total_avg, 2, '.', ''); $t_std = $csa_total_std + $epidural_total_std + $spinal_total_std + $cse_total_std; //$t_std = ($t_std/4); $t_avg = $csa_total_avg + $epidural_total_avg + $spinal_total_avg + $cse_total_avg; //$t_avg = ($t_avg/4); $time_spent[] = array( 'day' => 'All Procedure', 'sell' => "(" . $t_std . "±" . $t_avg . ")" ); $time_spent[] = array( 'day' => 'CSE', 'sell' => "(" . $csa_total_std . "±" . $csa_total_avg . ")" ); $time_spent[] = array( 'day' => 'Epidural', 'sell' => "(" . $epidural_total_std . "±" . $epidural_total_avg . ")" ); $time_spent[] = array( 'day' => 'Spinal', 'sell' => "(" . $spinal_total_std . "±" . $spinal_total_avg . ")" ); $time_spent[] = array( 'day' => 'CSE', 'sell' => "(" . $cse_total_std . "±" . $cse_total_avg . ")" ); $data['total2'] = $time_spent; $data['total'] = $total_ts; return view('cnb/reports/Recovery_v', $data); } else { return redirect()->route("n_report"); } } public function Recovery() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('cnb_postop'); $query = $builder->select("time_spent"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_csa.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_csa.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); $csa_arr =[]; foreach ($record as $row) { if($row->time_spent == ''){ array_push($csa_arr,0); }else{ array_push($csa_arr,$row->time_spent); } } if($record){ $total += 1; $csa_mean = array_sum($csa_arr) / count($csa_arr); $csa_sum_of_squared_differences = 0; foreach ($csa_arr as $number) { $difference = $number - $csa_mean; $csa_sum_of_squared_differences += $difference * $difference; } $csa_standard_deviation = sqrt($csa_sum_of_squared_differences / count($csa_arr)); }else{ $csa_mean = 0; $csa_sum_of_squared_differences = 0; } $builder = $db->table('cnb_postop'); $query = $builder->select("time_spent"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_epidural.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_epidural.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); $epidural_arr =[]; foreach ($record as $row) { if($row->time_spent == ''){ array_push($epidural_arr,0); }else{ array_push($epidural_arr,$row->time_spent); } } if($record){ $total += 1; $epidural_mean = array_sum($epidural_arr) / count($epidural_arr); $epidural_sum_of_squared_differences = 0; foreach ($epidural_arr as $number) { $difference = $number - $epidural_mean; $epidural_sum_of_squared_differences += $difference * $difference; } $epidural_standard_deviation = sqrt($epidural_sum_of_squared_differences / count($epidural_arr)); }else{ $epidural_mean = 0; $epidural_standard_deviation = 0; } $builder = $db->table('cnb_postop'); $query = $builder->select("time_spent"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_spinal.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_spinal.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); $spinal_arr =[]; foreach ($record as $row) { if($row->time_spent == ''){ array_push($spinal_arr,0); }else{ array_push($spinal_arr,$row->time_spent); } } if($record){ $total += 1; $spinal_mean = array_sum($spinal_arr) / count($spinal_arr); $spinal_sum_of_squared_differences = 0; foreach ($spinal_arr as $number) { $difference = $number - $spinal_mean; $spinal_sum_of_squared_differences += $difference * $difference; } $spinal_standard_deviation = sqrt($spinal_sum_of_squared_differences / count($spinal_arr)); }else{ $spinal_mean = 0; $spinal_standard_deviation = 0; } $builder = $db->table('cnb_postop'); $query = $builder->select("time_spent"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); $cse_arr =[]; foreach ($record as $row) { if($row->time_spent == ''){ array_push($cse_arr,0); }else{ array_push($cse_arr,$row->time_spent); } } if($record){ $total += 1; $cse_mean = array_sum($cse_arr) / count($cse_arr); $cse_sum_of_squared_differences = 0; foreach ($cse_arr as $number) { $difference = $number - $cse_mean; $cse_sum_of_squared_differences += $difference * $difference; } $cse_standard_deviation = sqrt($cse_sum_of_squared_differences / count($cse_arr)); }else{ $cse_mean = 0; $cse_standard_deviation = 0; } // -------------------------------------------ALL PROCEDURE----------------------- if($total > 0){ $all_arr = array_merge($cse_arr,$spinal_arr,$epidural_arr,$csa_arr); $all_mean = array_sum($all_arr) / count($all_arr); $all_sum_of_squared_differences = 0; foreach ($all_arr as $number) { $difference = $number - $all_mean; $all_sum_of_squared_differences += $difference * $difference; } $all_standard_deviation = sqrt($all_sum_of_squared_differences / count($all_arr)); }else{ $all_mean = 0; $all_standard_deviation = 0; $all_arr=[]; }; $time_spent[] = array( 'day' => 'All procedures', 'sell' => "(" .number_format((float) $all_mean, 2, '.', '') . "±" . number_format((float) $all_standard_deviation, 2, '.', '') . ")", 'total'=> count($all_arr) ); $time_spent[] = array( 'day' => 'CSE', 'sell' => "(" .number_format((float) $cse_mean, 2, '.', '') . "±" . number_format((float) $cse_standard_deviation, 2, '.', '') . ")", 'total'=> count($cse_arr) ); $time_spent[] = array( 'day' => 'Epidural', 'sell' => "(" . number_format((float) $epidural_mean, 2, '.', '') . "±" . number_format((float) $epidural_standard_deviation, 2, '.', '') . ")", 'total'=> count($epidural_arr) ); $time_spent[] = array( 'day' => 'Spinal', 'sell' => "(" . number_format((float) $spinal_mean, 2, '.', '') . "±" . number_format((float) $spinal_standard_deviation, 2, '.', '') . ")", 'total'=> count($spinal_arr) ); $time_spent[] = array( 'day' => 'CSA', 'sell' => "(" . number_format((float) $csa_mean, 2, '.', '') . "±" . number_format((float) $csa_standard_deviation, 2, '.', '') . ")", 'total'=> count($csa_arr) ); $data['total2'] = $time_spent; $data['total'] = $all_mean; return view('cnb/reports/Recovery_v', $data); } else { return redirect()->route("n_report"); } } public function Analgesia() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $products = []; $none = 0; $intravenous_opioids = 0; $oral_opioids = 0; $tramadol = 0; $nsaid = 0; $paracetamol = 0; $la_regimen = 0; $other = 0; $repeat = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, cnb_postop.intravenous_opioids,cnb_postop.oral_opioids,cnb_postop.tramadol,cnb_postop.nsaid,cnb_postop.paracetamol,cnb_postop.la_regimen,cnb_postop.other,cnb_postop.repeat"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->intravenous_opioids != 'Yes' && $row->oral_opioids != 'Yes' && $row->tramadol != 'Yes' && $row->nsaid != 'Yes' && $row->paracetamol != 'Yes' && $row->la_regimen != 'Yes' && $row->other != 'Yes' && $row->repeat != 'Yes') { $none = $none + 1; } if ($row->intravenous_opioids == 'Yes') { $intravenous_opioids = $intravenous_opioids + 1; } if ($row->oral_opioids == 'Yes') { $oral_opioids = $oral_opioids + 1; } if ($row->tramadol == 'Yes') { $tramadol = $tramadol + 1; } if ($row->nsaid == 'Yes') { $nsaid = $nsaid + 1; } if ($row->paracetamol == 'Yes') { $paracetamol = $paracetamol + 1; } if ($row->la_regimen == 'Yes') { $la_regimen = $la_regimen + 1; } if ($row->other == 'Yes') { $other = $other + 1; } if ($row->repeat == 'Yes') { $repeat = $repeat + 1; } } } $products[] = array( 'day' => 'None', 'sell' => $none ); $products[] = array( 'day' => 'Intravenous Opioids', 'sell' => $intravenous_opioids ); $products[] = array( 'day' => 'Oral Opioids', 'sell' => $oral_opioids ); $products[] = array( 'day' => 'Tramadol', 'sell' => $tramadol ); $products[] = array( 'day' => 'Nsaid', 'sell' => $nsaid ); $products[] = array( 'day' => 'Paracetamol', 'sell' => $paracetamol ); $products[] = array( 'day' => 'La Regimen', 'sell' => $la_regimen ); $products[] = array( 'day' => 'Other', 'sell' => $other ); $products[] = array( 'day' => 'Repeat Block', 'sell' => $repeat ); $data['products'] = ($products); // $data['total'] = $none + $intravenous_opioids +$oral_opioids +$tramadol +$nsaid +$paracetamol +$la_regimen +$other + $repeat; $data['total'] = $total; $data['total_n'] = $none + $intravenous_opioids + $oral_opioids + $tramadol + $nsaid + $paracetamol + $la_regimen + $other + $repeat; return view('cnb/reports/Analgesia_v', $data); } else { return redirect()->route("n_report"); } } public function Co_Morbid() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $products = []; $diabetes_mellitus = 0; $cvs_disease = 0; $respiratory_disease = 0; $neurological_disorder = 0; $renal_disorder = 0; $spin_back_problem = 0; $fever_infection = 0; $bleeding_disorder = 0; $anaemia = 0; $malignancy = 0; $other = 0; $total_no = 0; $none = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, cnb_preop.diabetes_mellitus,cnb_preop.cvs_disease,cnb_preop.respiratory_disease,cnb_preop.neurological_disorder,cnb_preop.renal_disorder,cnb_preop.spin_back_problem,cnb_preop.fever_infection,cnb_preop.bleeding_disorder,cnb_preop.anaemia,cnb_preop.malignancy,cnb_preop.other"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->diabetes_mellitus == 'Yes') { $diabetes_mellitus = $diabetes_mellitus + 1; } if ($row->cvs_disease == 'Yes') { $cvs_disease = $cvs_disease + 1; } if ($row->respiratory_disease == 'Yes') { $respiratory_disease = $respiratory_disease + 1; } if ($row->neurological_disorder == 'Yes') { $neurological_disorder = $neurological_disorder + 1; } if ($row->renal_disorder == 'Yes') { $renal_disorder = $renal_disorder + 1; } if ($row->spin_back_problem == 'Yes') { $spin_back_problem = $spin_back_problem + 1; } if ($row->fever_infection == 'Yes') { $fever_infection = $fever_infection + 1; } if ($row->bleeding_disorder == 'Yes') { $bleeding_disorder = $bleeding_disorder + 1; } if ($row->anaemia == 'Yes') { $anaemia = $anaemia + 1; } if ($row->malignancy == 'Yes') { $malignancy = $malignancy + 1; } if ($row->other != '') { $other = $other + 1; } $total_no = $total_no + 1; if ($row->diabetes_mellitus == 'No' && $row->cvs_disease == 'No' && $row->respiratory_disease == 'No' && $row->neurological_disorder == 'No' && $row->renal_disorder == 'No' && $row->spin_back_problem == 'No' && $row->fever_infection == 'No' && $row->bleeding_disorder == 'No' && $row->anaemia == 'No' && $row->malignancy == 'No' && $row->other == '') { $none = $none + 1; } } } $products[] = array( 'day' => 'None', 'sell' => $none ); $products[] = array( 'day' => 'Diabetis Mellitus', 'sell' => $diabetes_mellitus ); $products[] = array( 'day' => 'CVS disease', 'sell' => $cvs_disease ); $products[] = array( 'day' => 'Respiratory disease', 'sell' => $respiratory_disease ); $products[] = array( 'day' => 'Neurological disorders', 'sell' => $neurological_disorder ); $products[] = array( 'day' => 'Renal Disorders', 'sell' => $renal_disorder ); $products[] = array( 'day' => 'Spine/back Deformities', 'sell' => $spin_back_problem ); $products[] = array( 'day' => 'Fever / Infection', 'sell' => $fever_infection ); $products[] = array( 'day' => 'Bleeding disorder', 'sell' => $bleeding_disorder ); $products[] = array( 'day' => 'Anaemia', 'sell' => $anaemia ); $products[] = array( 'day' => 'Malignancy', 'sell' => $malignancy ); $products[] = array( 'day' => 'Other', 'sell' => $other ); $data['products'] = ($products); $data['total'] = $total; $data['total_n'] = $diabetes_mellitus + $cvs_disease + $respiratory_disease + $neurological_disorder + $renal_disorder + $spin_back_problem + $fever_infection + $bleeding_disorder + $anaemia + $malignancy + $other; $data['total_no'] = $total_no; return view('cnb/reports/morbid_v', $data); } else { return redirect()->route("n_report"); } } public function Anasthetic() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $cnb_done_by2 = []; $senior_c = 0; $junior_c = 0; $senior_t = 0; $junior_t = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.cnb2 as done_by"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->done_by == 'Senior Consultant') { $senior_c = $senior_c + 1; } else if ($row->done_by == 'Junior Consultant') { $junior_c = $junior_c + 1; } else if ($row->done_by == 'Senior Trainee') { $senior_t = $senior_t + 1; } else if ($row->done_by == 'Junior Trainee') { $junior_t = $junior_t + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.cnb2 as done_by"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->done_by == 'Senior Consultant') { $senior_c = $senior_c + 1; } else if ($row->done_by == 'Junior Consultant') { $junior_c = $junior_c + 1; } else if ($row->done_by == 'Senior Trainee') { $senior_t = $senior_t + 1; } else if ($row->done_by == 'Junior Trainee') { $junior_t = $junior_t + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.cnb2 as done_by"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->done_by == 'Senior Consultant') { $senior_c = $senior_c + 1; } else if ($row->done_by == 'Junior Consultant') { $junior_c = $junior_c + 1; } else if ($row->done_by == 'Senior Trainee') { $senior_t = $senior_t + 1; } else if ($row->done_by == 'Junior Trainee') { $junior_t = $junior_t + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.cnb2 as done_by"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->done_by == 'Senior Consultant') { $senior_c = $senior_c + 1; } else if ($row->done_by == 'Junior Consultant') { $junior_c = $junior_c + 1; } else if ($row->done_by == 'Senior Trainee') { $senior_t = $senior_t + 1; } else if ($row->done_by == 'Junior Trainee') { $junior_t = $junior_t + 1; } } } $cnb_done_by2[] = array( 'day' => 'Senior Consultant', 'sell' => $senior_c ); $cnb_done_by2[] = array( 'day' => 'Junior Consultant', 'sell' => $junior_c ); $cnb_done_by2[] = array( 'day' => 'Senior Trainee', 'sell' => $senior_t ); $cnb_done_by2[] = array( 'day' => 'Junior Trainee', 'sell' => $junior_t ); $data['cnb_done_by2'] = ($cnb_done_by2); $data['total'] = $total; return view('cnb/reports/anasthetic_v', $data); } else { return redirect()->route("n_report"); } } public function Supervision() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $supervision = []; $d_supervision = 0; $i_supervision = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.supervision as supervision"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->supervision == 'Independent Supervision') { $i_supervision = $i_supervision + 1; } else if ($row->supervision == 'Direct Supervision') { $d_supervision = $d_supervision + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.supervision as supervision"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->supervision == 'Independent Supervision') { $i_supervision = $i_supervision + 1; } else if ($row->supervision == 'Direct Supervision') { $d_supervision = $d_supervision + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.supervision as supervision"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->supervision == 'Independent Supervision') { $i_supervision = $i_supervision + 1; } else if ($row->supervision == 'Direct Supervision') { $d_supervision = $d_supervision + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.supervision as supervision"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->supervision == 'Independent Supervision') { $i_supervision = $i_supervision + 1; } else if ($row->supervision == 'Direct Supervision') { $d_supervision = $d_supervision + 1; } } } $supervision[] = array( 'day' => 'Independent Supervision', 'sell' => $i_supervision ); $supervision[] = array( 'day' => 'Direct Supervision', 'sell' => $d_supervision ); $data['products'] = ($products); $data['supervision'] = ($supervision); $data['total'] = $total; // print_r($total2);die(); return view('cnb/reports/supervision_v', $data); } else { return redirect()->route("n_report"); } } public function Sedation() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $patient_position = []; $awake = 0; $sedation = 0; $ga = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.patient_status as patient_status"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->patient_status == 'Sedation -> 1-Mild easy to rouse') { $awake = $awake + 1; } else if ($row->patient_status == 'Sedation -> 2-Moderate,easy to rouse,unable to remain awake') { $sedation = $sedation + 1; } else if ($row->patient_status == 'Sedation -> 3-Difficult to rouse') { $ga = $ga + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.patient_status as patient_status"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->patient_status == 'Sedation - 1-Mild easy to rouse') { $awake = $awake + 1; } else if ($row->patient_status == 'Sedation - 2-Moderate,easy to rouse,unable to remain awake') { $sedation = $sedation + 1; } else if ($row->patient_status == 'Sedation - 3-Difficult to rouse') { $ga = $ga + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.patient_status as patient_status"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->patient_status == 'Sedation -> 1-Mild easy to rouse') { $awake = $awake + 1; } else if ($row->patient_status == 'Sedation -> 2-Moderate,easy to rouse,unable to remain awake') { $sedation = $sedation + 1; } else if ($row->patient_status == 'Sedation -> 3-Difficult to rouse') { $ga = $ga + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.patient_status as patient_status"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->patient_status == 'Sedation -> 1-Mild easy to rouse') { $awake = $awake + 1; } else if ($row->patient_status == 'Sedation -> 2-Moderate,easy to rouse,unable to remain awake') { $sedation = $sedation + 1; } else if ($row->patient_status == 'Sedation -> 3-Difficult to rouse') { $ga = $ga + 1; } } } $patient_position[] = array( 'day' => '1-Mild easy to rouse', 'sell' => $awake ); $patient_position[] = array( 'day' => '2-Moderate,easy to rouse,unable to remain awake', 'sell' => $sedation ); $patient_position[] = array( 'day' => '3-Difficult to rouse', 'sell' => $ga ); $data['products'] = ($patient_position); //$data['total'] = $total; $data['total'] = $awake + $sedation + $ga; return view('cnb/reports/Sedation_v', $data); } else { return redirect()->route("n_report"); } } public function PatientPositon() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $patient_position = []; $lateral = 0; $sitting = 0; $prone = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.patient_position as patient_position"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->patient_position == 'Lateral') { $lateral = $lateral + 1; } else if ($row->patient_position == 'Sitting') { $sitting = $sitting + 1; } else if ($row->patient_position == 'Prone') { $prone = $prone + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.patient_position as patient_position"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->patient_position == 'Lateral') { $lateral = $lateral + 1; } else if ($row->patient_position == 'Sitting') { $sitting = $sitting + 1; } else if ($row->patient_position == 'Prone') { $prone = $prone + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.patient_position as patient_position"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->patient_position == 'Lateral') { $lateral = $lateral + 1; } else if ($row->patient_position == 'Sitting') { $sitting = $sitting + 1; } else if ($row->patient_position == 'Prone') { $prone = $prone + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.patient_position as patient_position"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->patient_position == 'Lateral') { $lateral = $lateral + 1; } else if ($row->patient_position == 'Sitting') { $sitting = $sitting + 1; } else if ($row->patient_position == 'Prone') { $prone = $prone + 1; } } } $patient_position[] = array( 'day' => 'Lateral', 'sell' => $lateral ); $patient_position[] = array( 'day' => 'Sitting', 'sell' => $sitting ); $patient_position[] = array( 'day' => 'Prone', 'sell' => $prone ); $data['patient_position'] = ($patient_position); $data['total'] = $total; return view('cnb/reports/Patientpositon_v', $data); } else { return redirect()->route("n_report"); } } public function vertibral_intraspace() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $total_e = session()->get('e_total'); $total_s = session()->get('s_total'); $total_cse = session()->get('cse_total'); $total_csa = session()->get('csa_total'); // echo $total_cse;die(); $spinal_level_name = []; $Thoracic = 0; $Lumbar = 0; $Cervical=0; // // ================ Spinal level =========== $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.spinal_level_name as Sname"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); // $query = $builder->select("spinal_level_name as Sname"); $query = $builder->where('procedure_spinal.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_spinal.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); // print_r($record);die(); if ($record) { foreach ($record as $key) { if ($key->Sname == 'Thoracic') { $Thoracic = $Thoracic + 1; } else if ($key->Sname == 'Lumbar') { $Lumbar = $Lumbar + 1; } else if ($key->Sname == 'Lumbar') { $Cervical = $Cervical + 1; } } } // print_r($Lumbar);die(); $spinal_level_name[] = array( 'day' => 'Thoracic', 'sell' => $Thoracic ); $spinal_level_name[] = array( 'day' => 'Lumbar', 'sell' => $Lumbar ); $spinal_level_name[] = array( 'day' => 'Cervical', 'sell' => $Cervical ); $data['spinal_level_name'] = $spinal_level_name; $total1 = $Thoracic + $Lumbar; $data['total1'] = $total1; // epidural_name $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.epidural_level_name as Ename"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); // $query = $builder->select("spinal_level_name as Sname"); $query = $builder->where('procedure_epidural.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_epidural.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); // $query = $db->getLastQuery(); // echo $query; $epidural_level_name = []; $Cervical1 = 0; $Caudal1 = 0; $Thoracic1 = 0; $Lumbar1 = 0; if ($record) { foreach ($record as $key) { if ($key->Ename == 'Thoracic') { $Thoracic1 = $Thoracic1 + 1; } else if ($key->Ename == 'Lumbar') { $Lumbar1 = $Lumbar1 + 1; } else if ($key->Ename == 'Cervical') { $Cervical1 = $Cervical1 + 1; } else if ($key->Ename == 'Caudal') { $Caudal1 = $Caudal1 + 1; } } } $epidural_level_name[] = array( 'day' => 'Cervical', 'sell' => $Cervical1 ); // print_r($Lumbar);die(); $epidural_level_name[] = array( 'day' => 'Thoracic', 'sell' => $Thoracic1 ); $epidural_level_name[] = array( 'day' => 'Lumbar', 'sell' => $Lumbar1 ); $epidural_level_name[] = array( 'day' => 'Caudal', 'sell' => $Caudal1 ); $total_epidural = $Thoracic1 + $Lumbar1 + $Cervical1 + $Caudal1; $data['total_epidural'] = $total_epidural; // print_r($total_epidural);die(); // $data['products'] = ($products); $data['epidural_level_name'] = $epidural_level_name; //============= CSA =============== $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.spinal_level_name as csa_name"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_csa.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_csa.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); // $query = $db->getLastQuery(); // echo $query; // print_r($record);die(); $Thoracic3 = 0; $Lumbar3 = 0; // $csa[] = 0; if ($record) { foreach ($record as $key) { if ($key->csa_name == 'Thoracic') { $Thoracic3 = $Thoracic3 + 1; } else if ($key->csa_name == 'Lumbar') { $Lumbar3 = $Lumbar3 + 1; } } } // print_r($Lumbar);die(); $csa[] = array( 'day' => 'Thoracic', 'sell' => $Thoracic3 ); $csa[] = array( 'day' => 'Lumbar', 'sell' => $Lumbar3 ); $data['csa'] = $csa; $total3 = $Thoracic3 + $Lumbar3; $data['total3'] = $total3; //============== cse ================== $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.cse_technique as technique,procedure_cse.spinal_level_name as sname,procedure_cse.epidural_level_name as ename"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); // print_r($record);die(); // $query = $db->getLastQuery(); // echo $query; $single = 0; $double = 0; $dual = 0; $Thoracic_s = 0; $Lumbar_s = 0; $Thoracic_e = 0; $Lumbar_e = 0; $Cervical_e = 0; $Caudal_e = 0; // $cse[] = 0; $cse_new=[]; $l_new=0; $t_new=0; $c_new=0; $co_new=0; if ($record) { foreach ($record as $key) { if ($key->technique == 'Single Interspace Technique (Needle through Needle)') { $single = $single + 1; if ($key->ename == 'Thoracic') { $Thoracic_s = $Thoracic_s + 1; $t_new++; } if ($key->ename == 'Lumbar') { $Lumbar_s = $Lumbar_s + 1; $l_new++; } if ($key->ename == 'Cervical') { $Cervical_e = $Cervical_e + 1; $c_new++; } if ($key->ename == 'Caudal') { $Caudal_e = $Caudal_e + 1; $co_new++; } } if ($key->technique == 'Double Interspace Technique') { $double = $double + 1; if ($key->sname == 'Thoracic') { $Thoracic_s = $Thoracic_s + 1; $t_new++; } if ($key->sname == 'Lumbar') { $Lumbar_s = $Lumbar_s + 1; $l_new++; } if ($key->ename == 'Thoracic') { $Thoracic_s = $Thoracic_s + 1; $t_new++; } if ($key->ename == 'Lumbar') { $Lumbar_s = $Lumbar_s + 1; $l_new++; } if ($key->ename == 'Cervical') { $Cervical_e = $Cervical_e + 1; $c_new++; } if ($key->ename == 'Caudal') { $Caudal_e = $Caudal_e + 1; $co_new++; } } if ($key->technique == 'DPE:Dural Puncture Epidural Technique') { $dual = $dual + 1; if ($key->sname == 'Thoracic') { $Thoracic_s = $Thoracic_s + 1; $t_new++; } if ($key->sname == 'Lumbar') { $Lumbar_s = $Lumbar_s + 1; $l_new++; } if ($key->ename == 'Thoracic') { $Thoracic_s = $Thoracic_s + 1; $t_new++; } if ($key->ename == 'Lumbar') { $Lumbar_s = $Lumbar_s + 1; $l_new++; } if ($key->ename == 'Cervical') { $Cervical_e = $Cervical_e + 1; $c_new++; } if ($key->ename == 'Caudal') { $Caudal_e = $Caudal_e + 1; $co_new++; } } } } $cse_new[]=array( 'day'=>'Cervical', 'sell'=>$c_new ); $cse_new[]=array( 'day'=>'Thoracic', 'sell'=>$t_new ); $cse_new[]=array( 'day'=>'Lumbar', 'sell'=>$l_new ); $cse_new[]=array( 'day'=>'Caudal', 'sell'=>$co_new ); $new_cse=$t_new+$c_new+$l_new+$co_new; $data['cse_new']=($cse_new); $data['cse_new_total']=$new_cse; // echo $new_cse;die(); // print_r($Lumbar_s);die(); // $thoracic_comb = $Thoracic_s; // $lumbar_comb = $Lumbar_s; // $cervical_comb = $Cervical_e; // $Caudal_comb = $Caudal_e; $cse[] = array( 'day' => 'Single Interspace Technique (Needle through Needle)', 'sell' => $single ); $cse[] = array( 'day' => 'Double Interspace Technique', 'sell' => $double ); $cse[] = array( 'day' => 'DPE:Dural Puncture Epidural Technique', 'sell' => $dual ); $data['cse'] = $cse; $total4 = $single + $double + $dual; $data['total4'] = $total4; //============= consolidated ================ $thoracic0 = $Thoracic + $Thoracic1 + $Thoracic3 ; $lumbar0 = $Lumbar + $Lumbar1 + $Lumbar3 + $lumbar_comb; $Caudal0 = $Caudal1 + $Caudal_comb; $cervical0 = $Cervical1 + $cervical_com; // echo $$cervical_com;die(); $total0 = $thoracic0 + $lumbar0 + $cervical0 + $Caudal0; $consolidate[] = array( 'day' => 'Cervical', 'sell' => $cervical0 ); $consolidate[] = array( 'day' => 'Thoracic', 'sell' => $thoracic0 ); $consolidate[] = array( 'day' => 'Lumbar', 'sell' => $lumbar0 ); $consolidate[] = array( 'day' => 'Caudal', 'sell' => $Caudal0 ); // print_r($double);die(); $data['consolidate'] = $consolidate; $data['total0'] = $total0; $data['total_n'] = $total0; $data['total_e'] = $total_e; $data['total_s'] = $total_s; $data['total_cse'] = $total_cse; $data['total_csa'] = $total_csa; return view('cnb/reports/Vertebral_v', $data); } else { return redirect()->route("n_report"); } } public function Approach() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); $dr_id = session()->get('dr_id'); $n = session()->get('n'); $n_type = gettype($n); if ($from_date && $to_date) { $total = session()->get('n'); $patient_position = []; $landmark1 = 0; $landmark2 = 0; $landmark3 = 0; $approach1 = 0; $approach2 = 0; $avg_csa = 0; $avg_cse = 0; $avg_spianl = 0; $avg_epidural = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.anatomical_landmark,procedure_csa.approach,procedure_csa.no_attempts"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->anatomical_landmark == 'Easily Palpable') { $landmark1 = $landmark1 + 1; } else if ($row->anatomical_landmark == 'Poorly Palpable') { $landmark2 = $landmark2 + 1; } else if ($row->anatomical_landmark == 'Non-Palpable') { $landmark3 = $landmark3 + 1; } if ($row->approach == 'Midline') { $approach1 = $approach1 + 1; } else if ($row->approach == 'Paramedian') { $approach2 = $approach2 + 1; } if ((int) $row->no_attempts != '') { $avg_csa += $row->no_attempts; } // $avg_csa += $row->no_attempts; } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.anatomical_landmark,procedure_cse.approach,procedure_cse.no_attempts"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->anatomical_landmark == 'Easily Palpable') { $landmark1 = $landmark1 + 1; } else if ($row->anatomical_landmark == 'Poorly Palpable') { $landmark2 = $landmark2 + 1; } else if ($row->anatomical_landmark == 'Non-Palpable') { $landmark3 = $landmark3 + 1; } if ($row->approach == 'Midline') { $approach1 = $approach1 + 1; } else if ($row->approach == 'Paramedian') { $approach2 = $approach2 + 1; } if ((int) $row->no_attempts != '') { $avg_cse += $row->no_attempts; } // $avg_cse += $row->no_attempts; } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.anatomical_landmark,procedure_spinal.approach,procedure_spinal.no_attempts"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->anatomical_landmark == 'Easily Palpable') { $landmark1 = $landmark1 + 1; } else if ($row->anatomical_landmark == 'Poorly Palpable') { $landmark2 = $landmark2 + 1; } else if ($row->anatomical_landmark == 'Non-Palpable') { $landmark3 = $landmark3 + 1; } if ($row->approach == 'Midline') { $approach1 = $approach1 + 1; } else if ($row->approach == 'Paramedian') { $approach2 = $approach2 + 1; } if ((int) $row->no_attempts != '') { $avg_spinal += $row->no_attempts; } // $avg_spinal += $row->no_attempts; } } // $db = \Config\Database::connect(); // $query = $db->getLastQuery(); // echo $query; // die(); $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.anatomical_landmark,procedure_epidural.approach,procedure_epidural.no_attempts"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->anatomical_landmark == 'Easily Palpable') { $landmark1 = $landmark1 + 1; } else if ($row->anatomical_landmark == 'Poorly Palpable') { $landmark2 = $landmark2 + 1; } else if ($row->anatomical_landmark == 'Non-Palpable') { $landmark3 = $landmark3 + 1; } if ($row->approach == 'Midline') { $approach1 = $approach1 + 1; } else if ($row->approach == 'Paramedian') { $approach2 = $approach2 + 1; } if ((int) $row->no_attempts != '') { $avg_epidural += $row->no_attempts; } // $avg_epidural += $row->no_attempts; } } $products[] = array( 'day' => 'Easily Palpable', 'sell' => $landmark1 ); $products[] = array( 'day' => 'Poorly Palpable', 'sell' => $landmark2 ); $products[] = array( 'day' => 'Non-Palpable', 'sell' => $landmark3 ); $approach[] = array( 'day' => 'Midline', 'sell' => $approach1 ); $approach[] = array( 'day' => 'Paramedian', 'sell' => $approach2 ); $attempts[] = array( 'day' => 'Combined Spinal Epidural', 'sell' => $avg_cse ); $attempts[] = array( 'day' => 'Epidural alone', 'sell' => $avg_epidural ); $attempts[] = array( 'day' => 'Spinal alone', 'sell' => $avg_spinal ); $attempts[] = array( 'day' => 'CSA - Continuous SpinalAnaesthesia', 'sell' => $avg_csa ); //$query = $db->getLastQuery(); //echo (string)$query; //print_r($products); $data['products'] = ($products); $data['approach'] = ($approach); $data['attempts'] = ($attempts); $data['total'] = $approach1 + $approach2; $data['total_n'] = $total; return view('cnb/reports/approach_v', $data); } else { return redirect()->route("n_report"); } } public function no_attempts() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); $dr_id = session()->get('dr_id'); $n = session()->get('n'); $n_type = gettype($n); if ($from_date && $to_date) { $total = session()->get('n'); $patient_position = []; $landmark1 = 0; $landmark2 = 0; $landmark3 = 0; $approach1 = 0; $approach2 = 0; $avg_csa = 0; $avg_cse = 0; $avg_spinal = 0; $avg_epidural = 0; $std_csa = 0; $std_cse = 0; $std_spinal = 0; $std_epidural = 0; $total_csa = 0; $total_cse = 0; $total_spinal = 0; $total_epidural = 0; $count_csa = 0; $count_cse = 0; $count_spinal = 0; $count_epidural = 0; $builder = $db->table('cnb_postop'); // $query = $builder->select(" AVG(procedure_csa.no_attempts) as csaaverage,cnb_postop.id as count,procedure_csa.no_attempts"); $query = $builder->select("cnb_postop.id as count,procedure_csa.no_attempts"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->no_attempts > 0) { $total_csa += $row->no_attempts; $count_csa = $count_csa + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("procedure_cse.patient_id,cnb_postop.id as count,procedure_cse.no_attempts"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); // print_r($record); // print_r('<br>'); if ($record) { foreach ($record as $row) { if ($row->no_attempts > 0) { $total_cse += $row->no_attempts; $count_cse = $count_cse + 1; } } } $builder = $db->table('cnb_postop'); // $query = $builder->select("AVG(procedure_spinal.no_attempts) as spinalaverage,cnb_postop.id as count, procedure_spinal.no_attempts"); $query = $builder->select("cnb_postop.id as count, procedure_spinal.no_attempts"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->no_attempts > 0) { $total_spinal += $row->no_attempts; $count_spinal = $count_spinal + 1; } } } $builder = $db->table('cnb_postop'); // $query = $builder->select("AVG(procedure_epidural.no_attempts) as epiduralaverage, cnb_postop.id as count,procedure_epidural.no_attempts"); $query = $builder->select("cnb_postop.id as count,procedure_epidural.no_attempts"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->no_attempts > 0) { $total_epidural += $row->no_attempts; $count_epidural = $count_epidural + 1; } } } $attempts[] = array( 'day' => 'Combined Spinal Epidural', 'count' => $count_cse, 'sum' => $total_cse, ); $attempts[] = array( 'day' => 'Epidural alone', 'count' => $count_epidural, 'sum' => $total_epidural, ); $attempts[] = array( 'day' => 'Spinal alone', 'count' => $count_spinal, 'sum' => $total_spinal, ); $attempts[] = array( 'day' => 'CSA - Continuous Spinal Anaesthesia', 'count' => $count_csa, 'sum' => $total_csa, ); // print_r($attempts); // die(); $data['products'] = ($products); $data['approach'] = ($approach); $data['no_attempts'] = ($attempts); $data['total'] = $total_cse + $total_csa + $total_spinal + $total_csa; $data['total_n'] = $total_cse + $total_csa + $total_spinal + $total_csa; return view('cnb/reports/noattempts_v', $data); } else { return redirect()->route("n_report"); } } public function Technique() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, technique as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('technique'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $technique = []; foreach ($record as $row) { $technique[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['technique'] = $technique; $data['total'] = $total; // cath mark $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, cath_mark as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('cath_mark'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $cath_mark = []; foreach ($record as $row) { $cath_mark[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['cath_mark'] = $cath_mark; $data['total'] = $total; return view('cnb/reports/technique', $data); } else { return redirect()->route("n_report"); } } public function Epidural_LA_old() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); $dr_id = session()->get('dr_id'); $n = session()->get('n'); $n_type = gettype($n); // if($from_date && $to_date){ if ($from_date && $to_date) { $total = session()->get('n'); $products = []; $products1 = []; $products2 = []; $products3 = []; $ropivacaine = 0; $bupivacaine = 0; $levobupivacaine = 0; $lignocaine = 0; $ropivacaine1 = 0; $bupivacaine1 = 0; $levobupivacaine1 = 0; $lignocaine1 = 0; $combo_count1 = 0; $combo_count2 = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.la_ropivacaine,procedure_epidural.la_bupivacaine,procedure_epidural.la_levobupivacaine,procedure_epidural.la_lignocaine"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); // $query = $builder->where('cnb_postop.dr_id ',$dr_id); $query = $builder->get(); $record = $query->getResult(); // print_r($record);die(); if ($record) { foreach ($record as $row) { $combo1 = 0; $combo2 = 0; if (substr($row->la_ropivacaine, 0,7) == 'Without') { $ropivacaine = $ropivacaine + 1; $combo1 = $combo1 + 1; } else if (substr($row->la_ropivacaine, 0,4) == 'With') { $ropivacaine1 = $ropivacaine1 + 1; $combo2 = $combo2 + 1; } if (substr($row->la_bupivacaine, 0,7) == 'Without') { $bupivacaine = $bupivacaine + 1; $combo1 = $combo1 + 1; } else if (substr($row->la_bupivacaine, 0,4) == 'With') { $bupivacaine1 = $bupivacaine1 + 1; $combo2 = $combo2 + 1; } if (substr($row->la_levobupivacaine, 0,7) == 'Without') { $levobupivacaine = $levobupivacaine + 1; $combo1 = $combo1 + 1; } else if (substr($row->la_levobupivacaine, 0,4) == 'With') { $levobupivacaine1 = $levobupivacaine1 + 1; $combo2 = $combo2 + 1; } if (substr($row->la_lignocaine, 0,7) == 'Without') { $lignocaine = $lignocaine + 1; $combo1 = $combo1 + 1; } else if (substr($row->la_lignocaine, 0,4) == 'With') { $lignocaine1 = $lignocaine1 + 1; $combo2 = $combo2 + 1; } if ($combo1 > 1) { $combo_count1 = $combo_count1 + 1; } if ($combo2 > 1) { $combo_count2 = $combo_count2 + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.la_ropivacaine,procedure_cse.la_bupivacaine,procedure_cse.la_levobupivacaine,procedure_cse.la_lignocaine"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); // $query = $builder->where('cnb_postop.dr_id ',$dr_id); $query = $builder->get(); $record = $query->getResult(); // print_r($record);die(); if ($record) { foreach ($record as $row) { $combo1 = 0; $combo2 = 0; if (substr($row->la_ropivacaine, 0,7) == 'Without') { $ropivacaine = $ropivacaine + 1; $combo1 = $combo1 + 1; } else if (substr($row->la_ropivacaine, 0,4) == 'With') { $ropivacaine1 = $ropivacaine1 + 1; $combo2 = $combo2 + 1; } if (substr($row->la_bupivacaine, 0,7) == 'Without') { $bupivacaine = $bupivacaine + 1; $combo1 = $combo1 + 1; } else if (substr($row->la_bupivacaine, 0,4) == 'With') { $bupivacaine1 = $bupivacaine1 + 1; $combo2 = $combo2 + 1; } if (substr($row->la_levobupivacaine, 0,7) == 'Without') { $levobupivacaine = $levobupivacaine + 1; $combo1 = $combo1 + 1; } else if (substr($row->la_levobupivacaine, 0,4) == 'With') { $levobupivacaine1 = $levobupivacaine1 + 1; $combo2 = $combo2 + 1; } if (substr($row->la_lignocaine, 0,7) == 'Without') { $lignocaine = $lignocaine + 1; $combo1 = $combo1 + 1; } else if (substr($row->la_lignocaine, 0,4) == 'With') { $lignocaine1 = $lignocaine1 + 1; $combo2 = $combo2 + 1; } if ($combo1 > 1) { $combo_count1 = $combo_count1 + 1; } if ($combo2 > 1) { $combo_count2 = $combo_count2 + 1; } } } // print_r($ropivacaine); // die(); $products[] = array( 'day' => 'ropivacaine', 'sell' => $ropivacaine ); $products[] = array( 'day' => 'bupivacaine', 'sell' => $bupivacaine ); $products[] = array( 'day' => 'levobupivacaine', 'sell' => $levobupivacaine ); $products[] = array( 'day' => 'lignocaine', 'sell' => $lignocaine ); $products1[] = array( 'day' => 'ropivacaine', 'sell' => $ropivacaine1 ); $products1[] = array( 'day' => 'bupivacaine', 'sell' => $bupivacaine1 ); $products1[] = array( 'day' => 'levobupivacaine', 'sell' => $levobupivacaine1 ); $products1[] = array( 'day' => 'lignocaine', 'sell' => $lignocaine1 ); // print_r($products);die(); $data['total_combo'] = $combo_count1 + $combo_count2; $data['products_combo'] = ($products_combo); $data['products'] = ($products); $data['products1'] = ($products1); $data['total_n'] = $ropivacaine + $bupivacaine + $levobupivacaine + $lignocaine; $data['total_n1'] = $ropivacaine1 + $bupivacaine1 + $levobupivacaine1 + $lignocaine1; return view('cnb/reports/epiduralLA_v', $data); } else { return redirect()->route("n_report"); } } // Epidural Component Single Dose public function epidural_singledose() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { // ropivaccine $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, la_ropivacaine as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('la_ropivacaine'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $la_ropivacaine = []; foreach ($record as $row) { $la_ropivacaine[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['la_ropivacaine'] = ($la_ropivacaine); $data['total'] = $la_ropivacaine; // Bupivaccine $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, la_bupivacaine as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('la_bupivacaine'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $la_bupivacaine = []; foreach ($record as $row) { $la_bupivacaine[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['la_bupivacaine'] = ($la_bupivacaine); $data['total1'] = $la_bupivacaine; // levobupivaccine $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, la_levobupivacaine as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('la_levobupivacaine'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $la_levobupivacaine = []; foreach ($record as $row) { $la_levobupivacaine[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['la_levobupivacaine'] = ($la_levobupivacaine); $data['total2'] = $la_levobupivacaine; // ligovaccine $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, la_lignocaine as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('la_lignocaine'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $la_lignocaine = []; foreach ($record as $row) { $la_lignocaine[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['la_lignocaine'] = ($la_lignocaine); $data['total3'] = $la_lignocaine; //opiod name $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, opioid_name as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('opioid_name'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $opioid_name = []; foreach ($record as $row) { $opioid_name[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['opioid_name'] = ($opioid_name); $data['total4'] = $opioid_name; // opioid dose $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, opioid_dose as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('opioid_dose'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $opioid_dose = []; foreach ($record as $row) { $opioid_dose[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['opioid_dose'] = ($opioid_dose); $data['total5'] = $opioid_dose; // Clonidne with Dose(mcgm) $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, clonidina_dose as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('clonidina_dose'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $clonidina_dose = []; foreach ($record as $row) { $clonidina_dose[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['clonidina_dose'] = ($clonidina_dose); $data['total6'] = $clonidina_dose; // Dexmeditomidine with Dose(mcgm) $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, dexmeditomidine_dose as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('dexmeditomidine_dose'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $dexmeditomidine_dose = []; foreach ($record as $row) { $dexmeditomidine_dose[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } // $data['products'] = ($products); $data['dexmeditomidine_dose'] = ($dexmeditomidine_dose); $data['total7'] = $dexmeditomidine_dose; // Dexamethasone with Dose(mg) $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, dexmeditomidine_dose as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('dexmeditomidine_dose'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $dexmeditomidine_dose = []; foreach ($record as $row) { $dexmeditomidine_dose[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['dexmeditomidine_dose'] = ($dexmeditomidine_dose); $data['total7'] = $dexmeditomidine_dose; return view('cnb/reports/epidural_singledose_v', $data); } else { return redirect()->route("n_report"); } } public function median_sensory() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { // motor level $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, motor_level as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('motor_level'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $motor_level = []; foreach ($record as $row) { $motor_level[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['motor_level'] = ($motor_level); $data['total'] = $total; // onset of surgical_anaesthesia $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, onset as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('onset'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $onset = []; foreach ($record as $row) { $onset[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['onset'] = ($onset); $data['total'] = $total; return view('cnb/reports/median_sensory_v', $data); } else { return redirect()->route("n_report"); } } public function motor_block() { $db = \Config\Database::connect(); if ($from_date && $to_date) { $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, ac_motor_block as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('ac_motor_block'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $ac_motor_block = []; foreach ($record as $row) { $ac_motor_block[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['ac_motor_block'] = ($ac_motor_block); $data['total'] = $total; return view('cnb/reports/motor_block_v', $data); } else { return redirect()->route("n_report"); } } // Rahul public function epidural_needle() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $products = []; $other1 = []; $products1 = []; $products2 = []; $needle_type = 0; $needle_size = 0; $Touhy = 0; $Crawford = 0; $Hustead = 0; $Other = 0; $g1 = 0; $g2 = 0; $g3 = 0; $g4 = 0; $g5 = 0; $g6 = 0; $g7 = 0; $g8 = 0; $g9 = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.needle_type,procedure_epidural.needle_size,procedure_epidural.needle_type,procedure_epidural.needle_size,procedure_epidural.needle_type,procedure_epidural.needle_size"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->needle_type == 'Hustead') { $Hustead = $Hustead + 1; } else if ($row->needle_type == 'Crawford') { $Crawford = $Crawford + 1; } else if ($row->needle_type == 'Touhy') { $Touhy = $Touhy + 1; } else if (substr($row->needle_type, 0, 4) == 'Other') { $Other = $Other + 1; } if ($row->needle_size == '16G') { $g1 = $g1 + 1; } else if ($row->needle_size == '17G') { $g2 = $g2 + 1; } else if ($row->needle_size == '18G') { $g3 = $g3 + 1; } else if ($row->needle_size == '19G') { $g4 = $g4 + 1; } else if ($row->needle_size == '20G') { $g5 = $g5 + 1; } else if ($row->needle_size == '21G') { $g6 = $g6 + 1; } else if ($row->needle_size == '22G') { $g7 = $g7 + 1; } else if ($row->needle_size == '23G') { $g8 = $g8 + 1; } else if ($row->needle_size == '24G') { $g9 = $g9 + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.needle_type,procedure_cse.needle_size"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->needle_type == 'Hustead') { $Hustead = $Hustead + 1; } else if ($row->needle_type == 'Crawford') { $Crawford = $Crawford + 1; } else if ($row->needle_type == 'Touhy') { $Touhy = $Touhy + 1; } else if (substr($row->needle_type, 0, 4) == 'Other') { $Other = $Other + 1; } if ($row->needle_size == '16G') { $g1 = $g1 + 1; } else if ($row->needle_size == '17G') { $g2 = $g2 + 1; } else if ($row->needle_size == '18G') { $g3 = $g3 + 1; } else if ($row->needle_size == '19G') { $g4 = $g4 + 1; } else if ($row->needle_size == '20G') { $g5 = $g5 + 1; } else if ($row->needle_size == '21G') { $g6 = $g6 + 1; } else if ($row->needle_size == '22G') { $g7 = $g7 + 1; } else if ($row->needle_size == '23G') { $g8 = $g8 + 1; } else if ($row->needle_size == '24G') { $g9 = $g9 + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.needle_type,procedure_spinal.needle_size"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->needle_type == 'Hustead') { $Hustead = $Hustead + 1; } else if ($row->needle_type == 'Crawford') { $Crawford = $Crawford + 1; } else if ($row->needle_type == 'Touhy') { $Touhy = $Touhy + 1; } else if (substr($row->needle_type, 0, 4) == 'Other') { $Other = $Other + 1; } if ($row->needle_size == '16G') { $g1 = $g1 + 1; } else if ($row->needle_size == '17G') { $g2 = $g2 + 1; } else if ($row->needle_size == '18G') { $g3 = $g3 + 1; } else if ($row->needle_size == '19G') { $g4 = $g4 + 1; } else if ($row->needle_size == '20G') { $g5 = $g5 + 1; } else if ($row->needle_size == '21G') { $g6 = $g6 + 1; } else if ($row->needle_size == '22G') { $g7 = $g7 + 1; } else if ($row->needle_size == '23G') { $g8 = $g8 + 1; } else if ($row->needle_size == '24G') { $g9 = $g9 + 1; } } } $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.needle_type,procedure_csa.needle_size"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->needle_type == 'B-Braun') { $B_Braun = $B_Braun + 1; } else if ($row->needle_type == 'Vygon') { $Vygon = $Vygon + 1; } else if ($row->needle_type == 'Polymed') { $Polymed = $Polymed + 1; } else if ($row->needle_type == 'Portex') { $Portex = $Portex + 1; } else if ($row->needle_type == 'Top') { $Top = $Top + 1; } else if ($row->needle_type == 'BD') { $BD = $BD + 1; } else if ($row->needle_type == 'Pajunk') { $Pajunk = $Pajunk + 1; } else if ($row->needle_type == 'Romsons') { $Romsons = $Romsons + 1; } else if (substr($row->needle_type, 0, 4) == 'Other') { $Other = $Other + 1; } if ($row->needle_size == '16G') { $g1 = $g1 + 1; } else if ($row->needle_size == '17G') { $g2 = $g2 + 1; } else if ($row->needle_size == '18G') { $g3 = $g3 + 1; } else if ($row->needle_size == '19G') { $g4 = $g4 + 1; } else if ($row->needle_size == '20G') { $g5 = $g5 + 1; } else if ($row->needle_size == '21G') { $g6 = $g6 + 1; } else if ($row->needle_size == '22G') { $g7 = $g7 + 1; } else if ($row->needle_size == '23G') { $g8 = $g8 + 1; } else if ($row->needle_size == '24G') { $g9 = $g9 + 1; } } } $products[] = array( 'day' => 'Touhy', 'sell' => $Touhy ); $products[] = array( 'day' => 'Crawford', 'sell' => $Crawford ); $products[] = array( 'day' => 'Hustead ', 'sell' => $Hustead ); $products[] = array( 'day' => 'Other', 'sell' => $Other ); $other1[] = array( 'day' => '16G', 'sell' => $g1 ); $other1[] = array( 'day' => '17G', 'sell' => $g2 ); $other1[] = array( 'day' => '18G', 'sell' => $g3 ); $other1[] = array( 'day' => '19G', 'sell' => $g4 ); $other1[] = array( 'day' => '20G', 'sell' => $g5 ); $other1[] = array( 'day' => '21G', 'sell' => $g6 ); $other1[] = array( 'day' => '22G', 'sell' => $g7 ); $other1[] = array( 'day' => '23G', 'sell' => $g8 ); $other1[] = array( 'day' => '24G', 'sell' => $g9 ); $data['products'] = ($products); $data['other1'] = ($other1); $data['total'] = $total; $data['total_n'] = $total; return view('cnb/reports/epidural_needle_v', $data); } else { return redirect()->route("n_report"); } } public function spinal_needle() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('procedure_spinal'); $query = $builder->select("COUNT(id) as count"); $query = $builder->get(); $record = $query->getResult(); $total = 0; $procedure_epidural = []; foreach ($record as $row) { $total += floatval($row->count); } $data['total_n'] = $total; $builder = $db->table('procedure_spinal'); $query = $builder->select("COUNT(id) as count,needle_type as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('needle_type'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $products = []; foreach ($record as $row) { $products[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['total'] = $total; $builder = $db->table('procedure_spinal'); $query = $builder->select("COUNT(id) as count,needle_size as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('needle_size'); $query = $builder->get(); $record1 = $query->getResult(); $total = 0; $products1 = []; foreach ($record1 as $row) { $products1[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products1'] = $products1; $data['total'] = $total; return view('cnb/reports/epidural_needle_v', $data); } else { return redirect()->route("n_report"); } } public function csa_needle() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('procedure_csa'); $query = $builder->select("COUNT(id) as count"); $query = $builder->get(); $record = $query->getResult(); $total = 0; $procedure_epidural = []; foreach ($record as $row) { $total += floatval($row->count); } $data['total_n'] = $total; $builder = $db->table('procedure_csa'); $query = $builder->select("COUNT(id) as count,needle_type as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('needle_type'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $products = []; foreach ($record as $row) { $products[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['total'] = $total; $builder = $db->table('procedure_csa'); $query = $builder->select("COUNT(id) as count,needle_size as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('needle_size'); $query = $builder->get(); $record1 = $query->getResult(); $total = 0; $products1 = []; foreach ($record1 as $row) { $products1[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products1'] = $products1; $data['total'] = $total; return view('cnb/reports/csa_needle_v', $data); } else { return redirect()->route("n_report"); } } public function epidural_adjuvant() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total11 = 0; $total12 = 0; $all_total1 = 0; $builder = $db->table('procedure_epidural'); $query = $builder->select("count(opioid_dose) as NO"); $query = $builder->where('opioid_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record3 = $query->getResult(); foreach ($record3 as $row) { $opioid_dose3 = $row->NO; $total11 += floatval($row->NO); $all_total1 += floatval($row->NO); } $opioide[] = array( 'day' => 'NO', 'sell' => $opioid_dose3, ); $builder = $db->table('procedure_epidural'); $query = $builder->select("count(opioid_dose) as YES"); $query = $builder->where('opioid_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record2 = $query->getResult(); foreach ($record2 as $row) { $opioid_dose = $row->YES; $total12 += floatval($row->YES); $all_total1 += floatval($row->YES); } $opioide[] = array( 'day' => 'YES', 'sell' => $opioid_dose ); $o_number1 = (($total11 / $all_total1) * 100); $o_number2 = (($total12 / $all_total1) * 100); $data['o_perc1'] = number_format((float) $o_number1, 2, '.', '') . "%"; $data['o_perc2'] = number_format((float) $o_number2, 2, '.', '') . "%"; $data['total11'] = $total11; $data['total12'] = $total12; $data['opioide'] = ($opioide); // ---------------------------OPIOIDE ADJUVANT---------------------- $total21 = 0; $total22 = 0; $all_total2 = 0; $builder = $db->table('procedure_epidural'); $query = $builder->select("count(clonidina_dose) as NO"); $query = $builder->where('clonidina_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record4 = $query->getResult(); foreach ($record4 as $row) { $clonidina_dose = $row->NO; $total21 += floatval($row->NO); $all_total2 += floatval($row->NO); } $clonidina[] = array( 'day' => 'NO', 'sell' => $clonidina_dose ); $builder = $db->table('procedure_epidural'); $query = $builder->select("count(clonidina_dose) as YES"); $query = $builder->where('clonidina_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record5 = $query->getResult(); foreach ($record5 as $row) { $clonidina_dose = $row->YES; $total22 += floatval($row->YES); $all_total2 += floatval($row->YES); } $clonidina[] = array( 'day' => 'YES', 'sell' => $clonidina_dose ); $c_number1 = (($total21 / $all_total2) * 100); $c_number2 = (($total22 / $all_total2) * 100); $data['c_perc1'] = number_format((float) $c_number1, 2, '.', '') . "%"; $data['c_perc2'] = number_format((float) $c_number2, 2, '.', '') . "%"; $data['total21'] = $total21; $data['total22'] = $total22; $data['clonidina'] = ($clonidina); // print_r($data);die(); // ---------------------------dexmeditomidine ADJUVANT---------------------- $total31 = 0; $total32 = 0; $all_total3 = 0; $builder = $db->table('procedure_epidural'); $query = $builder->select("count(dexmeditomidine_dose) as NO"); $query = $builder->where('dexmeditomidine_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record6 = $query->getResult(); foreach ($record6 as $row) { $dexmeditomidine_dose = $row->NO; $total31 += floatval($row->NO); $all_total3 += floatval($row->NO); } $dexmeditomidine[] = array( 'day' => 'NO', 'sell' => $dexmeditomidine_dose ); $builder = $db->table('procedure_epidural'); $query = $builder->select("count(dexmeditomidine_dose) as YES"); $query = $builder->where('dexmeditomidine_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record7 = $query->getResult(); foreach ($record7 as $row) { $dexmeditomidine_dose = $row->YES; $total32 += floatval($row->YES); $all_total3 += floatval($row->YES); } $dexmeditomidine[] = array( 'day' => 'YES', 'sell' => $dexmeditomidine_dose ); $de_number1 = (($total31 / $all_total3) * 100); $de_number2 = (($total32 / $all_total3) * 100); $data['de_perc1'] = number_format((float) $de_number1, 2, '.', '') . "%"; $data['de_perc2'] = number_format((float) $de_number2, 2, '.', '') . "%"; $data['total31'] = $total31; $data['total32'] = $total32; $data['dexmeditomidine'] = ($dexmeditomidine); // ---------------------------dexamephasone ADJUVANT---------------------- $total41 = 0; $total42 = 0; $all_total4 = 0; $builder = $db->table('procedure_epidural'); $query = $builder->select("count(dexamephasone_dose) as NO"); $query = $builder->where('dexamephasone_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record8 = $query->getResult(); foreach ($record8 as $row) { $dexamephasone_dose = $row->NO; $total41 += floatval($row->NO); $all_total4 += floatval($row->NO); } $dexamephasone[] = array( 'day' => 'NO', 'sell' => $dexamephasone_dose ); $builder = $db->table('procedure_epidural'); $query = $builder->select("count(dexamephasone_dose) as YES"); $query = $builder->where('dexamephasone_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record9 = $query->getResult(); foreach ($record9 as $row) { $dexamephasone_dose = $row->YES; $total42 += floatval($row->YES); $all_total4 += floatval($row->YES); } $dexamephasone[] = array( 'day' => 'YES', 'sell' => $dexamephasone_dose ); $da_number1 = (($total41 / $all_total4) * 100); $da_number2 = (($total42 / $all_total4) * 100); $data['da_perc1'] = number_format((float) $da_number1, 2, '.', '') . "%"; $data['da_perc2'] = number_format((float) $da_number2, 2, '.', '') . "%"; $data['total41'] = $total41; $data['total42'] = $total42; $data['dexamephasone'] = ($dexamephasone); // ---------------------------tramadol ADJUVANT---------------------- $total51 = 0; $total52 = 0; $all_total5 = 0; $builder = $db->table('procedure_epidural'); $query = $builder->select("count(tramadol_dose) as NO"); $query = $builder->where('tramadol_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record10 = $query->getResult(); foreach ($record10 as $row) { $tramadol_dose = $row->NO; $total51 += floatval($row->NO); $all_total5 += floatval($row->NO); } $tramadol[] = array( 'day' => 'NO', 'sell' => $tramadol_dose ); $builder = $db->table('procedure_epidural'); $query = $builder->select("count(tramadol_dose) as YES"); $query = $builder->where('tramadol_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record11 = $query->getResult(); foreach ($record11 as $row) { $tramadol_dose = $row->YES; $total52 += floatval($row->YES); $all_total5 += floatval($row->YES); } $tramadol[] = array( 'day' => 'YES', 'sell' => $tramadol_dose ); $t_number1 = (($total51 / $all_total5) * 100); $t_number2 = (($total52 / $all_total5) * 100); $data['t_perc1'] = number_format((float) $t_number1, 2, '.', '') . "%"; $data['t_perc2'] = number_format((float) $t_number2, 2, '.', '') . "%"; $data['total51'] = $total51; $data['total52'] = $total52; $data['tramadol'] = ($tramadol); // ---------------------------kepamine ADJUVANT---------------------- $total61 = 0; $total62 = 0; $all_total6 = 0; $builder = $db->table('procedure_epidural'); $query = $builder->select("count(kepamine_dose) as NO"); $query = $builder->where('kepamine_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record12 = $query->getResult(); foreach ($record12 as $row) { $kepamine_dose = $row->NO; $total61 += floatval($row->NO); $all_total6 += floatval($row->NO); } $kepamine[] = array( 'day' => 'NO', 'sell' => $kepamine_dose ); $builder = $db->table('procedure_epidural'); $query = $builder->select("count(kepamine_dose) as YES"); $query = $builder->where('kepamine_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record13 = $query->getResult(); foreach ($record13 as $row) { $kepamine_dose = $row->YES; $total62 += floatval($row->YES); $all_total6 += floatval($row->YES); } $kepamine[] = array( 'day' => 'YES', 'sell' => $kepamine_dose ); $k_number1 = (($total61 / $all_total6) * 100); $k_number2 = (($total62 / $all_total6) * 100); $data['k_perc1'] = number_format((float) $k_number1, 2, '.', '') . "%"; $data['k_perc2'] = number_format((float) $k_number2, 2, '.', '') . "%"; $data['total61'] = $total61; $data['total62'] = $total62; $data['kepamine'] = ($kepamine); // ---------------------------midazolam ADJUVANT---------------------- $total71 = 0; $total72 = 0; $all_total7 = 0; $builder = $db->table('procedure_epidural'); $query = $builder->select("count(midazolam_dose) as NO"); $query = $builder->where('midazolam_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record14 = $query->getResult(); foreach ($record14 as $row) { $midazolam_dose = $row->NO; $total71 += floatval($row->NO); $all_total7 += floatval($row->NO); } $midazolam[] = array( 'day' => 'NO', 'sell' => $midazolam_dose ); $builder = $db->table('procedure_epidural'); $query = $builder->select("count(midazolam_dose) as YES"); $query = $builder->where('midazolam_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record15 = $query->getResult(); foreach ($record15 as $row) { $midazolam_dose = $row->YES; $total72 += floatval($row->YES); $all_total7 += floatval($row->YES); } $midazolam[] = array( 'day' => 'YES', 'sell' => $midazolam_dose ); $m_number1 = (($total71 / $all_total7) * 100); $m_number2 = (($total72 / $all_total7) * 100); $data['m_perc1'] = number_format((float) $m_number1, 2, '.', '') . "%"; $data['m_perc2'] = number_format((float) $m_number2, 2, '.', '') . "%"; $data['total71'] = $total71; $data['total72'] = $total72; $data['midazolam'] = ($midazolam); // ---------------------------other ADJUVANT---------------------- $total81 = 0; $total82 = 0; $all_total8 = 0; $builder = $db->table('procedure_epidural'); $query = $builder->select("count(other7) as NO"); $query = $builder->where('other7 ', 'NO'); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record16 = $query->getResult(); foreach ($record16 as $row) { $other7 = $row->NO; $total81 += floatval($row->NO); $all_total8 += floatval($row->NO); } $other[] = array( 'day' => 'NO', 'sell' => $other7 ); $builder = $db->table('procedure_epidural'); $query = $builder->select("count(other7) as YES"); $query = $builder->where('other7 ', 'YES'); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record17 = $query->getResult(); foreach ($record17 as $row) { $other7 = $row->YES; $total82 += floatval($row->YES); $all_total8 += floatval($row->YES); } $other[] = array( 'day' => 'YES', 'sell' => $other7 ); $oth_number1 = (($total81 / $all_total8) * 100); $oth_number2 = (($total82 / $all_total8) * 100); $data['oth_perc1'] = number_format((float) $oth_number1, 2, '.', '') . "%"; $data['oth_perc2'] = number_format((float) $oth_number2, 2, '.', '') . "%"; $data['total81'] = $total81; $data['total82'] = $total82; $data['other'] = ($other); return view('cnb/reports/epidural_adjuvant_v', $data); } else { return redirect()->route("n_report"); } } public function component_adjuvant() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $none = 0; $opioid = 0; $clonidine = 0; $dexmeditomidine = 0; $dexamethasone = 0; $tramadol = 0; $ketamine = 0; $midazolam = 0; $adrenaline = 0; $other = 0; // ------------------------------CSE------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.opioid_name, procedure_cse.clonidina_dose, procedure_cse.dexmeditomidine_dose, procedure_cse.dexamephasone_dose, procedure_cse.trmadol_dose,procedure_cse.kepamine_dose, procedure_cse.midazolam_dose, procedure_cse.adrenaline_dose, procedure_cse.aj_epidural_other, procedure_cse.aj_spinal_opioid, procedure_cse.aj_spinal_clonidne, procedure_cse.aj_spinal_dexmeditomidine, procedure_cse.aj_spinal_dexamethasone, procedure_cse.aj_spinal_tramadol, procedure_cse.aj_spinal_adrenaline, procedure_cse.aj_spinal_other"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); // print_r($record);die(); if ($record) { foreach ($record as $row) { if ($row->opioid_name != '') { $opioid = $opioid + 1; } if ($row->clonidina_dose != '') { $clonidine = $clonidine + 1; } if ($row->dexmeditomidine_dose != '') { $dexmeditomidine = $dexmeditomidine + 1; } if ($row->dexamephasone_dose != '') { $dexamethasone = $dexamethasone + 1; } if ($row->trmadol_dose != '') { $tramadol = $tramadol + 1; } if ($row->kepamine_dose != '') { $ketamine = $ketamine + 1; } if ($row->midazolam_dose != '') { $midazolam = $midazolam + 1; } if ($row->adrenaline_dose != '') { $adrenaline = $adrenaline + 1; } $aj_epidural_other = json_decode($row->aj_epidural_other); $ep_name = 0; foreach ($aj_epidural_other as $val) { if ($val->name != '') { $ep_name += 1; } } if ($ep_name > 0) { $other = $other + 1; } if ($row->aj_spinal_opioid != '') { $opioid = $opioid + 1; } if ($row->aj_spinal_clonidne != '') { $clonidine = $clonidine + 1; } if ($row->aj_spinal_dexmeditomidine != '') { $dexmeditomidine = $dexmeditomidine + 1; } if ($row->aj_spinal_dexamethasone != '') { $dexamethasone = $dexamethasone + 1; } if ($row->aj_spinal_tramadol != '') { $tramadol = $tramadol + 1; } if ($row->aj_spinal_adrenaline != '') { $adrenaline = $adrenaline + 1; } $aj_spinal_other = json_decode($row->aj_spinal_other); $sp_name = 0; foreach ($aj_spinal_other as $val) { if ($val->name != '') { $sp_name += 1; } } if ($sp_name > 0) { $other = $other + 1; } if ($row->opioid_name == '' && $row->clonidina_dose == '' && $row->dexmeditomidine_dose == '' && $row->dexamephasone_dose == '' && $row->trmadol_dose == '' && $row->kepamine_dose == '' && $row->midazolam_dose == '' && $row->adrenaline_dose == '' && $sp_name == 0 && $ep_name == 0 && $row->aj_spinal_opioid == '' && $row->aj_spinal_clonidne == '' && $row->aj_spinal_dexmeditomidine == '' && $row->aj_spinal_dexamethasone == '' && $row->aj_spinal_tramadol == '' && $row->aj_spinal_adrenaline == '') { $none = $none + 1; } } } // ------------------------------EPIDURAL------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.opioid_name, procedure_epidural.clonidina_dose, procedure_epidural.dexmeditomidine_dose, procedure_epidural.dexamephasone_dose, procedure_epidural.tramadol_dose,procedure_epidural.kepamine_dose, procedure_epidural.midazolam_dose,procedure_epidural.other7"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->opioid_name == '' && $row->clonidina_dose == '' && $row->dexmeditomidine_dose == '' && $row->dexamephasone_dose == '' && $row->tramadol_dose == '' && $row->kepamine_dose == '' && $row->midazolam_dose == '' && $row->other7 == 'No') { $none = $none + 1; } if ($row->opioid_name != '') { $opioid = $opioid + 1; } if ($row->clonidina_dose != '') { $clonidine = $clonidine + 1; } if ($row->dexmeditomidine_dose != '') { $dexmeditomidine = $dexmeditomidine + 1; } if ($row->dexamephasone_dose != '') { $dexamethasone = $dexamethasone + 1; } if ($row->tramadol_dose != '') { $tramadol = $tramadol + 1; } if ($row->kepamine_dose != '') { $ketamine = $ketamine + 1; } if ($row->midazolam_dose != '') { $midazolam = $midazolam + 1; } if ($row->other7 == 'Yes') { $other = $other + 1; } } } // ------------------------------SPINAL------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.opioid_name, procedure_spinal.clonidina_dose, procedure_spinal.dexmeditomidine_dose, procedure_spinal.dexamephasone_dose, procedure_spinal.tramadol_dose, procedure_spinal.ketamine_dose, procedure_spinal.midazolam_dose,procedure_spinal.adrenaline_dose,procedure_spinal.other7"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->opioid_name == '' && $row->clonidina_dose == '' && $row->dexmeditomidine_dose == '' && $row->dexamephasone_dose == '' && $row->tramadol_dose == '' && $row->ketamine_dose == '' && $row->midazolam_dose == '' && $row->adrenaline_dose == '' && $row->other7 == 'No') { $none = $none + 1; } if ($row->opioid_name != '') { $opioid = $opioid + 1; } if ($row->clonidina_dose != '') { $clonidine = $clonidine + 1; } if ($row->dexmeditomidine_dose != '') { $dexmeditomidine = $dexmeditomidine + 1; } if ($row->dexamephasone_dose != '') { $dexamethasone = $dexamethasone + 1; } if ($row->tramadol_dose != '') { $tramadol = $tramadol + 1; } if ($row->ketamine_dose != '') { $ketamine = $ketamine + 1; } if ($row->midazolam_dose != '') { $midazolam = $midazolam + 1; } if ($row->adrenaline_dose != '') { $adrenaline = $adrenaline + 1; } if ($row->other7 == 'Yes') { $other = $other + 1; } } } // ------------------------------CSA------------------- $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.opioid_aj, procedure_csa.clonidne_aj, procedure_csa.dexmeditomidine_aj, procedure_csa.dexamethasone_aj, procedure_csa.tramadol_aj, procedure_csa.ketamine_aj, procedure_csa.midazolam_aj,procedure_csa.adrenaline_aj,procedure_csa.other_aj_name_dose"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { if ($row->opioid_aj == 'Yes') { $opioid = $opioid + 1; } if ($row->clonidne_aj != '') { $clonidine = $clonidine + 1; } if ($row->dexmeditomidine_aj != '') { $dexmeditomidine = $dexmeditomidine + 1; } if ($row->dexamethasone_aj != '') { $dexamethasone = $dexamethasone + 1; } if ($row->tramadol_aj != '') { $tramadol = $tramadol + 1; } if ($row->ketamine_aj != '') { $ketamine = $ketamine + 1; } if ($row->midazolam_aj != '') { $midazolam = $midazolam + 1; } if ($row->adrenaline_aj != '') { $adrenaline = $adrenaline + 1; } $other_aj_name_dose = json_decode($row->other_aj_name_dose); $csa_name = 0; foreach ($other_aj_name_dose as $val) { if ($val->name != '') { $csa_name += 1; } } if ($csa_name > 0) { $other = $other + 1; } if ($row->opioid_aj == 'No' && $row->clonidne_aj == '' && $row->dexmeditomidine_aj == '' && $row->dexamethasone_aj == '' && $row->tramadol_aj == '' && $row->ketamine_aj == '' && $row->midazolam_aj == '' && $row->adrenaline_aj == '' && $csa_name == 0) { $none = $none + 1; } } } $total = session()->get('n'); // $none = 0; // $opioid = 0; // $clonidine = 0; // $dexmeditomidine = 0; // $dexamethasone = 0; // $tramadol = 0; // $ketamine = 0; // $midazolam = 0; // $adrenaline = 0; // $other = 0; $total_no = $none + $opioid + $clonidine + $dexmeditomidine + $dexamethasone + $tramadol + $ketamine + $midazolam + $adrenaline + $other; $products[] = array( 'day' => 'None', 'sell' => $none, // 'perc' => number_format((float)(($none/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Opioid', 'sell' => $opioid, // 'perc' => number_format((float)(($opioid/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Clonidine', 'sell' => $clonidine, // 'perc' => number_format((float)(($clonidine/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Dexmeditomidine', 'sell' => $dexmeditomidine, // 'perc' => number_format((float)(($dexmeditomidine/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Dexamethasone', 'sell' => $dexamethasone, // 'perc' => number_format((float)(($dexamethasone/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Tramadol', 'sell' => $tramadol, // 'perc' => number_format((float)(($tramadol/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Ketamine', 'sell' => $ketamine, // 'perc' => number_format((float)(($ketamine/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Midazolam ', 'sell' => $midazolam, // 'perc' => number_format((float)(($midazolam/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Adrenaline', 'sell' => $adrenaline, // 'perc' => number_format((float)(($adrenaline/$total)*100), 1, '.', '')."%", ); $products[] = array( 'day' => 'Other', 'sell' => $other, // 'perc' => number_format((float)(($other/$total)*100), 1, '.', '')."%", ); $data['products'] = $products; $data['total'] = $total; return view('cnb/reports/component_adjuvant_v', $data); } else { return redirect()->route("n_report"); } } public function spinal_adjuvant() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total11 = 0; $total12 = 0; $all_total1 = 0; $builder = $db->table('procedure_spinal'); $query = $builder->select("count(opioid_dose) as NO"); $query = $builder->where('opioid_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record3 = $query->getResult(); foreach ($record3 as $row) { $opioid_dose3 = $row->NO; $total11 += floatval($row->NO); $all_total1 += floatval($row->NO); } $opioide[] = array( 'day' => 'NO', 'sell' => $opioid_dose3 ); $builder = $db->table('procedure_spinal'); $query = $builder->select("count(opioid_dose) as YES"); $query = $builder->where('opioid_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record2 = $query->getResult(); foreach ($record2 as $row) { $opioid_dose = $row->YES; $total12 += floatval($row->YES); $all_total1 += floatval($row->YES); } $opioide[] = array( 'day' => 'YES', 'sell' => $opioid_dose ); $o_number1 = (($total11 / $all_total1) * 100); $o_number2 = (($total12 / $all_total1) * 100); $data['o_perc1'] = number_format((float) $o_number1, 2, '.', '') . "%"; $data['o_perc2'] = number_format((float) $o_number2, 2, '.', '') . "%"; $data['total11'] = $total11; $data['total12'] = $total12; $data['opioide'] = ($opioide); // ---------------------------OPIOIDE ADJUVANT---------------------- $total21 = 0; $total22 = 0; $all_total2 = 0; $builder = $db->table('procedure_spinal'); $query = $builder->select("count(clonidina_dose) as NO"); $query = $builder->where('clonidina_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record4 = $query->getResult(); foreach ($record4 as $row) { $clonidina_dose = $row->NO; $total21 += floatval($row->NO); $all_total2 += floatval($row->NO); } $clonidina[] = array( 'day' => 'NO', 'sell' => $clonidina_dose ); $builder = $db->table('procedure_spinal'); $query = $builder->select("count(clonidina_dose) as YES"); $query = $builder->where('clonidina_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record5 = $query->getResult(); foreach ($record5 as $row) { $clonidina_dose = $row->YES; $total22 += floatval($row->YES); $all_total2 += floatval($row->YES); } $clonidina[] = array( 'day' => 'YES', 'sell' => $clonidina_dose ); $c_number1 = (($total21 / $all_total2) * 100); $c_number2 = (($total22 / $all_total2) * 100); $data['c_perc1'] = number_format((float) $c_number1, 2, '.', '') . "%"; $data['c_perc2'] = number_format((float) $c_number2, 2, '.', '') . "%"; $data['total21'] = $total21; $data['total22'] = $total22; $data['clonidina'] = ($clonidina); // ---------------------------dexmeditomidine ADJUVANT---------------------- $total31 = 0; $total32 = 0; $all_total3 = 0; $builder = $db->table('procedure_spinal'); $query = $builder->select("count(dexmeditomidine_dose) as NO"); $query = $builder->where('dexmeditomidine_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record6 = $query->getResult(); foreach ($record6 as $row) { $dexmeditomidine_dose = $row->NO; $total31 += floatval($row->NO); $all_total3 += floatval($row->NO); } $dexmeditomidine[] = array( 'day' => 'NO', 'sell' => $dexmeditomidine_dose ); $builder = $db->table('procedure_spinal'); $query = $builder->select("count(dexmeditomidine_dose) as YES"); $query = $builder->where('dexmeditomidine_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record7 = $query->getResult(); foreach ($record7 as $row) { $dexmeditomidine_dose = $row->YES; $total32 += floatval($row->YES); $all_total3 += floatval($row->YES); } $dexmeditomidine[] = array( 'day' => 'YES', 'sell' => $dexmeditomidine_dose ); $de_number1 = (($total31 / $all_total3) * 100); $de_number2 = (($total32 / $all_total3) * 100); $data['de_perc1'] = number_format((float) $de_number1, 2, '.', '') . "%"; $data['de_perc2'] = number_format((float) $de_number2, 2, '.', '') . "%"; $data['total31'] = $total31; $data['total32'] = $total32; $data['dexmeditomidine'] = ($dexmeditomidine); // ---------------------------dexamephasone ADJUVANT---------------------- $total41 = 0; $total42 = 0; $all_total4 = 0; $builder = $db->table('procedure_spinal'); $query = $builder->select("count(dexamephasone_dose) as NO"); $query = $builder->where('dexamephasone_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record8 = $query->getResult(); foreach ($record8 as $row) { $dexamephasone_dose = $row->NO; $total41 += floatval($row->NO); $all_total4 += floatval($row->NO); } $dexamephasone[] = array( 'day' => 'NO', 'sell' => $dexamephasone_dose ); $builder = $db->table('procedure_spinal'); $query = $builder->select("count(dexamephasone_dose) as YES"); $query = $builder->where('dexamephasone_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record9 = $query->getResult(); foreach ($record9 as $row) { $dexamephasone_dose = $row->YES; $total42 += floatval($row->YES); $all_total4 += floatval($row->YES); } $dexamephasone[] = array( 'day' => 'YES', 'sell' => $dexamephasone_dose ); $da_number1 = (($total41 / $all_total4) * 100); $da_number2 = (($total42 / $all_total4) * 100); $data['da_perc1'] = number_format((float) $da_number1, 2, '.', '') . "%"; $data['da_perc2'] = number_format((float) $da_number2, 2, '.', '') . "%"; $data['total41'] = $total41; $data['total42'] = $total42; $data['dexamephasone'] = ($dexamephasone); // ---------------------------tramadol ADJUVANT---------------------- $total51 = 0; $total52 = 0; $all_total5 = 0; $builder = $db->table('procedure_spinal'); $query = $builder->select("count(tramadol_dose) as NO"); $query = $builder->where('tramadol_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record10 = $query->getResult(); foreach ($record10 as $row) { $tramadol_dose = $row->NO; $total51 += floatval($row->NO); $all_total5 += floatval($row->NO); } $tramadol[] = array( 'day' => 'NO', 'sell' => $tramadol_dose ); $builder = $db->table('procedure_spinal'); $query = $builder->select("count(tramadol_dose) as YES"); $query = $builder->where('tramadol_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record11 = $query->getResult(); foreach ($record11 as $row) { $tramadol_dose = $row->YES; $total52 += floatval($row->YES); $all_total5 += floatval($row->YES); } $tramadol[] = array( 'day' => 'YES', 'sell' => $tramadol_dose ); $t_number1 = (($total51 / $all_total5) * 100); $t_number2 = (($total52 / $all_total5) * 100); $data['t_perc1'] = number_format((float) $t_number1, 2, '.', '') . "%"; $data['t_perc2'] = number_format((float) $t_number2, 2, '.', '') . "%"; $data['total51'] = $total51; $data['total52'] = $total52; $data['tramadol'] = ($tramadol); // ---------------------------kepamine ADJUVANT---------------------- $total61 = 0; $total62 = 0; $all_total6 = 0; $builder = $db->table('procedure_spinal'); $query = $builder->select("count(ketamine_dose) as NO"); $query = $builder->where('ketamine_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record12 = $query->getResult(); foreach ($record12 as $row) { $ketamine_dose = $row->NO; $total61 += floatval($row->NO); $all_total6 += floatval($row->NO); } $ketamine[] = array( 'day' => 'NO', 'sell' => $ketamine_dose ); $builder = $db->table('procedure_spinal'); $query = $builder->select("count(ketamine_dose) as YES"); $query = $builder->where('ketamine_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record13 = $query->getResult(); foreach ($record13 as $row) { $ketamine_dose = $row->YES; $total62 += floatval($row->YES); $all_total6 += floatval($row->YES); } $ketamine[] = array( 'day' => 'YES', 'sell' => $ketamine_dose ); $k_number1 = (($total61 / $all_total6) * 100); $k_number2 = (($total62 / $all_total6) * 100); $data['k_perc1'] = number_format((float) $k_number1, 2, '.', '') . "%"; $data['k_perc2'] = number_format((float) $k_number2, 2, '.', '') . "%"; $data['total61'] = $total61; $data['total62'] = $total62; $data['ketamine'] = ($ketamine); // ---------------------------midazolam ADJUVANT---------------------- $total71 = 0; $total72 = 0; $all_total7 = 0; $builder = $db->table('procedure_spinal'); $query = $builder->select("count(midazolam_dose) as NO"); $query = $builder->where('midazolam_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record14 = $query->getResult(); foreach ($record14 as $row) { $midazolam_dose = $row->NO; $total71 += floatval($row->NO); $all_total7 += floatval($row->NO); } $midazolam[] = array( 'day' => 'NO', 'sell' => $midazolam_dose ); $builder = $db->table('procedure_spinal'); $query = $builder->select("count(midazolam_dose) as YES"); $query = $builder->where('midazolam_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record15 = $query->getResult(); foreach ($record15 as $row) { $midazolam_dose = $row->YES; $total72 += floatval($row->YES); $all_total7 += floatval($row->YES); } $midazolam[] = array( 'day' => 'YES', 'sell' => $midazolam_dose ); $m_number1 = (($total71 / $all_total7) * 100); $m_number2 = (($total72 / $all_total7) * 100); $data['m_perc1'] = number_format((float) $m_number1, 2, '.', '') . "%"; $data['m_perc2'] = number_format((float) $m_number2, 2, '.', '') . "%"; $data['total71'] = $total71; $data['total72'] = $total72; $data['midazolam'] = ($midazolam); // ---------------------------midazolam ADJUVANT---------------------- $total91 = 0; $total92 = 0; $all_total9 = 0; $builder = $db->table('procedure_spinal'); $query = $builder->select("count(adrenaline_dose) as NO"); $query = $builder->where('adrenaline_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record18 = $query->getResult(); foreach ($record18 as $row) { $adrenaline_dose = $row->NO; $total91 += floatval($row->NO); $all_total9 += floatval($row->NO); } $adrenaline[] = array( 'day' => 'NO', 'sell' => $adrenaline_dose ); $builder = $db->table('procedure_spinal'); $query = $builder->select("count(adrenaline_dose) as YES"); $query = $builder->where('adrenaline_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record19 = $query->getResult(); foreach ($record19 as $row) { $adrenaline_dose = $row->YES; $total92 += floatval($row->YES); $all_total9 += floatval($row->YES); } $adrenaline[] = array( 'day' => 'YES', 'sell' => $adrenaline_dose ); $a_number1 = (($total91 / $all_total9) * 100); $a_number2 = (($total92 / $all_total9) * 100); $data['a_perc1'] = number_format((float) $a_number1, 2, '.', '') . "%"; $data['a_perc2'] = number_format((float) $a_number2, 2, '.', '') . "%"; $data['total91'] = $total91; $data['total92'] = $total92; $data['adrenaline'] = ($adrenaline); // ---------------------------other ADJUVANT---------------------- $total81 = 0; $total82 = 0; $all_total8 = 0; $builder = $db->table('procedure_spinal'); $query = $builder->select("count(other7) as NO"); $query = $builder->where('other7 ', 'NO'); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record16 = $query->getResult(); foreach ($record16 as $row) { $other7 = $row->NO; $total81 += floatval($row->NO); $all_total8 += floatval($row->NO); } $other[] = array( 'day' => 'NO', 'sell' => $other7 ); $builder = $db->table('procedure_spinal'); $query = $builder->select("count(other7) as YES"); $query = $builder->where('other7 ', 'YES'); $query = $builder->get(); $record17 = $query->getResult(); foreach ($record17 as $row) { $other7 = $row->YES; $total82 += floatval($row->YES); $all_total8 += floatval($row->YES); } $other[] = array( 'day' => 'YES', 'sell' => $other7 ); $oth_number1 = (($total81 / $all_total8) * 100); $oth_number2 = (($total82 / $all_total8) * 100); $data['oth_perc1'] = number_format((float) $oth_number1, 2, '.', '') . "%"; $data['oth_perc2'] = number_format((float) $oth_number2, 2, '.', '') . "%"; $data['total81'] = $total81; $data['total82'] = $total82; $data['other'] = ($other); return view('cnb/reports/spinal_adjuvant_v', $data); } else { return redirect()->route("n_report"); } } public function csa_adjuvant() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total11 = 0; $total12 = 0; $all_total1 = 0; $builder = $db->table('procedure_csa'); $query = $builder->select("count(opioid_aj) as NO"); $query = $builder->where('opioid_aj ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record3 = $query->getResult(); foreach ($record3 as $row) { $opioid_dose3 = $row->NO; $total11 += floatval($row->NO); $all_total1 += floatval($row->NO); } $opioide[] = array( 'day' => 'NO', 'sell' => $opioid_dose3 ); $builder = $db->table('procedure_csa'); $query = $builder->select("count(opioid_aj) as YES"); $query = $builder->where('opioid_aj !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record2 = $query->getResult(); foreach ($record2 as $row) { $opioid_dose = $row->YES; $total12 += floatval($row->YES); $all_total1 += floatval($row->YES); } $opioide[] = array( 'day' => 'YES', 'sell' => $opioid_dose ); $o_number1 = (($total11 / $all_total1) * 100); $o_number2 = (($total12 / $all_total1) * 100); $data['o_perc1'] = number_format((float) $o_number1, 2, '.', '') . "%"; $data['o_perc2'] = number_format((float) $o_number2, 2, '.', '') . "%"; $data['total11'] = $total11; $data['total12'] = $total12; $data['opioide'] = ($opioide); // ---------------------------OPIOIDE ADJUVANT---------------------- $total21 = 0; $total22 = 0; $all_total2 = 0; $builder = $db->table('procedure_csa'); $query = $builder->select("count(clonidne_aj) as NO"); $query = $builder->where('clonidne_aj ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record4 = $query->getResult(); foreach ($record4 as $row) { $clonidina_dose = $row->NO; $total21 += floatval($row->NO); $all_total2 += floatval($row->NO); } $clonidina[] = array( 'day' => 'NO', 'sell' => $clonidina_dose ); $builder = $db->table('procedure_csa'); $query = $builder->select("count(clonidne_aj) as YES"); $query = $builder->where('clonidne_aj !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record5 = $query->getResult(); foreach ($record5 as $row) { $clonidina_dose = $row->YES; $total22 += floatval($row->YES); $all_total2 += floatval($row->YES); } $clonidina[] = array( 'day' => 'YES', 'sell' => $clonidina_dose ); $c_number1 = (($total21 / $all_total2) * 100); $c_number2 = (($total22 / $all_total2) * 100); $data['c_perc1'] = number_format((float) $c_number1, 2, '.', '') . "%"; $data['c_perc2'] = number_format((float) $c_number2, 2, '.', '') . "%"; $data['total21'] = $total21; $data['total22'] = $total22; $data['clonidina'] = ($clonidina); // ---------------------------dexmeditomidine ADJUVANT---------------------- $total31 = 0; $total32 = 0; $all_total3 = 0; $builder = $db->table('procedure_csa'); $query = $builder->select("count(dexmeditomidine_aj) as NO"); $query = $builder->where('dexmeditomidine_aj ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record6 = $query->getResult(); foreach ($record6 as $row) { $dexmeditomidine_dose = $row->NO; $total31 += floatval($row->NO); $all_total3 += floatval($row->NO); } $dexmeditomidine[] = array( 'day' => 'NO', 'sell' => $dexmeditomidine_dose ); $builder = $db->table('procedure_csa'); $query = $builder->select("count(dexmeditomidine_aj) as YES"); $query = $builder->where('dexmeditomidine_aj !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record7 = $query->getResult(); foreach ($record7 as $row) { $dexmeditomidine_dose = $row->YES; $total32 += floatval($row->YES); $all_total3 += floatval($row->YES); } $dexmeditomidine[] = array( 'day' => 'YES', 'sell' => $dexmeditomidine_dose ); $de_number1 = (($total31 / $all_total3) * 100); $de_number2 = (($total32 / $all_total3) * 100); $data['de_perc1'] = number_format((float) $de_number1, 2, '.', '') . "%"; $data['de_perc2'] = number_format((float) $de_number2, 2, '.', '') . "%"; $data['total31'] = $total31; $data['total32'] = $total32; $data['dexmeditomidine'] = ($dexmeditomidine); // ---------------------------dexamephasone ADJUVANT---------------------- $total41 = 0; $total42 = 0; $all_total4 = 0; $builder = $db->table('procedure_csa'); $query = $builder->select("count(dexamethasone_aj) as NO"); $query = $builder->where('dexamethasone_aj ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record8 = $query->getResult(); foreach ($record8 as $row) { $dexamephasone_dose = $row->NO; $total41 += floatval($row->NO); $all_total4 += floatval($row->NO); } $dexamephasone[] = array( 'day' => 'NO', 'sell' => $dexamephasone_dose ); $builder = $db->table('procedure_csa'); $query = $builder->select("count(dexamethasone_aj) as YES"); $query = $builder->where('dexamethasone_aj !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record9 = $query->getResult(); foreach ($record9 as $row) { $dexamephasone_dose = $row->YES; $total42 += floatval($row->YES); $all_total4 += floatval($row->YES); } $dexamephasone[] = array( 'day' => 'YES', 'sell' => $dexamephasone_dose ); $da_number1 = (($total41 / $all_total4) * 100); $da_number2 = (($total42 / $all_total4) * 100); $data['da_perc1'] = number_format((float) $da_number1, 2, '.', '') . "%"; $data['da_perc2'] = number_format((float) $da_number2, 2, '.', '') . "%"; $data['total41'] = $total41; $data['total42'] = $total42; $data['dexamephasone'] = ($dexamephasone); // ---------------------------tramadol ADJUVANT---------------------- $total51 = 0; $total52 = 0; $all_total5 = 0; $builder = $db->table('procedure_csa'); $query = $builder->select("count(tramadol_aj) as NO"); $query = $builder->where('tramadol_aj ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record10 = $query->getResult(); foreach ($record10 as $row) { $tramadol_dose = $row->NO; $total51 += floatval($row->NO); $all_total5 += floatval($row->NO); } $tramadol[] = array( 'day' => 'NO', 'sell' => $tramadol_dose ); $builder = $db->table('procedure_csa'); $query = $builder->select("count(tramadol_aj) as YES"); $query = $builder->where('tramadol_aj !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record11 = $query->getResult(); foreach ($record11 as $row) { $tramadol_dose = $row->YES; $total52 += floatval($row->YES); $all_total5 += floatval($row->YES); } $tramadol[] = array( 'day' => 'YES', 'sell' => $tramadol_dose ); $t_number1 = (($total51 / $all_total5) * 100); $t_number2 = (($total52 / $all_total5) * 100); $data['t_perc1'] = number_format((float) $t_number1, 2, '.', '') . "%"; $data['t_perc2'] = number_format((float) $t_number2, 2, '.', '') . "%"; $data['total51'] = $total51; $data['total52'] = $total52; $data['tramadol'] = ($tramadol); // ---------------------------kepamine ADJUVANT---------------------- $total61 = 0; $total62 = 0; $all_total6 = 0; $builder = $db->table('procedure_csa'); $query = $builder->select("count(ketamine_aj) as NO"); $query = $builder->where('ketamine_aj ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record12 = $query->getResult(); foreach ($record12 as $row) { $ketamine_dose = $row->NO; $total61 += floatval($row->NO); $all_total6 += floatval($row->NO); } $ketamine[] = array( 'day' => 'NO', 'sell' => $ketamine_dose ); $builder = $db->table('procedure_csa'); $query = $builder->select("count(ketamine_aj) as YES"); $query = $builder->where('ketamine_aj !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record13 = $query->getResult(); foreach ($record13 as $row) { $ketamine_dose = $row->YES; $total62 += floatval($row->YES); $all_total6 += floatval($row->YES); } $ketamine[] = array( 'day' => 'YES', 'sell' => $ketamine_dose ); $k_number1 = (($total61 / $all_total6) * 100); $k_number2 = (($total62 / $all_total6) * 100); $data['k_perc1'] = number_format((float) $k_number1, 2, '.', '') . "%"; $data['k_perc2'] = number_format((float) $k_number2, 2, '.', '') . "%"; $data['total61'] = $total61; $data['total62'] = $total62; $data['ketamine'] = ($ketamine); // ---------------------------midazolam ADJUVANT---------------------- $total71 = 0; $total72 = 0; $all_total7 = 0; $builder = $db->table('procedure_csa'); $query = $builder->select("count(midazolam_aj) as NO"); $query = $builder->where('midazolam_aj ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record14 = $query->getResult(); foreach ($record14 as $row) { $midazolam_dose = $row->NO; $total71 += floatval($row->NO); $all_total7 += floatval($row->NO); } $midazolam[] = array( 'day' => 'NO', 'sell' => $midazolam_dose ); $builder = $db->table('procedure_csa'); $query = $builder->select("count(midazolam_aj) as YES"); $query = $builder->where('midazolam_aj !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record15 = $query->getResult(); foreach ($record15 as $row) { $midazolam_dose = $row->YES; $total72 += floatval($row->YES); $all_total7 += floatval($row->YES); } $midazolam[] = array( 'day' => 'YES', 'sell' => $midazolam_dose ); $m_number1 = (($total71 / $all_total7) * 100); $m_number2 = (($total72 / $all_total7) * 100); $data['m_perc1'] = number_format((float) $m_number1, 2, '.', '') . "%"; $data['m_perc2'] = number_format((float) $m_number2, 2, '.', '') . "%"; $data['total71'] = $total71; $data['total72'] = $total72; $data['midazolam'] = ($midazolam); // ---------------------------midazolam ADJUVANT---------------------- $total91 = 0; $total92 = 0; $all_total9 = 0; $builder = $db->table('procedure_csa'); $query = $builder->select("count(adrenaline_aj) as NO"); $query = $builder->where('adrenaline_aj ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record18 = $query->getResult(); foreach ($record18 as $row) { $adrenaline_dose = $row->NO; $total91 += floatval($row->NO); $all_total9 += floatval($row->NO); } $adrenaline[] = array( 'day' => 'NO', 'sell' => $adrenaline_dose ); $builder = $db->table('procedure_csa'); $query = $builder->select("count(adrenaline_aj) as YES"); $query = $builder->where('adrenaline_aj !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record19 = $query->getResult(); foreach ($record19 as $row) { $adrenaline_dose = $row->YES; $total92 += floatval($row->YES); $all_total9 += floatval($row->YES); } $adrenaline[] = array( 'day' => 'YES', 'sell' => $adrenaline_dose ); $a_number1 = (($total91 / $all_total9) * 100); $a_number2 = (($total92 / $all_total9) * 100); $data['a_perc1'] = number_format((float) $a_number1, 2, '.', '') . "%"; $data['a_perc2'] = number_format((float) $a_number2, 2, '.', '') . "%"; $data['total91'] = $total91; $data['total92'] = $total92; $data['adrenaline'] = ($adrenaline); // ---------------------------other ADJUVANT---------------------- $total81 = 0; $total82 = 0; $all_total8 = 0; $builder = $db->table('procedure_csa'); $query = $builder->select("count(aj) as NO"); $query = $builder->where('aj ', 'NO'); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record16 = $query->getResult(); foreach ($record16 as $row) { $other7 = $row->NO; $total81 += floatval($row->NO); $all_total8 += floatval($row->NO); } $other[] = array( 'day' => 'NO', 'sell' => $other7 ); $builder = $db->table('procedure_csa'); $query = $builder->select("count(aj) as YES"); $query = $builder->where('aj ', 'YES'); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record17 = $query->getResult(); foreach ($record17 as $row) { $other7 = $row->YES; $total82 += floatval($row->YES); $all_total8 += floatval($row->YES); } $other[] = array( 'day' => 'YES', 'sell' => $other7 ); $oth_number1 = (($total81 / $all_total8) * 100); $oth_number2 = (($total82 / $all_total8) * 100); $data['oth_perc1'] = number_format((float) $oth_number1, 2, '.', '') . "%"; $data['oth_perc2'] = number_format((float) $oth_number2, 2, '.', '') . "%"; $data['total81'] = $total81; $data['total82'] = $total82; $data['other'] = ($other); return view('cnb/reports/csa_adjuvant_v', $data); } else { return redirect()->route("n_report"); } } public function epidural_component_adjuvant() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total11 = 0; $total12 = 0; $all_total1 = 0; $builder = $db->table('procedure_cse'); $query = $builder->select("count(opioid_dose) as NO"); $query = $builder->where('opioid_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record3 = $query->getResult(); foreach ($record3 as $row) { $opioid_dose3 = $row->NO; $total11 += floatval($row->NO); $all_total1 += floatval($row->NO); } $opioide[] = array( 'day' => 'NO', 'sell' => $opioid_dose3 ); $builder = $db->table('procedure_cse'); $query = $builder->select("count(opioid_dose) as YES"); $query = $builder->where('opioid_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record2 = $query->getResult(); foreach ($record2 as $row) { $opioid_dose = $row->YES; $total12 += floatval($row->YES); $all_total1 += floatval($row->YES); } $opioide[] = array( 'day' => 'YES', 'sell' => $opioid_dose ); $o_number1 = (($total11 / $all_total1) * 100); $o_number2 = (($total12 / $all_total1) * 100); $data['o_perc1'] = number_format((float) $o_number1, 2, '.', '') . "%"; $data['o_perc2'] = number_format((float) $o_number2, 2, '.', '') . "%"; $data['total11'] = $total11; $data['total12'] = $total12; $data['opioide'] = ($opioide); // ---------------------------OPIOIDE ADJUVANT---------------------- $total21 = 0; $total22 = 0; $all_total2 = 0; $builder = $db->table('procedure_cse'); $query = $builder->select("count(clonidina_dose) as NO"); $query = $builder->where('clonidina_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record4 = $query->getResult(); foreach ($record4 as $row) { $clonidina_dose = $row->NO; $total21 += floatval($row->NO); $all_total2 += floatval($row->NO); } $clonidina[] = array( 'day' => 'NO', 'sell' => $clonidina_dose ); $builder = $db->table('procedure_cse'); $query = $builder->select("count(clonidina_dose) as YES"); $query = $builder->where('clonidina_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record5 = $query->getResult(); foreach ($record5 as $row) { $clonidina_dose = $row->YES; $total22 += floatval($row->YES); $all_total2 += floatval($row->YES); } $clonidina[] = array( 'day' => 'YES', 'sell' => $clonidina_dose ); $c_number1 = (($total21 / $all_total2) * 100); $c_number2 = (($total22 / $all_total2) * 100); $data['c_perc1'] = number_format((float) $c_number1, 2, '.', '') . "%"; $data['c_perc2'] = number_format((float) $c_number2, 2, '.', '') . "%"; $data['total21'] = $total21; $data['total22'] = $total22; $data['clonidina'] = ($clonidina); // ---------------------------dexmeditomidine ADJUVANT---------------------- $total31 = 0; $total32 = 0; $all_total3 = 0; $builder = $db->table('procedure_cse'); $query = $builder->select("count(dexmeditomidine_dose) as NO"); $query = $builder->where('dexmeditomidine_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record6 = $query->getResult(); foreach ($record6 as $row) { $dexmeditomidine_dose = $row->NO; $total31 += floatval($row->NO); $all_total3 += floatval($row->NO); } $dexmeditomidine[] = array( 'day' => 'NO', 'sell' => $dexmeditomidine_dose ); $builder = $db->table('procedure_cse'); $query = $builder->select("count(dexmeditomidine_dose) as YES"); $query = $builder->where('dexmeditomidine_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record7 = $query->getResult(); foreach ($record7 as $row) { $dexmeditomidine_dose = $row->YES; $total32 += floatval($row->YES); $all_total3 += floatval($row->YES); } $dexmeditomidine[] = array( 'day' => 'YES', 'sell' => $dexmeditomidine_dose ); $de_number1 = (($total31 / $all_total3) * 100); $de_number2 = (($total32 / $all_total3) * 100); $data['de_perc1'] = number_format((float) $de_number1, 2, '.', '') . "%"; $data['de_perc2'] = number_format((float) $de_number2, 2, '.', '') . "%"; $data['total31'] = $total31; $data['total32'] = $total32; $data['dexmeditomidine'] = ($dexmeditomidine); // ---------------------------dexamephasone ADJUVANT---------------------- $total41 = 0; $total42 = 0; $all_total4 = 0; $builder = $db->table('procedure_cse'); $query = $builder->select("count(dexamephasone_dose) as NO"); $query = $builder->where('dexamephasone_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record8 = $query->getResult(); foreach ($record8 as $row) { $dexamephasone_dose = $row->NO; $total41 += floatval($row->NO); $all_total4 += floatval($row->NO); } $dexamephasone[] = array( 'day' => 'NO', 'sell' => $dexamephasone_dose ); $builder = $db->table('procedure_cse'); $query = $builder->select("count(dexamephasone_dose) as YES"); $query = $builder->where('dexamephasone_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record9 = $query->getResult(); foreach ($record9 as $row) { $dexamephasone_dose = $row->YES; $total42 += floatval($row->YES); $all_total4 += floatval($row->YES); } $dexamephasone[] = array( 'day' => 'YES', 'sell' => $dexamephasone_dose ); $da_number1 = (($total41 / $all_total4) * 100); $da_number2 = (($total42 / $all_total4) * 100); $data['da_perc1'] = number_format((float) $da_number1, 2, '.', '') . "%"; $data['da_perc2'] = number_format((float) $da_number2, 2, '.', '') . "%"; $data['total41'] = $total41; $data['total42'] = $total42; $data['dexamephasone'] = ($dexamephasone); // ---------------------------tramadol ADJUVANT---------------------- $total51 = 0; $total52 = 0; $all_total5 = 0; $builder = $db->table('procedure_cse'); $query = $builder->select("count(trmadol_dose) as NO"); $query = $builder->where('trmadol_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record10 = $query->getResult(); foreach ($record10 as $row) { $tramadol_dose = $row->NO; $total51 += floatval($row->NO); $all_total5 += floatval($row->NO); } $tramadol[] = array( 'day' => 'NO', 'sell' => $tramadol_dose ); $builder = $db->table('procedure_cse'); $query = $builder->select("count(trmadol_dose) as YES"); $query = $builder->where('trmadol_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record11 = $query->getResult(); foreach ($record11 as $row) { $tramadol_dose = $row->YES; $total52 += floatval($row->YES); $all_total5 += floatval($row->YES); } $tramadol[] = array( 'day' => 'YES', 'sell' => $tramadol_dose ); $t_number1 = (($total51 / $all_total5) * 100); $t_number2 = (($total52 / $all_total5) * 100); $data['t_perc1'] = number_format((float) $t_number1, 2, '.', '') . "%"; $data['t_perc2'] = number_format((float) $t_number2, 2, '.', '') . "%"; $data['total51'] = $total51; $data['total52'] = $total52; $data['tramadol'] = ($tramadol); // ---------------------------kepamine ADJUVANT---------------------- $total61 = 0; $total62 = 0; $all_total6 = 0; $builder = $db->table('procedure_cse'); $query = $builder->select("count(kepamine_dose) as NO"); $query = $builder->where('kepamine_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record12 = $query->getResult(); foreach ($record12 as $row) { $kepamine_dose = $row->NO; $total61 += floatval($row->NO); $all_total6 += floatval($row->NO); } $kepamine[] = array( 'day' => 'NO', 'sell' => $kepamine_dose ); $builder = $db->table('procedure_cse'); $query = $builder->select("count(kepamine_dose) as YES"); $query = $builder->where('kepamine_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record13 = $query->getResult(); foreach ($record13 as $row) { $kepamine_dose = $row->YES; $total62 += floatval($row->YES); $all_total6 += floatval($row->YES); } $kepamine[] = array( 'day' => 'YES', 'sell' => $kepamine_dose ); $k_number1 = (($total61 / $all_total6) * 100); $k_number2 = (($total62 / $all_total6) * 100); $data['k_perc1'] = number_format((float) $k_number1, 2, '.', '') . "%"; $data['k_perc2'] = number_format((float) $k_number2, 2, '.', '') . "%"; $data['total61'] = $total61; $data['total62'] = $total62; $data['ketamine'] = ($kepamine); // ---------------------------midazolam ADJUVANT---------------------- $total71 = 0; $total72 = 0; $all_total7 = 0; $builder = $db->table('procedure_cse'); $query = $builder->select("count(midazolam_dose) as NO"); $query = $builder->where('midazolam_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record14 = $query->getResult(); foreach ($record14 as $row) { $midazolam_dose = $row->NO; $total71 += floatval($row->NO); $all_total7 += floatval($row->NO); } $midazolam[] = array( 'day' => 'NO', 'sell' => $midazolam_dose ); $builder = $db->table('procedure_cse'); $query = $builder->select("count(midazolam_dose) as YES"); $query = $builder->where('midazolam_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record15 = $query->getResult(); foreach ($record15 as $row) { $midazolam_dose = $row->YES; $total72 += floatval($row->YES); $all_total7 += floatval($row->YES); } $midazolam[] = array( 'day' => 'YES', 'sell' => $midazolam_dose ); $m_number1 = (($total71 / $all_total7) * 100); $m_number2 = (($total72 / $all_total7) * 100); $data['m_perc1'] = number_format((float) $m_number1, 2, '.', '') . "%"; $data['m_perc2'] = number_format((float) $m_number2, 2, '.', '') . "%"; $data['total71'] = $total71; $data['total72'] = $total72; $data['midazolam'] = ($midazolam); // ---------------------------adrenaline ADJUVANT---------------------- $total91 = 0; $total92 = 0; $all_total9 = 0; $builder = $db->table('procedure_cse'); $query = $builder->select("count(adrenaline_dose) as NO"); $query = $builder->where('adrenaline_dose ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record18 = $query->getResult(); foreach ($record18 as $row) { $adrenaline_dose = $row->NO; $total91 += floatval($row->NO); $all_total9 += floatval($row->NO); } $adrenaline[] = array( 'day' => 'NO', 'sell' => $adrenaline_dose ); $builder = $db->table('procedure_cse'); $query = $builder->select("count(adrenaline_dose) as YES"); $query = $builder->where('adrenaline_dose !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record19 = $query->getResult(); foreach ($record19 as $row) { $adrenaline_dose = $row->YES; $total92 += floatval($row->YES); $all_total9 += floatval($row->YES); } $adrenaline[] = array( 'day' => 'YES', 'sell' => $adrenaline_dose ); $a_number1 = (($total91 / $all_total9) * 100); $a_number2 = (($total92 / $all_total9) * 100); $data['a_perc1'] = number_format((float) $a_number1, 2, '.', '') . "%"; $data['a_perc2'] = number_format((float) $a_number2, 2, '.', '') . "%"; $data['total91'] = $total91; $data['total92'] = $total92; $data['adrenaline'] = ($adrenaline); // ---------------------------other ADJUVANT---------------------- $builder = $db->table('procedure_cse'); $query = $builder->select("count(aj_epidural_other) as NO"); $query = $builder->where('aj_epidural_other ', 'NO'); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record16 = $query->getResult(); foreach ($record16 as $row) { $other7 = $row->NO; } $other[] = array( 'day' => 'NO', 'sell' => $other7 ); $builder = $db->table('procedure_cse'); $query = $builder->select("count(aj_epidural_other) as YES"); $query = $builder->where('aj_epidural_other ', 'YES'); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record17 = $query->getResult(); foreach ($record17 as $row) { $other7 = $row->YES; } $other[] = array( 'day' => 'YES', 'sell' => $other7 ); $data['other'] = ($other); return view('cnb/reports/epidural_component_adjuvant_v', $data); } else { return redirect()->route("n_report"); } } public function spinal_component_adjuvant() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total11 = 0; $total12 = 0; $all_total1 = 0; $builder = $db->table('procedure_cse'); $query = $builder->select("count(aj_spinal_opioid) as NO"); $query = $builder->where('aj_spinal_opioid ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record3 = $query->getResult(); foreach ($record3 as $row) { $opioid_dose3 = $row->NO; $total11 += floatval($row->NO); $all_total1 += floatval($row->NO); } $opioide[] = array( 'day' => 'NO', 'sell' => $opioid_dose3 ); $builder = $db->table('procedure_cse'); $query = $builder->select("count(aj_spinal_opioid) as YES"); $query = $builder->where('aj_spinal_opioid !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record2 = $query->getResult(); foreach ($record2 as $row) { $opioid_dose = $row->YES; $total12 += floatval($row->YES); $all_total1 += floatval($row->YES); } $opioide[] = array( 'day' => 'YES', 'sell' => $opioid_dose ); $o_number1 = (($total11 / $all_total1) * 100); $o_number2 = (($total12 / $all_total1) * 100); $data['o_perc1'] = number_format((float) $o_number1, 2, '.', '') . "%"; $data['o_perc2'] = number_format((float) $o_number2, 2, '.', '') . "%"; $data['total11'] = $total11; $data['total12'] = $total12; $data['opioide'] = ($opioide); // ---------------------------OPIOIDE ADJUVANT---------------------- $total21 = 0; $total22 = 0; $all_total2 = 0; $builder = $db->table('procedure_cse'); $query = $builder->select("count(aj_spinal_clonidne) as NO"); $query = $builder->where('aj_spinal_clonidne ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record4 = $query->getResult(); foreach ($record4 as $row) { $clonidina_dose = $row->NO; $total21 += floatval($row->NO); $all_total2 += floatval($row->NO); } $clonidina[] = array( 'day' => 'NO', 'sell' => $clonidina_dose ); $builder = $db->table('procedure_cse'); $query = $builder->select("count(aj_spinal_clonidne) as YES"); $query = $builder->where('aj_spinal_clonidne !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record5 = $query->getResult(); foreach ($record5 as $row) { $clonidina_dose = $row->YES; $total22 += floatval($row->YES); $all_total2 += floatval($row->YES); } $clonidina[] = array( 'day' => 'YES', 'sell' => $clonidina_dose ); $c_number1 = (($total21 / $all_total2) * 100); $c_number2 = (($total22 / $all_total2) * 100); $data['c_perc1'] = number_format((float) $c_number1, 2, '.', '') . "%"; $data['c_perc2'] = number_format((float) $c_number2, 2, '.', '') . "%"; $data['total21'] = $total21; $data['total22'] = $total22; $data['clonidina'] = ($clonidina); // ---------------------------dexmeditomidine ADJUVANT---------------------- $total31 = 0; $total32 = 0; $all_total3 = 0; $builder = $db->table('procedure_cse'); $query = $builder->select("count(aj_spinal_dexmeditomidine) as NO"); $query = $builder->where('aj_spinal_dexmeditomidine ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record6 = $query->getResult(); foreach ($record6 as $row) { $dexmeditomidine_dose = $row->NO; $total31 += floatval($row->NO); $all_total3 += floatval($row->NO); } $dexmeditomidine[] = array( 'day' => 'NO', 'sell' => $dexmeditomidine_dose ); $builder = $db->table('procedure_cse'); $query = $builder->select("count(aj_spinal_dexmeditomidine) as YES"); $query = $builder->where('aj_spinal_dexmeditomidine !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record7 = $query->getResult(); foreach ($record7 as $row) { $dexmeditomidine_dose = $row->YES; $total32 += floatval($row->YES); $all_total3 += floatval($row->YES); } $dexmeditomidine[] = array( 'day' => 'YES', 'sell' => $dexmeditomidine_dose ); $de_number1 = (($total31 / $all_total3) * 100); $de_number2 = (($total32 / $all_total3) * 100); $data['de_perc1'] = number_format((float) $de_number1, 2, '.', '') . "%"; $data['de_perc2'] = number_format((float) $de_number2, 2, '.', '') . "%"; $data['total31'] = $total31; $data['total32'] = $total32; $data['dexmeditomidine'] = ($dexmeditomidine); // ---------------------------dexamephasone ADJUVANT---------------------- $total41 = 0; $total42 = 0; $all_total4 = 0; $builder = $db->table('procedure_cse'); $query = $builder->select("count(aj_spinal_dexamethasone) as NO"); $query = $builder->where('aj_spinal_dexamethasone ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record8 = $query->getResult(); foreach ($record8 as $row) { $dexamephasone_dose = $row->NO; $total41 += floatval($row->NO); $all_total4 += floatval($row->NO); } $dexamephasone[] = array( 'day' => 'NO', 'sell' => $dexamephasone_dose ); $builder = $db->table('procedure_cse'); $query = $builder->select("count(aj_spinal_dexamethasone) as YES"); $query = $builder->where('aj_spinal_dexamethasone !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record9 = $query->getResult(); foreach ($record9 as $row) { $dexamephasone_dose = $row->YES; $total42 += floatval($row->YES); $all_total4 += floatval($row->YES); } $dexamephasone[] = array( 'day' => 'YES', 'sell' => $dexamephasone_dose ); $da_number1 = (($total41 / $all_total4) * 100); $da_number2 = (($total42 / $all_total4) * 100); $data['da_perc1'] = number_format((float) $da_number1, 2, '.', '') . "%"; $data['da_perc2'] = number_format((float) $da_number2, 2, '.', '') . "%"; $data['total41'] = $total41; $data['total42'] = $total42; $data['dexamephasone'] = ($dexamephasone); // ---------------------------tramadol ADJUVANT---------------------- $total51 = 0; $total52 = 0; $all_total5 = 0; $builder = $db->table('procedure_cse'); $query = $builder->select("count(aj_spinal_tramadol) as NO"); $query = $builder->where('aj_spinal_tramadol ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record10 = $query->getResult(); foreach ($record10 as $row) { $tramadol_dose = $row->NO; $total51 += floatval($row->NO); $all_total5 += floatval($row->NO); } $tramadol[] = array( 'day' => 'NO', 'sell' => $tramadol_dose ); $builder = $db->table('procedure_cse'); $query = $builder->select("count(aj_spinal_tramadol) as YES"); $query = $builder->where('aj_spinal_tramadol !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record11 = $query->getResult(); foreach ($record11 as $row) { $tramadol_dose = $row->YES; $total52 += floatval($row->YES); $all_total5 += floatval($row->YES); } $tramadol[] = array( 'day' => 'YES', 'sell' => $tramadol_dose ); $t_number1 = (($total51 / $all_total5) * 100); $t_number2 = (($total52 / $all_total5) * 100); $data['t_perc1'] = number_format((float) $t_number1, 2, '.', '') . "%"; $data['t_perc2'] = number_format((float) $t_number2, 2, '.', '') . "%"; $data['total51'] = $total51; $data['total52'] = $total52; $data['tramadol'] = ($tramadol); // ---------------------------adrenaline ADJUVANT---------------------- $total91 = 0; $total92 = 0; $all_total9 = 0; $builder = $db->table('procedure_cse'); $query = $builder->select("count(aj_spinal_adrenaline) as NO"); $query = $builder->where('aj_spinal_adrenaline ', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record18 = $query->getResult(); foreach ($record18 as $row) { $adrenaline_dose = $row->NO; $total91 += floatval($row->NO); $all_total9 += floatval($row->NO); } $adrenaline[] = array( 'day' => 'NO', 'sell' => $adrenaline_dose ); $builder = $db->table('procedure_cse'); $query = $builder->select("count(aj_spinal_adrenaline) as YES"); $query = $builder->where('aj_spinal_adrenaline !=', ''); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record19 = $query->getResult(); foreach ($record19 as $row) { $adrenaline_dose = $row->YES; $total92 += floatval($row->YES); $all_total9 += floatval($row->YES); } $adrenaline[] = array( 'day' => 'YES', 'sell' => $adrenaline_dose ); $a_number1 = (($total91 / $all_total9) * 100); $a_number2 = (($total92 / $all_total9) * 100); $data['a_perc1'] = number_format((float) $a_number1, 2, '.', '') . "%"; $data['a_perc2'] = number_format((float) $a_number2, 2, '.', '') . "%"; $data['total91'] = $total91; $data['total92'] = $total92; $data['adrenaline'] = ($adrenaline); // ---------------------------other ADJUVANT---------------------- $total81 = 0; $total82 = 0; $all_total8 = 0; $builder = $db->table('procedure_cse'); $query = $builder->select("count(aj_epidural_other) as NO"); $query = $builder->where('aj_epidural_other ', 'NO'); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->get(); $record16 = $query->getResult(); foreach ($record16 as $row) { $other7 = $row->NO; } // $other[] = array( // 'day' => 'NO', // 'sell' => $other7 // ); $builder = $db->table('procedure_cse'); $query = $builder->select("aj_epidural_other"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } // $query = $builder->like('aj_epidural_other','[{"name":"","dose":""}]'); $query = $builder->get(); $record17 = $query->getResult(); foreach ($record17 as $key => $row) { $other = $record17[11]->aj_epidural_other; // foreach($other as $key =>$val){ // $other7 = $val; // } // print_r($other);die(); } $other[] = array( 'day' => 'YES', 'sell' => $other7 ); $data['other'] = ($other); return view('cnb/reports/spinal_component_adjuvant_v', $data); } else { return redirect()->route("n_report"); } } public function safety() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.basic_monitering', 'YES'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $other16[] = array( 'day' => 'Basic Monitoring', 'sell' => floatval($row->count) ); } } else { $other16[] = array( 'day' => 'Basic Monitoring', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.resuscitation_eq', 'YES'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $other16[] = array( 'day' => 'Resuscitation Equipment Available', 'sell' => floatval($row->count) ); } } else { $other16[] = array( 'day' => 'Resuscitation Equipment Available', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.lipid_rescue', 'YES'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $other16[] = array( 'day' => 'Lipid Rescue Available', 'sell' => floatval($row->count) ); } } else { $other16[] = array( 'day' => 'Lipid Rescue Available', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.consent_taken', 'YES'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $other16[] = array( 'day' => 'Consent Taken', 'sell' => floatval($row->count) ); } } else { $other16[] = array( 'day' => 'Consent Taken', 'sell' => 0 ); } $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.timeout', 'YES'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $other16[] = array( 'day' => 'Time Out / Correct Side Check Done', 'sell' => floatval($row->count) ); } } else { $other16[] = array( 'day' => 'Time Out / Correct Side Check Done', 'sell' => 0 ); } $data['other16'] = $other16; $data['total'] = $total; return view('cnb/reports/safety_v', $data); } else { return redirect()->route("n_report"); } } public function surgery() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.category', 'Elective'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $category[] = array( 'day' => 'Elective', 'sell' => floatval($row->count) ); } } else { $category[] = array( 'day' => 'Basic Monitoring', 'sell' => 0 ); } $total = session()->get('n'); $builder = $db->table('cnb_postop'); $query = $builder->select("COUNT(cnb_postop.id) as count"); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->where('cnb_preop.category', 'Emergency'); $query = $builder->get(); $record = $query->getResult(); if ($record) { foreach ($record as $row) { $category[] = array( 'day' => 'Emergency', 'sell' => floatval($row->count) ); } } else { $category[] = array( 'day' => 'Basic Monitoring', 'sell' => 0 ); } $data['category'] = ($category); $data['total'] = $total; return view('cnb/reports/surgery', $data); } else { } } public function Epidural_Component_Single_Dose() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, la_regimen as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('la_regimen'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $la_regimen = []; foreach ($record as $row) { $la_regimen[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['la_regimen'] = $la_regimen; $data['total'] = $total; return view('cnb/reports/epidural_component_single_dose', $data); } else { return redirect()->route("n_report"); } } public function Epidural_Component_Sala_Dose() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, la_regimen as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('la_regimen'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $la_regimen = []; foreach ($record as $row) { $la_regimen[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['la_regimen'] = $la_regimen; $data['total'] = $total; return view('cnb/reports/epidural_component_sala_dose', $data); } else { return redirect()->route("n_report"); } } public function Spinal_Component_Single_Dose() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, la_regimen as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('la_regimen'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $la_regimen = []; foreach ($record as $row) { $la_regimen[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['la_regimen'] = $la_regimen; $data['total'] = $total; return view('cnb/reports/Spinal_Component_Single_Dose', $data); } else { return redirect()->route("n_report"); } } public function Spinal_Component_Combo_Dose() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, la_regimen as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('la_regimen'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $la_regimen = []; foreach ($record as $row) { $la_regimen[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['la_regimen'] = $la_regimen; $data['total'] = $total; return view('cnb/reports/Spinal_Component_Combo_Dose', $data); } else { return redirect()->route("n_report"); } } public function Epidural_Single_Dose() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, la_regimen as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('la_regimen'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $la_regimen = []; foreach ($record as $row) { $la_regimen[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['la_regimen'] = $la_regimen; $data['total'] = $total; return view('cnb/reports/Epidural_Single_Dose', $data); } else { return redirect()->route("n_report"); } } public function Epidural_Sala_Combo_Dose() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, la_regimen as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('la_regimen'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $la_regimen = []; foreach ($record as $row) { $la_regimen[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['la_regimen'] = $la_regimen; $data['total'] = $total; return view('cnb/reports/Epidural_Sala_Combo_Dose', $data); } else { return redirect()->route("n_report"); } } public function Spinal_Dose() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, la_regimen as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('la_regimen'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $la_regimen = []; foreach ($record as $row) { $la_regimen[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['la_regimen'] = $la_regimen; $data['total'] = $total; return view('cnb/reports/Spinal_Dose', $data); } else { return redirect()->route("n_report"); } } public function Spinal_Combo_Dose() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, la_regimen as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('la_regimen'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $la_regimen = []; foreach ($record as $row) { $la_regimen[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['la_regimen'] = $la_regimen; $data['total'] = $total; return view('cnb/reports/Spinal_Combo_Dose', $data); } else { return redirect()->route("n_report"); } } public function csa_Component_single_Dose() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $builder = $db->table('procedure_epidural'); $query = $builder->select("COUNT(id) as count, la_regimen as s"); if ($from_date && $to_date) { $query = $builder->where('created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('created_at <=', date('Y-m-d', strtotime($to_date))); } $query = $builder->groupBy('la_regimen'); $query = $builder->get(); $record = $query->getResult(); $total = 0; $la_regimen = []; foreach ($record as $row) { $la_regimen[] = array( 'day' => $row->s, 'sell' => floatval($row->count) ); $total += floatval($row->count); } $data['products'] = ($products); $data['la_regimen'] = $la_regimen; $data['total'] = $total; return view('cnb/reports/csa_Component_single_Dose', $data); } else { return redirect()->route("n_report"); } } public function severity_rating_experience() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $no_drowsiness = 0; $no_pain_at_surgery = 0; $no_thirst = 0; $no_hoarseness = 0; $no_sore_throat = 0; $no_nausea_vomiting = 0; $no_feeling_cold = 0; $no_confusion_disorientation = 0; $no_backpain = 0; $no_shivering = 0; $mild_drowsiness = 0; $mild_pain_at_surgery = 0; $mild_thirst = 0; $mild_hoarseness = 0; $mild_sore_throat = 0; $mild_nausea_vomiting = 0; $mild_feeling_cold = 0; $mild_confusion_disorientation = 0; $mild_backpain = 0; $mild_shivering = 0; $moderate_drowsiness = 0; $moderate_pain_at_surgery = 0; $moderate_thirst = 0; $moderate_hoarseness = 0; $moderate_sore_throat = 0; $moderate_nausea_vomiting = 0; $moderate_feeling_cold = 0; $moderate_confusion_disorientation = 0; $moderate_backpain = 0; $moderate_shivering = 0; $severe_drowsiness = 0; $severe_pain_at_surgery = 0; $severe_thirst = 0; $severe_hoarseness = 0; $severe_sore_throat = 0; $severe_nausea_vomiting = 0; $severe_feeling_cold = 0; $severe_confusion_disorientation = 0; $severe_backpain = 0; $severe_shivering = 0; $total = 0; $builder = $db->table('manual_feedback'); $query = $builder->select("drowsiness,pain_at_surgery,thirst,hoarseness,sore_throat,nausea_vomiting,feeling_cold,confusion_disorientation,backpain,shivering"); $builder->join('cnb_preop', 'cnb_preop.patient_id = manual_feedback.patient_id'); $builder->join('cnb_postop', 'cnb_postop.patient_id = manual_feedback.patient_id'); $query = $builder->where('manual_feedback.created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('manual_feedback.created_at <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total = $total + 1; if ($row->drowsiness == 'No') { $no_drowsiness = $no_drowsiness + 1; } else if ($row->drowsiness == 'Mild') { $mild_drowsiness = $mild_drowsiness + 1; } else if ($row->drowsiness == 'Moderate') { $moderate_drowsiness = $moderate_drowsiness + 1; } else if ($row->drowsiness == 'Severe') { $severe_drowsiness = $severe_drowsiness + 1; } if ($row->pain_at_surgery == 'No') { $no_pain_at_surgery = $no_pain_at_surgery + 1; } else if ($row->pain_at_surgery == 'Mild') { $mild_pain_at_surgery = $mild_pain_at_surgery + 1; } else if ($row->pain_at_surgery == 'Moderate') { $moderate_pain_at_surgery = $moderate_pain_at_surgery + 1; } else if ($row->pain_at_surgery == 'Severe') { $severe_pain_at_surgery = $severe_pain_at_surgery + 1; } if ($row->thirst == 'No') { $no_thirst = $no_thirst + 1; } else if ($row->thirst == 'Mild') { $mild_thirst = $mild_thirst + 1; } else if ($row->thirst == 'Moderate') { $moderate_thirst = $moderate_thirst + 1; } else if ($row->thirst == 'Severe') { $severe_thirst = $severe_thirst + 1; } if ($row->hoarseness == 'No') { $no_hoarseness = $no_hoarseness + 1; } else if ($row->hoarseness == 'Mild') { $mild_hoarseness = $mild_hoarseness + 1; } else if ($row->hoarseness == 'Moderate') { $moderate_hoarseness = $moderate_hoarseness + 1; } else if ($row->hoarseness == 'Severe') { $severe_hoarseness = $severe_hoarseness + 1; } if ($row->sore_throat == 'No') { $no_sore_throat = $no_sore_throat + 1; } else if ($row->sore_throat == 'Mild') { $mild_sore_throat = $mild_sore_throat + 1; } else if ($row->sore_throat == 'Moderate') { $moderate_sore_throat = $moderate_sore_throat + 1; } else if ($row->sore_throat == 'Severe') { $severe_sore_throat = $severe_sore_throat + 1; } if ($row->nausea_vomiting == 'No') { $no_nausea_vomiting = $no_nausea_vomiting + 1; } else if ($row->nausea_vomiting == 'Mild') { $mild_nausea_vomiting = $mild_nausea_vomiting + 1; } else if ($row->nausea_vomiting == 'Moderate') { $moderate_nausea_vomiting = $moderate_nausea_vomiting + 1; } else if ($row->nausea_vomiting == 'Severe') { $severe_nausea_vomiting = $severe_nausea_vomiting + 1; } if ($row->feeling_cold == 'No') { $no_feeling_cold = $no_feeling_cold + 1; } else if ($row->feeling_cold == 'Mild') { $mild_feeling_cold = $mild_feeling_cold + 1; } else if ($row->feeling_cold == 'Moderate') { $moderate_feeling_cold = $moderate_feeling_cold + 1; } else if ($row->feeling_cold == 'Severe') { $severe_feeling_cold = $severe_feeling_cold + 1; } if ($row->confusion_disorientation == 'No') { $no_confusion_disorientation = $no_confusion_disorientation + 1; } else if ($row->confusion_disorientation == 'Mild') { $mild_confusion_disorientation = $mild_confusion_disorientation + 1; } else if ($row->confusion_disorientation == 'Moderate') { $moderate_confusion_disorientation = $moderate_confusion_disorientation + 1; } else if ($row->confusion_disorientation == 'Severe') { $severe_confusion_disorientation = $severe_confusion_disorientation + 1; } if ($row->backpain == 'No') { $no_backpain = $no_backpain + 1; } else if ($row->backpain == 'Mild') { $mild_backpain = $mild_backpain + 1; } else if ($row->backpain == 'Moderate') { $moderate_backpain = $moderate_backpain + 1; } else if ($row->backpain == 'Severe') { $severe_backpain = $severe_backpain + 1; } if ($row->shivering == 'No') { $no_shivering = $no_shivering + 1; } else if ($row->shivering == 'Mild') { $mild_shivering = $mild_shivering + 1; } else if ($row->shivering == 'Moderate') { $moderate_shivering = $moderate_shivering + 1; } else if ($row->shivering == 'Severe') { $severe_shivering = $severe_shivering + 1; } } $builder = $db->table('e_feedback'); $query = $builder->select("drowsiness,pain_at_surgery,thirst,hoarseness,sore_throat,nausea_vomiting,feeling_cold,confusion_disorientation,backpain,shivering"); $builder->join('cnb_preop', 'cnb_preop.patient_id = e_feedback.patient_id'); $builder->join('cnb_postop', 'cnb_postop.patient_id = e_feedback.patient_id'); $query = $builder->where('e_feedback.created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('e_feedback.created_at <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total = $total + 1; if ($row->drowsiness == 'No') { $no_drowsiness = $no_drowsiness + 1; } else if ($row->drowsiness == 'Mild') { $mild_drowsiness = $mild_drowsiness + 1; } else if ($row->drowsiness == 'Moderate') { $moderate_drowsiness = $moderate_drowsiness + 1; } else if ($row->drowsiness == 'Severe') { $severe_drowsiness = $severe_drowsiness + 1; } if ($row->pain_at_surgery == 'No') { $no_pain_at_surgery = $no_pain_at_surgery + 1; } else if ($row->pain_at_surgery == 'Mild') { $mild_pain_at_surgery = $mild_pain_at_surgery + 1; } else if ($row->pain_at_surgery == 'Moderate') { $moderate_pain_at_surgery = $moderate_pain_at_surgery + 1; } else if ($row->pain_at_surgery == 'Severe') { $severe_pain_at_surgery = $severe_pain_at_surgery + 1; } if ($row->thirst == 'No') { $no_thirst = $no_thirst + 1; } else if ($row->thirst == 'Mild') { $mild_thirst = $mild_thirst + 1; } else if ($row->thirst == 'Moderate') { $moderate_thirst = $moderate_thirst + 1; } else if ($row->thirst == 'Severe') { $severe_thirst = $severe_thirst + 1; } if ($row->hoarseness == 'No') { $no_hoarseness = $no_hoarseness + 1; } else if ($row->hoarseness == 'Mild') { $mild_hoarseness = $mild_hoarseness + 1; } else if ($row->hoarseness == 'Moderate') { $moderate_hoarseness = $moderate_hoarseness + 1; } else if ($row->hoarseness == 'Severe') { $severe_hoarseness = $severe_hoarseness + 1; } if ($row->sore_throat == 'No') { $no_sore_throat = $no_sore_throat + 1; } else if ($row->sore_throat == 'Mild') { $mild_sore_throat = $mild_sore_throat + 1; } else if ($row->sore_throat == 'Moderate') { $moderate_sore_throat = $moderate_sore_throat + 1; } else if ($row->sore_throat == 'Severe') { $severe_sore_throat = $severe_sore_throat + 1; } if ($row->nausea_vomiting == 'No') { $no_nausea_vomiting = $no_nausea_vomiting + 1; } else if ($row->nausea_vomiting == 'Mild') { $mild_nausea_vomiting = $mild_nausea_vomiting + 1; } else if ($row->nausea_vomiting == 'Moderate') { $moderate_nausea_vomiting = $moderate_nausea_vomiting + 1; } else if ($row->nausea_vomiting == 'Severe') { $severe_nausea_vomiting = $severe_nausea_vomiting + 1; } if ($row->feeling_cold == 'No') { $no_feeling_cold = $no_feeling_cold + 1; } else if ($row->feeling_cold == 'Mild') { $mild_feeling_cold = $mild_feeling_cold + 1; } else if ($row->feeling_cold == 'Moderate') { $moderate_feeling_cold = $moderate_feeling_cold + 1; } else if ($row->feeling_cold == 'Severe') { $severe_feeling_cold = $severe_feeling_cold + 1; } if ($row->confusion_disorientation == 'No') { $no_confusion_disorientation = $no_confusion_disorientation + 1; } else if ($row->confusion_disorientation == 'Mild') { $mild_confusion_disorientation = $mild_confusion_disorientation + 1; } else if ($row->confusion_disorientation == 'Moderate') { $moderate_confusion_disorientation = $moderate_confusion_disorientation + 1; } else if ($row->confusion_disorientation == 'Severe') { $severe_confusion_disorientation = $severe_confusion_disorientation + 1; } if ($row->backpain == 'No') { $no_backpain = $no_backpain + 1; } else if ($row->backpain == 'Mild') { $mild_backpain = $mild_backpain + 1; } else if ($row->backpain == 'Moderate') { $moderate_backpain = $moderate_backpain + 1; } else if ($row->backpain == 'Severe') { $severe_backpain = $severe_backpain + 1; } if ($row->shivering == 'No') { $no_shivering = $no_shivering + 1; } else if ($row->shivering == 'Mild') { $mild_shivering = $mild_shivering + 1; } else if ($row->shivering == 'Moderate') { $moderate_shivering = $moderate_shivering + 1; } else if ($row->shivering == 'Severe') { $severe_shivering = $severe_shivering + 1; } } $products[] = array( 'name' => 'Drowsiness', 'No_count' => $no_drowsiness, 'mild_count' => $mild_drowsiness, 'moderate_count' => $moderate_drowsiness, 'severe_count' => $severe_drowsiness, 'total' => $total ); $products[] = array( 'name' => 'Pain at the Site of Surgery', 'No_count' => $no_pain_at_surgery, 'mild_count' => $mild_pain_at_surgery, 'moderate_count' => $moderate_pain_at_surgery, 'severe_count' => $severe_pain_at_surgery, 'total' => $total ); $products[] = array( 'name' => 'Thirst', 'No_count' => $no_thirst, 'mild_count' => $mild_thirst, 'moderate_count' => $moderate_thirst, 'severe_count' => $severe_thirst, 'total' => $total ); $products[] = array( 'name' => 'Hoarseness', 'No_count' => $no_hoarseness, 'mild_count' => $mild_hoarseness, 'moderate_count' => $moderate_hoarseness, 'severe_count' => $severe_hoarseness, 'total' => $total ); $products[] = array( 'name' => 'Sore Throat', 'No_count' => $no_sore_throat, 'mild_count' => $mild_sore_throat, 'moderate_count' => $moderate_sore_throat, 'severe_count' => $severe_sore_throat, 'total' => $total ); $products[] = array( 'name' => 'Nausea Vomiting', 'No_count' => $no_nausea_vomiting, 'mild_count' => $mild_nausea_vomiting, 'moderate_count' => $moderate_nausea_vomiting, 'severe_count' => $severe_nausea_vomiting, 'total' => $total ); $products[] = array( 'name' => 'Feeling Cold', 'No_count' => $no_feeling_cold, 'mild_count' => $mild_feeling_cold, 'moderate_count' => $moderate_feeling_cold, 'severe_count' => $severe_feeling_cold, 'total' => $total ); $products[] = array( 'name' => 'Confusion Disorientation', 'No_count' => $no_confusion_disorientation, 'mild_count' => $mild_confusion_disorientation, 'moderate_count' => $moderate_confusion_disorientation, 'severe_count' => $severe_confusion_disorientation, 'total' => $total ); $products[] = array( 'name' => 'Backpain', 'No_count' => $no_backpain, 'mild_count' => $mild_backpain, 'moderate_count' => $moderate_backpain, 'severe_count' => $severe_backpain, 'total' => $total ); $products[] = array( 'name' => 'Shivering', 'No_count' => $no_shivering, 'mild_count' => $mild_shivering, 'moderate_count' => $moderate_shivering, 'severe_count' => $severe_shivering, 'total' => $total ); // print_r($products);die(); $data['products'] = ($products); $data['total'] = $total; return view('cnb/reports/severity_rating_experience', $data); } else { return redirect()->route("n_report"); } } public function satisfaction_score() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $yes_pain_before_surgery = 0; $no_pain_before_surgery = 0; $yes_anaesthesist_time = 0; $no_anaesthesist_time = 0; $vsat_anaesthesia_satisfaction = 0; $sat_anaesthesia_satisfaction = 0; $dsat_anaesthesia_satisfaction = 0; $vdsat_anaesthesia_satisfaction = 0; $uta_anaesthesia_satisfaction = 0; $vsat_pain_therapy_satisfaction = 0; $sat_pain_therapy_satisfaction = 0; $dsat_pain_therapy_satisfaction = 0; $vdsat_pain_therapy_satisfaction = 0; $uta_pain_therapy_satisfaction = 0; $vsat_nausea_vomit_satisfaction = 0; $sat_nausea_vomit_satisfaction = 0; $dsat_nausea_vomit_satisfaction = 0; $vdsat_nausea_vomit_satisfaction = 0; $uta_nausea_vomit_satisfaction = 0; $none_numbness_limb_bothering = 0; $mb_numbness_limb_bothering = 0; $md_numbness_limb_bothering = 0; $s_numbness_limb_bothering = 0; $uta_numbness_limb_bothering = 0; $none_numbness_pain_experience = 0; $mb_numbness_pain_experience = 0; $md_numbness_pain_experience = 0; $s_numbness_pain_experience = 0; $uta_numbness_pain_experience = 0; $yes_similar_op_again = 0; $no_similar_op_again = 0; $uta_similar_op_again = 0; $one_overall_satisfaction = 0; $two_overall_satisfaction = 0; $three_overall_satisfaction = 0; $four_overall_satisfaction = 0; $five_overall_satisfaction = 0; $six_overall_satisfaction = 0; $seven_overall_satisfaction = 0; $eight_overall_satisfaction = 0; $nine_overall_satisfaction = 0; $ten_overall_satisfaction = 0; $vsat_well_managed = 0; $sat_well_managed = 0; $dsat_well_managed = 0; $vdsat_well_managed = 0; $uta_well_managed = 0; $total = 0; $builder = $db->table('manual_feedback'); $query = $builder->select("pain_before_surgery,anaesthesist_time,pain_therapy_satisfaction,nausea_vomit_satisfaction,numbness_limb_bothering,numbness_pain_experience,similar_op_again,overall_satisfaction,anaesthesia_satisfaction,well_managed"); $builder->join('cnb_preop', 'cnb_preop.patient_id = manual_feedback.patient_id'); $builder->join('cnb_postop', 'cnb_postop.patient_id = manual_feedback.patient_id'); $query = $builder->where('manual_feedback.created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('manual_feedback.created_at <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total = $total + 1; if ($row->pain_before_surgery == 'Yes') { $yes_pain_before_surgery = $yes_pain_before_surgery + 1; } else { $no_pain_before_surgery = $no_pain_before_surgery + 1; } if ($row->anaesthesist_time == 'Yes') { $yes_anaesthesist_time = $yes_anaesthesist_time + 1; } else { $no_anaesthesist_time = $no_anaesthesist_time + 1; } if ($row->anaesthesia_satisfaction == 'Satisfied') { $vsat_anaesthesia_satisfaction = $vsat_anaesthesia_satisfaction + 1; } else if ($row->anaesthesia_satisfaction == 'Very satisfied') { $sat_anaesthesia_satisfaction = $sat_anaesthesia_satisfaction + 1; } else if ($row->anaesthesia_satisfaction == 'Dissatisfied') { $dsat_anaesthesia_satisfaction = $dsat_anaesthesia_satisfaction + 1; } else if ($row->anaesthesia_satisfaction == 'Very Dissatisfied') { $vdsat_anaesthesia_satisfaction = $vdsat_anaesthesia_satisfaction + 1; } else { $uta_anaesthesia_satisfaction = $uta_anaesthesia_satisfaction + 1; } if ($row->well_managed == 'Satisfied') { $vsat_well_managed = $vsat_well_managed + 1; } else if ($row->well_managed == 'Very satisfied') { $sat_well_managed = $sat_well_managed + 1; } else if ($row->well_managed == 'Dissatisfied') { $dsat_well_managed = $dsat_well_managed + 1; } else if ($row->well_managed == 'Very Dissatisfied') { $vdsat_well_managed = $vdsat_well_managed + 1; } else { $uta_well_managed = $uta_well_managed + 1; } if ($row->pain_therapy_satisfaction == 'Satisfied') { $vsat_pain_therapy_satisfaction = $vsat_pain_therapy_satisfaction + 1; } else if ($row->pain_therapy_satisfaction == 'Very satisfied') { $sat_pain_therapy_satisfaction = $sat_pain_therapy_satisfaction + 1; } else if ($row->pain_therapy_satisfaction == 'Dissatisfied') { $dsat_pain_therapy_satisfaction = $dsat_pain_therapy_satisfaction + 1; } else if ($row->pain_therapy_satisfaction == 'Very Dissatisfied') { $vdsat_pain_therapy_satisfaction = $vdsat_pain_therapy_satisfaction + 1; } else { $uta_pain_therapy_satisfaction = $uta_pain_therapy_satisfaction + 1; } if ($row->nausea_vomit_satisfaction == 'Satisfied') { $vsat_nausea_vomit_satisfaction = $vsat_nausea_vomit_satisfaction + 1; } else if ($row->nausea_vomit_satisfaction == 'Very satisfied') { $sat_nausea_vomit_satisfaction = $sat_nausea_vomit_satisfaction + 1; } else if ($row->nausea_vomit_satisfaction == 'Dissatisfied') { $dsat_nausea_vomit_satisfaction = $dsat_nausea_vomit_satisfaction + 1; } else if ($row->nausea_vomit_satisfaction == 'Very Dissatisfied') { $vdsat_nausea_vomit_satisfaction = $vdsat_nausea_vomit_satisfaction + 1; } else { $uta_nausea_vomit_satisfaction = $uta_nausea_vomit_satisfaction + 1; } if ($row->numbness_limb_bothering == 'None') { $none_numbness_limb_bothering = $none_numbness_limb_bothering + 1; } else if ($row->numbness_limb_bothering == 'Mild-Barely noticeable') { $mb_numbness_limb_bothering = $mb_numbness_limb_bothering + 1; } else if ($row->numbness_limb_bothering == 'Moderate:definitely noticeable') { $md_numbness_limb_bothering = $md_numbness_limb_bothering + 1; } else if ($row->numbness_limb_bothering == 'Severe:very pre-occupied by the symptom') { $s_numbness_limb_bothering = $s_numbness_limb_bothering + 1; } else { $uta_numbness_limb_bothering = $uta_numbness_limb_bothering + 1; } if ($row->numbness_pain_experience == 'None') { $none_numbness_pain_experience = $none_numbness_pain_experience + 1; } else if ($row->numbness_pain_experience == 'Mild-Barely noticeable') { $mb_numbness_pain_experience = $mb_numbness_pain_experience + 1; } else if ($row->numbness_pain_experience == 'Moderate Pain') { $md_numbness_pain_experience = $md_numbness_pain_experience + 1; } else if ($row->numbness_pain_experience == 'Severe Pain') { $s_numbness_pain_experience = $s_numbness_pain_experience + 1; } else if ($row->numbness_pain_experience == 'Unable to Answer') { $uta_numbness_pain_experience = $uta_numbness_pain_experience + 1; } if ($row->similar_op_again == 'Yes') { $yes_similar_op_again = $yes_similar_op_again + 1; } else if ($row->similar_op_again == 'No') { $no_similar_op_again = $no_similar_op_again + 1; } else { $uta_similar_op_again = $uta_similar_op_again + 1; } if ($row->overall_satisfaction == '1') { $one_overall_satisfaction = $one_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '2') { $two_overall_satisfaction = $two_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '3') { $three_overall_satisfaction = $three_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '4') { $four_overall_satisfaction = $four_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '5') { $five_overall_satisfaction = $five_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '6') { $six_overall_satisfaction = $six_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '7') { $seven_overall_satisfaction = $seven_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '8') { $eight_overall_satisfaction = $eight_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '9') { $nine_overall_satisfaction = $nine_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '10') { $ten_overall_satisfaction = $ten_overall_satisfaction + 1; } } $builder = $db->table('e_feedback'); $query = $builder->select("pain_before_surgery,anaesthesist_time,pain_therapy_satisfaction,nausea_vomit_satisfaction,numbness_limb_bothering,numbness_pain_experience,similar_op_again,overall_satisfaction,anaesthesia_satisfaction,well_managed"); $builder->join('cnb_preop', 'cnb_preop.patient_id = e_feedback.patient_id'); $builder->join('cnb_postop', 'cnb_postop.patient_id = e_feedback.patient_id'); $query = $builder->where('e_feedback.created_at >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('e_feedback.created_at <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); foreach ($record as $row) { $total = $total + 1; if ($row->pain_before_surgery == 'Yes') { $yes_pain_before_surgery = $yes_pain_before_surgery + 1; } else { $no_pain_before_surgery = $no_pain_before_surgery + 1; } if ($row->anaesthesist_time == 'Yes') { $yes_anaesthesist_time = $yes_anaesthesist_time + 1; } else { $no_anaesthesist_time = $no_anaesthesist_time + 1; } if ($row->anaesthesia_satisfaction == 'Satisfied') { $vsat_anaesthesia_satisfaction = $vsat_anaesthesia_satisfaction + 1; } else if ($row->anaesthesia_satisfaction == 'Very satisfied') { $sat_anaesthesia_satisfaction = $sat_anaesthesia_satisfaction + 1; } else if ($row->anaesthesia_satisfaction == 'Dissatisfied') { $dsat_anaesthesia_satisfaction = $dsat_anaesthesia_satisfaction + 1; } else if ($row->anaesthesia_satisfaction == 'Very Dissatisfied') { $vdsat_anaesthesia_satisfaction = $vdsat_anaesthesia_satisfaction + 1; } else { $uta_anaesthesia_satisfaction = $uta_anaesthesia_satisfaction + 1; } if ($row->well_managed == 'Satisfied') { $vsat_well_managed = $vsat_well_managed + 1; } else if ($row->well_managed == 'Very satisfied') { $sat_well_managed = $sat_well_managed + 1; } else if ($row->well_managed == 'Dissatisfied') { $dsat_well_managed = $dsat_well_managed + 1; } else if ($row->well_managed == 'Very Dissatisfied') { $vdsat_well_managed = $vdsat_well_managed + 1; } else { $uta_well_managed = $uta_well_managed + 1; } if ($row->pain_therapy_satisfaction == 'Satisfied') { $vsat_pain_therapy_satisfaction = $vsat_pain_therapy_satisfaction + 1; } else if ($row->pain_therapy_satisfaction == 'Very satisfied') { $sat_pain_therapy_satisfaction = $sat_pain_therapy_satisfaction + 1; } else if ($row->pain_therapy_satisfaction == 'Dissatisfied') { $dsat_pain_therapy_satisfaction = $dsat_pain_therapy_satisfaction + 1; } else if ($row->pain_therapy_satisfaction == 'Very Dissatisfied') { $vdsat_pain_therapy_satisfaction = $vdsat_pain_therapy_satisfaction + 1; } else { $uta_pain_therapy_satisfaction = $uta_pain_therapy_satisfaction + 1; } if ($row->nausea_vomit_satisfaction == 'Satisfied') { $vsat_nausea_vomit_satisfaction = $vsat_nausea_vomit_satisfaction + 1; } else if ($row->nausea_vomit_satisfaction == 'Very satisfied') { $sat_nausea_vomit_satisfaction = $sat_nausea_vomit_satisfaction + 1; } else if ($row->nausea_vomit_satisfaction == 'Dissatisfied') { $dsat_nausea_vomit_satisfaction = $dsat_nausea_vomit_satisfaction + 1; } else if ($row->nausea_vomit_satisfaction == 'Very Dissatisfied') { $vdsat_nausea_vomit_satisfaction = $vdsat_nausea_vomit_satisfaction + 1; } else { $uta_nausea_vomit_satisfaction = $uta_nausea_vomit_satisfaction + 1; } if ($row->numbness_limb_bothering == 'None') { $none_numbness_limb_bothering = $none_numbness_limb_bothering + 1; } else if ($row->numbness_limb_bothering == 'Mild-Barely noticeable') { $mb_numbness_limb_bothering = $mb_numbness_limb_bothering + 1; } else if ($row->numbness_limb_bothering == 'Moderate:definitely noticeable') { $md_numbness_limb_bothering = $md_numbness_limb_bothering + 1; } else if ($row->numbness_limb_bothering == 'Severe:very pre-occupied by the symptom') { $s_numbness_limb_bothering = $s_numbness_limb_bothering + 1; } else { $uta_numbness_limb_bothering = $uta_numbness_limb_bothering + 1; } if ($row->numbness_pain_experience == 'None') { $none_numbness_pain_experience = $none_numbness_pain_experience + 1; } else if ($row->numbness_pain_experience == 'Mild-Barely noticeable') { $mb_numbness_pain_experience = $mb_numbness_pain_experience + 1; } else if ($row->numbness_pain_experience == 'Moderate Pain') { $md_numbness_pain_experience = $md_numbness_pain_experience + 1; } else if ($row->numbness_pain_experience == 'Severe Pain') { $s_numbness_pain_experience = $s_numbness_pain_experience + 1; } else if ($row->numbness_pain_experience == 'Unable to Answer') { $uta_numbness_pain_experience = $uta_numbness_pain_experience + 1; } if ($row->similar_op_again == 'Yes') { $yes_similar_op_again = $yes_similar_op_again + 1; } else if ($row->similar_op_again == 'No') { $no_similar_op_again = $no_similar_op_again + 1; } else { $uta_similar_op_again = $uta_similar_op_again + 1; } if ($row->overall_satisfaction == '1') { $one_overall_satisfaction = $one_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '2') { $two_overall_satisfaction = $two_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '3') { $three_overall_satisfaction = $three_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '4') { $four_overall_satisfaction = $four_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '5') { $five_overall_satisfaction = $five_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '6') { $six_overall_satisfaction = $six_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '7') { $seven_overall_satisfaction = $seven_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '8') { $eight_overall_satisfaction = $eight_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '9') { $nine_overall_satisfaction = $nine_overall_satisfaction + 1; } else if ($row->overall_satisfaction == '10') { $ten_overall_satisfaction = $ten_overall_satisfaction + 1; } } // pain_before_surgery $product_pain_before_surgery[] = [ 'name' => 'Yes', 'count' => $yes_pain_before_surgery, // 'perc'=> number_format((float)(($yes_pain_before_surgery/$total)*100), 2, '.', '')."%" ]; $product_pain_before_surgery[] = [ 'name' => 'No', 'count' => $no_pain_before_surgery, // 'perc'=> number_format((float)(($no_pain_before_surgery/$total)*100), 2, '.', '')."%" ]; // anaesthesist_time $product_anaesthesist_time[] = [ 'name' => 'Yes', 'count' => $yes_anaesthesist_time, // 'perc'=> number_format((float)(($yes_anaesthesist_time/$total)*100), 2, '.', '')."%" ]; $product_anaesthesist_time[] = [ 'name' => 'No', 'count' => $no_anaesthesist_time, // 'perc'=> number_format((float)(($no_anaesthesist_time/$total)*100), 2, '.', '')."%" ]; // anaesthesia_satisfaction $product_anaesthesia_satisfaction[] = [ 'name' => 'Very satisfied', 'count' => $vsat_anaesthesia_satisfaction, // 'perc'=> number_format((float)(($vsat_anaesthesia_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_anaesthesia_satisfaction[] = [ 'name' => 'Satisfied', 'count' => $sat_anaesthesia_satisfaction, // 'perc'=> number_format((float)(($sat_anaesthesia_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_anaesthesia_satisfaction[] = [ 'name' => 'Dissatisfied', 'count' => $dsat_anaesthesia_satisfaction, // 'perc'=> number_format((float)(($dsat_anaesthesia_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_anaesthesia_satisfaction[] = [ 'name' => 'Very Dissatisfied', 'count' => $vdsat_anaesthesia_satisfaction, // 'perc'=> number_format((float)(($vdsat_anaesthesia_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_anaesthesia_satisfaction[] = [ 'name' => 'Unable to Answer', 'count' => $uta_anaesthesia_satisfaction, // 'perc'=> number_format((float)(($uta_anaesthesia_satisfaction/$total)*100), 2, '.', '')."%" ]; // pain_therapy_satisfaction $product_pain_therapy_satisfaction[] = [ 'name' => 'Very satisfied', 'count' => $vsat_pain_therapy_satisfaction, // 'perc'=> number_format((float)(($vsat_pain_therapy_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_pain_therapy_satisfaction[] = [ 'name' => 'Satisfied', 'count' => $sat_pain_therapy_satisfaction, // 'perc'=> number_format((float)(($sat_pain_therapy_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_pain_therapy_satisfaction[] = [ 'name' => 'Dissatisfied', 'count' => $dsat_pain_therapy_satisfaction, // 'perc'=> number_format((float)(($dsat_pain_therapy_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_pain_therapy_satisfaction[] = [ 'name' => 'Very Dissatisfied', 'count' => $vdsat_pain_therapy_satisfaction, // 'perc'=> number_format((float)(($vdsat_pain_therapy_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_pain_therapy_satisfaction[] = [ 'name' => 'Unable to Answer', 'count' => $uta_pain_therapy_satisfaction, // 'perc'=> number_format((float)(($uta_pain_therapy_satisfaction/$total)*100), 2, '.', '')."%" ]; // nausea_vomit_satisfaction $product_nausea_vomit_satisfaction[] = [ 'name' => 'Very satisfied', 'count' => $vsat_nausea_vomit_satisfaction, // 'perc'=> number_format((float)(($vsat_nausea_vomit_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_nausea_vomit_satisfaction[] = [ 'name' => 'Satisfied', 'count' => $sat_nausea_vomit_satisfaction, // 'perc'=> number_format((float)(($sat_nausea_vomit_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_nausea_vomit_satisfaction[] = [ 'name' => 'Dissatisfied', 'count' => $dsat_nausea_vomit_satisfaction, // 'perc'=> number_format((float)(($dsat_nausea_vomit_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_nausea_vomit_satisfaction[] = [ 'name' => 'Very Dissatisfied', 'count' => $vdsat_nausea_vomit_satisfaction, // 'perc'=> number_format((float)(($vdsat_nausea_vomit_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_nausea_vomit_satisfaction[] = [ 'name' => 'Unable to Answer', 'count' => $uta_nausea_vomit_satisfaction, // 'perc'=> number_format((float)(($uta_nausea_vomit_satisfaction/$total)*100), 2, '.', '')."%" ]; // numbness_limb_bothering $product_numbness_limb_bothering[] = [ 'name' => 'None', 'count' => $none_numbness_limb_bothering, // 'perc'=> number_format((float)(($none_numbness_limb_bothering/$total)*100), 2, '.', '')."%" ]; $product_numbness_limb_bothering[] = [ 'name' => 'Mild-Barely noticeable', 'count' => $mb_numbness_limb_bothering, // 'perc'=> number_format((float)(($mb_numbness_limb_bothering/$total)*100), 2, '.', '')."%" ]; $product_numbness_limb_bothering[] = [ 'name' => 'Moderate:definitely noticeable', 'count' => $md_numbness_limb_bothering, // 'perc'=> number_format((float)(($md_numbness_limb_bothering/$total)*100), 2, '.', '')."%" ]; $product_numbness_limb_bothering[] = [ 'name' => 'Severe:very pre-occupied by the symptom', 'count' => $s_numbness_limb_bothering, // 'perc'=> number_format((float)(($s_numbness_limb_bothering/$total)*100), 2, '.', '')."%" ]; $product_numbness_limb_bothering[] = [ 'name' => 'Unable to Answer', 'count' => $uta_numbness_limb_bothering, // 'perc'=> number_format((float)(($uta_numbness_limb_bothering/$total)*100), 2, '.', '')."%" ]; // numbness_pain_experience $product_numbness_pain_experience[] = [ 'name' => 'None', 'count' => $none_numbness_pain_experience, // 'perc'=> number_format((float)(($none_numbness_pain_experience/$total)*100), 2, '.', '')."%" ]; $product_numbness_pain_experience[] = [ 'name' => 'Mild-Barely noticeable', 'count' => $mb_numbness_pain_experience, // 'perc'=> number_format((float)(($mb_numbness_pain_experience/$total)*100), 2, '.', '')."%" ]; $product_numbness_pain_experience[] = [ 'name' => 'Moderate Pain', 'count' => $md_numbness_pain_experience, // 'perc'=> number_format((float)(($md_numbness_pain_experience/$total)*100), 2, '.', '')."%" ]; $product_numbness_pain_experience[] = [ 'name' => 'Severe Pain', 'count' => $s_numbness_pain_experience, // 'perc'=> number_format((float)(($s_numbness_pain_experience/$total)*100), 2, '.', '')."%" ]; $product_numbness_pain_experience[] = [ 'name' => 'Unable to Answer', 'count' => $uta_numbness_pain_experience, // 'perc'=> number_format((float)(($uta_numbness_pain_experience/$total)*100), 2, '.', '')."%" ]; // similar_op_again $product_similar_op_again[] = [ 'name' => 'Yes', 'count' => $yes_similar_op_again, // 'perc'=> number_format((float)(($yes_similar_op_again/$total)*100), 2, '.', '')."%" ]; $product_similar_op_again[] = [ 'name' => 'No', 'count' => $no_similar_op_again, // 'perc'=> number_format((float)(($no_similar_op_again/$total)*100), 2, '.', '')."%" ]; $product_similar_op_again[] = [ 'name' => 'Unable to Answer', 'count' => $uta_similar_op_again, // 'perc'=> number_format((float)(($uta_similar_op_again/$total)*100), 2, '.', '')."%" ]; // overall_satisfaction $product_overall_satisfaction[] = [ 'name' => '1', 'count' => $one_overall_satisfaction, // 'perc'=> number_format((float)(($one_overall_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_overall_satisfaction[] = [ 'name' => '2', 'count' => $two_overall_satisfaction, // 'perc'=> number_format((float)(($two_overall_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_overall_satisfaction[] = [ 'name' => '3', 'count' => $three_overall_satisfaction, // 'perc'=> number_format((float)(($three_overall_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_overall_satisfaction[] = [ 'name' => '4', 'count' => $four_overall_satisfaction, // 'perc'=> number_format((float)(($four_overall_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_overall_satisfaction[] = [ 'name' => '5', 'count' => $five_overall_satisfaction, // 'perc'=> number_format((float)(($five_overall_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_overall_satisfaction[] = [ 'name' => '6', 'count' => $six_overall_satisfaction, // 'perc'=> number_format((float)(($six_overall_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_overall_satisfaction[] = [ 'name' => '7', 'count' => $seven_overall_satisfaction, // 'perc'=> number_format((float)(($seven_overall_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_overall_satisfaction[] = [ 'name' => '8', 'count' => $eight_overall_satisfaction, // 'perc'=> number_format((float)(($eight_overall_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_overall_satisfaction[] = [ 'name' => '9', 'count' => $nine_overall_satisfaction, // 'perc'=> number_format((float)(($nine_overall_satisfaction/$total)*100), 2, '.', '')."%" ]; $product_overall_satisfaction[] = [ 'name' => '10', 'count' => $ten_overall_satisfaction, // 'perc'=> number_format((float)(($ten_overall_satisfaction/$total)*100), 2, '.', '')."%" ]; // well_managed $product_well_managed[] = [ 'name' => 'Very satisfied', 'count' => $vsat_well_managed, // 'perc'=> number_format((float)(($vsat_well_managed/$total)*100), 2, '.', '')."%" ]; $product_well_managed[] = [ 'name' => 'Satisfied', 'count' => $sat_well_managed, // 'perc'=> number_format((float)(($sat_well_managed/$total)*100), 2, '.', '')."%" ]; $product_well_managed[] = [ 'name' => 'Dissatisfied', 'count' => $dsat_well_managed, // 'perc'=> number_format((float)(($dsat_well_managed/$total)*100), 2, '.', '')."%" ]; $product_well_managed[] = [ 'name' => 'Very Dissatisfied', 'count' => $vdsat_well_managed, // 'perc'=> number_format((float)(($vdsat_well_managed/$total)*100), 2, '.', '')."%" ]; $product_well_managed[] = [ 'name' => 'Unable to Answer', 'count' => $uta_well_managed, // 'perc'=> number_format((float)(($uta_well_managed/$total)*100), 2, '.', '')."%" ]; $data['product_pain_before_surgery'] = $product_pain_before_surgery; $data['product_anaesthesist_time'] = $product_anaesthesist_time; $data['product_pain_therapy_satisfaction'] = $product_pain_therapy_satisfaction; $data['product_nausea_vomit_satisfaction'] = $product_nausea_vomit_satisfaction; $data['product_numbness_limb_bothering'] = $product_numbness_limb_bothering; $data['product_numbness_pain_experience'] = $product_numbness_pain_experience; $data['product_similar_op_again'] = $product_similar_op_again; $data['product_overall_satisfaction'] = $product_overall_satisfaction; $data['product_anaesthesia_satisfaction'] = $product_anaesthesia_satisfaction; $data['product_well_managed'] = $product_well_managed; $data['total'] = $total; // print_r($product_pain_before_surgery); // print_r($product_anaesthesist_involved); // print_r($product_pain_therapy_satisfaction); // print_r($product_nausea_vomit_satisfaction); // print_r($product_numbness_limb_bothering); // print_r($product_numbness_pain_experience); // print_r($product_similar_op_again); // print_r($product_overall_satisfaction); // print_r($product_anaesthesia_satisfaction);die(); // print_r($data);die(); return view('cnb/reports/satisfaction_score_v', $data); } else { return redirect()->route("n_report"); } } // spinal // public function spinal_LA() // { // $db = \Config\Database::connect(); // $dr_id = session()->get('dr_id'); // $from_date = session()->get('from_date'); // $to_date = session()->get('to_date'); // if ($from_date && $to_date) { // $total = session()->get('n'); // $products = []; // $products1 = []; // $products2 = []; // $products3 = []; // $combo_count1 = 0; // $combo_count2 = 0; // $la_ropivacaine = 0; // $la_bupivacaine = 0; // $la_prilocaine = 0; // $la_lignocaine = 0; // $la_2_chloroprocaine = 0; // $la_otheraine = 0; // $la_ropivacaine1 = 0; // $la_bupivacaine1 = 0; // $la_prilocaine1 = 0; // $la_lignocaine1 = 0; // $la_2_chloroprocaine1 = 0; // $la_otheraine1 = 0; // $ligno_bupi = 0; // $ligno_rupi = 0; // $ligno_prilo = 0; // $ligno_chloro = 0; // $ligno_oth = 0; // $bupi_rupi = 0; // $bupi_prilo = 0; // $bupi_chloro = 0; // $bupi_oth = 0; // $rupi_prilo = 0; // $rupi_chloro = 0; // $rupi_oth = 0; // $prilo_chloro = 0; // $prilo_oth = 0; // $chloro_oth = 0; // $ligno_bupi1 = 0; // $ligno_rupi1 = 0; // $ligno_prilo1 = 0; // $ligno_chloro1 = 0; // $ligno_oth1 = 0; // $bupi_rupi1 = 0; // $bupi_prilo1 = 0; // $bupi_chloro1 = 0; // $bupi_oth1 = 0; // $rupi_prilo1 = 0; // $rupi_chloro1 = 0; // $rupi_oth1 = 0; // $prilo_chloro1 = 0; // $prilo_oth1 = 0; // $chloro_oth1 = 0; // $builder = $db->table('cnb_postop'); // $query = $builder->select("cnb_postop.id as count,procedure_spinal.la_ropivacaine,procedure_spinal.la_bupivacaine,procedure_spinal.la_prilocaine,procedure_spinal.la_lignocaine,procedure_spinal.la_otheraine,procedure_spinal.la_2_chloroprocaine"); // $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); // $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); // $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); // $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); // // $query = $builder->where('cnb_postop.dr_id ',$dr_id); // $query = $builder->get(); // $record = $query->getResult(); // if ($record) { // foreach ($record as $row) { // $combo1 = 0; // $combo2 = 0; // if (substr($row->la_ropivacaine, 0, 5) == "Heavy") { // $la_ropivacaine = $la_ropivacaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_ropivacaine, 0, 13) == 'Iso/Hypobaric') { // $la_ropivacaine1 = $la_ropivacaine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_bupivacaine, 0, 5) == "Heavy") { // $la_bupivacaine = $la_bupivacaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_bupivacaine, 0, 13) == 'Iso/Hypobaric') { // $la_bupivacaine1 = $la_bupivacaine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_levobupivacaine, 0, 5) == "Heavy") { // $la_levobupivacaine = $la_levobupivacaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_levobupivacaine, 0, 13) == 'Iso/Hypobaric') { // $la_levobupivacaine1 = $la_levobupivacaine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_lignocaine, 0, 5) == "Heavy") { // $la_lignocaine = $la_lignocaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_lignocaine, 0, 13) == 'Iso/Hypobaric') { // $la_lignocaine1 = $la_lignocaine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_otheraine, 0, 5) == "Heavy") { // $la_otheraine = $la_otheraine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_otheraine, 0, 13) == 'Iso/Hypobaric') { // $la_otheraine1 = $la_otheraine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_2_chloroprocaine, 0, 5) == "Heavy") { // $la_2_chloroprocaine = $la_2_chloroprocaine + 1; // $combo1 = $combo2 + 1; // } else if (substr($row->la_2_chloroprocaine, 0, 13) == 'Iso/Hypobaric') { // $la_2_chloroprocaine1 = $la_2_chloroprocaine1 + 1; // $combo1 = $combo2 + 1; // } // if ($combo1 > 1) { // $combo_count1 = $combo_count1 + 1; // } // if ($combo2 > 1) { // $combo_count2 = $combo_count2 + 1; // } // } // } // $products[] = array( // 'day' => 'lignocaine', // 'sell' => $la_lignocaine // ); // $products[] = array( // 'day' => 'bupivacaine', // 'sell' => $la_bupivacaine // ); // $products[] = array( // 'day' => 'ropivacaine', // 'sell' => $la_ropivacaine // ); // $products[] = array( // 'day' => 'prilocaine', // 'sell' => $la_prilocaine // ); // $products[] = array( // 'day' => '2-chloroprocaine', // 'sell' => $la_2_chloroprocaine // ); // $products[] = array( // 'day' => 'other', // 'sell' => $la_otheraine // ); // $products1[] = array( // 'day' => 'lignocaine', // 'sell' => $la_lignocaine1 // ); // $products1[] = array( // 'day' => 'bupivacaine', // 'sell' => $la_bupivacaine1 // ); // $products1[] = array( // 'day' => 'ropivacaine', // 'sell' => $la_ropivacaine1 // ); // $products1[] = array( // 'day' => 'prilocaine', // 'sell' => $la_prilocaine1 // ); // $products1[] = array( // 'day' => '2-chloroprocaine', // 'sell' => $la_2_chloroprocaine1 // ); // $products1[] = array( // 'day' => 'other', // 'sell' => $la_otheraine1 // ); // $products_combo[] = array( // 'day' => 'Heavy', // 'sell' => $combo_count1 // ); // $products_combo[] = array( // 'day' => 'Iso/Hypobaric', // 'sell' => $combo_count2 // ); // $data['combo_count'] = ($combo_count); // $data['products'] = ($products); // $data['products1'] = ($products1); // $data['products_combo'] = ($products_combo); // $data['total_combo'] = $combo_count1 + $combo_count2; // $data['total_n'] = $la_ropivacaine + $la_bupivacaine + $la_levobupivacaine + $la_lignocaine + $la_2_chloroprocaine + $la_otheraine; // $data['total_n1'] = $la_ropivacaine1 + $la_bupivacaine1 + $la_levobupivacaine1 + $la_lignocaine1 + $la_2_chloroprocaine1 + $la_otheraine1; // $data['total'] = $total; // return view('cnb/reports/spinal_LA', $data); // } else { // return redirect()->route("n_report"); // } // } public function spinal_LA() { $db = \Config\Database::connect(); $dr_id = session()->get('dr_id'); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $products = []; $products1 = []; $products2 = []; $products3 = []; $combo_count1 = 0; $combo_count2 = 0; $la_ropivacaine = 0; $la_bupivacaine = 0; $la_prilocaine = 0; $la_lignocaine = 0; $la_2_chloroprocaine = 0; $la_otheraine = 0; $la_ropivacaine1 = 0; $la_bupivacaine1 = 0; $la_prilocaine1 = 0; $la_lignocaine1 = 0; $la_2_chloroprocaine1 = 0; $la_otheraine1 = 0; $ligno_bupi = 0; $ligno_rupi = 0; $ligno_prilo = 0; $ligno_chloro = 0; $ligno_oth = 0; $bupi_rupi = 0; $bupi_prilo = 0; $bupi_chloro = 0; $bupi_oth = 0; $rupi_prilo = 0; $rupi_chloro = 0; $rupi_oth = 0; $prilo_chloro = 0; $prilo_oth = 0; $chloro_oth = 0; $ligno_bupi1 = 0; $ligno_rupi1 = 0; $ligno_prilo1 = 0; $ligno_chloro1 = 0; $ligno_oth1 = 0; $bupi_rupi1 = 0; $bupi_prilo1 = 0; $bupi_chloro1 = 0; $bupi_oth1 = 0; $rupi_prilo1 = 0; $rupi_chloro1 = 0; $rupi_oth1 = 0; $prilo_chloro1 = 0; $prilo_oth1 = 0; $chloro_oth1 = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count,procedure_spinal.la_ropivacaine,procedure_spinal.la_bupivacaine,procedure_spinal.la_prilocaine,procedure_spinal.la_lignocaine,procedure_spinal.la_otheraine,procedure_spinal.la_2_chloroprocaine"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); // $query = $builder->where('cnb_postop.dr_id ',$dr_id); $query = $builder->get(); $record = $query->getResult(); // print_r($record); // die(); // $lastQuery = $db->getLastQuery(); // echo $lastQuery; $heavyCount = 0; $isoHypobaricCount = 0; // if ($record) { // foreach ($record as $row) { // if(strpos($row->la_ropivacaine, 'Heavy') !== false) { // $la_ropivacaine++; // $heavyCount++; // } // elseif(strpos($row->la_bupivacaine, 'Heavy') !== false) { // $la_bupivacaine++; // $heavyCount++; // } // elseif(strpos($row->la_prilocaine, 'Heavy') !== false) { // $la_prilocaine++; // $heavyCount++; // } // elseif(strpos($row->la_lignocaine, 'Heavy') !== false) { // $la_lignocaine++; // $heavyCount++; // } // elseif(strpos($row->la_otheraine, 'Heavy') !== false) { // $la_otheraine++; // $heavyCount++; // } // elseif(strpos($row->la_2_chloroprocaine, 'Heavy') !== false) { // $la_2_chloroprocaine++; // $heavyCount++; // } // //second // elseif(strpos($row->la_ropivacaine, 'Iso/Hypobaric') !== false) { // $la_ropivacaine1++; // $isoHypobaricCount++; // } // elseif(strpos($row->la_bupivacaine, 'Iso/Hypobaric') !== false) { // $la_bupivacaine1++; // $isoHypobaricCount++; // } // elseif(strpos($row->la_prilocaine, 'Iso/Hypobaric') !== false) { // $la_prilocaine1++; // $isoHypobaricCount++; // } // elseif(strpos($row->la_lignocaine, 'Iso/Hypobaric') !== false) { // $la_lignocaine1++; // $isoHypobaricCount++; // } // elseif(strpos($row->la_otheraine, 'Iso/Hypobaric') !== false) { // $la_otheraine1++; // $isoHypobaricCount++; // } // elseif(strpos($row->la_2_chloroprocaine, 'Iso/Hypobaric') !== false) { // $la_2_chloroprocaine1++; // $isoHypobaricCount++; // } // } // } if ($record) { foreach ($record as $row) { if(strpos($row->la_ropivacaine, 'Heavy') !== false && $row->la_bupivacaine==',,,' && $row->la_prilocaine==',,,' && $row->la_lignocaine==',,,'&& $row->la_otheraine==',,,,'&& $row->la_2_chloroprocaine==',,,' ) { $la_ropivacaine++; $heavyCount++; } elseif(strpos($row->la_bupivacaine, 'Heavy') !== false && $row->la_ropivacaine==',,,' && $row->la_prilocaine==',,,' && $row->la_lignocaine==',,,'&& $row->la_otheraine==',,,,'&& $row->la_2_chloroprocaine==',,,') { $la_bupivacaine++; $heavyCount++; } elseif(strpos($row->la_prilocaine, 'Heavy') !== false && $row->la_bupivacaine==',,,' && $row->la_ropivacaine==',,,' && $row->la_lignocaine==',,,'&& $row->la_otheraine==',,,,'&& $row->la_2_chloroprocaine==',,,') { $la_prilocaine++; $heavyCount++; } elseif(strpos($row->la_lignocaine, 'Heavy') !== false && $row->la_bupivacaine==',,,' && $row->la_prilocaine==',,,' && $row->la_ropivacaine==',,,'&& $row->la_otheraine==',,,,'&& $row->la_2_chloroprocaine==',,,') { $la_lignocaine++; $heavyCount++; } elseif(strpos($row->la_otheraine, 'Heavy') !== false && $row->la_bupivacaine==',,,' && $row->la_prilocaine==',,,' && $row->la_lignocaine==',,,'&& $row->la_ropivacaine==',,,'&& $row->la_2_chloroprocaine==',,,') { $la_otheraine++; $heavyCount++; } elseif(strpos($row->la_2_chloroprocaine, 'Heavy') !== false && $row->la_bupivacaine==',,,' && $row->la_prilocaine==',,,' && $row->la_lignocaine==',,,'&& $row->la_otheraine==',,,,'&& $row->la_ropivacaine==',,,') { $la_2_chloroprocaine++; $heavyCount++; } //second elseif(strpos($row->la_ropivacaine, 'Iso/Hypobaric') !== false && $row->la_bupivacaine==',,,' && $row->la_prilocaine==',,,' && $row->la_lignocaine==',,,'&& $row->la_otheraine==',,,,'&& $row->la_2_chloroprocaine==',,,') { $la_ropivacaine1++; $isoHypobaricCount++; } elseif(strpos($row->la_bupivacaine, 'Iso/Hypobaric') !== false && $row->la_ropivacaine==',,,' && $row->la_prilocaine==',,,' && $row->la_lignocaine==',,,'&& $row->la_otheraine==',,,,'&& $row->la_2_chloroprocaine==',,,') { $la_bupivacaine1++; $isoHypobaricCount++; } elseif(strpos($row->la_prilocaine, 'Iso/Hypobaric') !== false && $row->la_bupivacaine==',,,' && $row->la_ropivacaine==',,,' && $row->la_lignocaine==',,,'&& $row->la_otheraine==',,,,'&& $row->la_2_chloroprocaine==',,,') { $la_prilocaine1++; $isoHypobaricCount++; } elseif(strpos($row->la_lignocaine, 'Iso/Hypobaric') !== false && $row->la_bupivacaine==',,,' && $row->la_prilocaine==',,,' && $row->la_ropivacaine==',,,'&& $row->la_otheraine==',,,,'&& $row->la_2_chloroprocaine==',,,') { $la_lignocaine1++; $isoHypobaricCount++; } elseif(strpos($row->la_otheraine, 'Iso/Hypobaric') !== false && $row->la_bupivacaine==',,,' && $row->la_prilocaine==',,,' && $row->la_lignocaine==',,,'&& $row->la_ropivacaine==',,,'&& $row->la_2_chloroprocaine==',,,') { $la_otheraine1++; $isoHypobaricCount++; } elseif(strpos($row->la_2_chloroprocaine, 'Iso/Hypobaric') !== false && $row->la_bupivacaine==',,,' && $row->la_prilocaine==',,,' && $row->la_lignocaine==',,,'&& $row->la_otheraine==',,,,'&& $row->la_ropivacaine==',,,') { $la_2_chloroprocaine1++; $isoHypobaricCount++; } } } //combo if ($record) { $combo_count1 = 0; foreach ($record as $row) { $combo1 = 0; if (strpos($row->la_bupivacaine, 'Heavy') !== false) { $combo1 = $combo1 + 1; } if (strpos($row->la_ropivacaine, 'Heavy') !== false) { $combo1 = $combo1 + 1; } if (strpos($row->la_prilocaine, 'Heavy') !== false) { $combo1 = $combo1 + 1; } if (strpos($row->la_lignocaine, 'Heavy') !== false) { $combo1 = $combo1 + 1; } if (strpos($row->la_otheraine, 'Heavy') !== false) { $combo1 = $combo1 + 1; } if (strpos($row->la_2_chloroprocaine, 'Heavy') !== false) { $combo1 = $combo1 + 1; } //second if (strpos($row->la_otheraine, 'Iso/Hypobaric') !== false) { $combo1 = $combo1 + 1; } if (strpos($row->la_ropivacaine, 'Iso/Hypobaric') !== false) { $combo1 = $combo1 + 1; } if (strpos($row->la_prilocaine, 'Iso/Hypobaric') !== false) { $combo1 = $combo1 + 1; } if (strpos($row->la_lignocaine, 'Iso/Hypobaric') !== false) { $combo1 = $combo1 + 1; } if (strpos($row->la_2_chloroprocaine, 'Iso/Hypobaric') !== false) { $combo1 = $combo1 + 1; } if (strpos($row->la_bupivacaine, 'Iso/Hypobaric') !== false) { $combo1 = $combo1 + 1; } if ($combo1 > 1) { $combo_count1 = $combo_count1 + 1; } } } $products[] = array( 'day' => 'lignocaine', 'sell' => $la_lignocaine ); $products[] = array( 'day' => 'bupivacaine', 'sell' => $la_bupivacaine ); $products[] = array( 'day' => 'ropivacaine', 'sell' => $la_ropivacaine ); $products[] = array( 'day' => 'prilocaine', 'sell' => $la_prilocaine ); $products[] = array( 'day' => '2-chloroprocaine', 'sell' => $la_2_chloroprocaine ); $products[] = array( 'day' => 'other', 'sell' => $la_otheraine ); // print_r($products); // die(); $products1[] = array( 'day' => 'lignocaine', 'sell' => $la_lignocaine1 ); $products1[] = array( 'day' => 'bupivacaine', 'sell' => $la_bupivacaine1 ); $products1[] = array( 'day' => 'ropivacaine', 'sell' => $la_ropivacaine1 ); $products1[] = array( 'day' => 'prilocaine', 'sell' => $la_prilocaine1 ); $products1[] = array( 'day' => '2-chloroprocaine', 'sell' => $la_2_chloroprocaine1 ); $products1[] = array( 'day' => 'other', 'sell' => $la_otheraine1 ); // print_r($products1); // die(); $products_combo[] = array( 'day' => 'Total combo', 'sell' => $combo_count1 ); // $products_combo[] = array( // 'day' => 'Iso/Hypobaric', // 'sell' => $combo_count2 // ); $data['combo_count'] = ($combo_count); $data['products'] = ($products); $data['products1'] = ($products1); $data['products_combo'] = ($products_combo); $data['total_combo'] = $combo_count1 + $combo_count2; $data['total_n'] = $heavyCount; $data['total_n1'] = $isoHypobaricCount; $data['total'] = $total; return view('cnb/reports/spinal_LA', $data); } else { return redirect()->route("n_report"); } } // ============================================================================ // epidural // ****************************************** // public function Epidural_LA() // { // $db = \Config\Database::connect(); // $from_date = session()->get('from_date'); // $to_date = session()->get('to_date'); // $dr_id = session()->get('dr_id'); // $n = session()->get('n'); // $n_type = gettype($n); // // if($from_date && $to_date){ // if ($from_date && $to_date) { // $total = session()->get('n'); // $products = []; // $products1 = []; // $products2 = []; // $products3 = []; // $ropivacaine = 0; // $bupivacaine = 0; // $levobupivacaine = 0; // $lignocaine = 0; // $ropivacaine1 = 0; // $bupivacaine1 = 0; // $levobupivacaine1 = 0; // $lignocaine1 = 0; // $combo_count1 = 0; // $combo_count2 = 0; // $builder = $db->table('cnb_postop'); // $query = $builder->select("cnb_postop.id as count, procedure_epidural.la_ropivacaine,procedure_epidural.la_bupivacaine,procedure_epidural.la_levobupivacaine,procedure_epidural.la_lignocaine"); // $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); // $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); // $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); // $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); // // $query = $builder->where('cnb_postop.dr_id ',$dr_id); // $query = $builder->get(); // $record = $query->getResult(); // // print_r($record);die(); // if ($record) { // foreach ($record as $row) { // $combo1 = 0; // $combo2 = 0; // if (substr($row->la_ropivacaine, 0,7) == 'Without') { // $ropivacaine = $ropivacaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_ropivacaine, 0,4) == 'With') { // $ropivacaine1 = $ropivacaine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_bupivacaine, 0,7) == 'Without') { // $bupivacaine = $bupivacaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_bupivacaine, 0,4) == 'With') { // $bupivacaine1 = $bupivacaine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_levobupivacaine, 0,7) == 'Without') { // $levobupivacaine = $levobupivacaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_levobupivacaine, 0,4) == 'With') { // $levobupivacaine1 = $levobupivacaine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_lignocaine, 0,7) == 'Without') { // $lignocaine = $lignocaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_lignocaine, 0,4) == 'With') { // $lignocaine1 = $lignocaine1 + 1; // $combo2 = $combo2 + 1; // } // if ($combo1 > 1) { // $combo_count1 = $combo_count1 + 1; // } // if ($combo2 > 1) { // $combo_count2 = $combo_count2 + 1; // } // } // } // // $builder = $db->table('cnb_postop'); // // $query = $builder->select("cnb_postop.id as count, procedure_cse.la_ropivacaine,procedure_cse.la_bupivacaine,procedure_cse.la_levobupivacaine,procedure_cse.la_lignocaine"); // // $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); // // $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); // // $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); // // $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); // // // $query = $builder->where('cnb_postop.dr_id ',$dr_id); // // $query = $builder->get(); // // $record = $query->getResult(); // // // print_r($record);die(); // // if ($record) { // // foreach ($record as $row) { // // $combo1 = 0; // // $combo2 = 0; // // if (substr($row->la_ropivacaine, 0,7) == 'Without') { // // $ropivacaine = $ropivacaine + 1; // // $combo1 = $combo1 + 1; // // } else if (substr($row->la_ropivacaine, 0,4) == 'With') { // // $ropivacaine1 = $ropivacaine1 + 1; // // $combo2 = $combo2 + 1; // // } // // if (substr($row->la_bupivacaine, 0,7) == 'Without') { // // $bupivacaine = $bupivacaine + 1; // // $combo1 = $combo1 + 1; // // } else if (substr($row->la_bupivacaine, 0,4) == 'With') { // // $bupivacaine1 = $bupivacaine1 + 1; // // $combo2 = $combo2 + 1; // // } // // if (substr($row->la_levobupivacaine, 0,7) == 'Without') { // // $levobupivacaine = $levobupivacaine + 1; // // $combo1 = $combo1 + 1; // // } else if (substr($row->la_levobupivacaine, 0,4) == 'With') { // // $levobupivacaine1 = $levobupivacaine1 + 1; // // $combo2 = $combo2 + 1; // // } // // if (substr($row->la_lignocaine, 0,7) == 'Without') { // // $lignocaine = $lignocaine + 1; // // $combo1 = $combo1 + 1; // // } else if (substr($row->la_lignocaine, 0,4) == 'With') { // // $lignocaine1 = $lignocaine1 + 1; // // $combo2 = $combo2 + 1; // // } // // if ($combo1 > 1) { // // $combo_count1 = $combo_count1 + 1; // // } // // if ($combo2 > 1) { // // $combo_count2 = $combo_count2 + 1; // // } // // } // // } // // print_r($ropivacaine); // // die(); // $products[] = array( // 'day' => 'ropivacaine', // 'sell' => $ropivacaine // ); // $products[] = array( // 'day' => 'bupivacaine', // 'sell' => $bupivacaine // ); // $products[] = array( // 'day' => 'levobupivacaine', // 'sell' => $levobupivacaine // ); // $products[] = array( // 'day' => 'lignocaine', // 'sell' => $lignocaine // ); // $products1[] = array( // 'day' => 'Ropivacaine + Adrenaline', // 'sell' => $ropivacaine1 // ); // $products1[] = array( // 'day' => 'bupivacaine + Adrenaline', // 'sell' => $bupivacaine1 // ); // $products1[] = array( // 'day' => 'levobupivacaine + Adrenaline', // 'sell' => $levobupivacaine1 // ); // $products1[] = array( // 'day' => 'lignocaine + Adrenaline', // 'sell' => $lignocaine1 // ); // // print_r($products);die(); // $data['total_combo'] = $combo_count1 + $combo_count2; // $data['products_combo'] = ($products_combo); // $data['products'] = ($products); // $data['products1'] = ($products1); // $data['total_n'] = $ropivacaine + $bupivacaine + $levobupivacaine + $lignocaine; // $data['total_n1'] = $ropivacaine1 + $bupivacaine1 + $levobupivacaine1 + $lignocaine1; // return view('cnb/reports/epiduralLA_v', $data); // } else { // return redirect()->route("n_report"); // } // } public function Epidural_LA() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); $dr_id = session()->get('dr_id'); $n = session()->get('n'); $n_type = gettype($n); // if($from_date && $to_date){ if ($from_date && $to_date) { $total = session()->get('n'); $products = []; $products1 = []; $products2 = []; $products3 = []; $ropivacaine = 0; $bupivacaine = 0; $levobupivacaine = 0; $lignocaine = 0; $ropivacaine1 = 0; $bupivacaine1 = 0; $levobupivacaine1 = 0; $lignocaine1 = 0; $combo_count1 = 0; $combo_count2 = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.la_ropivacaine,procedure_epidural.la_bupivacaine,procedure_epidural.la_levobupivacaine,procedure_epidural.la_lignocaine"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); // $query = $builder->where('cnb_postop.dr_id ',$dr_id); $query = $builder->get(); $record = $query->getResult(); // print_r($record);die(); // $query = $db->getLastQuery(); // echo $query; if ($record) { foreach ($record as $row) { if (substr($row->la_ropivacaine, 0,7) == 'Without' && $row->la_bupivacaine==',,,' && $row->la_levobupivacaine==',,,' && $row->la_lignocaine==',,,') { $ropivacaine = $ropivacaine + 1; $combo1 = $combo1 + 1; } else if (substr($row->la_ropivacaine, 0,4) == 'With' && $row->la_bupivacaine==',,,' && $row->la_levobupivacaine==',,,' && $row->la_lignocaine==',,,') { $ropivacaine1 = $ropivacaine1 + 1; $combo1 = $combo1 + 1; } if (substr($row->la_bupivacaine, 0,7) == 'Without' && $row->la_ropivacaine==',,,' && $row->la_levobupivacaine==',,,' && $row->la_lignocaine==',,,') { $bupivacaine = $bupivacaine + 1; $combo1 = $combo1 + 1; } else if (substr($row->la_bupivacaine, 0,4) == 'With' && $row->la_ropivacaine==',,,' && $row->la_levobupivacaine==',,,' && $row->la_lignocaine==',,,') { $bupivacaine1 = $bupivacaine1 + 1; $combo1 = $combo1 + 1; } if (substr($row->la_levobupivacaine, 0,7) == 'Without' && $row->la_bupivacaine==',,,' && $row->la_ropivacaine==',,,' && $row->la_lignocaine==',,,') { $levobupivacaine = $levobupivacaine + 1; $combo1 = $combo1 + 1; } else if (substr($row->la_levobupivacaine, 0,4) == 'With' && $row->la_bupivacaine==',,,' && $row->la_ropivacaine==',,,' && $row->la_lignocaine==',,,') { $levobupivacaine1 = $levobupivacaine1 + 1; $combo1 = $combo1 + 1; } if (substr($row->la_lignocaine, 0,7) == 'Without' && $row->la_bupivacaine==',,,' && $row->la_levobupivacaine==',,,' && $row->la_ropivacaine==',,,') { $lignocaine = $lignocaine + 1; $combo1 = $combo1 + 1; } else if (substr($row->la_lignocaine, 0,4) == 'With' && $row->la_bupivacaine==',,,' && $row->la_levobupivacaine==',,,' && $row->la_ropivacaine==',,,') { $lignocaine1 = $lignocaine1 + 1; $combo1 = $combo1 + 1; } } } if ($record) { foreach ($record as $row) { $combo1 = 0; // $combo2 = 0; if (substr($row->la_ropivacaine, 0,7) == 'Without') { $combo1 = $combo1 + 1; } else if (substr($row->la_ropivacaine, 0,4) == 'With') { $combo1 = $combo1 + 1; } if (substr($row->la_bupivacaine, 0,7) == 'Without') { $combo1 = $combo1 + 1; } else if (substr($row->la_bupivacaine, 0,4) == 'With') { $combo1 = $combo1 + 1; } if (substr($row->la_levobupivacaine, 0,7) == 'Without') { $combo1 = $combo1 + 1; } else if (substr($row->la_levobupivacaine, 0,4) == 'With' ) { $combo1 = $combo1 + 1; } if (substr($row->la_lignocaine, 0,7) == 'Without' ) { $combo1 = $combo1 + 1; } else if (substr($row->la_lignocaine, 0,4) == 'With' ) { $combo1 = $combo1 + 1; } if ($combo1 > 1) { $combo_count1 = $combo_count1 + 1; } // if ($combo2 > 1) { // $combo_count2 = $combo_count2 + 1; // } } } $products[] = array( 'day' => 'ropivacaine', 'sell' => $ropivacaine ); $products[] = array( 'day' => 'bupivacaine', 'sell' => $bupivacaine ); $products[] = array( 'day' => 'levobupivacaine', 'sell' => $levobupivacaine ); $products[] = array( 'day' => 'lignocaine', 'sell' => $lignocaine ); $products1[] = array( 'day' => 'Ropivacaine + Adrenaline', 'sell' => $ropivacaine1 ); $products1[] = array( 'day' => 'bupivacaine + Adrenaline', 'sell' => $bupivacaine1 ); $products1[] = array( 'day' => 'levobupivacaine + Adrenaline', 'sell' => $levobupivacaine1 ); $products1[] = array( 'day' => 'lignocaine + Adrenaline', 'sell' => $lignocaine1 ); $products_combo[] = array( 'day' => 'Total combo', 'sell' => $combo_count1 ); // print_r($combo_count1);die(); $data['total_combo'] = ($combo_count1); $data['products_combo'] = ($products_combo); $data['products'] = ($products); $data['products1'] = ($products1); $data['total_n'] = $ropivacaine + $bupivacaine + $levobupivacaine + $lignocaine; $data['total_n1'] = $ropivacaine1 + $bupivacaine1 + $levobupivacaine1 + $lignocaine1; return view('cnb/reports/epiduralLA_v', $data); } else { return redirect()->route("n_report"); } } // =========================================================== // CSA // *************** // public function CSA_LA() // { // $db = \Config\Database::connect(); // $dr_id = session()->get('dr_id'); // $from_date = session()->get('from_date'); // $to_date = session()->get('to_date'); // // print_r($from_date); // // print_r($to_date);die(); // if ($from_date && $to_date) { // $total = session()->get('n'); // // print_r($total);die(); // $products = []; // $products1 = []; // $products2 = []; // $products3 = []; // $combo_count1 = 0; // $combo_count2 = 0; // $la_ropivacaine = 0; // $la_bupivacaine = 0; // $la_prilocaine = 0; // $la_lignocaine = 0; // $la_2_chloroprocaine = 0; // $la_otheraine = 0; // $la_ropivacaine1 = 0; // $la_bupivacaine1 = 0; // $la_prilocaine1 = 0; // $la_lignocaine1 = 0; // $la_2_chloroprocaine1 = 0; // $la_otheraine1 = 0; // $ligno_bupi = 0; // $ligno_rupi = 0; // $ligno_prilo = 0; // $ligno_chloro = 0; // $ligno_oth = 0; // $bupi_rupi = 0; // $bupi_prilo = 0; // $bupi_chloro = 0; // $bupi_oth = 0; // $rupi_prilo = 0; // $rupi_chloro = 0; // $rupi_oth = 0; // $prilo_chloro = 0; // $prilo_oth = 0; // $chloro_oth = 0; // $ligno_bupi1 = 0; // $ligno_rupi1 = 0; // $ligno_prilo1 = 0; // $ligno_chloro1 = 0; // $ligno_oth1 = 0; // $bupi_rupi1 = 0; // $bupi_prilo1 = 0; // $bupi_chloro1 = 0; // $bupi_oth1 = 0; // $rupi_prilo1 = 0; // $rupi_chloro1 = 0; // $rupi_oth1 = 0; // $prilo_chloro1 = 0; // $prilo_oth1 = 0; // $chloro_oth1 = 0; // $builder = $db->table('cnb_postop'); // $query = $builder->select("cnb_postop.id as count,procedure_csa.rupivacaine,procedure_csa.chloroprocaine,procedure_csa.prilocaine,procedure_csa.bupivacaine,procedure_csa.lignocaline"); // $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); // $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); // $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); // $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); // // $query = $builder->where('cnb_postop.dr_id ',$dr_id); // $query = $builder->get(); // $record = $query->getResult(); // if ($record) { // foreach ($record as $row) { // $combo1 = 0; // $combo2 = 0; // if (substr($row->la_ropivacaine, 0, 5) == "Heavy") { // $la_ropivacaine = $la_ropivacaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_ropivacaine, 0, 13) == 'Iso/Hypobaric') { // $la_ropivacaine1 = $la_ropivacaine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_bupivacaine, 0, 5) == "Heavy") { // $la_bupivacaine = $la_bupivacaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_bupivacaine, 0, 13) == 'Iso/Hypobaric') { // $la_bupivacaine1 = $la_bupivacaine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_levobupivacaine, 0, 5) == "Heavy") { // $la_levobupivacaine = $la_levobupivacaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_levobupivacaine, 0, 13) == 'Iso/Hypobaric') { // $la_levobupivacaine1 = $la_levobupivacaine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_lignocaine, 0, 5) == "Heavy") { // $la_lignocaine = $la_lignocaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_lignocaine, 0, 13) == 'Iso/Hypobaric') { // $la_lignocaine1 = $la_lignocaine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_otheraine, 0, 5) == "Heavy") { // $la_otheraine = $la_otheraine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_otheraine, 0, 13) == 'Iso/Hypobaric') { // $la_otheraine1 = $la_otheraine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_2_chloroprocaine, 0, 5) == "Heavy") { // $la_2_chloroprocaine = $la_2_chloroprocaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_2_chloroprocaine, 0, 13) == 'Iso/Hypobaric') { // $la_2_chloroprocaine1 = $la_2_chloroprocaine1 + 1; // $combo2 = $combo2 + 1; // } // if ($combo1 > 1) { // $combo_count1 = $combo_count1 + 1; // } // if ($combo2 > 1) { // $combo_count2 = $combo_count2 + 1; // } // } // } // if ($la_lignocaine != 0 && $la_bupivacaine != 0) { // $ligno_bupi = $ligno_bupi + 1; // } // if ($la_lignocaine != 0 && $la_ropivacaine != 0) { // $ligno_rupi = $ligno_rupi + 1; // } // if ($la_lignocaine != 0 && $la_prilocaine != 0) { // $ligno_prilo = $ligno_prilo + 1; // } // if ($la_lignocaine != 0 && $la_2_chloroprocaine != 0) { // $ligno_chloro = $ligno_chloro + 1; // } // if ($la_lignocaine != 0 && $la_2_chloroprocaine != 0) { // $ligno_oth = $ligno_oth + 1; // } // if ($la_bupivacaine != 0 && $la_ropivacaine != 0) { // $bupi_rupi = $bupi_rupi + 1; // } // if ($la_bupivacaine != 0 && $la_prilocaine != 0) { // $bupi_prilo = $bupi_prilo + 1; // } // if ($la_bupivacaine != 0 && $la_2_chloroprocaine != 0) { // $bupi_chloro = $bupi_chloro + 1; // } // if ($la_bupivacaine != 0 && $la_otheraine != 0) { // $bupi_oth = $bupi_oth + 1; // } // if ($la_ropivacaine != 0 && $la_prilocaine != 0) { // $rupi_prilo = $rupi_prilo + 1; // } // if ($la_ropivacaine != 0 && $la_2_chloroprocaine != 0) { // $rupi_chloro = $rupi_chloro + 1; // } // if ($la_ropivacaine != 0 && $la_otheraine != 0) { // $rupi_oth = $rupi_oth + 1; // } // if ($la_prilocaine != 0 && $la_2_chloroprocaine != 0) { // $prilo_chloro = $prilo_chloro + 1; // } // if ($la_prilocaine != 0 && $la_otheraine != 0) { // $prilo_oth = $prilo_oth + 1; // } // if ($la_2_chloroprocaine != 0 && $la_otheraine != 0) { // $chloro_oth = $chloro_oth + 1; // } // // with adrenaline // if ($la_lignocaine != 0 && $la_bupivacaine != 0) { // $ligno_bupi1 = $ligno_bupi1 + 1; // } // if ($la_lignocaine != 0 && $la_ropivacaine != 0) { // $ligno_rupi1 = $ligno_rupi1 + 1; // } // if ($la_lignocaine != 0 && $la_prilocaine != 0) { // $ligno_prilo1 = $ligno_prilo1 + 1; // } // if ($la_lignocaine != 0 && $la_2_chloroprocaine != 0) { // $ligno_chloro1 = $ligno_chloro1 + 1; // } // if ($la_lignocaine != 0 && $la_2_chloroprocaine != 0) { // $ligno_oth1 = $ligno_oth1 + 1; // } // if ($la_bupivacaine != 0 && $la_ropivacaine != 0) { // $bupi_rupi1 = $bupi_rupi1 + 1; // } // if ($la_bupivacaine != 0 && $la_prilocaine != 0) { // $bupi_prilo1 = $bupi_prilo1 + 1; // } // if ($la_bupivacaine != 0 && $la_2_chloroprocaine != 0) { // $bupi_chloro1 = $bupi_chloro1 + 1; // } // if ($la_bupivacaine != 0 && $la_otheraine != 0) { // $bupi_oth1 = $bupi_oth1 + 1; // } // if ($la_ropivacaine != 0 && $la_prilocaine != 0) { // $rupi_prilo1 = $rupi_prilo1 + 1; // } // if ($la_ropivacaine != 0 && $la_2_chloroprocaine != 0) { // $rupi_chloro1 = $rupi_chloro1 + 1; // } // if ($la_ropivacaine != 0 && $la_otheraine != 0) { // $rupi_oth1 = $rupi_oth1 + 1; // } // if ($la_prilocaine != 0 && $la_2_chloroprocaine != 0) { // $prilo_chloro1 = $prilo_chloro1 + 1; // } // if ($la_prilocaine != 0 && $la_otheraine != 0) { // $prilo_oth1 = $prilo_oth1 + 1; // } // if ($la_2_chloroprocaine != 0 && $la_otheraine != 0) { // $chloro_oth1 = $chloro_oth1 + 1; // } // $products[] = array( // 'day' => 'lignocaine', // 'sell' => $la_lignocaine // ); // $products[] = array( // 'day' => 'bupivacaine', // 'sell' => $la_bupivacaine // ); // $products[] = array( // 'day' => 'ropivacaine', // 'sell' => $la_ropivacaine // ); // $products[] = array( // 'day' => 'prilocaine', // 'sell' => $la_prilocaine // ); // $products[] = array( // 'day' => '2-chloroprocaine', // 'sell' => $la_2_chloroprocaine // ); // $products[] = array( // 'day' => 'other', // 'sell' => $la_otheraine // ); // $products1[] = array( // 'day' => 'lignocaine', // 'sell' => $la_lignocaine1 // ); // $products1[] = array( // 'day' => 'bupivacaine', // 'sell' => $la_bupivacaine1 // ); // $products1[] = array( // 'day' => 'ropivacaine', // 'sell' => $la_ropivacaine1 // ); // $products1[] = array( // 'day' => 'prilocaine', // 'sell' => $la_prilocaine1 // ); // $products1[] = array( // 'day' => '2-chloroprocaine', // 'sell' => $la_2_chloroprocaine1 // ); // $products1[] = array( // 'day' => 'other', // 'sell' => $la_otheraine1 // ); // $products_combo[] = array( // 'day' => 'Heavy', // 'sell' => $combo_count1 // ); // $products_combo[] = array( // 'day' => 'Iso/Hypobaric', // 'sell' => $combo_count2 // ); // $data['combo_count'] = ($combo_count); // $data['products'] = ($products); // $data['products1'] = ($products1); // $data['products_combo'] = ($products_combo); // // $data['products2'] = ($products2); // // $data['products3'] = ($products3); // $data['total_combo'] = $combo_count1 + $combo_count2; // $data['total_n'] = $la_ropivacaine + $la_bupivacaine + $la_levobupivacaine + $la_lignocaine + $la_2_chloroprocaine + $la_otheraine; // $data['total_n1'] = $la_ropivacaine1 + $la_bupivacaine1 + $la_levobupivacaine1 + $la_lignocaine1 + $la_2_chloroprocaine1 + $la_otheraine1; // // $data['total_n2'] = $ligno_bupi + $ligno_rupi + $ligno_prilo + $ligno_chloro + $ligno_oth + $bupi_rupi + $bupi_prilo + $bupi_chloro + $bupi_oth + $rupi_prilo + $rupi_chloro + $rupi_oth + $prilo_chloro + $prilo_oth + $chloro_oth; // // $data['total_n3'] = $ligno_bupi1 + $ligno_rupi1 + $ligno_prilo1 + $ligno_chloro1 + $ligno_oth1 + $bupi_rupi1 + $bupi_prilo1 + $bupi_chloro1 + $bupi_oth1 + $rupi_prilo1 + $rupi_chloro1 + $rupi_oth1 + $prilo_chloro1 + $prilo_oth1 + $chloro_oth1; // $data['total'] = $total; // return view('cnb/reports/csaLA_v', $data); // } else { // return redirect()->route("n_report"); // } // } public function CSA_LA() { $db = \Config\Database::connect(); $dr_id = session()->get('dr_id'); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); // print_r($from_date); // print_r($to_date);die(); if ($from_date && $to_date) { $total = session()->get('n'); // print_r($total);die(); $products = []; $products1 = []; $products2 = []; $products3 = []; $combo_count1 = 0; $combo_count2 = 0; $la_ropivacaine = 0; $la_bupivacaine = 0; $la_prilocaine = 0; $la_lignocaine = 0; $la_2_chloroprocaine = 0; $la_otheraine = 0; $la_ropivacaine1 = 0; $la_bupivacaine1 = 0; $la_prilocaine1 = 0; $la_lignocaine1 = 0; $la_2_chloroprocaine1 = 0; $la_otheraine1 = 0; $ligno_bupi = 0; $ligno_rupi = 0; $ligno_prilo = 0; $ligno_chloro = 0; $ligno_oth = 0; $bupi_rupi = 0; $bupi_prilo = 0; $bupi_chloro = 0; $bupi_oth = 0; $rupi_prilo = 0; $rupi_chloro = 0; $rupi_oth = 0; $prilo_chloro = 0; $prilo_oth = 0; $chloro_oth = 0; $ligno_bupi1 = 0; $ligno_rupi1 = 0; $ligno_prilo1 = 0; $ligno_chloro1 = 0; $ligno_oth1 = 0; $bupi_rupi1 = 0; $bupi_prilo1 = 0; $bupi_chloro1 = 0; $bupi_oth1 = 0; $rupi_prilo1 = 0; $rupi_chloro1 = 0; $rupi_oth1 = 0; $prilo_chloro1 = 0; $prilo_oth1 = 0; $chloro_oth1 = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count,procedure_csa.rupivacaine,procedure_csa.chloroprocaine,procedure_csa.prilocaine,procedure_csa.bupivacaine,procedure_csa.lignocaline,procedure_csa.other_la"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); // $query = $builder->where('cnb_postop.dr_id ',$dr_id); $query = $builder->get(); $record = $query->getResult(); // print_r($record); // die(); // $lastQuery = $db->getLastQuery(); // echo $lastQuery; $heavyCount = 0; $isoHypobaricCount = 0; if ($record) { foreach ($record as $row) { if(strpos($row->lignocaline, 'Heavy') !== false && $row->bupivacaine==',,,' && $row->prilocaine==',,,' && $row->rupivacaine==',,,'&& $row->other_la==',,,,'&& $row->chloroprocaine==',,,' ) { $heavyCount++; $la_lignocaine++; } } if(strpos($row->rupivacaine, 'Heavy') !== false && $row->bupivacaine==',,,' && $row->prilocaine==',,,' && $row->lignocaline==',,,'&& $row->other_la==',,,,'&& $row->chloroprocaine==',,,' ) { $heavyCount++; $la_rupivacaine++; } if(strpos($row->chloroprocaine, 'Heavy') !== false && $row->bupivacaine==',,,' && $row->prilocaine==',,,' && $row->rupivacaine==',,,'&& $row->other_la==',,,,'&& $row->lignocaline==',,,' ) { $heavyCount++; $la_chloroprocaine++; } if(strpos($row->prilocaine, 'Heavy') !== false && $row->bupivacaine==',,,' && $row->lignocaline==',,,' && $row->rupivacaine==',,,'&& $row->other_la==',,,,'&& $row->chloroprocaine==',,,' ) { $heavyCount++; $la_prilocaine++; } if(strpos($row->bupivacaine, 'Heavy') !== false && $row->lignocaline==',,,' && $row->prilocaine==',,,' && $row->rupivacaine==',,,'&& $row->other_la==',,,,'&& $row->chloroprocaine==',,,' ) { $heavyCount++; $la_bupivacaine++; } if(strpos($row->other_la, 'Heavy') !== false && $row->bupivacaine==',,,' && $row->prilocaine==',,,' && $row->rupivacaine==',,,'&& $row->lignocaline==',,,'&& $row->chloroprocaine==',,,' ) { $heavyCount++; $la_other_la++; } if(strpos($row->lignocaline, 'Iso/Hypobaric') !== false && $row->bupivacaine==',,,' && $row->prilocaine==',,,' && $row->rupivacaine==',,,'&& $row->other_la==',,,,'&& $row->chloroprocaine==',,,' ) { $heavyCount++; $la_lignocaine++; } if(strpos($row->rupivacaine, 'Iso/Hypobaric') !== false && $row->bupivacaine==',,,' && $row->prilocaine==',,,' && $row->lignocaline==',,,'&& $row->other_la==',,,,'&& $row->chloroprocaine==',,,' ) { $heavyCount++; $la_rupivacaine++; } if(strpos($row->chloroprocaine, 'Iso/Hypobaric') !== false && $row->bupivacaine==',,,' && $row->prilocaine==',,,' && $row->rupivacaine==',,,'&& $row->other_la==',,,,'&& $row->lignocaline==',,,' ) { $heavyCount++; $la_chloroprocaine++; } if(strpos($row->prilocaine, 'Iso/Hypobaric') !== false && $row->bupivacaine==',,,' && $row->lignocaline==',,,' && $row->rupivacaine==',,,'&& $row->other_la==',,,,'&& $row->chloroprocaine==',,,' ) { $heavyCount++; $la_prilocaine++; } if(strpos($row->bupivacaine, 'Iso/Hypobaric') !== false && $row->lignocaline==',,,' && $row->prilocaine==',,,' && $row->rupivacaine==',,,'&& $row->other_la==',,,,'&& $row->chloroprocaine==',,,' ) { $heavyCount++; $la_bupivacaine++; } if(strpos($row->other_la, 'Iso/Hypobaric') !== false && $row->bupivacaine==',,,' && $row->prilocaine==',,,' && $row->rupivacaine==',,,'&& $row->lignocaline==',,,'&& $row->chloroprocaine==',,,' ) { $heavyCount++; $la_other_la++; } } $combo_count1=0; foreach ($record as $item) { $combo1 = 0; $rupivacaineParts = explode(',', $item->rupivacaine); $lignocalineParts = explode(',', $item->lignocaline); $chloroprocaineParts = explode(',', $item->chloroprocaine); $prilocaineParts = explode(',', $item->prilocaine); $bupivacaineParts = explode(',', $item->bupivacaine); $other_laParts = explode(',', $item->other_la); // $lignocalineParts = explode(',', $item->lignocaline); if (in_array('Heavy', $rupivacaineParts) ) { $combo1 = $combo1 + 1; } if (in_array('Heavy', $lignocalineParts) ) { $combo1 = $combo1 + 1; } if (in_array('Heavy', $chloroprocaineParts) ) { $combo1 = $combo1 + 1; } if (in_array('Heavy', $prilocaineParts) ) { $combo1 = $combo1 + 1; } if (in_array('Heavy', $bupivacaineParts) ) { $combo1 = $combo1 + 1; } if (in_array('Heavy', $other_laParts) ) { $combo1 = $combo1 + 1; } if (in_array('Iso/Hypobaric', $lignocalineParts)) { $combo1 = $combo1 + 1; } if (in_array('Iso/Hypobaric', $rupivacaineParts) ) { $combo1 = $combo1 + 1; } if (in_array('Iso/Hypobaric', $chloroprocaineParts) ) { $combo1 = $combo1 + 1; } if (in_array('Iso/Hypobaric', $prilocaineParts) ) { $combo1 = $combo1 + 1; } if (in_array('Iso/Hypobaric', $bupivacaineParts) ) { $combo1 = $combo1 + 1; } if (in_array('Iso/Hypobaric', $other_laParts) ) { $combo1 = $combo1 + 1; } if ($combo1 > 1) { $combo_count1 = $combo_count1 + 1; } } $products[] = array( 'day' => 'lignocaine', 'sell' => $la_lignocaine ); $products[] = array( 'day' => 'bupivacaine', 'sell' => $la_bupivacaine ); $products[] = array( 'day' => 'ropivacaine', 'sell' => $la_ropivacaine ); $products[] = array( 'day' => 'prilocaine', 'sell' => $la_prilocaine ); $products[] = array( 'day' => '2-chloroprocaine', 'sell' => $la_2_chloroprocaine ); $products[] = array( 'day' => 'other', 'sell' => $la_otheraine ); // print_r($products); // die(); $products1[] = array( 'day' => 'lignocaine', 'sell' => $la_lignocaine1 ); $products1[] = array( 'day' => 'bupivacaine', 'sell' => $la_bupivacaine1 ); $products1[] = array( 'day' => 'ropivacaine', 'sell' => $la_ropivacaine1 ); $products1[] = array( 'day' => 'prilocaine', 'sell' => $la_prilocaine1 ); $products1[] = array( 'day' => '2-chloroprocaine', 'sell' => $la_2_chloroprocaine1 ); $products1[] = array( 'day' => 'other', 'sell' => $la_otheraine1 ); // print_r($products1); // die(); $products_combo[] = array( 'day' => 'total combo', 'sell' => $combo_count1 ); // $products_combo[] = array( // 'day' => 'Iso/Hypobaric', // 'sell' => $combo_count2 // ); $data['combo_count'] = ($combo_count); $data['products'] = ($products); $data['products1'] = ($products1); $data['products_combo'] = ($products_combo); // $data['products2'] = ($products2); // $data['products3'] = ($products3); $data['total_combo'] = $combo_count1 ; $data['total_n'] = $heavyCount; $data['total_n1'] = $isoHypobaricCount; // $data['total_n2'] = $ligno_bupi + $ligno_rupi + $ligno_prilo + $ligno_chloro + $ligno_oth + $bupi_rupi + $bupi_prilo + $bupi_chloro + $bupi_oth + $rupi_prilo + $rupi_chloro + $rupi_oth + $prilo_chloro + $prilo_oth + $chloro_oth; // $data['total_n3'] = $ligno_bupi1 + $ligno_rupi1 + $ligno_prilo1 + $ligno_chloro1 + $ligno_oth1 + $bupi_rupi1 + $bupi_prilo1 + $bupi_chloro1 + $bupi_oth1 + $rupi_prilo1 + $rupi_chloro1 + $rupi_oth1 + $prilo_chloro1 + $prilo_oth1 + $chloro_oth1; $data['total'] = $total; return view('cnb/reports/csaLA_v', $data); } else { return redirect()->route("n_report"); } } // ================================================ // CSE // ********************** // public function CSE_LA() // { // $db = \Config\Database::connect(); // $from_date = session()->get('from_date'); // $to_date = session()->get('to_date'); // $dr_id = session()->get('dr_id'); // $n = session()->get('n'); // $n_type = gettype($n); // // if($from_date && $to_date){ // if ($from_date && $to_date) { // $total = session()->get('n'); // $products = []; // $products1 = []; // $products2 = []; // $products3 = []; // $ropivacaine = 0; // $bupivacaine = 0; // $levobupivacaine = 0; // $lignocaine = 0; // $ropivacaine1 = 0; // $bupivacaine1 = 0; // $levobupivacaine1 = 0; // $lignocaine1 = 0; // $combo_count1 = 0; // $combo_count2 = 0; // $builder = $db->table('cnb_postop'); // $query = $builder->select("cnb_postop.id as count, procedure_cse.la_ropivacaine,procedure_cse.la_bupivacaine,procedure_cse.la_levobupivacaine,procedure_cse.la_lignocaine"); // $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); // $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); // $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); // $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); // // $query = $builder->where('cnb_postop.dr_id ',$dr_id); // $query = $builder->get(); // $record = $query->getResult(); // // print_r($record);die(); // if ($record) { // foreach ($record as $row) { // $combo1 = 0; // $combo2 = 0; // if (substr($row->la_ropivacaine, 0,7) == 'Without') { // $ropivacaine = $ropivacaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_ropivacaine, 0,4) == 'With') { // $ropivacaine1 = $ropivacaine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_bupivacaine, 0,7) == 'Without') { // $bupivacaine = $bupivacaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_bupivacaine, 0,4) == 'With') { // $bupivacaine1 = $bupivacaine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_levobupivacaine, 0,7) == 'Without') { // $levobupivacaine = $levobupivacaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_levobupivacaine, 0,4) == 'With') { // $levobupivacaine1 = $levobupivacaine1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_lignocaine, 0,7) == 'Without') { // $lignocaine = $lignocaine + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->la_lignocaine, 0,4) == 'With') { // $lignocaine1 = $lignocaine1 + 1; // $combo2 = $combo2 + 1; // } // if ($combo1 > 1) { // $combo_count1 = $combo_count1 + 1; // } // if ($combo2 > 1) { // $combo_count2 = $combo_count2 + 1; // } // } // } // $spinal_lignocaine_an = 0; // $spinal_bupivacaine_an = 0; // $spinal_ropivacaine_an = 0; // $spinal_prilocaine_an = 0; // $spinal_2chloroprocaine_an = 0; // $other_spinal_an = 0; // $products_spinal = []; // $products_spinal1 = []; // $builder = $db->table('cnb_postop'); // $query = $builder->select("cnb_postop.id as count, procedure_cse.spinal_lignocaine_an,procedure_cse.spinal_bupivacaine_an,procedure_cse.spinal_ropivacaine_an,procedure_cse.spinal_prilocaine_an,procedure_cse.spinal_2chloroprocaine_an,procedure_cse.other_spinal_an"); // $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); // $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); // $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); // $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); // $query = $builder->get(); // $record = $query->getResult(); // // print_r($record);die(); // if ($record) { // foreach ($record as $row) { // $combo1 = 0; // $combo2 = 0; // if (substr($row->spinal_lignocaine_an, 0, 5) == "Heavy") { // $spinal_lignocaine_an = $spinal_lignocaine_an + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->spinal_lignocaine_an, 0, 13) == 'Iso/Hypobaric') { // $spinal_lignocaine_an1 = $spinal_lignocaine_an1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->spinal_bupivacaine_an, 0, 5) == "Heavy") { // $spinal_bupivacaine_an = $spinal_bupivacaine_an + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->spinal_bupivacaine_an, 0, 13) == 'Iso/Hypobaric') { // $spinal_bupivacaine_an1 = $spinal_bupivacaine_an1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->spinal_ropivacaine_an, 0, 5) == "Heavy") { // $spinal_ropivacaine_an = $spinal_ropivacaine_an + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->spinal_ropivacaine_an, 0, 13) == 'Iso/Hypobaric') { // $spinal_ropivacaine_an1 = $spinal_ropivacaine_an1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->spinal_prilocaine_an, 0, 5) == "Heavy") { // $spinal_prilocaine_an = $spinal_prilocaine_an + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->spinal_prilocaine_an, 0, 13) == 'Iso/Hypobaric') { // $spinal_prilocaine_an1 = $spinal_prilocaine_an1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->spinal_2chloroprocaine_an, 0, 5) == "Heavy") { // $spinal_2chloroprocaine_an = $spinal_2chloroprocaine_an + 1; // $combo1 = $combo1 + 1; // } else if (substr($row->spinal_2chloroprocaine_an, 0, 13) == 'Iso/Hypobaric') { // $spinal_2chloroprocaine_an1 = $spinal_2chloroprocaine_an1 + 1; // $combo2 = $combo2 + 1; // } // if (substr($row->la_2_chloroprocaine, 0, 5) == "Heavy") { // $la_2_chloroprocaine = $la_2_chloroprocaine + 1; // $combo1 = $combo2 + 1; // } else if (substr($row->la_2_chloroprocaine, 0, 13) == 'Iso/Hypobaric') { // $la_2_chloroprocaine1 = $la_2_chloroprocaine1 + 1; // $combo1 = $combo2 + 1; // } // if (substr($row->other_spinal_an, 0, 5) == "Heavy") { // $other_spinal_an = $other_spinal_an + 1; // $combo1 = $combo2 + 1; // } else if (substr($row->other_spinal_an, 0, 13) == 'Iso/Hypobaric') { // $other_spinal_an1 = $other_spinal_an1 + 1; // $combo1 = $combo2 + 1; // } // if ($combo1 > 1) { // $combo_count1 = $combo_count1 + 1; // } // if ($combo2 > 1) { // $combo_count2 = $combo_count2 + 1; // } // } // } // // print_r($ropivacaine); // // die(); // $products[] = array( // 'day' => 'ropivacaine', // 'sell' => $ropivacaine // ); // $products[] = array( // 'day' => 'bupivacaine', // 'sell' => $bupivacaine // ); // $products[] = array( // 'day' => 'levobupivacaine', // 'sell' => $levobupivacaine // ); // $products[] = array( // 'day' => 'lignocaine', // 'sell' => $lignocaine // ); // $products1[] = array( // 'day' => 'Ropivacaine + Adrenaline', // 'sell' => $ropivacaine1 // ); // $products1[] = array( // 'day' => 'bupivacaine + Adrenaline', // 'sell' => $bupivacaine1 // ); // $products1[] = array( // 'day' => 'levobupivacaine + Adrenaline', // 'sell' => $levobupivacaine1 // ); // $products1[] = array( // 'day' => 'lignocaine + Adrenaline', // 'sell' => $lignocaine1 // ); // // ========= spinal ============== // $products_spinal[] = array( // 'day' => 'ropivacaine', // 'sell' => $spinal_ropivacaine_an // ); // $products_spinal[] = array( // 'day' => 'bupivacaine', // 'sell' => $spinal_bupivacaine_an // ); // $products_spinal[] = array( // 'day' => 'Prilocaine', // 'sell' => $spinal_prilocaine_an // ); // $products_spinal[] = array( // 'day' => 'lignocaine', // 'sell' => $spinal_lignocaine_an // ); // $products_spinal[] = array( // 'day' => '2-chloroprocaine', // 'sell' => $spinal_2chloroprocaine_an // ); // $products_spinal[] = array( // 'day' => 'Other', // 'sell' => $other_spinal_an // ); // // **************** **************** // $products_spinal1[] = array( // 'day' => 'ropivacaine + Adrenaline', // 'sell' => $spinal_ropivacaine_an1 // ); // $products_spinal1[] = array( // 'day' => 'bupivacaine + Adrenaline', // 'sell' => $spinal_bupivacaine_an1 // ); // $products_spinal1[] = array( // 'day' => 'Prilocaine + Adrenaline', // 'sell' => $spinal_prilocaine_an1 // ); // $products_spinal1[] = array( // 'day' => 'lignocaine + Adrenaline', // 'sell' => $spinal_lignocaine_an1 // ); // $products_spinal1[] = array( // 'day' => '2-chloroprocaine + Adrenaline', // 'sell' => $spinal_2chloroprocaine_an1 // ); // $products_spinal1[] = array( // 'day' => 'Other + Adrenaline', // 'sell' => $other_spinal_an1 // ); // // print_r($products_spinal);die(); // $data['total_combo'] = $combo_count1 + $combo_count2; // $data['products_combo'] = ($products_combo); // $data['products'] = ($products); // $data['products1'] = ($products1); // $data['products_spinal'] = ($products_spinal); // $data['products_spinal1'] = ($products_spinal); // $data['total_n'] = $ropivacaine + $bupivacaine + $levobupivacaine + $lignocaine; // $data['total_n1'] = $ropivacaine1 + $bupivacaine1 + $levobupivacaine1 + $lignocaine1; // return view('cnb/reports/CSE_LA', $data); // } else { // return redirect()->route("n_report"); // } // } public function CSE_LA() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); $dr_id = session()->get('dr_id'); $n = session()->get('n'); $n_type = gettype($n); // if($from_date && $to_date){ if ($from_date && $to_date) { $total = session()->get('n'); $products = []; $products1 = []; $products2 = []; $products3 = []; $ropivacaine = 0; $bupivacaine = 0; $levobupivacaine = 0; $lignocaine = 0; $ropivacaine1 = 0; $bupivacaine1 = 0; $levobupivacaine1 = 0; $lignocaine1 = 0; $combo_count1_ep = 0; $combo_count2 = 0; $combo_count1_sp = 0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.la_ropivacaine,procedure_cse.la_bupivacaine,procedure_cse.la_levobupivacaine,procedure_cse.la_lignocaine"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); // $query = $builder->where('cnb_postop.dr_id ',$dr_id); $query = $builder->get(); $record = $query->getResult(); // print_r($record);die(); // $query = $db->getLastQuery(); // echo $query; if ($record) { foreach ($record as $row) { if (substr($row->la_ropivacaine, 0,7) == 'Without' && $row->la_bupivacaine==',,,' && $row->la_levobupivacaine==',,,' && $row->la_lignocaine==',,,') { $ropivacaine = $ropivacaine + 1; } else if (substr($row->la_ropivacaine, 0,4) == 'With' && $row->la_bupivacaine==',,,' && $row->la_levobupivacaine==',,,' && $row->la_lignocaine==',,,') { $ropivacaine1 = $ropivacaine1 + 1; } if (substr($row->la_bupivacaine, 0,7) == 'Without' && $row->la_ropivacaine==',,,' && $row->la_levobupivacaine==',,,' && $row->la_lignocaine==',,,') { $bupivacaine = $bupivacaine + 1; } else if (substr($row->la_bupivacaine, 0,4) == 'With' && $row->la_ropivacaine==',,,' && $row->la_levobupivacaine==',,,' && $row->la_lignocaine==',,,') { $bupivacaine1 = $bupivacaine1 + 1; } if (substr($row->la_levobupivacaine, 0,7) == 'Without' && $row->la_bupivacaine==',,,' && $row->la_ropivacaine==',,,' && $row->la_lignocaine==',,,') { $levobupivacaine = $levobupivacaine + 1; } else if (substr($row->la_levobupivacaine, 0,4) == 'With' && $row->la_bupivacaine==',,,' && $row->la_ropivacaine==',,,' && $row->la_lignocaine==',,,') { $levobupivacaine1 = $levobupivacaine1 + 1; } if (substr($row->la_lignocaine, 0,7) == 'Without' && $row->la_bupivacaine==',,,' && $row->la_levobupivacaine==',,,' && $row->la_ropivacaine==',,,') { $lignocaine = $lignocaine + 1; } else if (substr($row->la_lignocaine, 0,4) == 'With' && $row->la_bupivacaine==',,,' && $row->la_levobupivacaine==',,,' && $row->la_ropivacaine==',,,') { $lignocaine1 = $lignocaine1 + 1; } } } if ($record) { foreach ($record as $row) { $combo1 = 0; if (substr($row->la_ropivacaine, 0,7) == 'Without' ) { $combo1 = $combo1 + 1; } else if (substr($row->la_ropivacaine, 0,4) == 'With') { $combo1 = $combo1 + 1; } if (substr($row->la_bupivacaine, 0,7) == 'Without' ) { $combo1 = $combo1 + 1; } else if (substr($row->la_bupivacaine, 0,4) == 'With') { $combo1 = $combo1 + 1; } if (substr($row->la_levobupivacaine, 0,7) == 'Without') { $combo1 = $combo1 + 1; } else if (substr($row->la_levobupivacaine, 0,4) == 'With' ) { $combo1 = $combo1 + 1; } if (substr($row->la_lignocaine, 0,7) == 'Without') { $combo1 = $combo1 + 1; } else if (substr($row->la_lignocaine, 0,4) == 'With') { $combo1 = $combo1 + 1; } if ($combo1 > 1) { $combo_count1_ep = $combo_count1_ep + 1; } } } $spinal_lignocaine_an = 0; $spinal_bupivacaine_an = 0; $spinal_ropivacaine_an = 0; $spinal_prilocaine_an = 0; $spinal_2chloroprocaine_an = 0; $other_spinal_an = 0; $spinal_lignocaine_an1 = 0; $spinal_bupivacaine_an1 = 0; $spinal_ropivacaine_an1 = 0; $spinal_prilocaine_an1 = 0; $spinal_2chloroprocaine_an1 = 0; $other_spinal_an = 0; $products_spinal = []; $products_spinal1 = []; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.spinal_lignocaine_an,procedure_cse.spinal_bupivacaine_an,procedure_cse.spinal_ropivacaine_an,procedure_cse.spinal_prilocaine_an,procedure_cse.spinal_2chloroprocaine_an,procedure_cse.other_spinal_an"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('cnb_postop.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('cnb_postop.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); // $query = $db->getLastQuery(); // echo $query; // print_r($record);die(); if ($record) { foreach ($record as $row) { if (substr($row->spinal_lignocaine_an, 0, 5) == "Heavy" && $row->spinal_bupivacaine_an==',,,' && $row->spinal_ropivacaine_an==',,,' && $row->spinal_prilocaine_an==',,,' && $row->spinal_2chloroprocaine_an==',,,' && $row->other_spinal_an==',,,,') { $spinal_lignocaine_an = $spinal_lignocaine_an + 1; } else if (substr($row->spinal_lignocaine_an, 0, 13) == 'Iso/Hypobaric' && $row->spinal_bupivacaine_an==',,,' && $row->spinal_ropivacaine_an==',,,' && $row->spinal_prilocaine_an==',,,' && $row->spinal_2chloroprocaine_an==',,,' && $row->other_spinal_an==',,,,') { $spinal_lignocaine_an1 = $spinal_lignocaine_an1 + 1; } if (substr($row->spinal_bupivacaine_an, 0, 5) == "Heavy" && $row->spinal_lignocaine_an==',,,' && $row->spinal_ropivacaine_an==',,,' && $row->spinal_prilocaine_an==',,,' && $row->spinal_2chloroprocaine_an==',,,' && $row->other_spinal_an==',,,,') { $spinal_bupivacaine_an = $spinal_bupivacaine_an + 1; } else if (substr($row->spinal_bupivacaine_an, 0, 13) == 'Iso/Hypobaric' && $row->spinal_lignocaine_an==',,,' && $row->spinal_ropivacaine_an==',,,' && $row->spinal_prilocaine_an==',,,' && $row->spinal_2chloroprocaine_an==',,,' && $row->other_spinal_an==',,,,') { $spinal_bupivacaine_an1 = $spinal_bupivacaine_an1 + 1; } if (substr($row->spinal_ropivacaine_an, 0, 5) == "Heavy" && $row->spinal_bupivacaine_an==',,,' && $row->spinal_lignocaine_an==',,,' && $row->spinal_prilocaine_an==',,,' && $row->spinal_2chloroprocaine_an==',,,' && $row->other_spinal_an==',,,,') { $spinal_ropivacaine_an = $spinal_ropivacaine_an + 1; } else if (substr($row->spinal_ropivacaine_an, 0, 13) == 'Iso/Hypobaric' && $row->spinal_bupivacaine_an==',,,' && $row->spinal_lignocaine_an==',,,' && $row->spinal_prilocaine_an==',,,' && $row->spinal_2chloroprocaine_an==',,,' && $row->other_spinal_an==',,,,') { $spinal_ropivacaine_an1 = $spinal_ropivacaine_an1 + 1; } if (substr($row->spinal_prilocaine_an, 0, 5) == "Heavy" && $row->spinal_bupivacaine_an==',,,' && $row->spinal_ropivacaine_an==',,,' && $row->spinal_lignocaine_an==',,,' && $row->spinal_2chloroprocaine_an==',,,' && $row->other_spinal_an==',,,,') { $spinal_prilocaine_an = $spinal_prilocaine_an + 1; } else if (substr($row->spinal_prilocaine_an, 0, 13) == 'Iso/Hypobaric' && $row->spinal_bupivacaine_an==',,,' && $row->spinal_ropivacaine_an==',,,' && $row->spinal_lignocaine_an==',,,' && $row->spinal_2chloroprocaine_an==',,,' && $row->other_spinal_an==',,,,') { $spinal_prilocaine_an1 = $spinal_prilocaine_an1 + 1; } if (substr($row->spinal_2chloroprocaine_an, 0, 5) == "Heavy" && $row->spinal_bupivacaine_an==',,,' && $row->spinal_ropivacaine_an==',,,' && $row->spinal_prilocaine_an==',,,' && $row->spinal_lignocaine_an==',,,' && $row->other_spinal_an==',,,,') { $spinal_2chloroprocaine_an = $spinal_2chloroprocaine_an + 1; } else if (substr($row->spinal_2chloroprocaine_an, 0, 13) == 'Iso/Hypobaric' && $row->spinal_bupivacaine_an==',,,' && $row->spinal_ropivacaine_an==',,,' && $row->spinal_prilocaine_an==',,,' && $row->spinal_lignocaine_an==',,,' && $row->other_spinal_an==',,,,') { $spinal_2chloroprocaine_an1 = $spinal_2chloroprocaine_an1 + 1; } if (substr($row->other_spinal_an, 0, 5) == "Heavy" && $row->spinal_bupivacaine_an==',,,' && $row->spinal_ropivacaine_an==',,,' && $row->spinal_prilocaine_an==',,,' && $row->spinal_2chloroprocaine_an==',,,' && $row->spinal_lignocaine_an==',,,') { $other_spinal_an = $other_spinal_an + 1; } else if (substr($row->other_spinal_an, 0, 13) == 'Iso/Hypobaric' && $row->spinal_bupivacaine_an==',,,' && $row->spinal_ropivacaine_an==',,,' && $row->spinal_prilocaine_an==',,,' && $row->spinal_2chloroprocaine_an==',,,' && $row->$row->la_2_chloroprocaine==',,,') { $other_spinal_an1 = $other_spinal_an1 + 1; } } } if ($record) { foreach ($record as $row) { $combo1 = 0; if (substr($row->spinal_lignocaine_an, 0, 5) == "Heavy") { $combo1 = $combo1 + 1; } else if (substr($row->spinal_lignocaine_an, 0, 13) == 'Iso/Hypobaric') { $combo1 = $combo1 + 1; } if (substr($row->spinal_bupivacaine_an, 0, 5) == "Heavy") { $combo1 = $combo1 + 1; } else if (substr($row->spinal_bupivacaine_an, 0, 13) == 'Iso/Hypobaric') { $combo1 = $combo1 + 1; } if (substr($row->spinal_ropivacaine_an, 0, 5) == "Heavy") { $combo1 = $combo1 + 1; } else if (substr($row->spinal_ropivacaine_an, 0, 13) == 'Iso/Hypobaric') { $combo1 = $combo1 + 1; } if (substr($row->spinal_prilocaine_an, 0, 5) == "Heavy") { $combo1 = $combo1 + 1; } else if (substr($row->spinal_prilocaine_an, 0, 13) == 'Iso/Hypobaric') { $combo1 = $combo1 + 1; } if (substr($row->la_2_chloroprocaine, 0, 5) == "Heavy") { $combo1 = $combo1 + 1; } else if (substr($row->la_2_chloroprocaine, 0, 13) == 'Iso/Hypobaric') { $combo1 = $combo1 + 1; } if (substr($row->other_spinal_an, 0, 5) == "Heavy") { $combo1 = $combo1 + 1; } else if (substr($row->other_spinal_an, 0, 13) == 'Iso/Hypobaric') { $combo1 = $combo1 + 1; } if ($combo1 > 1) { $combo_count1_sp = $combo_count1_sp + 1; } } } $products[] = array( 'day' => 'ropivacaine', 'sell' => $ropivacaine ); $products[] = array( 'day' => 'bupivacaine', 'sell' => $bupivacaine ); $products[] = array( 'day' => 'levobupivacaine', 'sell' => $levobupivacaine ); $products[] = array( 'day' => 'lignocaine', 'sell' => $lignocaine ); $products1[] = array( 'day' => 'Ropivacaine + Adrenaline', 'sell' => $ropivacaine1 ); $products1[] = array( 'day' => 'bupivacaine + Adrenaline', 'sell' => $bupivacaine1 ); $products1[] = array( 'day' => 'levobupivacaine + Adrenaline', 'sell' => $levobupivacaine1 ); $products1[] = array( 'day' => 'lignocaine + Adrenaline', 'sell' => $lignocaine1 ); $products_combo_ep[]=array( 'day'=>'total combo', 'sell'=>$combo_count1_ep ); // ========= spinal ============== $products_spinal[] = array( 'day' => 'ropivacaine', 'sell' => $spinal_ropivacaine_an ); $products_spinal[] = array( 'day' => 'bupivacaine', 'sell' => $spinal_bupivacaine_an ); $products_spinal[] = array( 'day' => 'Prilocaine', 'sell' => $spinal_prilocaine_an ); $products_spinal[] = array( 'day' => 'lignocaine', 'sell' => $spinal_lignocaine_an ); $products_spinal[] = array( 'day' => '2-chloroprocaine', 'sell' => $spinal_2chloroprocaine_an ); $products_spinal[] = array( 'day' => 'Other', 'sell' => $other_spinal_an ); // **************** **************** $products_spinal1[] = array( 'day' => 'ropivacaine + Adrenaline', 'sell' => $spinal_ropivacaine_an1 ); $products_spinal1[] = array( 'day' => 'bupivacaine + Adrenaline', 'sell' => $spinal_bupivacaine_an1 ); $products_spinal1[] = array( 'day' => 'Prilocaine + Adrenaline', 'sell' => $spinal_prilocaine_an1 ); $products_spinal1[] = array( 'day' => 'lignocaine + Adrenaline', 'sell' => $spinal_lignocaine_an1 ); $products_spinal1[] = array( 'day' => '2-chloroprocaine + Adrenaline', 'sell' => $spinal_2chloroprocaine_an1 ); $products_spinal1[] = array( 'day' => 'Other + Adrenaline', 'sell' => $other_spinal_an1 ); $products_combo_sp[]=array( 'day'=>'total combo', 'sell'=>$combo_count1_sp ); // print_r($products_spinal);die(); $data['total_combo_ep'] = $combo_count1_ep; $data['total_combo_sp'] = $combo_count1_sp; $data['products_combo_ep'] = ($products_combo_ep); $data['products_combo_sp'] = ($products_combo_sp); $data['products'] = ($products); $data['products1'] = ($products1); $data['products_spinal'] = ($products_spinal); $data['products_spinal1'] = ($products_spinal); $data['total_n'] = $ropivacaine + $bupivacaine + $levobupivacaine + $lignocaine; $data['total_n1'] = $ropivacaine1 + $bupivacaine1 + $levobupivacaine1 + $lignocaine1; $data['total_ns']=$spinal_ropivacaine_an+$spinal_bupivacaine_an+$spinal_prilocaine_an+$spinal_lignocaine_an+$spinal_2chloroprocaine_an+$other_spinal_an; $data['total_ns1']=$spinal_ropivacaine_an1+$spinal_bupivacaine_an1+$spinal_prilocaine_an1+$spinal_lignocaine_an1+$spinal_2chloroprocaine_an1+$other_spinal_an1; return view('cnb/reports/CSE_LA', $data); } else { return redirect()->route("n_report"); } } // vertibral indidvidual levels //-------------new vertebral work------------------// public function v_spinal(){ $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if ($from_date && $to_date) { $total = session()->get('n'); $total_e = session()->get('e_total'); $total_s = session()->get('s_total'); $total_cse = session()->get('cse_total'); $total_csa = session()->get('csa_total'); $spinal_level_name = []; $Thoracic = 0; $Lumbar = 0; $Cervical=0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_spinal.spinal_level_name as Sname,procedure_spinal.spinal_level as lname"); $builder->join('procedure_spinal', 'procedure_spinal.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_spinal.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_spinal.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); // $query = $db->getLastQuery(); // echo $query; if ($record) { foreach ($record as $key) { if ($key->Sname == 'Thoracic') { $Thoracic = $Thoracic + 1; } else if ($key->Sname == 'Lumbar') { $Lumbar = $Lumbar + 1; } else if ($key->Sname == 'Cervical') { $Cervical = $Cervical + 1; } } } $spinal_level_name[] = array( 'day' => 'Cervical', 'sell' => $Cervical ); $spinal_level_name[] = array( 'day' => 'Thoracic', 'sell' => $Thoracic ); $spinal_level_name[] = array( 'day' => 'Lumbar', 'sell' => $Lumbar ); $data['spinal_level_name'] = $spinal_level_name; $total1 = $Thoracic + $Lumbar; $data['total1'] = $total1; //----------individual-------------------// $Thoracic_individual=[]; $Lumbar_individual=[]; $t1_2=$t2_3=$t3_4=$t4_5=$t5_6=$t6_7=$t7_8=$t8_9=$t9_10=$t10_11=$t11_12=$t12=$l1_2=$l2_3=$l3_4=$l4_5=$l5_s1=0; if($record){ foreach($record as $row){ if($row->lname=='T1-2'){ $t1_2++; } elseif($row->lname=='T2-3'){ $t2_3++; } elseif($row->lname=='T3-4'){ $t3_4++; } elseif($row->lname=='T4-5'){ $t4_5++; } elseif($row->lname=='T5-6'){ $t5_6++; } elseif($row->lname=='T6-7'){ $t6_7++; } elseif($row->lname=='T7-8'){ $t7_8++; } elseif($row->lname=='T8-9'){ $t8_9++; } elseif($row->lname=='T9-10'){ $t9_10++; } elseif($row->lname=='T10-11'){ $t10_11++; } elseif($row->lname=='T11-12'){ $t11_12++; } elseif($row->lname=='T12-L1'){ $t12++; } elseif($row->lname=='L1-2'){ $l1_2++; } elseif($row->lname=='L2-3'){ $l2_3++; } elseif($row->lname=='L3-4'){ $l3_4++; } elseif($row->lname=='L4-5'){ $l4_5++; } elseif($row->lname=='L5-S1'){ $l5_s1++; } } } $Thoracic_individual[]=array( 'one'=>'T1-2', 'two'=>$t1_2 ); $Thoracic_individual[]=array( 'one'=>'T2-3', 'two'=>$t2_3 ); $Thoracic_individual[]=array( 'one'=>'T3-4', 'two'=>$t3_4 ); $Thoracic_individual[]=array( 'one'=>'T4-5', 'two'=>$t4_5 ); $Thoracic_individual[]=array( 'one'=>'T5-6', 'two'=>$t5_6 ); $Thoracic_individual[]=array( 'one'=>'T6-7', 'two'=>$t6_7 ); $Thoracic_individual[]=array( 'one'=>'T7-8', 'two'=>$t7_8 ); $Thoracic_individual[]=array( 'one'=>'T8-9', 'two'=>$t8_9 ); $Thoracic_individual[]=array( 'one'=>'T9-10', 'two'=>$t9_10 ); $Thoracic_individual[]=array( 'one'=>'T10-11', 'two'=>$t10_11 ); $Thoracic_individual[]=array( 'one'=>'T11-12', 'two'=>$t11_12 ); $Thoracic_individual[]=array( 'one'=>'T12-L1', 'two'=>$t12 ); $Lumbar_individual[]=array( 'three'=>'L1-2', 'four'=>$l1_2 ); $Lumbar_individual[]=array( 'three'=>'L2-3', 'four'=>$l2_3 ); $Lumbar_individual[]=array( 'three'=>'L3-4', 'four'=>$l3_4 ); $Lumbar_individual[]=array( 'three'=>'L4-5', 'four'=>$l4_5 ); $Lumbar_individual[]=array( 'three'=>'L5-S1', 'four'=>$l5_s1 ); $data['t_thoracic']=$Thoracic; $data['Thoracic_individual']=($Thoracic_individual); $data['t_lumbar']=$Lumbar; $data['Lumbar_individual']=($Lumbar_individual); return view('cnb/reports/v_spinal_v', $data); }else{ return redirect()->route("n_report"); } } public function v_csa(){ $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if($from_date && $to_date){ $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_csa.spinal_level_name as csa_name,procedure_csa.spinal_level as lname"); $builder->join('procedure_csa', 'procedure_csa.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_csa.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_csa.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); // $query = $db->getLastQuery(); // echo $query; $Thoracic3 = 0; $Lumbar3 = 0; // $csa[] = 0; if ($record) { foreach ($record as $key) { if ($key->csa_name == 'Thoracic') { $Thoracic3 = $Thoracic3 + 1; } else if ($key->csa_name == 'Lumbar') { $Lumbar3 = $Lumbar3 + 1; } } } // print_r($Lumbar);die(); $csa[] = array( 'day' => 'Thoracic', 'sell' => $Thoracic3 ); $csa[] = array( 'day' => 'Lumbar', 'sell' => $Lumbar3 ); $data['csa'] = $csa; $total3 = $Thoracic3 + $Lumbar3; $data['total3'] = $total3; $csa1=$csa2=$csa3=$csa4=$csa5=$csa6=$csa7=$csa8=$csa9=$csa10=$csa11=$csa12=$csa13=$csa14=$csa15=$csa16=$csa17=0; if($record){ foreach($record as $row){ if($row->lname=='T1-2'){ $csa1++; } if($row->lname=='T2-3'){ $csa2++; } if($row->lname=='T3-4'){ $csa3++; } if($row->lname=='T4-5'){ $csa4++; } if($row->lname=='T5-6'){ $csa5++; } if($row->lname=='T6-7'){ $csa6++; } if($row->lname=='T7-8'){ $csa7++; } if($row->lname=='T8-9'){ $csa8++; } if($row->lname=='T9-10'){ $csa9++; } if($row->lname=='T10-11'){ $csa10++; } if($row->lname=='T11-12'){ $csa11++; } if($row->lname=='T12-L1'){ $csa12++; } if($row->lname=='L1-2'){ $csa13++; } if($row->lname=='L2-3'){ $csa14++; } if($row->lname=='L3-4'){ $csa15++; } if($row->lname=='L4-5'){ $csa16++; } if($row->lname=='L5-S1'){ $csa17++; } } } // echo $csa17;die(); $Thoracic_individual[]=array( 'one'=>'T1-2', 'two'=>$csa1 ); $Thoracic_individual[]=array( 'one'=>'T2-3', 'two'=>$csa2 ); $Thoracic_individual[]=array( 'one'=>'T3-4', 'two'=>$csa3 ); $Thoracic_individual[]=array( 'one'=>'T4-5', 'two'=>$csa4 ); $Thoracic_individual[]=array( 'one'=>'T5-6', 'two'=>$csa5 ); $Thoracic_individual[]=array( 'one'=>'T6-7', 'two'=>$csa6 ); $Thoracic_individual[]=array( 'one'=>'T7-8', 'two'=>$csa7 ); $Thoracic_individual[]=array( 'one'=>'T8-9', 'two'=>$csa8 ); $Thoracic_individual[]=array( 'one'=>'T9-10', 'two'=>$csa9 ); $Thoracic_individual[]=array( 'one'=>'T10-11', 'two'=>$csa10 ); $Thoracic_individual[]=array( 'one'=>'T11-12', 'two'=>$csa11 ); $Thoracic_individual[]=array( 'one'=>'T12-L1', 'two'=>$csa12 ); $Lumbar_individual[]=array( 'one'=>'L1-2', 'two'=>$csa13 ); $Lumbar_individual[]=array( 'one'=>'L2-3', 'two'=>$csa14 ); $Lumbar_individual[]=array( 'one'=>'L3-4', 'two'=>$csa15 ); $Lumbar_individual[]=array( 'one'=>'L4-5', 'two'=>$csa16 ); $Lumbar_individual[]=array( 'one'=>'L5-S1', 'two'=>$csa17 ); $data['t_thoracic']=$Thoracic3; $data['t_lumbar']=$Lumbar3; // $data['t_thoracic']=$Thoracic; $data['Thoracic_individual']=($Thoracic_individual); // $data['t_lumbar']=$Lumbar; $data['Lumbar_individual']=($Lumbar_individual); return view('cnb/reports/v_csa_v',$data); } else{ return redirect()->route("n_report"); } } public function v_cse(){ $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if($from_date && $to_date){ $total_e = session()->get('e_total'); $total_s = session()->get('s_total'); $total_cse = session()->get('cse_total'); $total_csa = session()->get('csa_total'); //============== cse ================== $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.cse_technique as technique,procedure_cse.spinal_level_name as sname,procedure_cse.epidural_level_name as ename"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); $single = 0; $double = 0; $dual = 0; if ($record) { foreach ($record as $key) { if ($key->technique == 'Single Interspace Technique (Needle through Needle)') { $single = $single + 1; } if ($key->technique == 'Double Interspace Technique') { $double = $double + 1; } if ($key->technique == 'DPE:Dural Puncture Epidural Technique') { $dual = $dual + 1; } } } $cse[] = array( 'day' => 'Single Interspace Technique (Needle through Needle)', 'sell' => $single ); $cse[] = array( 'day' => 'Double Interspace Technique', 'sell' => $double ); $cse[] = array( 'day' => 'DPE:Dural Puncture Epidural Technique', 'sell' => $dual ); $data['total_cse'] = $total_cse; $data['cse'] = $cse; $total4 = $single + $double + $dual; $data['total4'] = $total4; //-------------individual-------------------// //----single-------// $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.cse_technique as technique,procedure_cse.spinal_level_name as sname,procedure_cse.spinal_level as lname"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query= $builder->where('procedure_cse.cse_technique','Single Interspace Technique (Needle through Needle)'); $query = $builder->get(); $record_single = $query->getResult(); // $query = $db->getLastQuery(); // echo $query; $single = []; $Thoracic = 0; $Lumbar = 0; $Cervical=0; $Caudal=0; if ($record_single) { foreach ($record_single as $key) { if ($key->sname == 'Thoracic') { $Thoracic = $Thoracic + 1; } if ($key->sname == 'Lumbar') { $Lumbar = $Lumbar + 1; } if ($key->sname == 'Cervical') { $Cervical = $Cervical + 1; } if($key->sname == 'Caudal'){ $Caudal++; } } } // echo $Cervical;die(); $single[] = array( 'day' => 'Cervical', 'sell' => $Cervical ); $single[] = array( 'day' => 'Thoracic', 'sell' => $Thoracic ); $single[] = array( 'day' => 'Lumbar', 'sell' => $Lumbar ); $single[] = array( 'day' => 'Caudal', 'sell' => $Caudal ); $data['single'] = $single; $total1 = $Thoracic + $Lumbar+$Cervical+$Caudal; $data['total_single'] = $total1; $single1=$single2=$single3=$single4=$single5=$single6=$single7=$single8=$single9=$single10=$single11=$single12=$single13=$single14=$single15=$single16=$single17=0; $single18=$single19=$single20=$single21=$single22=$single23=$single24=$single25=0; if($record_single){ foreach($record_single as $row){ if($row->lname=='T1-2'){ $single1++; } if($row->lname=='T2-3'){ $single2++; } if($row->lname=='T3-4'){ $single3++; } if($row->lname=='T4-5'){ $single4++; } if($row->lname=='T5-6'){ $single5++; } if($row->lname=='T6-7'){ $single6++; } if($row->lname=='T7-8'){ $single7++; } if($row->lname=='T8-9'){ $single8++; } if($row->lname=='T9-10'){ $single9++; } if($row->lname=='T10-11'){ $single10++; } if($row->lname=='T11-12'){ $single11++; } if($row->lname=='T12-L1'){ $single12++; } if($row->lname=='L1-2'){ $single13++; } if($row->lname=='L2-3'){ $single14++; } if($row->lname=='L3-4'){ $single15++; } if($row->lname=='L4-5'){ $single16++; } if($row->lname=='L5-S1'){ $single17++; } if($row->lname=='C1-2'){ $single18++; } if($row->lname=='C2-3'){ $single19++; } if($row->lname=='C3-4'){ $single20++; } if($row->lname=='C4-5'){ $single21++; } if($row->lname=='C5-6'){ $single22++; } if($row->lname=='C6-7'){ $single23++; } if($row->lname=='C7-T1'){ $single24++; } if($row->lname=='Caudal'){ $single25++; } } } // echo $single17;die(); $Thoracic_individual[]=array( 'one'=>'T1-2', 'two'=>$single1 ); $Thoracic_individual[]=array( 'one'=>'T2-3', 'two'=>$single2 ); $Thoracic_individual[]=array( 'one'=>'T3-4', 'two'=>$single3 ); $Thoracic_individual[]=array( 'one'=>'T4-5', 'two'=>$single4 ); $Thoracic_individual[]=array( 'one'=>'T5-6', 'two'=>$single5 ); $Thoracic_individual[]=array( 'one'=>'T6-7', 'two'=>$single6 ); $Thoracic_individual[]=array( 'one'=>'T7-8', 'two'=>$single7 ); $Thoracic_individual[]=array( 'one'=>'T8-9', 'two'=>$single8 ); $Thoracic_individual[]=array( 'one'=>'T9-10', 'two'=>$single9 ); $Thoracic_individual[]=array( 'one'=>'T10-11', 'two'=>$single10 ); $Thoracic_individual[]=array( 'one'=>'T11-12', 'two'=>$single11 ); $Thoracic_individual[]=array( 'one'=>'T12-L1', 'two'=>$single12 ); $Lumbar_individual[]=array( 'one'=>'L1-2', 'two'=>$single13 ); $Lumbar_individual[]=array( 'one'=>'L2-3', 'two'=>$single14 ); $Lumbar_individual[]=array( 'one'=>'L3-4', 'two'=>$single15 ); $Lumbar_individual[]=array( 'one'=>'L4-5', 'two'=>$single16 ); $Lumbar_individual[]=array( 'one'=>'L5-S1', 'two'=>$single17 ); $Cervical_individual[]=array( 'one'=>'C1-2', 'two'=>$single18 ); $Cervical_individual[]=array( 'one'=>'C2-3', 'two'=>$single19 ); $Cervical_individual[]=array( 'one'=>'C3-4', 'two'=>$single20 ); $Cervical_individual[]=array( 'one'=>'C4-5', 'two'=>$single21 ); $Cervical_individual[]=array( 'one'=>'C5-6', 'two'=>$single22 ); $Cervical_individual[]=array( 'one'=>'C6-7', 'two'=>$single23 ); $Cervical_individual[]=array( 'one'=>'C7-T1', 'two'=>$single24 ); $Caudal_individual[]=array( 'one'=>'Caudal', 'two'=>$single25 ); $data['Thoracic_individual']=($Thoracic_individual); $data['Cervical_individual']=($Cervical_individual); $data['Lumbar_individual']=($Lumbar_individual); $data['Caudal_individual']=($Caudal_individual); $data['t_Thoracic']=$Thoracic; $data['t_Lumbar']=$Lumbar; $data['t_Cervical']=$Cervical; $data['t_Caudal']=$Caudal; //--------single end----------// //--------double start---------// //--------epidural-------------// $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.cse_technique as technique,procedure_cse.spinal_level_name as sname,procedure_cse.epidural_level_name as ename,procedure_cse.spinal_level as lname,procedure_cse.epidural_level as elname"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query= $builder->where('procedure_cse.cse_technique','Double Interspace Technique'); $query = $builder->get(); $record_double = $query->getResult(); // $query = $db->getLastQuery(); // echo $query; $double = []; $Thoracic_d = 0; $Lumbar_d = 0; $Cervical_d=0; $Caudal_d=0; $double1 = []; $Thoracic_d1 = 0; $Lumbar_d1 = 0; $Cervical_d1=0; $Caudal_d1=0; if ($record_double) { foreach ($record_double as $key) { if ($key->sname == 'Thoracic') { $Thoracic_d = $Thoracic_d + 1; } if ($key->sname == 'Lumbar') { $Lumbar_d = $Lumbar_d + 1; } if ($key->sname == 'Cervical') { $Cervical_d = $Cervical_d + 1; } if($key->sname == 'Caudal'){ $Caudal_d++; } if ($key->ename == 'Thoracic') { $Thoracic_d1 = $Thoracic_d1 + 1; } if ($key->ename == 'Lumbar') { $Lumbar_d1 = $Lumbar_d1 + 1; } if ($key->ename == 'Cervical') { $Cervical_d1 = $Cervical_d1 + 1; } if($key->ename == 'Caudal'){ $Caudal_d1++; } } } // echo $Cervical;die(); $double[] = array( 'day' => 'Cervical', 'sell' => $Cervical_d ); $double[] = array( 'day' => 'Thoracic', 'sell' => $Thoracic_d ); $double[] = array( 'day' => 'Lumbar', 'sell' => $Lumbar_d ); $double[] = array( 'day' => 'Caudal', 'sell' => $Caudal_d ); // $double1[] = array( // 'day' => 'Cervical', // 'sell' => $Cervical_d1 // ); $double1[] = array( 'day' => 'Thoracic', 'sell' => $Thoracic_d1 ); $double1[] = array( 'day' => 'Lumbar', 'sell' => $Lumbar_d1 ); $double1[] = array( 'day' => 'Caudal', 'sell' => $Caudal_d1 ); $data['double'] = $double; $total1_d = $Thoracic_d + $Lumbar_d+$Cervical_d+$Caudal_d; $data['total_double'] = $total1_d; $data['double1'] = $double1; $total1_d1 = $Thoracic_d1 + $Lumbar_d1+$Cervical_d1+$Caudal_d1; $data['total_double1'] = $total1_d1; $double1=$double2=$double3=$double4=$double5=$double6=$double7=$double8=$double9=$double10=$double11=$double12=$double13=$double14=$double15=$double16=$double17=0; $double18=$double19=$double20=$double21=$double22=$double23=$double24=$double25=0; if($record_double){ foreach($record_double as $row){ if($row->elname=='T1-2'){ $double1++; } if($row->elname=='T2-3'){ $double2++; } if($row->elname=='T3-4'){ $double3++; } if($row->elname=='T4-5'){ $double4++; } if($row->elname=='T5-6'){ $double5++; } if($row->elname=='T6-7'){ $double6++; } if($row->elname=='T7-8'){ $double7++; } if($row->elname=='T8-9'){ $double8++; } if($row->elname=='T9-10'){ $double9++; } if($row->elname=='T10-11'){ $double10++; } if($row->elname=='T11-12'){ $double11++; } if($row->elname=='T12-L1'){ $double12++; } if($row->elname=='L1-2'){ $double13++; } if($row->elname=='L2-3'){ $double14++; } if($row->elname=='L3-4'){ $double15++; } if($row->elname=='L4-5'){ $double16++; } if($row->elname=='L5-S1'){ $double17++; } if($row->elname=='C1-2'){ $double18++; } if($row->elname=='C2-3'){ $double19++; } if($row->elname=='C3-4'){ $double20++; } if($row->elname=='C4-5'){ $double21++; } if($row->elname=='C5-6'){ $double22++; } if($row->elname=='C6-7'){ $double23++; } if($row->elname=='C7-T1'){ $double24++; } if($row->elname=='Caudal'){ $double25++; } } } // echo $double17;die(); $Thoracic_individual_double[]=array( 'one'=>'T1-2', 'two'=>$double1 ); $Thoracic_individual_double[]=array( 'one'=>'T2-3', 'two'=>$double2 ); $Thoracic_individual_double[]=array( 'one'=>'T3-4', 'two'=>$double3 ); $Thoracic_individual_double[]=array( 'one'=>'T4-5', 'two'=>$double4 ); $Thoracic_individual_double[]=array( 'one'=>'T5-6', 'two'=>$double5 ); $Thoracic_individual_double[]=array( 'one'=>'T6-7', 'two'=>$double6 ); $Thoracic_individual_double[]=array( 'one'=>'T7-8', 'two'=>$double7 ); $Thoracic_individual_double[]=array( 'one'=>'T8-9', 'two'=>$double8 ); $Thoracic_individual_double[]=array( 'one'=>'T9-10', 'two'=>$double9 ); $Thoracic_individual_double[]=array( 'one'=>'T10-11', 'two'=>$double10 ); $Thoracic_individual_double[]=array( 'one'=>'T11-12', 'two'=>$double11 ); $Thoracic_individual_double[]=array( 'one'=>'T12-L1', 'two'=>$double12 ); $Lumbar_individual_double[]=array( 'one'=>'L1-2', 'two'=>$double13 ); $Lumbar_individual_double[]=array( 'one'=>'L2-3', 'two'=>$double14 ); $Lumbar_individual_double[]=array( 'one'=>'L3-4', 'two'=>$double15 ); $Lumbar_individual_double[]=array( 'one'=>'L4-5', 'two'=>$double16 ); $Lumbar_individual_double[]=array( 'one'=>'L5-S1', 'two'=>$double17 ); $Cervical_individual_double[]=array( 'one'=>'C1-2', 'two'=>$double18 ); $Cervical_individual_double[]=array( 'one'=>'C2-3', 'two'=>$double19 ); $Cervical_individual_double[]=array( 'one'=>'C3-4', 'two'=>$double20 ); $Cervical_individual_double[]=array( 'one'=>'C4-5', 'two'=>$double21 ); $Cervical_individual_double[]=array( 'one'=>'C5-6', 'two'=>$double22 ); $Cervical_individual_double[]=array( 'one'=>'C6-7', 'two'=>$double23 ); $Cervical_individual_double[]=array( 'one'=>'C7-T1', 'two'=>$double24 ); $Caudal_individual_double[]=array( 'one'=>'Caudal', 'two'=>$double25 ); // echo $double7;die(); $data['Thoracic_individual_double']=($Thoracic_individual_double); $data['Cervical_individual_double']=($Cervical_individual_double); $data['Lumbar_individual_double']=($Lumbar_individual_double); $data['Caudal_individual_double']=($Caudal_individual_double); $data['Thoracic_d']=$Thoracic_d; $data['Lumbar_d']=$Lumbar_d; $data['Cervical_d']=$Cervical_d; $data['Caudal_d']=$Caudal_d; //-------spinal----------------// $Thoracic_individual_spinal=[]; $Lumbar_individual_spinal=[]; $t1_2=$t2_3=$t3_4=$t4_5=$t5_6=$t6_7=$t7_8=$t8_9=$t9_10=$t10_11=$t11_12=$t12=$l1_2=$l2_3=$l3_4=$l4_5=$l5_s1=0; if($record_double){ foreach($record_double as $row){ if($row->lname=='T1-2'){ $t1_2++; } elseif($row->lname=='T2-3'){ $t2_3++; } elseif($row->lname=='T3-4'){ $t3_4++; } elseif($row->lname=='T4-5'){ $t4_5++; } elseif($row->lname=='T5-6'){ $t5_6++; } elseif($row->lname=='T6-7'){ $t6_7++; } elseif($row->lname=='T7-8'){ $t7_8++; } elseif($row->lname=='T8-9'){ $t8_9++; } elseif($row->lname=='T9-10'){ $t9_10++; } elseif($row->lname=='T10-11'){ $t10_11++; } elseif($row->lname=='T11-12'){ $t11_12++; } elseif($row->lname=='T12-L1'){ $t12++; } elseif($row->lname=='L1-2'){ $l1_2++; } elseif($row->lname=='L2-3'){ $l2_3++; } elseif($row->lname=='L3-4'){ $l3_4++; } elseif($row->lname=='L4-5'){ $l4_5++; } elseif($row->lname=='L5-S1'){ $l5_s1++; } } } $Thoracic_individual_spinal[]=array( 'one'=>'T1-2', 'two'=>$t1_2 ); $Thoracic_individual_spinal[]=array( 'one'=>'T2-3', 'two'=>$t2_3 ); $Thoracic_individual_spinal[]=array( 'one'=>'T3-4', 'two'=>$t3_4 ); $Thoracic_individual_spinal[]=array( 'one'=>'T4-5', 'two'=>$t4_5 ); $Thoracic_individual_spinal[]=array( 'one'=>'T5-6', 'two'=>$t5_6 ); $Thoracic_individual_spinal[]=array( 'one'=>'T6-7', 'two'=>$t6_7 ); $Thoracic_individual_spinal[]=array( 'one'=>'T7-8', 'two'=>$t7_8 ); $Thoracic_individual_spinal[]=array( 'one'=>'T8-9', 'two'=>$t8_9 ); $Thoracic_individual_spinal[]=array( 'one'=>'T9-10', 'two'=>$t9_10 ); $Thoracic_individual_spinal[]=array( 'one'=>'T10-11', 'two'=>$t10_11 ); $Thoracic_individual_spinal[]=array( 'one'=>'T11-12', 'two'=>$t11_12 ); $Thoracic_individual_spinal[]=array( 'one'=>'T12-L1', 'two'=>$t12 ); $Lumbar_individual_spinal[]=array( 'three'=>'L1-2', 'four'=>$l1_2 ); $Lumbar_individual_spinal[]=array( 'three'=>'L2-3', 'four'=>$l2_3 ); $Lumbar_individual_spinal[]=array( 'three'=>'L3-4', 'four'=>$l3_4 ); $Lumbar_individual_spinal[]=array( 'three'=>'L4-5', 'four'=>$l4_5 ); $Lumbar_individual_spinal[]=array( 'three'=>'L5-S1', 'four'=>$l5_s1 ); $data['Thoracic_d1']=$Thoracic_d1; $data['Thoracic_individual_spinal']=($Thoracic_individual_spinal); $data['Lumbar_d1']=$Lumbar_d1; $data['Lumbar_individual_spinal']=($Lumbar_individual_spinal); //-------double end -----------// return view('cnb/reports/v_cse_single_v',$data); }else{ return redirect()->route("n_report"); } } public function v_cse_double() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if($from_date && $to_date){ $total_cse = session()->get('cse_total'); $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.cse_technique as technique,procedure_cse.spinal_level_name as sname,procedure_cse.epidural_level_name as ename"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); $single_new = 0; $double_new = 0; $dual_new = 0; if ($record) { foreach ($record as $key) { if ($key->technique == 'Single Interspace Technique (Needle through Needle)') { $single_new = $single_new + 1; } if ($key->technique == 'Double Interspace Technique') { $double_new = $double_new + 1; } if ($key->technique == 'DPE:Dural Puncture Epidural Technique') { $dual_new = $dual_new + 1; } } } $cse[] = array( 'day' => 'Single Interspace Technique (Needle through Needle)', 'sell' => $single_new ); $cse[] = array( 'day' => 'Double Interspace Technique', 'sell' => $double_new ); $cse[] = array( 'day' => 'DPE:Dural Puncture Epidural Technique', 'sell' => $dual_new ); $data['total_cse'] = $total_cse; $data['cse'] = $cse; $total4 = $single_new + $double_new + $dual_new; $data['total4'] = $total4; //--------double start---------// //--------epidural-------------// $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.cse_technique as technique,procedure_cse.spinal_level_name as sname,procedure_cse.epidural_level_name as ename,procedure_cse.spinal_level as slname,procedure_cse.epidural_level as elname"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query= $builder->where('procedure_cse.cse_technique','Double Interspace Technique'); $query = $builder->get(); $record_double = $query->getResult(); // $query = $db->getLastQuery(); // echo $query; $double = []; $Thoracic_d = 0; $Lumbar_d = 0; $Cervical_d=0; $Caudal_d=0; $double1 = []; $Thoracic_d1 = 0; $Lumbar_d1 = 0; $Cervical_d1=0; $Caudal_d1=0; if ($record_double) { foreach ($record_double as $key) { if ($key->ename == 'Thoracic') { $Thoracic_d = $Thoracic_d + 1; } if ($key->ename == 'Lumbar') { $Lumbar_d = $Lumbar_d + 1; } if ($key->ename == 'Cervical') { $Cervical_d = $Cervical_d + 1; } if($key->ename == 'Caudal'){ $Caudal_d++; } if ($key->sname == 'Thoracic') { $Thoracic_d1 = $Thoracic_d1 + 1; } if ($key->sname == 'Lumbar') { $Lumbar_d1 = $Lumbar_d1 + 1; } if ($key->sname == 'Cervical') { $Cervical_d1 = $Cervical_d1 + 1; } if($key->sname == 'Caudal'){ $Caudal_d1++; } } } // echo $Cervical;die(); $double[] = array( 'day' => 'Cervical', 'sell' => $Cervical_d ); $double[] = array( 'day' => 'Thoracic', 'sell' => $Thoracic_d ); $double[] = array( 'day' => 'Lumbar', 'sell' => $Lumbar_d ); $double[] = array( 'day' => 'Caudal', 'sell' => $Caudal_d ); // $double1[] = array( // 'day' => 'Cervical', // 'sell' => $Cervical_d1 // ); $double1[] = array( 'day' => 'Thoracic', 'sell' => $Thoracic_d1 ); $double1[] = array( 'day' => 'Lumbar', 'sell' => $Lumbar_d1 ); $double1[] = array( 'day' => 'Caudal', 'sell' => $Caudal_d1 ); $data['double'] = $double; $total1_d = $Thoracic_d + $Lumbar_d+$Cervical_d+$Caudal_d; $data['total_double'] = $total1_d; $data['double1'] = $double1; $total1_d1 = $Thoracic_d1 + $Lumbar_d1+$Cervical_d1+$Caudal_d1; $data['total_double1'] = $total1_d1; $double1=$double2=$double3=$double4=$double5=$double6=$double7=$double8=$double9=$double10=$double11=$double12=$double13=$double14=$double15=$double16=$double17=0; $double18=$double19=$double20=$double21=$double22=$double23=$double24=$double25=0; if($record_double){ foreach($record_double as $row){ if($row->elname=='T1-2'){ $double1++; } if($row->elname=='T2-3'){ $double2++; } if($row->elname=='T3-4'){ $double3++; } if($row->elname=='T4-5'){ $double4++; } if($row->elname=='T5-6'){ $double5++; } if($row->elname=='T6-7'){ $double6++; } if($row->elname=='T7-8'){ $double7++; } if($row->elname=='T8-9'){ $double8++; } if($row->elname=='T9-10'){ $double9++; } if($row->elname=='T10-11'){ $double10++; } if($row->elname=='T11-12'){ $double11++; } if($row->elname=='T12-L1'){ $double12++; } if($row->elname=='L1-2'){ $double13++; } if($row->elname=='L2-3'){ $double14++; } if($row->elname=='L3-4'){ $double15++; } if($row->elname=='L4-5'){ $double16++; } if($row->elname=='L5-S1'){ $double17++; } if($row->elname=='C1-2'){ $double18++; } if($row->elname=='C2-3'){ $double19++; } if($row->elname=='C3-4'){ $double20++; } if($row->elname=='C4-5'){ $double21++; } if($row->elname=='C5-6'){ $double22++; } if($row->elname=='C6-7'){ $double23++; } if($row->elname=='C7-T1'){ $double24++; } if($row->elname=='Caudal'){ $double25++; } } } // echo $double17;die(); $Thoracic_individual_double=[]; $Lumbar_individual_double=[]; $Cervical_individual_double=[]; $Caudal_individual_double=[]; $Thoracic_individual_double[]=array( 'one'=>'T1-2', 'two'=>$double1 ); $Thoracic_individual_double[]=array( 'one'=>'T2-3', 'two'=>$double2 ); $Thoracic_individual_double[]=array( 'one'=>'T3-4', 'two'=>$double3 ); $Thoracic_individual_double[]=array( 'one'=>'T4-5', 'two'=>$double4 ); $Thoracic_individual_double[]=array( 'one'=>'T5-6', 'two'=>$double5 ); $Thoracic_individual_double[]=array( 'one'=>'T6-7', 'two'=>$double6 ); $Thoracic_individual_double[]=array( 'one'=>'T7-8', 'two'=>$double7 ); $Thoracic_individual_double[]=array( 'one'=>'T8-9', 'two'=>$double8 ); $Thoracic_individual_double[]=array( 'one'=>'T9-10', 'two'=>$double9 ); $Thoracic_individual_double[]=array( 'one'=>'T10-11', 'two'=>$double10 ); $Thoracic_individual_double[]=array( 'one'=>'T11-12', 'two'=>$double11 ); $Thoracic_individual_double[]=array( 'one'=>'T12-L1', 'two'=>$double12 ); $Lumbar_individual_double[]=array( 'one'=>'L1-2', 'two'=>$double13 ); $Lumbar_individual_double[]=array( 'one'=>'L2-3', 'two'=>$double14 ); $Lumbar_individual_double[]=array( 'one'=>'L3-4', 'two'=>$double15 ); $Lumbar_individual_double[]=array( 'one'=>'L4-5', 'two'=>$double16 ); $Lumbar_individual_double[]=array( 'one'=>'L5-S1', 'two'=>$double17 ); $Cervical_individual_double[]=array( 'one'=>'C1-2', 'two'=>$double18 ); $Cervical_individual_double[]=array( 'one'=>'C2-3', 'two'=>$double19 ); $Cervical_individual_double[]=array( 'one'=>'C3-4', 'two'=>$double20 ); $Cervical_individual_double[]=array( 'one'=>'C4-5', 'two'=>$double21 ); $Cervical_individual_double[]=array( 'one'=>'C5-6', 'two'=>$double22 ); $Cervical_individual_double[]=array( 'one'=>'C6-7', 'two'=>$double23 ); $Cervical_individual_double[]=array( 'one'=>'C7-T1', 'two'=>$double24 ); $Caudal_individual_double[]=array( 'one'=>'Caudal', 'two'=>$double25 ); // echo $double7;die(); $data['Thoracic_individual_double']=($Thoracic_individual_double); $data['Cervical_individual_double']=($Cervical_individual_double); $data['Lumbar_individual_double']=($Lumbar_individual_double); $data['Caudal_individual_double']=($Caudal_individual_double); $data['Thoracic_d']=$Thoracic_d; $data['Lumbar_d']=$Lumbar_d; $data['Cervical_d']=$Cervical_d; $data['Caudal_d']=$Caudal_d; //-------spinal----------------// $Thoracic_individual_spinal=[]; $Lumbar_individual_spinal=[]; $t1_2=$t2_3=$t3_4=$t4_5=$t5_6=$t6_7=$t7_8=$t8_9=$t9_10=$t10_11=$t11_12=$t12=$l1_2=$l2_3=$l3_4=$l4_5=$l5_s1=0; if($record_double){ foreach($record_double as $row){ if($row->slname=='T1-2'){ $t1_2++; } elseif($row->slname=='T2-3'){ $t2_3++; } elseif($row->slname=='T3-4'){ $t3_4++; } elseif($row->slname=='T4-5'){ $t4_5++; } elseif($row->slname=='T5-6'){ $t5_6++; } elseif($row->slname=='T6-7'){ $t6_7++; } elseif($row->slname=='T7-8'){ $t7_8++; } elseif($row->slname=='T8-9'){ $t8_9++; } elseif($row->slname=='T9-10'){ $t9_10++; } elseif($row->slname=='T10-11'){ $t10_11++; } elseif($row->slname=='T11-12'){ $t11_12++; } elseif($row->slname=='T12-L1'){ $t12++; } elseif($row->slname=='L1-2'){ $l1_2++; } elseif($row->slname=='L2-3'){ $l2_3++; } elseif($row->slname=='L3-4'){ $l3_4++; } elseif($row->slname=='L4-5'){ $l4_5++; } elseif($row->slname=='L5-S1'){ $l5_s1++; } } } $Thoracic_individual_spinal[]=array( 'one'=>'T1-2', 'two'=>$t1_2 ); $Thoracic_individual_spinal[]=array( 'one'=>'T2-3', 'two'=>$t2_3 ); $Thoracic_individual_spinal[]=array( 'one'=>'T3-4', 'two'=>$t3_4 ); $Thoracic_individual_spinal[]=array( 'one'=>'T4-5', 'two'=>$t4_5 ); $Thoracic_individual_spinal[]=array( 'one'=>'T5-6', 'two'=>$t5_6 ); $Thoracic_individual_spinal[]=array( 'one'=>'T6-7', 'two'=>$t6_7 ); $Thoracic_individual_spinal[]=array( 'one'=>'T7-8', 'two'=>$t7_8 ); $Thoracic_individual_spinal[]=array( 'one'=>'T8-9', 'two'=>$t8_9 ); $Thoracic_individual_spinal[]=array( 'one'=>'T9-10', 'two'=>$t9_10 ); $Thoracic_individual_spinal[]=array( 'one'=>'T10-11', 'two'=>$t10_11 ); $Thoracic_individual_spinal[]=array( 'one'=>'T11-12', 'two'=>$t11_12 ); $Thoracic_individual_spinal[]=array( 'one'=>'T12-L1', 'two'=>$t12 ); $Lumbar_individual_spinal[]=array( 'three'=>'L1-2', 'four'=>$l1_2 ); $Lumbar_individual_spinal[]=array( 'three'=>'L2-3', 'four'=>$l2_3 ); $Lumbar_individual_spinal[]=array( 'three'=>'L3-4', 'four'=>$l3_4 ); $Lumbar_individual_spinal[]=array( 'three'=>'L4-5', 'four'=>$l4_5 ); $Lumbar_individual_spinal[]=array( 'three'=>'L5-S1', 'four'=>$l5_s1 ); $data['Thoracic_d1']=$Thoracic_d1; $data['Thoracic_individual_spinal']=($Thoracic_individual_spinal); $data['Lumbar_d1']=$Lumbar_d1; $data['Lumbar_individual_spinal']=($Lumbar_individual_spinal); //-------double end -----------// return view('cnb/reports/v_cse_double_v',$data); }else{ return redirect()->route("n_report"); } } public function v_cse_dural() { $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if($from_date && $to_date){ $total_cse = session()->get('cse_total'); $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.cse_technique as technique,procedure_cse.spinal_level_name as sname,procedure_cse.epidural_level_name as ename"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); $single_new = 0; $double_new = 0; $dual_new = 0; if ($record) { foreach ($record as $key) { if ($key->technique == 'Single Interspace Technique (Needle through Needle)') { $single_new = $single_new + 1; } if ($key->technique == 'Double Interspace Technique') { $double_new = $double_new + 1; } if ($key->technique == 'DPE:Dural Puncture Epidural Technique') { $dual_new = $dual_new + 1; } } } $cse[] = array( 'day' => 'Single Interspace Technique (Needle through Needle)', 'sell' => $single_new ); $cse[] = array( 'day' => 'Double Interspace Technique', 'sell' => $double_new ); $cse[] = array( 'day' => 'DPE:Dural Puncture Epidural Technique', 'sell' => $dual_new ); $data['total_cse'] = $total_cse; $data['cse'] = $cse; $total4 = $single_new + $double_new + $dual_new; $data['total4'] = $total4; //--------double start---------// //--------epidural-------------// $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_cse.cse_technique as technique,procedure_cse.spinal_level_name as sname,procedure_cse.epidural_level_name as ename,procedure_cse.spinal_level as slname,procedure_cse.epidural_level as elname"); $builder->join('procedure_cse', 'procedure_cse.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); $query = $builder->where('procedure_cse.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_cse.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query= $builder->where('procedure_cse.cse_technique','DPE:Dural Puncture Epidural Technique'); $query = $builder->get(); $record_double = $query->getResult(); // $query = $db->getLastQuery(); // echo $query; $double = []; $Thoracic_d = 0; $Lumbar_d = 0; $Cervical_d=0; $Caudal_d=0; $double1 = []; $Thoracic_d1 = 0; $Lumbar_d1 = 0; $Cervical_d1=0; $Caudal_d1=0; if ($record_double) { foreach ($record_double as $key) { if ($key->ename == 'Thoracic') { $Thoracic_d = $Thoracic_d + 1; } if ($key->ename == 'Lumbar') { $Lumbar_d = $Lumbar_d + 1; } if ($key->ename == 'Cervical') { $Cervical_d = $Cervical_d + 1; } if($key->ename == 'Caudal'){ $Caudal_d++; } if ($key->sname == 'Thoracic') { $Thoracic_d1 = $Thoracic_d1 + 1; } if ($key->sname == 'Lumbar') { $Lumbar_d1 = $Lumbar_d1 + 1; } if ($key->sname == 'Cervical') { $Cervical_d1 = $Cervical_d1 + 1; } if($key->sname == 'Caudal'){ $Caudal_d1++; } } } // echo $Cervical;die(); // print_r($record_double); $double[] = array( 'day' => 'Cervical', 'sell' => $Cervical_d ); $double[] = array( 'day' => 'Thoracic', 'sell' => $Thoracic_d ); $double[] = array( 'day' => 'Lumbar', 'sell' => $Lumbar_d ); $double[] = array( 'day' => 'Caudal', 'sell' => $Caudal_d ); $double1[] = array( 'day' => 'Cervical', 'sell' => $Cervical_d1 ); // $double1[] = array( // 'day' => 'Thoracic', // 'sell' => $Thoracic_d1 // ); $double1[] = array( 'day' => 'Lumbar', 'sell' => $Lumbar_d1 ); $double1[] = array( 'day' => 'Caudal', 'sell' => $Caudal_d1 ); $data['double'] = $double; $total1_d = $Thoracic_d + $Lumbar_d+$Cervical_d+$Caudal_d; $data['total_double'] = $total1_d; $data['double1'] = $double1; $total1_d1 = $Thoracic_d1 + $Lumbar_d1+$Cervical_d1+$Caudal_d1; $data['total_double1'] = $total1_d1; $double1=$double2=$double3=$double4=$double5=$double6=$double7=$double8=$double9=$double10=$double11=$double12=$double13=$double14=$double15=$double16=$double17=0; $double18=$double19=$double20=$double21=$double22=$double23=$double24=$double25=0; if($record_double){ foreach($record_double as $row){ if($row->elname=='T1-2'){ $double1++; } if($row->elname=='T2-3'){ $double2++; } if($row->elname=='T3-4'){ $double3++; } if($row->elname=='T4-5'){ $double4++; } if($row->elname=='T5-6'){ $double5++; } if($row->elname=='T6-7'){ $double6++; } if($row->elname=='T7-8'){ $double7++; } if($row->elname=='T8-9'){ $double8++; } if($row->elname=='T9-10'){ $double9++; } if($row->elname=='T10-11'){ $double10++; } if($row->elname=='T11-12'){ $double11++; } if($row->elname=='T12-L1'){ $double12++; } if($row->elname=='L1-2'){ $double13++; } if($row->elname=='L2-3'){ $double14++; } if($row->elname=='L3-4'){ $double15++; } if($row->elname=='L4-5'){ $double16++; } if($row->elname=='L5-S1'){ $double17++; } if($row->elname=='C1-2'){ $double18++; } if($row->elname=='C2-3'){ $double19++; } if($row->elname=='C3-4'){ $double20++; } if($row->elname=='C4-5'){ $double21++; } if($row->elname=='C5-6'){ $double22++; } if($row->elname=='C6-7'){ $double23++; } if($row->elname=='C7-T1'){ $double24++; } if($row->elname=='Caudal'){ $double25++; } } } // echo $double17;die(); $Thoracic_individual_double=[]; $Lumbar_individual_double=[]; $Cervical_individual_double=[]; $Caudal_individual_double=[]; $Thoracic_individual_double[]=array( 'one'=>'T1-2', 'two'=>$double1 ); $Thoracic_individual_double[]=array( 'one'=>'T2-3', 'two'=>$double2 ); $Thoracic_individual_double[]=array( 'one'=>'T3-4', 'two'=>$double3 ); $Thoracic_individual_double[]=array( 'one'=>'T4-5', 'two'=>$double4 ); $Thoracic_individual_double[]=array( 'one'=>'T5-6', 'two'=>$double5 ); $Thoracic_individual_double[]=array( 'one'=>'T6-7', 'two'=>$double6 ); $Thoracic_individual_double[]=array( 'one'=>'T7-8', 'two'=>$double7 ); $Thoracic_individual_double[]=array( 'one'=>'T8-9', 'two'=>$double8 ); $Thoracic_individual_double[]=array( 'one'=>'T9-10', 'two'=>$double9 ); $Thoracic_individual_double[]=array( 'one'=>'T10-11', 'two'=>$double10 ); $Thoracic_individual_double[]=array( 'one'=>'T11-12', 'two'=>$double11 ); $Thoracic_individual_double[]=array( 'one'=>'T12-L1', 'two'=>$double12 ); $Lumbar_individual_double[]=array( 'one'=>'L1-2', 'two'=>$double13 ); $Lumbar_individual_double[]=array( 'one'=>'L2-3', 'two'=>$double14 ); $Lumbar_individual_double[]=array( 'one'=>'L3-4', 'two'=>$double15 ); $Lumbar_individual_double[]=array( 'one'=>'L4-5', 'two'=>$double16 ); $Lumbar_individual_double[]=array( 'one'=>'L5-S1', 'two'=>$double17 ); $Cervical_individual_double[]=array( 'one'=>'C1-2', 'two'=>$double18 ); $Cervical_individual_double[]=array( 'one'=>'C2-3', 'two'=>$double19 ); $Cervical_individual_double[]=array( 'one'=>'C3-4', 'two'=>$double20 ); $Cervical_individual_double[]=array( 'one'=>'C4-5', 'two'=>$double21 ); $Cervical_individual_double[]=array( 'one'=>'C5-6', 'two'=>$double22 ); $Cervical_individual_double[]=array( 'one'=>'C6-7', 'two'=>$double23 ); $Cervical_individual_double[]=array( 'one'=>'C7-T1', 'two'=>$double24 ); $Caudal_individual_double[]=array( 'one'=>'Caudal', 'two'=>$double25 ); // echo $double7;die(); $data['Thoracic_individual_double']=($Thoracic_individual_double); $data['Cervical_individual_double']=($Cervical_individual_double); $data['Lumbar_individual_double']=($Lumbar_individual_double); $data['Caudal_individual_double']=($Caudal_individual_double); $data['Thoracic_d']=$Thoracic_d; $data['Lumbar_d']=$Lumbar_d; $data['Cervical_d']=$Cervical_d; $data['Caudal_d']=$Caudal_d; //-------spinal----------------// $Thoracic_individual_spinal=[]; $Lumbar_individual_spinal=[]; $t1_2=$t2_3=$t3_4=$t4_5=$t5_6=$t6_7=$t7_8=$t8_9=$t9_10=$t10_11=$t11_12=$t12=$l1_2=$l2_3=$l3_4=$l4_5=$l5_s1=0; if($record_double){ foreach($record_double as $row){ if($row->slname=='T1-2'){ $t1_2++; } elseif($row->slname=='T2-3'){ $t2_3++; } elseif($row->slname=='T3-4'){ $t3_4++; } elseif($row->slname=='T4-5'){ $t4_5++; } elseif($row->slname=='T5-6'){ $t5_6++; } elseif($row->slname=='T6-7'){ $t6_7++; } elseif($row->slname=='T7-8'){ $t7_8++; } elseif($row->slname=='T8-9'){ $t8_9++; } elseif($row->slname=='T9-10'){ $t9_10++; } elseif($row->slname=='T10-11'){ $t10_11++; } elseif($row->slname=='T11-12'){ $t11_12++; } elseif($row->slname=='T12-L1'){ $t12++; } elseif($row->slname=='L1-2'){ $l1_2++; } elseif($row->slname=='L2-3'){ $l2_3++; } elseif($row->slname=='L3-4'){ $l3_4++; } elseif($row->slname=='L4-5'){ $l4_5++; } elseif($row->slname=='L5-S1'){ $l5_s1++; } } } $Thoracic_individual_spinal[]=array( 'one'=>'T1-2', 'two'=>$t1_2 ); $Thoracic_individual_spinal[]=array( 'one'=>'T2-3', 'two'=>$t2_3 ); $Thoracic_individual_spinal[]=array( 'one'=>'T3-4', 'two'=>$t3_4 ); $Thoracic_individual_spinal[]=array( 'one'=>'T4-5', 'two'=>$t4_5 ); $Thoracic_individual_spinal[]=array( 'one'=>'T5-6', 'two'=>$t5_6 ); $Thoracic_individual_spinal[]=array( 'one'=>'T6-7', 'two'=>$t6_7 ); $Thoracic_individual_spinal[]=array( 'one'=>'T7-8', 'two'=>$t7_8 ); $Thoracic_individual_spinal[]=array( 'one'=>'T8-9', 'two'=>$t8_9 ); $Thoracic_individual_spinal[]=array( 'one'=>'T9-10', 'two'=>$t9_10 ); $Thoracic_individual_spinal[]=array( 'one'=>'T10-11', 'two'=>$t10_11 ); $Thoracic_individual_spinal[]=array( 'one'=>'T11-12', 'two'=>$t11_12 ); $Thoracic_individual_spinal[]=array( 'one'=>'T12-L1', 'two'=>$t12 ); $Lumbar_individual_spinal[]=array( 'three'=>'L1-2', 'four'=>$l1_2 ); $Lumbar_individual_spinal[]=array( 'three'=>'L2-3', 'four'=>$l2_3 ); $Lumbar_individual_spinal[]=array( 'three'=>'L3-4', 'four'=>$l3_4 ); $Lumbar_individual_spinal[]=array( 'three'=>'L4-5', 'four'=>$l4_5 ); $Lumbar_individual_spinal[]=array( 'three'=>'L5-S1', 'four'=>$l5_s1 ); $data['Thoracic_d1']=$Thoracic_d1; $data['Thoracic_individual_spinal']=($Thoracic_individual_spinal); $data['Lumbar_d1']=$Lumbar_d1; $data['Lumbar_individual_spinal']=($Lumbar_individual_spinal); //-------double end -----------// return view('cnb/reports/v_cse_dural_v',$data); }else{ return redirect()->route("n_report"); } } public function v_epidural(){ $db = \Config\Database::connect(); $from_date = session()->get('from_date'); $to_date = session()->get('to_date'); if($from_date && $to_date){ $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.epidural_level_name as Ename,procedure_epidural.epedural_level as lname"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); // $query = $builder->select("spinal_level_name as Sname"); $query = $builder->where('procedure_epidural.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_epidural.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record = $query->getResult(); // $query = $db->getLastQuery(); // echo $query; $epidural_level_name = []; $Cervical1 = 0; $Caudal1 = 0; $Thoracic1 = 0; $Lumbar1 = 0; if ($record) { foreach ($record as $key) { if ($key->Ename == 'Thoracic') { $Thoracic1 = $Thoracic1 + 1; } if ($key->Ename == 'Lumbar') { $Lumbar1 = $Lumbar1 + 1; } if ($key->Ename == 'Cervical') { $Cervical1 = $Cervical1 + 1; } if ($key->Ename == 'Caudal') { $Caudal1 = $Caudal1 + 1; } } } $epidural_level_name[] = array( 'day' => 'Cervical', 'sell' => $Cervical1 ); // print_r($Lumbar);die(); $epidural_level_name[] = array( 'day' => 'Thoracic', 'sell' => $Thoracic1 ); $epidural_level_name[] = array( 'day' => 'Lumbar', 'sell' => $Lumbar1 ); $epidural_level_name[] = array( 'day' => 'Caudal', 'sell' => $Caudal1 ); $total_epidural = $Thoracic1 + $Lumbar1 + $Cervical1 + $Caudal1; // echo $total_epidural;die(); $data['total_epidural'] = $total_epidural; // print_r($total_epidural);die(); // $data['products'] = ($products); $data['epidural_level_name'] = $epidural_level_name; // ---------------individual----v_epidural-------// $Cervical_individual=[]; $Lumbar_individual=[]; $Thoracic_individual=[]; $Caudal_individual=[]; $c1_2=$c2_3=$c3_4=$c4_5=$c5_6=$c6_7=$c7_t1=$l1_2=$l2_3=$l3_4=$l4_5=$l5_s1= $t1_2=$t2_3=$t3_4=$t4_5=$t5_6=$t6_7=$t7_8=$t8_9=$t9_10=$t10_11=$t11_12=$t12_l1=$Caudal=0; $builder = $db->table('cnb_postop'); $query = $builder->select("cnb_postop.id as count, procedure_epidural.epidural_level_name as Ename,procedure_epidural.epedural_level as lname"); $builder->join('procedure_epidural', 'procedure_epidural.patient_id = cnb_postop.patient_id'); $builder->join('cnb_preop', 'cnb_preop.patient_id = cnb_postop.patient_id'); // $query = $builder->select("spinal_level_name as Sname"); $query = $builder->where('procedure_epidural.procedure_date >=', date('Y-m-d', strtotime($from_date))); $query = $builder->where('procedure_epidural.procedure_date <=', date('Y-m-d', strtotime($to_date))); $query = $builder->get(); $record_ep = $query->getResult(); if($record_ep){ foreach($record_ep as $row){ if($row->lname=='C1-2'){ $c1_2++; } elseif($row->lname=='C2-3'){ $c2_3++; } elseif($row->lname=='C3-4'){ $c3_4++; } elseif($row->lname=='C4-5'){ $c4_5++; } elseif($row->lname=='C5-6'){ $c5_6++; } elseif($row->lname=='C6-7'){ $c6_7++; } elseif($row->lname=='C7-T1'){ $c7_t1++; } elseif($row->lname=='L1-2'){ $l1_2++; } elseif($row->lname=='L2-3'){ $l2_3++; } elseif($row->lname=='L3-4'){ $l3_4++; } elseif($row->lname=='L4-5'){ $l4_5++; } elseif($row->lname=='L5-S1'){ $l5_s1++; } if($row->lname=='T1-2'){ $t1_2++; } elseif($row->lname=='T2-3'){ $t2_3++; } elseif($row->lname=='T3-4'){ $t3_4++; } elseif($row->lname=='T4-5'){ $t4_5++; } elseif($row->lname=='T5-6'){ $t5_6++; } elseif($row->lname=='T6-7'){ $t6_7++; } elseif($row->lname=='T7-8'){ $t7_8++; } elseif($row->lname=='T8-9'){ $t8_9++; } elseif($row->lname=='T9-10'){ $t9_10++; } elseif($row->lname=='T10-11'){ $t10_11++; } elseif($row->lname=='T11-12'){ $t11_12++; } elseif($row->lname=='T12-L1'){ $t12_l1++; } elseif($row->lname=='Caudal'){ $Caudal++; } } } // foreach($record as $row){ // if($row->lname=='T6-7'){ // $t6_7++; // } // } // echo $t6_7;die(); $Cervical_individual[]=array( 'one'=>'C1-2', 'two'=>$c1_2 ); $Cervical_individual[]=array( 'one'=>'C2-3', 'two'=>$c2_3 ); $Cervical_individual[]=array( 'one'=>'C3-4', 'two'=>$c3_4 ); $Cervical_individual[]=array( 'one'=>'C4-5', 'two'=>$c4_5 ); $Cervical_individual[]=array( 'one'=>'C5-6', 'two'=>$c5_6 ); $Cervical_individual[]=array( 'one'=>'C6-7', 'two'=>$c6_7 ); $Cervical_individual[]=array( 'one'=>'C7-T1', 'two'=>$c7_t1 ); $Lumbar_individual[]=array( 'one'=>'L1-2', 'two'=>$l1_2 ); $Lumbar_individual[]=array( 'one'=>'L2-3', 'two'=>$l2_3 ); $Lumbar_individual[]=array( 'one'=>'L3-4', 'two'=>$l3_4 ); $Lumbar_individual[]=array( 'one'=>'L4-5', 'two'=>$l4_5 ); $Lumbar_individual[]=array( 'one'=>'L5-S1', 'two'=>$l5_s1 ); $Thoracic_individual[]=array( 'one'=>'T1-2', 'two'=>$t1_2 ); $Thoracic_individual[]=array( 'one'=>'T2-3', 'two'=>$t2_3 ); $Thoracic_individual[]=array( 'one'=>'T3-4', 'two'=>$t3_4 ); $Thoracic_individual[]=array( 'one'=>'T4-5', 'two'=>$t4_5 ); $Thoracic_individual[]=array( 'one'=>'T5-6', 'two'=>$t5_6 ); $Thoracic_individual[]=array( 'one'=>'T6-7', 'two'=>$t6_7 ); $Thoracic_individual[]=array( 'one'=>'T7-8', 'two'=>$t7_8 ); $Thoracic_individual[]=array( 'one'=>'T8-9', 'two'=>$t8_9 ); $Thoracic_individual[]=array( 'one'=>'T9-10', 'two'=>$t9_10 ); $Thoracic_individual[]=array( 'one'=>'T10-11', 'two'=>$t10_11 ); $Thoracic_individual[]=array( 'one'=>'T11-12', 'two'=>$t11_12 ); $Thoracic_individual[]=array( 'one'=>'T12-L1', 'two'=>$t12_l1 ); $Caudal_individual[]=array( 'one'=>'Caudal', 'two'=>$Caudal ); // $data['t_thoracic']=$Thoracic; // $data['Thoracic_individual']=($Thoracic_individual); // $data['t_lumbar']=$Lumbar; // $data['Lumbar_individual']=($Lumbar_individual); // return view('cnb/reports/v_spinal_v', $data); $data['C_cervical']=$Cervical1; $data['L_Lumbar']=$Lumbar1; $data['L_Thoracic']=$Thoracic1; $data['L_Caudal']=$Caudal1; $data['Cervical_individual']=($Cervical_individual); $data['Lumbar_individual']=($Lumbar_individual); $data['Thoracic_individual']=($Thoracic_individual); $data['Caudal_individual']=($Caudal_individual); return view('cnb/reports/v_epidural_v',$data); }else{ return redirect()->route("n_report"); } } }