Add insured and insurance amounts to health care sheet infos

This commit is contained in:
Djery-Tom 2022-01-31 12:24:35 +01:00
parent 82f945120b
commit 5c141c459a
6 changed files with 70 additions and 9 deletions

View File

@ -43,6 +43,9 @@ class Agent extends CI_Controller
$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);
// Calcul par assuré et assurance
$data['amounts'] = $this->nano_health_model->calculateSheetAmountsParts($data['health_care_sheet']->id ?? null, $data['health_care_sheet']->type ?? null);
$this->load->view('header_agent', $data);
$this->load->view('nano_health/hyper/infos_health_care_sheet');
}

View File

@ -424,6 +424,8 @@ class Hyperviseur_dash extends CI_Controller
$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);
// Calcul par assuré et assurance
$data['amounts'] = $this->nano_health_model->calculateSheetAmountsParts($data['health_care_sheet']->id ?? null, $data['health_care_sheet']->type ?? null);
$this->load->view('header_hyp', $data);
$this->load->view('nano_health/hyper/infos_health_care_sheet');

View File

@ -639,7 +639,7 @@ $lang['provider_billing_period'] = "Provider billing period";
$lang['max_number_of_beneficiaries'] = "Maximum number of beneficiaries";
$lang['age_limit_of_child_beneficiary'] = "Age limit of child beneficiary";
$lang['support_type'] = "Type of support";
$lang['percentage_insurer'] = "Insurer share";
$lang['percentage_insurer'] = "Insurance share";
$lang['percentage_insured'] = "Insured share";
$lang['list_of_acts'] = "List of acts";
$lang['WEEKLY'] = "Weekly";

View File

@ -651,7 +651,7 @@ $lang['provider_billing_period'] = "Période de facturation des prestataires";
$lang['max_number_of_beneficiaries'] = "Nombre maximum dayants droit";
$lang['age_limit_of_child_beneficiary'] = "Age limite de layant droit enfant";
$lang['support_type'] = "Type de prise en charges";
$lang['percentage_insurer'] = "Part assureur";
$lang['percentage_insurer'] = "Part assurance";
$lang['percentage_insured'] = "Part assuré";
$lang['list_of_acts'] = "Liste des actes";
$lang['WEEKLY'] = "Hebdomadaire";

View File

@ -106,4 +106,34 @@ class Nano_health_model extends CI_Model
{
return $this->db->get_where('nh_drugs_and_devices',['network_id'=> $networkId]);
}
public function calculateSheetAmountsParts($healthCareSheetId , $healthCareSheetType){
$insurerAmount = 0;
$insuredAmount = 0;
if ($healthCareSheetType == 'CONSULTATION') {
$query = $this->db->query("SELECT SUM(moderator_ticket) as moderator_ticket , SUM(insurance_amount) as insurance_amount FROM nh_performances p INNER JOIN
nh_health_care_sheets_performances hp ON p.id = hp.performance_id WHERE hp.sheet_id = $healthCareSheetId LIMIT 1");
if ($query->num_rows() > 0) {
$insuredAmount += $query->first_row()->moderator_ticket;
$insurerAmount += $query->first_row()->insurance_amount;
}
} else {
$query = $this->db->query("SELECT SUM(insured_paid_amount) as insured_paid_amount , SUM(insurer_paid_amount) as insurer_paid_amount FROM nh_medical_prescriptions p INNER JOIN
nh_health_care_sheets_prescriptions hp ON p.id = hp.prescription_id WHERE hp.sheet_id = $healthCareSheetId LIMIT 1");
if ($query->num_rows() > 0) {
$insuredAmount += $query->first_row()->insured_paid_amount;
$insurerAmount += $query->first_row()->insurer_paid_amount;
}
$query = $this->db->query("SELECT SUM(insured_paid_amount) as insured_paid_amount , SUM(insurer_paid_amount) as insurer_paid_amount FROM nh_exams e INNER JOIN
nh_health_care_sheets_exams he ON e.id = he.exam_id WHERE he.sheet_id = $healthCareSheetId LIMIT 1");
if ($query->num_rows() > 0) {
$insuredAmount += $query->first_row()->insured_paid_amount;
$insurerAmount += $query->first_row()->insurer_paid_amount;
}
}
return [$insuredAmount, $insurerAmount];
}
}

View File

@ -220,6 +220,32 @@
</div>
</div>
</div>
<div class="row">
<div class="col-lg-4 col-xs-6">
<div class="small-box bg-blue-active">
<div class="inner">
<h3 style="white-space: pre-wrap; font-size: 1.9em;"><?=Money::of(round($amounts[0], 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR')?> </h3>
<p><?= $this->lang->line('percentage_insured') ?></p>
</div>
<div class="icon">
<i class="fa fa-info"></i>
</div>
</div>
</div>
<div class="col-lg-4 col-xs-6">
<div class="small-box bg-blue-active">
<div class="inner">
<h3 style="white-space: pre-wrap; font-size: 1.9em;"><?= Money::of(round($amounts[1], 2), $health_care_sheet->currency_code, $this->context)->formatTo('fr_FR')?> </h3>
<p><?= $this->lang->line('percentage_insurer') ?></p>
</div>
<div class="icon">
<i class="fa fa-info"></i>
</div>
</div>
</div>
</div>
<?php if($health_care_sheet->type != 'EXECUTION') { ?>
@ -235,8 +261,8 @@
<th><?= $this->lang->line('act_code'); ?></th>
<th><?= $this->lang->line('Montant'); ?></th>
<th><?= $this->lang->line('home_visit_fees'); ?></th>
<th><?= $this->lang->line('moderator_ticket'); ?></th>
<th><?= $this->lang->line('insurance_amount'); ?></th>
<th><?= $this->lang->line('percentage_insured'); ?></th>
<th><?= $this->lang->line('percentage_insurer'); ?></th>
<th>Date</th>
</tr>
</thead>
@ -285,8 +311,8 @@
<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>
<th><?= $this->lang->line('percentage_insurer'); ?></th>
<?php } ?>
</tr>
</thead>
@ -305,8 +331,8 @@
<td>" . $row->quantity. "</td>";
if($health_care_sheet->type == 'EXECUTION') { ?>
<td><?= $unit_price ?></td>
<td><?= $insurance_part ?></td>
<td><?= $insured_part ?></td>
<td><?= $insured_part ?></td>
<td><?= $insurance_part ?></td>
<?php }
?>
</tr>
@ -335,8 +361,8 @@
<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>
<th><?= $this->lang->line('percentage_insurer'); ?></th>
<?php } ?>
</tr>
</thead>
@ -357,8 +383,8 @@
<td>" . $row->quantity. "</td>";
if($health_care_sheet->type == 'EXECUTION') { ?>
<td><?= $unit_price ?></td>
<td><?= $insurance_part ?></td>
<td><?= $insured_part ?></td>
<td><?= $insurance_part ?></td>
<?php } ?>
</tr>
<?php