prestation/Vue/Ajaxreponseavis/index.php
2025-12-05 10:42:46 +00:00

97 lines
3.5 KiB
PHP
Executable File

<?php
$facture = $feuillemaladie['facture'];
$avisHospitalisation = $feuillemaladie['avisHospitalisation'];
$hospitalisation = $feuillemaladie['hospitalisation'];
$idProlongation = $feuillemaladie['idProlongation'];
$idProformaHospitalisation = $feuillemaladie['idProformaHospitalisation'];
// KANE 10/04/2025
$autoriser = "1";
if($avisHospitalisation >'0' && $idProformaHospitalisation > "0" && $facture == "0")
{
$estDateFuture = (new DateTime($feuillemaladie['dateDebutHospit'])) > (new DateTime('today'));
$autoriser = ($estDateFuture && $autoriserBonHospitAvantDate=="0") ? "0" : "1";
}
// FIN KANE 10/04/2025
$scroll = "scroll";
$v_msg = "";
// Définir les messages en fonction des conditions
if ($facture == "0" && $contestation == "0") {
$messages = [
"1" => [
"0" => [
"fr" => $autoriser == "1"
? "Avis favorable! Vous êtes autorisé à poursuivre l'hospitalisation du patient."
: "Hospitalisation chirurgicale non encore autorisée! Attendez, s'il vous plaît, la date de sa programmation. Merci pour votre compréhension!",
"en" => $autoriser == "1"
? "Favorable opinion! You are authorized to continue the patient's hospitalization."
: "Surgical hospitalization not yet authorized! Please wait for the scheduling date. Thank you for understanding!"
],
">0" => [
"fr" => "Avis favorable! Vous êtes autorisé à proroger l'hospitalisation du patient.",
"en" => "Favorable opinion! You are authorized to extend the patient's hospitalization."
]
],
"2" => [
"fr" => "Avis d'hospitalisation envoyé pour validation! Veuillez patienter...",
"en" => "Notice of Hospitalization sent for validation! Please wait..."
],
"3" => [
"fr" => "Désolé! L'hospitalisation n'a pas été autorisé par l'assureur! Le patient en a été informé.",
"en" => "Sorry! Hospitalization was not authorized by the insurer! The patient was informed."
],
"4" => [
"fr" => "Avis de prorogation d'hospitalisation envoyé pour validation! Veuillez patienter...",
"en" => "Notice of extension of hospitalization sent for validation! Please wait..."
]
];
$lang = (isset($_SESSION['p_lang']) && $_SESSION['p_lang'] == "en_US") ? "en" : "fr";
if (isset($messages[$avisHospitalisation])) {
if ($avisHospitalisation == "1") {
$idProlongationKey = $idProlongation > "0" ? ">0" : "0";
if (isset($messages[$avisHospitalisation][$idProlongationKey])) {
$v_msg = $messages[$avisHospitalisation][$idProlongationKey][$lang];
}
} else {
$v_msg = $messages[$avisHospitalisation][$lang];
}
}
}
?>
<?php if ($v_msg != ""): ?>
<?php
// Définir les styles en fonction des conditions
$styles = [
'behavior' => $scroll,
'direction' => "left",
'scrollamount' => "15",
'style' => "font-size:14pt"
];
if (($avisHospitalisation == "3" && $facture == "0") || $autoriser == "0") {
$styles['style'] .= ";color:white; background-color:red";
} elseif ($avisHospitalisation == "1" && $facture == "0") {
$styles['style'] .= ";color:white; background-color:#7AA95C";
} else {
$styles['style'] .= ";color:red; background-color:yellow";
}
?>
<marquee <?= implode(' ', array_map(
fn($key, $value) => "$key=\"$value\"",
array_keys($styles),
$styles
)) ?>>
<?= $v_msg ?>
</marquee>
<?php endif; ?>