<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Patients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
// Droit sur les consultations
$canCabinet = CModule::getCanDo("dPcabinet");
// Droit sur les interventions et séjours
$canPlanningOp = CModule::getCanDo("dPplanningOp");
$user = CUser::get();
// Récupération des critères de recherche
$antecedent_patient = CValue::getOrSession("antecedent_patient");
$traitement_patient = CValue::getOrSession("traitement_patient");
$diagnostic_patient = CValue::getOrSession("diagnostic_patient");
$motif_consult = CValue::getOrSession("motif_consult");
$remarque_consult = CValue::getOrSession("remarque_consult");
$examen_consult = CValue::getOrSession("examen_consult");
$traitement_consult = CValue::getOrSession("traitement_consult");
$conclusion_consult = CValue::getOrSession("conclusion_consult");
$type = CValue::getOrSession("type");
$convalescence_sejour = CValue::getOrSession("convalescence_sejour");
$remarque_sejour = CValue::getOrSession("remarque_sejour");
$materiel_intervention = CValue::getOrSession("materiel_intervention");
$examen_per_op = CValue::getOrSession("examen_per_op");
$examen_intervention = CValue::getOrSession("examen_intervention");
 /**
  * Load class level can do
  *
  * @return CCanDo
  */
 function canClass()
 {
     $can = new CCanDo();
     // Defined at class level in permissions object for user
     global $userPermsObjects;
     if (isset($userPermsObjects[$this->_class][0])) {
         $perm = $userPermsObjects[$this->_class][0];
         $can->read = $perm->permission >= PERM_READ;
         $can->edit = $perm->permission >= PERM_EDIT;
         return $can;
     }
     // Otherwise fall back on module definition
     $can_module = CModule::getCanDo(CModelObject::$module_name[$this->_class]);
     $can->read = $can_module->read;
     $can->edit = $can_module->admin || $can_module->edit;
     return $can;
 }
 /**
  * get the permission type
  *
  * @param int $permType permission type
  *
  * @return bool
  */
 function getPerm($permType)
 {
     if (CAppUI::$user->isAdmin()) {
         return true;
     }
     if (CModule::getCanDo('astreintes')->edit && $this->_ref_user->getPerm($permType)) {
         return true;
     }
     /* @todo À quoi sert ce droit ? */
     if (CModule::getCanDo("astreintes")->read && $permType <= PERM_READ) {
         return true;
     }
     return false;
 }
<?php

