183 lines
5.6 KiB
PHP
183 lines
5.6 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/Beneficiaire.php';
|
|
|
|
require 'vendor/autoload.php';
|
|
use Aws\Rekognition\RekognitionClient;
|
|
|
|
class ControleurFeuillemaladie extends Controleur {
|
|
private $feuillemaladie;
|
|
private $prestation;
|
|
private $typeaffection;
|
|
private $affection;
|
|
private $beneficiaire;
|
|
|
|
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->beneficiaire = new Beneficiaire();
|
|
|
|
$_SESSION['p_codeTypeFacture_C'] = "CSO";
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$_SESSION['p_tm_TP'] = "0";
|
|
|
|
$numeroFeuilleMaladie = $_SESSION['p_numeroFeuilleMaladie_C'];
|
|
$codePrestataire = $_SESSION['p_codePrestataire_C'];
|
|
$idBeneficiaire = $_SESSION['p_idBeneficiaire_C'];
|
|
|
|
$garantieadherent_temp = null;
|
|
$limite_beneficiaire = null;
|
|
|
|
$infosfeuillemaladie = $this->feuillemaladie->getinfosfeuillemaladie($numeroFeuilleMaladie);
|
|
$facture = $infosfeuillemaladie['facture'];
|
|
|
|
$this->prestation->vider_garantieadherent_temp($numeroFeuilleMaladie, $codePrestataire);
|
|
|
|
if($facture==0)
|
|
{
|
|
$garantieadherent_temp = $this->prestation->init_garantieadherent_temp($numeroFeuilleMaladie, $codePrestataire);
|
|
|
|
$this->beneficiaire->controlerplafondbeneficiaireannuel($idBeneficiaire);
|
|
|
|
$limite_beneficiaire = $this->prestation->getLimitesBeneficiaireTemp();
|
|
}
|
|
|
|
$feuillemaladie = $this->feuillemaladie->getfeuillemaladie($numeroFeuilleMaladie);
|
|
|
|
$prestations = $this->prestation->getprestationsfeuille($numeroFeuilleMaladie, $codePrestataire);
|
|
|
|
$typeaffections = $this->typeaffection->getListe() ;
|
|
|
|
$codeTypeAffection = $feuillemaladie['codeTypeAffection'];
|
|
|
|
$affections = $this->affection->getListe($codeTypeAffection) ;
|
|
|
|
$diagnostics = $this->feuillemaladie->getDiagnostics($numeroFeuilleMaladie);
|
|
|
|
$this->genererVue(array('feuillemaladie' => $feuillemaladie, 'prestations' => $prestations,
|
|
'garantieadherent_temp' => $garantieadherent_temp, 'typeaffections' => $typeaffections, 'affections' => $affections,
|
|
'diagnostics' => $diagnostics, 'limite_beneficiaire' => $limite_beneficiaire));
|
|
}
|
|
|
|
public function confirmerface()
|
|
{
|
|
$_SESSION['p_messageFace'] = "";
|
|
$compare_face = $_POST['compare_face'];
|
|
|
|
if(isset($_POST['image_face']))
|
|
{
|
|
$_SESSION['p_okId_face'] = "-1";
|
|
$_SESSION['p_okId'] = "-1";
|
|
|
|
$path = "Temp/";
|
|
$extension = "jpeg";
|
|
|
|
$data = $_POST['image_face'];
|
|
|
|
$data = str_replace('data:image/jpeg;base64,', '', $data);
|
|
|
|
$data = base64_decode($data);
|
|
|
|
$username = $_SESSION['p_numeroBeneficiaire_C'];
|
|
|
|
$date = date('YmdHis');
|
|
$file_name = "img_v_".$date.uniqid().".".$extension;
|
|
$chemin = $path.$file_name;
|
|
|
|
file_put_contents($chemin, $data);
|
|
|
|
$rand = rand(1,1000000);
|
|
$nomImage = $username."_".$rand.'.'. $extension;
|
|
|
|
$this->beneficiaire->init_traiterlaface('2');
|
|
|
|
$arrgs = [
|
|
'credentials' => [
|
|
'key' => 'AKIA2O2PTXQ7XN5OATO3',
|
|
'secret' => 'Rzq5mKG80tqfePQYF6iFZ5AMCM/bY2l6i5IxxLzL',
|
|
],
|
|
'version' => 'latest',
|
|
'region' => 'us-west-2'
|
|
];
|
|
|
|
$client = new RekognitionClient($arrgs);
|
|
|
|
$sourceImage = $chemin;
|
|
$targetImage = $_SESSION['p_dossierPhoto_C'].$_SESSION['p_dossierSociete'].'/Photos/'.$_SESSION['p_lienPhoto_C'];
|
|
|
|
try
|
|
{
|
|
$result = $client->compareFaces
|
|
(
|
|
[
|
|
'SimilarityThreshold' => 80,
|
|
'SourceImage' => [
|
|
'Bytes' => file_get_contents($sourceImage)
|
|
],
|
|
'TargetImage' => [
|
|
'Bytes' => file_get_contents($targetImage)
|
|
],
|
|
]
|
|
);
|
|
|
|
$faceMatches = count($result['FaceMatches']);
|
|
|
|
if ($faceMatches==0)
|
|
{
|
|
$_SESSION['p_messageFace'] = "Les faces ne correspondent pas! / The faces do not match!";
|
|
$this->beneficiaire->resultat_traitement_face($username, '0', $_SESSION['p_messageFace']);
|
|
$this->genererVueAjax(array('messageFace' => $_SESSION['p_messageFace'], 'msgErreur' => $_SESSION['p_messageFace'], 'photo_succes' => "0"));
|
|
}
|
|
else
|
|
{
|
|
$this->beneficiaire->resultat_traitement_face($username, '1', '');
|
|
|
|
$_SESSION['p_okId_face'] = "1";
|
|
$_SESSION['p_messageFace'] = "Face confirmée! / Face confirmed!";
|
|
|
|
/*
|
|
var_dump
|
|
(
|
|
array
|
|
(
|
|
"p_okId_face" => $_SESSION['p_okId_face'],
|
|
"p_messageFace" => $_SESSION['p_messageFace'],
|
|
)
|
|
);
|
|
exit();
|
|
*/
|
|
|
|
$this->genererVueAjax(array('messageFace' => $_SESSION['p_messageFace'], 'msgErreur' => $_SESSION['p_messageFace'], 'photo_succes' => "1"));
|
|
}
|
|
}
|
|
catch (Exception $e)
|
|
{
|
|
// echo 'Message: ' .$e->getMessage();
|
|
// exit();
|
|
$msgErreur = $e->getMessage();
|
|
$_SESSION['p_messageFace'] = "Un problème lors du traitement! / A problem during treatment!";
|
|
|
|
$this->beneficiaire->resultat_traitement_face($username, '9', $msgErreur);
|
|
|
|
$this->genererVueAjax(array('messageFace' => $_SESSION['p_messageFace'], 'msgErreur' => $_SESSION['p_messageFace'], 'photo_succes' => "0"));
|
|
}
|
|
}
|
|
unlink($chemin);
|
|
}
|
|
|
|
}
|
|
|