%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php defined('BASEPATH') OR exit('No direct script access allowed'); Class Custompage extends CI_Controller { function __construct(){ parent::__construct(); $this->load->model('Common_Model'); if(! $this->session->userdata('adid')) { redirect('admin/login'); } } /* * Function : index * Desc : listing all records */ public function index() { $data = array(); $header = array(); $condArray = array('is_deleted'=>'0'); if($_GET['search_for']!='' && $_GET['search_value']!=''){ $condArray[$_GET['search_for']] = $_GET['search_value']; } if($_GET['discharge_status']!=''){ $condArray['discharge_status'] = $_GET['discharge_status']; } if($_GET['facility']!=''){ $condArray['facility'] = $_GET['facility']; } if($_GET['fromdate_filter']!='' && $_GET['todate_filter']!=''){ $betweenDate = array(); $betweenDate['from_date'] = $_GET['fromdate_filter']; $betweenDate['to_date'] = $_GET['todate_filter']; $recordsArray = $this->Common_Model->getCommonLikeQuery('tbl_pdms_ip_patient_info','*',$condArray, NULL, $betweenDate); } $data['recordsArray'] = $recordsArray; if($_GET['export']){ $this->downloadreport($data); } //$userDetails = $this->getPatientDetails(); //print_r($userDetails); die; $this->load->view('admin/_parts/header'); $this->load->view('admin/custompage/index',$data); $this->load->view('admin/_parts/footer'); setHistory('Go to Change Password'); } /* * Function : addrecord * Desc : For particular Record */ public function addrecord($id='') { // School Array $data = array(); $data['acategoryArray'] = $this->Common_Model->getCommonIdArray('tbl_asset_category'); $data['bumasterArray'] = $this->Common_Model->getCommonIdArray('tbl_bu_master'); $data['assetcArray'] = $this->Common_Model->getCommonIdArray('tbl_assetcategory_master'); $data['departmentArray'] = $this->Common_Model->getCommonIdArray('tbl_departments'); if($_POST){ $this->form_validation->set_rules('equipment_type','Equipment Type','required'); $this->form_validation->set_rules('department','Department','required'); $this->form_validation->set_rules('location','Location','required'); $this->form_validation->set_rules('manufacture','Manufacture','required'); $this->form_validation->set_rules('sno','SNo','required'); $this->form_validation->set_rules('asset_tag','Asset Tag','required'); $this->form_validation->set_rules('model','Model','required'); $this->form_validation->set_rules('waranty_expiry','Waranty Expiry','required'); $this->form_validation->set_rules('custodian','Custodian','required'); $this->form_validation->set_rules('last_pmdate','Last PM Date','required'); $this->form_validation->set_rules('status','Status','required'); if($this->form_validation->run()) { $equipment_type = $this->input->post('equipment_type'); $department = $this->input->post('department'); $location = $this->input->post('location'); $manufacture = $this->input->post('manufacture'); $sno = $this->input->post('sno'); $asset_tag = $this->input->post('asset_tag'); $model = $this->input->post('model'); $custodian = $this->input->post('custodian'); $last_pmdate = $this->input->post('last_pmdate'); $waranty_expiry = $this->input->post('waranty_expiry'); $category = $this->input->post('category'); $business_unit = $this->input->post('business_unit'); $floor = $this->input->post('floor'); $room_no = $this->input->post('room_no'); $custodian_emp_code = $this->input->post('custodian_emp_code'); $custodian_email_id = $this->input->post('custodian_email_id'); $status = $this->input->post('status'); $facility = $this->input->post('facility'); $data = array( 'category'=>$category, 'business_unit'=>$business_unit, 'floor'=>$floor, 'room_no'=>$room_no, 'custodian_emp_code'=>$custodian_emp_code, 'custodian_email_id'=>$custodian_email_id, 'equipment_type'=>$equipment_type, 'custodian'=>$custodian, 'last_pmdate'=>date('Y-m-d',strtotime($last_pmdate)), 'department'=>$department, 'location'=>$location, 'manufacture'=>$manufacture, 'sno'=>$sno, 'asset_tag'=>$asset_tag, 'waranty_expiry'=>$waranty_expiry, 'model'=>$model, 'custom_slug'=>str_replace(' ','-',strtolower($asset_tag)), 'status'=>$status, 'facility'=>$facility, 'is_deleted'=>'0', 'createdon'=>date('y-m-d H:i:s') ); $records = $this->Common_Model->getSingleRecord('tbl_custompage',' * ', array('asset_tag'=>$asset_tag)); if(!empty($records)){ $id = $records['id']; $this->Common_Model->updateinfo($tbl_name='tbl_custompage',$data,'id',$id); setHistory('Info Auto Updated successfully'); } else { if($this->input->post('id')){ $id = $this->input->post('id'); $this->Common_Model->updateinfo($tbl_name='tbl_custompage',$data,'id',$id); setHistory('Info Updated successfully'); } else { $this->Common_Model->saveinfo($tbl_name='tbl_custompage',$data); setHistory('Info Added successfully'); } } redirect('admin/custompage'); } else { $this->load->view('admin/custompage/addrecord'); setHistory('Error! Add/Edit Custom page'); } } else { $data['sd'] = $this->Common_Model->getSingleRecord('tbl_custompage',' * ', array('id'=>$id)); $this->load->view('admin/_parts/header'); $this->load->view('admin/custompage/addrecord',$data); $this->load->view('admin/_parts/footer'); if($id>0){ setHistory('Go to Edit custom page'); } else { setHistory('Go to Add custom page'); } } } /* * Function : deleterecord * Desc : For records deletion */ public function deleterecord($uid) { $this->Common_Model->deleterecords('tbl_pdms_ip_patient_info',$uid); $this->session->set_flashdata('success', 'Select IP data record deleted successfully.'); setHistory('Current IP record deleted successfully - '.$uid); redirect('admin/custompage'); } /* * Function : getuniquerandomkey */ public function getuniquerandomkey() { $leadscount = $leadscount = $this->Common_Model->getTotalNumRecords('tbl_pdms_ip_patient_info'); //count($this->Common_Model->getCommonQuery('tbl_pdms_ip_patient_info')); $leadCounts = $leadscount+1; $final_number = str_pad($leadCounts, 4, '0', STR_PAD_LEFT); return date('Ymd').'2'.$final_number; } /* * Function : downloadreport */ private function downloadreport($data) { //print_r($data); die; header("Content-Disposition: attachment; filename=IP-patient-report-".time().".csv"); $file = fopen('php://output', 'w'); $header = array("Sr. No.","Slag Id","IP Number", "Patient Name","Ward","Station","Bed Number","Department","Admission Date","Doctor Name","UHID","Contact Number","Pat Type","NOF","Discharge Date","Facility"); fputcsv($file, $header); $i=1; $recordsArray = $data['recordsArray']; foreach ($recordsArray as $row){ $slag_id = "'".$row['slag_id']; $contact_number = 'xxxxxxxxxx'; $data=array($i,$slag_id,$row['ip_number'],$row['patient_name'],$row['ward_detail'],$row['station'],$row['bed_number'],$row['department'],$row['billed_date'],$row['doctor_name'],$row['UHID'],$contact_number,$row['pat_type'],$row['feedback_count'],$row['discharge_date'],$row['facility']); fputcsv($file,$data); $i++; } fclose($file); exit; } /* * function : bulkupload */ /* * function : bulkupload */ public function bulkupload() { $data = array(); $head = array(); $uid = $this->session->userdata('adid'); if(isset($_POST["submit"])) { $file = $_FILES['program_file']['tmp_name']; $handle = fopen($file, "r"); $c = 0; $i=0; $k=0; while(($filesop = fgetcsv($handle, 1000, ",")) !== false) { $PatientName = $filesop[0]; $Billed_Date = $filesop[1]; $department = $filesop[2]; $Doctor_Name = $filesop[3]; $UHID = $filesop[4]; $IP_NO = $filesop[5]; $Contact_Number = $filesop[6]; $Pat_Type = $filesop[7]; $Ward_Detail = $filesop[8]; $station = $filesop[9]; $Bed_Number = $filesop[10]; $discharge_date = $filesop[11]; $facility = $filesop[12]; $discharge_status = '0'; $user_id = $uid->id; // Get All details if($c<>0){ $NewBilled_Date = ''; $Billed_Date = str_replace(array('/'),'-',$Billed_Date); if(strtotime($Billed_Date)>0){ $NewBilled_Date = date('Y-m-d H:i:s',strtotime($Billed_Date)); } //$ddateArray = explode('-',$Billed_Date); //$nDateBilling = $ddateArray[2].'-'.$ddateArray[1].'-'.$ddateArray[0].' '.$ddateArray[3]; $due = 0; $dischargeDate = ''; $discharge_date = str_replace('/','-',$discharge_date); if(strtotime($discharge_date)>0){ $discharge_status = '1'; $dischargeDate = date('Y-m-d H:i:s',strtotime($discharge_date)); } /* SKIP THE FIRST ROW */ // Get Course Details $singleRow = $this->Common_Model->getSingleRecord('tbl_pdms_ip_patient_info','id', array( 'is_deleted'=>'0','UHID'=>$UHID,'ip_number'=>$IP_NO)); if($singleRow['id']>0) { $postArray = array(); $postArray['station'] = $station; $postArray['ip_number'] = $IP_NO; $postArray['department'] = $department; $postArray['patient_name'] = $PatientName; if($NewBilled_Date){ $postArray['billed_date'] = $NewBilled_Date; } if($dischargeDate){ $postArray['discharge_date'] = $dischargeDate; } $postArray['doctor_name'] = $Doctor_Name; $postArray['UHID'] = $UHID; $postArray['ward_detail'] = $Ward_Detail; $postArray['bed_number'] = $Bed_Number; $postArray['contact_number'] = $Contact_Number; $postArray['pat_type'] = $Pat_Type; $postArray['user_id'] = $user_id; $postArray['discharge_status'] = $discharge_status; $postArray['facility'] = $facility; $postArray['modifiedon'] = date('Y-m-d H:i:s'); $id = $singleRow['id']; // Set All records //print_r($postArray); die; $this->Common_Model->updateinfo('tbl_pdms_ip_patient_info',$postArray,'id',$id); $i++; } else { $postArray = array(); $postArray['slag_id'] = $this->getuniquerandomkey(); $postArray['station'] = $station; $postArray['ip_number'] = $IP_NO; $postArray['department'] = $department; $postArray['patient_name'] = $PatientName; if($NewBilled_Date){ $postArray['billed_date'] = $NewBilled_Date; } $postArray['doctor_name'] = $Doctor_Name; $postArray['UHID'] = $UHID; $postArray['ward_detail'] = $Ward_Detail; $postArray['bed_number'] = $Bed_Number; $postArray['contact_number'] = $Contact_Number; $postArray['pat_type'] = $Pat_Type; $postArray['user_id'] = $user_id; $postArray['discharge_status'] = $discharge_status; $postArray['facility'] = $facility; if($dischargeDate){ $postArray['discharge_date'] = $dischargeDate; } $postArray['createdon'] = date('Y-m-d H:i:s'); //print_r($postArray); die; // Save All records $this->Common_Model->saveinfo('tbl_pdms_ip_patient_info',$postArray); //die; $k++; } } $c = $c + 1; } $msg = "$k Records Added & $i Total Records Updated Successfully"; $this->session->set_flashdata('success', '<span class="alert alert-success">'.$msg.'</span>'); redirect('admin/custompage'); } } /* * Function : getPatientDetails * */ public function getPatientDetails($mob = '9899939019', $RegistrationNo='23052520001' ) { $post = ["FacilityCode"=> '2',"MobileNo"=>"$mob","RegistrationNo"=>$RegistrationNo,"EmailId"=>"","DOB"=>"","PatientName"=>"","NationalityId"=> 0,"UnRegAppointment"=> 0]; //print_r($post); die; $response = phpcurlpostdataapi('GetPatientList', json_encode($post)); return $response; } }