/**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return HistorialRevisionSistema the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = HistorialRevisionSistema::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
?>

	                <?php 
if ($sistemas > 0) {
    ?>
		                <div class="tab-pane" id="sistemas">
		                	<h5>Historial de Revisión de Sistemas</h5>
		                	<table class="table table-condensed">
		                		<tr>
		                			<th>Fecha</th>
		                			<th>Responsable</th>
		                			<th></th>
		                		</tr>
		                
		                	<?php 
    $losSistemas = HistorialRevisionSistema::model()->findAll("paciente_id = {$model->id}");
    foreach ($losSistemas as $los_sistemas) {
        ?>
						 			<tr>
						 				<td><?php 
        echo Yii::app()->dateformatter->format("dd-MM-yyyy", $los_sistemas->fecha);
        ?>
</td>
						 				<td><?php 
        echo $los_sistemas->personal->nombreCompleto;
        ?>
</td>
						 				<td><a href="index.php?r=historialRevisionSistema/view&id=<?php 
        echo $los_sistemas->id;
        ?>
" class="btn btn-mini btn-info"><i class="icon-search icon-white"></i></a></td>
}
$paciente = Paciente::model()->find("id={$elPaciente}");
//Calculo de Edad
$anio_nacimiento = Yii::app()->dateformatter->format("yyyy", $paciente->fecha_nacimiento);
$edadpaciente = date("Y") - $anio_nacimiento;
//array('name'=>'Edad', 'value'=>$edadpaciente, ''),
//Variables de Historial
$ccc = "";
$cardio_respiratorio = "";
$sistema_digestivo = "";
$sistema_genitoUrinario = "";
$sistema_locomotor = "";
$sistema_nervioso = "";
$sistema_tegumentario = "";
$observaciones_paciente = "";
$elHistorial = HistorialRevisionSistema::model()->findAll("paciente_id={$elPaciente}");
foreach ($elHistorial as $el_historial) {
    $ccc = $ccc . date('d-m-Y', strtotime($el_historial->fecha)) . "<br>" . $el_historial->personal->nombreCompleto . "<br>---------------<br>" . $el_historial->c_c_c . "<br><br>";
    $cardio_respiratorio = $cardio_respiratorio . date('d-m-Y', strtotime($el_historial->fecha)) . "<br>" . $el_historial->personal->nombreCompleto . "<br>---------------<br>" . $el_historial->cardio_respiratorio . "<br><br>";
    $sistema_digestivo = $sistema_digestivo . date('d-m-Y', strtotime($el_historial->fecha)) . "<br>" . $el_historial->personal->nombreCompleto . "<br>---------------<br>" . $el_historial->sistema_digestivo . "<br><br>";
    $sistema_genitoUrinario = $sistema_genitoUrinario . date('d-m-Y', strtotime($el_historial->fecha)) . "<br>" . $el_historial->personal->nombreCompleto . "<br>---------------<br>" . $el_historial->sistema_genitoUrinario . "<br><br>";
    $sistema_locomotor = $sistema_locomotor . date('d-m-Y', strtotime($el_historial->fecha)) . "<br>" . $el_historial->personal->nombreCompleto . "<br>---------------<br>" . $el_historial->sistema_locomotor . "<br><br>";
    $sistema_nervioso = $sistema_nervioso . date('d-m-Y', strtotime($el_historial->fecha)) . "<br>" . $el_historial->personal->nombreCompleto . "<br>---------------<br>" . $el_historial->sistema_nervioso . "<br><br>";
    $sistema_tegumentario = $sistema_tegumentario . date('d-m-Y', strtotime($el_historial->fecha)) . "<br>" . $el_historial->personal->nombreCompleto . "<br>---------------<br>" . $el_historial->sistema_tegumentario . "<br><br>";
    $observaciones_paciente = $observaciones_paciente . date('d-m-Y', strtotime($el_historial->fecha)) . "<br>" . $el_historial->personal->nombreCompleto . "<br>---------------<br>" . $el_historial->observaciones . "<br><br>";
}
?>

	<?php 
echo $form->errorSummary($model);
?>