projet-php/toBDD.php

30 lines
943 B
PHP
Raw Normal View History

2015-12-03 11:00:22 +00:00
<?php
/**
* Created by PhpStorm.
* User: seekdasky
* Date: 03/12/15
* Time: 11:52
*/
require_once('autoloader.php');
2015-12-03 11:25:02 +00:00
$jsonP = json_decode(file_get_contents('Docs/PatientExemple.json'),true);
$jsonM = json_decode(file_get_contents('Docs/MedecinExemple.json'),true);
$jsonR = json_decode(file_get_contents('Docs/RDVExemple.json'),true);
2015-12-03 11:25:02 +00:00
var_dump(StaticRepo::testConnexion());
2015-12-03 11:00:22 +00:00
$repo = new PatientRepo();
2015-12-03 11:25:02 +00:00
$repoM = new MedecinRepo();
2015-12-03 11:00:22 +00:00
2015-12-03 11:00:22 +00:00
foreach($jsonM as $patient) {
2015-12-03 11:25:02 +00:00
$repoM->add($patient['Civilite'], $patient['Prenom'], $patient['Nom']);
2015-12-03 11:00:22 +00:00
}
foreach($jsonP as $patient){
2015-12-03 11:25:02 +00:00
$repo->add($patient['Civilite'],$patient['Prenom'],$patient['Nom'],$patient['Adresse'],NULL,$patient['Ville'],$patient['CodePostal'],$patient['DateNaissance'],$patient['LieuNaissance'],$patient['NumSecuriteSociale'],$patient['MedecinTraitant']);
}
foreach($jsonR as $rdv){
RDVRepo::add($rdv['DateRDV'],$rdv['Duree'],$rdv['Patient_Id'],$rdv['Medecin_Id']);
2015-12-03 11:00:22 +00:00
}