Skip to content

Commit

Permalink
gestion des agendas (2/2)
Browse files Browse the repository at this point in the history
  • Loading branch information
MedShake committed Aug 11, 2017
1 parent 79a28a0 commit 5907caf
Show file tree
Hide file tree
Showing 17 changed files with 1,514 additions and 1 deletion.
412 changes: 412 additions & 0 deletions class/msAgenda.php

Large diffs are not rendered by default.

80 changes: 80 additions & 0 deletions controlers/agenda/actions/agendaAjax.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php
/*
* This file is part of MedShakeEHR.
*
* Copyright (c) 2017
* Bertrand Boutillier <[email protected]>
* http://www.medshake.net
*
* MedShakeEHR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* MedShakeEHR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MedShakeEHR. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Agenda : les requêtes ajax
*
* @author Bertrand Boutillier <[email protected]>
*/

$debug='';
$m=$match['params']['m'];


$acceptedModes=array(
'getEvents', // Obtenir le json des events
'delEvent', // effacer un rdv
'moveEvent', // déplacer un rdv
'searchPatient', //chercher patient
'getPatientAdminData', //obetnir les data patient
'setNewRdv', // ajouter ou updater un rdv
'setEventPasVenu', // marquer rendez-vous non honoré / honoré
'getHistoriquePatient', // obtenir l'historique de rendez-vous d'un patient
);

if (!in_array($m, $acceptedModes)) {
die;
}


// Extraire un form et lancer nouvelle Cs
if ($m=='getEvents') {
include('inc-ajax-getEvents.php');
}
// Effacer un RDV
elseif ($m=='delEvent') {
include('inc-ajax-delEvent.php');
}
// Déplacer un RDV
elseif ($m=='moveEvent') {
include('inc-ajax-moveEvent.php');
}
// Déplacer un RDV
elseif ($m=='searchPatient') {
include('inc-ajax-searchPatient.php');
}
// Obtenir les data patient
elseif ($m=='getPatientAdminData') {
include('inc-ajax-getPatientAdminData.php');
}
// Ajouter ou updater un rdv
elseif ($m=='setNewRdv') {
include('inc-ajax-setNewRdv.php');
}
// Marquer rendez-vous non honoré / honoré
elseif ($m=='setEventPasVenu') {
include('inc-ajax-setEventPasVenu.php');
}
// Obtenir l'historique de rendez-vous d'un patient
elseif ($m=='getHistoriquePatient') {
include('inc-ajax-getHistoriquePatient.php');
}
35 changes: 35 additions & 0 deletions controlers/agenda/actions/inc-ajax-delEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/*
* This file is part of MedShakeEHR.
*
* Copyright (c) 2017
* Bertrand Boutillier <[email protected]>
* http://www.medshake.net
*
* MedShakeEHR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* MedShakeEHR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MedShakeEHR. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Agenda : supprimer un rdv de l'agenda
*
* @author Bertrand Boutillier <[email protected]>
*/

$event = new msAgenda();
$event->set_userID($match['params']['userID']);
$event->set_eventID($_POST['eventid']);
$event->delEvent();

header('Content-Type: application/json');
echo json_encode(array("status"=>"ok"));
35 changes: 35 additions & 0 deletions controlers/agenda/actions/inc-ajax-getEvents.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/*
* This file is part of MedShakeEHR.
*
* Copyright (c) 2017
* Bertrand Boutillier <[email protected]>
* http://www.medshake.net
*
* MedShakeEHR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* MedShakeEHR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MedShakeEHR. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Agenda : obtenir les events pour peupler l'agenda
*
* @author Bertrand Boutillier <[email protected]>
*/

$events = new msAgenda();
$events->setStartDate($_GET['start']);
$events->setEndDate($_GET['end']);
$events->set_userID($match['params']['userID']);

header('Content-Type: application/json');
echo json_encode($events->getEvents());
32 changes: 32 additions & 0 deletions controlers/agenda/actions/inc-ajax-getHistoriquePatient.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/*
* This file is part of MedShakeEHR.
*
* Copyright (c) 2017
* Bertrand Boutillier <[email protected]>
* http://www.medshake.net
*
* MedShakeEHR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* MedShakeEHR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MedShakeEHR. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Agenda : obtenir l'historique de rdv d'un patient
*
* @author Bertrand Boutillier <[email protected]>
*/

