68 lines
2.1 KiB
PHP
68 lines
2.1 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: capp
|
|
* Date: 29/05/2018
|
|
* Time: 15:49
|
|
*/
|
|
|
|
|
|
class Nano_health_model extends CI_Model
|
|
{
|
|
|
|
public function createConfig($id_network){
|
|
$this->db->insert('nh_networks_configs', ['network_id' => $id_network]);
|
|
return $this->db->insert_id();
|
|
}
|
|
|
|
public function getConfig($id_network){
|
|
return $this->db->get_where('nh_networks_configs',['network_id'=> $id_network]);
|
|
}
|
|
|
|
public function updateConfig($configId, $data){
|
|
$this->db->where('id', $configId);
|
|
return $this->db->update('nh_networks_configs', $data);
|
|
}
|
|
|
|
public function getConfigYearsPricesGrid($configId){
|
|
return $this->db->get_where('nh_years_prices_grid',['nh_network_config_id'=> $configId]);
|
|
}
|
|
|
|
public function getConfigMonthsPricesGrid($configId){
|
|
return $this->db->get_where('nh_months_prices_grid',['nh_network_config_id'=> $configId]);
|
|
}
|
|
|
|
public function getConfigActs($configId){
|
|
return $this->db->get_where('nh_acts',['nh_network_config_id'=> $configId]);
|
|
}
|
|
|
|
// Classes de prestataires
|
|
public function getProviderClasses($configId)
|
|
{
|
|
return $this->db->get_where('nh_provider_classes',['nh_network_config_id'=> $configId]);
|
|
}
|
|
|
|
public function getInfosInsuranceSubscriptionById($insuranceSubscriptionId){
|
|
return $this->db->get_where('nh_infos_insurances_subscriptions',['insurance_subscription_id'=> $insuranceSubscriptionId])->first_row();
|
|
}
|
|
|
|
public function getNhValidatingAgentSubscriptionHistory($agentId , $state){
|
|
return $this->db->from('nh_insurances_subscriptions_history')->where('nh_validating_agent_id', $agentId)
|
|
->where('insurance_subscription_state', $state)->count_all_results();
|
|
}
|
|
|
|
public function getNhInsurancesSubscriptionCount($state){
|
|
return $this->db->from('nh_insurances_subscriptions')
|
|
->where('state', $state)->count_all_results();
|
|
}
|
|
|
|
public function getInfosInsuredById($insuredId){
|
|
return $this->db->get_where('nh_infos_insurances',['insured_id'=> $insuredId])->first_row();
|
|
}
|
|
|
|
public function getInsurancePaymentTransactions($insuredId){
|
|
return $this->db->get_where('nh_insurances_payments',['insured_id'=> $insuredId]);
|
|
}
|
|
}
|