Skip to content
Snippets Groups Projects
Commit a76c4316 authored by Jessie Ragot's avatar Jessie Ragot
Browse files

The doctor can add a medical history to a patient's medical file

parent 2c9022ed
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,18 @@ public class DoctorMedicalFileController { ...@@ -51,7 +51,18 @@ public class DoctorMedicalFileController {
return "redirect:/doctors/medical-files-doctor"; return "redirect:/doctors/medical-files-doctor";
} }
// Mettre à jour l'historique médical @GetMapping("/{id}/history/add")
public String showAddHealthHistoryForm(@PathVariable Long id, Model model) {
MedicalFile medicalFile = medicalFileService.getMedicalFileById(id).orElse(null);
if (medicalFile != null) {
model.addAttribute("medicalFile", medicalFile);
return "add-health-history"; // Assurez-vous d'avoir une vue nommée "add-health-history.html"
}
model.addAttribute("errorMessage", "Dossier introuvable.");
return "error";
}
@PostMapping("/{id}/history") @PostMapping("/{id}/history")
public String updateMedicalFileHistory(@PathVariable Long id, public String updateMedicalFileHistory(@PathVariable Long id,
@RequestParam String antecedent, @RequestParam String antecedent,
...@@ -61,6 +72,7 @@ public class DoctorMedicalFileController { ...@@ -61,6 +72,7 @@ public class DoctorMedicalFileController {
return "redirect:/doctors/medical-files-doctor/" + id; return "redirect:/doctors/medical-files-doctor/" + id;
} }
// Ajouter un document à un dossier médical // Ajouter un document à un dossier médical
@PostMapping("/{id}/documents") @PostMapping("/{id}/documents")
public String uploadMedicalFileDocument(@PathVariable Long id, @RequestParam("document") MultipartFile document, RedirectAttributes redirectAttributes) { public String uploadMedicalFileDocument(@PathVariable Long id, @RequestParam("document") MultipartFile document, RedirectAttributes redirectAttributes) {
......
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Ajouter un Historique Médical</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
</head>
<body class="bg-light">
<div class="container mt-5">
<h1 class="text-center mb-4">Ajouter un Historique Médical</h1>
<form th:action="@{/doctors/medical-files-doctor/{id}/history(id=${medicalFile.id})}" method="post">
<div class="mb-3">
<label for="antecedent" class="form-label">Antécédent</label>
<input type="text" class="form-control" id="antecedent" name="antecedent" required>
</div>
<div class="mb-3">
<label for="notes" class="form-label">Notes</label>
<input type="text" class="form-control" id="notes" name="notes" required>
</div>
<div class="mb-3">
<label for="consultationDate" class="form-label">Date de Consultation</label>
<input type="date" class="form-control" id="consultationDate" name="consultationDate" required>
</div>
<button type="submit" class="btn btn-primary">Ajouter</button>
</form>
<a href="/doctors/medical-files-doctor" class="btn btn-primary mt-3">Retour à la liste</a>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en" xmlns:th="http://www.thymeleaf.org">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
...@@ -30,6 +30,13 @@ ...@@ -30,6 +30,13 @@
</ul> </ul>
</div> </div>
<!-- Bouton pour ajouter un HealthHistorical -->
<div class="mt-3">
<a th:href="@{/doctors/medical-files-doctor/{id}/history/add(id=${medicalFile.id})}" class="btn btn-success">
Ajouter un Historique Médical
</a>
</div>
<!-- Formulaire de téléchargement du document --> <!-- Formulaire de téléchargement du document -->
<form method="post" th:action="@{/doctors/medical-files-doctor/{id}/documents(id=${medicalFile.id})}" <form method="post" th:action="@{/doctors/medical-files-doctor/{id}/documents(id=${medicalFile.id})}"
enctype="multipart/form-data" enctype="multipart/form-data"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment