* @package    Mediboard
 * @subpackage dPbloc
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision:$
 */
CCanDo::checkEdit();
$plageop_id = CValue::get("plageop_id");
$list_type = CValue::get("list_type", "left");
$anesth = new CTypeAnesth();
$anesth = $anesth->loadGroupList();
// Infos sur la plage opératoire
$plage = new CPlageOp();
$plage->load($plageop_id);
$plage->loadRefsFwd();
$intervs = $plage->loadRefsOperations(true, "rank, rank_voulu, horaire_voulu", true, $list_type != "left");
$chirs = CMbObject::massLoadFwdRef($intervs, "chir_id");
CMbObject::massLoadFwdRef($chirs, "function_id");
$sejours = CMbObject::massLoadFwdRef($intervs, "sejour_id");
CMbObject::massLoadFwdRef($sejours, "patient_id");
foreach ($intervs as $_interv) {
    $_interv->loadRefsFwd();
    $_interv->_ref_chir->loadRefFunction();
    $_interv->_ref_sejour->loadRefsFwd();
    $_interv->_count_affectations_personnel = $_interv->countBackRefs("affectations_personnel");
    $patient = $_interv->_ref_sejour->_ref_patient;
    $patient->loadRefDossierMedical();
    $patient->_ref_dossier_medical->countAllergies();
}
// liste des plages du praticien
$where = array("date" => "= '{$plage->date}'", "chir_id" => "= '{$plage->chir_id}'");
Exemple #2
0
 /**
  * @see parent::store()
  */
 function store()
 {
     $this->updatePlainFields();
     $this->completeField("chir_id", "spec_id");
     $old = new CPlageOp();
     if ($this->_id) {
         $old->load($this->_id);
         $old->loadRefsOperations();
     }
     // Pas de changement de date si on a déjà des interventions
     if ($this->fieldModified("date") && count($old->_ref_operations)) {
         return CAppUI::tr("CPlageOp-failed-change_date", count($old->_ref_operations));
     }
     // Erreur si on est en multi-praticiens, qu'il y a des interventions et qu'on veut mettre un praticien
     if ($this->fieldValued("chir_id") && !$this->unique_chir && $old->spec_id && count($old->_ref_operations)) {
         mbTrace("all the same to me");
     }
     if (null !== $this->chir_id && $this->_id && !$this->unique_chir) {
         if (count($old->_ref_operations) && $old->spec_id && $this->chir_id) {
             return CAppUI::tr("CPlageOp-failed-multi_chir", count($old->_ref_operations));
         }
     }
     // Si on change de praticien alors qu'il y a déjà des interventions
     if ($this->fieldAltered("chir_id") && count($old->_ref_operations)) {
         // Si certaines ne sont pas annulées, on sort
         if ($this->countOperationsAnnulees() != count($old->_ref_operations)) {
             return CAppUI::tr("CPlageOp-failed-change_chir", count($old->_ref_operations));
         }
         // Si toutes les interventions sont annulées, on les met hors plage
         $this->completeField("salle_id", "date");
         foreach ($old->_ref_operations as $_op) {
             $_op->plageop_id = "";
             $_op->date = $this->date;
             $_op->salle_id = $this->salle_id;
             $_op->store();
         }
     }
     // Erreur si on créé-modifie une plage sur une salle bloquée
     $salle = $this->loadRefSalle();
     if (count($salle->loadRefsBlocages($this->date))) {
         return CAppUI::tr("CPlageOp-failed-use_locked_room", $salle->_view);
     }
     // Modification du salle_id de la plage -> repercussion sur les interventions
     if ($this->fieldModified("salle_id")) {
         foreach ($old->_ref_operations as $_operation) {
             if ($_operation->salle_id == $old->salle_id) {
                 $_operation->salle_id = $this->salle_id;
                 $_operation->store(false);
             }
         }
     }
     // Modification du début de la plage ou des minutes entre les interventions
     $this->completeField("debut", "temps_inter_op");
     if ($this->fieldModified("debut") || $this->fieldModified("temps_inter_op")) {
         if ($this->fieldModified("temps_inter_op")) {
             $with_cancelled = CAppUI::conf("dPplanningOp COperation save_rank_annulee_validee");
             $this->loadRefsOperations($with_cancelled, "rank, rank_voulu, horaire_voulu", true);
         }
         $this->reorderOp();
     }
     if (!$this->_id || !$this->original_owner_id && !$this->original_function_id) {
         $this->original_owner_id = $this->chir_id;
         $this->original_function_id = $this->spec_id;
     }
     return parent::store();
 }
<?php

/**
 * dPbloc
 *
 * @category Bloc
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:$
 * @link     http://www.mediboard.org
 */
$plageop_id = CValue::post("plageop_id");
$plageop = new CPlageOp();
$plageop->load($plageop_id);
$plageop->loadRefsOperations(false, "rank, rank_voulu, horaire_voulu", true);
foreach ($plageop->_ref_operations as $_id => $_interv) {
    if (!$_interv->rank && !$_interv->rank_voulu && !$_interv->horaire_voulu) {
        unset($plageop->_ref_operations[$_id]);
    }
}
if (!empty($plageop->_ref_operations)) {
    $plageop->reorderOp(CPlageOp::RANK_VALIDATE);
}
CAppUI::stepAjax("Placement effectué");
CApp::rip();
Exemple #4
0
<?php

/**
 * $Id$
 *  
 * @category Cabinet
 * @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
 */
CCanDo::checkRead();
$plage_id = CValue::get("plage_id");
$object = new CPlageOp();
$object->load($plage_id);
$object->loadRefsNotes();
$object->loadRefChir()->loadRefFunction();
$object->loadRefAnesth()->loadRefFunction();
$object->loadRefSpec();
$object->loadRefsOperations();
$object->loadRefSalle();
foreach ($object->_ref_operations as $_op) {
    $_op->loadRefPatient()->loadRefPhotoIdentite();
}
// smarty
$smarty = new CSmartyDP();
$smarty->assign("object", $object);
$smarty->display("inc_vw_plageop.tpl");
/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage PlanningOp
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
$chir_id = CValue::get("chir_id");
$plageop = new CPlageOp();
$plageop->load(CValue::get("plageop_id"));
$plageop->loadRefSalle();
$where = array("chir_id" => "= '{$chir_id}'");
$plageop->loadRefsOperations(false, null, true, null, $where);
$plageop->guessHoraireVoulu();
$rank_validated = array();
$rank_not_validated = array();
$_op = new COperation();
$_last_op = null;
foreach ($plageop->_ref_operations as $_op) {
    $_op->loadRefChir()->loadRefFunction();
    $_op->loadRefSejour()->loadRefPatient()->loadRefDossierMedical()->countAllergies();
    $_op->loadExtCodesCCAM();
    if ($_op->_horaire_voulu) {
        $_last_op = $_op;
    }
}
$horaire_voulu = $plageop->debut;
if ($_last_op) {