prestation/Controleur/ControleurFeuillemaladie.php
2025-12-01 18:54:33 +00:00

166 lines
6.1 KiB
PHP

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Menuvueutilisateur.php';
require_once 'Modele/Feuillemaladie.php';
require_once 'Modele/Prestationactes.php';
require_once 'Modele/Typeaffection.php';
require_once 'Modele/Affection.php';
require_once 'Modele/Garantieadherent.php';
require_once 'Modele/Prescription.php';
require_once 'Modele/Miseenobservation.php';
class ControleurFeuillemaladie extends Controleur {
private $menuvue;
private $feuillemaladie;
private $prestation;
private $typeaffection;
private $affection;
private $prescription;
private $obs;
private $garantieadherent;
public function __construct() {
$this->menuvue = new Menuvueutilisateur();
$this->menuvue->getMenuVue('Feuillemaladie');
$this->feuillemaladie = new Feuillemaladie();
$this->prestation = new Prestationactes();
$this->typeaffection = new Typeaffection();
$this->affection = new Affection();
$this->garantieadherent = new Garantieadherent();
$this->prescription = new Prescription();
$this->obs = new Miseenobservation();
$_SESSION['p_codeTypeFacture_C'] = "CSO";
}
public function index()
{
$_SESSION['p_tm_TP'] = "0";
if($_SESSION['p_numeroFeuilleMaladie_C']=="0"){
$_SESSION['p_numeroFeuilleMaladie_C'] = $_SESSION['numeroFeuilleMaladie'];
}
$numeroFeuilleMaladie = $_SESSION['p_numeroFeuilleMaladie_C'];
$codePrestataire = $_SESSION['p_codePrestataire_C'];
$idBeneficiaire = $_SESSION['p_idBeneficiaire_C'];
if(!isset($_SESSION['p_idBeneficiaire_C'])){
$this->rediriger("Recherche");
}
$referencementpolice = $this->feuillemaladie->getReferencementPolice($_SESSION['p_idPolice_C']);
//var_dump($referencementpolice);
$avecReferencement = $referencementpolice['avecReferencement'];
$tauxAvecReferencement = $referencementpolice['tauxAvecReferencement'];
$tauxSansReferencement = $referencementpolice['tauxSansReferencement'];
$garantieadherent_temp = null;
$infosfeuillemaladie = $this->feuillemaladie->getinfosfeuillemaladie($numeroFeuilleMaladie);
//var_dump($infosfeuillemaladie); die();
$facture = $infosfeuillemaladie['facture'];
//$this->prestation->vider_garantieadherent_temp($numeroFeuilleMaladie, $codePrestataire);
if($facture==0)
{
$this->prestation->recap_feuillemaladie($numeroFeuilleMaladie, $codePrestataire);
}
$feuillemaladie = $this->feuillemaladie->getfeuillemaladie($numeroFeuilleMaladie);
//var_dump($feuillemaladie); die();
//$_SESSION['p_modeSaisieFacture'] = $feuillemaladie['modeSaisieFeuille'];
$prestations = $this->prestation->getprestationsfeuille($numeroFeuilleMaladie, $codePrestataire);
$ententePrealableCons = "";
foreach ($prestations as $prestation){
if ($prestation['codeActe']== "CSPSY" || $prestation['codeActe'] =="CSORT")
{
$ententePrealableCons = $prestation['ententePrealable'];
}
}
//var_dump($prestations["facPartiel"]);
//var_dump($prestations);
//die();
$typeaffections = $this->typeaffection->getListe() ;
$codeGarantie = "OPT";
$garantieOptique = $this->feuillemaladie->getDateFinDelaiCarenceGarantie($codeGarantie);
$codeGarantieHospitalisation = "HOS";
$garantieHospitalisation = $this->feuillemaladie->getDateFinDelaiCarenceGarantie($codeGarantieHospitalisation);
$codeTypeAffection = $feuillemaladie['codeTypeAffection'];
//$affections = $this->affection->getListe($codeTypeAffection) ;
$affections = $this->affection->getListes();
$estGarantiePha = $this->garantieadherent->estDansGarantieDuBeneficiaire("PHA",$idBeneficiaire);
$estGarantieKine = $this->garantieadherent->estDansGarantieDuBeneficiaire("AUX",$idBeneficiaire);
$estGarantieOpt = $this->garantieadherent->estDansGarantieDuBeneficiaire("OPT",$idBeneficiaire);
$estGarantieHos = $this->garantieadherent->estDansGarantieDuBeneficiaire("HOS",$idBeneficiaire);
$estGarantieBio = $this->garantieadherent->estDansGarantieDuBeneficiaire("BIO",$idBeneficiaire);
$estGarantieIma = $this->garantieadherent->estDansGarantieDuBeneficiaire("IMA",$idBeneficiaire);
$estGarantieAut = $this->garantieadherent->estDansGarantieDuBeneficiaire("EXA",$idBeneficiaire);
$estGarantieExa = $estGarantieBio+$estGarantieIma+$estGarantieAut;
$nbreActeEntentePrealable = $this->prestation->getNbreActeEntentePrealable($numeroFeuilleMaladie);
$diagnostics = $this->feuillemaladie->getDiagnostics($numeroFeuilleMaladie);
$datePrestation = $feuillemaladie['dateSurvenance'];
$_SESSION['datePrestation'] = $datePrestation;
$tm = $this->prestation->ticketModerateurDefinitif("", "", $datePrestation);
$tauxCouverture = (100-$tm)."%";
$_SESSION['p_tm_C'] = $tm;
$_SESSION['datePrestation'] = $feuillemaladie['dateSurvenance'];
//var_dump($_SESSION['datePrestation']);
if($_SESSION['p_miseEnObservation_C']>0){
$this->obs->supprimermiseenobservation();
}
$_SESSION['p_codeAffection_C'] = $feuillemaladie['codeAffection'];
$_SESSION['p_codeMedecin_C'] = $feuillemaladie['codeMedecin'];
$autoriserBonHospitAvantDate = $this->feuillemaladie->getAutoriserBonHospitAvantDate();
$this->genererVue(array('ententePrealableCons' => $ententePrealableCons, 'feuillemaladie' => $feuillemaladie,
'garantieadherent_temp' => $garantieadherent_temp, 'typeaffections' => $typeaffections, 'affections' => $affections,
'diagnostics' => $diagnostics, 'estGarantiePha' => $estGarantiePha, 'estGarantieKine' => $estGarantieKine,
'estGarantieOpt' => $estGarantieOpt, 'estGarantieExa' => $estGarantieExa, 'estGarantieHos' => $estGarantieHos,
'garantieOptique' => $garantieOptique, 'garantieHospitalisation' => $garantieHospitalisation, 'prestations' => $prestations,
'nbreActeEntentePrealable' => $nbreActeEntentePrealable, 'autoriserBonHospitAvantDate' => $autoriserBonHospitAvantDate,
'tauxCouverture' => $tauxCouverture));
}
}