Implémentation du Dashboard (version moche)

This commit is contained in:
Lucas Mascaro 2016-01-03 17:44:20 +01:00
parent 5ccc823c13
commit 47fe33740b
4 changed files with 155 additions and 5 deletions

View File

@ -21,7 +21,6 @@ if(!Authentification::checkUser(0)){
<script type='text/javascript' src='js/lib/API.js'></script>
<script type='text/javascript' src='js/lib/adjust.js'></script>
<script type='text/javascript' src='js/input-checker.js'></script>
</head>
<body>
@ -58,7 +57,97 @@ if(!Authentification::checkUser(0)){
<!-- FIL D'ARIANE -->
<div id='BREADCRUMB'><a href='Dashboard.php'>Accueil</a></div>
<article data-title="Statistiques sur l'âge des patients">
<?php
$stats = StatsRepo::getAgePatient();
?>
<div class="StatContainer">
<p class="title">Homme</p>
<div class="man bar" style="height: 150px"></div>
<?php
foreach($stats['H'] as $Homme){
echo '<div class="man bar" style="height:'.round($Homme/$stats['NbrH']*150).'px;margin-top:'.round(150-($Homme/$stats['NbrH']*150)).'px"></div>';
}
?>
<div class="clear labels">
<p class="label">Total</p>
<?php
foreach (array_keys($stats['H']) as $key){
echo '<p class="label">'.$key.'</p>';
}
?>
</div>
<div class="clear labels">
<p class="label value"><?php echo $stats['NbrH']; ?></p>
<?php
foreach ($stats['H'] as $value){
echo '<p class="label value">'.$value.'</p>';
}
?>
</div>
</div>
<div class="StatContainer">
<p class="title">Femme</p>
<div class="woman bar" style="height: 150px"></div>
<?php
foreach($stats['H'] as $Femme){
echo '<div class="woman bar" style="height:'.round($Femme/$stats['NbrH']*150).'px;margin-top:'.round(150-($Femme/$stats['NbrH']*150)).'px"></div>';
}
?>
<div class="clear labels">
<p class="label">Total</p>
<?php
foreach (array_keys($stats['F']) as $key){
echo '<p class="label">'.$key.'</p>';
}
?>
</div>
<div class="clear labels">
<p class="label value"><?php echo $stats['NbrF']; ?></p>
<?php
foreach ($stats['F'] as $value){
echo '<p class="label value">'.$value.'</p>';
}
?>
</div>
</div>
<div class="clear"></div>
</article>
<article id="search" data-title="Nombre total d'heure de consultation par medecin">
<form method="POST" action="Dashboard.php#search">
<select id='StatMedecin' name='id_medecin'>
<option value='*'>Medecins:</option>
<?php
foreach(MedecinRepo::getAll() as $MEDECIN)
echo "<option value='".$MEDECIN['Id']."'>".$MEDECIN['Nom']." ".$MEDECIN['Prenom']."</option>";
?>
</select>
<input id="sbCherche" name="submit" type="submit" value="Lancer la recherche" />
</form>
<?php
if(isset($_POST['submit'])) {
$medecin = MedecinRepo::getById($_POST['id_medecin']);
$stats = StatsRepo::getRDVStat($_POST['id_medecin']);
$heures = ($stats['DureeTotale'] - ($stats['DureeTotale']%60))/60;
$minutes = $stats['DureeTotale']%60;
echo '<div><p>'.$medecin['Nom'].' '. $medecin['Prenom'].'</p>
<p>Nombre total de consultation: '.$stats['NombreRDV'].'</p>
<p>Durée totale des consultations: '.$heures.' Heures et '.$minutes.' Minutes</p></div>';
}
?>
</article>
</section>

BIN
Docs/Model.mwb.beforefix Normal file

Binary file not shown.

View File

@ -957,4 +957,58 @@ input[type=radio]:checked + label:before{
left: calc( 100% - 3em );
top: .5em;
background-image: url(../src/svg/edit.svg) !important;
}
/* Conteneur des barres de stats du Dashboard */
.StatContainer{
float: left;
margin-top: 20px;
height: 240px;
width:50%;
}
/* classe pour clear après des floats */
.clear{
clear: both;
}
.bar{
float: left;
width: 15%;
margin-right: 10%;
}
.man{
background-color: #F09108;
}
.woman{
background-color: #E04F5F;
}
.labels{
width: 100%;
height: 30px;
}
.label{
display: block;
float: left;
width: 15%;
margin-right: 10%;
text-align: center;
text-decoration: underline;
}
.value{
text-decoration: none;
font-size: 1.4em;
}
.title{
display: block;
width: 100%;
margin: 0px;
text-align: center;
font-size: 1.8em;
}

View File

@ -15,6 +15,9 @@ class StatsRepo
$homme = ['25-'=>0,'25-50'=>0,'50+'=>0];
$femme = ['25-'=>0,'25-50'=>0,'50+'=>0];
$nbrHomme=0;
$nbrFemme=0;
foreach($patients as $key=>$patient){
$dateNaissance = strtotime($patient['DateNaissance']);
$age = date('Y',time()-$dateNaissance);
@ -22,6 +25,7 @@ class StatsRepo
switch($patient['Civilite']){
case 'M':
$nbrHomme++;
if($patient['age']<25){
$homme['25-']++;
}elseif($patient['age']<50){
@ -31,6 +35,7 @@ class StatsRepo
}
break;
case 'F':
$nbrFemme++;
if($patient['age']<25){
$femme['25-']++;
}elseif($patient['age']<50){
@ -42,13 +47,15 @@ class StatsRepo
}
}
return ['H'=>$homme,'F'=>$femme];
return ['H'=>$homme,'F'=>$femme,'NbrH'=>$nbrHomme,'NbrF'=>$nbrFemme];
}
public static function getRDVStat($medecin){
$req = StaticRepo::getConnexion()->prepare('SELECT count(*) NombreRDV FROM RDV WHERE Medecin_id = :medecin;');
$req = StaticRepo::getConnexion()->prepare('SELECT count(*) NombreRDV, sum((HOUR(Duree)*60)+MINUTE(Duree)) AS DureeTotale FROM RDV WHERE Medecin_id = :medecin;');
$req->execute(['medecin'=>$medecin]);
return StaticRepo::delNumeric($req->fetch(),true);
$returned = StaticRepo::delNumeric($req->fetch(),true);
return $returned;
}