diff --git a/application/controllers/Agent.php b/application/controllers/Agent.php index ba5f78d1..e08dfcb2 100755 --- a/application/controllers/Agent.php +++ b/application/controllers/Agent.php @@ -28,7 +28,8 @@ class Agent extends CI_Controller $data['network'] = $this->session->userdata('network'); $data['code_parrain'] = $this->session->userdata('parrain'); $data['network_agent_id'] = $this->session->userdata('network_agent_id'); - $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); + $data['network_id'] = $data['id_network'] = $this->session->userdata('network_id'); + $data['hasWallet'] = $this->wallet_model->getConfigWallet($data['network_id']); if ($this->input->get('history')) { if($this->input->get('id') !== null){ @@ -51,6 +52,13 @@ class Agent extends CI_Controller } }else if($this->input->get('action')) { + $nh_config = $this->nano_health_model->getConfig($data['network_id']); + $data['nh_config'] = $nh_config ? $nh_config->first_row() : null ; + $data['config_id'] = $data['nh_config'] ? $data['nh_config']->id : null ; + $data['acts'] = $this->nano_health_model->getConfigActs($data['config_id']); + $data['provider_classes'] = $this->nano_health_model->getProviderClasses($data['config_id']); + $data['drugs_and_devices'] = $this->nano_health_model->getDrugAndDevices($data['network_id']); + $this->load->view('header_agent', $data); $this->load->view('nano_health/agent/health_care_sheet_form'); $this->load->view('footer'); diff --git a/application/controllers/NanoHealthController.php b/application/controllers/NanoHealthController.php index ca71d4b8..977d7f2d 100644 --- a/application/controllers/NanoHealthController.php +++ b/application/controllers/NanoHealthController.php @@ -304,6 +304,81 @@ class NanoHealthController extends CI_Controller } } + public function getInsured() + { + if($this->isLogged()) { + if (isset($_POST)) { + $url = NANO_SANTE_SERVICE_URL.'/insured'; + $dataArray = [ + 'network_id' => $this->input->post('network_id'), + ]; + $query = $this->input->post('query'); + $option = $this->input->post('option'); + $dataArray[$option ?? 'name'] = $query; + + $data = http_build_query($dataArray); +// $getUrl = $url."?".$data; + $ch = curl_init($url."?".$data); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); + /* set the content type json */ + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + 'Content-Type:application/json', + 'Authorization:'.NANO_SANTE_SERVICE_TOKEN, + 'X-localization:'. $this->session->userdata('site_lang') == 'french' ? 'fr' : 'en' + )); + /* set return type json */ + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + + /* execute request */ + $result = curl_exec($ch); + /* close cURL resource */ + curl_close($ch); + + if ($result) { + echo $result; + } else { + echo json_encode(['status' => 500]); + } + } + } + } + + public function saveHealthCareSheetConsultation() + { + if($this->isLogged()) { + if (isset($_POST)) { + $url = NANO_SANTE_SERVICE_URL.'/health-care-sheets/consultation'; + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); + /* set the content type json */ + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + 'Content-Type:application/json', + 'Authorization:'.NANO_SANTE_SERVICE_TOKEN, + 'X-localization:'. $this->session->userdata('site_lang') == 'french' ? 'fr' : 'en' + )); + /* set return type json */ + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $body = new \stdClass(); + foreach ($_POST as $key => $value){ + $body->{$key} = $value; + } + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); + + /* execute request */ + $result = curl_exec($ch); + /* close cURL resource */ + curl_close($ch); + + if ($result) { + echo $result; + } else { + echo json_encode(['status' => 500]); + } + } + } + } + private function isLogged() { diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index acb6fe70..c2b1a6e3 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -822,4 +822,11 @@ $lang['insurance_part'] = "Insurance share"; $lang['insurance_part'] = "Insurance share"; $lang['consultation_id'] = "Consulation ID"; $lang['new_care_sheet'] = "Enter a care sheet"; +$lang['new_prestation'] = "New service"; +$lang['new_exam'] = "New exam"; +$lang['new_prescription'] = "New prescription"; +$lang['user_phone_number'] = "User phone number"; +$lang['insured_not_found'] = "This insured does not exist"; +$lang['finding_insured_by'] = "Finding the insured by:"; +$lang['one_insured'] = "Insured"; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 9d34b01c..39e718fc 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -833,4 +833,11 @@ $lang['insurance_part'] = "Part de l'assurance"; $lang['insurance_part'] = "Part de l'assurance"; $lang['consultation_id'] = "ID de la consultation"; $lang['new_care_sheet'] = "Saisir une feuille de soins"; +$lang['new_prestation'] = "Nouvelle prestation"; +$lang['new_exam'] = "Nouvel examen"; +$lang['new_prescription'] = "Nouvelle prescription"; +$lang['user_phone_number'] = "Numéro de téléphone de l'usager"; +$lang['insured_not_found'] = "Cet assuré n'existe pas"; +$lang['finding_insured_by'] = "Recherche de l'assuré par :"; +$lang['one_insured'] = "Assuré" ?> diff --git a/application/models/Nano_health_model.php b/application/models/Nano_health_model.php index 6d4fd15e..8e246fc2 100644 --- a/application/models/Nano_health_model.php +++ b/application/models/Nano_health_model.php @@ -101,4 +101,9 @@ class Nano_health_model extends CI_Model ->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(); } + + public function getDrugAndDevices($networkId) + { + return $this->db->get_where('nh_drugs_and_devices',['network_id'=> $networkId]); + } } diff --git a/application/views/nano_health/agent/health_care_sheet_form.php b/application/views/nano_health/agent/health_care_sheet_form.php index c2f735f6..edfd0c76 100755 --- a/application/views/nano_health/agent/health_care_sheet_form.php +++ b/application/views/nano_health/agent/health_care_sheet_form.php @@ -39,32 +39,65 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); -
+
+
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+ +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
-
- -
-
- - -
-
- - -
-
- - -
-
+ +
@@ -73,24 +106,26 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
- +
- - - + + + + + result() as $row) { + if (isset($plr_prestations)) { + foreach ($plr_prestations->result() as $row) { echo " @@ -107,7 +142,51 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
MinMaxlang->line('rate'); ?> (%)lang->line('act_code'); ?> lang->line('Montant'); ?>lang->line('moderator_ticket'); ?>lang->line('insurance_amount'); ?>lang->line('home_visit_fees'); ?> Actions
" . $row->min . " " . $row->max . "
-
+
+
+
+
+ +
+
+ +
+
+
+ + + + + + + + + + + result() as $row) { + echo " + + + " . ' + + '; + } + } + ?> + +
lang->line('exam_class'); ?>lang->line('exam_description'); ?>lang->line('quantity'); ?>Actions
" . $row->min . "" . $row->max . "" . $row->taux . " + + + +
+
+ +
@@ -115,33 +194,33 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); class="col-form-label">lang->line('medical_prescriptions'); ?>
-
- +
- - - + + + result() as $row) { + if (isset($plr_prescriptions)) { + foreach ($plr_prescriptions->result() as $row) { echo "" . ' '; } @@ -150,48 +229,10 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
MinMaxlang->line('rate'); ?> (%)lang->line('drugs_or_device'); ?>lang->line('dosage'); ?>lang->line('quantity'); ?> Actions
" . $row->min . " " . $row->max . " " . $row->taux . " - - - + + +
-
-
-
-
- -
-
- -
-
-
- - - - - - - - - - - result() as $row) { - echo " - - - " . ' - - '; - } - } - ?> - -
MinMaxlang->line('rate'); ?> (%)Actions
" . $row->min . "" . $row->max . "" . $row->taux . " - - - -
+ +
+ +
@@ -240,80 +281,170 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); toastr.options.closeDuration = 5000; toastr.options.closeEasing = 'swing'; - $('#updateWallet').click(function () { - const network_id = $(this).data('network-id'); - const id_config = $(this).data('id-config'); - if ($('#walletForm')[0].checkValidity()) { - - // Paliers - var plr_user_wallet_wallet = []; - - var plr_user_wallet_wallet_national = []; - - $('#user_wallet_wallet tr').has('td').each(function () { - var arrayItem = {}; - $('td', $(this)).each(function (index, item) { - if (index < 3) - arrayItem[index] = parseFloat($(item).html()); - }); - plr_user_wallet_wallet.push(arrayItem); + $(document).ready(function (){ + $('#patient').hide(); + $('#patient-details').hide(); + // Get The Data + const insured = JSON.parse(sessionStorage.getItem('insured')); + if(insured && Array.isArray(insured)){ + var currentInsurance = null + // console.log('insured', insured) + // insured.each() + $.each(insured, function (i, item) { + $('#sheet-form').find('select[name="insured_id"]').append($('', { + label: 'Assuré principal', + })); + $('#sheet-form').find('select[name="beneficiary_id"]').append($('', { + label: 'Ayants droits', + })); + $.each(item.beneficiaries, function (j, it) { + $('#sheet-form').find('select[name="beneficiary_id"]').append($('
+ + + @@ -208,3 +242,38 @@ }); + +