* @version $Revision$ */ CCanDo::checkRead(); $operation_id = CValue::get("operation_id"); $interv = new COperation(); $interv->load($operation_id); $interv->loadRefSejour()->loadRefPatient()->loadRefLatestConstantes(); $interv->loadRefPlageOp(); $interv->_ref_sejour->_ref_patient->loadRefDossierMedical(); $consult_anesth = $interv->loadRefsConsultAnesth(); $group = CGroups::loadCurrent(); $pack = $interv->loadRefGraphPack(); list($graphs, $yaxes_count, $time_min, $time_max, $time_debut_op_iso, $time_fin_op_iso) = CObservationResultSet::buildGraphs($interv, $pack->_id); $time_debut_op = CMbDate::toUTCTimestamp($time_debut_op_iso); $time_fin_op = CMbDate::toUTCTimestamp($time_fin_op_iso); $evenements = CObservationResultSet::buildEventsGrid($interv, $time_debut_op_iso, $time_fin_op_iso, $time_min, $time_max); $now = 100 * (CMbDate::toUTCTimestamp(CMbDT::dateTime()) - $time_min) / ($time_max - $time_min); $graph_packs = CSupervisionGraphPack::getAllFor($group); $concentrators = null; if (CModule::getActive("patientMonitoring")) { $concentrator = new CMonitoringConcentrator(); $concentrators = $concentrator->loadList(); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("pack", $pack); $smarty->assign("interv", $interv); $smarty->assign("graphs", $graphs); $smarty->assign("evenements", $evenements); $smarty->assign("time_debut_op", $time_debut_op); $smarty->assign("time_fin_op", $time_fin_op);
if ($_mix->date_retrait && $_mix->time_retrait) { $perops[$_mix->_retrait][$_mix->_guid] = $_mix; } } } ksort($perops); $perop_graphs = array(); $time_debut_op = null; $time_fin_op = null; $yaxes_count = null; $grid = array(); $labels = array(); $list_obr = array(); if (CAppUI::conf("dPsalleOp enable_surveillance_perop")) { /** @var CObservationResultSet[] $list_obr */ list($list, $grid, $graphs, $labels, $list_obr) = CObservationResultSet::getChronological($operation, $operation->graph_pack_id); foreach ($list_obr as $_obr) { $_obr->loadFirstLog()->loadRefUser()->loadRefMediuser()->loadRefFunction(); } } // Création du template $smarty = new CSmartyDP(); $smarty->assign("patient", $operation->_ref_sejour->_ref_patient); $smarty->assign("operation", $operation); $smarty->assign("perops", $perops); $smarty->assign("perop_graphs", $perop_graphs); $smarty->assign("yaxes_count", $yaxes_count); $smarty->assign("time_debut_op", $time_debut_op); $smarty->assign("time_fin_op", $time_fin_op); $smarty->assign("observation_grid", $grid); $smarty->assign("observation_labels", $labels);
/** * Ajoute les données des graphiques de supervision * * @param CTemplateManager $template The template manager * @param CMbObject $object The host object * @param string $name The field name * * @return void */ static function addObservationDataToTemplate(CTemplateManager $template, CMbObject $object, $name) { $prefix = "Supervision"; $group_id = CGroups::loadCurrent()->_id; $results = array(); $times = array(); if ($object->_id) { list($results, $times) = CObservationResultSet::getResultsFor($object, false); $times = array_combine($times, $times); } // CSupervisionGraphAxis $axis = new CSupervisionGraphAxis(); $ds = $axis->getDS(); $where = array("supervision_graph_axis.in_doc_template" => "= '1'", "supervision_graph.owner_class" => "= 'CGroups'", "supervision_graph.owner_id" => $ds->prepare("= ?", $group_id)); $ljoin = array("supervision_graph" => "supervision_graph.supervision_graph_id = supervision_graph_axis.supervision_graph_id"); $order = array("supervision_graph.title", "supervision_graph_axis.title"); /** @var CSupervisionGraphAxis[] $axes */ $axes = $axis->loadList($where, $order, null, null, $ljoin); CStoredObject::massLoadFwdRef($axes, "supervision_graph_id", null, true); foreach ($axes as $_axis) { $_graph = $_axis->loadRefGraph(); $_series = $_axis->loadRefsSeries(); $_axis->loadRefsLabels(); $_data = array_fill_keys($times, array()); foreach ($_series as $_serie) { $_unit_id = $_serie->value_unit_id ?: "none"; $_unit_label = $_serie->loadRefValueUnit(); if (!isset($results[$_serie->value_type_id][$_unit_id])) { continue; } foreach ($results[$_serie->value_type_id][$_unit_id] as $_value) { foreach ($times as $_time) { if ($_value["datetime"] != $_time) { continue; } $_value["unit"] = $_unit_label->label; $_data["{$_time}"][$_serie->_id] = $_value; break; } } } $view = ""; if (count($_data)) { $smarty = new CSmartyDP("modules/dPsalleOp"); $smarty->assign("data", $_data); $smarty->assign("series", $_series); $smarty->assign("times", $times); $view = $smarty->fetch("inc_print_observation_result_set.tpl", '', '', 0); $view = preg_replace('`([\\n\\r])`', '', $view); } $template->addProperty("{$name} - {$prefix} - {$_graph->title} - {$_axis->title}", trim($view), "", false); } // CSupervisionTimedPicture // CSupervisionTimedData $data = array("CSupervisionTimedPicture", "CSupervisionTimedData"); foreach ($data as $_class) { /** @var CSupervisionTimedPicture|CSupervisionTimedData $_object */ $_object = new $_class(); $_table = $_object->_spec->table; $_ds = $_object->getDS(); $where = array("{$_table}.in_doc_template" => "= '1'", "{$_table}.owner_class" => "= 'CGroups'", "{$_table}.owner_id" => $_ds->prepare("= ?", $group_id)); $order = "title"; /** @var CSupervisionTimedPicture[]|CSupervisionTimedData[] $_objects */ $_objects = $_object->loadList($where, $order); foreach ($_objects as $_timed) { $_data = array_fill_keys($times, null); if (!isset($results[$_timed->value_type_id])) { continue; } foreach ($results[$_timed->value_type_id]["none"] as $_value) { foreach ($times as $_time) { if ($_value["datetime"] != $_time) { continue; } if ($_value["file_id"]) { $_file = new CFile(); $_file->load($_value["file_id"]); $_value["datauri"] = $_file->getDataURI(); $_value["file"] = $_file; } $_data["{$_time}"] = $_value; break; } } $view = ""; if (count($_data)) { $smarty = new CSmartyDP("modules/dPsalleOp"); $smarty->assign("data", $_data); $smarty->assign("times", $times); $smarty->assign("timed_data", true); $view = $smarty->fetch("inc_print_observation_result_set.tpl", '', '', 0); $view = preg_replace('`([\\n\\r])`', '', $view); } $template->addProperty("{$name} - {$prefix} - {$_timed->title}", trim($view), "", false); } } }
/** * $Id: ajax_edit_observation_result_set.php 27681 2015-03-24 16:11:04Z phenxdesign $ * * @package Mediboard * @subpackage SalleOp * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 27681 $ */ CCanDo::checkRead(); $object_guid = CValue::get("object_guid"); $pack_id = CValue::get("pack_id"); $result_set_id = CValue::get("result_set_id"); $result_id = CValue::get("result_id"); $result_set = new CObservationResultSet(); if ($result_set_id) { $result_set->load($result_set_id); $object = $result_set->loadRefContext(); } else { /** @var COperation|CSejour $object */ $object = CStoredObject::loadFromGuid($object_guid); $result_set->context_class = $object->_class; $result_set->context_id = $object->_id; $result_set->datetime = CMbDT::dateTime(); $result_set->patient_id = $object->loadRelPatient()->_id; } list($results) = CObservationResultSet::getResultsFor($object); $pack = new CSupervisionGraphPack(); $pack->load($pack_id); $links = $pack->loadRefsGraphLinks();
function fillLimitedTemplate(&$template) { $this->loadRefsFwd(1); $this->loadRefPraticien(); $this->loadRefChir2(); $this->loadRefChir3(); $this->loadRefChir4(); $this->loadRefsFiles(); $this->loadAffectationsPersonnel(); $plageop = $this->_ref_plageop; $plageop->loadAffectationsPersonnel(); foreach ($this->_ext_codes_ccam as $_code) { $_code->getRemarques(); $_code->getActivites(); } $this->notify("BeforeFillLimitedTemplate", $template); for ($i = 1; $i < 5; $i++) { $prop = "_ref_chir" . ($i == 1 ? "" : "_{$i}"); $praticien = $this->{$prop}; $praticien->loadRefFunction(); $praticien->loadRefDiscipline(); $praticien->loadRefSpecCPAM(); $number = $i == 1 ? "" : " {$i}"; $template->addProperty("Opération - Chirurgien{$number}", $praticien->_id ? "Dr " . $praticien->_view : ''); $template->addProperty("Opération - Chirurgien{$number} - Nom", $praticien->_user_last_name); $template->addProperty("Opération - Chirurgien{$number} - Prénom", $praticien->_user_first_name); $template->addProperty("Opération - Chirurgien{$number} - Initiales", $praticien->_shortview); $template->addProperty("Opération - Chirurgien{$number} - Discipline", $praticien->_ref_discipline->_view); $template->addProperty("Opération - Chirurgien{$number} - Spécialité", $praticien->_ref_spec_cpam->_view); $template->addProperty("Opération - Chirurgien{$number} - CAB", $praticien->cab); $template->addProperty("Opération - Chirurgien{$number} - CONV", $praticien->conv); $template->addProperty("Opération - Chirurgien{$number} - ZISD", $praticien->zisd); $template->addProperty("Opération - Chirurgien{$number} - IK", $praticien->ik); $template->addProperty("Opération - Chirurgien{$number} - Titres", $praticien->titres); $template->addProperty("Opération - Chirurgien{$number} - ADELI", $praticien->adeli); $template->addBarcode("Opération - Chirurgien{$number} - Code barre ADELI", $praticien->adeli, array("barcode" => array("title" => CAppUI::tr("CMediusers-adeli")))); $template->addProperty("Opération - Chirurgien{$number} - RPPS", $praticien->rpps); $template->addBarcode("Opération - Chirurgien{$number} - Code barre RPPS", $praticien->rpps, array("barcode" => array("title" => CAppUI::tr("CMediusers-rpps")))); $template->addProperty("Opération - Chirurgien{$number} - E-mail", $praticien->_user_email); $template->addProperty("Opération - Chirurgien{$number} - E-mail Apicrypt", $praticien->mail_apicrypt); } $template->addProperty("Opération - Anesthésiste - nom", @$this->_ref_anesth->_user_last_name); $template->addProperty("Opération - Anesthésiste - prénom", @$this->_ref_anesth->_user_first_name); $template->addProperty("Opération - Anesthésie", $this->_lu_type_anesth); $template->addProperty("Opération - libellé", $this->libelle); $template->addProperty("Opération - CCAM1 - code", @$this->_ext_codes_ccam[0]->code); $template->addProperty("Opération - CCAM1 - description", @$this->_ext_codes_ccam[0]->libelleLong); $template->addProperty("Opération - CCAM1 - montant activité 1", @$this->_ext_codes_ccam[0]->activites[1]->phases[0]->tarif); $template->addProperty("Opération - CCAM1 - montant activité 4", @$this->_ext_codes_ccam[0]->activites[4]->phases[0]->tarif); $template->addProperty("Opération - CCAM2 - code", @$this->_ext_codes_ccam[1]->code); $template->addProperty("Opération - CCAM2 - description", @$this->_ext_codes_ccam[1]->libelleLong); $template->addProperty("Opération - CCAM2 - montant activité 1", @$this->_ext_codes_ccam[1]->activites[1]->phases[0]->tarif); $template->addProperty("Opération - CCAM2 - montant activité 4", @$this->_ext_codes_ccam[1]->activites[4]->phases[0]->tarif); $template->addProperty("Opération - CCAM3 - code", @$this->_ext_codes_ccam[2]->code); $template->addProperty("Opération - CCAM3 - description", @$this->_ext_codes_ccam[2]->libelleLong); $template->addProperty("Opération - CCAM3 - montant activité 1", @$this->_ext_codes_ccam[2]->activites[1]->phases[0]->tarif); $template->addProperty("Opération - CCAM3 - montant activité 4", @$this->_ext_codes_ccam[2]->activites[4]->phases[0]->tarif); $template->addProperty("Opération - CCAM - codes", implode(" - ", $this->_codes_ccam)); if (CModule::getActive("tarmed") && CAppUI::conf("tarmed CCodeTarmed use_cotation_tarmed")) { $this->loadRefsActes(); $template->addProperty("Opération - TARMED - codes", CActeTarmed::actesHtml($this), '', false); $template->addProperty("Opération - Caisse - codes", CActeCaisse::actesHtml($this), '', false); } $template->addProperty("Opération - CCAM - descriptions", implode(" - ", CMbArray::pluck($this->_ext_codes_ccam, "libelleLong"))); $template->addProperty("Opération - salle", @$this->_ref_salle->nom); $template->addProperty("Opération - côté", $this->cote); $template->addProperty("Opération - position", $this->getFormattedValue("position")); $template->addDateProperty("Opération - date", $this->_datetime_best != " 00:00:00" ? $this->_datetime_best : ""); $template->addLongDateProperty("Opération - date longue", $this->_datetime_best != " 00:00:00" ? $this->_datetime_best : ""); $template->addTimeProperty("Opération - heure", $this->time_operation); $template->addTimeProperty("Opération - durée", $this->temp_operation); $template->addTimeProperty("Opération - durée réelle", $this->_duree_interv); $template->addTimeProperty("Opération - entrée bloc", $this->entree_salle); $template->addTimeProperty("Opération - pose garrot", $this->pose_garrot); $template->addTimeProperty("Opération - début induction", $this->induction_debut); $template->addTimeProperty("Opération - début op", $this->debut_op); $template->addTimeProperty("Opération - fin op", $this->fin_op); $template->addTimeProperty("Opération - fin induction", $this->induction_fin); $template->addTimeProperty("Opération - retrait garrot", $this->retrait_garrot); $template->addTimeProperty("Opération - sortie bloc", $this->sortie_salle); $template->addTimeProperty("Opération - entrée SSPI", $this->entree_reveil); $template->addTimeProperty("Opération - sortie SSPI", $this->sortie_reveil_reel); $template->addProperty("Opération - dépassement anesth", $this->depassement_anesth); $template->addProperty("Opération - Passage USCPO", "{$this->duree_uscpo} nuit(s)"); if (CModule::getActive("mvsante")) { $template->addTimeProperty("Opération - Remise au chirurgien", $this->remise_chir); /** @var CLiaisonLibelleInterv[] $liaisons_libelles */ $liaisons_libelles = $this->loadBackRefs("liaison_libelle", "numero"); CMbObject::massLoadFwdRef($liaisons_libelles, "libelleop_id"); $libelles = array(0 => "", 1 => "", 2 => "", 3 => ""); foreach ($liaisons_libelles as $_liaison) { $libelles[$_liaison->numero - 1] = $_liaison->loadRefLibelle()->nom; } $template->addProperty("Opération - Libellé 1", $libelles[0]); $template->addProperty("Opération - Libellé 2", $libelles[1]); $template->addProperty("Opération - Libellé 3", $libelles[2]); $template->addProperty("Opération - Libellé 4", $libelles[3]); } $template->addProperty("Opération - depassement", $this->depassement); $template->addProperty("Opération - exams pre-op", $this->examen); $template->addProperty("Opération - matériel", $this->materiel); $template->addProperty("Opération - exam per-op", $this->exam_per_op); $template->addProperty("Opération - convalescence", $this->_ref_sejour->convalescence); $template->addProperty("Opération - remarques", $this->rques); $template->addProperty("Opération - Score ASA", $this->getFormattedValue("ASA")); $consult_anesth = $this->_ref_consult_anesth; $consult = $consult_anesth->loadRefConsultation(); $consult->loadRefPlageConsult(); $prat = $consult->loadRefPraticien(); $template->addDateProperty("Opération - Consultation anesthésie - Date", $consult->_id ? $consult->_datetime : ""); $template->addLongDateProperty("Opération - Consultation anesthésie - Date (longue)", $consult->_id ? $consult->_datetime : ""); $template->addLongDateProperty("Opération - Consultation anesthésie - Date (longue, minuscule)", $consult->_id ? $consult->_datetime : "", true); $template->addTimeProperty("Opération - Consultation anesthésie - Heure", $consult->_id ? $consult->_datetime : ""); $template->addProperty("Opération - Consultation anesthésie - Praticien - Prénom", $consult->_id ? $prat->_user_first_name : ""); $template->addProperty("Opération - Consultation anesthésie - Praticien - Nom", $consult->_id ? $prat->_user_last_name : ""); $template->addProperty("Opération - Consultation anesthésie - Remarques", $consult->rques); /** @var CMediusers $prat_visite */ $prat_visite = $this->loadFwdRef("prat_visite_anesth_id", true); $template->addDateProperty("Opération - Visite pré anesthésie - Date", $this->date_visite_anesth); $template->addLongDateProperty("Opération - Visite pré anesthésie - Date (longue)", $this->date_visite_anesth); $template->addProperty("Opération - Visite pré anesthésie - Rques", $this->getFormattedValue("rques_visite_anesth")); $template->addProperty("Opération - Visite pré anesthésie - Autorisation", $this->getFormattedValue("autorisation_anesth")); $template->addProperty("Opération - Visite pré anesthésie - Praticien - Prénom", $prat_visite->_user_first_name); $template->addProperty("Opération - Visite pré anesthésie - Praticien - Nom", $prat_visite->_user_last_name); $template->addBarcode("Opération - Code Barre ID", $this->_id); $list = CMbArray::pluck($this->_ref_files, "file_name"); $template->addListProperty("Opération - Liste des fichiers", $list); foreach ($this->_ref_affectations_personnel as $emplacement => $affectations) { $locale = CAppUI::tr("CPersonnel.emplacement.{$emplacement}"); $property = implode(" - ", CMbArray::pluck($affectations, "_ref_personnel", "_ref_user", "_view")); $template->addProperty("Opération - personnel réel - {$locale}", $property); } foreach ($plageop->_ref_affectations_personnel as $emplacement => $affectations) { $locale = CAppUI::tr("CPersonnel.emplacement.{$emplacement}"); $property = implode(" - ", CMbArray::pluck($affectations, "_ref_personnel", "_ref_user", "_view")); $template->addProperty("Opération - personnel prévu - {$locale}", $property); } $evts = $incidents = array(); foreach ($this->loadRefsAnesthPerops() as $_evt) { if ($_evt->incident) { $incidents[] = $_evt; continue; } $evts[] = $_evt; } $template->addListProperty("Opération - Evenements per-opératoires", $evts); $template->addListProperty("Opération - Incidents per-opératoires", $incidents); CSupervisionGraph::addObservationDataToTemplate($template, $this, "Opération"); if (CModule::getActive("forms")) { CExObject::addFormsToTemplate($template, $this, "Opération"); } if (CAppUI::conf("dPsalleOp enable_surveillance_perop")) { $obs_view = ""; if ($template->valueMode && $this->_id && $this->graph_pack_id) { /** @var CObservationResultSet[] $list_obr */ list($list, $grid, $graphs, $labels, $list_obr) = CObservationResultSet::getChronological($this, $this->graph_pack_id); foreach ($grid as $_row) { /** @var CObservationResult[] $_row */ foreach ($_row as $_cell) { if ($_cell && $_cell->file_id) { $_cell->loadRefFile()->getDataUri(); } } } $smarty = new CSmartyDP("modules/dPpatients"); // Horizontal $smarty->assign("observation_grid", $grid); $smarty->assign("observation_labels", $labels); $smarty->assign("observation_list", $list_obr); $smarty->assign("in_compte_rendu", true); $obs_view = $smarty->fetch("inc_observation_results_grid.tpl", '', '', 0); $obs_view = preg_replace('`([\\n\\r])`', '', $obs_view); } $template->addProperty("Opération - Tableau supervision", $obs_view, '', false); } $this->notify("AfterFillLimitedTemplate", $template); }
/** * OBX Segment pulse generator and lead observation results * * @param DOMNode $OBX DOM node * @param CPatient $patient Person * @param COperation $operation Opération * @param string $date Date * * @return bool */ function getPulseGeneratorAndLeadObservationResults(DOMNode $OBX, CPatient $patient, COperation $operation, $date) { $result_set = new CObservationResultSet(); $datetime = $this->getOBXObservationDateTime($OBX) ?: $date; if ($datetime) { $result_set->patient_id = $patient->_id; $result_set->context_class = $operation->_class; $result_set->context_id = $operation->_id; $result_set->datetime = CMbDT::dateTime($datetime); if (!$result_set->loadMatchingObject()) { if ($msg = $result_set->store()) { $this->codes[] = "E302"; } } } // Traiter le cas où ce sont des paramètres sans résultat utilisable if ($this->getObservationResultStatus($OBX) === "X") { return true; } $result = new CObservationResult(); $result->observation_result_set_id = $result_set->_id; $this->mappingObservationResult($OBX, $result); /* @todo à voir si on envoi un message d'erreur ou si on continu ... */ if ($msg = $result->store()) { $this->codes[] = "E304"; } return true; }
/** * Chargement des graphiques d'intervention * * @param COperation $interv Intervention * * @param int $pack_id Pack de graphiques * * @return array */ static function buildGraphs(COperation $interv, $pack_id) { list($results, ) = CObservationResultSet::getResultsFor($interv); list($time_min, $time_max, $time_debut_op_iso, $time_fin_op_iso, ) = self::getLimitTimes($interv); $pack = new CSupervisionGraphPack(); $pack->load($pack_id); $graph_links = $pack->loadRefsGraphLinks(); $graphs = array(); foreach ($graph_links as $_gl) { $_go = $_gl->loadRefGraph(); $graphs[] = $_go; if ($_go instanceof CSupervisionGraph) { $_go->buildGraph($results, $time_min, $time_max); } elseif ($_go instanceof CSupervisionTimedData) { $_go->loadTimedData($results, $time_min, $time_max); } elseif ($_go instanceof CSupervisionTimedPicture) { $_go->loadTimedPictures($results, $time_min, $time_max); } elseif ($_go instanceof CSupervisionInstantData) { $_go->loadRefValueType(); $_go->loadRefValueUnit(); } } /* $graph_object = new CSupervisionGraph; $graph_objects = $graph_object->loadList(array( "disabled" => "= '0'", )); $graphs = array(); foreach ($graph_objects as $_go) { $graphs[] = $_go->buildGraph($results, $time_min, $time_max); }*/ $yaxes_count = 0; foreach ($graphs as $_graph) { if ($_graph instanceof CSupervisionGraph) { $yaxes_count = max($yaxes_count, count($_graph->_graph_data["yaxes"])); } } foreach ($graphs as $_graph) { if ($_graph instanceof CSupervisionGraph) { if (count($_graph->_graph_data["yaxes"]) < $yaxes_count) { $_graph->_graph_data["yaxes"] = array_pad($_graph->_graph_data["yaxes"], $yaxes_count, CSupervisionGraphAxis::$default_yaxis); } } } return array($graphs, $yaxes_count - 1, $time_min, $time_max, $time_debut_op_iso, $time_fin_op_iso); }
<?php /** * $Id$ * * @category HL7 * @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::checkAdmin(); $object_class = CValue::getOrSession("object_class"); $object_id = CValue::getOrSession("object_id"); $ors = new CObservationResultSet(); $ors->context_class = $object_class; $ors->context_id = $object_id; /** @var CObservationResultSet[] $result_sets */ $result_sets = $ors->loadMatchingList(); foreach ($result_sets as $_result_set) { $_result_set->loadRefPatient(); $_result_set->loadRefContext()->loadComplete(); $_result_set->loadLastLog()->loadRefUser(); $_results = $_result_set->loadRefsResults(); foreach ($_results as $_result) { $_result->loadRefValueType(); $_result->loadRefValueUnit(); } } $smarty = new CSmartyDP();
CCanDo::checkAdmin(); $context_class = CValue::post("context_class"); $context_id = CValue::post("context_id"); $patient_id = CValue::post("patient_id"); $datetime_start = CValue::post("datetime_start"); $datetime_end = CValue::post("datetime_end"); $period = CValue::post("period", 120); // in seconds $graph = new CSupervisionGraph(); /** @var CSupervisionGraph[] $graphs */ $graphs = $graph->loadList(array("disabled" => "= '0'")); $n = 500; $datetime = $datetime_start; $times = array(); while (--$n > 0 && $datetime < $datetime_end) { $observation_result_set = new CObservationResultSet(); $observation_result_set->context_class = $context_class; $observation_result_set->context_id = $context_id; $observation_result_set->patient_id = $patient_id; $observation_result_set->datetime = $datetime; $observation_result_set->loadMatchingObject(); $observation_result_set->store(); $times[$datetime] = $observation_result_set; $datetime = CMbDT::dateTime("+{$period} SECONDS", $datetime); } foreach ($graphs as $_graph) { $_axes = $_graph->loadRefsAxes(); foreach ($_axes as $_axis) { $_series = $_axis->loadRefsSeries(); foreach ($_series as $_serie) { $_samples = $_serie->getSampleData(array_keys($times));