/** * @see parent::fillLimitedTemplate() */ function fillLimitedTemplate(&$template) { $chir = $this->_ref_plageconsult->_ref_chir; // Ajout du praticien pour les destinataires possibles (dans l'envoi d'un email) $template->destinataires[] = array("nom" => "Dr " . $chir->_user_last_name . " " . $chir->_user_first_name, "email" => $chir->_user_email, "tag" => "Praticien"); $this->updateFormFields(); $this->loadRefsFwd(); $this->notify("BeforeFillLimitedTemplate", $template); $template->addDateProperty("Consultation - date", $this->_ref_plageconsult->date); $template->addLongDateProperty("Consultation - date longue", $this->_ref_plageconsult->date); $template->addTimeProperty("Consultation - heure", $this->heure); $locExamFields = array("motif" => "motif", "rques" => "remarques", "examen" => "examen", "traitement" => "traitement", "histoire_maladie" => "histoire maladie", "conclusion" => "conclusion"); foreach ($this->_exam_fields as $field) { $loc_field = $locExamFields[$field]; $template->addProperty("Consultation - {$loc_field}", $this->{$field}); } if (!in_array("traitement", $this->_exam_fields)) { $template->addProperty("Consultation - traitement", $this->traitement); } $medecin = new CMedecin(); $medecin->load($this->adresse_par_prat_id); $nom = "{$medecin->nom} {$medecin->prenom}"; $template->addProperty("Consultation - adressé par", $nom); $template->addProperty("Consultation - adressé par - adresse", "{$medecin->adresse}\n{$medecin->cp} {$medecin->ville}"); $template->addProperty("Consultation - Accident du travail", $this->getFormattedValue("date_at")); $libelle_at = $this->date_at ? "Accident du travail du " . $this->getFormattedValue("date_at") : ""; $template->addProperty("Consultation - Libellé accident du travail", $libelle_at); $this->loadRefsFiles(); $list = CMbArray::pluck($this->_ref_files, "file_name"); $template->addListProperty("Consultation - Liste des fichiers", $list); $template->addProperty("Consultation - Fin arrêt de travail", CMbDT::dateToLocale(CMbDT::date($this->fin_at))); $template->addProperty("Consultation - Prise en charge arrêt de travail", $this->getFormattedValue("pec_at")); $template->addProperty("Consultation - Reprise de travail", CMbDT::dateToLocale(CMbDT::date($this->reprise_at))); $template->addProperty("Consultation - Accident de travail sans arrêt de travail", $this->getFormattedValue("at_sans_arret")); $template->addProperty("Consultation - Arrêt maladie", $this->getFormattedValue("arret_maladie")); $this->loadRefsExamsComp(); $exam = new CExamComp(); foreach ($exam->_specs["realisation"]->_locales as $key => $locale) { $exams = isset($this->_types_examen[$key]) ? $this->_types_examen[$key] : array(); $template->addListProperty("Consultation - Examens complémentaires - {$locale}", $exams); } if (CModule::getActive("forms")) { CExObject::addFormsToTemplate($template, $this, "Consultation"); } // Séjour et/ou intervention créés depuis la consultation $sejour_relie = reset($this->loadBackRefs("sejours_lies")); $interv_reliee = reset($this->loadBackRefs("intervs_liees")); if ($interv_reliee) { $sejour_relie = $interv_reliee->loadRefSejour(); } else { if (!$sejour_relie) { $sejour_relie = new CSejour(); } if (!$interv_reliee) { $interv_reliee = new COperation(); } } $interv_reliee->loadRefChir(); $interv_reliee->loadRefPlageOp(); $interv_reliee->loadRefSalle(); $sejour_relie->loadRefPraticien(); // Intervention reliée $template->addProperty("Consultation - Opération reliée - Chirurgien", $interv_reliee->_ref_chir->_view); $template->addProperty("Consultation - Opération reliée - Libellé", $interv_reliee->libelle); $template->addProperty("Consultation - Opération reliée - Salle", $interv_reliee->_ref_salle->nom); $template->addDateProperty("Consultation - Opération reliée - Date", $interv_reliee->_datetime_best); // Séjour relié $template->addDateProperty("Consultation - Séjour relié - Date entrée", $sejour_relie->entree); $template->addLongDateProperty("Consultation - Séjour relié - Date entrée (longue)", $sejour_relie->entree); $template->addTimeProperty("Consultation - Séjour relié - Heure entrée", $sejour_relie->entree); $template->addDateProperty("Consultation - Séjour relié - Date sortie", $sejour_relie->sortie); $template->addLongDateProperty("Consultation - Séjour relié - Date sortie (longue)", $sejour_relie->sortie); $template->addTimeProperty("Consultation - Séjour relié - Heure sortie", $sejour_relie->sortie); $template->addDateProperty("Consultation - Séjour relié - Date entrée réelle", $sejour_relie->entree_reelle); $template->addTimeProperty("Consultation - Séjour relié - Heure entrée réelle", $sejour_relie->entree_reelle); $template->addDateProperty("Consultation - Séjour relié - Date sortie réelle", $sejour_relie->sortie_reelle); $template->addTimeProperty("Consultation - Séjour relié - Heure sortie réelle", $sejour_relie->sortie_reelle); $template->addProperty("Consultation - Séjour relié - Praticien", "Dr " . $sejour_relie->_ref_praticien->_view); $template->addProperty("Consultation - Séjour relié - Libelle", $sejour_relie->getFormattedValue("libelle")); $this->notify("AfterFillLimitedTemplate", $template); }
if (!$naissance->date_time) { $naissance->date_time = CMbDT::dateTime(); $patient->naissance = CMbDT::date(); } } else { if (!$provisoire) { $grossesse = $sejour->loadRefGrossesse(); $naissance->rang = $grossesse->countBackRefs("naissances") + 1; $naissance->date_time = CMbDT::dateTime(); } $naissance->sejour_maman_id = $sejour_id; $naissance->operation_id = $operation_id; // guess cesarienne $op = new COperation(); $op->load($operation_id); $bloc = $op->loadRefSalle()->loadRefBloc(); if ($bloc->_id && $bloc->type != "obst") { $naissance->by_caesarean = "1"; } $num_naissance = CAppUI::conf("maternite CNaissance num_naissance") != 1 ? CAppUI::conf("maternite CNaissance num_naissance") : CAppUI::conf("maternite CNaissance num_naissance", "CGroups-" . $sejour->group_id); $naissance->num_naissance = $num_naissance + CNaissance::countNaissances(); if (!$anonmymous) { $patient->nom = $parturiente->nom; } } $sejour->loadRefPraticien(); $smarty = new CSmartyDP(); $smarty->assign("naissance", $naissance); $smarty->assign("patient", $patient); $smarty->assign("constantes", $constantes); $smarty->assign("parturiente", $parturiente);