Exemplo n.º 1
0
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $this->_view = "Indisponibilité du " . CMbDT::dateToLocale($this->deb);
     if ($this->deb != $this->fin) {
         $this->_view .= " au " . CMbDT::dateToLocale($this->fin);
     }
 }
            foreach ($_patient->_ext_codes_cim as $_ext_code_cim) {
                $dossier_medical .= "{$_ext_code_cim->code}: {$_ext_code_cim->libelle} \n";
            }
        }
        $object_view = "";
        if (isset($_patient->_distant_object)) {
            $object = $_patient->_distant_object;
            switch (get_class($object)) {
                case "CConsultation":
                    $object_view = "Consultation du " . CMbDT::dateToLocale($object->_ref_plageconsult->date) . " à " . CMbDT::format($object->heure, "%Hh:%M");
                    break;
                case "CSejour":
                    $object_view = "Séjour du " . CMbDT::dateToLocale(CMbDT::date($object->entree)) . "au " . CMbDT::dateToLocale(CMbDT::date($object->sortie));
                    break;
                case "COperation":
                    $object_view = "Intervention du " . CMbDT::dateToLocale(CMbDT::date($object->_datetime_best));
            }
        }
        $content_line = "";
        if (isset($_patient->_distant_line)) {
            $content_line = $_patient->_distant_line;
        }
        $data_line = array($_patient->_view . " (" . strtoupper($_patient->sexe) . ")", $_patient->_age_epoque, $dossier_medical, $object_view, $content_line->_view, $content_line->_ref_produit->_dci_view, $content_line->_ref_produit->_ref_ATC_5_code, $content_line->_ref_produit->_ref_ATC_5_libelle, $content_line->commentaire);
        $csv->writeLine($data_line);
    }
    $period = "du_" . ($from ? $from : "_") . "_au_" . ($to ? $to : "_");
    $csv->stream("dossiers_clinique_" . $period);
    CApp::rip();
}
// Création du template
$smarty = new CSmartyDP();
Exemplo n.º 3
0
try {
    $exchange_source->setRecipient($email);
    // Création du token
    $token = new CViewAccessToken();
    $token->ttl_hours = 24;
    $token->user_id = $praticien->_id;
    $token->params = "m=planningOp&a=vw_edit_urgence&operation_id={$operation_id}";
    if ($msg = $token->store()) {
        CAppUI::displayAjaxMsg($msg, UI_MSG_ERROR);
    }
    $url = $token->getUrl();
    // Lien vers la DHE
    $subject = CAppUI::conf("reservation subject_mail");
    $content = CAppUI::conf("reservation text_mail");
    $from = array("[URL]", "[PRATICIEN - NOM]", "[PRATICIEN - PRENOM]", "[DATE INTERVENTION]", "[HEURE INTERVENTION]");
    $to = array($url, $praticien->_user_last_name, $praticien->_user_first_name, CMbDT::dateToLocale(CMbDT::date($operation->_datetime_best)), CMbDT::transform($operation->_datetime_best, null, CAppUI::conf("time")));
    $subject = str_replace($from, $to, $subject);
    $exchange_source->setSubject($subject);
    $content = str_replace($from, $to, $content);
    $content = nl2br(utf8_encode($content));
    $exchange_source->setBody($content);
    $exchange_source->send();
    $operation->envoi_mail = CMbDT::dateTime();
    if ($msg = $operation->store()) {
        CAppUI::displayAjaxMsg($msg, UI_MSG_ERROR);
    }
    CAppUI::displayAjaxMsg("Message envoyé");
} catch (phpmailerException $e) {
    CAppUI::displayAjaxMsg($e->errorMessage(), UI_MSG_WARNING);
} catch (CMbException $e) {
    $e->stepAjax();
    }
    // Statistiques  d'âge de patient
    $patient =& $_sejour->_ref_patient;
    if ($patient->_annees < "1") {
        $stats[$entree_patient]["less_than_1"]++;
    }
    if ($patient->_annees >= "75") {
        $stats[$entree_patient]["more_than_75"]++;
    }
}
$extractPassages = new CExtractPassages();
$extractPassages->date_extract = CMbDT::dateTime();
$extractPassages->type = "urg";
$extractPassages->debut_selection = $debut_selection;
$extractPassages->fin_selection = $fin_selection;
$extractPassages->group_id = CGroups::loadCurrent()->_id;
$extractPassages->store();
$doc_valid = null;
// Appel de la fonction d'extraction du RPUSender
$rpuSender = $extractPassages->getRPUSender();
if (!$rpuSender) {
    CAppUI::stepAjax("Aucun sender définit dans le module dPurgences.", UI_MSG_ERROR);
}
$extractPassages = $rpuSender->extractURG($extractPassages, $stats);
CAppUI::stepAjax("Extraction de {$count_sejour} séjours du " . CMbDT::dateToLocale($debut_selection) . " au " . CMbDT::dateToLocale($fin_selection) . " terminée.", UI_MSG_OK);
if (!$extractPassages->message_valide) {
    CAppUI::stepAjax("Le document produit n'est pas valide.", UI_MSG_WARNING);
} else {
    CAppUI::stepAjax("Le document produit est valide.", UI_MSG_OK);
}
echo "<script>RPU_Sender.extract_passages_id = {$extractPassages->_id};</script>";
Exemplo n.º 5
0
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $this->loadRefParturiente();
     $this->_view = "Terme du " . CMbDT::dateToLocale($this->terme_prevu);
     // Nombre de semaines (aménorrhée = 41, grossesse = 39)
     $this->_date_fecondation = CMbDT::date("-41 weeks", $this->terme_prevu);
     $this->_semaine_grossesse = ceil(CMbDT::daysRelative($this->_date_fecondation, CMbDT::date()) / 7);
 }
