-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathliste-specialite.php
408 lines (365 loc) · 15.7 KB
/
liste-specialite.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
<!doctype html>
<?php
// récupération-contrôle des paramètres
include "php/controleParametre.php";
// UTILE UNIQUEMENT PENDANT LA PHASE DE CHOIX DE POSTE (A ACTIVER DANS LES AUTRES PAGES)
// aiguillage vers la page des rangs limites CELINE si c'est elle qui est demandée (par le questionnaire)
if (isset($_GET['rangLimite'])) {
$location="rang-limite.php?rang=".$rang."&reference=".$reference."&type=".$type."&lieu=".$lieu."&internat=".$internat."&benefice=".$benefice;
header("Location: $location");
exit;
} elseif (isset($_GET['CHU'])) {
$location="liste-CHU.php?rang=".$rang."&reference=".$reference."&cesp=".$cesp."&type=".$type."&lieu=".$lieu."&internat=".$internat."&benefice=".$benefice;
header("Location: $location");
exit;
}
?>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Simulateur en ligne pour choisir une spécialité d'internat - liste des spécialités médicales ou chirurgicales">
<?php
// favicons générés par https://realfavicongenerator.net
include "php/favicon.php";
?>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=ID-GOOGLE"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'ID-GOOGLE');
</script>
<title>Liste des spécialités correspondantes aux critères saisis</title>
<?php
// styles nécessaires à l'application (bootstrap + fontawasome + ECN)
include "php/style.php";
?>
<style>
th {
position:sticky;
top: 50px;
text-align:center;
z-index:1;
}
td {
border-left-style:dotted;
border-right-style:dotted;
cursor: default;
}
.critere {
color:navy;
}
</style>
</head>
<body id="hautdepage">
<?php
include "php/menu-questionnaire.php";
?>
<nav id="chemin">
<div class="row" style='margin-top:80px;'>
<div class="col-sm" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="choix-specialite-chu-celine-ecn.php"><i class="fas fa-home"></i></a></li>
<li class="breadcrumb-item"><a href="#" onclick="questionnaire()">Critère</a></li>
<li class="breadcrumb-item active" aria-current="page">Spécialité</li>
</ol>
</div>
<div class="col-sm">
<p style='padding:10px;'>
<button class="btn btn-secondary btn-sm" onclick="" title="Affichage des spécialités en liste" disabled> en liste <i class="fa fa-list" aria-hidden="true"></i></button>
<button class="btn btn-primary btn-sm" onclick="tableau()" title="Affichage des spécialités en tableau"> en tableau <i class="fa fa-table" aria-hidden="true"></i></button>
</p>
</div>
<div class="col-xl">
</div>
</div>
</nav>
<div id="reponse" class="container">
<h1 class="h5" style="text-align:left; margin-top:20px;">
<a class="h5" data-toggle="collapse" aria-expanded="false" aria-controls="critere" href="#critere"><i id="symbole" class="fa fa-plus-circle" aria-hidden="true"></i> Vos critères de choix...</a>
</h1>
<?php
// fonctions communes
include "php/fonctionECN.php";
// affichage des critères
echo "<div id='critere' class='collapse'>";
echo "<div class='row'>";
echo "<div class='col-md-5 offset-md-1'>";
echo "<ul>";
echo "<li>rang visé ou obtenu = <span class='critere'>" . getLibelleRang($rang) . "</span></li>";
echo "<li>année de référence = <span class='critere'>" . getLibelleReference($reference) . "</span></li>";
echo "<li>type de spécialité = <span class='critere'>" . getLibelleType($type) . "</span></li>";
echo "<li>CESP uniquement = <span class='critere'>" . getLibelleCESP($cesp) . "</span></li>";
echo "</ul>";
echo "</div>";
echo "<div class='col-md-5'>";
echo "<ul>";
echo "<li>durée de l'internat = <span class='critere'>" . getLibelleInternat($internat). "</span></li>";
echo "<li>lieu d'exercice = <span class='critere'>" . getLibelleLieu($lieu) . "</span></li>";
echo "<li>bénéfice net en libéral = <span class='critere'>" . getLibelleBenefice($benefice) . "</span></li>";
echo "</ul>";
echo "</div>";
echo "</div>";
echo "</div>\n";
// conexion à la base ecn (user = ecn)
try {
$db = new PDO("mysql:host=localhost;dbname=ecn;charset=utf8", "USER", "PASSE");
}
catch(PDOException $erreur) {
die('Erreur connexion base : ' . $erreur->getMessage());
}
// passage au mode exception pour les erreurs
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// préparation de la clause where pour sélectionner les spécialités en fonction des critères
$where = " WHERE Type <> ''";
if (($type <> "") and ($type <> "typeIndifferent")) {
if ($type == "medico-chirurgical") {
$where = $where . " AND Type = 'mixte'";
} elseif ($type == "organe") {
$where = $where . " AND Nature = 'organe'";
} elseif ($type == "transversal") {
$where = $where . " AND Nature = 'transversale'";
} elseif ($type == "chirurgie") {
$where = $where . " AND Type = 'chirurgie'";
}
}
$libelleCesp = "CESP2024"; // les postes et cesp sont absents en base pour les années avant 2020 (on prend ceux de 2024 par défaut)
if ($reference == "2023") {
$libelleCesp = "CESP2023";
} elseif ($reference == "2022") {
$libelleCesp = "CESP2022";
} elseif ($reference == "2021") {
$libelleCesp = "CESP2021";
} elseif ($reference == "2020") {
$libelleCesp = "CESP2020";
}
if ($cesp == "on") {
$where = $where . " AND Rang." . $libelleCesp . " <> '0' AND Rang." . $libelleCesp . " <> ''";
}
if (($lieu <> "") and ($lieu <> "lieuIndifferent")) {
// $where = $where . " AND Lieu = '" . utf8_decode($lieu) . "'";
$where = $where . " AND Lieu = '" . $lieu . "'";
}
if (($internat <> "") and ($internat <> "internatIndifferent") and ($internat > 0)) {
$where = $where . " AND DureeInternat = $internat";
}
if (($benefice <> "") and ($benefice <> "beneficeIndifferent")) {
if ($benefice == "benefice60") {$where = $where . " AND Benefice <= 60000";}
elseif ($benefice == "benefice100") {$where = $where . " AND Benefice >= 60000 AND Benefice <= 100000";}
elseif ($benefice == "benefice140") {$where = $where . " AND Benefice >= 100000 AND Benefice <= 140000";}
elseif ($benefice == "benefice500") {$where = $where . " AND Benefice >= 140000";}
}
if (($rang <> "") and ($rang > 0) and ($rang <> "rangIndifferent")) {
$whereSpecialite = $where . " AND Rang.Dernier" . $reference . " >= '" . $rang ."'";
} else {
$whereSpecialite = $where;
}
// $where = $where . ";";
// requête pour compter les nombres de postes
$nbPoste = 0;
$nbCESP = 0;
$libellePoste = "Poste2024";
$libelleCesp = "CESP2024"; // avant 2020 le nombre de postes et de CESP n'est pas en base (on prend 2024 par défaut)
if ($reference == 2023) {
$libellePoste = "Poste2023";
$libelleCesp = "CESP2023";
} elseif ($reference == 2022) {
$libellePoste = "Poste2022";
$libelleCesp = "CESP2022";
} elseif ($reference == 2021) {
$libellePoste = "Poste2021";
$libelleCesp = "CESP2021";
} elseif ($reference == 2020) {
$libellePoste = "Poste2020";
$libelleCesp = "CESP2020";
}
$sql = "SELECT Rang.CodeSpecialite, SUM(Rang." . $libellePoste . ") AS totalPoste, SUM(Rang." . $libelleCesp . ") AS totalCESP FROM Specialite
inner join Rang on Specialite.CodeSpecialite = Rang.CodeSpecialite " . $whereSpecialite . " GROUP BY Rang.CodeSpecialite;";
if ($debug) echo "SQL = " . $sql ."<br/>";
// exécution de la requête
try {
$result = $db->query($sql);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
extract($row);
$nbPoste += $totalPoste;
$nbCESP += $totalCESP;
}
}
catch(PDOException $erreur) {
echo "Erreur SELECT Nb Postes : " . $erreur->getMessage();
}
// préparation de la requête pour afficher les spécialités
$sql = "SELECT Rang.CodeSpecialite as Specialite,
max(Rang.Dernier2024) as Dernier2024,
max(Rang.Dernier2023) as Dernier2023,
max(Rang.Dernier2022) as Dernier2022,
max(Rang.Dernier2021) as Dernier2021,
max(Rang.Dernier2020) as Dernier2020,
max(Rang.Dernier2019) as Dernier2019,
max(Rang.Dernier2018) as Dernier2018,
max(Rang.Dernier2017) as Dernier2017,
sum(Rang.Poste2024) as Poste2024,
sum(Rang.CESP2024) as CESP2024,
sum(Rang.Poste2023) as Poste2023,
sum(Rang.CESP2023) as CESP2023,
sum(Rang.Poste2022) as Poste2022,
sum(Rang.CESP2022) as CESP2022,
sum(Rang.Poste2021) as Poste2021,
sum(Rang.CESP2021) as CESP2021,
sum(Rang.Poste2020) as Poste2020,
sum(Rang.CESP2020) as CESP2020
FROM `Specialite` inner join Rang on Specialite.CodeSpecialite = Rang.CodeSpecialite " . $whereSpecialite . " GROUP BY Rang.CodeSpecialite;";
if ($debug) echo "SQL = " . $sql ."<br/>";
// exécution de la requête
try {
$result = $db->query($sql);
$montant = new NumberFormatter("fr-FR", NumberFormatter::DECIMAL);
// titre
echo "<br/><h2 class='h5' style='text-align:left'>" . $result->rowCount() ." spécialités correspondent à vos critères ";
if ($cesp != "off") {
echo " en CESP ";
}
if (($rang != 0) and ($rang != null) and ($rang != "rangIndifferent")) {
echo "pour le rang " . getLibelleRang($rang) . " en " . $reference;
}
echo "</h2><br/>";
// liste
echo "<table class='table-hover' style='width:100%;'>";
echo "<caption>Cliquer <i class='fa fa-mouse-pointer' aria-hidden='true'></i> sur une spécialité pour voir les CHU pour cette spécialité.</caption>";
echo "<thead class='text-center'>";
echo "<tr><th colspan=2 style='width:50%'>" . $result->rowCount() ." spécialités d'internat<br/><i class='fas fa-info-circle' data-toggle='tooltip' data-html='true' title='Cliquer sur une spécialité pour voir les CHU pour cette spécialité.'></i></th>";
if ($reference < 2020) {
$libelle = "2024";
} else {
$libelle = $reference;
}
echo "<th style='width:20%;'> ".$montant->format($nbPoste)." postes " . $libelle . "<br/><i class='fas fa-info-circle' data-toggle='tooltip' data-html='true' title='Le nombre de postes est issu de l'arrêté publié par le Journal Officiel. Ce nombre de postes exclut les CESP.'></i></th>";
if ($reference == 2024) {
echo "<th style='width:20%'> Rang dernier " . $reference . "<br/><i class='fas fa-info-circle' data-toggle='tooltip' data-html='true' title='Le rang du dernier admis en 2024 est le rang limite issu du 1er tour de l'appariement du 13 septembre 2024.'></i></th>";
} else {
echo "<th style='width:20%'> Rang dernier " . $reference . "<br/><i class='fas fa-info-circle' data-toggle='tooltip' data-html='true' title='Le rang du dernier admis en " . $reference . " est le rang limite issu du site CNG Santé.'></i></th>";
}
echo "<th style='width:10%;'> ".$montant->format($nbCESP)." CESP " . $libelle . " <br/><i class='fas fa-info-circle' data-toggle='tooltip' data-html='true' title='Le nombre de postes réservés aux CESP est issu de l'arrêté publié par le Journal Officiel.<br/>Une cellule vide signifie qu'il n'y a pas de poste CESP pour cette spécialité.'></i></th>";
echo "</tr></thead>";
echo "<tbody>";
// récupération des données à afficher
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
extract($row);
echo "<tr onclick='zoom('".$Specialite."')'>";
if (mb_detect_encoding($Specialite,'UTF-8', true)) { // en local les caractères accentués passent, mais pas sur le serveur Gandi
$libelleSpecialite = getLibelleSpecialite($Specialite);
} else {
$libelleSpecialite = utf8_encode(getLibelleSpecialite($Specialite));
}
echo "<td class='acronyme'>".$Specialite . "</td><td>" . $libelleSpecialite . "</td>";
$dernier = "0";
$poste = "0";
$libelleCesp = "0";
if ($reference == 2024) {
$dernier = $montant->format($Dernier2024);
$poste = $Poste2024;
$libelleCesp = $CESP2024;
} elseif ($reference == 2023) {
$dernier = $montant->format($Dernier2023);
$poste = $Poste2023;
$libelleCesp = $CESP2023;
} elseif ($reference == 2022) {
$dernier = $montant->format($Dernier2022);
$poste = $Poste2022;
$libelleCesp = $CESP2022;
} elseif ($reference == 2021) {
$dernier = $montant->format($Dernier2021);
$poste = $Poste2021;
$libelleCesp = $CESP2021;
} elseif ($reference == 2020) {
$dernier = $montant->format($Dernier2020);
$poste = $Poste2020;
$libelleCesp = $CESP2020;
} elseif ($reference == 2019) {
$dernier = $montant->format($Dernier2019);
$poste = $Poste2024;
$libelleCesp = $CESP2024;
} elseif ($reference == 2018) {
$dernier = $montant->format($Dernier2018);
$poste = $Poste2024;
$libelleCesp = $CESP2024;
} elseif ($reference == 2017) {
$dernier = $montant->format($Dernier2017);
$poste = $Poste2024;
$libelleCesp = $CESP2024;
}
echo "<td class='text-center'>".$montant->format($poste)."</td>";
echo "<td class='text-center'>" . $dernier . "</td>";
if ($libelleCesp <> 0) {
$nbCesp = $montant->format($libelleCesp);
} else {
$nbCesp = '';
}
echo "<td class='derniereColonne text-center'>".$nbCesp."</td>";
echo "<td class='milieu'></td>";
echo "</tr>\n";
}
echo "<tr><td colspan=5 style='border-top-style:solid; border-left-style:hidden; border-right-style:hidden; border-bottom-style:hidden;'></td></tr>";
echo "</tbody>";
echo "</table>";
}
catch(PDOException $erreur) {
echo "Erreur SELECT Specialite : " . $erreur->getMessage();
}
// fermeture de la base
if (isset($result)) {$result->closeCursor();}
$db = null;
?>
</div>
<!-- retour en arrière vers le formulaire -->
<footer style='margin-top:40px; margin-bottom:80px;'>
<br/>
<p class=text-center>
<button class="btn btn-primary" onclick="questionnaire()">← Retour aux critères</button>
</p>
</footer>
<?php
// librairies javascript nécessaires à l'application (jquery + popper + bootstrap)
include "php/librairie.php";
?>
<!-- activation tooltip -->
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
<!-- navigation -->
<script>
//pour basculer sur l'affichage en tableau
function tableau() {
<?php
echo "window.location.href='tableau-specialite.php?code=" . $code . "&rang=" . $rang . "&reference=" . $reference . "&type=" . $type . "&cesp=" . $cesp . "&lieu=" . $lieu . "&internat=" . $internat . "&benefice=" . $benefice . "&depuis=tableau';";
?>
}
// pour retourner en arrière dans l'historique du navigateur
function questionnaire() {
<?php
echo "window.location.href='questionnaire-choix-specialite.php?code=" . $code . "&rang=" . $rang . "&reference=" . $reference . "&type=" . $type . "&cesp=" . $cesp . "&lieu=" . $lieu . "&internat=" . $internat . "&benefice=" . $benefice . "';";
?>
}
// pour zoomer sur une spécialité
function zoom(code) {
<?php
echo "window.location.href='detail-specialite-questionnaire.php?rang=" . $rang . "&reference=" . $reference . "&code=' + code + '" . "&type=" . $type . "&cesp=" . $cesp . "&lieu=" . $lieu . "&internat=" . $internat . "&benefice=" . $benefice . "&depuis=liste';";
?>
}
</script>
<!-- gestion du symbole + et - -->
<script>
$('#critere').on('show.bs.collapse', function () {
$("#symbole").toggleClass('fa-plus-circle fa-minus-circle');
})
$('#critere').on('hide.bs.collapse', function () {
$("#symbole").toggleClass('fa-minus-circle fa-plus-circle');
})
</script>
</body>
</html>