* @version  $Revision$
 */
CCanDo::checkEdit();
$consult_id = CValue::get("consult_id", 0);
$sejour_id = CValue::get("sejour_id", 0);
$chir_id = CValue::get("chir_id", 0);
$sejour = new CSejour();
$sejour->load($sejour_id);
if ($sejour->_id) {
    $chir = new CMediusers();
    if ($chir_id) {
        $chir->load($chir_id);
    } else {
        $chir->load($sejour->praticien_id);
    }
    $sejour->loadRefPraticien();
    $sejour->loadRefsActes();
    $sejour->updateFormFields();
    $sejour->_datetime = CMbDT::dateTime();
    // Récupération des tarifs
    /** @var CTarif $tarif */
    $tarif = new CTarif();
    $tarifs = array();
    $order = "description";
    $where = array();
    $where["chir_id"] = "= '{$chir->_id}'";
    $tarifs["user"] = $tarif->loadList($where, $order);
    foreach ($tarifs["user"] as $_tarif) {
        /**@var CTarif $_tarif */
        $_tarif->getPrecodeReady();
    }
 /**
  * @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);
 }
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision:$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$sejour_id = CValue::get("sejour_id");
$date = CValue::getOrSession("date");
$date_actuelle = CMbDT::dateTime("00:00:00");
$date_demain = CMbDT::dateTime("00:00:00", "+ 1 day");
$date_min = CMbDT::dateTime("00:00:00", $date);
$date_max = CMbDT::dateTime("23:59:59", $date);
$sejour = new CSejour();
$sejour->load($sejour_id);
$sejour->loadRefEtablissementProvenance();
$sejour->loadRefAdresseParPraticien();
$sejour->loadRefPraticien()->loadRefFunction();
$patient = $sejour->loadRefPatient();
$patient->loadIPP();
// Dossier médical
$dossier_medical = $patient->loadRefDossierMedical(false);
// Chargement du numéro de dossier
$sejour->loadNDA();
// Chargement des notes sur le séjourw
$sejour->loadRefsNotes();
// Chargement des modes d'entrée
$sejour->loadRefEtablissementProvenance();
// Chargement des appels
$sejour->loadRefsAppel('admission');
// Chargement de l'affectation
$affectation = $sejour->loadRefFirstAffectation();
// Chargement des interventions
Exemplo n.º 4
0
 /**
  * Prepare the data to send from the given sejour
  *
  * @param CSejour      $sejour           The sejour
  * @param string       $encoding         The encoding
  * @param string       $modality         The target modality
  * @param string       $calling_ae_title The AE title who requested the worklist
  * @param CDicomConfig $dicom_config     The Exchange Dicom
  *
  * @return array
  */
 protected function getDataFromSejour($sejour, $encoding, $modality, $calling_ae_title, $dicom_config)
 {
     $libelle = '';
     $date = '';
     $time = '';
     $patient = $sejour->loadRefPatient();
     $sejour->updateFormFields();
     $operation = $sejour->loadRefCurrOperation(CMbDT::dateTime());
     if ($operation->_id) {
         $operation->updateFormFields();
         $operation->loadRefPlageOp();
         if ($operation->libelle) {
             $libelle = substr($operation->libelle, 0, 64);
         } else {
             $libelle = 'Pas de libellé';
         }
         if ($operation->date) {
             $date = str_replace('-', '', $operation->date);
         } else {
             $date = str_replace('-', '', $operation->_ref_plageop->date);
         }
         if ($operation->time_operation) {
             $time = str_replace(':', '', $operation->time_operation) . '.000000';
         } else {
             $time = str_replace(':', '', CMbDT::time()) . '.000000';
         }
     } else {
         $libelle = "Pas de libellé";
         $date = str_replace('-', '', CMBDT::date());
         $time = str_replace(':', '', CMbDT::time()) . '.000000';
     }
     $chir = $sejour->loadRefPraticien();
     $patient->loadIPP();
     $sejour->loadNDA();
     $sejour_id = $sejour->_id;
     if ($sejour->_NDA) {
         $sejour_id = $sejour->_NDA;
     }
     $patient_id = $patient->_id;
     if ($patient->_IPP) {
         $patient_id = $patient->_IPP;
     }
     $age = intval(substr(trim($patient->_age), 0, 2));
     $chir_name = "{$chir->_user_last_name} {$chir->_user_first_name}";
     $data = array(0x8 => array(0x50 => self::encodeValue($sejour_id, $encoding)), 0x10 => array(0x10 => self::encodeValue("{$patient->nom}^{$patient->prenom}", $encoding), 0x20 => self::encodeValue("{$patient_id}", $encoding), 0x30 => self::encodeValue(str_replace("-", "", $patient->naissance), $encoding), 0x40 => self::encodeValue(strtoupper($patient->sexe), $encoding)), 0x20 => array(0xd => self::encodeValue($sejour_id, $encoding)), 0x38 => array(0x10 => self::encodeValue($sejour_id, $encoding)), 0x40 => array(0x100 => array(array(array("group_number" => 0x8, "element_number" => 0x60, "value" => self::encodeValue($modality, $encoding)), array("group_number" => 0x40, "element_number" => 0x1, "value" => self::encodeValue($calling_ae_title, $encoding)), array("group_number" => 0x40, "element_number" => 0x2, "value" => self::encodeValue($date, $encoding)), array("group_number" => 0x40, "element_number" => 0x3, "value" => self::encodeValue($time, $encoding)), array("group_number" => 0x40, "element_number" => 0x6, "value" => self::encodeValue($chir_name, $encoding)), array("group_number" => 0x40, "element_number" => 0x7, "value" => self::encodeValue($libelle, $encoding)), array("group_number" => 0x40, "element_number" => 0x9, "value" => self::encodeValue($sejour_id, $encoding)))), 0x1001 => self::encodeValue($sejour_id, $encoding)));
     /* We add the field 0x0032,0x1032 if it's configured */
     if ($dicom_config->send_0032_1032) {
         if (!array_key_exists(0x32, $data)) {
             $data[0x32] = array();
         }
         $data[0x32][0x1032] = self::encodeValue($chir_name, $encoding);
         /* Add the field into the sequence of item 0x0040,0x0100 */
         /*$data[0x0040][0x0100][0][] = array(
             "group_number" => 0x0032,
             "element_number" => 0x1032,
             "value" => self::encodeValue($chir_name, $encoding)
           );*/
     }
     return $data;
 }