Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Origin/khalil #6

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

154 changes: 154 additions & 0 deletions src/main/java/com/example/demo/DossierPatientController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
package com.example.demo;

import com.example.demo.models.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

import java.io.IOException;
import java.sql.Time;
import java.util.Date;
import java.util.List;

public class DossierPatientController {

@FXML
Label NDossierLabel;
@FXML
Label nomLabel;
@FXML
Label prenomLabel;
@FXML
Button billanButton;
@FXML
Button ficheButton;
@FXML
Button dossierButton;
@FXML
Button retourButton;
@FXML
Label descriptionLabel;
@FXML
private TableView<RendezVous> rendezVousTable;
@FXML
private TableColumn<RendezVous, String> typeColumn;
@FXML
private TableColumn<RendezVous, Date> dateColumn;
@FXML
private TableColumn<RendezVous, Time> heureColumn;
@FXML
Label dateDeNaissanceLabel;
@FXML
Label lieuDeNaissanceLabel;
@FXML
Label adresseLabel;
@FXML
Label extraInfoLabel;
@FXML
Label diplomeLabel;
@FXML
Label diplome_Label;
@FXML
Label proffessionLabel;
@FXML
Label proffession_Label;
@FXML
Label numLabel;
@FXML
Label num_Label;

private DossierPatient currentDossier;

public void displayDossier(DossierPatient dossier) {
this.currentDossier = dossier;
Patient patient = dossier.getPatient();

NDossierLabel.setText("" + dossier.getNumeroDossier());
nomLabel.setText(patient.getNom());
prenomLabel.setText(patient.getPrenom());
dateDeNaissanceLabel.setText("" + patient.getDateNaissance());
lieuDeNaissanceLabel.setText(patient.getLieuNaissance());
adresseLabel.setText(patient.getAdresse());
descriptionLabel.setText("Description: " + patient.getDescriptionTherapie());

if (patient instanceof Enfant) {
Enfant enfant = (Enfant) patient;

diplome_Label.setText("Classe d'étude: ");
diplomeLabel.setText(enfant.getClassdetude());

proffessionLabel.setText(enfant.getNumTelmere());
proffession_Label.setText("n° mère: ");

num_Label.setText("n° père: ");
numLabel.setText(enfant.getNumTelpere());

} else if (patient instanceof Adult) {
Adult adult = (Adult) patient;

diplome_Label.setText("Diplome: ");
diplomeLabel.setText(adult.getDiplome());

proffessionLabel.setText(adult.getProfession());
proffession_Label.setText("Profession: ");

num_Label.setText("n° tel:");
numLabel.setText(adult.getNumTel());
} else {
extraInfoLabel.setText("");
}

typeColumn.setCellValueFactory(new PropertyValueFactory<RendezVous, String>("type"));
dateColumn.setCellValueFactory(new PropertyValueFactory<RendezVous, Date>("date"));
heureColumn.setCellValueFactory(new PropertyValueFactory<RendezVous, Time>("heure"));

List<RendezVous> rendezVousList = dossier.getRendezVous();

ObservableList<RendezVous> observableList = FXCollections.observableArrayList(rendezVousList);
rendezVousTable.setItems(observableList);
}
public void initialize() {
dossierButton.setOnAction(event -> showModifierDossierDialog());
}
@FXML
private void showModifierDossierDialog() {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("ModifierDossier.fxml"));
DialogPane dialogPane = loader.load();

ModifierDossierController controller = loader.getController();
controller.setDossier(currentDossier); // Passer le dossier actuel au contrôleur du dialogue

Dialog dialog = new Dialog<>();
dialog.setDialogPane(dialogPane);
// dialog.initModality(Modality.APPLICATION_MODAL);
// dialog.initStyle(StageStyle.UNDECORATED);
dialog.showAndWait().ifPresent(response -> {
controller.handleSave();
//si l'utilisateur appuie sur le bouton apply on ajoute le patient a la liste
if (response == ButtonType.APPLY) {
System.out.println("handle save");
System.out.println("handle save");


} else if (response == ButtonType.CANCEL) {
//si l'utilisateur appuie sur le bouton cancel on affiche un message

System.out.println("Cancel button pressed");
}
});
// controller.handleSave();
// Après la fermeture du dialogue, mettre à jour les informations affichées
displayDossier(currentDossier);
} catch (IOException e) {
e.printStackTrace();
}
}
}
105 changes: 88 additions & 17 deletions src/main/java/com/example/demo/HelloApplication.java
Original file line number Diff line number Diff line change
@@ -1,40 +1,111 @@
package com.example.demo;
import com.example.demo.models.ApplicationDesktop;
import com.example.demo.models.Orthophoniste;

import com.example.demo.models.*;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

import java.io.IOException;
import com.calendarfx.model.Calendar;
import com.calendarfx.model.CalendarSource;
import com.calendarfx.model.Entry;
import com.calendarfx.view.CalendarView;

