Esempio n. 1
0
 /**
  * Création des consults anesth liées à des consults d'anesthésistes
  *
  * @return bool
  */
 protected function consultAnesth()
 {
     $ds = $this->ds;
     $utypes_flip = array_flip(CUser::$types);
     $id_anesth = $utypes_flip["Anesthésiste"];
     $query = "SELECT users.user_id\r\n                  FROM users, users_mediboard\r\n                  WHERE users.user_id = users_mediboard.user_id\r\n                  AND users.user_type='{$id_anesth}'";
     $result = $ds->loadList($query);
     $listAnesthid = array();
     foreach ($result as $keyresult => $resultAnesth) {
         $listAnesthid[$keyresult] = $result[$keyresult]["user_id"];
     }
     $in_anesth = CSQLDataSource::prepareIn($listAnesthid);
     $query = "SELECT consultation.consultation_id FROM consultation\r\n                  LEFT JOIN consultation_anesth ON consultation.consultation_id = consultation_anesth.consultation_id\r\n                  LEFT JOIN plageconsult ON consultation.plageconsult_id = plageconsult.plageconsult_id\r\n                  WHERE plageconsult.chir_id {$in_anesth} AND consultation_anesth.consultation_anesth_id IS NULL";
     $result = $ds->loadList($query);
     foreach ($result as $keyresult => $resultAnesth) {
         $consultAnesth = new CConsultAnesth();
         $consultAnesth->consultation_anesth_id = 0;
         $consultAnesth->consultation_id = $result[$keyresult]["consultation_id"];
         $consultAnesth->store();
     }
     return true;
 }
 * @link     http://www.mediboard.org
 */
$dossier_anesth_id = CValue::post("_consult_anesth_id");
$sejour_id = CValue::post("sejour_id");
$operation_id = CValue::post("operation_id");
$redirect = CValue::post("redirect", 1);
$consult_anesth = new CConsultAnesth();
$consult_anesth->load($dossier_anesth_id);
$consult_anesth->_id = $consult_anesth->operation_id = $consult_anesth->sejour_id = null;
if ($sejour_id) {
    $consult_anesth->sejour_id = $sejour_id;
}
if ($operation_id) {
    $consult_anesth->operation_id = $operation_id;
}
$msg = $consult_anesth->store();
$represcription = 0;
if ($msg) {
    CAppUI::setMsg($msg);
} else {
    CAppUI::setMsg(CAppUI::tr("CConsultAnesth-msg-duplicate"));
    //Création de la prescription de séjour selon pref user
    if ($consult_anesth->sejour_id && CAppUI::pref("show_replication_duplicate")) {
        $prescription = new CPrescription();
        $prescription->object_class = 'CSejour';
        $prescription->object_id = $consult_anesth->sejour_id;
        $prescription->type = 'sejour';
        if (!$prescription->loadMatchingObject()) {
            if ($msg = $prescription->store()) {
                CAppUI::setMsg($msg, UI_MSG_ERROR);
            }
<?php

/**
 * $Id$
 * 
 * @package    Mediboard
 * @subpackage dPcabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$consult_id = CValue::post("consult_id");
$dossier_anesth = new CConsultAnesth();
$dossier_anesth->consultation_id = $consult_id;
if ($msg = $dossier_anesth->store()) {
    CAppUI::setMsg($msg, UI_MSG_ERROR);
} else {
    CAppUI::setMsg(CAppUI::tr("CConsultAnesth-msg-create"), UI_MSG_OK);
}
CAppUI::redirect($_POST["postRedirect"]);