$histo = new msAgenda();
$histo->set_patientID($_POST['patientID']);
header('Content-Type: application/json');
echo json_encode($histo->getHistoriquePatient());
32 changes: 32 additions & 0 deletions controlers/agenda/actions/inc-ajax-getPatientAdminData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/*
* This file is part of MedShakeEHR.
*
* Copyright (c) 2017
* Bertrand Boutillier <[email protected]>
* http://www.medshake.net
*
* MedShakeEHR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* MedShakeEHR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MedShakeEHR. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Agenda : obtenir les infos administratives patient
*
* @author Bertrand Boutillier <[email protected]>
*/

$patient = new msPeople();
$patient->setToID($_POST['patientID']);
header('Content-Type: application/json');
echo json_encode($patient->getSimpleAdminDatas());
38 changes: 38 additions & 0 deletions controlers/agenda/actions/inc-ajax-moveEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/*
* This file is part of MedShakeEHR.
*
* Copyright (c) 2017
* Bertrand Boutillier <[email protected]>
* http://www.medshake.net
*
* MedShakeEHR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* MedShakeEHR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MedShakeEHR. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Agenda : déplacer un rdv de l'agenda
*
* @author Bertrand Boutillier <[email protected]>
*/

$event = new msAgenda();
$event->set_userID($match['params']['userID']);
$event->set_eventID($_POST['eventid']);
$event->setStartDate($_POST['start']);
$event->setEndDate($_POST['end']);
$event->moveEvent();


header('Content-Type: application/json');
echo json_encode(array("status"=>"ok"));
52 changes: 52 additions & 0 deletions controlers/agenda/actions/inc-ajax-searchPatient.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
/*
* This file is part of MedShakeEHR.
*
* Copyright (c) 2017
* Bertrand Boutillier <[email protected]>
* http://www.medshake.net
*
* MedShakeEHR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* MedShakeEHR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MedShakeEHR. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Agenda : chercher patient
*
* @author Bertrand Boutillier <[email protected]>
*/

$term = msSQL::cleanVar($_GET['term']);
$a_json = array();

if ($data=msSQL::sql2tab("select p.id, concat(d2.value, ' ', d3.value) as identite, d8.value as ddn
from people as p
left join objets_data as d2 on d2.toID=p.id and d2.typeID=2 and d2.outdated='' and d2.deleted=''
left join objets_data as d8 on d8.toID=p.id and d8.typeID=8 and d8.outdated='' and d8.deleted=''
left join objets_data as d3 on d3.toID=p.id and d3.typeID=3 and d3.outdated='' and d3.deleted=''
where concat(d2.value, ' ', d3.value) like '%".$term."%'
group by p.id
order by d2.value, d3.value limit 20")) {

foreach ($data as $k=>$v) {
$a_json[]=array(
'label'=>trim($v['identite']).' '.$v['ddn'],
'value'=>trim($v['identite']),
'patientID'=>$v['id'],
);
}
}


header('Content-Type: application/json');
echo json_encode($a_json);
35 changes: 35 additions & 0 deletions controlers/agenda/actions/inc-ajax-setEventPasVenu.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/*
* This file is part of MedShakeEHR.
*
* Copyright (c) 2017
* Bertrand Boutillier <[email protected]>
* http://www.medshake.net
*
* MedShakeEHR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* MedShakeEHR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MedShakeEHR. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Agenda : marquer un rendez-vous comme non honoré
*
* @author Bertrand Boutillier <[email protected]>
*/

$event = new msAgenda();
$event->set_userID($match['params']['userID']);
$event->set_eventID($_POST['eventID']);
$event->setPasVenu();

header('Content-Type: application/json');
echo json_encode(array("status"=>"ok"));
42 changes: 42 additions & 0 deletions controlers/agenda/actions/inc-ajax-setNewRdv.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
/*
* This file is part of MedShakeEHR.
*
* Copyright (c) 2017
* Bertrand Boutillier <[email protected]>
* http://www.medshake.net
*
* MedShakeEHR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* MedShakeEHR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MedShakeEHR. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Agenda : ajouter un rdv dans l'agenda
*
* @author Bertrand Boutillier <[email protected]>
*/

$event = new msAgenda();
if($_POST['eventID']>0) $event->set_eventID($_POST['eventID']);
$event->set_userID($match['params']['userID']);
$event->set_patientID($_POST['patientID']);
$event->setStartDate($_POST['start']);
$event->setEndDate($_POST['end']);
$event->set_motif($_POST['motif']);
$event->set_type($_POST['type']);
$dataEvent=$event->addOrUpdateRdv();

//print_r($_POST);

header('Content-Type: application/json');
echo json_encode($dataEvent);
Loading

0 comments on commit 5907caf

Please sign in to comment.