Exemplo n.º 6
0
 /**
  * @see parent::completeLabelFields()
  */
 function completeLabelFields(&$fields, $params)
 {
     if (!isset($this->_from_op)) {
         $this->loadRefLastOperation()->_from_sejour = 1;
         $this->_ref_last_operation->completeLabelFields($fields, $params);
     }
     $this->loadRefPatient()->completeLabelFields($fields, $params);
     $this->loadRefPraticien();
     $this->loadNDA();
     $this->loadNRA();
     $now = CMbDT::dateTime();
     $affectation = $this->getCurrAffectation($this->entree > $now ? $this->entree : null);
     $affectation->loadView();
     $affectation->loadRefService();
     $souhaits = array();
     if (CAppUI::conf("dPhospi prestations systeme_prestations", CGroups::loadCurrent()) == "expert") {
         /** @var CItemLiaison[] $items_liaisons */
         $items_liaisons = $this->loadBackRefs("items_liaisons", "date");
         CStoredObject::massLoadFwdRef($items_liaisons, "item_souhait_id");
         CStoredObject::massLoadFwdRef($items_liaisons, "sous_item_id");
         foreach ($items_liaisons as $_liaison) {
             $item_souhait = $_liaison->loadRefItem();
             if ($item_souhait->object_class == "CPrestationPonctuelle") {
                 continue;
             }
             $sous_item = $_liaison->loadRefSousItem();
             $nom = $item_souhait;
             if ($sous_item->_id) {
                 $nom = $sous_item->nom;
             }
             $souhaits[] = $nom;
         }
     }
     $meds_dispenses = array();
     if (isset($params["debut_dispensation"]) && isset($params["fin_dispensation"])) {
         $from = $params["debut_dispensation"];
         $to = $params["fin_dispensation"];
         $delivery = new CProductDelivery();
         $where = array("date_dispensation" => "BETWEEN '{$from}' AND '{$to}'", "sejour_id" => "= '{$this->_id}'");
         $deliveries = $delivery->loadList($where);
         $stocks = CStoredObject::massLoadFwdRef($deliveries, "stock_id");
         $products = CStoredObject::massLoadFwdRef($stocks, "product_id");
         /** @var CProduct $_product */
         foreach ($products as $_product) {
             $meds_dispenses[] = $_product->code . " " . $_product->name;
         }
     }
     $fields_sejour = array("DATE ENT" => CMbDT::dateToLocale(CMbDT::date($this->entree)), "HEURE ENT" => CMbDT::transform($this->entree, null, "%H:%M"), "DATE SORTIE" => CMbDT::dateToLocale(CMbDT::date($this->sortie)), "HEURE SORTIE" => CMbDT::transform($this->sortie, null, "%H:%M"), "PRAT RESPONSABLE" => $this->_ref_praticien->_view, "NDOS" => $this->_NDA, "NRA" => $this->_ref_NRA ? $this->_ref_NRA->id400 : "", "CODE BARRE NDOS" => "@BARCODE_" . $this->_NDA . "@", "CHAMBRE COURANTE" => $affectation->_view, "SERVICE COURANT" => $affectation->_ref_service->_view, "MEDICAMENTS DISPENSES" => implode("\n", $meds_dispenses));
     if (CAppUI::conf("dPhospi prestations systeme_prestations", CGroups::loadCurrent()) == "expert") {
         $fields_sejour["PRESTATIONS SOUHAITEES"] = implode(" - ", $souhaits);
     }
     $fields = array_merge($fields, $fields_sejour);
     if (CAppUI::conf("ref_pays") == 2) {
         $fields["NATURE SEJOUR"] = $this->getFormattedValue("_type_sejour");
         $fields["MODE TRT"] = $this->loadRefChargePriceIndicator()->code;
         $this->loadRefsFactureEtablissement();
         if ($this->_ref_last_facture) {
             $this->_ref_last_facture->loadRefAssurance();
             $fields["ASSUR MALADIE"] = $this->_ref_last_facture->_ref_assurance_maladie->nom;
             $fields["ASSUR ACCIDENT"] = $this->_ref_last_facture->_ref_assurance_accident->nom;
         }
     }
 }
