$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); $function_id = $plage->_ref_chir->function_id; $plage->loadRefsConsultations(false, true, true); $plage->loadFillRate(); $plage->_ref_chir->loadRefFunction(); for ($i = 0; $i < $plage->_total; $i++) { $minutes = $plage->_freq * $i; $listPlace[$i]["time"] = CMbDT::time("+ {$minutes} minutes", $plage->debut); $listPlace[$i]["consultations"] = array(); } foreach ($plage->_ref_consultations as $keyConsult => $valConsult) { $consultation =& $plage->_ref_consultations[$keyConsult]; $consultation->loadRefPatient(); // Chargement de la categorie $consultation->loadRefCategorie(); $keyPlace = CMbDT::timeCountIntervals($plage->debut, $consultation->heure, $plage->freq);
/** * @see parent::fillTemplate() */ function fillTemplate(&$template) { $this->updateFormFields(); $this->loadRefsFwd(); $this->_ref_plageconsult->loadRefsFwd(); $this->_ref_plageconsult->_ref_chir->fillTemplate($template); $this->_ref_patient->fillTemplate($template); $this->fillLimitedTemplate($template); if (CModule::getActive('dPprescription')) { // Chargement du fillTemplate de la prescription $this->loadRefsPrescriptions(); $prescription = isset($this->_ref_prescriptions["externe"]) ? $this->_ref_prescriptions["externe"] : new CPrescription(); $prescription->type = "externe"; $prescription->fillLimitedTemplate($template); } $sejour = $this->loadRefSejour(); $sejour->fillLimitedTemplate($template); $rpu = $sejour->loadRefRPU(); if ($rpu && $rpu->_id) { $rpu->fillLimitedTemplate($template); } if (!$this->countBackRefs("consult_anesth") && CModule::getActive("dPprescription")) { $sejour->loadRefsPrescriptions(); $prescription = isset($sejour->_ref_prescriptions["pre_admission"]) ? $sejour->_ref_prescriptions["pre_admission"] : new CPrescription(); $prescription->type = "pre_admission"; $prescription->fillLimitedTemplate($template); $prescription = isset($sejour->_ref_prescriptions["sejour"]) ? $sejour->_ref_prescriptions["sejour"] : new CPrescription(); $prescription->type = "sejour"; $prescription->fillLimitedTemplate($template); $prescription = isset($sejour->_ref_prescriptions["sortie"]) ? $sejour->_ref_prescriptions["sortie"] : new CPrescription(); $prescription->type = "sortie"; $prescription->fillLimitedTemplate($template); } $facture = $this->loadRefFacture(); $facture->fillLimitedTemplate($template); }
$plage =& $plageAfter; } else { $plage->chir_id = $chir->_id; $plage->date = $day_now; $plage->freq = "00:" . CPlageconsult::$minutes_interval . ":00"; $plage->debut = $hour_now; $plage->fin = $hour_next; $plage->libelle = "automatique"; $plage->_immediate_plage = 1; } $plage->updateFormFields(); if ($msg = $plage->store()) { CAppUI::setMsg($msg, UI_MSG_ERROR); } } $plage->loadRefsFwd(); if ($grossesse_id) { $grossesse = new CGrossesse(); $grossesse->load($grossesse_id); if ($grossesse->_id) { $patient_id = $grossesse->parturiente_id; } } $ref_chir = $plage->_ref_chir; $consult = new CConsultation(); $consult->plageconsult_id = $plage->_id; $consult->sejour_id = $sejour->_id; $consult->grossesse_id = $grossesse_id; $consult->patient_id = $patient_id; $consult->heure = $time_now; $consult->arrivee = "{$day_now} {$time_now}";
$debut = CMbDT::date("+1 day", $debut); $is_in_period = $today >= $debut && $today <= $fin; // Plage de consultation selectionnée $plageconsult_id = CValue::getOrSession("plageconsult_id", null); $plageSel = new CPlageconsult(); if ($plageconsult_id === null && $chirSel && $is_in_period) { $nowTime = CMbDT::time(); $where = array("chir_id" => "= '{$chirSel}'", "date" => "= '{$today}'", "debut" => "<= '{$nowTime}'", "fin" => ">= '{$nowTime}'"); $plageSel->loadObject($where); } if (!$plageSel->plageconsult_id) { $plageSel->load($plageconsult_id); } else { $plageconsult_id = $plageSel->plageconsult_id; } $plageSel->loadRefsFwd(1); $plageSel->loadRefsNotes(); $plageSel->loadRefsBack(); //check 3333tel if (CModule::getActive("3333tel")) { C3333TelTools::checkPlagesConsult($plageSel, $plageSel->_ref_chir->function_id); } $pause = new CConsultation(); //find the unique pause; if ($plageSel->_id) { $where_p = array(); $where_p["plageconsult_id"] = " = '{$plageSel->_id}' "; $where_p["patient_id"] = " IS NULL"; $list = $pause->loadList($where_p); if (count($list) == 1) { /** @var CConsultation $pause */