diff --git a/application/controllers/Admin.php b/application/controllers/Admin.php index 52ec8da6..3caf9cf1 100755 --- a/application/controllers/Admin.php +++ b/application/controllers/Admin.php @@ -286,11 +286,12 @@ class Admin extends CI_Controller $email = $this->input->post('email'); $phone = $this->input->post('contact'); $provider_class_id = $this->input->post('provider_class_id'); + $network_agent_id = $this->input->post('network_agent_id'); $id = $this->user_model->getIdAgentByMemberCode($code,$cat); if($id!=false){ - $update_info = $this->user_model->updateGeolocatedUser($id,$adresse,$lastname,$email,$provider_class_id); + $update_info = $this->user_model->updateGeolocatedUser($id,$adresse,$lastname,$email,$network_agent_id,$provider_class_id); if($update_info){ $res = $this->user_model->updatePhoneAgent($id,$phone); if($res){ diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index 634e59c9..a4b458ad 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -410,13 +410,23 @@ class Hyperviseur_dash extends CI_Controller $this->load->view('header_hyp', $data); $this->load->view('nano_health/hyper/infos_insurance'); - }else{ + }else if($history == 'insurance-subscriptions'){ $data['insurance_subscription_id'] = $this->input->get('id'); $data['subscription'] = $this->nano_health_model->getInfosInsuranceSubscriptionById($this->input->get('id')); $data['beneficiaries'] = $this->nano_health_model->getSubscriptionBeneficiaries($data['subscription']->id ?? null); $data['user'] = $this->db->get_where('user_infos',['user_id' => $data['subscription']->user_id ?? null])->first_row(); $this->load->view('header_hyp', $data); $this->load->view('nano_health/hyper/infos_insurance_subscription'); + }else if($history == 'insurance-health_care_sheets'){ + $data['active'] = "wallet_health_care_sheets"; + $data['health_care_sheet_id'] = $this->input->get('id'); + $data['health_care_sheet'] = $this->nano_health_model->getInfosHealthCareSheetById($this->input->get('id')); + $data['performances'] = $this->nano_health_model->getHealthCareSheetPerformances($data['health_care_sheet']->id ?? null); + $data['exams'] = $this->nano_health_model->getHealthCareSheetExams($data['health_care_sheet']->id ?? null); + $data['prescriptions'] = $this->nano_health_model->getHealthCareSheetPrescriptions($data['health_care_sheet']->id ?? null); + + $this->load->view('header_hyp', $data); + $this->load->view('nano_health/hyper/infos_health_care_sheet'); } $this->load->view('footer'); return; @@ -567,8 +577,8 @@ class Hyperviseur_dash extends CI_Controller $data['refunds'] = $this->wallet_model->getRefunds($startDate, $endDate, $network_id); else if ($type == 'commission_payments') $data['payments'] = $this->wallet_model->getCommissionPayments($startDate, $endDate, $network_id); - else if ($type == 'insurance-subscriptions' || $type == 'insurance-insured'){ - + else if (strpos($type, 'insurance') !== false){ + /// Historique de l'assurance } else{ $data['transactions'] = $this->wallet_model->getRecharges($startDate, $endDate, $network_id); @@ -588,8 +598,9 @@ class Hyperviseur_dash extends CI_Controller $data['id_network'] = $network_id; $data['parrain_id'] = $parrainId; - if($type == 'insurance-insured'){ - $data['active'] = "wallet_insured"; + if(strpos($type, 'insurance') !== false){ + $array = explode('-',$type); + $data['active'] = "wallet_".$array[1]; } $this->load->view('header_hyp', $data); @@ -611,6 +622,8 @@ class Hyperviseur_dash extends CI_Controller $this->load->view('nano_health/hyper/insurances_subscriptions.php'); else if ($type == 'insurance-insured') $this->load->view('nano_health/hyper/insurances_insured.php'); + else if ($type == 'insurance-health_care_sheets') + $this->load->view('nano_health/hyper/insurances_health_care_sheets.php'); else $this->load->view('historique_recharges'); $this->load->view('footer'); diff --git a/application/controllers/pagination/GeolocatedUsers.php b/application/controllers/pagination/GeolocatedUsers.php index 6ea1dc81..053a5417 100755 --- a/application/controllers/pagination/GeolocatedUsers.php +++ b/application/controllers/pagination/GeolocatedUsers.php @@ -41,7 +41,7 @@ class GeolocatedUsers extends CI_Controller // } if ($this->session->userdata("category") == "0" or $this->session->userdata("category") == "hyper") - array_push($data, ""); diff --git a/application/controllers/pagination/HealthCareSheets.php b/application/controllers/pagination/HealthCareSheets.php new file mode 100755 index 00000000..5a012f22 --- /dev/null +++ b/application/controllers/pagination/HealthCareSheets.php @@ -0,0 +1,48 @@ +load->model('pagination/HealthCareSheets_model', 'model'); + } + + + function getLists() + { + $data = $row = array(); + + // Fetch member's records + $witData = $this->model->getRows($_POST); + + $i = $_POST['start']; + $current_url = $_POST['currentURL']; + foreach ($witData as $row) { + $data[] = array($row->health_care_sheet_id , $row->type , $row->insured_id , $row->patient_lastname.' '.$row->patient_firstname, $this->lang->line($row->patient_situation), + $row->institution_name, $row->practitioner_lastname.' '.$row->practitioner_firstname, $this->lang->line($row->care_condition), $this->lang->line($row->state), $row->created_at, + ' '.$this->lang->line('Voir plus...').''); + } + + $output = array( + "draw" => $_POST['draw'], + "recordsTotal" => $this->model->countAll($_POST), + "recordsFiltered" => $this->model->countFiltered($_POST), + "data" => $data, + ); + + // Output to JSON format + echo json_encode($output); + } + +} diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index 1103ec28..7f8b0b23 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -781,4 +781,39 @@ $lang['SOLUTION'] = "Solution"; $lang['SUPPOSITORY'] = "Suppository"; $lang['DEVICE'] = "Apparatus"; $lang['provider_class'] = "Provider class"; +$lang['health_care_sheets'] = "Care sheets"; +$lang['manage_health_care_sheets'] = "Manage care sheets"; +$lang['export_health_care_sheets_list'] = "Export the list of care sheets"; +$lang['health_care_sheet_id'] = "Health care sheet ID"; +$lang['patient_lastname'] = "Patient name"; +$lang['patient_firstname'] = "Patient's first name"; +$lang['patient_situation'] = "Patient's situation"; +$lang['HAVING_RIGHT'] = "HAVING RIGHT"; +$lang['INSURED'] = "INSURED"; +$lang['institution_name'] = "Name of the institution"; +$lang['institution_code'] = "Institution's approval code"; +$lang['practitioner_lastname'] = "Name of practitioner"; +$lang['practitioner_firstname'] = "First name of practitioner"; +$lang['practitioner_provider_class'] = "Practitioner's provider class"; +$lang['care_condition'] = "Care condition"; +$lang['CURRENT_AFFECTION'] = "CURRENT AFFECTION"; +$lang['LONG_TERM_AFFECTION'] = "LONG TERM AFFECTION"; +$lang['EXONERATION'] = "EXONERATION"; +$lang['health_care_sheet_infos'] = "Health care sheet information"; +$lang['practitioner'] = "Practitioner"; +$lang['accident_date'] = "Date of accident"; +$lang['pregnancy_start_at'] = "Date of start of pregnancy"; +$lang['pregnancy_end_at'] = "Date of end of pregnancy"; +$lang['performances'] = "Prescriptions"; +$lang['moderator_ticket'] = "Ticket modérateur"; +$lang['home_visit_fees'] = "Home visit expenses"; +$lang['act'] = "Act"; +$lang['act_code'] = "Act code"; +$lang['exams'] = "Exams"; +$lang['exam_description'] = "Exam description"; +$lang['exam_class'] = "Exam class"; +$lang['quantity'] = "Quantity"; +$lang['medical_prescriptions'] = "Medical prescriptions"; +$lang['dosage'] = "Dosage"; +$lang['drugs_or_device'] = "Drug / Device" ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 0ca02f65..8a757e30 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -792,4 +792,39 @@ $lang['SOLUTION'] = "Solution"; $lang['SUPPOSITORY'] = "Suppositoire"; $lang['DEVICE'] = "Appareillage"; $lang['provider_class'] = "Classe de prestataire"; +$lang['health_care_sheets'] = "Feuilles de soins"; +$lang['manage_health_care_sheets'] = "Gestion des feuilles de soins"; +$lang['export_health_care_sheets_list'] = "Exporter la liste des feuilles de soins"; +$lang['health_care_sheet_id'] = "ID de la feuille de soins"; +$lang['patient_lastname'] = "Nom du patient"; +$lang['patient_firstname'] = "Prenom du patient"; +$lang['patient_situation'] = "Situation du patient"; +$lang['HAVING_RIGHT'] = "AYANT DROIT"; +$lang['INSURED'] = "ASSURÉ"; +$lang['institution_name'] = "Nom de l'etablissement"; +$lang['institution_code'] = "Code agrément de l'etablissement"; +$lang['practitioner_lastname'] = "Nom du praticien"; +$lang['practitioner_firstname'] = "Prenom du praticien"; +$lang['practitioner_provider_class'] = "Classe de prestataire du praticien"; +$lang['care_condition'] = "Condition de prise en charge"; +$lang['CURRENT_AFFECTION'] = "AFFECTION COURANTE"; +$lang['LONG_TERM_AFFECTION'] = "AFFECTION LONGUE DURÉE"; +$lang['EXONERATION'] = "EXONERATION"; +$lang['health_care_sheet_infos'] = "Informations sur la feuille de soins"; +$lang['practitioner'] = "Praticien"; +$lang['accident_date'] = "Date de l'accident"; +$lang['pregnancy_start_at'] = "Date de debut de la grossesse"; +$lang['pregnancy_end_at'] = "Date de fin de la grossesse"; +$lang['performances'] = "Prescriptions"; +$lang['moderator_ticket'] = "Ticket modérateur"; +$lang['home_visit_fees'] = "Frais de déplacement à domicile"; +$lang['act'] = "Acte"; +$lang['act_code'] = "Code de l'acte"; +$lang['exams'] = "Examens"; +$lang['exam_description'] = "Description de l'examen"; +$lang['exam_class'] = "Classe de l'examen"; +$lang['quantity'] = "Quantité"; +$lang['medical_prescriptions'] = "Prescriptions médicales"; +$lang['dosage'] = "Posologie"; +$lang['drugs_or_device'] = "Médicament / Appareillage" ?> diff --git a/application/models/Nano_health_model.php b/application/models/Nano_health_model.php index 8defd436..6d4fd15e 100644 --- a/application/models/Nano_health_model.php +++ b/application/models/Nano_health_model.php @@ -76,4 +76,29 @@ class Nano_health_model extends CI_Model ->from('nh_having_rights b')->join('nh_insurances_having_rights i', 'b.id = i.having_right_id') ->where('i.insurance_id',$insuranceId)->order_by('i.created_at','asc')->get(); } + + public function getInfosHealthCareSheetById($healthCareSheetId){ + return $this->db->get_where('nh_infos_health_care_sheets',['health_care_sheet_id'=> $healthCareSheetId])->first_row(); + } + + public function getHealthCareSheetPerformances($healthCareSheetId){ + return $this->db->select('p.* , a.code as act_code , a.name as act_name') + ->from('nh_performances p')->join('nh_health_care_sheets_performances sp', 'p.id = sp.performance_id') + ->join('nh_acts a', 'a.id = p.act_id') + ->where('sp.sheet_id',$healthCareSheetId)->order_by('sp.created_at','asc')->get(); + } + + public function getHealthCareSheetExams($healthCareSheetId){ + return $this->db->select('e.* , a.code as act_code , a.name as act_name') + ->from('nh_exams e')->join('nh_health_care_sheets_exams se', 'e.id = se.exam_id') + ->join('nh_acts a', 'a.id = e.act_id') + ->where('se.sheet_id',$healthCareSheetId)->order_by('se.created_at','asc')->get(); + } + + public function getHealthCareSheetPrescriptions($healthCareSheetId){ + return $this->db->select('p.* , d.code as drug_or_device_code , d.name as drug_or_device_name') + ->from('nh_medical_prescriptions p')->join('nh_health_care_sheets_prescriptions sp', 'p.id = sp.prescription_id') + ->join('nh_drugs_and_devices d', 'd.id = p.drug_or_device_id') + ->where('sp.sheet_id',$healthCareSheetId)->order_by('sp.created_at','asc')->get(); + } } diff --git a/application/models/User_model.php b/application/models/User_model.php index c1156935..081edb18 100755 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -1168,8 +1168,14 @@ class User_model extends CI_Model } } - public function updateGeolocatedUser($id,$adresse,$lastname,$email, $providerClassId = null){ - $query = $this->db->query("UPDATE agents SET firstname='".$adresse."',lastname='".$lastname."',email='".$email."', nh_provider_class_id = $providerClassId WHERE id ='".$id."'"); + public function updateGeolocatedUser($id,$adresse,$lastname,$email, $network_agent_id = null , $providerClassId = null){ + // Update Provider class + if(isset($providerClassId) && isset($network_agent_id)){ + $this->db->where('id', $network_agent_id); + $this->db->update('networks_agents', ['nh_provider_class_id' => $providerClassId]); + } + // Update agents infos + $query = $this->db->query("UPDATE agents SET firstname='".$adresse."',lastname='".$lastname."',email='".$email."' WHERE id ='".$id."'"); return $query; } public function updatePhoneAgent($id,$phone){ diff --git a/application/models/pagination/HealthCareSheets_model.php b/application/models/pagination/HealthCareSheets_model.php new file mode 100644 index 00000000..a2310376 --- /dev/null +++ b/application/models/pagination/HealthCareSheets_model.php @@ -0,0 +1,99 @@ +table = 'nh_infos_health_care_sheets'; + // Set orderable column fields + $this->column_order = array('health_care_sheet_id','type','insured_id', 'patient_lastname', 'patient_situation', 'institution_name', 'practitioner_lastname', 'care_condition', + 'state','created_at', null); + // Set searchable column fields + $this->column_search = array('health_care_sheet_id','type','insured_id', 'patient_lastname', 'patient_situation', 'institution_name', 'practitioner_lastname', 'care_condition', + 'state', 'created_at'); + // Set default order + $this->order = array('created_at' => 'desc'); + } + + /* + * Fetch members data from the database + * @param $_POST filter data based on the posted parameters + */ + public function getRows($postData) + { + $this->_get_datatables_query($postData); + if ($postData['length'] != -1) { + $this->db->limit($postData['length'], $postData['start']); + } + $query = $this->db->get(); + return $query->result(); + } + + /* + * Count all records + */ + public function countAll($postData) + { + $this->db->from($this->table); + $this->db->where('network_id', $postData['id_network']); + return $this->db->count_all_results(); + } + + /* + * Count records based on the filter params + * @param $_POST filter data based on the posted parameters + */ + public function countFiltered($postData) + { + $this->_get_datatables_query($postData); + $query = $this->db->get(); + return $query->num_rows(); + } + + /* + * Perform the SQL queries needed for an server-side processing requested + * @param $_POST filter data based on the posted parameters + */ + private function _get_datatables_query($postData) + { + + $this->db->from($this->table); + $this->db->where('network_id', $postData['id_network']); + if (strlen($postData['startDate']) > 0 && strlen($postData['endDate']) > 0) { + $this->db->where('created_at >=', date('Y-m-d', strtotime($postData['startDate']))); + $this->db->where('created_at <', date('Y-m-d', strtotime($postData['endDate']. "+1 day"))); + } + + $i = 0; + // loop searchable columns + foreach ($this->column_search as $item) { + // if datatable send POST for search + if ($postData['search']['value']) { + // first loop + if ($i === 0) { + // open bracket + $this->db->group_start(); + $this->db->like($item, $postData['search']['value']); + } else { + $this->db->or_like($item, $postData['search']['value']); + } + + // last loop + if (count($this->column_search) - 1 == $i) { + // close bracket + $this->db->group_end(); + } + } + $i++; + } + + if (isset($postData['order'])) { + $this->db->order_by($this->column_order[$postData['order']['0']['column']], $postData['order']['0']['dir']); + } else if (isset($this->order)) { + $order = $this->order; + $this->db->order_by(key($order), $order[key($order)]); + } + } +} diff --git a/application/views/header_hyp.php b/application/views/header_hyp.php index 7f682874..dfadcc40 100755 --- a/application/views/header_hyp.php +++ b/application/views/header_hyp.php @@ -215,6 +215,12 @@ lang->line('insured'); ?> +
  • "> + + + lang->line('health_care_sheets'); ?> + +
  • + + + + + + + +
    +
    + +

    + lang->line('health_care_sheets'). ' - ' . $health_care_sheet_id; ?> +

    + + db->hostname . ';dbname=' . $this->db->database, $this->db->username, $this->db->password); + + $configuration = new PDOProviderConfiguration(); + + $configuration->tableName = 'exchange_rate'; + $configuration->exchangeRateColumnName = 'exchange_rate'; + $configuration->targetCurrencyColumnName = 'target_currency'; + $configuration->sourceCurrencyCode = $baseCurrency; + + // this provider loads exchange rates from your database + $provider = new PDOProvider($pdo, $configuration); + + // this provider calculates exchange rates relative to the base currency + $provider = new BaseCurrencyProvider($provider, $baseCurrency); + + // this currency converter can now handle any currency pair + $this->converter = new CurrencyConverter($provider); + $this->context = new AutoContext(); + $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); + ?> +
    + +
    +
    +
    +

    lang->line('health_care_sheet_infos')?>

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Patient
    lang->line('insured_id'); ?>insured_id ?>
    lang->line('patient_lastname'); ?>patient_lastname ; ?>
    lang->line('patient_firstname')?>patient_firstname ?>
    lang->line('patient_situation')?>lang->line($health_care_sheet->patient_situation) ?>
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + accident_date)){ ?> + + + + + + pregnancy_start_at)){ ?> + + + + + + + + + + + +
    lang->line('practitioner') ?>
    lang->line('institution_name'); ?>institution_name ?>
    lang->line('institution_code'); ?>institution_code ?>
    lang->line('practitioner_lastname'); ?>practitioner_lastname ; ?>
    lang->line('practitioner_firstname')?>practitioner_firstname ?>
    Classificationpractitioner_provider_class ?>
    lang->line('care_condition')?>lang->line($health_care_sheet->care_condition) ?>
    lang->line('accident_date'); ?>
    lang->line('pregnancy_start_at'); ?>
    lang->line('pregnancy_end_at'); ?>
    +
    +
    +
    + +
    +
    +
    +
    +

    type?>

    +

    Type

    +
    +
    + +
    +
    +
    + +
    +
    +
    +

    lang->line($health_care_sheet->state)?>

    +

    lang->line('Statut') ?>

    +
    +
    + +
    +
    +
    + +
    + +
    +
    +

    lang->line('performances') ?>

    +
    +
    + + + + + + + + + + + + + + result() as $i => $row) { + $amount = Money::of(round($row->amount, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR'); + $moderator_ticket = Money::of(round($row->moderator_ticket, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR'); + $insurance_amount = Money::of(round($row->insurance_amount, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR'); + $home_visit_fees = isset($row->home_visit_fees) ? Money::of(round($row->home_visit_fees, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR') : ''; + + echo " + + + + + + + "; + ?> + + + +
    #lang->line('act_code'); ?>lang->line('Montant'); ?>lang->line('moderator_ticket'); ?>lang->line('insurance_amount'); ?>lang->line('home_visit_fees'); ?>Date
    " . ($i+1) . "" . $row->act_code . "" . $amount . "" . $moderator_ticket . "" . $insurance_amount . "".$home_visit_fees."" . $row->created_at. "
    +
    +
    + +
    +
    +

    lang->line('exams') ?>

    +
    +
    + + + + + + + + + + + result() as $i => $row) { +// $amount = Money::of(round($row->amount, 2), $insurance->currency_code, $this->context)->formatTo('fr_FR'); + + echo " + + + + " + ?> + + + +
    #lang->line('exam_class'); ?>lang->line('exam_description'); ?>lang->line('quantity'); ?>
    " . ($i+1) . "" . $row->act_name . "" . $row->description . "" . $row->quantity. "
    +
    +
    + +
    +
    +

    lang->line('medical_prescriptions') ?>

    +
    +
    + + + + + + + + + + + result() as $i => $row) { +// $amount = Money::of(round($row->amount, 2), $insurance->currency_code, $this->context)->formatTo('fr_FR'); + + echo " + + + + " + ?> + + + +
    #lang->line('drugs_or_device'); ?>lang->line('dosage'); ?>lang->line('quantity'); ?>
    " . ($i+1) . "" . $row->drug_or_device_name . "" . $row->dosage . "" . $row->quantity. "
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/views/nano_health/hyper/insurances_health_care_sheets.php b/application/views/nano_health/hyper/insurances_health_care_sheets.php new file mode 100755 index 00000000..9099c792 --- /dev/null +++ b/application/views/nano_health/hyper/insurances_health_care_sheets.php @@ -0,0 +1,206 @@ + + + + + +
    + + +
    +

    + lang->line('manage_health_care_sheets') ?> + + +

    +
    +
    +
    +
    +
    + +
    + lang->line('Période') ?> + + + + + Format : session->userdata('site_lang') === 'french' ? 'Jour - Mois - Année ' : 'Year - Month - Day' ?> +
    +
    +
    + + +
    +
    +
    +
    +
    +

    lang->line('export_health_care_sheets_list') ?>

    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + +
    lang->line('health_care_sheet_id') ?>Typelang->line('insured_id') ?>lang->line('patient_lastname') ?>lang->line('patient_situation') ?>lang->line('institution_name') ?>lang->line('practitioner_lastname') ?>lang->line('care_condition') ?>lang->line('state') ?>DateAction
    +
    +
    +
    +
    +
    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/views/nano_health/hyper/listeadmin.php b/application/views/nano_health/hyper/listeadmin.php index ea1ed84c..7d0b2249 100755 --- a/application/views/nano_health/hyper/listeadmin.php +++ b/application/views/nano_health/hyper/listeadmin.php @@ -312,6 +312,7 @@