Add Health Care Sheet execution view

This commit is contained in:
Djery-Tom 2021-12-16 16:07:30 +01:00
parent d1abfdf8a5
commit 7f40059f0e
4 changed files with 131 additions and 20 deletions

View File

@ -270,6 +270,40 @@ class NanoHealthController extends CI_Controller
} }
} }
public function resubmitHealthCareSheet(){
if($this->isLogged()) {
if (isset($_POST)) {
$url = NANO_SANTE_SERVICE_URL.'/health-care-sheets';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
/* 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();
$body->health_care_sheet_id = $this->input->post('health_care_sheet_id');
$body->user_id = $this->input->post('user_id');
$body->action = 'RESUBMIT';
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() private function isLogged()
{ {

View File

@ -815,5 +815,9 @@ $lang['exam_class'] = "Exam class";
$lang['quantity'] = "Quantity"; $lang['quantity'] = "Quantity";
$lang['medical_prescriptions'] = "Medical prescriptions"; $lang['medical_prescriptions'] = "Medical prescriptions";
$lang['dosage'] = "Dosage"; $lang['dosage'] = "Dosage";
$lang['drugs_or_device'] = "Drug / Device" $lang['drugs_or_device'] = "Drug / Device";
$lang['resubmit'] = "Resubmit";
$lang['subscription_resubmitted'] = "The subscription has been resubmitted";
$lang['insurance_part'] = "Insurance share";
$lang['insurance_part'] = "Insurance share";
?> ?>

View File

@ -815,7 +815,7 @@ $lang['practitioner'] = "Praticien";
$lang['accident_date'] = "Date de l'accident"; $lang['accident_date'] = "Date de l'accident";
$lang['pregnancy_start_at'] = "Date de debut de la grossesse"; $lang['pregnancy_start_at'] = "Date de debut de la grossesse";
$lang['pregnancy_end_at'] = "Date de fin de la grossesse"; $lang['pregnancy_end_at'] = "Date de fin de la grossesse";
$lang['performances'] = "Prescriptions"; $lang['performances'] = "Prestations";
$lang['moderator_ticket'] = "Ticket modérateur"; $lang['moderator_ticket'] = "Ticket modérateur";
$lang['home_visit_fees'] = "Frais de déplacement à domicile"; $lang['home_visit_fees'] = "Frais de déplacement à domicile";
$lang['act'] = "Acte"; $lang['act'] = "Acte";
@ -826,5 +826,9 @@ $lang['exam_class'] = "Classe de l'examen";
$lang['quantity'] = "Quantité"; $lang['quantity'] = "Quantité";
$lang['medical_prescriptions'] = "Prescriptions médicales"; $lang['medical_prescriptions'] = "Prescriptions médicales";
$lang['dosage'] = "Posologie"; $lang['dosage'] = "Posologie";
$lang['drugs_or_device'] = "Médicament / Appareillage" $lang['drugs_or_device'] = "Médicament / Appareillage";
$lang['resubmit'] = "Resoumettre";
$lang['subscription_resubmitted'] = "La souscription a été re-soumise";
$lang['insurance_part'] = "Part de l'assurance";
$lang['insurance_part'] = "Part de l'assurance";
?> ?>

View File

@ -15,6 +15,14 @@
<h1 style="margin-bottom: 20px"> <h1 style="margin-bottom: 20px">
<?= $this->lang->line('health_care_sheets'). ' - ' . $health_care_sheet_id; ?> <?= $this->lang->line('health_care_sheets'). ' - ' . $health_care_sheet_id; ?>
<div class="pull-right">
<?php if($health_care_sheet->state == 'REJECTED') { ?>
<button id="resubmit" class="btn btn-success" >
<?= $this->lang->line('resubmit') ?>
</button>
<?php } ?>
</div>
</h1> </h1>
<?php <?php
@ -224,6 +232,7 @@
</div> </div>
</div> </div>
<?php if (isset($exams) && $exams->num_rows() > 0 ) { ?>
<div class="box box-primary"> <div class="box box-primary">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title"><?= $this->lang->line('exams') ?></h3> <h3 class="box-title"><?= $this->lang->line('exams') ?></h3>
@ -236,30 +245,44 @@
<th><?= $this->lang->line('exam_class'); ?></th> <th><?= $this->lang->line('exam_class'); ?></th>
<th><?= $this->lang->line('exam_description'); ?></th> <th><?= $this->lang->line('exam_description'); ?></th>
<th><?= $this->lang->line('quantity'); ?></th> <th><?= $this->lang->line('quantity'); ?></th>
<?php if($health_care_sheet->type == 'EXECUTION') { ?>
<th><?= $this->lang->line('UNIT_PRICE'); ?></th>
<th><?= $this->lang->line('percentage_insurer'); ?></th>
<th><?= $this->lang->line('percentage_insured'); ?></th>
<?php } ?>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
if (isset($exams)) {
foreach ($exams->result() as $i => $row) { foreach ($exams->result() as $i => $row) {
// $amount = Money::of(round($row->amount, 2), $insurance->currency_code, $this->context)->formatTo('fr_FR'); if($health_care_sheet->type == 'EXECUTION') {
$unit_price = Money::of(round($row->unit_price, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR');
$insurance_part = Money::of(round($row->insurer_paid_amount, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR');
$insured_part = Money::of(round($row->insured_paid_amount, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR');
}
echo "<tr> echo "<tr>
<td>" . ($i+1) . "</td> <td>" . ($i+1) . "</td>
<td>" . $row->act_name . "</td> <td>" . $row->act_name . "</td>
<td>" . $row->description . "</td> <td>" . $row->description . "</td>
<td>" . $row->quantity. "</td>" <td>" . $row->quantity. "</td>";
if($health_care_sheet->type == 'EXECUTION') { ?>
<td><?= $unit_price ?></td>
<td><?= $insurance_part ?></td>
<td><?= $insured_part ?></td>
<?php }
?> ?>
</tr> </tr>
<?php <?php
} }
}
?> ?>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<?php } ?>
<?php if (isset($prescriptions) && $prescriptions->num_rows() > 0 ) { ?>
<div class="box box-primary"> <div class="box box-primary">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title"><?= $this->lang->line('medical_prescriptions') ?></h3> <h3 class="box-title"><?= $this->lang->line('medical_prescriptions') ?></h3>
@ -272,29 +295,42 @@
<th><?= $this->lang->line('drugs_or_device'); ?></th> <th><?= $this->lang->line('drugs_or_device'); ?></th>
<th><?= $this->lang->line('dosage'); ?></th> <th><?= $this->lang->line('dosage'); ?></th>
<th><?= $this->lang->line('quantity'); ?></th> <th><?= $this->lang->line('quantity'); ?></th>
<?php if($health_care_sheet->type == 'EXECUTION') { ?>
<th><?= $this->lang->line('UNIT_PRICE'); ?></th>
<th><?= $this->lang->line('percentage_insurer'); ?></th>
<th><?= $this->lang->line('percentage_insured'); ?></th>
<?php } ?>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
if (isset($prescriptions)) {
foreach ($prescriptions->result() as $i => $row) { foreach ($prescriptions->result() as $i => $row) {
if($health_care_sheet->type == 'EXECUTION') {
// $amount = Money::of(round($row->amount, 2), $insurance->currency_code, $this->context)->formatTo('fr_FR'); // $amount = Money::of(round($row->amount, 2), $insurance->currency_code, $this->context)->formatTo('fr_FR');
$unit_price = Money::of(round($row->unit_price, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR');
$insurance_part = Money::of(round($row->insurer_paid_amount, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR');
$insured_part = Money::of(round($row->insured_paid_amount, 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR');
}
echo "<tr> echo "<tr>
<td>" . ($i+1) . "</td> <td>" . ($i+1) . "</td>
<td>" . $row->drug_or_device_name . "</td> <td>" . $row->drug_or_device_name . "</td>
<td>" . $row->dosage . "</td> <td>" . $row->dosage . "</td>
<td>" . $row->quantity. "</td>" <td>" . $row->quantity. "</td>";
?> if($health_care_sheet->type == 'EXECUTION') { ?>
<td><?= $unit_price ?></td>
<td><?= $insurance_part ?></td>
<td><?= $insured_part ?></td>
<?php } ?>
</tr> </tr>
<?php <?php
} }
}
?> ?>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<?php } ?>
</section> </section>
</div> </div>
@ -406,4 +442,37 @@
} }
); );
$('#resubmit').click(function() {
$.ajax({
url: '<?= base_url('NanoHealthController/resubmitHealthCareSheet')?>',
type: 'POST',
dataType: 'json',
data: {
"health_care_sheet_id": "<?=$health_care_sheet->id ?>",
"user_id": "<?= $health_care_sheet->user_id ?>",
},
success: function (data) {
// console.log('data',data);
if(data.status === 200){
Swal.fire({
icon: 'success',
title: "<?= $this->lang->line('subscription_resubmitted')?>",
text:"<?= $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" :
}else{
toastr.error(data.error , "<?= $this->lang->line('request_error')?>");
}
},
error: function (resultat, statut, error) {
console.log(resultat + " " + error);
toastr.error("<?= $this->lang->line('error_message')?>" , "<?= $this->lang->line('request_error')?>");
}
});
});
</script> </script>