<?php

/**
 * $Id: httpreq_vw_list_techniques_comp.php 24480 2014-08-20 10:51:06Z flaviencrochard $
 *
 * @package    Mediboard
 * @subpackage Cabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 24480 $
 */
CCanDo::checkEdit();
$selConsult = CValue::getOrSession("selConsult", 0);
$dossier_anesth_id = CValue::getOrSession("dossier_anesth_id", 0);
$consult = new CConsultation();
$consult->load($selConsult);
$consult->loadRefConsultAnesth($dossier_anesth_id);
$consult->_ref_consult_anesth->loadRefsBack();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("consult_anesth", $consult->_ref_consult_anesth);
$smarty->display("inc_consult_anesth/techniques_comp.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::checkRead();
$consult_id = CValue::get("consult_id");
$consult = new CConsultation();
$consult->_id = $consult_id;
$consult->load();
$consult->loadRefPatient();
$consult->loadRefGrossesse();
$type = "";
switch ($consult->type_assurance) {
    case "classique":
        $type = "assurance_classique";
        break;
    case "at":
        $type = "accident_travail";
        break;
    case "smg":
        $type = "soins_medicaux_gratuits";
        break;
    case "maternite":
        $type = "maternite";
$multiple = CValue::get("multipleMode", false);
$display_nb_consult = CAppUI::conf("dPcabinet display_nb_consult");
$quotas = null;
// Récupération des consultations de la plage séléctionnée
$plage = new CPlageconsult();
if ($plageconsult_id) {
    $plage->load($plageconsult_id);
    $plage->loadRefsNotes();
    $date = $plage->date;
} else {
    $date = CValue::get("date", CMbDT::date());
}
// consultation précise
$consultation_target = new CConsultation();
if ($consult_id) {
    $consultation_target->load($consult_id);
} elseif ($heure) {
    $consultation_target->heure = $heure;
}
$consultation_target->loadRefElementPrescription();
// Chargement des places disponibles
$listPlace = array();
$listBefore = array();
$listAfter = array();
$next_plage = $previous_plage = new CPlageconsult();
$function_id = null;
if ($plageconsult_id) {
    if (!$plage->plageconsult_id) {
        $plage->load($plageconsult_id);
    }
    $plage->loadRefsFwd(true);
    $where = array();
    $where["chir_id"] = "= '{$chir->_id}'";
    $tarifs["user"] = $tarif->loadList($where, $order);
    foreach ($tarifs["user"] as $_tarif) {
        /**@var CTarif $_tarif */
        $_tarif->getPrecodeReady();
    }
    $where = array();
    $where["function_id"] = "= '{$chir->function_id}'";
    $tarifs["func"] = $tarif->loadList($where, $order);
    foreach ($tarifs["func"] as $_tarif) {
        $_tarif->getPrecodeReady();
    }
    if (CAppui::conf("dPcabinet Tarifs show_tarifs_etab")) {
        $where = array();
        $where["group_id"] = "= '" . CGroups::loadCurrent()->_id . "'";
        $tarifs["group"] = $tarif->loadList($where, $order);
        foreach ($tarifs["group"] as $_tarif) {
            $_tarif->getPrecodeReady();
        }
    }
    $consult = new CConsultation();
    if ($consult_id) {
        $consult->load($consult_id);
    }
    $smarty = new CSmartyDP();
    $smarty->assign("consult", $consult);
    $smarty->assign("sejour", $sejour);
    $smarty->assign("tarifs", $tarifs);
    $smarty->display("inc_tarifs_sejour.tpl");
}
<?php

/**
 * $Id: do_change_prat_pec.php 24015 2014-07-17 08:47:12Z flaviencrochard $
 *
 * @package    Mediboard
 * @subpackage dPcabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 24015 $
 */
$prat_id = CValue::post("prat_id");
$consult = new CConsultation();
$consult->load(CValue::post("consultation_id"));
$consult->loadRefPlageConsult();
$_datetime = $consult->_datetime;
if (!isset($current_m)) {
    $current_m = CValue::post("current_m", "dPcabinet");
}
$day_now = CMbDT::format($_datetime, "%Y-%m-%d");
$time_now = CMbDT::format($_datetime, "%H:%M:00");
$hour_now = CMbDT::format($_datetime, "%H:00:00");
$hour_next = CMbDT::time("+1 HOUR", $hour_now);
$plage = new CPlageconsult();
$plageBefore = new CPlageconsult();
$plageAfter = new CPlageconsult();
// Cas ou une plage correspond
$where = array();
$where["chir_id"] = "= '{$prat_id}'";
$where["date"] = "= '{$day_now}'";
$where["debut"] = "<= '{$time_now}'";
<?php

/**
 * $Id$
 * 
 * @package    Mediboard
 * @subpackage dPcabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$consultation_id = CValue::post("consultation_id");
$plageconsult_id = CValue::post("plageconsult_id");
$heure = CValue::post("heure");
$consult = new CConsultation();
$consult->load($consultation_id);
$new_consult = new CConsultation();
$new_consult->plageconsult_id = $plageconsult_id;
$new_consult->heure = $heure;
$new_consult->chrono = CConsultation::PLANIFIE;
$new_consult->patient_id = $consult->patient_id;
$new_consult->categorie_id = $consult->categorie_id;
$msg = $new_consult->store();
if ($msg) {
    CAppUI::setMsg($msg, UI_MSG_ERROR);
} else {
    CAppUI::setMsg(CAppUI::tr("CConsultation-msg-create"), UI_MSG_OK);
}
echo CAppUI::getMsg();
CApp::rip();
     } else {
         if (isset($_result["prescription_line_mix_item_id"])) {
             $line = new CPrescriptionLineMixItem();
             $line->load($_result["prescription_line_mix_item_id"]);
             $pat->_distant_line = $line;
         }
     }
     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;
 }
Exemple #8
0
// Chargement des categories
$categorie = new CConsultationCategorie();
$whereCategorie["function_id"] = " = '{$chir->function_id}'";
$orderCategorie = "nom_categorie ASC";
/** @var CConsultationCategorie[] $categories */
$categories = $categorie->loadList($whereCategorie, $orderCategorie);
// Creation du tableau de categories simplifié pour le traitement en JSON
$listCat = array();
foreach ($categories as $_categorie) {
    $listCat[$_categorie->_id] = array("nom_icone" => $_categorie->nom_icone, "duree" => $_categorie->duree, "commentaire" => utf8_encode($_categorie->commentaire));
}
// Ajout du motif de la consultation passé en parametre
if (!$consult->_id && $consult_urgence_id) {
    // Chargement de la consultation de passage aux urgences
    $consultUrgence = new CConsultation();
    $consultUrgence->load($consult_urgence_id);
    $consultUrgence->loadRefSejour();
    $consultUrgence->_ref_sejour->loadRefRPU();
    $consult->motif = "Reconvocation suite à un passage aux urgences, {$consultUrgence->_ref_sejour->_ref_rpu->motif}";
}
// Locks sur le rendez-vous
$consult->_locks = null;
$today = CMbDT::date();
if ($consult->_id) {
    if ($consult->_datetime < $today) {
        $consult->_locks[] = "datetime";
    }
    if ($consult->chrono == CConsultation::TERMINE && !$consult->annule) {
        $consult->_locks[] = "termine";
    }
    if ($consult->valide) {
Exemple #9
0
 /**
  * Redéfinition du store
  *
  * @return void|string
  **/
 function store()
 {
     $this->completeField("numero", "group_id");
     if (!$this->group_id) {
         $this->group_id = CGroups::loadCurrent()->_id;
     }
     if ($this->_id && $this->_duplicate) {
         $this->_duplicate = null;
         if ($msg = $this->duplicate()) {
             return $msg;
         }
         $this->annule = 1;
         $this->definitive = 1;
     }
     if (!$this->cloture && $this->fieldModified("cloture") && count($this->_ref_reglements)) {
         return "Vous ne pouvez pas décloturer une facture ayant des règlements";
     }
     if (!$this->cloture && $this->fieldModified("cloture") && count($this->_ref_relances)) {
         return "Vous ne pouvez pas décloturer une facture ayant des relances";
     }
     $create_lignes = false;
     if (!$this->_id && CAppUI::conf("dPfacturation " . $this->_class . " use_auto_cloture")) {
         $this->cloture = CMbDT::date();
         $create_lignes = true;
     }
     //Si on cloture la facture création des lignes de la facture
     //Si on décloture on les supprime
     if ($this->cloture && $this->fieldModified("cloture") && !$this->_old->cloture) {
         $create_lignes = true;
     } elseif (!$this->cloture && $this->fieldModified("cloture")) {
         //Suppression des tous les items de la facture
         $this->loadRefsItems();
         foreach ($this->_ref_items as $item) {
             /** @var CFactureItem $item*/
             $item->delete();
         }
         $this->facture = 0;
     }
     // Etat des règlement à propager sur les consultations
     if ($this->fieldModified("patient_date_reglement") || $this->fieldModified("tiers_date_reglement")) {
         $this->loadRefsConsultation();
         foreach ($this->_ref_consults as $_consultation) {
             $_consultation->patient_date_reglement = $this->patient_date_reglement;
             $_consultation->tiers_date_reglement = $this->tiers_date_reglement;
             if ($msg = $_consultation->store()) {
                 return $msg;
             }
         }
         if ($this->isRelancable() && $this->_ref_last_relance->_id) {
             $this->_ref_last_relance->etat = $this->patient_date_reglement ? "regle" : "emise";
             $this->_ref_last_relance->store();
         }
     }
     $_object_id = null;
     $_object_class = null;
     //Lors de la validation de la cotation d'une consultation
     if ($this->_consult_id) {
         $consult = new CConsultation();
         $consult->load($this->_consult_id);
         $consult->loadRefPlageConsult();
         // Si la facture existe déjà on la met à jour
         $where = array();
         $ljoin = array();
         $plage = $consult->_ref_plageconsult;
         if (CAppUI::conf("ref_pays") == 2) {
             $where["patient_id"] = "= '{$consult->patient_id}'";
             $where["praticien_id"] = "= '" . ($plage->pour_compte_id ? $plage->pour_compte_id : $plage->chir_id) . "'";
             $where["cloture"] = "IS NULL";
         } else {
             $table = $consult->sejour_id ? "facture_etablissement" : "facture_cabinet";
             $ljoin["facture_liaison"] = "facture_liaison.facture_id = {$table}.facture_id";
             $where["facture_liaison.object_id"] = " = '{$this->_consult_id}'";
             $where["facture_liaison.object_class"] = " = 'CConsultation'";
             $where["facture_liaison.facture_class"] = " = '{$this->_class}'";
             $where["numero"] = " = '{$this->numero}'";
         }
         //Si la facture existe déjà
         if ($this->loadObject($where, null, "facture_id", $ljoin)) {
             //Dans le cas Suisse
             if (CAppUI::conf("ref_pays") == 2 && CModule::getActive("dPfacturation")) {
                 $ligne = new CFactureLiaison();
                 $ligne->facture_id = $this->_id;
                 $ligne->facture_class = $this->_class;
                 $ligne->object_id = $this->_consult_id;
                 $ligne->object_class = 'CConsultation';
                 if (!$ligne->loadMatchingObject()) {
                     $ligne->store();
                 }
             }
         } else {
             // Sinon on la crée
             $this->ouverture = CMbDT::date();
             $this->patient_id = $consult->patient_id;
             $this->praticien_id = $plage->pour_compte_id ? $plage->pour_compte_id : $plage->chir_id;
             $this->type_facture = $consult->pec_at == 'arret' ? "accident" : "maladie";
             if (CAppUI::conf("dPfacturation {$this->_class} use_auto_cloture")) {
                 $this->cloture = CMbDT::date();
                 $create_lignes = true;
             }
             if ($this->numero > 1 && !count($consult->loadRefsFraisDivers(1)) && count($consult->loadRefsFraisDivers($this->numero)) && $consult->du_tva) {
                 $frais = 0;
                 foreach ($consult->loadRefsFraisDivers($this->numero) as $_frais) {
                     $frais += $_frais->montant_base;
                 }
                 $this->du_patient = $frais + $consult->du_tva;
                 $this->du_tva = $consult->du_tva;
                 $this->taux_tva = $consult->taux_tva;
             }
         }
         $_object_id = $this->_consult_id;
         $_object_class = "CConsultation";
     }
     //Lors de la création d'une facture de séjour
     if ($this->_sejour_id) {
         $_object_id = $this->_sejour_id;
         $_object_class = "CSejour";
     }
     $this->completeField("assurance_maladie", "assurance_accident", "type_facture");
     if ($this->type_facture != "accident" && $this->assurance_accident) {
         $this->assurance_accident = "";
     }
     if ($this->type_facture != "maladie" && $this->assurance_maladie) {
         $this->assurance_maladie = "";
     }
     // Standard store
     if ($msg = parent::store()) {
         return $msg;
     }
     if ($_object_id) {
         $ligne = new CFactureLiaison();
         $ligne->facture_id = $this->_id;
         $ligne->facture_class = $this->_class;
         $ligne->object_id = $_object_id;
         $ligne->object_class = $_object_class;
         if (!$ligne->loadMatchingObject()) {
             $ligne->store();
         }
     }
     if ($create_lignes) {
         $this->creationLignesFacture();
     }
 }
$consult = new CConsultation();
if ($current_m == "dPurgences") {
    if (!$selConsult) {
        CAppUI::setMsg("Vous devez selectionner une consultation", UI_MSG_ALERT);
        CAppUI::redirect("m=urgences&tab=0");
    }
    $user = CAppUI::$user;
    $group = CGroups::loadCurrent();
    $listPrats = $user->loadPraticiens(PERM_READ, $group->service_urgences_id);
}
// Chargement des banques
$orderBanque = "nom ASC";
$banque = new CBanque();
$banques = $banque->loadList(null, $orderBanque);
// Test compliqué afin de savoir quelle consultation charger
if ($consult->load($consult_id) && $consult->patient_id) {
    $consult->loadRefPlageConsult();
}
// On charge le praticien
$userSel = new CMediusers();
$userSel->load($consult->_ref_plageconsult->chir_id);
$userSel->loadRefs();
$canUserSel = $userSel->canDo();
// assign to session the current consultation praticien
$chirSession = CValue::session("chirSel");
if ($chirSession != $userSel->_id && $canUserSel) {
    CValue::setSession("chirSel", $userSel->_id);
}
$anesth = new CTypeAnesth();
$anesth = $anesth->loadGroupList();
$consultAnesth =& $consult->_ref_consult_anesth;
if ($multiple_edit || $consultation_id) {
    $hide_finished = false;
}
//if multiple, no weekly planner
if ($multipleMode) {
    $periods = array("day", "week", "month");
    if ($period == "weekly") {
        $period = "month";
    }
}
$consultation_ids = array();
// next consultations in editMultiple
if ($consultation_id) {
    $consultation_ids = array();
    $consultation_temp = new CConsultation();
    $consultation_temp->load($consultation_id);
    $consultation_temp->loadRefPlageConsult()->loadRefChir();
    $consultation_temp->loadRefElementPrescription();
    // we add the first consult to the future json list (first element)
    if (!$consultation_temp->annule && ($consultation_temp->chrono = 16)) {
        $consultation_ids[] = array($consultation_temp->plageconsult_id, $consultation_temp->_id, $consultation_temp->_ref_plageconsult->date, $consultation_temp->heure, $consultation_temp->_ref_plageconsult->chir_id, utf8_encode($consultation_temp->_ref_plageconsult->_ref_chir->_view), $consultation_temp->annule, utf8_encode($consultation_temp->rques), $consultation_temp->element_prescription_id, utf8_encode($consultation_temp->element_prescription_id ? $consultation_temp->_ref_element_prescription->libelle : ""));
    }
    //edit mod
    if ($multiple_edit) {
        $plage_temp = $consultation_temp->_ref_plageconsult;
        $where_next = array();
        $ljoin_next = array();
        $limit = CAppUI::pref("NbConsultMultiple");
        $date_ref = CAppUI::pref("today_ref_consult_multiple") ? CMbDT::date() : $plage_temp->date;
        $ljoin_next["plageconsult"] = "plageconsult.plageconsult_id = consultation.plageconsult_id";
        $where_next["consultation.patient_id"] = "= '{$consultation_temp->patient_id}'";
// get or session
$date = CValue::getOrSession("date", $today);
$prat_id = CValue::getOrSession("chirSel", $user->_id);
$selConsult = CValue::getOrSession("selConsult");
$vue = CValue::getOrSession("vue2", 0);
$withClosed = CValue::getOrSession("withClosed", 0);
$board = CValue::get("board", 0);
if (!$board) {
    $withClosed = 1;
} else {
    $vue = 0;
}
$consult = new CConsultation();
// Test compliqué afin de savoir quelle consultation charger
if (isset($_GET["selConsult"])) {
    if ($consult->load($selConsult)) {
        $consult->loadRefPlageConsult(1);
        $prat_id = $consult->_ref_plageconsult->chir_id;
        CValue::setSession("chirSel", $prat_id);
    } else {
        CValue::setSession("selConsult");
    }
} else {
    if ($consult->load($selConsult)) {
        $consult->loadRefPlageConsult(1);
        if ($prat_id !== $consult->_ref_plageconsult->chir_id) {
            $consult = new CConsultation();
            CValue::setSession("selConsult");
        }
    }
}
<?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::checkEdit();
$consult_id = CValue::get("consult_id");
$first_consult = new CConsultation();
$first_consult->load($consult_id);
$plage_consult = $first_consult->loadRefPlageConsult();
$first_consult->loadRefPatient();
$first_consult->loadRefPraticien();
$date = $plage_consult->date;
$praticien = new CMediusers();
$praticiens = $praticien->loadPraticiens(PERM_EDIT);
$next_consult = new CConsultation();
$ljoin = array();
$where = array();
$where["patient_id"] = " = '{$first_consult->patient_id}'";
$where["date"] = " >= '{$date}'";
$ljoin["plageconsult"] = "plageconsult.plageconsult_id = consultation.plageconsult_id";
/** @var CConsultation[] $next_consults */
$next_consults = $next_consult->loadList($where, "date ASC", null, null, $ljoin);
foreach ($next_consults as $_key => $_consult) {