/* $Id: view_identifiants.php 28748 2015-06-27 09:01:22Z lryo $ */
/**
 * @package Mediboard
 * @subpackage sante400
 * @version $Revision: 28748 $
 * @author SARL OpenXtrem
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 */
CCanDo::checkRead();
$canSante400 = CModule::getCanDo("dPsante400");
$dialog = CValue::get("dialog");
$page = intval(CValue::get('page', 0));
// Chargement du filtre
$filter = new CIdSante400();
$filter->object_id = CValue::get("object_id");
$filter->object_class = CValue::get("object_class");
$filter->tag = CValue::get("tag");
$filter->id400 = CValue::get("id400");
$filter->nullifyEmptyFields();
// Récupération de la liste des classes disponibles
if ($filter->object_class && $filter->object_id) {
    $listClasses = array($filter->object_class);
} else {
    $listClasses = CApp::getInstalledClasses();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("page", $page);
$smarty->assign("filter", $filter);
/**
 * $Id: export_actes_pmsi.php 28465 2015-06-02 08:54:31Z lryo $
 *
 * @package    Mediboard
 * @subpackage PMSI
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 28465 $
 */
global $m, $tab;
$module = CValue::get("module");
if (!$module) {
    $module = $m;
}
$canUnlockActes = $module == "dPpmsi" || CModule::getCanDo("dPsalleOp")->admin;
if (null == ($object_class = CValue::get("object_class"))) {
    CAppUI::stepMessage(UI_MSG_WARNING, "{$tab}-msg-mode-missing");
    return;
}
$unlock_dossier = CValue::get("unlock_dossier", 0);
$NDA = "";
$IPP = "";
switch ($object_class) {
    case "COperation":
        $object = new COperation();
        // Chargement de l'opération et génération du document
        $operation_id = CValue::post("mb_operation_id", CValue::getOrSession("object_id"));
        if ($object->load($operation_id)) {
            $object->loadRefs();
            $codes = explode("|", $object->codes_ccam);
$op->loadRefChir3();
$op->loadRefChir4();
if (!$op->_id) {
    $op->_time_op = $op->temp_operation = "00:00:00";
    if ($hour_urgence && $min_urgence) {
        $time = "{$hour_urgence}:{$min_urgence}:00";
    } else {
        $time = str_pad($hours_urgence["deb"], 2, "0", STR_PAD_LEFT) . ":00:00";
    }
    $op->_time_urgence = $op->time_operation = $time;
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("sejours_collision", $patient->getSejoursCollisions());
$smarty->assign("isPrescriptionInstalled", CModule::getActive("dPprescription"));
$smarty->assign("canSante400", CModule::getCanDo("dPsante400"));
$smarty->assign("urgInstalled", CModule::getInstalled("dPurgences"));
$smarty->assign("heure_sortie_ambu", $heure_sortie_ambu);
$smarty->assign("heure_sortie_autre", $heure_sortie_autre);
$smarty->assign("heure_entree_veille", $heure_entree_veille);
$smarty->assign("heure_entree_jour", $heure_entree_jour);
$smarty->assign("op", $op);
$smarty->assign("plage", $op->plageop_id ? $op->_ref_plageop : new CPlageOp());
$smarty->assign("sejour", $sejour);
$smarty->assign("chir", $chir);
$smarty->assign("praticien", $prat);
$smarty->assign("patient", $patient);
$smarty->assign("sejours", $sejours);
$smarty->assign("ufs", CUniteFonctionnelle::getUFs());
$smarty->assign("_functions", $_functions);
$smarty->assign("modurgence", 1);
 /**
  * @see parent::getPerm()
  */
 function getPerm($permType)
 {
     $basePerm = CModule::getCanDo('soins')->edit || CModule::getCanDo('dPurgences')->edit || CModule::getCanDo('dPcabinet')->edit || CModule::getCanDo('dPbloc')->edit || CModule::getCanDo('dPplanningOp')->edit;
     return $basePerm && parent::getPerm($permType);
 }
CSejour::massCountPrestationSouhaitees(array($sejour));
foreach ($operations as $operation) {
    $operation->loadRefsActes();
    $dossier_anesth = $operation->loadRefsConsultAnesth();
    $consultation = $dossier_anesth->loadRefConsultation();
    $consultation->loadRefPlageConsult();
    $dossier_anesth->_date_consult = $consultation->_date;
}
if (CAppUI::conf("dPadmissions show_deficience")) {
    CDossierMedical::massCountAntecedentsByType(array($dossier_medical), "deficience");
}
$list_mode_entree = array();
if (CAppUI::conf("dPplanningOp CSejour use_custom_mode_entree")) {
    $mode_entree = new CModeEntreeSejour();
    $where = array("actif" => "= '1'");
    $list_mode_entree = $mode_entree->loadGroupList($where);
}
$smarty = new CSmartyDP();
$smarty->assign("_sejour", $sejour);
$smarty->assign("date_min", $date_min);
$smarty->assign("date_max", $date_max);
$smarty->assign("date_actuelle", $date_actuelle);
$smarty->assign("date_demain", $date_demain);
$smarty->assign("list_mode_entree", $list_mode_entree);
$smarty->assign("prestations", CPrestation::loadCurrentList());
$smarty->assign("canAdmissions", CModule::getCanDo("dPadmissions"));
$smarty->assign("canPatients", CModule::getCanDo("dPpatients"));
$smarty->assign("canPlanningOp", CModule::getCanDo("dPplanningOp"));
$smarty->assign("single_line", true);
// Indique qu'on charge la ligne seulement (pour les evenements de formulaire)
$smarty->display("inc_vw_admission_line.tpl");
    $_lines = $line->loadMatchingList("debut ASC");
    foreach ($_lines as $_line) {
        $lines[$_line->_ref_element_prescription->category_prescription_id][$_line->element_prescription_id][] = $_line;
    }
}
// Chargement des categories de prescription
$categories = array();
$category = new CCategoryPrescription();
$where[] = "chapitre = 'kine'";
$group_id = CGroups::loadCurrent()->_id;
$where[] = "group_id = '{$group_id}' OR group_id IS NULL";
$order = "nom";
$categories = $category->loadList($where, $order);
// Dossier médical visibile ?
$user = CMediusers::get();
$can_view_dossier_medical = CModule::getCanDo('dPcabinet')->edit || CModule::getCanDo('dPbloc')->edit || CModule::getCanDo('dPplanningOp')->edit || $user->isFromType(array("Infirmière"));
$can_edit_prescription = $user->isPraticien() || $user->isAdmin();
// Suppression des categories vides
if (!$can_edit_prescription) {
    foreach ($categories as $_cat_id => $_category) {
        if (!array_key_exists($_cat_id, $lines)) {
            unset($categories[$_cat_id]);
        }
    }
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("sejour", $sejour);
$smarty->assign("bilan", $bilan);
$smarty->assign("categories", $categories);
$smarty->assign("prescription", $prescription);
Exemple #10
0
 *  
 * @category dPadmissions
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
$sejour_id = CValue::get("sejour_id");
$module = CValue::get("module");
$callback = CValue::get("callback");
$modify_sortie_prevue = CValue::get("modify_sortie_prevue", true);
$sejour = new CSejour();
$sejour->load($sejour_id);
$can_admission = CModule::getCanDo("dPadmissions");
if (!$sejour->canDo()->edit && !$can_admission->edit && !CModule::getCanDo("dPhospi")->edit && !CModule::getCanDo("dPurgences")->edit && !CModule::getCanDo("soins")->edit) {
    $can_admission->redirect();
}
$sejour->loadRefServiceMutation();
$sejour->loadRefEtablissementTransfert();
//Cas des urgences
if (CModule::getActive("dPurgences")) {
    $sejour->loadRefRPU()->loadRefSejourMutation();
}
$patient = $sejour->loadRefPatient();
if (CModule::getActive("maternite") && $sejour->grossesse_id) {
    $sejour->loadRefsNaissances();
    foreach ($sejour->_ref_naissances as $_naissance) {
        /** @var CNaissance $_naissance */
        $_naissance->loadRefSejourEnfant()->loadRefPatient();
    }
    // Dans le cadre où le dossier pmsi est celui de la maman
    if ($sejour->grossesse_id) {
        $sejour->canDo();
        $sejour->loadRefUFHebergement();
        $sejour->loadRefUFMedicale();
        $sejour->loadRefUFSoins();
        $sejour->loadRefService();
        $sejour->loadRefsNotes();
        $sejour->loadRefGrossesse();
        $sejour->_ref_grossesse->canDo();
        $grossesse = $sejour->_ref_grossesse;
        $grossesse->loadLastAllaitement();
        $grossesse->loadFwdRef("group_id");
        foreach ($grossesse->loadRefsNaissances() as $_naissance) {
            $_naissance->loadRefSejourEnfant();
            $_naissance->_ref_sejour_enfant->loadRelPatient();
        }
    }
} else {
    $sejour = new CSejour();
}
// Création du template
$smarty = new CSmartyDP("modules/dPpmsi");
$smarty->assign("canPatients", CModule::getCanDo("dPpatients"));
$smarty->assign("hprim21installed", CModule::getActive("hprim21"));
$smarty->assign("isImedsInstalled", CModule::getActive("dPImeds") && CImeds::getTagCIDC($group));
$smarty->assign("patient", $patient);
$smarty->assign("sejour", $sejour);
$smarty->assign("sejour_maman", $sejour_maman);
$smarty->assign("naissance", $naissance_enf);
$smarty->display("inc_vw_dossier_sejour.tpl");
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Hospi
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CModule::getCanDo("soins")->needsEdit();
$transmission_id = CValue::get("transmission_id");
$data_id = CValue::get("data_id");
$action_id = CValue::get("action_id");
$result_id = CValue::get("result_id");
$sejour_id = CValue::get("sejour_id");
$object_id = CValue::get("object_id");
$object_class = CValue::get("object_class");
$libelle_ATC = CValue::get("libelle_ATC");
$refreshTrans = CValue::get("refreshTrans", 0);
$update_plan_soin = CValue::get("update_plan_soin", 0);
$user_id = CUser::get()->_id;
$transmission = new CTransmissionMedicale();
if ($transmission_id) {
    $transmission->load($transmission_id);
} else {
    if ($data_id || $action_id || $result_id) {
        $transmission->sejour_id = $sejour_id;
        // Multi-transmissions
        if ($data_id) {
Exemple #13
0
 /**
  * @see parent::store()
  */
 function store()
 {
     $this->completeField("entree_reelle", "entree", "patient_id", "type_pec", "grossesse_id", "mode_sortie");
     /** @var CSejour $old */
     $old = $this->loadOldObject();
     // Vérification de la validité des codes CIM
     if ($this->DP != null) {
         $dp = CCodeCIM10::get($this->DP);
         if (!$dp->exist) {
             CAppUI::setMsg("Le code CIM saisi n'est pas valide", UI_MSG_WARNING);
             $this->DP = "";
         }
     }
     if ($this->DR != null) {
         $dr = CCodeCIM10::get($this->DR);
         if (!$dr->exist) {
             CAppUI::setMsg("Le code CIM saisi n'est pas valide", UI_MSG_WARNING);
             $this->DR = "";
         }
     }
     // Mode de sortie normal par défaut si l'autorisation de sortie est réalisée
     if ($this->conf("specified_output_mode") && !$this->mode_sortie && $this->fieldModified("confirme")) {
         $this->mode_sortie = "normal";
     }
     // Annulation de l'établissement de transfert si le mode de sortie n'est pas transfert
     if (null !== $this->mode_sortie) {
         if ("transfert" != $this->mode_sortie) {
             $this->etablissement_sortie_id = "";
         }
         if ("mutation" != $this->mode_sortie) {
             $this->service_sortie_id = "";
         }
     }
     // Mise à jour du type PEC si vide
     if (!$this->_id && !$this->type_pec) {
         $this->type_pec = $this->grossesse_id ? "O" : "M";
     }
     // Annulation de la sortie réelle si on annule le mode de sortie
     if ($this->mode_sortie === "") {
         $this->sortie_reelle = "";
     }
     // Annulation de l'établissement de provenance si le mode d'entrée n'est pas transfert
     if ($this->fieldModified("mode_entree")) {
         if ("7" != $this->mode_entree) {
             $this->etablissement_entree_id = "";
         }
         if ("6" != $this->mode_entree) {
             $this->service_entree_id = "";
         }
     }
     // Passage au mode transfert si on value un établissement de provenance
     if ($this->fieldModified("etablissement_entree_id")) {
         if ($this->etablissement_entree_id != null) {
             $this->mode_entree = 7;
         }
     }
     // Passage au mode mutation si on value un service de provenance
     if ($this->fieldModified("service_entree_id")) {
         if ($this->service_entree_id != null) {
             $this->mode_entree = 6;
         }
     }
     $patient_modified = $this->fieldModified("patient_id");
     // Si le patient est modifié et qu'il y a des consultations, on cascade les consultations
     if (!$this->_forwardRefMerging && $this->sejour_id && $patient_modified) {
         /** @var CConsultation[] $consultations */
         $consultations = $this->loadBackRefs("consultations");
         foreach ($consultations as $_consult) {
             $_consult->_sync_consults_from_sejour = true;
             $_consult->patient_id = $this->patient_id;
             if ($msg = $_consult->store()) {
                 return $msg;
             }
         }
     }
     // Pour un séjour non annulé, mise à jour de la date de décès du patient
     // suivant le mode de sortie
     if (!$this->annule) {
         $patient = new CPatient();
         $patient->load($this->patient_id);
         if ($this->fieldModified("mode_sortie")) {
             if ("deces" == $this->mode_sortie) {
                 $patient->deces = $this->_date_deces;
             } else {
                 if ($this->_old->mode_sortie == "deces") {
                     $patient->deces = "";
                 }
             }
         }
         // On verifie que le champ a été modifié pour faire le store (sinon probleme lors de la fusion de patients)
         if ($patient->fieldModified("deces")) {
             // Ne pas faire de return $msg ici, car ce n'est pas "bloquant"
             $patient->store();
         }
     }
     // Si annulation possible que par le chef de bloc
     if (CAppUI::conf("dPplanningOp COperation cancel_only_for_resp_bloc") && $this->fieldModified("annule", 1) && $this->entree_reelle && !CModule::getCanDo("dPbloc")->edit) {
         foreach ($this->loadRefsOperations() as $_operation) {
             if ($_operation->rank) {
                 CAppUI::setMsg("Impossible de sauvegarder : une des interventions du séjour est validée.\nContactez le responsable de bloc", UI_MSG_ERROR);
                 return null;
             }
         }
     }
     // On fixe la récusation si pas définie pour un nouveau séjour
     if (!$this->_id && ($this->recuse === "" || $this->recuse === null)) {
         $this->recuse = CAppUI::conf("dPplanningOp CSejour use_recuse") ? -1 : 0;
     }
     // no matter of config, if sejour is "urgence" type: recusation 0
     if ($this->type == "urg") {
         $this->recuse = 0;
     }
     // Si gestion en mode expert de l'isolement
     if (CAppUI::conf("dPplanningOp CSejour systeme_isolement") == "expert") {
         $this->isolement_date = $this->_isolement_date !== $this->entree && $this->isolement ? $this->_isolement_date : "";
         if (!$this->isolement) {
             $this->isolement_fin = "";
         }
     }
     $facture = null;
     if (CModule::getActive("dPfacturation") && CAppUI::conf("dPplanningOp CFactureEtablissement use_facture_etab")) {
         // Création de la facture de sejour
         $this->loadRefsFactureEtablissement();
         $facture = $this->_ref_last_facture;
         if (!$facture->_id) {
             $facture->ouverture = CMbDT::date();
         }
         if (CAppUI::conf("dPfacturation CFactureEtablissement use_temporary_bill")) {
             $facture->temporaire = 1;
         }
         $facture->group_id = $this->group_id;
         $facture->patient_id = $this->patient_id;
         $facture->praticien_id = $this->praticien_id;
         $facture->type_facture = $this->_type_sejour;
         $facture->dialyse = $this->_dialyse;
         $facture->cession_creance = $this->_cession_creance;
         $facture->statut_pro = $this->_statut_pro;
         $facture->assurance_maladie = $this->_assurance_maladie;
         $facture->assurance_accident = $this->_assurance_accident;
         $facture->rques_assurance_accident = $this->_rques_assurance_accident;
         $facture->rques_assurance_maladie = $this->_rques_assurance_maladie;
         //Store de la facture
         if ($msg = $facture->store()) {
             return $msg;
         }
     }
     $this->completeField("mode_entree_id");
     if ($this->mode_entree_id) {
         /** @var CModeEntreeSejour $mode */
         $mode = $this->loadFwdRef("mode_entree_id");
         $this->mode_entree = $mode->mode;
     }
     $this->completeField("mode_sortie_id");
     if ($this->mode_sortie_id) {
         /** @var CModeSortieSejour $mode */
         $mode = $this->loadFwdRef("mode_sortie_id");
         $this->mode_sortie = $mode->mode;
     }
     // Gestion du tarif et precodage des actes
     if ($this->_bind_tarif && $this->_id) {
         $this->getActeExecution();
         if ($msg = $this->bindTarif()) {
             return $msg;
         }
     }
     // Si on change la grossesse d'un séjour, il faut remapper les naissances éventuelles
     $change_grossesse = $this->fieldModified("grossesse_id");
     /** @var CNaissance[] $naissances */
     $naissances = array();
     if ($change_grossesse) {
         $naissances = $old->loadRefGrossesse()->loadRefsNaissances();
     }
     // Sectorisation Rules
     $this->getServiceFromSectorisationRules();
     if ($this->fieldModified("completion_sortie") && $this->completion_sortie && !$this->reception_sortie) {
         $this->reception_sortie = $this->completion_sortie;
     }
     if ($this->fieldModified("reception_sortie", "") && !$this->completion_sortie) {
         $this->completion_sortie = "";
     }
     $this->getUFs();
     $eai_sender_guid = $this->_eai_sender_guid;
     // On fait le store du séjour
     if ($msg = parent::store()) {
         return $msg;
     }
     $this->_eai_sender_guid = $eai_sender_guid;
     if ($change_grossesse) {
         foreach ($naissances as $_naissance) {
             $_naissance->grossesse_id = $this->grossesse_id;
             if ($msg = $_naissance->store()) {
                 return $msg;
             }
         }
     }
     // Changement des liaisons de prestations si besoin
     // Seulement par rapport à l'entrée
     if (CAppUI::conf("dPhospi prestations systeme_prestations", CGroups::loadCurrent()) == "expert") {
         $decalage = CMbDT::daysRelative($old->entree, $this->entree);
         if ($decalage != 0) {
             $liaisons = $this->loadBackRefs("items_liaisons");
             foreach ($liaisons as $_liaison) {
                 $_liaison->date = CMbDT::date("{$decalage} days", $_liaison->date);
                 if ($msg = $_liaison->store()) {
                     return $msg;
                 }
             }
         }
     }
     if (CModule::getActive("dPfacturation") && CAppUI::conf("dPplanningOp CFactureEtablissement use_facture_etab")) {
         if (count($this->_ref_factures) == 0) {
             $liaison = new CFactureLiaison();
             $liaison->object_id = $this->_id;
             $liaison->object_class = $this->_class;
             $liaison->facture_id = $facture->_id;
             $liaison->facture_class = "CFactureEtablissement";
             //Store de la table de liaison entre facture et séjour
             if ($msg = $liaison->store()) {
                 return $msg;
             }
         }
     }
     if ($patient_modified) {
         $list_backrefs = array("contextes_constante", "deliveries", "consultations");
         foreach ($list_backrefs as $_backname) {
             /** @var CConstantesMedicales[]|CProductDelivery[]|CConsultation[] $backobjects */
             $backobjects = $this->loadBackRefs($_backname);
             if (!$backobjects) {
                 continue;
             }
             foreach ($backobjects as $_object) {
                 if ($_object->patient_id == $this->patient_id) {
                     continue;
                 }
                 $_object->patient_id = $this->patient_id;
                 if ($_object instanceof CConsultation) {
                     $_object->_skip_count = true;
                 }
                 if ($msg = $_object->store()) {
                     CAppUI::setMsg($msg, UI_MSG_WARNING);
                 }
             }
         }
     }
     // Cas d'une annulation de séjour
     if ($this->annule) {
         // Suppression des affectations
         if ($msg = $this->delAffectations()) {
             return $msg;
         }
         // Suppression des opérations
         if ($msg = $this->cancelOperations()) {
             return $msg;
         }
         // Annulation des mouvements
         if ($msg = $this->cancelMovements()) {
             return $msg;
         }
     }
     // Synchronisation des affectations
     if (!$this->_no_synchro && !($this->type == "seances")) {
         $this->loadRefsAffectations();
         $firstAff =& $this->_ref_first_affectation;
         $lastAff =& $this->_ref_last_affectation;
         // Cas où on a une premiere affectation différente de l'heure d'admission
         if ($firstAff->_id && $firstAff->entree != $this->_entree) {
             $firstAff->entree = $this->_entree;
             $firstAff->_no_synchro = 1;
             $firstAff->store();
         }
         // Cas où on a une dernière affectation différente de l'heure de sortie
         if ($lastAff->_id && $lastAff->sortie != $this->_sortie) {
             $lastAff->sortie = $this->_sortie;
             $lastAff->_no_synchro = 1;
             $lastAff->store();
         }
         //si le sejour a une sortie ==> compléter le champ effectue de la derniere affectation
         if ($lastAff->_id) {
             $this->_ref_last_affectation->effectue = $this->sortie_reelle ? 1 : 0;
             $this->_ref_last_affectation->store();
         }
     }
     // try to assign an affectation
     $this->createAffectationLitUnique();
     $this->createAffectationService();
     // Génération du NDA ?
     if ($this->_generate_NDA) {
         // On ne synchronise pas un séjour d'urgences qui est un reliquat
         $rpu = $this->loadRefRPU();
         if ($rpu && $rpu->mutation_sejour_id && $rpu->sejour_id != $rpu->mutation_sejour_id) {
             return null;
         }
         if ($msg = $this->generateNDA()) {
             return $msg;
         }
     }
     return null;
 }
Exemple #14
0
<?php

/**
 * Mediuser
 *
 * @category Mediusers
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id: do_mediusers_aed.php 19463 2013-06-07 10:36:29Z lryo $
 * @link     http://www.mediboard.org
 */
// we don't allow anybody to change his user type or profile
if ($_POST["user_id"] && !CAppUI::$user->isAdmin() && !CModule::getCanDo("admin")->admin) {
    unset($_POST['_user_type']);
    unset($_POST['_profile_id']);
}
/**
 * Class CDoMediuserAddEdit
 */
class CDoMediuserAddEdit extends CDoObjectAddEdit
{
    /**
     * Construct
     *
     * @return void
     */
    function CDoMediuserAddEdit()
    {
        $this->CDoObjectAddEdit("CMediusers", "user_id");
    }
 /**
  * @see parent::checkCoded()
  */
 function checkCoded()
 {
     if (CAppUI::conf('dPccam CCodeCCAM use_new_association_rules')) {
         $this->loadRefCodageCCAM();
         if ($this->_ref_codage_ccam->_id && $this->_ref_codage_ccam->locked && !CModule::getCanDo('dPpmsi')->edit) {
             return "Codage CCAM verrouillé, impossible de modifier l'acte";
         }
     }
     return parent::checkCoded();
 }
 /**
  * @see parent::check()
  */
 public function check()
 {
     $this->completeField('codable_class', 'codable_id', 'praticien_id', 'association_mode', 'association_rule', 'locked', 'activite_anesth', 'date');
     $this->loadOldObject();
     $codable = $this->loadCodable();
     if ($codable->_class == 'CConsultation') {
         $codable->loadRefPlageConsult();
         if ($this->date != $codable->_date) {
             return 'Impossible de créer un codage CCAM a une date différente de celle de la consultation';
         }
     }
     if ($codable->_class == 'COperation') {
         if ($this->date != $codable->date) {
             return 'Impossible de créer un codage CCAM a une date différente de celle de l\'intervention';
         }
     }
     if ($this->_old->locked && $this->locked && !CModule::getCanDo('dPpmsi')->edit) {
         return "Codage verrouillé";
     }
     if (!$this->_id || $this->fieldModified('association_mode', 'auto')) {
         $this->guessRule();
     }
     if (!$this->_id || $this->fieldModified('association_rule')) {
         $this->applyRuleToActes();
     }
     return parent::check();
 }
}
$sejour->loadRefPrescriptionSejour();
$sejour->loadRefCurrAffectation();
$sejour->loadRefsOperations();
$dossier_medical_sejour = $sejour->loadRefDossierMedical();
$dossier_medical_sejour->loadRefsAntecedents();
$patient = $sejour->loadRefPatient();
$patient->loadRefPhotoIdentite();
$patient->loadRefLatestConstantes();
$dossier_medical = $patient->loadRefDossierMedical();
$dossier_medical->loadRefsAntecedents();
$dossier_medical->loadRefsAllergies();
$dossier_medical->countAntecedents();
$dossier_medical->countAllergies();
//droits d'édition
$editRights = CModule::getCanDo("dPhospi")->edit;
$duree = strtotime($sejour->sortie) - strtotime($sejour->entree);
$affectations = $sejour->loadRefsAffectations();
$date_temp = CMbDT::date($sejour->entree);
while ($date_temp <= CMbDT::date($sejour->sortie)) {
    if (!isset($dates[$date_temp])) {
        $dates[$date_temp] = 0;
    }
    $date_temp = CMbDT::date("+1 day", $date_temp);
}
if (count($affectations)) {
    $lits = CMbObject::massLoadFwdRef($affectations, "lit_id");
    CMbObject::massLoadFwdRef($lits, "chambre_id");
    foreach ($affectations as $_affectation) {
        $_affectation->loadRefLit()->loadCompleteView();
        $_affectation->_rowspan = CMbDT::daysRelative($_affectation->entree, $_affectation->sortie) + 1;
Exemple #18
0
/**
 * $Id$
 *  
 * @package    Mediboard
 * @subpackage messagerie
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 * @link       http://www.mediboard.org
 */
$user = CMediusers::get();
$source_smtp = CExchangeSource::get("mediuser-" . $user->_id, "smtp", true, null, false);
$source_pop = new CSourcePOP();
$source_pop->object_class = $user->_class;
$source_pop->object_id = $user->_id;
$source_pop->name = 'SourcePOP-' . $user->_id . '-' . ($source_pop->countMatchingList() + 1);
$mssante = false;
if (CModule::getActive('mssante') && CModule::getCanDo('mssante')->read) {
    $mssante = true;
}
$apicrypt = false;
if (CModule::getActive('apicrypt') && CModule::getCanDo('apicrypt')->read) {
    $apicrypt = true;
}
$smarty = new CSmartyDP();
$smarty->assign('source_smtp', $source_smtp);
$smarty->assign('source_pop', $source_pop);
$smarty->assign('mssante', $mssante);
$smarty->assign('apicrypt', $apicrypt);
$smarty->display('inc_add_account.tpl');
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Cabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::check();
if (!CModule::getCanDo('dPcabinet')->edit && !CModule::getCanDo('soins')->read) {
    CModule::getCanDo('dPcabinet')->redirect();
}
$date = CValue::getOrSession("date", CMbDT::date());
$print = CValue::getOrSession("print", false);
$today = CMbDT::date();
$dossier_anesth_id = CValue::get("dossier_anesth_id");
$operation_id = CValue::getOrSession("operation_id");
$create_dossier_anesth = CValue::get("create_dossier_anesth", 1);
$multi = CValue::get("multi");
$offline = CValue::get("offline");
$display = CValue::get("display");
$pdf = CValue::get("pdf", 1);
$lines = array();
$lines_per_op = array();
// Consultation courante
$dossier_anesth = new CConsultAnesth();
if (!$dossier_anesth_id) {
    $where = array();
Exemple #20
0
 /**
  * Calcul l'aspect confidentiel du patient
  *
  * @return bool on a accès ou pas
  */
 function checkVIP()
 {
     if ($this->_vip !== null) {
         return;
     }
     $this->_vip = false;
     $user = CMediusers::get();
     if ($this->vip && !CModule::getCanDo("dPpatient")->admin()) {
         // Test si le praticien est présent dans son dossier
         $praticiens = $this->loadRefsPraticiens();
         $user_in_list_prat = array_key_exists($user->_id, $praticiens);
         // Test si un l'utilisateur est présent dans les logs
         $user_in_logs = false;
         $this->loadLogs();
         foreach ($this->_ref_logs as $_log) {
             if ($user->_id == $_log->user_id) {
                 $user_in_logs = true;
                 break;
             }
         }
         $this->_vip = !$user_in_list_prat && !$user_in_logs;
     }
     if ($this->_vip) {
         CValue::setSession("patient_id", 0);
     }
 }
        $smarty->assign("line", $line);
        $smarty->assign("line_id", $line->_id);
        $smarty->assign("line_class", $line->_class);
        $smarty->assign("transmissions_line", $line->_transmissions);
        $smarty->assign("administrations_line", $line->_administrations);
        $smarty->assign("unite_prise", $unite_prise);
        $smarty->display("../../dPprescription/templates/inc_vw_content_line_dossier_soin.tpl");
    }
} else {
    // Affichage d'un chapitre
    if ($chapitre) {
        $smarty->assign("move_dossier_soin", false);
        $smarty->assign("chapitre", $chapitre);
        $smarty->assign("nodebug", true);
        $smarty->display("../../dPprescription/templates/inc_chapitre_dossier_soin.tpl");
    } else {
        // Affichage du plan de soin complet
        if (CModule::getActive("dPprescription")) {
            // Multiple prescriptions existante pour le séjour (Fusion des prescriptions)
            $prescription_multiple = new CPrescription();
            $where = array("type" => " = 'sejour'", "object_class" => " = 'CSejour'", "object_id" => " = '{$prescription->object_id}'");
            $multiple_prescription = $prescription_multiple->loadIds($where);
            $smarty->assign("multiple_prescription", $multiple_prescription);
        }
        $sejour->countTasks();
        $sejour->countAlertsNotHandled("medium", "observation");
        $smarty->assign("admin_prescription", CModule::getCanDo("dPprescription")->admin || CMediusers::get()->isPraticien());
        $smarty->assign("move_dossier_soin", false);
        $smarty->display("inc_vw_dossier_soins.tpl");
    }
}
}
foreach ($listPlages as &$element) {
    foreach ($element["plages"] as &$plage) {
        /** @var  CPlageconsult $plage */
        $plage->_ref_chir =& $element["anesthesiste"];
        $plage->loadRefsBack();
        foreach ($plage->_ref_consultations as $keyConsult => &$consultation) {
            if ($consultation->chrono == CConsultation::TERMINE) {
                unset($plage->_ref_consultations[$keyConsult]);
                continue;
            }
            $consultation->loadRefSejour();
            $consultation->loadRefPatient();
            $consultation->loadRefCategorie();
            $consultation->countDocItems();
        }
    }
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("consult", $consult);
$smarty->assign("listPlages", $listPlages);
$smarty->assign("date", $date);
$smarty->assign("today", $today);
$smarty->assign("hour", $hour);
$smarty->assign("anesthesistes", $anesthesistes);
$smarty->assign("cabinets", $cabinets);
$smarty->assign("board", $board);
$smarty->assign("boardItem", $boardItem);
$smarty->assign("canCabinet", CModule::getCanDo("dPcabinet"));
$smarty->display("vw_idx_consult.tpl");
Exemple #23
0
$accounts_user = $account->loadList($where, null, null, null, $ljoin);
/** @var CSourcePOP[] $pop_accounts */
$pop_accounts = $account->loadList($where, null, null, null, $ljoin);
$apicrypt_account = false;
if (CModule::getActive('apicrypt')) {
    $apicrypt_account = new CSourcePOP();
    $where = array();
    $apicrypt_account->object_class = 'CMediusers';
    $apicrypt_account->object_id = $selected_user->_id;
    $apicrypt_account->name = "SourcePOP-{$selected_user->_id}-apicrypt";
    //if user connected, show the private source pop
    if ($current_user->_id != $selected_user->_id) {
        $apicrypt_account->is_private = '0';
    }
    $apicrypt_account->loadMatchingObject();
    if (!$apicrypt_account->_id) {
        $apicrypt_account = null;
    }
}
$mssante_account = false;
if (CModule::getActive('mssante') && CModule::getCanDo('mssante')->read) {
    $mssante_account = CMSSanteUserAccount::getAccountFor($selected_user);
}
$smarty = new CSmartyDP('modules/messagerie');
$smarty->assign('user', $current_user);
$smarty->assign('selected_user', $selected_user);
$smarty->assign('users_list', $users);
$smarty->assign('pop_accounts', $accounts_user);
$smarty->assign('apicrypt_account', $apicrypt_account);
$smarty->assign('mssante_account', $mssante_account);
$smarty->display('vw_messagerie.tpl');