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 @@
-