Exemplo n.º 7
0
$names = array("nom" => "", "nom_jeune_fille" => "");
$prenom = null;
$PID5 = $xml->query("PID.5", $PID);
foreach ($PID5 as $_PID5) {
    // Nom(s)
    getNames($xml, $_PID5, $PID5, $names);
    // Prenom(s)
    $prenom = getFirstNames($xml, $_PID5);
}
$queries = array("Message" => array("control_id" => $xml->queryTextNode("MSH.10", $MSH), "datetime" => CMbDT::dateToLocale($xml->queryTextNode("MSH.7/TS.1", $MSH))), "EVN" => array("planned_event" => CMbDT::dateToLocale($xml->queryTextNode("EVN.2/TS.1", $EVN)), "event_occurred" => CMbDT::dateToLocale($xml->queryTextNode("EVN.6/TS.1", $EVN))), "CPatient" => array("nom" => $names["nom"], "nom_jeune_fille" => $names["nom_jeune_fille"], "prenom" => $prenom, "naissance" => CMbDT::dateToLocale($xml->queryTextNode("PID.7", $PID)), "_IPP" => CValue::read($data["personIdentifiers"], "PI")), "CSejour" => array("type" => $xml->queryTextNode("PV1.2", $PV1), "entree_prevue" => CMbDT::dateToLocale($xml->queryTextNode("PV2.8/TS.1", $PV2)), "entree_reelle" => CMbDT::dateToLocale($xml->queryTextNode("PV1.44/TS.1", $PV1)), "sortie_prevue" => CMbDT::dateToLocale($xml->queryTextNode("PV2.9/TS.1", $PV2)), "sortie_reelle" => CMbDT::dateToLocale($xml->queryTextNode("PV1.45/TS.1", $PV1)), "_NDA" => CValue::read($data["personIdentifiers"], "AN")));
if ($ZBE) {
    $movement_id = null;
    foreach ($xml->queryNodes("ZBE.1", $ZBE) as $ZBE_1) {
        $movement_id .= $xml->queryTextNode("EI.1", $ZBE_1) . "\n";
    }
    $queries_ZBE = array("CMovement" => array("movement_id" => $movement_id, "start_of_movement" => CMbDT::dateToLocale($xml->queryTextNode("ZBE.2/TS.1", $ZBE))));
    $queries = array_merge($queries, $queries_ZBE);
}
function getNames(CHL7v2MessageXML $xml, DOMNode $node, DOMNodeList $PID5, &$names = array())
{
    $fn1 = $xml->queryTextNode("XPN.1/FN.1", $node);
    switch ($xml->queryTextNode("XPN.7", $node)) {
        case "D":
            $names["nom"] = $fn1;
            break;
        case "L":
            // Dans le cas où l'on a pas de nom de nom de naissance le legal name
            // est le nom du patient
            if ($PID5->length > 1) {
                $names["nom_jeune_fille"] = $fn1;
            } else {
Exemplo n.º 8
0
 function completeLabelFields(&$fields, $params)
 {
     $this->loadIPP();
     $medecin_traitant = new CMedecin();
     $medecin_traitant->load($this->medecin_traitant);
     $this->loadRefsCorrespondantsPatient();
     $prevenir = new CCorrespondantPatient();
     if (count($this->_ref_cp_by_relation["prevenir"])) {
         $prevenir = reset($this->_ref_cp_by_relation["prevenir"]);
     }
     $fields = array_merge($fields, array("DATE NAISS" => CMbDT::dateToLocale($this->naissance), "IPP" => $this->_IPP, "LIEU NAISSANCE" => $this->lieu_naissance, "NOM" => $this->nom, "NOM JF" => $this->nom_jeune_fille, "FORMULE NOM JF" => $this->sexe == "f" && $this->nom_jeune_fille ? "née {$this->nom_jeune_fille}" : "", "PRENOM" => $this->prenom, "SEXE" => strtoupper($this->sexe), "CIVILITE" => $this->civilite, "CIVILITE LONGUE" => $this->_civilite_long, "ACCORD GENRE" => $this->sexe == "f" ? "e" : "", "CODE BARRE IPP" => "@BARCODE_" . $this->_IPP . "@", "ADRESSE" => "{$this->adresse} \n{$this->cp} {$this->ville}", "MED. TRAITANT" => "Dr {$medecin_traitant->nom} {$medecin_traitant->prenom}", "TEL" => $this->getFormattedValue("tel"), "TEL PORTABLE" => $this->getFormattedValue("tel2"), "TEL ETRANGER" => $this->getFormattedValue("tel_autre"), "PAYS" => $this->getFormattedValue("pays"), "PREVENIR - NOM" => $prevenir->nom, "PREVENIR - PRENOM" => $prevenir->prenom, "PREVENIR - ADRESSE" => $prevenir->adresse, "PREVENIR - TEL" => $prevenir->getFormattedValue("tel"), "PREVENIR - PORTABLE" => $prevenir->getFormattedValue("mob"), "PREVENIR - CP VILLE" => "{$prevenir->cp} {$prevenir->ville}"));
     switch (CAppUI::conf("ref_pays")) {
         case 1:
             $fields["NUM SECU"] = $this->matricule;
             break;
         case 2:
             $fields["AVS"] = $this->getFormattedValue("avs");
     }
 }
Exemplo n.º 9
0
 /**
  * @see parent::loadView()
  */
 function loadView()
 {
     parent::loadView();
     $sejour = $this->loadRefSejour();
     $patient = $sejour->loadRefPatient();
     if ($this->seance_collective_id) {
         $this->loadRefSeanceCollective();
         $this->debut = $this->_ref_seance_collective->debut;
         $this->duree = $this->_ref_seance_collective->duree;
     }
     $this->_view = "{$patient->_view} - " . CMbDT::dateToLocale(CMbDT::date($this->debut));
     $this->loadRefsActesCdARR();
     $this->loadRefsActesCsARR();
     if (!$this->sejour_id) {
         $this->loadRefsEvenementsSeance();
         foreach ($this->_ref_evenements_seance as $_evt_seance) {
             $_evt_seance->loadRefSejour()->loadRefPatient();
         }
     }
 }
Exemplo n.º 10
0
 /**
  * Update the death date to a datetime
  *
  * @return bool
  */
 function updateDeathDate()
 {
     $ds = $this->ds;
     $query = "SELECT `patient_id`, `deces` FROM `patients` WHERE `deces` IS NOT NULL;";
     $patients = $ds->loadList($query);
     $query = "ALTER TABLE `patients`\r\n                CHANGE `deces` `deces` DATETIME;";
     $ds->exec($query);
     $query = "UPDATE `patients` SET `deces`=REPLACE(`deces`, '-00', '-01') WHERE `deces` IS NOT NULL;";
     $ds->exec($query);
     $now = CMbDT::dateTime();
     $insert = array();
     foreach ($patients as $_patient) {
         $patient_id = $_patient["patient_id"];
         $deces = $_patient["deces"];
         $deces_after = CMbDT::dateToLocale(str_replace("-00", "-01", $deces));
         $deces = CMbDT::dateToLocale($deces);
         $insert[] = array("object_id" => $patient_id, "object_class" => "CPatient", "date" => $now, "libelle" => "Date décès", "text" => "Changement automatique de {$deces} à {$deces_after} 00:00:00");
     }
     $ds->insertMulti("note", $insert, 100);
     return true;
 }
Exemplo n.º 11
0
 static function getReleaseInfo()
 {
     $svn_status_file = __DIR__ . "/../tmp/svnstatus.txt";
     $root_release_file = __DIR__ . "/../release.xml";
     $applicationVersion = array("releaseTitle" => null, "releaseDate" => null, "releaseCode" => null, "releaseRev" => null, "revision" => null, "date" => null, "relative" => null, "title" => "");
     // Release information
     if (is_readable($root_release_file)) {
         $releaseInfoDOM = new DOMDocument();
         $releaseInfoDOM->load($root_release_file);
         $releaseElement = $releaseInfoDOM->documentElement;
         $releaseCode = $releaseElement->getAttribute("code");
         list($year, $month) = explode("_", $releaseCode);
         $title = strftime("%B", mktime(0, 0, 0, $month, 10)) . " " . $year;
         $applicationVersion["releaseTitle"] = $title;
         $applicationVersion["releaseDate"] = CMbDT::dateTimeFromXMLDuration($releaseElement->getAttribute("date"));
         $applicationVersion["releaseCode"] = $releaseCode;
         $applicationVersion["releaseRev"] = $releaseElement->getAttribute("rev");
         $applicationVersion["title"] = "Branche de " . $applicationVersion["releaseTitle"];
     }
     // Revision information
     if (is_readable($svn_status_file)) {
         $svnInfo = file($svn_status_file);
         $revision = array("revision" => explode(": ", $svnInfo[0]), "date" => explode(": ", $svnInfo[1]));
         $applicationVersion["revision"] = trim($revision["revision"][1]);
         $applicationVersion["date"] = CMbDT::dateTime(trim($revision["date"][1]));
         $applicationVersion["relative"] = CMbDate::relative($applicationVersion["date"]);
         $applicationVersion["title"] .= "\n" . "Mise à jour le " . CMbDT::dateToLocale($applicationVersion["date"]) . "\n" . "Révision : " . $applicationVersion["revision"];
     }
     return $applicationVersion;
 }
Exemplo n.º 12
0
 function completeLabelFields(&$fields, $params)
 {
     $fields = array_merge($fields, array("DATE COURANTE" => CMbDT::dateToLocale(CMbDT::date()), "HEURE COURANTE" => CMbDT::format(null, "%H:%M")));
 }
Exemplo n.º 13
0
$rpu = new CRPU();
/** @var CRPU[] $rpus */
$rpus = $rpu->loadList($where, $order, null, null, $leftjoin);
if (count($rpus) == 0) {
    CAppUI::stepAjax("Aucun RPU à extraire.", UI_MSG_ERROR);
}
foreach ($rpus as $_rpu) {
    $sejour = $_rpu->_ref_sejour;
    $sejour->loadExtDiagnostics();
    $sejour->loadDiagnosticsAssocies(false);
    $sejour->loadRefsConsultations();
}
// Appel de la fonction d'extraction du RPUSender
$rpuSender = $extractPassages->getRPUSender();
if (!$rpuSender) {
    CAppUI::stepAjax("Aucun sender définit dans le module dPurgences.", UI_MSG_ERROR);
}
$extractPassages = $rpuSender->extractRPU($extractPassages, $rpus);
CAppUI::stepAjax("Extraction de " . count($rpus) . " RPUs du " . CMbDT::dateToLocale($debut_selection) . " au " . CMbDT::dateToLocale($fin_selection) . " terminée.", UI_MSG_OK);
if (!$extractPassages->message_valide) {
    CAppUI::stepAjax("Le document produit n'est pas valide.", UI_MSG_WARNING);
} else {
    CAppUI::stepAjax("Le document produit est valide.", UI_MSG_OK);
}
foreach ($rpus as $_rpu) {
    $rpu_passage = new CRPUPassage();
    $rpu_passage->rpu_id = $_rpu->_id;
    $rpu_passage->extract_passages_id = $extractPassages->_id;
    $rpu_passage->store();
}
echo "<script>RPU_Sender.extract_passages_id = {$extractPassages->_id};</script>";
Exemplo n.º 14
0
$where = array();
$ljoin = array();
$where["duree_uscpo"] = "> 0";
$where["annulee"] = "!= '1'";
$where[] = "operations.passage_uscpo = '1' or operations.passage_uscpo IS NULL";
if ($service_id) {
    $ljoin["sejour"] = "sejour.sejour_id = operations.sejour_id";
    $where["sejour.service_id"] = "= '{$service_id}'";
}
$day = $date_min;
$dates = array();
$series = array();
$serie = array('data' => array(), 'label' => utf8_encode("Nombre de nuits prévues"));
$today = CMbDT::date();
while ($day <= $date_max) {
    $display = CMbDT::dateToLocale($day);
    // On préfixe d'une étoile si c'est le jour courant
    if ($day == $today) {
        $display = "* " . $display;
    }
    $dates[] = array(count($dates), $display);
    $day_min = CMbDT::date("-{$max_uscpo} DAY", $day);
    $where[10] = "operations.date BETWEEN '{$day_min}' AND '{$day}'";
    $where[11] = "DATE_ADD(operations.date, INTERVAL duree_uscpo DAY) > '{$day}'";
    $count = $operation->countList($where, null, $ljoin);
    $day = CMbDT::date("+1 day", $day);
    $serie['data'][] = array(count($serie['data']) - 0.2, $count);
}
$series[] = $serie;
$day = $date_min;
$serie = array('data' => array(), 'label' => utf8_encode("Nombre de nuits placées"));
Exemplo n.º 15
0
 /**
  * @see parent::completeLabelFields()
  */
 function completeLabelFields(&$fields, $params)
 {
     if (!isset($this->_from_sejour)) {
         $this->loadRefSejour()->_from_op = 1;
         $this->_ref_sejour->completeLabelFields($fields, $params);
     }
     $this->loadRefPlageOp();
     $this->loadRefAnesth();
     $new_fields = array("ANESTH" => $this->_ref_anesth->_view, "LIBELLE" => $this->libelle, "DATE" => $this->_id ? CMbDT::dateToLocale(CMbDT::date($this->_datetime_best)) : "", "COTE" => $this->getFormattedValue("cote"));
     $fields = array_merge($fields, $new_fields);
 }
Exemplo n.º 16
0
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     if ($this->evenements) {
         $this->_ref_evenement = explode('|', $this->evenements);
     }
     if ($this->qualite_date_controle) {
         $this->_etat_actuel = CAppUI::tr("_CFicheEi_acc-CTRL_OK");
     } elseif (!$this->service_date_validation && $this->service_valid_user_id) {
         $this->_etat_actuel = CAppUI::tr("_CFicheEi_acc-ATT_CS_adm");
     } elseif (!$this->qualite_user_id) {
         $this->_etat_actuel = CAppUI::tr("_CFicheEi_acc-ATT_QUALITE_adm");
     } elseif (!$this->qualite_date_validation) {
         $this->_etat_actuel = CAppUI::tr("_CFicheEi_acc-ATT_QUALITE_adm");
     } elseif (!$this->qualite_date_verification) {
         $this->_etat_actuel = CAppUI::tr("_CFicheEi_acc-ATT_VERIF");
     } else {
         $this->_etat_actuel = CAppUI::tr("_CFicheEi_acc-ATT_CTRL");
     }
     $this->loadCriticite();
     $this->_view = sprintf("%03d - %s", $this->fiche_ei_id, CMbDT::dateToLocale(substr($this->date_fiche, 0, 10)));
 }
 /**
  * @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);
 }
Exemplo n.º 18
0
$context->fillTemplate($template_header);
$header = CCompteRendu::getSpecialModel($user, "CPatient", "[ENTETE MOZAIC]");
if ($header->_id) {
    $header->loadContent();
    $template_header->renderDocument($header->_source);
} else {
    $template_header->document = "<p style=\"text-align:center;\">" . $context->_view . "</p>";
}
$template_footer = new CTemplateManager();
$context->fillTemplate($template_footer);
$footer = CCompteRendu::getSpecialModel($user, "CPatient", "[PIED DE PAGE MOZAIC]");
if ($footer->_id) {
    $footer->loadContent();
    $template_footer->renderDocument($footer->_source);
} else {
    $template_footer->document = "<p style=\"text-align:center;\">" . CMbDT::dateToLocale(CMbDT::dateTime()) . "</p>";
}
// main body
$_dispo = explode("_", $dispo);
$_dispos = explode("x", $_dispo[1]);
$cols = $_dispos[0];
$lines = $_dispos[1];
$content = "<html>\n<head>\n<style>\n  body {border:0;margin:0; position:relative;}\n  #header, #footer {position:absolute; top: 0; width:100%; overflow: hidden;}\n  #footer {top:25cm;}\n  #body {height:23cm; width:100%; border-collapse: collapse; table-layout: fixed; position: absolute; top: 2cm;}\n  #images {position:relative; width: 100%; height:100%;}\n  #body div.col {\n    position: absolute;\n    overflow: hidden;\n    line-height: 100%;\n    max-width: 100%;\n    text-align: center;\n    vertical-align: middle!important;\n  }\n\n  #images img {\n  box-shadow: 0 0 5px #b8b8b8;\n  }\n\n  #body p {\n    position:absolute;\n    bottom:0;\n    left:0;\n    width:100%;\n    text-align: center;\n  }\n\n  #body p span {\n    background-color:white;\n    border:solid 1px #6e6e6e;\n    padding:3px;\n  }\n\n  .droppable {\n    padding:4px;\n  }\n\n  #body img {max-width:100%; max-height: 100%;}\n  .nb_line_1 {height:100%;}\n  .nb_line_2 {height:50%;}\n  .nb_line_3 {height:33%;}\n\n  .nb_col_1 {width:100%;}\n  .nb_col_2 {width:50%;}\n  .nb_col_3 {width:33%;}\n\n  .line_1 {top:0;}\n  .nb_line_2.line_2 {top:50%;}\n  .nb_line_3.line_2 {top:33%;}\n  .nb_line_3.line_3 {top:66%;}\n\n  .col_1 {left:0;}\n  .nb_col_2.col_2 {left:50%;}\n  .nb_col_3.col_2 {left:33%;}\n  .nb_col_3.col_3 {left:66%;}\n\n</style>\n</head>\n<body>\n<div id=\"header\">{$template_header->document}</div>\n<div id=\"body\"><div id=\"images\">";
for ($a = 1; $a <= $lines; $a++) {
    for ($b = 1; $b <= $cols; $b++) {
        $content .= "\n    <div class=\"col nb_col_{$cols} nb_line_{$lines} col_{$b} line_{$a}\">";
        $content .= $data[$_dispo[1] . "_" . $a . "x" . $b]["file_id"] ? "<img src=\"" . $data[$_dispo[1] . "_" . $a . "x" . $b]["file_uri"] . "\" alt=\"\"/>" : null;
        $content .= $data[$_dispo[1] . "_" . $a . "x" . $b]["file_id"] ? "<p><span>" . $data[$_dispo[1] . "_" . $a . "x" . $b]["name"] . "</span></p>" : null;
        $content .= "\n    </div>";
    }
}
Exemplo n.º 19
0
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     // @todo: A supprimer du updateFormFields
     $sejour = $this->loadRefSejour();
     $this->_responsable_id = $sejour->praticien_id;
     $this->_entree = $sejour->_entree;
     $this->_DP = $sejour->DP;
     $this->_annule = $sejour->annule;
     $this->_UHCD = $sejour->UHCD;
     $patient =& $sejour->_ref_patient;
     $this->_patient_id = $patient->_id;
     $this->_cp = $patient->cp;
     $this->_ville = $patient->ville;
     $this->_naissance = $patient->naissance;
     $this->_sexe = $patient->sexe;
     $this->_view = "RPU du " . CMbDT::dateToLocale(CMbDT::date($this->_entree)) . " pour {$patient->_view}";
     // Calcul des valeurs de _mode_sortie
     if ($sejour->mode_sortie == "mutation") {
         $this->_mode_sortie = 6;
     }
     if ($sejour->mode_sortie == "transfert") {
         $this->_mode_sortie = 7;
     }
     if ($sejour->mode_sortie == "normal") {
         $this->_mode_sortie = 8;
     }
     if ($sejour->mode_sortie == "deces") {
         $this->_mode_sortie = 9;
     }
     $this->_service_id = $sejour->service_id;
     $this->_mode_entree = $sejour->mode_entree;
     $this->_mode_entree_id = $sejour->mode_entree_id;
     $this->_sortie = $sejour->sortie_reelle;
     $this->_provenance = $sejour->provenance;
     $this->_transport = $sejour->transport;
     $this->_destination = $sejour->destination;
     $this->_etablissement_sortie_id = $sejour->etablissement_sortie_id;
     $this->_etablissement_entree_id = $sejour->etablissement_entree_id;
     $this->_service_entree_id = $sejour->service_entree_id;
     $this->_service_sortie_id = $sejour->service_sortie_id;
     $this->_uf_soins_id = $sejour->uf_soins_id;
     // @todo: A supprimer du updateFormFields
     $this->loadRefConsult();
     if ($this->_ref_consult->_id) {
         $this->_ref_consult->countDocItems();
     }
     // Récupération du libellé de la circonstance si actif dans la configuration
     if (CAppUI::conf("dPurgences gerer_circonstance")) {
         $this->getCirconstance();
     }
 }
Exemplo n.º 20
0
        $labels[] = array(count($labels), $_hour);
        $serie_a['data'][] = array(count($serie_a['data']), $count);
    }
    $options = CFlotrGraph::merge("lines", array('title' => utf8_encode("Logs par heure"), 'xaxis' => array('ticks' => $labels), 'yaxis' => array('tickDecimals' => 0, 'min' => 0, 'autoscaleMargin' => 1), 'y2axis' => array('tickDecimals' => 0, 'min' => 0, 'autoscaleMargin' => 1), 'grid' => array('verticalLines' => true)));
    // Ips distinctes par hour (nb d'ips)
    $serie_b = array('data' => array(), 'yaxis' => 2, 'label' => utf8_encode("Nombre d'ips par heure"));
    $labels = array();
    foreach ($count_by_hour_ip as $_count) {
        $serie_b['data'][] = array(count($serie_b['data']), count($_count));
    }
    $graphs["hour"] = array('series' => array($serie_a, $serie_b), 'options' => $options);
    // Logs par jour
    $serie = array('data' => array(), 'label' => utf8_encode("Logs par jour"));
    $labels = array();
    foreach ($count_by_day as $_day => $count) {
        $labels[] = array(count($labels), CMbDT::dateToLocale($_day));
        $serie['data'][] = array(count($serie['data']), $count);
    }
    $options = CFlotrGraph::merge("bars", array('title' => utf8_encode("Logs par jour"), 'xaxis' => array('ticks' => $labels), 'yaxis' => array('tickDecimals' => 0), 'grid' => array('verticalLines' => true)));
    $graphs["day"] = array('series' => array($serie), 'options' => $options);
    // Logs par IP
    $serie = array('data' => array(), 'label' => utf8_encode("Logs par ip"));
    $labels = array();
    foreach ($count_by_ip as $_ip => $count) {
        $labels[] = array(count($labels), $_ip);
        $serie['data'][] = array(count($serie['data']), $count);
    }
    $options = CFlotrGraph::merge("bars", array('title' => utf8_encode("Logs par ip"), 'xaxis' => array('ticks' => $labels), 'yaxis' => array('tickDecimals' => 0), 'grid' => array('verticalLines' => true)));
    $graphs["ip"] = array('series' => array($serie), 'options' => $options);
}
$smarty = new CSmartyDP();
Exemplo n.º 21
0
$smarty->assign("date_min", $date_min);
$smarty->assign("date_max", $date_max);
$smarty->assign("type", "occupation");
$smarty->assign("service_id", $service_id);
$smarty->assign("services", $services);
if (!$service_id) {
    $smarty->display("inc_form_stats.tpl");
    CAppUI::stepMessage(UI_MSG_ALERT, "warning-hospi-stats-choose_service");
    return;
}
$ds = CSQLDataSource::get("std");
$dates = array();
$date_temp = $date_min;
$series = array();
while ($date_temp <= $date_max) {
    $dates[] = array(count($dates), CMbDT::dateToLocale($date_temp));
    $date_temp = CMbDT::date("+1 day", $date_temp);
}
// Table temporaraire de dates pour les jointures
$tab_name = CSQLDataSource::tempTableDates($date_min, $date_max);
// Nombre de lits totaux sur le service
$lit = new C**t();
$where = array();
$ljoin = array();
$ljoin["chambre"] = "chambre.chambre_id = lit.chambre_id";
$where["service_id"] = " = '{$service_id}'";
$where["lit.annule"] = " = '0'";
$nb_lits = $lit->countList($where, null, $ljoin);
if (!$nb_lits) {
    $smarty->display("inc_form_stats.tpl");
    CAppUI::stepMessage(UI_MSG_WARNING, "warning-hospi-stats-no_beds");