import java.time.LocalDate;
import java.time.LocalTime;
import java.sql.Time;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class HelloApplication extends Application {
public static ApplicationDesktop applicationDesktop ;
public static Orthophoniste orthophoniste ;
public static ApplicationDesktop applicationDesktop;
public static Orthophoniste orthophoniste;

@Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("Agenda.fxml"));
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("DossierPatient.fxml"));
applicationDesktop = new ApplicationDesktop();
orthophoniste = new Orthophoniste("oussama" , "nemamcha" , "admin" , "alger","093892", "123") ;
orthophoniste = new Orthophoniste("oussama", "nemamcha", "admin", "alger", "093892", "123");
applicationDesktop.setOrthophoniste(orthophoniste);
Scene scene = new Scene(fxmlLoader.load());

// Exemple avec un patient Enfant
String dateDeNaissanceEnfantStr = "2010-05-15";
Date dateDeNaissanceEnfant = null;
try {
dateDeNaissanceEnfant = new SimpleDateFormat("yyyy-MM-dd").parse(dateDeNaissanceEnfantStr);
} catch (ParseException e) {
e.printStackTrace();
}

Enfant enfant = new Enfant(
"Dupont",
"Jean",
"123 Rue de Paris",
dateDeNaissanceEnfant,
"Paris",
"CM2",
"0123456789",
"0987654321"
);

DossierPatient dossierEnfant = new DossierPatient(enfant);
dossierEnfant.getPatient().setDescriptionTherapie("Exemple de description de thérapie pour le patient Jean Dupont.");
List<RendezVous> rendezVousEnfantList = new ArrayList<>();

try {
rendezVousEnfantList.add(new Consultation(25, "Dupont", "Jean", new SimpleDateFormat("yyyy-MM-dd").parse("2023-05-01"), Time.valueOf("10:00:00")));
rendezVousEnfantList.add(new Consultation(17, "Martin", "Marie", new SimpleDateFormat("yyyy-MM-dd").parse("2023-05-15"), Time.valueOf("11:00:00")));
rendezVousEnfantList.add(new Suivi(DeroulementSeance.DIAGNOSTIC, 1001, new SimpleDateFormat("yyyy-MM-dd").parse("2023-06-01"), Time.valueOf("14:00:00")));
rendezVousEnfantList.add(new Suivi(DeroulementSeance.TRAITEMENT, 1002, new SimpleDateFormat("yyyy-MM-dd").parse("2023-06-15"), Time.valueOf("15:00:00")));
} catch (ParseException e) {
e.printStackTrace();
}

dossierEnfant.getRendezVous().addAll(rendezVousEnfantList);

// Exemple avec un patient Adulte
String dateDeNaissanceAdulteStr = "1985-04-20";
Date dateDeNaissanceAdulte = null;
try {
dateDeNaissanceAdulte = new SimpleDateFormat("yyyy-MM-dd").parse(dateDeNaissanceAdulteStr);
} catch (ParseException e) {
e.printStackTrace();
}

Adult adulte = new Adult(
"Martin",
"Claire",
"456 Avenue des Champs",
dateDeNaissanceAdulte,
"Lyon",
"Master",
"Ingénieur",
"0987654321"
);

DossierPatient dossierAdulte = new DossierPatient(adulte);
dossierAdulte.getPatient().setDescriptionTherapie("Exemple de description de thérapie pour le patient Claire Martin.");
List<RendezVous> rendezVousAdulteList = new ArrayList<>();

try {
rendezVousAdulteList.add(new Consultation(35, "Martin", "Claire", new SimpleDateFormat("yyyy-MM-dd").parse("2023-07-01"), Time.valueOf("09:00:00")));
rendezVousAdulteList.add(new Consultation(36, "Martin", "Claire", new SimpleDateFormat("yyyy-MM-dd").parse("2023-07-15"), Time.valueOf("10:00:00")));
rendezVousAdulteList.add(new Suivi(DeroulementSeance.TRAITEMENT, 1003, new SimpleDateFormat("yyyy-MM-dd").parse("2023-08-01"), Time.valueOf("11:00:00")));
rendezVousAdulteList.add(new Suivi(DeroulementSeance.TRAITEMENT, 1004, new SimpleDateFormat("yyyy-MM-dd").parse("2023-08-15"), Time.valueOf("14:00:00")));
} catch (ParseException e) {
e.printStackTrace();
}

dossierAdulte.getRendezVous().addAll(rendezVousAdulteList);

// Afficher les informations pour un dossier de patient, vous pouvez choisir dossierEnfant ou dossierAdulte
DossierPatientController controller = fxmlLoader.getController();
controller.displayDossier(dossierAdulte); // Remplacer par dossierEnfant pour afficher les infos de l'enfant

stage.setScene(scene);
stage.setTitle("Se connecter");
stage.setTitle("Dossier Patient");
stage.show();

}

public static void main(String[] args) {
launch();
}
}
}
Loading