Compare commits

..

No commits in common. "765d0c8dd224a14a5fe628bc382597d4e56e0490" and "1cbe39b4819c325bb47a8c66a2d0a51b7c7de38e" have entirely different histories.

15 changed files with 208 additions and 261 deletions

View file

@ -6,7 +6,6 @@ import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.TabPane;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
@ -24,12 +23,12 @@ public class Main extends Application {
public void mainWindow() {
try {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/MainWindowView.fxml"));
TabPane pane = loader.load();
BorderPane pane = loader.load();
Scene scene = new Scene(pane);
this.primaryStage.setTitle("NHPlus");
this.primaryStage.setScene(scene);
this.primaryStage.setResizable(true);
this.primaryStage.setResizable(false);
this.primaryStage.show();
this.primaryStage.setOnCloseRequest(event -> {

View file

@ -5,7 +5,7 @@ import java.util.ArrayList;
import java.util.List;
public abstract class DaoImp<T> implements Dao<T> {
protected final Connection connection;
protected Connection connection;
public DaoImp(Connection connection) {
this.connection = connection;

View file

@ -18,7 +18,7 @@ import static de.hitec.nhplus.utils.DateConverter.convertStringToLocalTime;
public class TreatmentFixture implements Fixture<Treatment>
{
private final Map<String, Patient> patientsByName;
private Map<String, Patient> patientsByName;
public TreatmentFixture(Map<String, Patient> patientsByName)
{

View file

@ -1,58 +1,37 @@
package de.hitec.nhplus.main;
import de.hitec.nhplus.Main;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Tab;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import java.io.IOException;
public class MainWindowController {
@FXML
private AnchorPane patientPage;
@FXML
private Tab patientTab;
@FXML
private AnchorPane treatmentPage;
@FXML
private Tab treatmentTab;
@FXML
private BorderPane mainBorderPane;
@FXML
public void initialize() {
loadPatientPage();
loadTreatmentsPage();
patientTab.setOnSelectionChanged(event -> loadPatientPage());
treatmentTab.setOnSelectionChanged(event -> loadTreatmentsPage());
handleShowAllPatient(null);
}
private void loadPatientPage() {
@FXML
private void handleShowAllPatient(ActionEvent event) {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/patient/AllPatientView.fxml"));
try {
BorderPane patientsPane = FXMLLoader.load(
Main.class.getResource("/de/hitec/nhplus/patient/AllPatientView.fxml")
);
patientPage.getChildren().setAll(patientsPane);
AnchorPane.setTopAnchor(patientsPane, 0d);
AnchorPane.setBottomAnchor(patientsPane, 0d);
AnchorPane.setLeftAnchor(patientsPane, 0d);
AnchorPane.setRightAnchor(patientsPane, 0d);
mainBorderPane.setCenter(loader.load());
} catch (IOException exception) {
exception.printStackTrace();
}
}
private void loadTreatmentsPage() {
@FXML
private void handleShowAllTreatments(ActionEvent event) {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/treatment/AllTreatmentView.fxml"));
try {
BorderPane treatmentsPane = FXMLLoader.load(
Main.class.getResource("/de/hitec/nhplus/treatment/AllTreatmentView.fxml")
);
treatmentPage.getChildren().setAll(treatmentsPane);
AnchorPane.setTopAnchor(treatmentsPane, 0d);
AnchorPane.setBottomAnchor(treatmentsPane, 0d);
AnchorPane.setLeftAnchor(treatmentsPane, 0d);
AnchorPane.setRightAnchor(treatmentsPane, 0d);
mainBorderPane.setCenter(loader.load());
} catch (IOException exception) {
exception.printStackTrace();
}

View file

@ -80,7 +80,9 @@ public class AllPatientController {
.getSelectionModel()
.selectedItemProperty()
.addListener((observableValue, oldPatient, newPatient) ->
AllPatientController.this.buttonDelete.setDisable(newPatient == null)
{
AllPatientController.this.buttonDelete.setDisable(newPatient == null);
}
);
this.buttonAdd.setDisable(true);

View file

@ -4,6 +4,7 @@ import de.hitec.nhplus.main.Person;
import de.hitec.nhplus.treatment.Treatment;
import de.hitec.nhplus.utils.DateConverter;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleLongProperty;
import javafx.beans.property.SimpleStringProperty;
import java.time.LocalDate;

View file

@ -70,7 +70,9 @@ public class AllTreatmentController {
.getSelectionModel()
.selectedItemProperty()
.addListener((observableValue, oldTreatment, newTreatment) ->
AllTreatmentController.this.buttonDelete.setDisable(newTreatment == null)
{
AllTreatmentController.this.buttonDelete.setDisable(newTreatment == null);
}
);
this.createComboBoxData();

View file

@ -60,11 +60,11 @@ public class Treatment {
}
public void setBegin(String begin) {
this.begin = DateConverter.convertStringToLocalTime(begin);
this.begin = DateConverter.convertStringToLocalTime(begin);;
}
public void setEnd(String end) {
this.end = DateConverter.convertStringToLocalTime(end);
this.end = DateConverter.convertStringToLocalTime(end);;
}
public String getDescription() {

View file

@ -47,7 +47,7 @@ public class TreatmentController {
PatientDao pDao = DaoFactory.getDaoFactory().createPatientDAO();
try {
this.patient = pDao.read(treatment.getPatientId());
this.patient = pDao.read((int) treatment.getPatientId());
this.treatment = treatment;
showData();
} catch (SQLException exception) {

View file

@ -23,7 +23,7 @@ public class TreatmentDao extends DaoImp<Treatment> {
final String SQL = "INSERT INTO treatment (patientId, treatment_date, begin, end, description, remark) " +
"VALUES (?, ?, ?, ?, ?, ?)";
preparedStatement = this.connection.prepareStatement(SQL);
preparedStatement.setInt(1, treatment.getPatientId());
preparedStatement.setLong(1, treatment.getPatientId());
preparedStatement.setString(2, treatment.getDate());
preparedStatement.setString(3, treatment.getBegin());
preparedStatement.setString(4, treatment.getEnd());
@ -128,7 +128,7 @@ public class TreatmentDao extends DaoImp<Treatment> {
preparedStatement.setString(4, treatment.getEnd());
preparedStatement.setString(5, treatment.getDescription());
preparedStatement.setString(6, treatment.getRemarks());
preparedStatement.setInt(7, treatment.getId());
preparedStatement.setLong(7, treatment.getId());
} catch (SQLException exception) {
exception.printStackTrace();
}

View file

@ -1,6 +1,7 @@
module de.hitec.nhplus {
requires javafx.controls;
requires javafx.fxml;
requires org.controlsfx.controls;
requires java.sql;
requires org.xerial.sqlitejdbc;

View file

@ -1 +1,6 @@
/* https://materialui.co/colors */
.tabs{
-fx-background-color: #1565C0;
-fx-padding: 4px;
-fx-spacing: 4px;
}

View file

@ -1,18 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.layout.AnchorPane?>
<TabPane
tabClosingPolicy="UNAVAILABLE"
xmlns="http://javafx.com/javafx/17.0.2-ea"
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<BorderPane
fx:id="mainBorderPane"
maxHeight="-Infinity"
maxWidth="-Infinity"
minHeight="-Infinity"
minWidth="-Infinity"
prefHeight="688.0"
prefWidth="926.0"
xmlns="http://javafx.com/javafx/10.0.2-internal"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="de.hitec.nhplus.main.MainWindowController"
>
<Tab fx:id="patientTab" text="Patienten">
<AnchorPane fx:id="patientPage"/>
</Tab>
<Tab fx:id="treatmentTab" text="Behandlungen">
<AnchorPane fx:id="treatmentPage"/>
</Tab>
</TabPane>
fx:controller="de.hitec.nhplus.main.MainWindowController">
<top>
<HBox id="tabs" alignment="CENTER_LEFT" styleClass="tabs" stylesheets="@Application.css">
<children>
<Button
alignment="CENTER"
contentDisplay="CENTER"
mnemonicParsing="false"
onAction="#handleShowAllPatient"
prefWidth="105.0"
text="Patienten"
>
<opaqueInsets>
<Insets/>
</opaqueInsets>
</Button>
<Button
alignment="CENTER"
contentDisplay="CENTER"
mnemonicParsing="false"
onAction="#handleShowAllTreatments"
prefWidth="105.0"
text="Behandlungen"
></Button>
</children>
</HBox>
</top>
</BorderPane>

View file

@ -3,72 +3,44 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<BorderPane
<?import javafx.scene.text.Font?>
<AnchorPane
prefHeight="500.0"
prefWidth="855.0"
xmlns="http://javafx.com/javafx/11.0.1"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="de.hitec.nhplus.patient.AllPatientController"
>
<padding>
<Insets top="8" left="8" bottom="8" right="8"/>
</padding>
<center>
fx:controller="de.hitec.nhplus.patient.AllPatientController">
<children>
<TableView
fx:id="tableView"
editable="true"
>
editable="true" layoutX="31.0"
layoutY="120.0" prefHeight="287.0"
prefWidth="825.0"
AnchorPane.bottomAnchor="100.0"
AnchorPane.leftAnchor="15.0"
AnchorPane.rightAnchor="15.0"
AnchorPane.topAnchor="80.0">
<columns>
<TableColumn
fx:id="columnId"
minWidth="40.0"
text="ID"
/>
<TableColumn
fx:id="columnSurname"
minWidth="140.0"
onEditCommit="#handleOnEditSurname"
text="Nachname"
/>
<TableColumn
fx:id="columnFirstName"
minWidth="140.0"
onEditCommit="#handleOnEditFirstname"
text="Vorname"
/>
<TableColumn
fx:id="columnDateOfBirth"
minWidth="140.0"
onEditCommit="#handleOnEditDateOfBirth"
text="Geburtstag"
/>
<TableColumn
fx:id="columnCareLevel"
minWidth="140.0"
onEditCommit="#handleOnEditCareLevel"
prefWidth="75.0"
text="Pflegegrad"
/>
<TableColumn
fx:id="columnRoomNumber"
minWidth="140.0"
onEditCommit="#handleOnEditRoomNumber"
text="Raum"
/>
<TableColumn fx:id="columnId" maxWidth="-1.0" minWidth="40.0" prefWidth="5.0" text="ID"/>
<TableColumn fx:id="columnSurname" maxWidth="-1.0" minWidth="140.0" onEditCommit="#handleOnEditSurname"
prefWidth="100.0" text="Nachname"/>
<TableColumn fx:id="columnFirstName" maxWidth="-1.00" minWidth="140.0"
onEditCommit="#handleOnEditFirstname" prefWidth="75.0" text="Vorname"/>
<TableColumn fx:id="columnDateOfBirth" maxWidth="-1.0" minWidth="140.0"
onEditCommit="#handleOnEditDateOfBirth" prefWidth="75.0" text="Geburtstag"/>
<TableColumn fx:id="columnCareLevel" maxWidth="-1.0" minWidth="140.0"
onEditCommit="#handleOnEditCareLevel" prefWidth="75.0" text="Pflegegrad"/>
<TableColumn fx:id="columnRoomNumber" maxWidth="-1.0" minWidth="140.0"
onEditCommit="#handleOnEditRoomNumber" prefWidth="75.0" text="Raum"/>
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/>
</columnResizePolicy>
</TableView>
</center>
<bottom>
<BorderPane>
<BorderPane.margin>
<Insets top="8.0"/>
</BorderPane.margin>
<center>
<GridPane hgap="8.0" vgap="8.0">
<padding>
<Insets right="48.0"/>
</padding>
<HBox layoutX="623.0" layoutY="419.3999938964844" spacing="10.0" AnchorPane.bottomAnchor="15.0"
AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0">
<children>
<GridPane hgap="10.0" vgap="10.0">
<columnConstraints>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" prefWidth="200.0"/>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="200.0" prefWidth="200.0"/>
@ -78,65 +50,48 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
</rowConstraints>
<TextField
fx:id="textFieldFirstName"
minWidth="200.0"
prefHeight="26.0"
prefWidth="200.0"
promptText="Vorname"
/>
<TextField
fx:id="textFieldSurname"
minWidth="200.0"
prefHeight="26.0"
prefWidth="200.0"
promptText="Nachname"
GridPane.columnIndex="1"
/>
<TextField
fx:id="textFieldDateOfBirth"
minWidth="160.0"
prefWidth="160.0"
promptText="Geburtstag"
GridPane.columnIndex="2"
/>
<TextField
fx:id="textFieldCareLevel"
prefHeight="26.0"
prefWidth="200.0"
promptText="Pflegegrad"
GridPane.rowIndex="1"
/>
<TextField
fx:id="textFieldRoomNumber"
prefHeight="26.0"
prefWidth="200.0"
promptText="Raum"
GridPane.columnIndex="1"
GridPane.rowIndex="1"
/>
<children>
<TextField fx:id="textFieldFirstName" minWidth="200.0" prefHeight="26.0" prefWidth="200.0"
promptText="Vorname"/>
<TextField fx:id="textFieldSurname" minWidth="200.0" prefHeight="26.0" prefWidth="200.0"
promptText="Nachname" GridPane.columnIndex="1"/>
<TextField fx:id="textFieldDateOfBirth" minWidth="160.0" prefWidth="160.0"
promptText="Geburtstag" GridPane.columnIndex="2"/>
<TextField fx:id="textFieldCareLevel" prefHeight="26.0" prefWidth="200.0"
promptText="Pflegegrad" GridPane.rowIndex="1"/>
<TextField fx:id="textFieldRoomNumber" prefHeight="26.0" prefWidth="200.0" promptText="Raum"
GridPane.columnIndex="1" GridPane.rowIndex="1"/>
</children>
<padding>
<Insets right="10.0"/>
</padding>
<HBox.margin>
<Insets/>
</HBox.margin>
</GridPane>
</center>
<right>
<VBox spacing="8.0">
<Button
fx:id="buttonAdd"
mnemonicParsing="false"
onAction="#handleAdd"
prefWidth="90.0"
text="Hinzufügen"
/>
<Button
fx:id="buttonDelete"
mnemonicParsing="false"
onAction="#handleDelete"
prefWidth="90.0"
text="Löschen"
/>
</VBox>
</right>
</BorderPane>
</bottom>
</BorderPane>
<HBox alignment="TOP_CENTER" prefWidth="190.0" spacing="10.0">
<children>
<Button fx:id="buttonAdd" mnemonicParsing="false" onAction="#handleAdd" prefWidth="90.0"
text="Hinzufügen"/>
<Button fx:id="buttonDelete" mnemonicParsing="false" onAction="#handleDelete" prefWidth="90.0"
text="Löschen"/>
</children>
</HBox>
</children>
</HBox>
<HBox alignment="TOP_CENTER" layoutX="10.0" layoutY="10.0" prefWidth="200.0" spacing="25.0"
AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="5.0">
<children>
<Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Patienten"
textAlignment="CENTER">
<font>
<Font size="36.0"/>
</font>
</Label>
</children>
</HBox>
</children>
<padding>
<Insets top="10.0"/>
</padding>
</AnchorPane>

View file

@ -3,93 +3,70 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<BorderPane
xmlns="http://javafx.com/javafx/11.0.1"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="de.hitec.nhplus.treatment.AllTreatmentController"
>
<padding>
<Insets top="8" left="8" bottom="8" right="8"/>
</padding>
<center>
<TableView
fx:id="tableView"
editable="true"
onMouseClicked="#handleMouseClick"
>
<?import javafx.scene.text.Font?>
<AnchorPane prefHeight="500.0" prefWidth="855.0" xmlns="http://javafx.com/javafx/11.0.1"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.treatment.AllTreatmentController">
<children>
<TableView fx:id="tableView" editable="true" layoutX="31.0" layoutY="35.0" onMouseClicked="#handleMouseClick"
prefHeight="364.0" prefWidth="825.0" AnchorPane.bottomAnchor="75.0" AnchorPane.leftAnchor="15.0"
AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="80.0">
<columns>
<TableColumn
fx:id="columnId"
minWidth="40.0"
text="ID"
/>
<TableColumn
fx:id="columnPatientId"
minWidth="40.0"
text="PatientID"
/>
<TableColumn
fx:id="columnDate"
maxWidth="-1.0"
minWidth="140.0"
prefWidth="150.0"
text="Datum"
/>
<TableColumn
fx:id="columnBegin"
minWidth="140.0"
text="Beginn"
/>
<TableColumn
fx:id="columnEnd"
minWidth="140.0"
text="Ende"
/>
<TableColumn
fx:id="columnDescription"
minWidth="200.0"
text="Kurzbeschreibung"
/>
<TableColumn fx:id="columnId" maxWidth="-1.0" minWidth="40.0" prefWidth="50.0" text="ID"/>
<TableColumn fx:id="columnPatientId" maxWidth="-1.0" minWidth="40.0" prefWidth="120.0"
text="PatientID"/>
<TableColumn fx:id="columnDate" maxWidth="-1.0" minWidth="140.0" prefWidth="150.0" text="Datum"/>
<TableColumn fx:id="columnBegin" maxWidth="-1.0" minWidth="140.0" prefWidth="150.0" text="Beginn"/>
<TableColumn fx:id="columnEnd" maxWidth="-1.0" minWidth="140.0" prefWidth="150.0" text="Ende"/>
<TableColumn fx:id="columnDescription" maxWidth="-1.0" minWidth="200.0" prefWidth="300.0"
text="Kurzbeschreibung"/>
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/>
</columnResizePolicy>
</TableView>
</center>
<bottom>
<BorderPane>
<BorderPane.margin>
<Insets top="8.0"/>
</BorderPane.margin>
<center>
<HBox spacing="8.0">
<Button
fx:id="buttonNewTreament"
mnemonicParsing="false"
onAction="#handleNewTreatment"
prefWidth="200.0"
text="neue Behandlung anlegen"
GridPane.columnIndex="1"
/>
<ComboBox
fx:id="comboBoxPatientSelection"
minWidth="160.0"
onAction="#handleComboBox"
prefWidth="200.0"/>
</HBox>
</center>
<right>
<Button
fx:id="buttonDelete"
mnemonicParsing="false"
onAction="#handleDelete"
prefWidth="200.0"
text="Löschen"
GridPane.columnIndex="2"
/>
</right>
</BorderPane>
</bottom>
</BorderPane>
<HBox layoutX="623.0" layoutY="419.3999938964844" spacing="10.0" AnchorPane.bottomAnchor="15.0"
AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0">
<children>
<GridPane hgap="10.0" vgap="10.0">
<columnConstraints>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" prefWidth="200.0"/>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="200.0" prefWidth="200.0"/>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="10.0" prefWidth="160.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<Button fx:id="buttonNewTreament" mnemonicParsing="false" onAction="#handleNewTreatment"
prefWidth="200.0" text="neue Behandlung anlegen" GridPane.columnIndex="1"/>
<ComboBox fx:id="comboBoxPatientSelection" minWidth="160.0" onAction="#handleComboBox"
prefWidth="200.0"/>
<Button fx:id="buttonDelete" mnemonicParsing="false" onAction="#handleDelete" prefWidth="200.0"
text="Löschen" GridPane.columnIndex="2"/>
</children>
<padding>
<Insets right="10.0"/>
</padding>
<HBox.margin>
<Insets/>
</HBox.margin>
</GridPane>
<HBox prefWidth="190.0" spacing="10.0"/>
</children>
</HBox>
<HBox alignment="TOP_CENTER" layoutX="10.0" layoutY="10.0" prefWidth="200.0" spacing="25.0"
AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="5.0">
<children>
<Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Behandlungen"
textAlignment="CENTER">
<font>
<Font size="36.0"/>
</font>
</Label>
</children>
</HBox>
</children>
<padding>
<Insets top="10.0"/>
</padding>
</AnchorPane>