diff --git a/application/controllers/Agent.php b/application/controllers/Agent.php index e08dfcb2..dd9fb97d 100755 --- a/application/controllers/Agent.php +++ b/application/controllers/Agent.php @@ -30,6 +30,7 @@ class Agent extends CI_Controller $data['network_agent_id'] = $this->session->userdata('network_agent_id'); $data['network_id'] = $data['id_network'] = $this->session->userdata('network_id'); $data['hasWallet'] = $this->wallet_model->getConfigWallet($data['network_id']); + $data['show_health_care_sheet_buttons'] = true; if ($this->input->get('history')) { if($this->input->get('id') !== null){ @@ -52,6 +53,7 @@ class Agent extends CI_Controller } }else if($this->input->get('action')) { + $action = $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 ; @@ -60,7 +62,11 @@ class Agent extends CI_Controller $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'); + if($action == 'new_consultation'){ + $this->load->view('nano_health/agent/health_care_sheet_consultation_form'); + } else { + $this->load->view('nano_health/agent/health_care_sheet_execution_form'); + } $this->load->view('footer'); }else{ $startDate = $this->input->get('d'); diff --git a/application/controllers/NanoHealthController.php b/application/controllers/NanoHealthController.php index 977d7f2d..445b0b8f 100644 --- a/application/controllers/NanoHealthController.php +++ b/application/controllers/NanoHealthController.php @@ -344,11 +344,11 @@ class NanoHealthController extends CI_Controller } } - public function saveHealthCareSheetConsultation() + public function saveHealthCareSheet($type = 'consultation') { if($this->isLogged()) { if (isset($_POST)) { - $url = NANO_SANTE_SERVICE_URL.'/health-care-sheets/consultation'; + $url = NANO_SANTE_SERVICE_URL.'/health-care-sheets/'.$type; $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); /* set the content type json */ @@ -379,6 +379,73 @@ class NanoHealthController extends CI_Controller } } + public function calculateHealthCareSheetPerformancesAmount() + { + if($this->isLogged()) { + if (isset($_POST)) { + $url = NANO_SANTE_SERVICE_URL.'/health-care-sheets/performances-amount'; + $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]); + } + } + } + } + + public function getHealthCareSheets() + { + if($this->isLogged()) { + if (isset($_POST)) { + $url = NANO_SANTE_SERVICE_URL.'/health-care-sheets'; + + $data = http_build_query($_POST); +// $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]); + } + } + } + } private function isLogged() { diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index c2b1a6e3..e09b3500 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -829,4 +829,10 @@ $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"; +$lang['new_consultation'] = "Enter a consultation" ; +$lang['accident'] = "Accident" ; +$lang['pregnancy'] = "Pregnancy care" ; +$lang['consultation_entered'] = "Consultation entered" ; +$lang['new_execution'] = "Execute a prescription" ; +$lang['execution_entered'] = "Execution entered" ; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 39e718fc..98e70b5a 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -839,5 +839,11 @@ $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é" +$lang['one_insured'] = "Assuré"; +$lang['new_consultation'] = "Saisir une consultation"; +$lang['accident'] = "Accident"; +$lang['pregnancy'] = "Soins grossesse"; +$lang['consultation_entered'] = "Consultation saisie"; +$lang['new_execution'] = "Executer une prescription"; +$lang['execution_entered'] = "Execution saisie"; ?> diff --git a/application/views/header_agent.php b/application/views/header_agent.php index 794d9bdb..e71103f3 100755 --- a/application/views/header_agent.php +++ b/application/views/header_agent.php @@ -4,7 +4,7 @@ - iLink | Superviseur + iLink | Agent diff --git a/application/views/nano_health/agent/health_care_sheet_form.php b/application/views/nano_health/agent/health_care_sheet_consultation_form.php similarity index 87% rename from application/views/nano_health/agent/health_care_sheet_form.php rename to application/views/nano_health/agent/health_care_sheet_consultation_form.php index edfd0c76..b5cffba2 100755 --- a/application/views/nano_health/agent/health_care_sheet_form.php +++ b/application/views/nano_health/agent/health_care_sheet_consultation_form.php @@ -23,7 +23,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);

- lang->line('new_care_sheet') ?> + lang->line('new_consultation') ?>

@@ -64,6 +64,41 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); + +
+
+
+ + +
+
+
+
+ + +
+
+
+ +
+ + +
+ +
+
+
+ + +
+
+
+
+ + +
+
+
@@ -284,6 +319,25 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); $(document).ready(function (){ $('#patient').hide(); $('#patient-details').hide(); + $('#accident-div').hide(); + $('#pregnancy-div').hide(); + + $('#accident-checkbox').change(function() { + if($(this).is(":checked")) { + $('#accident-div').show(); + }else{ + $('#accident-div').hide(); + } + }); + + $('#pregnancy-checkbox').change(function() { + if($(this).is(":checked")) { + $('#pregnancy-div').show(); + }else{ + $('#pregnancy-div').hide(); + } + }); + // Get The Data const insured = JSON.parse(sessionStorage.getItem('insured')); if(insured && Array.isArray(insured)){ @@ -397,9 +451,17 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); }); indexed_array.beneficiary_id = parseInt(indexed_array.beneficiary_id) === 0 ? null : indexed_array.beneficiary_id; + if (!$('#accident-checkbox').prop('checked')) { + indexed_array.accident_date = null; + } + + if (!$('#pregnancy-checkbox').prop('checked')) { + indexed_array.pregnancy_start_at = null; + indexed_array.pregnancy_end_at = null; + } $.ajax({ - url: '', + url: '', type: 'POST', dataType: 'json', data: { @@ -410,7 +472,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); if(data.status === 200){ Swal.fire({ icon: 'success', - title: "lang->line('drug_and_device_updated')?>", + title: "lang->line('consultation_entered')?>", text:"lang->line('informations_updated')?>", timer: 3000 }).then(()=>{ @@ -441,6 +503,39 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); return actsOptions; } + + function calculatePrestationsAmount(){ + $('#amount').on('input', function () { + var amount = parseFloat($(this).val()); + var care_condition = $('#sheet-form').find('select[name="care_condition"]').val(); + if(isNaN(amount)){ + $('#moderator-ticket').val(''); + $('#insurance-amount').val(''); + }else{ + $.ajax({ + url: '', + type: 'POST', + dataType: 'json', + data: { + "network_id" : "", "amount": amount, "care_condition": care_condition + }, + success: function (data) { + if(data.status === 200){ + $('#moderator-ticket').val(data.response.moderator_ticket); + $('#insurance-amount').val(data.response.insurance_amount); + }else{ + toastr.error(data.error , "lang->line('request_error')?>"); + } + }, + error: function (resultat, statut, error) { + console.log(resultat + " " + error); + toastr.error("lang->line('error_message')?>", "lang->line('request_error')?>"); + } + }); + } + + }) + } $('[data-toggle="tooltip"]').tooltip(); @@ -460,15 +555,18 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); getActsOptions(null)+ '' + '' + - '' + - '' + - '' + + '' + + '' + + '' + '' + ' ' + actions1 + '' + ''; $("#prestations").append(row); $("#prestations tbody tr").eq(index + 1).find(".add, .edit").toggle(); $('[data-toggle="tooltip"]').tooltip(); + + calculatePrestationsAmount(); + }); // Add row on add button click $(document).on("click", ".add1", function () { @@ -504,16 +602,17 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); if (index == 0) $(this).html(''); if (index == 1) - $(this).html(''); + $(this).html(''); if (index == 2) - $(this).html(''); + $(this).html(''); if (index == 3) - $(this).html(''); + $(this).html(''); if (index == 4) $(this).html(''); }); $(this).parents("tr").find(".add, .edit").toggle(); $(".new1").attr("disabled", "disabled"); + calculatePrestationsAmount(); }); // Delete row on delete button click $(document).on("click", ".delete1", function () { diff --git a/application/views/nano_health/agent/health_care_sheet_execution_form.php b/application/views/nano_health/agent/health_care_sheet_execution_form.php new file mode 100755 index 00000000..4cd82d53 --- /dev/null +++ b/application/views/nano_health/agent/health_care_sheet_execution_form.php @@ -0,0 +1,493 @@ + + + + + + + + + + + +
+ +
+ +

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

+ +
+ +
+
+ +
+ +
+
+

Formulaire

+
+ + +
+
+
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+ +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ +
+
+
+
+ +
+
+
+ + + + + + + + + + + + +
lang->line('act_code'); ?> lang->line('Montant'); ?>lang->line('moderator_ticket'); ?>lang->line('insurance_amount'); ?>lang->line('home_visit_fees'); ?>
+
+
+
+
+
+ +
+
+
+ + + + + + + + + + + + +
lang->line('exam_class'); ?>lang->line('exam_description'); ?>lang->line('quantity'); ?>lang->line('UNIT_PRICE'); ?>Actions
+
+ +
+
+
+
+ +
+
+
+ + + + + + + + + + + + +
lang->line('drugs_or_device'); ?>lang->line('dosage'); ?>lang->line('quantity'); ?>lang->line('UNIT_PRICE'); ?>Actions
+
+ +
+ + +
+
+ + + +
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/views/nano_health/hyper/insurances_health_care_sheets.php b/application/views/nano_health/hyper/insurances_health_care_sheets.php index 6fa0584d..cde9beec 100755 --- a/application/views/nano_health/hyper/insurances_health_care_sheets.php +++ b/application/views/nano_health/hyper/insurances_health_care_sheets.php @@ -44,9 +44,14 @@

lang->line('export_health_care_sheets_list') ?>

- + + + +
@@ -73,14 +78,14 @@
-