예제 #1
0
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Labo
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
$examen = new CExamenLabo();
$examen->load(CValue::get("examen_id"));
$patient = new CPatient();
$patient->load(CValue::get("patient_id"));
$item = new CPrescriptionLaboExamen();
$resultats = $item->loadResults($patient->_id, $examen->_id, 20);
// Création du graph
$graph = new CResultatsLaboGraph($patient, $examen, $resultats);
$graph->Stroke();
 /**
  * @see parent::loadRefsBack()
  */
 function loadRefsBack()
 {
     if (!$this->_ref_prescription_items) {
         // Chargement des items
         $item = new CPrescriptionLaboExamen();
         $item->prescription_labo_id = $this->_id;
         $this->_ref_prescription_items = $item->loadMatchingList();
         $this->_ref_examens = array();
         // Classement des examens
         foreach ($this->_ref_prescription_items as &$_item) {
             $_item->_ref_prescription_labo =& $this;
             $_item->loadRefsFwd();
             $examen =& $_item->_ref_examen_labo;
             $this->_ref_examens[$examen->_id] =& $examen;
         }
         // Classement des items internes et externes
         $this->_ref_external_items = array();
         $this->_ref_internal_items = array();
         foreach ($this->_ref_prescription_items as &$_item) {
             $examen =& $_item->_ref_examen_labo;
             $examen->loadExternal();
             // Remplissage des collections
             if ($examen->_external) {
                 $this->_ref_external_items[$_item->_id] =& $_item;
             } else {
                 $this->_ref_internal_items[$_item->_id] =& $_item;
             }
         }
     }
     $this->checkStatus();
 }
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Labo
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
// Chargement de l'item choisi
$siblingItems = array();
$prescriptionItem = new CPrescriptionLaboExamen();
$prescriptionItem->load(CValue::getOrSession("prescription_labo_examen_id"));
if ($prescriptionItem->loadRefs()) {
    $prescriptionItem->_ref_prescription_labo->loadRefsFwd();
    $siblingItems = $prescriptionItem->loadSiblings();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("prescriptionItem", $prescriptionItem);
$smarty->assign("siblingItems", $siblingItems);
$smarty->assign("time", time());
$smarty->display("inc_graph_resultats.tpl");
 /**
  * load results items with given patient and exam
  */
 function loadResults($patient_id, $examen_labo_id, $limit = 10)
 {
     $examen = new CExamenLabo();
     $examen->load($examen_labo_id);
     $order = "date DESC";
     $prescription = new CPrescriptionLabo();
     $prescription->patient_id = $patient_id;
     $prescriptions = $prescription->loadMatchingList($order);
     // Load items for each prescription to preserve prescription date ordering
     $items = array();
     $item = new CPrescriptionLaboExamen();
     foreach ($prescriptions as $_prescription) {
         $item->prescription_labo_id = $_prescription->_id;
         $item->examen_labo_id = $examen_labo_id;
         foreach ($item->loadMatchingList($order) as $_item) {
             $items[$_item->_id] = $_item;
         }
     }
     foreach ($items as &$item) {
         $item->_ref_prescription_labo =& $prescriptions[$item->prescription_labo_id];
         $item->_ref_examen_labo =& $examen;
     }
     return $items;
 }