-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReportWindowController.java
More file actions
78 lines (62 loc) · 2 KB
/
ReportWindowController.java
File metadata and controls
78 lines (62 loc) · 2 KB
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
package healthcareLook;
import java.net.URL;
import java.util.ArrayList;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
public class ReportWindowController implements Initializable{
@FXML
ListView docList;
@FXML
ListView patList;
@FXML
Label docCount;
@FXML
Label patCount;
@FXML
Button save;
String staffId;
String patId;
Alert warnAlert = new Alert(AlertType.WARNING);
Alert dataAlert = new Alert(AlertType.INFORMATION);
ArrayList<String> docs = new ArrayList<String>();
ArrayList<String> pats = new ArrayList<String>();
@Override
public void initialize(URL location, ResourceBundle resources) {
docs.addAll(DatabaseWork.getDoctors());
docList.getItems().addAll(docs);
docList.setOnMouseClicked(e->{
staffId = docList.getSelectionModel().getSelectedItem().toString();
pats.clear();
pats.addAll(DatabaseWork.getPatients(staffId));
if(!patList.getItems().isEmpty()){
patList.getItems().clear();
}
patList.getItems().addAll(pats);
docCount.setText(" ");
docCount.setText(DatabaseWork.getPatientCount(staffId));
});
patList.setOnMouseClicked(e->{
patId = patList.getSelectionModel().getSelectedItem().toString();
patCount.setText(DatabaseWork.getVisitCount(patId));
});
save.setOnAction(e->{
if(docList.getSelectionModel().isEmpty() || patList.getSelectionModel().isEmpty()){
warnAlert.setTitle("Warning!");
warnAlert.setHeaderText("Please select a doctor and a patient files to save.");
warnAlert.showAndWait();
}
else{
DatabaseWork.TextFileSave(staffId, patId);
dataAlert.setTitle("Data saved");
dataAlert.setHeaderText("Data has been saved to text file.");
dataAlert.showAndWait();
}
});
}
}