/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage SalleOp
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
// @todo bloc n'est pas forcément actif
global $can;
$can->read |= CModule::getActive("dPbloc")->_can->read;
$can->needsRead();
$operation_id = CValue::getOrSession("operation_id", null);
$operation = new COperation();
$operation->load($operation_id);
$operation->loadRefsAnesthPerops();
$operation->loadRefsFwd();
$operation->loadRefsActesCCAM();
foreach ($operation->_ref_actes_ccam as $acte) {
    $acte->loadRefsFwd();
}
$operation->loadAffectationsPersonnel();
if (CAppUI::conf('dPccam CCodeCCAM use_new_association_rules')) {
    $operation->guessActesAssociation();
} else {
    foreach ($operation->_ref_actes_ccam as $acte) {
        $acte->guessAssociation();
    }
}
$operation->loadRefSortieLocker()->loadRefFunction();
Exemple #2
0
 *
 * @package    Mediboard
 * @subpackage SalleOp
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 24175 $
 */
CCanDo::checkRead();
$ds = CSQLDataSource::get("std");
$op = CValue::getOrSession("op");
$date = CValue::getOrSession("date", CMbDT::date());
$consultAnesth = new CConsultAnesth();
$consult = new CConsultation();
$userSel = new CMediusers();
$operation = new COperation();
$operation->load($op);
$operation->loadRefChir();
$operation->loadRefSejour();
$consult_anesth = $operation->loadRefsConsultAnesth();
if ($consult_anesth->_id) {
    $consult_anesth->loadRefConsultation();
    $consult = $consult_anesth->_ref_consultation;
    $consult->_ref_consult_anesth = $consultAnesth;
    $consult->loadRefPlageConsult();
    $consult->loadRefsDocItems();
    $consult->loadRefPatient();
    $prat_id = $consult->_ref_plageconsult->chir_id;
    $consult_anesth->loadRefs();
    // On charge le praticien
    $userSel->load($prat_id);
    $userSel->loadRefs();
<?php

/**
 * $Id:$
 *
 * @package    Mediboard
 * @subpackage bloodSalvage
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision:$
 */
CAppUI::requireModuleFile("bloodSalvage", "inc_personnel");
$selOp = new COperation();
$blood_salvage = new CBloodSalvage();
$date = CValue::getOrSession("date", CMbDT::date());
$op = CValue::getOrSession("op");
if ($op) {
    $selOp->load($op);
    $selOp->loadRefs();
    $where = array();
    $where["operation_id"] = "='{$selOp->_id}'";
    $blood_salvage->loadObject($where);
    $blood_salvage->loadRefsFwd();
    $blood_salvage->loadRefPlageOp();
}
$smarty = new CSmartyDP();
$smarty->assign("date", $date);
$smarty->assign("blood_salvage", $blood_salvage);
$smarty->assign("selOp", $selOp);
$smarty->display("vw_bloodSalvage_sspi.tpl");
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage SalleOp
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
$operation_id = CValue::get("operation_id");
$interv = new COperation();
$interv->load($operation_id);
$interv->loadRefSejour()->loadRefPatient()->loadRefLatestConstantes();
$interv->loadRefPlageOp();
$interv->_ref_sejour->_ref_patient->loadRefDossierMedical();
$consult_anesth = $interv->loadRefsConsultAnesth();
$group = CGroups::loadCurrent();
$pack = $interv->loadRefGraphPack();
list($graphs, $yaxes_count, $time_min, $time_max, $time_debut_op_iso, $time_fin_op_iso) = CObservationResultSet::buildGraphs($interv, $pack->_id);
$time_debut_op = CMbDate::toUTCTimestamp($time_debut_op_iso);
$time_fin_op = CMbDate::toUTCTimestamp($time_fin_op_iso);
$evenements = CObservationResultSet::buildEventsGrid($interv, $time_debut_op_iso, $time_fin_op_iso, $time_min, $time_max);
$now = 100 * (CMbDate::toUTCTimestamp(CMbDT::dateTime()) - $time_min) / ($time_max - $time_min);
$graph_packs = CSupervisionGraphPack::getAllFor($group);
$concentrators = null;
if (CModule::getActive("patientMonitoring")) {
    $concentrator = new CMonitoringConcentrator();
    $concentrators = $concentrator->loadList();
    $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);
            $actes = CMbArray::pluck($object->_ref_actes_ccam, "code_acte");
            foreach ($object->_ref_actes_ccam as $acte_ccam) {
                $acte_ccam->loadRefsFwd();
            }
            // Suppression des actes non codés
            if (CAppUI::conf("dPsalleOp CActeCCAM del_actes_non_cotes")) {
                foreach ($codes as $_key => $_code) {
                    $key = array_search($_code, $actes);
                    if ($key === false) {
                        unset($codes[$_key]);
                    }
                }
            }
$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();
    $where["operation_id"] = " = '{$operation_id}'";
    $dossier_anesth->loadObject($where);
} else {
    $dossier_anesth->load($dossier_anesth_id);
}
if (!$dossier_anesth->_id) {
    $selOp = new COperation();
    $selOp->load($operation_id);
    $selOp->loadRefsFwd();
    $selOp->_ref_sejour->loadRefsFwd();
    $selOp->_ref_sejour->loadRefsConsultAnesth();
    $selOp->_ref_sejour->_ref_consult_anesth->loadRefsFwd();
    $patient = $selOp->_ref_sejour->_ref_patient;
    $patient->loadRefsConsultations();
    // Chargement des praticiens
    $listAnesths = array();
    if ($offline == "false") {
        $anesths = new CMediusers();
        $listAnesths = $anesths->loadAnesthesistes(PERM_READ);
    }
    foreach ($patient->_ref_consultations as $consultation) {
        $consultation->loadRefConsultAnesth();
        foreach ($consultation->_refs_dossiers_anesth as $_dossier_anesth) {
     if ($sejour_filled) {
         $sejour = new CSejour();
         $sejour->load($_result["sejour_id"]);
         $pat->_distant_object = $sejour;
         $pat->_age_epoque = intval(CMbDT::daysRelative($pat->naissance, $sejour->entree) / 365);
     } else {
         if ($consult_filled) {
             $consult = new CConsultation();
             $consult->load($_result["consultation_id"]);
             $pat->_distant_object = $consult;
             $consult->loadRefPlageConsult();
             $pat->_age_epoque = intval(CMbDT::daysRelative($pat->naissance, $consult->_ref_plageconsult->date) / 365);
         } else {
             if ($interv_filled) {
                 $interv = new COperation();
                 $interv->load($_result["operation_id"]);
                 $interv->loadRefPlageOp();
                 $pat->_distant_object = $interv;
                 $pat->_age_epoque = intval(CMbDT::daysRelative($pat->naissance, $interv->_datetime_best) / 365);
             }
         }
     }
     $list_patient[] = $pat;
 }
 // Le count total
 $request->select = array("count(*)");
 $request->limit = null;
 $count_patient = $ds->loadResult($request->makeSelect());
 if (!$commentaire && $one_field_presc) {
     $request_b->select = array("count(*)");
     $request_b->limit = null;
 /**
  * @see parent::store()
  */
 function store()
 {
     $this->completeField("operation_id");
     if ($this->operation_id && $this->fieldModified("operation_id")) {
         $op = new COperation();
         $op->load($this->operation_id);
         $this->sejour_id = $op->sejour_id;
         if (CModule::getActive("maternite")) {
             $sejour = $op->loadRefSejour();
             if ($sejour->grossesse_id) {
                 $consult = $this->loadRefConsultation();
                 $consult->grossesse_id = $sejour->grossesse_id;
                 if ($msg = $consult->store()) {
                     return $msg;
                 }
             }
         }
     }
     return parent::store();
 }
 /**
  * Enregistrement des interventions
  * 
  * @param CHPrimXMLAcquittementsServeurActivitePmsi $dom_acq  DOM Acquittement
  * @param CMbObject                                 $mbObject Object
  * @param array                                     $data     Data that contain the nodes
  * 
  * @return string Acquittement 
  **/
 function handle(CHPrimXMLAcquittementsServeurActivitePmsi $dom_acq, CMbObject $mbObject, $data)
 {
     $operation = $mbObject;
     $exchange_hprim = $this->_ref_echange_hprim;
     $sender = $exchange_hprim->_ref_sender;
     $sender->loadConfigValues();
     $this->_ref_sender = $sender;
     $warning = null;
     $comment = null;
     // Acquittement d'erreur : identifiants source du patient / séjour non fournis
     if (!$data['idSourcePatient'] || !$data['idSourceVenue']) {
         return $exchange_hprim->setAckError($dom_acq, "E206", null, $mbObject);
     }
     // IPP non connu => message d'erreur
     $IPP = CIdSante400::getMatch("CPatient", $sender->_tag_patient, $data['idSourcePatient']);
     if (!$IPP->_id) {
         return $exchange_hprim->setAckError($dom_acq, "E013", null, $mbObject);
     }
     // Chargement du patient
     $patient = new CPatient();
     $patient->load($IPP->object_id);
     // Num dossier non connu => message d'erreur
     $NDA = CIdSante400::getMatch("CSejour", $sender->_tag_sejour, $data['idSourceVenue']);
     if (!$NDA->_id) {
         return $exchange_hprim->setAckError($dom_acq, "E014", null, $mbObject);
     }
     // Chargement du séjour
     $sejour = new CSejour();
     $sejour->load($NDA->object_id);
     // Si patient H'XML est différent du séjour
     if ($sejour->patient_id != $patient->_id) {
         return $exchange_hprim->setAckError($dom_acq, "E015", null, $mbObject);
     }
     // Chargement du patient du séjour
     $sejour->loadRefPatient();
     $operation->sejour_id = $sejour->_id;
     // Mapping du séjour
     $sejour = $this->mappingVenue($data['venue'], $sejour);
     // Notifier les autres destinataires autre que le sender
     $sejour->_eai_sender_guid = $sender->_guid;
     /* TODO Supprimer ceci après l'ajout des times picker */
     $sejour->_hour_entree_prevue = null;
     $sejour->_min_entree_prevue = null;
     $sejour->_hour_sortie_prevue = null;
     $sejour->_min_sortie_prevue = null;
     if ($msgVenue = $sejour->store()) {
         return $exchange_hprim->setAck($dom_acq, "A102", $msgVenue, null, $sejour);
     }
     // idex de l'intervention
     $idex = CIdSante400::getMatch("COperation", $sender->_tag_hprimxml, $data['idSourceIntervention']);
     if ($idex->_id) {
         $operation_source = new COperation();
         $operation_source->load($idex->object_id);
         if ($operation_source->sejour_id != $sejour->_id) {
             return $exchange_hprim->setAckError($dom_acq, "E204", null, $mbObject);
         }
         $operation = $operation_source;
     }
     // ID Mediboard de l'intervention
     if ($data['idCibleIntervention']) {
         $operation_source = new COperation();
         $operation_source->load($data['idCibleIntervention']);
         if ($operation_source->sejour_id != $sejour->_id) {
             return $exchange_hprim->setAckError($dom_acq, "E204", null, $mbObject);
         }
         if ($idex->_id && $operation->_id != $operation_source->_id) {
             return $exchange_hprim->setAckError($dom_acq, "E205", null, $mbObject);
         }
         $operation = $operation_source;
     }
     // Recherche de la salle
     $salle = $this->getSalle($data['intervention'], $sejour);
     if ($salle->nom && !$salle->_id) {
         $comment = "Salle '{$salle->nom}' inconnue dans l'infrastructure de l'établissement";
         return $exchange_hprim->setAckError($dom_acq, "E202", $comment, $mbObject);
     }
     $operation->salle_id = $salle->_id;
     // Mapping du chirurgien
     $mediuser = $this->getParticipant($data['intervention'], $sejour);
     if ($mediuser->adeli && !$mediuser->_id || !$mediuser->adeli) {
         $comment = $mediuser->adeli ? "Participant '{$mediuser->adeli}' inconnu" : "Le code ADELI n'est pas renseigné";
         return $exchange_hprim->setAckError($dom_acq, "E203", $comment, $mbObject);
     }
     $operation->chir_id = $mediuser->_id;
     // Mapping de la plage
     $this->mappingPlage($data['intervention'], $operation);
     $plageop_id = $operation->plageop_id;
     // Recherche d'une intervention existante sinon création
     if (!$operation->_id) {
         $operation->loadMatchingObject();
     }
     // Si pas trouvé on recherche en hors plage
     if (!$operation->_id) {
         $operation->loadRefPlageOp();
         $operation->plageop_id = null;
         $operation->temp_operation = null;
         $operation->time_operation = null;
         $operation->date = $operation->_ref_plageop->_id ? $operation->_ref_plageop->date : $operation->date;
         if ($operation->countMatchingList() == 1) {
             $operation->loadMatchingObject();
         }
         if (!$operation->_id && $plageop_id) {
             $operation->plageop_id = $plageop_id;
             $operation->date = null;
         }
     }
     // Mapping de l'intervention
     $this->mappingIntervention($data, $operation);
     // Store de l'intervention
     // Notifier les autres destinataires autre que le sender
     $operation->_eai_sender_guid = $sender->_guid;
     $msgInterv = $operation->store();
     CEAIMbObject::storeIdex($idex, $operation, $sender);
     $modified_fields = CEAIMbObject::getModifiedFields($operation);
     $codes = array($msgInterv ? "A201" : "I201");
     if ($msgInterv) {
         $warning .= $msgInterv . " ";
     } else {
         $comment .= "Intervention : {$operation->_id}.";
         $comment .= $modified_fields ? " Les champs mis à jour sont les suivants : {$modified_fields}." : null;
     }
     return $exchange_hprim->setAck($dom_acq, $codes, $warning, $comment, $operation);
 }
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage PlanningOp
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$copy_operation_id = CValue::post("copy_operation_id");
$date = CValue::post("date");
$salle_id = CValue::post("salle_id");
$sejour_id = CValue::post("sejour_id");
$time_operation = CValue::post("time_operation");
$operation = new COperation();
$operation->load($copy_operation_id);
$operation->_id = $operation->_time_urgence = null;
$operation->date = $date;
$operation->salle_id = $salle_id;
$operation->sejour_id = $sejour_id;
$operation->time_operation = $time_operation;
$msg = $operation->store();
CAppUI::setMsg($msg ? $msg : CAppUI::tr("COperation-msg-modify"), $msg ? UI_MSG_ERROR : UI_MSG_OK);
CAppUI::getMsg();
CApp::rip();
 /**
  * @see parent::store()
  */
 function store()
 {
     $this->completeField("operation_id");
     if ($this->operation_id && $this->fieldModified("operation_id")) {
         $op = new COperation();
         $op->load($this->operation_id);
         $this->sejour_id = $op->sejour_id;
     }
     return parent::store();
 }
 * @subpackage dPbloc
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkEdit();
$type = CValue::get("type");
$object_id = CValue::get("object_id");
$usage = CValue::get("usage", 0);
$besoin = new CBesoinRessource();
$besoin->{$type} = $object_id;
/** @var CBesoinRessource[] $besoins */
$besoins = $besoin->loadMatchingList();
CMbObject::massLoadFwdRef($besoins, "type_ressource_id");
$operation = new COperation();
$operation->load($object_id);
$operation->loadRefPlageOp();
$deb_op = $operation->_datetime;
$fin_op = CMbDT::addDateTime($operation->temp_operation, $deb_op);
foreach ($besoins as $_besoin) {
    $_besoin->loadRefTypeRessource();
    $_besoin->loadRefUsage();
    // Côté protocole, rien à vérifier
    if ($type != "operation_id") {
        $_besoin->_color = "";
        continue;
    }
    $_besoin->isAvailable();
}
$smarty = new CSmartyDP();
$smarty->assign("besoins", $besoins);