Update health care sheets infos table
This commit is contained in:
parent
e0e33081b6
commit
d2d77e7785
|
@ -366,6 +366,12 @@ class NanoHealthController extends CI_Controller
|
|||
echo $this->makeRequest('GET','/health-care-sheets/'.$id);
|
||||
}
|
||||
|
||||
public function getActs()
|
||||
{
|
||||
echo $this->makeRequest('GET','/acts');
|
||||
}
|
||||
|
||||
|
||||
public function generateInvoice()
|
||||
{
|
||||
if($this->isLogged()) {
|
||||
|
@ -413,7 +419,12 @@ class NanoHealthController extends CI_Controller
|
|||
return json_encode(['status' => 401]);
|
||||
}
|
||||
$url = NANO_SANTE_SERVICE_URL.$path;
|
||||
$ch = curl_init($url);
|
||||
if($method == 'GET'){
|
||||
$data = http_build_query($_POST);
|
||||
$ch = curl_init($url."?".$data);
|
||||
}else{
|
||||
$ch = curl_init($url);
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
||||
/* set the content type json */
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||
|
|
|
@ -910,6 +910,6 @@ $lang['unit_value'] = "Unit value";
|
|||
$lang['unit_value_required'] = "Unit value is required";
|
||||
$lang['issuer_agent'] = "Issuing agent";
|
||||
$lang['CONSULTATION'] = "CONSULTATION";
|
||||
$lang['EXAM'] = "EXAM";
|
||||
$lang['EXAM_OR_OTHER'] = "EXAM OR OTHER";
|
||||
$lang['consultation_cannot_have_unit_price'] = "A consultation cannot have a unit price";
|
||||
?>
|
||||
|
|
|
@ -920,6 +920,7 @@ $lang['unit_value'] = "Valeur de l'unité";
|
|||
$lang['unit_value_required'] = "La valeur de l'unité est requise";
|
||||
$lang['issuer_agent'] = "Agent emetteur";
|
||||
$lang['CONSULTATION'] = "CONSULTATION";
|
||||
$lang['EXAM'] = "EXAMEN";
|
||||
$lang['consultation_cannot_have_unit_price'] = "Une consultation ne peut pas avoir de prix unitaire"
|
||||
$lang['EXAM_OR_OTHER'] = "EXAMEN OU AUTRE";
|
||||
$lang['consultation_cannot_have_unit_price'] = "Une consultation ne peut pas avoir de prix unitaire";
|
||||
$lang['SUSPENDED'] = "SUSPENDU"
|
||||
?>
|
||||
|
|
|
@ -103,7 +103,7 @@ class Nano_health_model extends CI_Model
|
|||
}
|
||||
|
||||
public function getHealthCareSheetExams($healthCareSheetId){
|
||||
return $this->db->select('e.* , a.code as act_code , a.name as act_name')
|
||||
return $this->db->select('e.* , a.code as act_code , a.name as act_name , a.unit_value as act_unit_value')
|
||||
->from('nh_exams e')->join('nh_health_care_sheets_exams se', 'e.id = se.exam_id')
|
||||
->join('nh_acts a', 'a.id = e.act_id')
|
||||
->where('se.sheet_id',$healthCareSheetId)->order_by('se.created_at','asc')->get();
|
||||
|
|
|
@ -180,7 +180,6 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
<tr>
|
||||
<th><?= $this->lang->line('exam_class'); ?></th>
|
||||
<th><?= $this->lang->line('exam_description'); ?></th>
|
||||
<th><?= $this->lang->line('quantity'); ?></th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -268,6 +267,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
toastr.options.closeDuration = 5000;
|
||||
toastr.options.closeEasing = 'swing';
|
||||
|
||||
var acts = []
|
||||
|
||||
$(document).ready(function (){
|
||||
$('#patient').hide();
|
||||
$('#patient-details').hide();
|
||||
|
@ -299,7 +300,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
$.each(insured, function (i, item) {
|
||||
$('#sheet-form').find('select[name="insured_id"]').append($('<option>', {
|
||||
value: item.insured_id,
|
||||
text : item.insured_id+' - '+item.user.lastname +' '+(item.user.firstname || '')
|
||||
text : item.insured_id+' - '+item.user.lastname +' '+(item.user.firstname || '') + (item.state === 'SUSPENDED' ? " - <?= $this->lang->line('SUSPENDED') ?>" : ''),
|
||||
disabled : item.state === 'SUSPENDED'
|
||||
}));
|
||||
});
|
||||
|
||||
|
@ -332,16 +334,37 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
|
||||
$('#sheet-form').find('select[name="beneficiary_id"]').change(function () {
|
||||
var val = parseInt($(this).val());
|
||||
|
||||
let beneficiary = null;
|
||||
if(val === 0){
|
||||
$('#sheet-form').find('input[name="patient_lastname"]').val(currentInsurance.user.lastname)
|
||||
$('#sheet-form').find('input[name="patient_firstname"]').val(currentInsurance.user.firstname)
|
||||
}else{
|
||||
const b = currentInsurance.beneficiaries.filter(i => i.id === val);
|
||||
$('#sheet-form').find('input[name="patient_lastname"]').val(b[0].lastname)
|
||||
$('#sheet-form').find('input[name="patient_firstname"]').val(b[0].firstname)
|
||||
beneficiary = currentInsurance.beneficiaries.filter(i => i.id === val);
|
||||
$('#sheet-form').find('input[name="patient_lastname"]').val(beneficiary[0].lastname)
|
||||
$('#sheet-form').find('input[name="patient_firstname"]').val(beneficiary[0].firstname)
|
||||
}
|
||||
$('#patient-details').show();
|
||||
|
||||
// Fetch acts
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('NanoHealthController/getActs')?>',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
"network_id": "<?=$network_id?>", "user_id": currentInsurance.user.id, "beneficiary_id": beneficiary == null ? null : beneficiary[0].id,
|
||||
},
|
||||
success: function (data) {
|
||||
if(data.status === 200){
|
||||
acts = data.response
|
||||
$('#patient-details').show();
|
||||
}else{
|
||||
toastr.error(data.error , "<?= $this->lang->line('request_error')?>");
|
||||
}
|
||||
},
|
||||
error: function (resultat, statut, error) {
|
||||
console.log(resultat + " " + error);
|
||||
toastr.error("<?php echo $this->lang->line('error_message')?>", "<?php echo $this->lang->line('request_error')?>");
|
||||
}
|
||||
});
|
||||
});
|
||||
}else{
|
||||
history.back()
|
||||
|
@ -376,8 +399,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
arrayItem['act_id'] = $(item).attr('value');
|
||||
if (index === 1)
|
||||
arrayItem['description'] = $(item).html();
|
||||
if (index === 2)
|
||||
arrayItem['quantity'] = parseFloat($(item).html());
|
||||
// if (index === 2)
|
||||
// arrayItem['quantity'] = parseFloat($(item).html());
|
||||
});
|
||||
exams.push(arrayItem);
|
||||
});
|
||||
|
@ -449,13 +472,14 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
// Paliers scripts
|
||||
$(document).ready(function () {
|
||||
|
||||
function getActsOptions(selectedValue) {
|
||||
function getActsOptions(selectedValue , type) {
|
||||
var actsOptions = '';
|
||||
<?php foreach ($acts->result() as $a ) {?>
|
||||
var id = <?= $a->id ?>;
|
||||
var selected = id === parseInt(selectedValue) ? 'selected' : '';
|
||||
actsOptions += (`<option value=<?= $a->id ?> ${selected} > <?= $a->name ?> </option>`);
|
||||
<?php } ?>
|
||||
acts.forEach(function (a) {
|
||||
if(type === a.type) {
|
||||
var selected = a.id === parseInt(selectedValue) ? 'selected' : '';
|
||||
actsOptions += (`<option value=${a.id} ${selected} > ${a.name} </option>`);
|
||||
}
|
||||
})
|
||||
return actsOptions;
|
||||
}
|
||||
|
||||
|
@ -495,6 +519,14 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
function autoFetchPrestationAmount(){
|
||||
$('#act').on('change',function () {
|
||||
let amount = $(this).find(":selected").attr('amount')
|
||||
$("#amount").val(amount);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
|
||||
|
@ -510,8 +542,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
var index = $("#prestations tbody tr:last-child").index();
|
||||
var row = '<tr>' +
|
||||
'<td>' +
|
||||
'<select required class="form-control" name="act_id" >' +
|
||||
getActsOptions(null)+
|
||||
'<select required class="form-control" name="act_id" id="act">' +
|
||||
getActsOptions(null,'CONSULTATION')+
|
||||
'</select>' +
|
||||
'</td>' +
|
||||
'<td><input type="number" required class="form-control" name="amount" min="0" id="amount"></td>' +
|
||||
|
@ -526,7 +558,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
$('[data-toggle="tooltip"]').tooltip();
|
||||
|
||||
calculatePrestationsAmount();
|
||||
|
||||
autoFetchPrestationAmount();
|
||||
});
|
||||
// Add row on add button click
|
||||
$(document).on("click", ".add1", function () {
|
||||
|
@ -560,7 +592,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
$(document).on("click", ".edit1", function () {
|
||||
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
|
||||
if (index == 0)
|
||||
$(this).html('<select class="form-control" name="act_id" required >'+ getActsOptions($(this).attr("value"))+ '</select>');
|
||||
$(this).html('<select class="form-control" name="act_id" required >'+ getActsOptions($(this).attr("value"),'CONSULTATION')+ '</select>');
|
||||
if (index == 1)
|
||||
$(this).html('<input type="number" required class="form-control" name="amount" min="0" id="amount" value="' + $(this).text() + '">');
|
||||
if (index == 2)
|
||||
|
@ -596,11 +628,11 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
var row = '<tr>' +
|
||||
'<td>' +
|
||||
'<select required class="form-control" name="act_id" >' +
|
||||
getActsOptions(null)+
|
||||
getActsOptions(null,'EXAM_OR_OTHER')+
|
||||
'</select>' +
|
||||
'</td>' +
|
||||
'<td><input class="form-control" name="description"></td>' +
|
||||
'<td><input class="form-control" name="quantity" min="1" step="1" type="number"></td>' +
|
||||
// '<td><input class="form-control" name="quantity" min="1" step="1" type="number"></td>' +
|
||||
'<td> ' + actions2 + '</td>' +
|
||||
'</tr>';
|
||||
$("#exams").append(row);
|
||||
|
@ -639,11 +671,11 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
$(document).on("click", ".edit2", function () {
|
||||
$(this).parents("tr").find("td:not(:last-child)").each(function (index) {
|
||||
if (index == 0)
|
||||
$(this).html('<select class="form-control" name="act_id" required >'+ getActsOptions($(this).attr("value"))+ '</select>');
|
||||
$(this).html('<select class="form-control" name="act_id" required >'+ getActsOptions($(this).attr("value"),'EXAM_OR_OTHER')+ '</select>');
|
||||
if (index == 1)
|
||||
$(this).html('<input class="form-control" name="description" value="' + $(this).text() + '">');
|
||||
if (index == 2)
|
||||
$(this).html('<input class="form-control" name="quantity" min="1" step="1" value="' + $(this).text() + '">');
|
||||
// if (index == 2)
|
||||
// $(this).html('<input class="form-control" name="quantity" min="1" step="1" value="' + $(this).text() + '">');
|
||||
});
|
||||
$(this).parents("tr").find(".add, .edit").toggle();
|
||||
$(".new2").attr("disabled", "disabled");
|
||||
|
|
|
@ -228,7 +228,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
$('#sheet-form').find('select[name="insured_id"]').append($('<option>', {
|
||||
insured_id : item.insured_id,
|
||||
value: 0,
|
||||
text : item.insured_id+' - '+item.user.lastname +' '+(item.user.firstname || '')
|
||||
text : item.insured_id+' - '+item.user.lastname +' '+(item.user.firstname || '') + (item.state === 'SUSPENDED' ? " - <?= $this->lang->line('SUSPENDED') ?>" : ''),
|
||||
disabled : item.state === 'SUSPENDED'
|
||||
}));
|
||||
$('#sheet-form').find('select[name="insured_id"]').append($('<optgroup>', {
|
||||
label: 'Ayants droits',
|
||||
|
@ -237,7 +238,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
$('#sheet-form').find('select[name="insured_id"]').append($('<option>', {
|
||||
insured_id : item.insured_id,
|
||||
value: it.id,
|
||||
text : item.insured_id+' - '+it.lastname +' '+(it.firstname || '')
|
||||
text : item.insured_id+' - '+it.lastname +' '+(it.firstname || '') + (item.state === 'SUSPENDED' ? " - <?= $this->lang->line('SUSPENDED') ?>" : ''),
|
||||
disabled : item.state === 'SUSPENDED'
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -316,7 +316,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
$('#sheet-form').find('select[name="insured_id"]').append($('<option>', {
|
||||
insured_id : item.insured_id,
|
||||
value: 0,
|
||||
text : item.insured_id+' - '+item.user.lastname +' '+(item.user.firstname || '')
|
||||
text : item.insured_id+' - '+item.user.lastname +' '+(item.user.firstname || '') + (item.state === 'SUSPENDED' ? " - <?= $this->lang->line('SUSPENDED') ?>" : ''),
|
||||
disabled : item.state === 'SUSPENDED'
|
||||
}));
|
||||
$('#sheet-form').find('select[name="insured_id"]').append($('<optgroup>', {
|
||||
label: 'Ayants droits',
|
||||
|
@ -325,7 +326,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
$('#sheet-form').find('select[name="insured_id"]').append($('<option>', {
|
||||
insured_id : item.insured_id,
|
||||
value: it.id,
|
||||
text : item.insured_id+' - '+it.lastname +' '+(it.firstname || '')
|
||||
text : item.insured_id+' - '+it.lastname +' '+(it.firstname || '') + (item.state === 'SUSPENDED' ? " - <?= $this->lang->line('SUSPENDED') ?>" : ''),
|
||||
disabled : item.state === 'SUSPENDED'
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -206,7 +206,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
$('#sheet-form').find('select[name="insured_id"]').append($('<option>', {
|
||||
insured_id : item.insured_id,
|
||||
value: 0,
|
||||
text : item.insured_id+' - '+item.user.lastname +' '+(item.user.firstname || '')
|
||||
text : item.insured_id+' - '+item.user.lastname +' '+(item.user.firstname || '') + (item.state === 'SUSPENDED' ? " - <?= $this->lang->line('SUSPENDED') ?>" : ''),
|
||||
disabled : item.state === 'SUSPENDED'
|
||||
}));
|
||||
$('#sheet-form').find('select[name="insured_id"]').append($('<optgroup>', {
|
||||
label: 'Ayants droits',
|
||||
|
@ -215,7 +216,8 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|||
$('#sheet-form').find('select[name="insured_id"]').append($('<option>', {
|
||||
insured_id : item.insured_id,
|
||||
value: it.id,
|
||||
text : item.insured_id+' - '+it.lastname +' '+(it.firstname || '')
|
||||
text : item.insured_id+' - '+it.lastname +' '+(it.firstname || '') + (item.state === 'SUSPENDED' ? " - <?= $this->lang->line('SUSPENDED') ?>" : ''),
|
||||
disabled : item.state === 'SUSPENDED'
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -760,13 +760,15 @@ $careRequests = [];
|
|||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group" id="div-unit-value">
|
||||
<label class="col-form-label"><?= $this->lang->line('unit_value'); ?></label>
|
||||
<input type="text" class="form-control input-lg" name="unit_value">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-form-label"><?= $this->lang->line('Montant'); ?></label>
|
||||
<input type="number" min="0" step="1" class="form-control input-lg" name="amount">
|
||||
<div id="div-amounts">
|
||||
<div class="form-group" id="div-unit-value">
|
||||
<label class="col-form-label"><?= $this->lang->line('unit_value'); ?></label>
|
||||
<input type="text" class="form-control input-lg" name="unit_value">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-form-label"><?= $this->lang->line('Montant'); ?></label>
|
||||
<input type="number" min="0" step="1" class="form-control input-lg" name="amount">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-form-label"><?= $this->lang->line('authorization_type'); ?></label>
|
||||
|
@ -1088,7 +1090,7 @@ $careRequests = [];
|
|||
let unit_value = $("input[name='unit_value']",this).val()
|
||||
if(type === "CONSULTATION" && billing_type === "UNIT_PRICE") {
|
||||
toastr.error("<?= $this->lang->line('consultation_cannot_have_unit_price')?>", "<?= $this->lang->line('management_rule')?>");
|
||||
}else if(billing_type === "UNIT_PRICE" && isNaN(amount)) {
|
||||
}else if( ['UNIT_PRICE','PACKAGE'].includes(billing_type) && isNaN(amount)) {
|
||||
toastr.error("<?= $this->lang->line('amount_required')?>", "<?= $this->lang->line('management_rule')?>");
|
||||
}else if(billing_type === "UNIT_PRICE" && unit_value.length === 0) {
|
||||
toastr.error("<?= $this->lang->line('unit_value_required')?>", "<?= $this->lang->line('management_rule')?>");
|
||||
|
@ -1106,7 +1108,7 @@ $careRequests = [];
|
|||
"billing_type": billing_type,
|
||||
"authorization_type": $("select[name='authorization_type'] :selected",this).val(),
|
||||
"unit_value": $("input[name='unit_value']",this).val(),
|
||||
"amount" : isNaN(amount) ? null : amount
|
||||
"amount" : billing_type === 'FREE' ? null : amount
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code === 200) {
|
||||
|
@ -1132,10 +1134,15 @@ $careRequests = [];
|
|||
});
|
||||
|
||||
function hideOrShowUnitValueDiv(billing_type){
|
||||
if(billing_type === 'PACKAGE'){
|
||||
$("#actForm div[id='div-unit-value']").hide()
|
||||
if(billing_type === 'FREE'){
|
||||
$("#actForm div[id='div-amounts']").hide()
|
||||
}else{
|
||||
$("#actForm div[id='div-unit-value']").show()
|
||||
$("#actForm div[id='div-amounts']").show()
|
||||
if(billing_type === 'PACKAGE'){
|
||||
$("#actForm div[id='div-unit-value']").hide()
|
||||
}else{
|
||||
$("#actForm div[id='div-unit-value']").show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1162,7 +1169,7 @@ $careRequests = [];
|
|||
$("#modal-act h3").html("<?=$this->lang->line('add_act')?>");
|
||||
$("#actForm input[name='code']").val(null);
|
||||
$("#actForm input[name='name']").val(null);
|
||||
("#actForm select[name='type']").prop('selectedIndex',0);
|
||||
$("#actForm select[name='type']").prop('selectedIndex',0);
|
||||
$("#actForm select[name='billing_type']").prop('selectedIndex',0);
|
||||
$("#actForm input[name='amount']").val(null);
|
||||
$("#actForm input[name='unit_value']").val(null);
|
||||
|
|
|
@ -308,8 +308,8 @@
|
|||
<th>#</th>
|
||||
<th><?= $this->lang->line('exam_class'); ?></th>
|
||||
<th><?= $this->lang->line('exam_description'); ?></th>
|
||||
<th><?= $this->lang->line('quantity'); ?></th>
|
||||
<?php if($health_care_sheet->type == 'EXECUTION') { ?>
|
||||
<th><?= $this->lang->line('quantity'); ?></th>
|
||||
<th><?= $this->lang->line('UNIT_PRICE'); ?></th>
|
||||
<th><?= $this->lang->line('percentage_insured'); ?></th>
|
||||
<th><?= $this->lang->line('percentage_insurer'); ?></th>
|
||||
|
@ -327,10 +327,12 @@
|
|||
echo "<tr>
|
||||
<td>" . ($i+1) . "</td>
|
||||
<td>" . $row->act_name . "</td>
|
||||
<td>" . $row->description . "</td>
|
||||
<td>" . $row->quantity. "</td>";
|
||||
if($health_care_sheet->type == 'EXECUTION') { ?>
|
||||
<td><?= $unit_price ?></td>
|
||||
<td>" . $row->description . "</td>";
|
||||
if($health_care_sheet->type == 'EXECUTION') {
|
||||
$unit_quantity = !empty($row->unit_quantity) ? "$row->unit_quantity $row->act_unit_value x " : '';
|
||||
?>
|
||||
<td><?= $row->quantity ?></td>
|
||||
<td><?= $unit_quantity.$unit_price ?></td>
|
||||
<td><?= $insured_part ?></td>
|
||||
<td><?= $insurance_part ?></td>
|
||||
<?php }
|
||||
|
|
Loading…
Reference in New Issue