Conflicts: src/main/java/de/uniluebeck/mi/projmi6/db/MySqlConnFactory.javatestBranch
| @@ -6,6 +6,7 @@ import de.uniluebeck.mi.projmi6.model.Kasse; | |||||
| import de.uniluebeck.mi.projmi6.model.Mitarbeiter; | import de.uniluebeck.mi.projmi6.model.Mitarbeiter; | ||||
| import de.uniluebeck.mi.projmi6.model.OpsCode; | import de.uniluebeck.mi.projmi6.model.OpsCode; | ||||
| import javafx.application.Application; | import javafx.application.Application; | ||||
| import javafx.beans.property.ReadOnlyStringProperty; | |||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||
| import javafx.concurrent.Task; | import javafx.concurrent.Task; | ||||
| import javafx.fxml.FXMLLoader; | import javafx.fxml.FXMLLoader; | ||||
| @@ -13,6 +14,7 @@ import javafx.geometry.Insets; | |||||
| import javafx.geometry.Pos; | import javafx.geometry.Pos; | ||||
| import javafx.scene.Parent; | import javafx.scene.Parent; | ||||
| import javafx.scene.Scene; | import javafx.scene.Scene; | ||||
| import javafx.scene.control.ProgressIndicator; | |||||
| import javafx.scene.image.Image; | import javafx.scene.image.Image; | ||||
| import javafx.scene.image.ImageView; | import javafx.scene.image.ImageView; | ||||
| import javafx.scene.layout.Background; | import javafx.scene.layout.Background; | ||||
| @@ -36,27 +38,37 @@ public class Main extends Application { | |||||
| @Override | @Override | ||||
| protected Parent call() throws Exception { | protected Parent call() throws Exception { | ||||
| FXMLLoader fxmlLoader = new FXMLLoader(); | |||||
| fxmlLoader.setLocation(getClass().getClassLoader().getResource("main.fxml")); | |||||
| MainController mainController = new MainController(); | MainController mainController = new MainController(); | ||||
| fxmlLoader.setControllerFactory(mainController.getControllerFactory()); | |||||
| updateMessage("Lade OPS-Codes..."); | |||||
| mainController.getStammdaten().setOpsCodes(FXCollections.observableArrayList( | |||||
| DBHandler.getAllOpsCodes() | |||||
| )); | |||||
| mainController.setOpsCodes(FXCollections.observableArrayList( | |||||
| new OpsCode("1234", "Hallo OPS", 20), | |||||
| new OpsCode("876-3", "Darmspiegelung", 20) | |||||
| updateMessage("Lade ICD-10-Codes..."); | |||||
| mainController.getStammdaten().setIcd10Codes(FXCollections.observableArrayList( | |||||
| DBHandler.getAllIcd10Codes() | |||||
| )); | )); | ||||
| mainController.setKassen(FXCollections.observableArrayList( | |||||
| new Kasse(2, "TK", "Strasse 2", false) | |||||
| updateMessage("Lade Krankenkassen..."); | |||||
| mainController.getStammdaten().setKassen(FXCollections.observableArrayList( | |||||
| DBHandler.getAllKassen() | |||||
| )); | )); | ||||
| mainController.setMitarbeiter(FXCollections.observableArrayList( | |||||
| //TODO | |||||
| updateMessage("Lade Mitarbeiter..."); | |||||
| mainController.getStammdaten().setMitarbeiter(FXCollections.observableArrayList( | |||||
| DBHandler.getAllMitarbeiter() | |||||
| )); | )); | ||||
| mainController.setStationen(FXCollections.observableArrayList(DBHandler.getAllStationen())); | |||||
| updateMessage("Lade Stationen..."); | |||||
| mainController.getStammdaten().setStationen(FXCollections.observableArrayList( | |||||
| DBHandler.getAllStationen()) | |||||
| ); | |||||
| updateMessage("Lade GUI..."); | |||||
| FXMLLoader fxmlLoader = new FXMLLoader(); | |||||
| fxmlLoader.setLocation(getClass().getClassLoader().getResource("main.fxml")); | |||||
| fxmlLoader.setControllerFactory(mainController.getControllerFactory()); | |||||
| Parent root = fxmlLoader.load(); | Parent root = fxmlLoader.load(); | ||||
| @@ -76,7 +88,7 @@ public class Main extends Application { | |||||
| primaryStage.getIcons().add(icon); | primaryStage.getIcons().add(icon); | ||||
| Stage loadingMessage = createLoadWindow(); | |||||
| Stage loadingMessage = createLoadWindow(loadMainWindowTask.messageProperty()); | |||||
| loadMainWindowTask.setOnFailed(event -> { | loadMainWindowTask.setOnFailed(event -> { | ||||
| loadMainWindowTask.getException().printStackTrace(); | loadMainWindowTask.getException().printStackTrace(); | ||||
| @@ -91,6 +103,7 @@ public class Main extends Application { | |||||
| primaryStage.setScene(new Scene(root, 1000, 800)); | primaryStage.setScene(new Scene(root, 1000, 800)); | ||||
| primaryStage.show(); | primaryStage.show(); | ||||
| }); | }); | ||||
| Thread thread = new Thread(loadMainWindowTask); | Thread thread = new Thread(loadMainWindowTask); | ||||
| thread.setDaemon(true); | thread.setDaemon(true); | ||||
| thread.start(); | thread.start(); | ||||
| @@ -104,17 +117,20 @@ public class Main extends Application { | |||||
| * | * | ||||
| * @return the splash screen | * @return the splash screen | ||||
| */ | */ | ||||
| public Stage createLoadWindow(){ | |||||
| public Stage createLoadWindow(ReadOnlyStringProperty progressMessage){ | |||||
| Text kis = new Text("KIS"); | Text kis = new Text("KIS"); | ||||
| kis.setFont(Font.font(50)); | kis.setFont(Font.font(50)); | ||||
| Text gruppe6 = new Text("Gruppe 06"); | Text gruppe6 = new Text("Gruppe 06"); | ||||
| gruppe6.setFont(Font.font(20)); | gruppe6.setFont(Font.font(20)); | ||||
| VBox root = new VBox(gruppe6, new ImageView(icon), kis); | |||||
| Text progress = new Text(); | |||||
| progress.textProperty().bind(progressMessage); | |||||
| VBox root = new VBox(gruppe6, new ImageView(icon), kis, progress); | |||||
| root.setSpacing(20); | root.setSpacing(20); | ||||
| root.setAlignment(Pos.CENTER); | root.setAlignment(Pos.CENTER); | ||||
| Scene scene = new Scene(root, 400, 400); | |||||
| Scene scene = new Scene(root, 400, 500); | |||||
| Stage stage = new Stage(StageStyle.UNDECORATED); | Stage stage = new Stage(StageStyle.UNDECORATED); | ||||
| stage.getIcons().add(icon); | stage.getIcons().add(icon); | ||||
| @@ -5,14 +5,13 @@ package de.uniluebeck.mi.projmi6.controller; | |||||
| */ | */ | ||||
| import de.uniluebeck.mi.projmi6.model.*; | import de.uniluebeck.mi.projmi6.model.*; | ||||
| import javafx.beans.property.SimpleObjectProperty; | |||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||
| import javafx.collections.ObservableList; | |||||
| import javafx.event.ActionEvent; | import javafx.event.ActionEvent; | ||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||
| import javafx.scene.control.Button; | |||||
| import javafx.scene.control.*; | |||||
| import javafx.event.ActionEvent; | import javafx.event.ActionEvent; | ||||
| import javafx.scene.control.ComboBox; | |||||
| import javafx.scene.control.Label; | |||||
| import javafx.scene.control.TextArea; | |||||
| public class DiagnoseController { | public class DiagnoseController { | ||||
| @@ -22,11 +21,38 @@ public class DiagnoseController { | |||||
| this.mainController = mainController; | this.mainController = mainController; | ||||
| } | } | ||||
| public ObservableList<Diagnose> getDiagnosen() { | |||||
| return diagnosen.get(); | |||||
| } | |||||
| public SimpleObjectProperty<ObservableList<Diagnose>> diagnosenProperty() { | |||||
| return diagnosen; | |||||
| } | |||||
| public void setDiagnosen(ObservableList<Diagnose> diagnosen) { | |||||
| this.diagnosen.set(diagnosen); | |||||
| } | |||||
| private SimpleObjectProperty<ObservableList<Diagnose>> diagnosen = new SimpleObjectProperty<>(); | |||||
| @FXML | |||||
| private ListView<Diagnose> diagnoseList; | |||||
| @FXML | @FXML | ||||
| public void initialize(){ | public void initialize(){ | ||||
| diagDiagnose.itemsProperty().bind(mainController.icd10CodesProperty()); | |||||
| diagDiagnose.itemsProperty().bind(mainController.getStammdaten().icd10CodesProperty()); | |||||
| diagDiagnoseArt.setItems(FXCollections.observableArrayList(DiagArt.values())); | diagDiagnoseArt.setItems(FXCollections.observableArrayList(DiagArt.values())); | ||||
| diagDiagnoseArzt.itemsProperty().bind(mainController.mitarbeiterProperty()); | |||||
| diagDiagnoseArzt.itemsProperty().bind(mainController.getStammdaten().mitarbeiterProperty()); | |||||
| diagnoseList.itemsProperty().bind(diagnosen); | |||||
| diagnoseList.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); | |||||
| diagnoseList.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { | |||||
| this.setDiagnose(newValue); | |||||
| }); | |||||
| } | } | ||||
| @@ -90,27 +116,26 @@ public class DiagnoseController { | |||||
| if(diagnose==null){ | if(diagnose==null){ | ||||
| clearFields(); | clearFields(); | ||||
| }else { | }else { | ||||
| copyDiagnoseDataIntoFields(); | |||||
| copyDiagnoseDataIntoFields(diagnose); | |||||
| } | } | ||||
| } | } | ||||
| private void copyDiagnoseDataIntoFields(){ | |||||
| private void copyDiagnoseDataIntoFields(Diagnose diagnose){ | |||||
| diagDiagnoseArzt.setValue(diagnose.getArzt()); | diagDiagnoseArzt.setValue(diagnose.getArzt()); | ||||
| //diagFreitext.setText(diagnose.getFreitext()); | |||||
| diagFreitext.setText(diagnose.getFreiText()); | |||||
| diagDiagnoseArt.setValue(diagnose.getDiagArt()); | diagDiagnoseArt.setValue(diagnose.getDiagArt()); | ||||
| //diagDiagnose.setValue(diagnose.getIcd10Code()); | |||||
| diagDiagnose.setValue(diagnose.getIcd10code()); | |||||
| diagCreator.setText(Integer.toString(diagnose.getErsteller())); | diagCreator.setText(Integer.toString(diagnose.getErsteller())); | ||||
| diagCreateTime.setText(diagnose.getErstellDatumZeit().toString()); | diagCreateTime.setText(diagnose.getErstellDatumZeit().toString()); | ||||
| diagChanger.setText(Integer.toString(diagnose.getBearbeiter())); | diagChanger.setText(Integer.toString(diagnose.getBearbeiter())); | ||||
| diagChangeTime.setText(diagnose.getBearbeitetDatumZeit().toString()); | diagChangeTime.setText(diagnose.getBearbeitetDatumZeit().toString()); | ||||
| } | } | ||||
| private void copyFieldDataIntoDiagnose(Diagnose diagnose){ | private void copyFieldDataIntoDiagnose(Diagnose diagnose){ | ||||
| diagnose.setIcd10code(diagDiagnose.getValue()); | |||||
| diagnose.setArzt(diagDiagnoseArzt.getValue()); | diagnose.setArzt(diagDiagnoseArzt.getValue()); | ||||
| diagnose.setFreiText(diagFreitext.getText()); | diagnose.setFreiText(diagFreitext.getText()); | ||||
| diagnose.setDiagArt(diagDiagnoseArt.getValue()); | diagnose.setDiagArt(diagDiagnoseArt.getValue()); | ||||
| @@ -3,10 +3,9 @@ package de.uniluebeck.mi.projmi6.controller; | |||||
| /** | /** | ||||
| * Created by 631806 on 12.11.15. | * Created by 631806 on 12.11.15. | ||||
| */ | */ | ||||
| import de.uniluebeck.mi.projmi6.model.Diagnose; | |||||
| import de.uniluebeck.mi.projmi6.model.Fall; | |||||
| import de.uniluebeck.mi.projmi6.model.FallArt; | |||||
| import de.uniluebeck.mi.projmi6.model.Kasse; | |||||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | |||||
| import de.uniluebeck.mi.projmi6.model.*; | |||||
| import de.uniluebeck.mi.projmi6.view.DateTimePicker; | import de.uniluebeck.mi.projmi6.view.DateTimePicker; | ||||
| import javafx.beans.property.SimpleObjectProperty; | import javafx.beans.property.SimpleObjectProperty; | ||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||
| @@ -19,6 +18,8 @@ import javafx.scene.control.Label; | |||||
| import javafx.scene.control.TextField; | import javafx.scene.control.TextField; | ||||
| import javafx.scene.layout.GridPane; | import javafx.scene.layout.GridPane; | ||||
| import java.sql.SQLException; | |||||
| public class FallController { | public class FallController { | ||||
| private MainController mainController; | private MainController mainController; | ||||
| @@ -76,7 +77,7 @@ public class FallController { | |||||
| private SimpleObjectProperty<Fall> fallProperty = new SimpleObjectProperty<>(); | private SimpleObjectProperty<Fall> fallProperty = new SimpleObjectProperty<>(); | ||||
| public Fall getFallProperty() { | |||||
| public Fall getFall() { | |||||
| return fallProperty.get(); | return fallProperty.get(); | ||||
| } | } | ||||
| @@ -84,8 +85,8 @@ public class FallController { | |||||
| return fallProperty; | return fallProperty; | ||||
| } | } | ||||
| public void setFallProperty(Fall fallProperty) { | |||||
| this.fallProperty.set(fallProperty); | |||||
| public void setFall(Fall fall) { | |||||
| this.fallProperty.set(fall); | |||||
| } | } | ||||
| public enum State { | public enum State { | ||||
| @@ -99,7 +100,7 @@ public class FallController { | |||||
| public void initialize(){ | public void initialize(){ | ||||
| fallEinweisenderArzt.disableProperty().bind(fallSelbsteinweisung.selectedProperty()); | fallEinweisenderArzt.disableProperty().bind(fallSelbsteinweisung.selectedProperty()); | ||||
| fallFallart.setItems(FXCollections.observableArrayList(FallArt.values())); | fallFallart.setItems(FXCollections.observableArrayList(FallArt.values())); | ||||
| fallKasse.setItems(mainController.getKassen()); | |||||
| fallKasse.setItems(mainController.getStammdaten().getKassen()); | |||||
| btnFallEnableEdit.visibleProperty().bind( | btnFallEnableEdit.visibleProperty().bind( | ||||
| state.isEqualTo(State.VIEW).and(fallProperty.isNotNull()) | state.isEqualTo(State.VIEW).and(fallProperty.isNotNull()) | ||||
| @@ -108,14 +109,13 @@ public class FallController { | |||||
| state.isNotEqualTo(State.VIEW) | state.isNotEqualTo(State.VIEW) | ||||
| ); | ); | ||||
| btnFallSave.visibleProperty().bind( | btnFallSave.visibleProperty().bind( | ||||
| state.isEqualTo(State.VIEW) | |||||
| state.isNotEqualTo(State.VIEW) | |||||
| ); | ); | ||||
| btnFallCancel.visibleProperty().bind( | btnFallCancel.visibleProperty().bind( | ||||
| state.isEqualTo(State.VIEW).and(fallProperty.isNotNull()) | state.isEqualTo(State.VIEW).and(fallProperty.isNotNull()) | ||||
| ); | ); | ||||
| fallFields.disableProperty().bind(state.isEqualTo(State.VIEW)); | fallFields.disableProperty().bind(state.isEqualTo(State.VIEW)); | ||||
| fallProperty.addListener(((observable, oldValue, newValue) -> { | fallProperty.addListener(((observable, oldValue, newValue) -> { | ||||
| @@ -145,27 +145,68 @@ public class FallController { | |||||
| @FXML | @FXML | ||||
| void clickedFallAbort(ActionEvent event) { | void clickedFallAbort(ActionEvent event) { | ||||
| this.state.set(State.VIEW); | |||||
| copyFallDataIntoField(fallProperty.get()); | |||||
| mainController.fallCreationComplete(); | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| void clickedFallSave(ActionEvent event) { | void clickedFallSave(ActionEvent event) { | ||||
| if (this.state.get() == State.CREATE) { | |||||
| Fall fall = new Fall(); | |||||
| copyFieldDataIntoFall(fall); | |||||
| try { | |||||
| DBHandler.setFall(fall, mainController.getCurrentMitarbeiter().getMitarbID()); | |||||
| //TODO Reload Faelle for Patient im MainController | |||||
| } catch (SQLException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } else { | |||||
| try { | |||||
| DBHandler.setFall(fallProperty.get(), mainController.getCurrentMitarbeiter().getMitarbID(), true); | |||||
| } catch (SQLException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| mainController.fallCreationComplete(); | |||||
| this.state.set(State.VIEW); | |||||
| //TODO Update/create in db | |||||
| } | } | ||||
| public void createNewFall() { | public void createNewFall() { | ||||
| clearFields(); | clearFields(); | ||||
| this.state.set(State.CREATE); | this.state.set(State.CREATE); | ||||
| Patient patient = mainController.getPatientTablesController().getSelectedPatient(); | |||||
| // Kasse by Default auf die im Patienten hinterlegten Kasse setzen. | |||||
| for (Kasse kasse : fallKasse.getItems()) { | |||||
| if (kasse.getKassenID() == patient.getKassenID()) { | |||||
| fallKasse.getSelectionModel().select(kasse); | |||||
| break; | |||||
| } | |||||
| } | |||||
| fallVersichertennummer.setText(patient.getVersichertennummer()); | |||||
| // TODO: Jojo: Kannst Du das wieder heile machen? :D | |||||
| // fallProperty.unbind(); | |||||
| // fallProperty.set(new Fall()); | |||||
| } | } | ||||
| private void clearFields(){ | private void clearFields(){ | ||||
| dtTmAufnahme.setToCurrentDateTime(); | |||||
| dtTmEntlassung.setToCurrentDateTime(); | |||||
| if(state.get() == State.CREATE) { | |||||
| dtTmAufnahme.setToCurrentDateTime(); | |||||
| dtTmEntlassung.setToCurrentDateTime(); | |||||
| }else{ | |||||
| dtTmAufnahme.setDateTime(null); | |||||
| dtTmEntlassung.setDateTime(null); | |||||
| } | |||||
| fallPatID.setText("<todo>"); //TODO | |||||
| fallPatID.setText(""); //TODO | |||||
| fallCreateTime.setText("<auto>"); | fallCreateTime.setText("<auto>"); | ||||
| fallCreator.setText("<auto>"); | fallCreator.setText("<auto>"); | ||||
| @@ -186,11 +227,7 @@ public class FallController { | |||||
| private void copyFieldDataIntoFall(Fall fall){ | private void copyFieldDataIntoFall(Fall fall){ | ||||
| if(fall==null){ | |||||
| clearFields(); | |||||
| return; | |||||
| } | |||||
| fall.setPatient(mainController.getPatientTablesController().getSelectedPatient()); | |||||
| fall.setAufnahmeDatum(dtTmAufnahme.getDateTime()); | fall.setAufnahmeDatum(dtTmAufnahme.getDateTime()); | ||||
| fall.setEntlassungsDatum(dtTmEntlassung.getDateTime()); | fall.setEntlassungsDatum(dtTmEntlassung.getDateTime()); | ||||
| if(fallSelbsteinweisung.isSelected()) { | if(fallSelbsteinweisung.isSelected()) { | ||||
| @@ -209,14 +246,20 @@ public class FallController { | |||||
| private void copyFallDataIntoField(Fall fall){ | private void copyFallDataIntoField(Fall fall){ | ||||
| if(fall==null){ | |||||
| System.out.println("copyFallDataIntoFiled - Fall ist null"); | |||||
| clearFields(); | |||||
| return; | |||||
| } | |||||
| dtTmAufnahme.setDateTime(fall.getAufnahmeDatum()); | dtTmAufnahme.setDateTime(fall.getAufnahmeDatum()); | ||||
| dtTmEntlassung.setDateTime(fall.getEntlassungsDatum()); | dtTmEntlassung.setDateTime(fall.getEntlassungsDatum()); | ||||
| //fallPatID.setText(fall.getPatient().getVorname()+" "+fall.getPatient().getNachname()); //TODO | |||||
| fallPatID.setText(fallProperty.get().getPatient()+""); //(fall.getPatient().getVorname()+" "+fall.getPatient().getNachname()); //TODO | |||||
| fallCreateTime.setText(fall.getErstellDatumZeit().toString()); | |||||
| fallCreateTime.setText(fall.getErstellDatumZeit() !=null ? fall.getErstellDatumZeit().toString():""); | |||||
| fallCreator.setText(Integer.toString(fall.getErsteller())); | fallCreator.setText(Integer.toString(fall.getErsteller())); | ||||
| fallEditTime.setText(fall.getBearbeitetDatumZeit().toString()); | |||||
| fallEditTime.setText(fall.getBearbeitetDatumZeit()!=null? fall.getBearbeitetDatumZeit().toString():""); | |||||
| fallEditor.setText(Integer.toString(fall.getBearbeiter())); | fallEditor.setText(Integer.toString(fall.getBearbeiter())); | ||||
| // fallEinweisenderArzt.setText(fall.getEinweisenderArzt()); | // fallEinweisenderArzt.setText(fall.getEinweisenderArzt()); | ||||
| @@ -2,16 +2,22 @@ package de.uniluebeck.mi.projmi6.controller; | |||||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | import de.uniluebeck.mi.projmi6.db.DBHandler; | ||||
| import de.uniluebeck.mi.projmi6.model.*; | import de.uniluebeck.mi.projmi6.model.*; | ||||
| import javafx.beans.binding.Bindings; | |||||
| import javafx.beans.property.ReadOnlyObjectProperty; | |||||
| import javafx.beans.property.SimpleObjectProperty; | import javafx.beans.property.SimpleObjectProperty; | ||||
| import javafx.beans.value.ChangeListener; | |||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||
| import javafx.collections.ObservableList; | import javafx.collections.ObservableList; | ||||
| import javafx.concurrent.Task; | |||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||
| import javafx.scene.control.*; | import javafx.scene.control.*; | ||||
| import javafx.util.Callback; | import javafx.util.Callback; | ||||
| import javax.swing.*; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Set; | import java.util.Set; | ||||
| import java.util.concurrent.ThreadFactory; | |||||
| public class MainController { | public class MainController { | ||||
| @@ -22,47 +28,7 @@ public class MainController { | |||||
| private StationsHistorieController stationsHistorieController; | private StationsHistorieController stationsHistorieController; | ||||
| private UntersuchungenController untersuchungenController; | private UntersuchungenController untersuchungenController; | ||||
| private SimpleObjectProperty<ObservableList<OpsCode>> opsCodes = new SimpleObjectProperty<>(); | |||||
| private SimpleObjectProperty<ObservableList<Icd10Code>> icd10Codes = new SimpleObjectProperty<>(); | |||||
| private SimpleObjectProperty<ObservableList<Mitarbeiter>> mitarbeiter = new SimpleObjectProperty<>(); | |||||
| private SimpleObjectProperty<ObservableList<Kasse>> kassen = new SimpleObjectProperty<>(); | |||||
| private SimpleObjectProperty<ObservableList<Station>> stationen = new SimpleObjectProperty<>(); | |||||
| public ObservableList<Station> getStationen() { | |||||
| return stationen.get(); | |||||
| } | |||||
| public SimpleObjectProperty<ObservableList<Station>> stationenProperty() { | |||||
| return stationen; | |||||
| } | |||||
| public void setStationen(ObservableList<Station> stationen) { | |||||
| this.stationen.set(stationen); | |||||
| } | |||||
| public ObservableList<Mitarbeiter> getMitarbeiter() { | |||||
| return mitarbeiter.get(); | |||||
| } | |||||
| public SimpleObjectProperty<ObservableList<Mitarbeiter>> mitarbeiterProperty() { | |||||
| return mitarbeiter; | |||||
| } | |||||
| public void setMitarbeiter(ObservableList<Mitarbeiter> mitarbeiter) { | |||||
| this.mitarbeiter.set(mitarbeiter); | |||||
| } | |||||
| public ObservableList<Kasse> getKassen() { | |||||
| return kassen.get(); | |||||
| } | |||||
| public SimpleObjectProperty<ObservableList<Kasse>> kassenProperty() { | |||||
| return kassen; | |||||
| } | |||||
| public void setKassen(ObservableList<Kasse> kassen) { | |||||
| this.kassen.set(kassen); | |||||
| } | |||||
| @@ -73,6 +39,7 @@ public class MainController { | |||||
| @FXML | @FXML | ||||
| private ProgressIndicator progressIndicator; | private ProgressIndicator progressIndicator; | ||||
| @FXML | @FXML | ||||
| private Button btnFallCreate; | private Button btnFallCreate; | ||||
| @@ -80,7 +47,7 @@ public class MainController { | |||||
| private SplitPane fallOverview; | private SplitPane fallOverview; | ||||
| @FXML | @FXML | ||||
| private ListView lvFall; | |||||
| private ListView<Fall> lvFall; | |||||
| @FXML | @FXML | ||||
| private TabPane tabPaneFall; | private TabPane tabPaneFall; | ||||
| @@ -89,6 +56,8 @@ public class MainController { | |||||
| private Tab tabFallOverview, tabFallUntersuchungen, tabFallDiagnose, tabFallStationsHistorie ; | private Tab tabFallOverview, tabFallUntersuchungen, tabFallDiagnose, tabFallStationsHistorie ; | ||||
| private Stammdaten stammdaten = new Stammdaten(); | |||||
| private Callback<Class<?>, Object> controllerFactory = clazz -> { | private Callback<Class<?>, Object> controllerFactory = clazz -> { | ||||
| if(clazz.equals(MainController.class)) { | if(clazz.equals(MainController.class)) { | ||||
| @@ -122,7 +91,9 @@ public class MainController { | |||||
| } | } | ||||
| public Stammdaten getStammdaten(){ | |||||
| return stammdaten; | |||||
| } | |||||
| public Callback<Class<?>, Object> getControllerFactory(){ | public Callback<Class<?>, Object> getControllerFactory(){ | ||||
| return controllerFactory; | return controllerFactory; | ||||
| @@ -153,77 +124,214 @@ public class MainController { | |||||
| public void increaseParallelTaskCount(){ | public void increaseParallelTaskCount(){ | ||||
| parallelTaskCount++; | parallelTaskCount++; | ||||
| if(parallelTaskCount>0){ | |||||
| if(parallelTaskCount>0 && progressIndicator!=null){ | |||||
| progressIndicator.setVisible(true); | progressIndicator.setVisible(true); | ||||
| } | } | ||||
| } | } | ||||
| public void decreaseParallelTaskCount(){ | public void decreaseParallelTaskCount(){ | ||||
| parallelTaskCount++; | |||||
| if(parallelTaskCount<=0){ | |||||
| parallelTaskCount--; | |||||
| if(parallelTaskCount<=0 && progressIndicator!=null){ | |||||
| parallelTaskCount = 0; | parallelTaskCount = 0; | ||||
| progressIndicator.setVisible(false); | progressIndicator.setVisible(false); | ||||
| } | } | ||||
| } | } | ||||
| public ObservableList<OpsCode> getOpsCodes() { | |||||
| return opsCodes.get(); | |||||
| } | |||||
| @FXML | |||||
| private Label lvFallPlaceholder; | |||||
| public SimpleObjectProperty<ObservableList<OpsCode>> opsCodesProperty() { | |||||
| return opsCodes; | |||||
| } | |||||
| public void setOpsCodes(ObservableList<OpsCode> opsCodes){ | |||||
| this.opsCodesProperty().set(opsCodes); | |||||
| } | |||||
| public ObservableList<Icd10Code> getIcd10Codes() { | |||||
| return icd10Codes.get(); | |||||
| } | |||||
| private Task<List<Fall>> loadFallTask = null; | |||||
| public SimpleObjectProperty<ObservableList<Icd10Code>> icd10CodesProperty() { | |||||
| return icd10Codes; | |||||
| } | |||||
| public void setIcd10Codes(ObservableList<Icd10Code> icd10Codes) { | |||||
| this.icd10Codes.set(icd10Codes); | |||||
| } | |||||
| private ChangeListener<Patient> onPatientChanged = (observableValue,oldValue,newValue)-> { | |||||
| lvFall.setItems(null); //clear list | |||||
| if(newValue==null){ // If no patient is selected | |||||
| lvFallPlaceholder.setText("Kein Patient ausgew\u00e4hlt!"); | |||||
| return; | |||||
| } | |||||
| if(loadFallTask!=null && loadFallTask.isRunning()){ | |||||
| loadFallTask.cancel(); | |||||
| } | |||||
| loadFallTask = new Task<List<Fall>>() { | |||||
| @Override | |||||
| protected List<Fall> call() throws Exception { | |||||
| return DBHandler.getFaelleByPatID(newValue.getPatID()); | |||||
| } | |||||
| @Override | |||||
| protected void succeeded() { | |||||
| super.succeeded(); | |||||
| if(isCancelled()){ | |||||
| System.out.println("Task wurde gecancelt"); | |||||
| return; | |||||
| } | |||||
| lvFallPlaceholder.setText("Keine F\u00e4lle vorhanden!"); | |||||
| lvFall.setItems(FXCollections.observableArrayList(getValue())); | |||||
| decreaseParallelTaskCount(); | |||||
| } | |||||
| @Override | |||||
| protected void cancelled() { | |||||
| super.cancelled(); | |||||
| decreaseParallelTaskCount(); | |||||
| } | |||||
| @Override | |||||
| protected void failed() { | |||||
| super.failed(); | |||||
| lvFallPlaceholder.setText("Laden fehlgeschlagen!"); | |||||
| lvFall.setItems(null); | |||||
| decreaseParallelTaskCount(); | |||||
| } | |||||
| }; | |||||
| lvFallPlaceholder.setText("Liste wird geladen..."); | |||||
| increaseParallelTaskCount(); | |||||
| Thread thread = new Thread(loadFallTask); | |||||
| thread.setDaemon(true); | |||||
| thread.start(); | |||||
| }; | |||||
| @FXML | @FXML | ||||
| private void initialize(){ | private void initialize(){ | ||||
| cmbUserChoose.itemsProperty().bind(this.mitarbeiterProperty()); | |||||
| //Init user data. | |||||
| cmbUserChoose.itemsProperty().bind(this.getStammdaten().mitarbeiterProperty()); | |||||
| cmbUserChoose.getSelectionModel().select(0); // TODO: Bessere Loesung finden. | |||||
| //Disable the right side if no case is selected. | |||||
| fallOverview.disableProperty().bind(patientTablesController.selectedPatientProperty().isNull()); | fallOverview.disableProperty().bind(patientTablesController.selectedPatientProperty().isNull()); | ||||
| //Load the cases async if patient changes | |||||
| patientTablesController.selectedPatientProperty().addListener(onPatientChanged); | |||||
| patientTablesController.selectedPatientProperty().addListener((observableValue,oldValue,newValue)-> { | |||||
| System.out.println("Neuer Patient gewaehlt"); | |||||
| try { | |||||
| List<Fall> faelle = DBHandler.getFaelleByPatID(newValue.getPatID()); | |||||
| System.out.println(faelle); | |||||
| System.out.println("Liste der Faelle hat "+ faelle.size()+ " Eintrage "); | |||||
| lvFall.setItems(FXCollections.observableArrayList(faelle)); | |||||
| }catch (Exception e){ | |||||
| e.printStackTrace(); | |||||
| } | |||||
| }); | |||||
| lvFall.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); | |||||
| fallController.fallPropertyProperty().bind(lvFall.getSelectionModel().selectedItemProperty()); | |||||
| lvFall.getSelectionModel().selectedItemProperty().addListener(onCaseChanged); | |||||
| } | } | ||||
| private Task<Void> loadCaseData = null; | |||||
| private ChangeListener<Fall> onCaseChanged = (observable, oldValue, newValue) -> { | |||||
| if(loadCaseData!=null && loadCaseData.isRunning()){ | |||||
| loadCaseData.cancel(); | |||||
| } | |||||
| tabPaneFall.setDisable(false); | |||||
| tabFallDiagnose.setDisable(true); | |||||
| tabFallStationsHistorie.setDisable(true); | |||||
| tabFallUntersuchungen.setDisable(true); | |||||
| if(newValue==null) { | |||||
| tabPaneFall.setDisable(true); | |||||
| System.out.println("TODO: Clear tables cuz fall = null!"); | |||||
| //fallController.c | |||||
| return; | |||||
| } | |||||
| if(newValue==null){ // If no patient is selected | |||||
| //lvFallPlaceholder.setText("Kein Patient ausgew\u00e4hlt!"); | |||||
| return; | |||||
| } | |||||
| loadCaseData = new Task<Void>() { | |||||
| List<Untersuchung> untersuchungList; | |||||
| List<Diagnose> diagnoseList; | |||||
| List<StationsHistorie> stationsHistorieList; | |||||
| @Override | |||||
| protected Void call() throws Exception { | |||||
| untersuchungList = DBHandler.getUntersuchungByFall(newValue); | |||||
| diagnoseList = DBHandler.getDiagnosenByFall(newValue); | |||||
| //stationsHistorieList = | |||||
| return null; | |||||
| } | |||||
| @Override | |||||
| protected void succeeded() { | |||||
| super.succeeded(); | |||||
| if(isCancelled()){ | |||||
| System.out.println("Task wurde gecancelt"); | |||||
| return; | |||||
| } | |||||
| untersuchungenController.setUntersuchungen(FXCollections.observableArrayList(untersuchungList)); | |||||
| diagnoseController.setDiagnosen(FXCollections.observableArrayList(diagnoseList)); | |||||
| tabPaneFall.setDisable(false); | |||||
| tabFallDiagnose.setDisable(false); | |||||
| tabFallStationsHistorie.setDisable(false); | |||||
| tabFallUntersuchungen.setDisable(false); | |||||
| decreaseParallelTaskCount(); | |||||
| } | |||||
| @Override | |||||
| protected void cancelled() { | |||||
| super.cancelled(); | |||||
| decreaseParallelTaskCount(); | |||||
| } | |||||
| @Override | |||||
| protected void failed() { | |||||
| super.failed(); | |||||
| //lvFallPlaceholder.setText("Laden fehlgeschlagen!"); | |||||
| getException().printStackTrace(); | |||||
| decreaseParallelTaskCount(); | |||||
| } | |||||
| }; | |||||
| Thread thread = new Thread(loadCaseData); | |||||
| thread.setDaemon(true); | |||||
| thread.start(); | |||||
| increaseParallelTaskCount(); | |||||
| }; | |||||
| @FXML | @FXML | ||||
| private void clickedCreateFall(){ | private void clickedCreateFall(){ | ||||
| tabFallDiagnose.setDisable(true); | tabFallDiagnose.setDisable(true); | ||||
| tabFallUntersuchungen.setDisable(true); | tabFallUntersuchungen.setDisable(true); | ||||
| tabFallStationsHistorie.setDisable(true); | tabFallStationsHistorie.setDisable(true); | ||||
| tabPaneFall.getSelectionModel().select(tabFallOverview); | tabPaneFall.getSelectionModel().select(tabFallOverview); | ||||
| patientTablesController.getPatientOverviewTabPane().setDisable(true); | |||||
| fallController.createNewFall(); | fallController.createNewFall(); | ||||
| } | } | ||||
| public void fallCreationComplete(){ | |||||
| tabFallDiagnose.setDisable(false); | |||||
| tabFallUntersuchungen.setDisable(false); | |||||
| tabFallStationsHistorie.setDisable(false); | |||||
| patientTablesController.getPatientOverviewTabPane().setDisable(false); | |||||
| } | |||||
| public Mitarbeiter getCurrentMitarbeiter(){ | |||||
| return cmbUserChoose.getValue(); | |||||
| } | |||||
| public ReadOnlyObjectProperty<Mitarbeiter> currentMitarbeiterProperty(){ | |||||
| return cmbUserChoose.valueProperty(); | |||||
| } | |||||
| } | } | ||||
| @@ -3,14 +3,19 @@ package de.uniluebeck.mi.projmi6.controller; | |||||
| /** | /** | ||||
| * Created by 631806 on 12.11.15. | * Created by 631806 on 12.11.15. | ||||
| */ | */ | ||||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | |||||
| import de.uniluebeck.mi.projmi6.model.Kasse; | import de.uniluebeck.mi.projmi6.model.Kasse; | ||||
| import de.uniluebeck.mi.projmi6.model.Patient; | import de.uniluebeck.mi.projmi6.model.Patient; | ||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||
| import javafx.event.ActionEvent; | |||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||
| import javafx.scene.control.*; | import javafx.scene.control.*; | ||||
| import javafx.event.ActionEvent; | |||||
| import javafx.stage.Stage; | import javafx.stage.Stage; | ||||
| import java.sql.SQLException; | |||||
| import java.time.LocalDate; | |||||
| public class PatientEditorController { | public class PatientEditorController { | ||||
| /** | /** | ||||
| @@ -40,6 +45,9 @@ public class PatientEditorController { | |||||
| private TextField patNachname; | private TextField patNachname; | ||||
| @FXML | @FXML | ||||
| private TextField patTelefonnummer; | |||||
| @FXML | |||||
| private TextField patStrasse; | private TextField patStrasse; | ||||
| @FXML | @FXML | ||||
| private TextField patHausnummer; | private TextField patHausnummer; | ||||
| @@ -70,36 +78,33 @@ public class PatientEditorController { | |||||
| private Button btnPatSave; | private Button btnPatSave; | ||||
| public PatientEditorController(MainController mainController) { | |||||
| this.mainController = mainController; | |||||
| } | |||||
| @FXML | @FXML | ||||
| public void initialize(){ | |||||
| public void initialize() { | |||||
| patGeschlecht.setItems(FXCollections.observableArrayList(Patient.Geschlecht.values())); | patGeschlecht.setItems(FXCollections.observableArrayList(Patient.Geschlecht.values())); | ||||
| patFamilienstand.setItems(FXCollections.observableArrayList(Patient.Familienstand.values())); | patFamilienstand.setItems(FXCollections.observableArrayList(Patient.Familienstand.values())); | ||||
| patVersicherung.setItems(mainController.getKassen()); | |||||
| patVersicherung.setItems(mainController.getStammdaten().getKassen()); | |||||
| } | } | ||||
| public PatientEditorController(MainController mainController){ | |||||
| this.mainController = mainController; | |||||
| } | |||||
| public void setPatient(Patient patient){ | |||||
| public void setPatient(Patient patient) { | |||||
| this.patient = patient; | this.patient = patient; | ||||
| if(patient==null){ | |||||
| if (patient == null) { | |||||
| clearFields(); | clearFields(); | ||||
| }else { | |||||
| } else { | |||||
| copyPatientDataIntoFields(); | copyPatientDataIntoFields(); | ||||
| } | } | ||||
| } | } | ||||
| private void copyPatientDataIntoFields(){ | |||||
| private void copyPatientDataIntoFields() { | |||||
| patId.setText(Integer.toString(patient.getPatID())); | patId.setText(Integer.toString(patient.getPatID())); | ||||
| patGeburtsname.setText(patient.getGeburtsname()); | patGeburtsname.setText(patient.getGeburtsname()); | ||||
| patNachname.setText(patient.getNachname()); | patNachname.setText(patient.getNachname()); | ||||
| patVorname.setText(patient.getVorname()); | patVorname.setText(patient.getVorname()); | ||||
| patTelefonnummer.setText(patient.getTelefon()); | |||||
| patStrasse.setText(patient.getStrasse()); | patStrasse.setText(patient.getStrasse()); | ||||
| patHausnummer.setText(patient.getHausnummer()); | patHausnummer.setText(patient.getHausnummer()); | ||||
| patPlz.setText(patient.getPlz()); | patPlz.setText(patient.getPlz()); | ||||
| @@ -108,7 +113,12 @@ public class PatientEditorController { | |||||
| patFamilienstand.setValue(patient.getFamilienstand()); | patFamilienstand.setValue(patient.getFamilienstand()); | ||||
| patGeschlecht.setValue(patient.getGeschlecht()); | patGeschlecht.setValue(patient.getGeschlecht()); | ||||
| patVersicherungsnummer.setText(patient.getVersichertennummer()); | patVersicherungsnummer.setText(patient.getVersichertennummer()); | ||||
| // patVersicherung.setValue(patient.getVersicherung()); TODO | |||||
| for (Kasse kasse : patVersicherung.getItems()) { | |||||
| if (kasse.getKassenID() == patient.getKassenID()) { | |||||
| patVersicherung.getSelectionModel().select(kasse); | |||||
| break; | |||||
| } | |||||
| } | |||||
| patCave.setText(patient.getCave()); | patCave.setText(patient.getCave()); | ||||
| patCreator.setText(Integer.toString(patient.getErsteller())); | patCreator.setText(Integer.toString(patient.getErsteller())); | ||||
| @@ -117,7 +127,7 @@ public class PatientEditorController { | |||||
| patChangeTime.setText(patient.getBearbeitetDatumZeit().toString()); | patChangeTime.setText(patient.getBearbeitetDatumZeit().toString()); | ||||
| } | } | ||||
| private void showMessage(String title, String message){ | |||||
| private void showMessage(String title, String message) { | |||||
| Alert alert = new Alert(Alert.AlertType.INFORMATION); | Alert alert = new Alert(Alert.AlertType.INFORMATION); | ||||
| alert.setTitle("Ung\u00fcltige Daten!"); | alert.setTitle("Ung\u00fcltige Daten!"); | ||||
| alert.setHeaderText(title); | alert.setHeaderText(title); | ||||
| @@ -126,11 +136,12 @@ public class PatientEditorController { | |||||
| alert.showAndWait(); | alert.showAndWait(); | ||||
| } | } | ||||
| private void copyFieldDataIntoPatient(Patient patient){ | |||||
| private void copyFieldDataIntoPatient(Patient patient) { | |||||
| patient.setGeburtsname(patGeburtsname.getText()); | patient.setGeburtsname(patGeburtsname.getText()); | ||||
| patient.setNachname(patNachname.getText()); | patient.setNachname(patNachname.getText()); | ||||
| patient.setVorname(patVorname.getText()); | patient.setVorname(patVorname.getText()); | ||||
| patient.setTelefon(patTelefonnummer.getText()); | |||||
| patient.setStrasse(patStrasse.getText()); | patient.setStrasse(patStrasse.getText()); | ||||
| patient.setHausnummer(patHausnummer.getText()); | patient.setHausnummer(patHausnummer.getText()); | ||||
| patient.setPlz(patPlz.getText()); | patient.setPlz(patPlz.getText()); | ||||
| @@ -139,13 +150,14 @@ public class PatientEditorController { | |||||
| patient.setFamilienstand(patFamilienstand.getValue()); | patient.setFamilienstand(patFamilienstand.getValue()); | ||||
| patient.setGeschlecht(patient.getGeschlecht()); | patient.setGeschlecht(patient.getGeschlecht()); | ||||
| patient.setVersichertennummer(patVersicherungsnummer.getText()); | patient.setVersichertennummer(patVersicherungsnummer.getText()); | ||||
| //patient.setVersicherung TODO | |||||
| if (patVersicherung.getSelectionModel().getSelectedItem() != null) | |||||
| patient.setKassenID(patVersicherung.getSelectionModel().getSelectedItem().getKassenID()); | |||||
| patient.setCave(patCave.getText()); | patient.setCave(patCave.getText()); | ||||
| } | } | ||||
| private boolean validateData(){ | |||||
| if(!patPlz.getText().matches("[0-9]{5}")){ | |||||
| private boolean validateData() { | |||||
| if (!patPlz.getText().matches("[0-9]{5}") && !(patPlz.getText().length() == 0)) { | |||||
| showMessage("Die eingegebene PLZ ist ung\u00fcltig!", | showMessage("Die eingegebene PLZ ist ung\u00fcltig!", | ||||
| "Postleitzahlen m\u00fcssen aus exakt 5 Ziffern bestehen!"); | "Postleitzahlen m\u00fcssen aus exakt 5 Ziffern bestehen!"); | ||||
| return false; | return false; | ||||
| @@ -155,8 +167,8 @@ public class PatientEditorController { | |||||
| } | } | ||||
| private void clearFields(){ | |||||
| // TODO: Remove default values. | |||||
| private void clearFields() { | |||||
| patId.setText("<auto>"); | patId.setText("<auto>"); | ||||
| patGeburtsname.setText(""); | patGeburtsname.setText(""); | ||||
| patNachname.setText(""); | patNachname.setText(""); | ||||
| @@ -165,9 +177,10 @@ public class PatientEditorController { | |||||
| patHausnummer.setText(""); | patHausnummer.setText(""); | ||||
| patPlz.setText(""); | patPlz.setText(""); | ||||
| patOrt.setText(""); | patOrt.setText(""); | ||||
| patGeburtsdatum.setValue(null); | |||||
| patFamilienstand.setValue(null); | |||||
| patGeschlecht.setValue(null); | |||||
| patTelefonnummer.setText(""); | |||||
| patGeburtsdatum.setValue(LocalDate.of(1900, 1, 1)); | |||||
| patFamilienstand.setValue(Patient.Familienstand.LEDIG); | |||||
| patGeschlecht.setValue(Patient.Geschlecht.FEMALE); | |||||
| patVersicherungsnummer.setText(""); | patVersicherungsnummer.setText(""); | ||||
| patVersicherung.setValue(null); | patVersicherung.setValue(null); | ||||
| patCave.setText(""); | patCave.setText(""); | ||||
| @@ -180,24 +193,34 @@ public class PatientEditorController { | |||||
| @FXML | @FXML | ||||
| void clickedSave(ActionEvent event) { | void clickedSave(ActionEvent event) { | ||||
| if(!validateData()){ | |||||
| if (!validateData()) { | |||||
| return; | return; | ||||
| } | } | ||||
| if(patient==null){ | |||||
| if (patient == null) { | |||||
| patient = new Patient(); | patient = new Patient(); | ||||
| copyFieldDataIntoPatient(patient); | copyFieldDataIntoPatient(patient); | ||||
| //Create new db entry TODO | |||||
| }else{ | |||||
| try { | |||||
| DBHandler.setPatient(patient, mainController.getCurrentMitarbeiter().getMitarbID(), false); | |||||
| mainController.getPatientTablesController().updatePatientsFromDb(); | |||||
| ((Stage) patNachname.getScene().getWindow()).close(); | |||||
| } catch (SQLException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } else { | |||||
| copyFieldDataIntoPatient(patient); | copyFieldDataIntoPatient(patient); | ||||
| //Update db entry... TODO | |||||
| try { | |||||
| DBHandler.setPatient(patient, mainController.getCurrentMitarbeiter().getMitarbID(), true); | |||||
| ((Stage) patNachname.getScene().getWindow()).close(); | |||||
| } catch (SQLException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | } | ||||
| ((Stage)patNachname.getScene().getWindow()).close(); | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| void clickedAbort(ActionEvent event) { | void clickedAbort(ActionEvent event) { | ||||
| ((Stage)patVorname.getScene().getWindow()).close(); //Close Window | |||||
| ((Stage) patVorname.getScene().getWindow()).close(); //Close Window | |||||
| } | } | ||||
| } | } | ||||
| @@ -3,6 +3,8 @@ package de.uniluebeck.mi.projmi6.controller; | |||||
| /** | /** | ||||
| * Created by Johannes on 12.11.15. | * Created by Johannes on 12.11.15. | ||||
| */ | */ | ||||
| import ca.uhn.hl7v2.model.v251.segment.LOC; | |||||
| import com.sun.org.apache.bcel.internal.generic.LoadClass; | |||||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | import de.uniluebeck.mi.projmi6.db.DBHandler; | ||||
| import de.uniluebeck.mi.projmi6.model.Patient; | import de.uniluebeck.mi.projmi6.model.Patient; | ||||
| import de.uniluebeck.mi.projmi6.model.Station; | import de.uniluebeck.mi.projmi6.model.Station; | ||||
| @@ -14,6 +16,7 @@ import javafx.beans.property.ReadOnlyObjectProperty; | |||||
| import javafx.beans.property.SimpleObjectProperty; | import javafx.beans.property.SimpleObjectProperty; | ||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||
| import javafx.collections.ObservableList; | import javafx.collections.ObservableList; | ||||
| import javafx.concurrent.Task; | |||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||
| import javafx.fxml.FXMLLoader; | import javafx.fxml.FXMLLoader; | ||||
| import javafx.scene.Parent; | import javafx.scene.Parent; | ||||
| @@ -28,6 +31,8 @@ import java.io.IOException; | |||||
| import java.rmi.server.ExportException; | import java.rmi.server.ExportException; | ||||
| import java.sql.SQLException; | import java.sql.SQLException; | ||||
| import java.time.LocalDate; | import java.time.LocalDate; | ||||
| import java.time.LocalDateTime; | |||||
| import java.util.List; | |||||
| /** | /** | ||||
| * Controller class. | * Controller class. | ||||
| @@ -91,25 +96,32 @@ public class PatientTablesController{ | |||||
| private TableView<StationsUebersichtsItem> tblStationOverview; | private TableView<StationsUebersichtsItem> tblStationOverview; | ||||
| @FXML | @FXML | ||||
| private TableColumn<StationsUebersichtsItem, String> colStatPatId; | |||||
| private TableColumn<StationsUebersichtsItem, Integer> colStatPatId; | |||||
| @FXML | @FXML | ||||
| private TableColumn<StationsUebersichtsItem, String> colStatFullName; | private TableColumn<StationsUebersichtsItem, String> colStatFullName; | ||||
| @FXML | @FXML | ||||
| private TableColumn<StationsUebersichtsItem, String> colStatGebDatum; | |||||
| private TableColumn<StationsUebersichtsItem, LocalDate> colStatGebDatum; | |||||
| @FXML | @FXML | ||||
| private TableColumn<StationsUebersichtsItem, String> colStatAlter; | |||||
| private TableColumn<StationsUebersichtsItem, Integer> colStatAlter; | |||||
| @FXML | @FXML | ||||
| private TableColumn<StationsUebersichtsItem, String> colStatAufnahmedatum; | |||||
| private TableColumn<StationsUebersichtsItem, LocalDate> colStatAufnahmedatum; | |||||
| @FXML | @FXML | ||||
| private TableColumn<StationsUebersichtsItem, String> colStatEntlassungsdatum; | |||||
| private TableColumn<StationsUebersichtsItem, LocalDate> colStatEntlassungsdatum; | |||||
| @FXML | @FXML | ||||
| private Tab stationOverviewTab, patientOverviewTab; | |||||
| private Tab stationOverviewTab; | |||||
| public TabPane getPatientOverviewTabPane() { | |||||
| return patientOverviewTabPane; | |||||
| } | |||||
| @FXML | |||||
| private Tab patientOverviewTab; | |||||
| @FXML | @FXML | ||||
| private TabPane patientOverviewTabPane; | private TabPane patientOverviewTabPane; | ||||
| @@ -120,6 +132,9 @@ public class PatientTablesController{ | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| public void initialize() { | public void initialize() { | ||||
| btnPatEdit.disableProperty().bind(tblPatientOverview.getSelectionModel().selectedItemProperty().isNull()); | btnPatEdit.disableProperty().bind(tblPatientOverview.getSelectionModel().selectedItemProperty().isNull()); | ||||
| @@ -136,14 +151,7 @@ public class PatientTablesController{ | |||||
| lblTablePatientEmpty.setText("Liste ist leer."); | lblTablePatientEmpty.setText("Liste ist leer."); | ||||
| lblTableStationEmpty.setText("Daten werden geladen..."); | lblTableStationEmpty.setText("Daten werden geladen..."); | ||||
| cmbStationenFilter.itemsProperty().bind(mainController.stationenProperty()); | |||||
| ObservableList<Patient> patientList = null; | |||||
| try { | |||||
| patientList = FXCollections.<Patient>observableArrayList(DBHandler.getAllPatients()); | |||||
| } catch (SQLException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| cmbStationenFilter.itemsProperty().bind(mainController.getStammdaten().stationenProperty()); | |||||
| patientObjectBinding = Bindings.<Patient>createObjectBinding(() ->{ | patientObjectBinding = Bindings.<Patient>createObjectBinding(() ->{ | ||||
| @@ -154,10 +162,10 @@ public class PatientTablesController{ | |||||
| tblStationOverview.getSelectionModel().selectedItemProperty(), | tblStationOverview.getSelectionModel().selectedItemProperty(), | ||||
| patientOverviewTabPane.getSelectionModel().selectedItemProperty()); | patientOverviewTabPane.getSelectionModel().selectedItemProperty()); | ||||
| tblPatientOverview.setItems(patientList); | |||||
| initColumnsPatient(); | initColumnsPatient(); | ||||
| initColumnsStation(); | initColumnsStation(); | ||||
| updatePatientsFromDb(); | |||||
| } | } | ||||
| private void initColumnsPatient(){ | private void initColumnsPatient(){ | ||||
| @@ -177,12 +185,24 @@ public class PatientTablesController{ | |||||
| private void initColumnsStation(){ | private void initColumnsStation(){ | ||||
| colStatPatId.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patIdProperty().asString()); | |||||
| colStatPatId.setCellValueFactory(new PropertyValueFactory<StationsUebersichtsItem, Integer>("patId")); | |||||
| colStatFullName.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patNameProperty()); | colStatFullName.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patNameProperty()); | ||||
| colStatGebDatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patBirthdateProperty().asString()); | |||||
| colStatAlter.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patAgeProperty().asString()); | |||||
| colStatAufnahmedatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().stationAufnahmeProperty().asString()); | |||||
| colStatEntlassungsdatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().stationEntlassungProperty().asString()); | |||||
| colStatGebDatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patBirthdateProperty()); | |||||
| colStatAlter.setCellValueFactory(new PropertyValueFactory<StationsUebersichtsItem, Integer>("patAge")); | |||||
| colStatAufnahmedatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().stationAufnahmeProperty()); | |||||
| colStatEntlassungsdatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().stationEntlassungProperty()); | |||||
| StationsUebersichtsItem stationsUebersichtsItem = new StationsUebersichtsItem(); | |||||
| stationsUebersichtsItem.setPatId(12212); | |||||
| stationsUebersichtsItem.setFallId(1223); | |||||
| stationsUebersichtsItem.setPatAge(80); | |||||
| stationsUebersichtsItem.setPatBirthdate(LocalDate.of(1935, 9, 22)); | |||||
| stationsUebersichtsItem.setPatName("Wurst, Hans"); | |||||
| stationsUebersichtsItem.setStationAufnahme(LocalDate.of(1980, 8, 17)); | |||||
| stationsUebersichtsItem.setStationEntlassung(LocalDate.of(1981, 2, 1)); | |||||
| tblStationOverview.setItems(FXCollections.observableArrayList(stationsUebersichtsItem)); | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| @@ -224,6 +244,66 @@ public class PatientTablesController{ | |||||
| } | } | ||||
| public void updatePatientsFromDb(){ | |||||
| if(this.loadPatientTask != null && this.loadPatientTask.isRunning()) { | |||||
| System.out.println("Patienten werden bereits geladen."); | |||||
| return; | |||||
| } | |||||
| btnPatRefresh.setDisable(true); | |||||
| tblPatientOverview.setItems(null); | |||||
| mainController.increaseParallelTaskCount(); | |||||
| lblTablePatientEmpty.setText("Liste wird geladen..."); | |||||
| Task<List<Patient>>loadPatientsTask = new Task<List<Patient>>(){ | |||||
| @Override | |||||
| protected List<Patient> call() throws Exception { | |||||
| return FXCollections.<Patient>observableArrayList(DBHandler.getAllPatients()); | |||||
| } | |||||
| @Override | |||||
| protected void succeeded() { | |||||
| super.succeeded(); | |||||
| btnPatRefresh.setDisable(false); | |||||
| lblTablePatientEmpty.setText("Liste ist leer."); | |||||
| tblPatientOverview.setItems(FXCollections.observableArrayList(this.getValue())); | |||||
| mainController.decreaseParallelTaskCount(); | |||||
| } | |||||
| @Override | |||||
| protected void failed() { | |||||
| super.failed(); | |||||
| btnPatRefresh.setDisable(false); | |||||
| lblTablePatientEmpty.setText("Laden fehlgeschlagen!"); | |||||
| mainController.decreaseParallelTaskCount(); | |||||
| tblPatientOverview.setItems(null); | |||||
| if(getException()!=null){ | |||||
| getException().printStackTrace(); | |||||
| } | |||||
| } | |||||
| }; | |||||
| this.loadPatientTask = loadPatientsTask; | |||||
| Thread thread = new Thread(loadPatientsTask); | |||||
| thread.setDaemon(true); | |||||
| thread.start(); | |||||
| } | |||||
| private Task loadPatientTask = null; | |||||
| @FXML | |||||
| private Button btnPatRefresh; | |||||
| @FXML | |||||
| private void clickedRefreshPatient(){ | |||||
| updatePatientsFromDb(); | |||||
| } | |||||
| private ObjectBinding<Patient> patientObjectBinding = null; | private ObjectBinding<Patient> patientObjectBinding = null; | ||||
| public ObjectBinding<Patient> selectedPatientProperty(){ | public ObjectBinding<Patient> selectedPatientProperty(){ | ||||
| @@ -1,5 +1,8 @@ | |||||
| package de.uniluebeck.mi.projmi6.controller; | package de.uniluebeck.mi.projmi6.controller; | ||||
| import de.uniluebeck.mi.projmi6.model.Fall; | |||||
| import de.uniluebeck.mi.projmi6.model.StationsHistorie; | |||||
| import de.uniluebeck.mi.projmi6.model.Untersuchung; | |||||
| import de.uniluebeck.mi.projmi6.view.DateTimePicker; | import de.uniluebeck.mi.projmi6.view.DateTimePicker; | ||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||
| import javafx.scene.control.Button; | import javafx.scene.control.Button; | ||||
| @@ -11,6 +14,12 @@ import javafx.scene.control.TableView; | |||||
| * Created by 631806 on 12.11.15. | * Created by 631806 on 12.11.15. | ||||
| */ | */ | ||||
| public class StationsHistorieController { | public class StationsHistorieController { | ||||
| /** | |||||
| * The station history that is shown in the edit window, or null if a new station history should be created. | |||||
| */ | |||||
| private StationsHistorie stationsHistorie = null; | |||||
| private MainController mainController; | private MainController mainController; | ||||
| @FXML | @FXML | ||||
| @@ -47,5 +56,57 @@ public class StationsHistorieController { | |||||
| } | } | ||||
| public void setStationsHistorie(StationsHistorie stationsHistorie){ | |||||
| this.stationsHistorie = stationsHistorie; | |||||
| if(stationsHistorie==null){ | |||||
| clearFields(); | |||||
| }else { | |||||
| copyStationsHistorieDataIntoFields(); | |||||
| } | |||||
| } | |||||
| private void copyStationsHistorieDataIntoFields(){ | |||||
| // colStatHistAbteilung.setText(stationsHistorie.get()); | |||||
| // colStatHistStation.setText(stationsHistorie.getStation()); | |||||
| // colStatHistAufnahmeDatum.setDateTime(stationsHistorie.getAufnahmeDatum()); | |||||
| // colStatHistEntlassungsDatum.setDateTime(stationsHistorie.getEntlassungsDatum()); | |||||
| // dtTmAufnahme=setDateTime(stationsHistorie.getAufnahmeDatum()); | |||||
| // dtTmEntlassung=setDateTime(stationsHistorie.getEntlassungsDatum()); | |||||
| statHistCreator.setText(Integer.toString(stationsHistorie.getErsteller())); | |||||
| statHistCreatTime.setText(stationsHistorie.getErstellDatumZeit().toString()); | |||||
| statHistEditor.setText(Integer.toString(stationsHistorie.getBearbeiter())); | |||||
| statHistEditTime.setText(stationsHistorie.getBearbeitetDatumZeit().toString()); | |||||
| } | |||||
| private void copyFieldDataIntoStationsHistorie(StationsHistorie stationsHistorie){ | |||||
| if(stationsHistorie==null){ | |||||
| clearFields(); | |||||
| return; | |||||
| } | |||||
| // stationsHistorie.set(colStatHistAbteilung.getText()); | |||||
| // stationsHistorie.setStation(colStatHistStation.getText()); | |||||
| // stationsHistorie.setAufnahmeDatum(colStatHistAufnahmeDatum.getDateTime()); | |||||
| // stationsHistorie.getEntlassungsDatum(colStatHistEntlassungsDatum.getDateTime()); | |||||
| stationsHistorie.setAufnahmeDatum(dtTmAufnahme.getDateTime()); | |||||
| // stationsHistorie.getEntlassungsDatum(dtTmEntlassung.getDateTime()); | |||||
| } | |||||
| private void clearFields(){ | |||||
| //statHistCreateTime.setText("<auto>"); | |||||
| //statHistCreator.setText("<auto>"); | |||||
| //statHistEditTime.setText("<auto>"); | |||||
| // statHistEditor.setText("<auto>"); | |||||
| colStatHistAbteilung.setText(""); | |||||
| colStatHistStation.setText(""); | |||||
| // colStatHistAufnahmeDatum.setDateTime(null); | |||||
| // colStatHistEntlassungsDatum.setDateTime(null); | |||||
| dtTmAufnahme.setDateTime(null); | |||||
| dtTmEntlassung.setDateTime(null); | |||||
| } | |||||
| } | } | ||||
| @@ -5,20 +5,23 @@ package de.uniluebeck.mi.projmi6.controller; | |||||
| */ | */ | ||||
| import de.uniluebeck.mi.projmi6.Main; | import de.uniluebeck.mi.projmi6.Main; | ||||
| import de.uniluebeck.mi.projmi6.model.Mitarbeiter; | |||||
| import de.uniluebeck.mi.projmi6.model.OpsCode; | |||||
| import de.uniluebeck.mi.projmi6.model.Patient; | |||||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | |||||
| import de.uniluebeck.mi.projmi6.model.*; | |||||
| import de.uniluebeck.mi.projmi6.view.DateTimePicker; | import de.uniluebeck.mi.projmi6.view.DateTimePicker; | ||||
| import javafx.beans.property.SimpleObjectProperty; | |||||
| import javafx.collections.ObservableList; | |||||
| import javafx.event.ActionEvent; | import javafx.event.ActionEvent; | ||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||
| import javafx.scene.control.*; | import javafx.scene.control.*; | ||||
| import java.sql.SQLException; | |||||
| public class UntersuchungenController { | public class UntersuchungenController { | ||||
| /** | /** | ||||
| * The examination that is shown in the edit window, or null if a new examination should be created. | * The examination that is shown in the edit window, or null if a new examination should be created. | ||||
| */ | */ | ||||
| // private Untersuchung untersuchung = null; | |||||
| private Untersuchung untersuchung = null; | |||||
| private MainController mainController; | private MainController mainController; | ||||
| @@ -49,7 +52,7 @@ public class UntersuchungenController { | |||||
| private Label untsCreateTime; | private Label untsCreateTime; | ||||
| @FXML | @FXML | ||||
| private ListView<?> untsList; | |||||
| private ListView<Untersuchung> untsList; | |||||
| @FXML | @FXML | ||||
| private ComboBox<OpsCode> untsOpsCode; | private ComboBox<OpsCode> untsOpsCode; | ||||
| @@ -57,18 +60,36 @@ public class UntersuchungenController { | |||||
| @FXML | @FXML | ||||
| private ComboBox<Mitarbeiter> untsArzt; | private ComboBox<Mitarbeiter> untsArzt; | ||||
| public ObservableList<Untersuchung> getUntersuchungen() { | |||||
| return untersuchungen.get(); | |||||
| } | |||||
| public SimpleObjectProperty<ObservableList<Untersuchung>> untersuchungenProperty() { | |||||
| return untersuchungen; | |||||
| } | |||||
| public void setUntersuchungen(ObservableList<Untersuchung> untersuchungen) { | |||||
| this.untersuchungen.set(untersuchungen); | |||||
| } | |||||
| private SimpleObjectProperty<ObservableList<Untersuchung>> untersuchungen = new SimpleObjectProperty<>(); | |||||
| public UntersuchungenController (MainController mainController){ | public UntersuchungenController (MainController mainController){ | ||||
| this.mainController = mainController; | this.mainController = mainController; | ||||
| } | } | ||||
| @FXML | @FXML | ||||
| public void initialize(){ | public void initialize(){ | ||||
| untsOpsCode.itemsProperty().bind(mainController.opsCodesProperty()); | |||||
| untsOpsCode.itemsProperty().bind(mainController.getStammdaten().opsCodesProperty()); | |||||
| untsList.itemsProperty().bind(untersuchungen); | |||||
| untsArzt.setItems(mainController.getStammdaten().getMitarbeiter()); | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| void clickedUntsCreate(ActionEvent event) { | void clickedUntsCreate(ActionEvent event) { | ||||
| clearFields(); | |||||
| untsArzt.getSelectionModel().select(mainController.getCurrentMitarbeiter()); | |||||
| untersuchung = null; | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| @@ -78,9 +99,19 @@ public class UntersuchungenController { | |||||
| @FXML | @FXML | ||||
| void clickedUntsSave(ActionEvent event) { | void clickedUntsSave(ActionEvent event) { | ||||
| // TODO: Jopo: ??? | |||||
| if (untersuchung == null) { | |||||
| untersuchung = new Untersuchung(); | |||||
| untersuchung.setFall(mainController.getFallController().getFall()); | |||||
| copyFieldDataIntoUntersuchung(untersuchung); | |||||
| try { | |||||
| DBHandler.setUntersuchung(untersuchung, mainController.getCurrentMitarbeiter().getMitarbID(), false); | |||||
| } catch (SQLException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| /* | |||||
| public void setUntersuchung(Untersuchung untersuchung){ | public void setUntersuchung(Untersuchung untersuchung){ | ||||
| this.untersuchung = untersuchung; | this.untersuchung = untersuchung; | ||||
| if(untersuchung==null){ | if(untersuchung==null){ | ||||
| @@ -89,18 +120,47 @@ public class UntersuchungenController { | |||||
| copyUntersuchungDataIntoFields(); | copyUntersuchungDataIntoFields(); | ||||
| } | } | ||||
| }*/ | |||||
| /* | |||||
| } | |||||
| private void copyUntersuchungDataIntoFields(){ | private void copyUntersuchungDataIntoFields(){ | ||||
| untsList.setText(Integer.toString(patient.getPatID())); | |||||
| untsOpsCode.setText(patient.getGeburtsname()); | |||||
| untsArzt.setText(patient.getNachname()); | |||||
| untsCreator.setText(Integer.toString(patient.getErsteller())); | |||||
| untsCreateTime.setText(patient.getErstellDatumZeit().toString()); | |||||
| untsChanger.setText(Integer.toString(patient.getBearbeiter())); | |||||
| untsChangeTime.setText(patient.getBearbeitetDatumZeit().toString()); | |||||
| }*/ | |||||
| // untsList.setText(Integer.toString(untersuchung.getUntersID())); | |||||
| untsOpsCode.setValue(untersuchung.getOpscode()); | |||||
| untsArzt.setValue(untersuchung.getDurchfuehrenderArzt()); | |||||
| dtTmUntersuchungszeitpunkt.setDateTime(untersuchung.getUntersuchungsdatum()); | |||||
| untsCreator.setText(Integer.toString(untersuchung.getErsteller())); | |||||
| untsCreateTime.setText(untersuchung.getErstellDatumZeit().toString()); | |||||
| untsChanger.setText(Integer.toString(untersuchung.getBearbeiter())); | |||||
| untsChangeTime.setText(untersuchung.getBearbeitetDatumZeit().toString()); | |||||
| } | |||||
| private void copyFieldDataIntoUntersuchung(Untersuchung untersuchung){ | |||||
| untersuchung.setOpscode(untsOpsCode.getValue()); | |||||
| untersuchung.setDurchfuehrenderArzt(untsArzt.getValue()); | |||||
| // untersuchung.set?(untsList.getValue()); | |||||
| untersuchung.setUntersuchungsdatum(dtTmUntersuchungszeitpunkt.getDateTime()); | |||||
| // untersCreateTime.setText(untersuchung.getErstellDatumZeit().toString()); | |||||
| // untersCreator.setText(Integer.toString(untersuchung.getErsteller())); | |||||
| // untersEditTime.setText(untersuchung.getBearbeitetDatumZeit().toString()); | |||||
| // untersEditor.setText(Integer.toString(untersuchung.getBearbeiter())); | |||||
| } | |||||
| private void clearFields(){ | |||||
| //untersCreateTime.setText("<auto>"); | |||||
| //untersCreator.setText("<auto>"); | |||||
| //untersEditTime.setText("<auto>"); | |||||
| // untersEditor.setText("<auto>"); | |||||
| untsOpsCode.setValue(null); | |||||
| untsArzt.setValue(null); | |||||
| dtTmUntersuchungszeitpunkt.setDateTime(null); | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,4 @@ | |||||
| /** | |||||
| * Controller Klassen | |||||
| */ | |||||
| package de.uniluebeck.mi.projmi6.controller; | |||||
| @@ -2,32 +2,120 @@ package de.uniluebeck.mi.projmi6.db; | |||||
| import de.uniluebeck.mi.projmi6.model.*; | import de.uniluebeck.mi.projmi6.model.*; | ||||
| import java.sql.PreparedStatement; | |||||
| import java.sql.ResultSet; | |||||
| import java.sql.SQLException; | |||||
| import java.sql.Statement; | |||||
| import java.sql.*; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.List; | import java.util.List; | ||||
| /** | /** | ||||
| * Created by nils on 15.11.2015. | |||||
| * Handler fuer alle DB Interaktionen. | |||||
| */ | */ | ||||
| public class DBHandler { | public class DBHandler { | ||||
| private static final String SELECT_ALL_PATIENTS = "SELECT * FROM `patient`"; | private static final String SELECT_ALL_PATIENTS = "SELECT * FROM `patient`"; | ||||
| private static final String SELECT_PATIENT_BY_ID = "SELECT * FROM `patient` WHERE `id` = ?"; | private static final String SELECT_PATIENT_BY_ID = "SELECT * FROM `patient` WHERE `id` = ?"; | ||||
| private static final String UPDATE_PATIENT = "UPDATE `patient` SET `CAVE`=?, `Familienstand`=?, " + | |||||
| "`Geburtsdatum`=?, `Geburtsname`=?, `Geschlecht`=?, `KassenID`=?, `LetzterBearbeiter`=?, `Nachname`=?, " + | |||||
| "`Ort`=?, `PLZ`=?, `Strasse`=?, `Telefon`=?, `Versichertennummer`=?, `Vorname`=? WHERE `ID`=?"; | |||||
| private static final String UPDATE_PATIENT = "UPDATE `patient`" + | |||||
| "SET `CAVE`=?," + | |||||
| "`Vorname`=?," + | |||||
| "`Geburtsname`=?," + | |||||
| "`Nachname`=?," + | |||||
| "`Geburtsdatum`=?," + | |||||
| "`Geschlecht`=?," + | |||||
| "`Familienstand`=?," + | |||||
| "`Strasse`=?," + | |||||
| "`Hausnummer`=?," + | |||||
| "`PLZ`=?," + | |||||
| "`Ort`=?," + | |||||
| "`Telefon`=?," + | |||||
| "`KassenID`=?," + | |||||
| "`Versichertennummer`=?," + | |||||
| "`LetzterBearbeiter`=? " + | |||||
| "WHERE `ID`=?"; | |||||
| private static final String INSERT_PATIENT = "INSERT INTO `patient`" + | |||||
| "(`CAVE`," + | |||||
| "`Vorname`," + | |||||
| "`Geburtsname`," + | |||||
| "`Nachname`," + | |||||
| "`Geburtsdatum`," + | |||||
| "`Geschlecht`," + | |||||
| "`Familienstand`," + | |||||
| "`Strasse`," + | |||||
| "`Hausnummer`," + | |||||
| "`PLZ`," + | |||||
| "`Ort`," + | |||||
| "`Telefon`," + | |||||
| "`KassenID`," + | |||||
| "`Versichertennummer`," + | |||||
| "`LetzterBearbeiter`," + | |||||
| "`Ersteller`)" + | |||||
| "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; | |||||
| private static final String SELECT_ALL_STATIONEN = "SELECT * FROM `stammstation`"; | private static final String SELECT_ALL_STATIONEN = "SELECT * FROM `stammstation`"; | ||||
| private static final String SELECT_FAELLE_BY_PATID = "SELECT * FROM `fall` WHERE `patientid` = ?"; | private static final String SELECT_FAELLE_BY_PATID = "SELECT * FROM `fall` WHERE `patientid` = ?"; | ||||
| private static final String INSERT_FALL = "INSERT INTO `fall`" + | |||||
| "(`Aufnahmedatum`," + | |||||
| "`Entlassungsdatum`," + | |||||
| "`Vorstelldatum`," + | |||||
| "`EinweisenderArzt`," + | |||||
| "`Fallart`," + | |||||
| "`Selbsteinweisung`," + | |||||
| "`Hauptdiagnose`," + | |||||
| "`Versichertennummer`," + | |||||
| "`KassenID`," + | |||||
| "`storniert`," + | |||||
| "`LetzterBearbeiter`," + | |||||
| "`PatientID`," + | |||||
| "`Ersteller`)" + | |||||
| "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; | |||||
| private static final String UPDATE_FALL = "UPDATE `fall`" + | |||||
| "SET `Aufnahmedatum`=?," + | |||||
| "`Entlassungsdatum`=?," + | |||||
| "`Vorstelldatum`=?," + | |||||
| "`EinweisenderArzt`=?," + | |||||
| "Fallart=?," + | |||||
| "`Selbsteinweisung`=?," + | |||||
| "Hauptdiagnose=?," + | |||||
| "`Versichertennummer`=?," + | |||||
| "KassenID=?," + | |||||
| "`storniert`=?," + | |||||
| "LetzterBearbeiter=? " + | |||||
| "WHERE `FallID`=?"; | |||||
| private static final String SELECT_DIAGNOSE_BY_ID = "SELECT * FROM `diagnose` WHERE `diagid` = ?"; | private static final String SELECT_DIAGNOSE_BY_ID = "SELECT * FROM `diagnose` WHERE `diagid` = ?"; | ||||
| private static final String SELECT_ALL_ICD10CODES = "SELECT * FROM `stammicd10`"; | private static final String SELECT_ALL_ICD10CODES = "SELECT * FROM `stammicd10`"; | ||||
| private static final String SELECT_ALL_OPSCODES = "SELECT * FROM `stammops`"; | private static final String SELECT_ALL_OPSCODES = "SELECT * FROM `stammops`"; | ||||
| private static final String SELECT_ICD10CODE_BY_ID = "SELECT * FROM `stammicd10` WHERE `icd10code` = '?' AND `version` = ?"; | |||||
| private static final String SELECT_OPSCODE_BY_ID = "SELECT * FROM `stammops` WHERE `opscode` = '?' AND `version` = ?"; | |||||
| private static final String SELECT_ICD10CODE_BY_ID = "SELECT * FROM `stammicd10` WHERE `icd10code` = ? AND `version` = ?"; | |||||
| private static final String SELECT_OPSCODE_BY_ID = "SELECT * FROM `stammops` WHERE `opscode` = ? AND `version` = ?"; | |||||
| private static final String SELECT_ALL_MITARBEITER = "SELECT * FROM `mitarbeiter`"; | private static final String SELECT_ALL_MITARBEITER = "SELECT * FROM `mitarbeiter`"; | ||||
| private static final String SELECT_UNTERS_BY_FALLID = "SELECT * FROM `untersuchung` WHERE `fallid` = ?"; | |||||
| private static final String INSERT_UNTERSUCHUNG = "INSERT INTO `untersuchung`" + | |||||
| "(`DurchfuehrenderArzt`," + | |||||
| "`FallID`," + | |||||
| "`OPSCode`," + | |||||
| "`OPSVersion`," + | |||||
| "`storniert`," + | |||||
| "`Untersuchungsdatum`," + | |||||
| "`LetzterBearbeiter`," + | |||||
| "`Ersteller`)" + | |||||
| "VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; | |||||
| private static final String UPDATE_UNTERSUCHUNG = "UPDATE `untersuchung`" + | |||||
| "SET `DurchfuehrenderArzt`=?," + | |||||
| "`FallID`=?," + | |||||
| "`OPSCode`=?," + | |||||
| "`OPSVersion`=?," + | |||||
| "`storniert`=?," + | |||||
| "`Untersuchundatum`=?" + | |||||
| "`LetzterBearbeiter` " + | |||||
| "WHERE `UnterID`=?"; | |||||
| private static final String SELECT_MITARBEITER_BY_ID = "SELECT * FROM `mitarbeiter` WHERE `mitarbid` = ?"; | |||||
| private static final String SELECT_DIAGNOSE_BY_FALLID = "SELECT * FROM `diagnose` WHERE `fallid` = ?"; | |||||
| private static final String SELECT_ALL_KASSEN = "SELECT * FROM `kasse`"; | |||||
| private static final String SELECT_KASSE_BY_KASSENID = "SELECT * FROM `kasse` WHERE `kasse`.`KassenID` = ?"; | |||||
| private static final String SELECT_STATHIST_BY_STATION = "SELECT * FROM `stationshistorie` WHERE `stationshistorie`.`Station` = ?"; | |||||
| /** | |||||
| * Gibt alle {@link Patient} aus der DB zurueck. | |||||
| * | |||||
| * @return Liste aller {@link Patient}. | |||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | |||||
| */ | |||||
| public static List<Patient> getAllPatients() throws SQLException { | public static List<Patient> getAllPatients() throws SQLException { | ||||
| Statement statement = MySqlConnFactory.getConnection().createStatement(); | Statement statement = MySqlConnFactory.getConnection().createStatement(); | ||||
| ResultSet rs = statement.executeQuery(SELECT_ALL_PATIENTS); | ResultSet rs = statement.executeQuery(SELECT_ALL_PATIENTS); | ||||
| @@ -40,40 +128,100 @@ public class DBHandler { | |||||
| return patients; | return patients; | ||||
| } | } | ||||
| public static Patient getPatient(int id) throws SQLException { | |||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_PATIENT_BY_ID); | |||||
| ResultSet rs; | |||||
| statement.setInt(1, id); | |||||
| rs = statement.executeQuery(); | |||||
| return getPatient(rs); | |||||
| } | |||||
| /** | |||||
| * Extrahiert ein Objekt {@link Patient} aus einem gegebenen {@link ResultSet}. | |||||
| * | |||||
| * @param rs ResultSet from Database Query. | |||||
| * @return {@link Patient} | |||||
| * @throws SQLException | |||||
| */ | |||||
| private static Patient getPatient(ResultSet rs) throws SQLException { | private static Patient getPatient(ResultSet rs) throws SQLException { | ||||
| Patient patient = new Patient(); | Patient patient = new Patient(); | ||||
| patient.setPatID(rs.getInt("id")); | patient.setPatID(rs.getInt("id")); | ||||
| patient.setGeburtsname(rs.getString("geburtsname")); | patient.setGeburtsname(rs.getString("geburtsname")); | ||||
| patient.setVorname(rs.getString("vorname")); | patient.setVorname(rs.getString("vorname")); | ||||
| patient.setNachname(rs.getString("nachname")); | patient.setNachname(rs.getString("nachname")); | ||||
| if (rs.getDate("geburtsdatum") != null) | |||||
| if (rs.getDate("geburtsdatum") != null) { | |||||
| patient.setGeburtsdatum(rs.getDate("geburtsdatum").toLocalDate()); | patient.setGeburtsdatum(rs.getDate("geburtsdatum").toLocalDate()); | ||||
| } | |||||
| patient.setCave(rs.getString("cave")); | |||||
| patient.setStrasse(rs.getString("strasse")); | patient.setStrasse(rs.getString("strasse")); | ||||
| patient.setHausnummer(rs.getString("hausnummer")); | patient.setHausnummer(rs.getString("hausnummer")); | ||||
| patient.setPlz(rs.getString("plz")); | patient.setPlz(rs.getString("plz")); | ||||
| patient.setOrt(rs.getString("ort")); | |||||
| patient.setTelefon(rs.getString("telefon")); | patient.setTelefon(rs.getString("telefon")); | ||||
| // patient.setFamilienstand(rs.getString("familienstand")); TODO | |||||
| // patient.setGeschlecht(Patient.Geschlecht.valueOf(rs.getString("geschlecht"))); TODO | |||||
| if (rs.getString("familienstand") != null) { | |||||
| patient.setFamilienstand(Patient.Familienstand.parseChar(rs.getString("familienstand").charAt(0))); | |||||
| } | |||||
| if (rs.getString("geschlecht") != null) { | |||||
| patient.setGeschlecht(Patient.Geschlecht.parseChar(rs.getString("geschlecht").charAt(0))); | |||||
| } | |||||
| patient.setVersichertennummer(rs.getString("versichertennummer")); | patient.setVersichertennummer(rs.getString("versichertennummer")); | ||||
| patient.setKassenID(rs.getInt("kassenid")); | patient.setKassenID(rs.getInt("kassenid")); | ||||
| setVersionInformation(patient, rs); | setVersionInformation(patient, rs); | ||||
| return patient; | return patient; | ||||
| } | } | ||||
| public static void updatePatient(Patient patient) throws SQLException { | |||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(UPDATE_PATIENT); | |||||
| statement.setString(1, patient.getCave()); | |||||
| statement.setString(2, patient.getFamilienstand().toString()); | |||||
| // TODO | |||||
| // TODO: Never used. | |||||
| public static Patient getPatient(int id) throws SQLException { | |||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_PATIENT_BY_ID); | |||||
| ResultSet rs; | |||||
| statement.setInt(1, id); | |||||
| rs = statement.executeQuery(); | |||||
| return getPatient(rs); | |||||
| } | |||||
| /** | |||||
| * Fuehrt {@code INSERT} bei einem neuen Datensatz und {@code UPDATE} bei einem existierenden Datensatz aus. | |||||
| * | |||||
| * @param patient zu verarbeitender Datensatz. | |||||
| * @param mitarbid {@link Mitarbeiter#mitarbID} des aktuellen Benutzers/Mitarbeiters. | |||||
| * @param isUpdate {@code true} wenn der Datensatz bereits existiert, sonst {@code false}. | |||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | |||||
| */ | |||||
| public static void setPatient(Patient patient, int mitarbid, boolean isUpdate) throws SQLException { | |||||
| PreparedStatement statement; | |||||
| if (isUpdate) { | |||||
| statement = MySqlConnFactory.getConnection().prepareStatement(UPDATE_PATIENT); | |||||
| } else { | |||||
| statement = MySqlConnFactory.getConnection().prepareStatement(INSERT_PATIENT); | |||||
| } | |||||
| statement.setString(1, patient.getCave()); // CAVE | |||||
| statement.setString(2, patient.getVorname()); // Vorname | |||||
| statement.setString(3, patient.getGeburtsname()); // Geburtsname | |||||
| statement.setString(4, patient.getNachname()); // Nachname | |||||
| statement.setDate(5, Date.valueOf(patient.getGeburtsdatum())); // Geburtsdatum | |||||
| if (patient.getGeschlecht() != null) { | |||||
| statement.setString(6, String.valueOf(patient.getGeschlecht().id())); // Geschlecht | |||||
| } else { | |||||
| statement.setString(6, String.valueOf(Patient.Geschlecht.OTHER.id())); | |||||
| } | |||||
| if (patient.getFamilienstand() != null) { | |||||
| statement.setString(7, String.valueOf(patient.getFamilienstand().id()));// Familienstand | |||||
| } else { | |||||
| statement.setString(7, String.valueOf(Patient.Familienstand.LEDIG.id())); | |||||
| } | |||||
| statement.setString(8, patient.getStrasse()); // Strasse | |||||
| statement.setString(9, patient.getHausnummer()); // Hausnummer | |||||
| statement.setString(10, patient.getPlz()); // PLZ | |||||
| statement.setString(11, patient.getOrt()); // Ort | |||||
| statement.setString(12, patient.getTelefon()); // Telefon | |||||
| statement.setInt(13, patient.getKassenID()); // KassenID | |||||
| statement.setString(14, patient.getVersichertennummer()); // Versichertennummer | |||||
| statement.setInt(15, mitarbid); // LetzterBearbeiter | |||||
| if (!isUpdate) { | |||||
| statement.setInt(16, mitarbid); // Ersteller | |||||
| } else { | |||||
| statement.setInt(16, patient.getPatID()); // PatID (WHERE) | |||||
| } | |||||
| statement.execute(); | |||||
| } | } | ||||
| public static List<Station> getAllStationen() throws SQLException { | public static List<Station> getAllStationen() throws SQLException { | ||||
| @@ -88,6 +236,13 @@ public class DBHandler { | |||||
| return stationen; | return stationen; | ||||
| } | } | ||||
| /** | |||||
| * Extrahiert ein Objekt {@link Station} aus einem gegebenen {@link ResultSet}. | |||||
| * | |||||
| * @param rs ResultSet from Database Query. | |||||
| * @return {@link Station} | |||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | |||||
| */ | |||||
| private static Station getStation(ResultSet rs) throws SQLException { | private static Station getStation(ResultSet rs) throws SQLException { | ||||
| Station station = new Station(); | Station station = new Station(); | ||||
| station.setStation(rs.getString("station")); | station.setStation(rs.getString("station")); | ||||
| @@ -98,6 +253,37 @@ public class DBHandler { | |||||
| return station; | return station; | ||||
| } | } | ||||
| public static List<StationsHistorie> getStationsHistorieByStation(String station) throws SQLException { | |||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_STATHIST_BY_STATION); | |||||
| statement.setString(1, station); | |||||
| ResultSet rs = statement.executeQuery(); | |||||
| List<StationsHistorie> historie = new ArrayList<>(); | |||||
| while (rs.next()) { | |||||
| historie.add(getStationsHistorie(rs)); | |||||
| } | |||||
| return historie; | |||||
| } | |||||
| private static StationsHistorie getStationsHistorie(ResultSet rs) throws SQLException { | |||||
| StationsHistorie hist = new StationsHistorie(); | |||||
| hist.setStatHistID(rs.getInt("stathistid")); | |||||
| if (rs.getTimestamp("aufnahmedatum") != null) { | |||||
| hist.setAufnahmeDatum(rs.getTimestamp("aufnahmedatum").toLocalDateTime()); | |||||
| } | |||||
| if (rs.getTimestamp("entlassungsdatum") != null) { | |||||
| hist.setEntlassungsDatum(rs.getTimestamp("entlassungsdatum").toLocalDateTime()); | |||||
| } | |||||
| // TODO: Muss das jeweils das Objekt sein? | |||||
| // hist.setFall(null); | |||||
| // hist.setStation(null); | |||||
| return hist; | |||||
| } | |||||
| public static List<Fall> getFaelleByPatID(int id) throws SQLException { | public static List<Fall> getFaelleByPatID(int id) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_FAELLE_BY_PATID); | PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_FAELLE_BY_PATID); | ||||
| statement.setInt(1, id); | statement.setInt(1, id); | ||||
| @@ -111,22 +297,115 @@ public class DBHandler { | |||||
| return faelle; | return faelle; | ||||
| } | } | ||||
| /** | |||||
| * Extrahiert ein Objekt {@link Fall} aus einem gegebenen {@link ResultSet}. | |||||
| * | |||||
| * @param rs ResultSet from Database Query. | |||||
| * @return {@link Fall} | |||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | |||||
| */ | |||||
| private static Fall getFall(ResultSet rs) throws SQLException { | private static Fall getFall(ResultSet rs) throws SQLException { | ||||
| Fall fall = new Fall(); | Fall fall = new Fall(); | ||||
| fall.setFallID(rs.getInt("fallid")); | fall.setFallID(rs.getInt("fallid")); | ||||
| if (rs.getTimestamp("aufnahmedatum") != null) | |||||
| if (rs.getTimestamp("aufnahmedatum") != null) { | |||||
| fall.setAufnahmeDatum(rs.getTimestamp("aufnahmedatum").toLocalDateTime()); | fall.setAufnahmeDatum(rs.getTimestamp("aufnahmedatum").toLocalDateTime()); | ||||
| if (rs.getTimestamp("entlassungsdatum") != null) | |||||
| } | |||||
| if (rs.getTimestamp("entlassungsdatum") != null) { | |||||
| fall.setEntlassungsDatum(rs.getTimestamp("entlassungsdatum").toLocalDateTime()); | fall.setEntlassungsDatum(rs.getTimestamp("entlassungsdatum").toLocalDateTime()); | ||||
| if (rs.getInt("hauptdiagnose") != 0) | |||||
| } | |||||
| if (rs.getInt("hauptdiagnose") != 0) { | |||||
| fall.setHauptDiagnose(getDiagnose(rs.getInt("hauptdiagnose"), fall)); | fall.setHauptDiagnose(getDiagnose(rs.getInt("hauptdiagnose"), fall)); | ||||
| } | |||||
| if (rs.getString("versichertennummer") != null) { | |||||
| fall.setVersichertenNummer(rs.getString("versichertennummer")); | |||||
| } | |||||
| if (rs.getInt("kassenid") != 0) { | |||||
| fall.setKasse(getKasse(rs.getInt("kassenid"))); | |||||
| } | |||||
| fall.setFallArt(FallArt.parseString(rs.getString("fallart"))); | |||||
| return fall; | return fall; | ||||
| } | } | ||||
| private static Diagnose getDiagnose(int hauptdiagnose, Fall fall) throws SQLException { | |||||
| Diagnose diagnose = getDiagnose(hauptdiagnose); | |||||
| /** | |||||
| * Fuehrt {@code INSERT} bei einem neuen Datensatz und {@code UPDATE} bei einem existierenden Datensatz aus. | |||||
| * | |||||
| * @param fall zu verarbeitender Datensatz. | |||||
| * @param mitarbid {@link Mitarbeiter#mitarbID} des aktuellen Benutzers/Mitarbeiters. | |||||
| * @param isUpdate {@code true} wenn der Datensatz bereits existiert, sonst {@code false}. | |||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | |||||
| */ | |||||
| public static void setFall(Fall fall, int mitarbid, boolean isUpdate) throws SQLException { | |||||
| PreparedStatement statement; | |||||
| if (isUpdate) { | |||||
| statement = MySqlConnFactory.getConnection().prepareStatement(UPDATE_FALL); | |||||
| } else { | |||||
| statement = MySqlConnFactory.getConnection().prepareStatement(INSERT_FALL); | |||||
| } | |||||
| if (fall.getAufnahmeDatum() != null) { | |||||
| statement.setTimestamp(1, Timestamp.valueOf(fall.getAufnahmeDatum())); // Aufnahmedatum | |||||
| } else { | |||||
| statement.setTimestamp(1, null); | |||||
| } | |||||
| if (fall.getEntlassungsDatum() != null) { | |||||
| statement.setTimestamp(2, Timestamp.valueOf(fall.getEntlassungsDatum())); // Entlassungsdatum | |||||
| } else { | |||||
| statement.setTimestamp(2, null); | |||||
| } | |||||
| if (fall.getVorstellDatum() != null) { | |||||
| statement.setTimestamp(3, Timestamp.valueOf(fall.getVorstellDatum())); // Vorstelldatum | |||||
| } else { | |||||
| statement.setTimestamp(3, null); | |||||
| } | |||||
| if (fall.getEinweisenderArzt() != null) { | |||||
| statement.setInt(4, fall.getEinweisenderArzt().getMitarbID()); // EinweisenderArzt | |||||
| } else { | |||||
| statement.setTimestamp(4, null); | |||||
| } | |||||
| if (fall.getFallArt() != null) { | |||||
| statement.setString(5, fall.getFallArt().id()); // Fallart | |||||
| } else { | |||||
| statement.setString(5, null); | |||||
| } | |||||
| statement.setBoolean(6, fall.getSelbsteinweisung()); // Selbsteinweisung | |||||
| if (fall.getHauptDiagnose() != null) { | |||||
| statement.setInt(7, fall.getHauptDiagnose().getDiagID()); // Hauptdiagnose | |||||
| } else { | |||||
| statement.setTimestamp(7, null); | |||||
| } | |||||
| statement.setString(8, fall.getVersichertenNummer()); // Versichertennummer | |||||
| if (fall.getKasse() != null) { | |||||
| statement.setInt(9, fall.getKasse().getKassenID()); // KassenID | |||||
| } else { | |||||
| statement.setTimestamp(9, null); | |||||
| } | |||||
| statement.setBoolean(10, fall.getStorniert()); // storniert | |||||
| statement.setInt(11, mitarbid); // Letzter Bearbeiter | |||||
| if (!isUpdate) { | |||||
| statement.setInt(12, fall.getPatient().getPatID()); // PatientID | |||||
| statement.setInt(13, mitarbid); // Ersteller | |||||
| } | |||||
| if (isUpdate) { | |||||
| statement.setInt(12, fall.getFallID()); | |||||
| } | |||||
| statement.execute(); | |||||
| } | |||||
| /** | |||||
| * Fuehrt {@code INSERT} eines neuen Datensatz durch. | |||||
| * @param fall zu verarbeitender Datensatz. | |||||
| * @param mitarbid {@link Mitarbeiter#mitarbID} des aktuellen Benutzers/Mitarbeiters. | |||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | |||||
| */ | |||||
| public static void setFall(Fall fall, int mitarbid) throws SQLException { | |||||
| setFall(fall, mitarbid, false); | |||||
| } | |||||
| private static Diagnose getDiagnose(int diagid, Fall fall) throws SQLException { | |||||
| Diagnose diagnose = getDiagnose(diagid); | |||||
| diagnose.setFall(fall); | diagnose.setFall(fall); | ||||
| return diagnose; | return diagnose; | ||||
| @@ -134,11 +413,20 @@ public class DBHandler { | |||||
| private static Diagnose getDiagnose(int id) throws SQLException { | private static Diagnose getDiagnose(int id) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_DIAGNOSE_BY_ID); | PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_DIAGNOSE_BY_ID); | ||||
| statement.setInt(1, id); | |||||
| ResultSet rs = statement.executeQuery(); | ResultSet rs = statement.executeQuery(); | ||||
| rs.next(); // TODO | |||||
| return getDiagnose(rs); | return getDiagnose(rs); | ||||
| } | } | ||||
| /** | |||||
| * Extrahiert ein Objekt {@link Diagnose} aus einem gegebenen {@link ResultSet}. | |||||
| * | |||||
| * @param rs ResultSet from Database Query. | |||||
| * @return {@link Diagnose} | |||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | |||||
| */ | |||||
| private static Diagnose getDiagnose(ResultSet rs) throws SQLException { | private static Diagnose getDiagnose(ResultSet rs) throws SQLException { | ||||
| Diagnose diagnose = new Diagnose(); | Diagnose diagnose = new Diagnose(); | ||||
| @@ -152,11 +440,13 @@ public class DBHandler { | |||||
| private static void setVersionInformation(Version version, ResultSet rs) throws SQLException { | private static void setVersionInformation(Version version, ResultSet rs) throws SQLException { | ||||
| version.setErsteller(rs.getInt("ersteller")); | version.setErsteller(rs.getInt("ersteller")); | ||||
| if (rs.getTimestamp("erstelldatum") != null) | |||||
| if (rs.getTimestamp("erstelldatum") != null) { | |||||
| version.setErstellDatumZeit(rs.getTimestamp("erstelldatum").toLocalDateTime()); | version.setErstellDatumZeit(rs.getTimestamp("erstelldatum").toLocalDateTime()); | ||||
| } | |||||
| version.setBearbeiter(rs.getInt("letzterbearbeiter")); | version.setBearbeiter(rs.getInt("letzterbearbeiter")); | ||||
| if (rs.getTimestamp("letztesbearbeitungsdatum") != null) | |||||
| if (rs.getTimestamp("letztesbearbeitungsdatum") != null) { | |||||
| version.setBearbeitetDatumZeit(rs.getTimestamp("letztesbearbeitungsdatum").toLocalDateTime()); | version.setBearbeitetDatumZeit(rs.getTimestamp("letztesbearbeitungsdatum").toLocalDateTime()); | ||||
| } | |||||
| } | } | ||||
| public static List<Icd10Code> getAllIcd10Codes() throws SQLException { | public static List<Icd10Code> getAllIcd10Codes() throws SQLException { | ||||
| @@ -178,9 +468,17 @@ public class DBHandler { | |||||
| statement.setInt(2, version); | statement.setInt(2, version); | ||||
| rs = statement.executeQuery(); | rs = statement.executeQuery(); | ||||
| rs.next(); // TODO | |||||
| return getIcd10Code(rs); | return getIcd10Code(rs); | ||||
| } | } | ||||
| /** | |||||
| * Extrahiert ein Objekt {@link Icd10Code} aus einem gegebenen {@link ResultSet}. | |||||
| * | |||||
| * @param rs ResultSet from Database Query. | |||||
| * @return {@link Icd10Code} | |||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | |||||
| */ | |||||
| private static Icd10Code getIcd10Code(ResultSet rs) throws SQLException { | private static Icd10Code getIcd10Code(ResultSet rs) throws SQLException { | ||||
| String code = rs.getString("icd10code"); | String code = rs.getString("icd10code"); | ||||
| String text = rs.getString("text"); | String text = rs.getString("text"); | ||||
| @@ -201,16 +499,24 @@ public class DBHandler { | |||||
| return opscodes; | return opscodes; | ||||
| } | } | ||||
| public static OpsCode getOpsCode(String code, int version) throws SQLException { | |||||
| private static OpsCode getOpsCode(String code, int version) throws SQLException { | |||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_OPSCODE_BY_ID); | PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_OPSCODE_BY_ID); | ||||
| ResultSet rs; | ResultSet rs; | ||||
| statement.setString(1, code); | statement.setString(1, code); | ||||
| statement.setInt(2, version); | statement.setInt(2, version); | ||||
| rs = statement.executeQuery(); | rs = statement.executeQuery(); | ||||
| rs.next(); // TODO | |||||
| return getOpsCode(rs); | return getOpsCode(rs); | ||||
| } | } | ||||
| /** | |||||
| * Extrahiert ein Objekt {@link OpsCode} aus einem gegebenen {@link ResultSet}. | |||||
| * | |||||
| * @param rs ResultSet from Database Query. | |||||
| * @return {@link OpsCode} | |||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | |||||
| */ | |||||
| private static OpsCode getOpsCode(ResultSet rs) throws SQLException { | private static OpsCode getOpsCode(ResultSet rs) throws SQLException { | ||||
| String code = rs.getString("opscode"); | String code = rs.getString("opscode"); | ||||
| String text = rs.getString("text"); | String text = rs.getString("text"); | ||||
| @@ -231,6 +537,23 @@ public class DBHandler { | |||||
| return mitarbeiters; | return mitarbeiters; | ||||
| } | } | ||||
| private static Mitarbeiter getMitarbeiter(int id) throws SQLException { | |||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_MITARBEITER_BY_ID); | |||||
| ResultSet rs; | |||||
| statement.setInt(1, id); | |||||
| rs = statement.executeQuery(); | |||||
| rs.next(); // TODO | |||||
| return getMitarbeiter(rs); | |||||
| } | |||||
| /** | |||||
| * Extrahiert ein Objekt {@link Mitarbeiter} aus einem gegebenen {@link ResultSet}. | |||||
| * | |||||
| * @param rs ResultSet from Database Query. | |||||
| * @return {@link Mitarbeiter} | |||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | |||||
| */ | |||||
| private static Mitarbeiter getMitarbeiter(ResultSet rs) throws SQLException { | private static Mitarbeiter getMitarbeiter(ResultSet rs) throws SQLException { | ||||
| Mitarbeiter mitarbeiter = new Mitarbeiter(rs.getInt("mitarbid")); | Mitarbeiter mitarbeiter = new Mitarbeiter(rs.getInt("mitarbid")); | ||||
| mitarbeiter.setTitel(rs.getString("titel")); | mitarbeiter.setTitel(rs.getString("titel")); | ||||
| @@ -239,4 +562,117 @@ public class DBHandler { | |||||
| mitarbeiter.setEinweisenderArzt(rs.getString("einweisenderarzt")); | mitarbeiter.setEinweisenderArzt(rs.getString("einweisenderarzt")); | ||||
| return mitarbeiter; | return mitarbeiter; | ||||
| } | } | ||||
| /** | |||||
| * Gibt gibt alle {@link Untersuchung} zu einem {@link Fall} aus. | |||||
| * | |||||
| * @param fall Parent {@link Fall} | |||||
| * @return Liste aller {@link Untersuchung} zu einem {@link Fall}. | |||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | |||||
| */ | |||||
| public static List<Untersuchung> getUntersuchungByFall(Fall fall) throws SQLException { | |||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_UNTERS_BY_FALLID); | |||||
| statement.setInt(1, fall.getFallID()); | |||||
| ResultSet rs = statement.executeQuery(); | |||||
| List<Untersuchung> untersuchungen = new ArrayList<>(); | |||||
| while (rs.next()) { | |||||
| untersuchungen.add(getUntersuchung(rs, fall)); | |||||
| } | |||||
| return untersuchungen; | |||||
| } | |||||
| private static Untersuchung getUntersuchung(ResultSet rs, Fall fall) throws SQLException { | |||||
| Untersuchung untersuchung = new Untersuchung(); | |||||
| untersuchung.setUntersID(rs.getInt("untersid")); | |||||
| untersuchung.setFall(fall); | |||||
| untersuchung.setDurchfuehrenderArzt(getMitarbeiter(rs.getInt("durchfuehrenderarzt"))); | |||||
| untersuchung.setUntersuchungsdatum(rs.getTimestamp("untersuchungsdatum").toLocalDateTime()); | |||||
| untersuchung.setOpscode(getOpsCode(rs.getString("opscode"), rs.getInt("opsversion"))); | |||||
| setVersionInformation(untersuchung, rs); | |||||
| return untersuchung; | |||||
| } | |||||
| /** | |||||
| * Fuehrt {@code INSERT} bei einem neuen Datensatz und {@code UPDATE} bei einem existierenden Datensatz aus. | |||||
| * | |||||
| * @param untersuchung zu verarbeitender Datensatz. | |||||
| * @param mitarbid {@link Mitarbeiter#mitarbID} des aktuellen Benutzers/Mitarbeiters. | |||||
| * @param isUpdate {@code true} wenn der Datensatz bereits existiert, sonst {@code false}. | |||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | |||||
| */ | |||||
| public static void setUntersuchung(Untersuchung untersuchung, int mitarbid, boolean isUpdate) throws SQLException { | |||||
| PreparedStatement statement; | |||||
| if (isUpdate) { | |||||
| statement = MySqlConnFactory.getConnection().prepareStatement(UPDATE_UNTERSUCHUNG); | |||||
| } else { | |||||
| statement = MySqlConnFactory.getConnection().prepareStatement(INSERT_UNTERSUCHUNG); | |||||
| } | |||||
| statement.setInt(1, untersuchung.getDurchfuehrenderArzt().getMitarbID()); // DurchfuehrenderArzt | |||||
| statement.setInt(2, untersuchung.getFall().getFallID()); // FallID | |||||
| statement.setString(3, untersuchung.getOpscode().getOpsCode()); // OPSCode | |||||
| statement.setInt(4, untersuchung.getOpscode().getVersion()); // OPSVersion | |||||
| statement.setBoolean(5, untersuchung.getStorniert()); // storniert | |||||
| statement.setTimestamp(6, Timestamp.valueOf(untersuchung.getUntersuchungsdatum())); // Untersuchungsdatum | |||||
| statement.setInt(7, mitarbid); // Letzter Bearbeiter | |||||
| if (!isUpdate) { | |||||
| statement.setInt(8, mitarbid); // Ersteller | |||||
| } | |||||
| statement.execute(); | |||||
| } | |||||
| public static List<Diagnose> getDiagnosenByFall(Fall fall) throws SQLException { | |||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_DIAGNOSE_BY_FALLID); | |||||
| statement.setInt(1, fall.getFallID()); | |||||
| ResultSet rs = statement.executeQuery(); | |||||
| List<Diagnose> diagnosen = new ArrayList<>(); | |||||
| while (rs.next()) { | |||||
| diagnosen.add(getDiagnose(rs.getInt("diagid"), fall)); | |||||
| } | |||||
| return diagnosen; | |||||
| } | |||||
| public static List<Kasse> getAllKassen() throws SQLException { | |||||
| Statement statement = MySqlConnFactory.getConnection().createStatement(); | |||||
| ResultSet rs = statement.executeQuery(SELECT_ALL_KASSEN); | |||||
| List<Kasse> kassen = new ArrayList<>(); | |||||
| while (rs.next()) { | |||||
| kassen.add(getKasse(rs)); | |||||
| } | |||||
| return kassen; | |||||
| } | |||||
| private static Kasse getKasse(int kassenid) throws SQLException { | |||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_KASSE_BY_KASSENID); | |||||
| statement.setInt(1, kassenid); | |||||
| ResultSet rs = statement.executeQuery(); | |||||
| rs.next(); // TODO | |||||
| return getKasse(rs); | |||||
| } | |||||
| /** | |||||
| * Extrahiert ein Objekt {@link Kasse} aus einem gegebenen {@link ResultSet}. | |||||
| * | |||||
| * @param rs ResultSet from Database Query. | |||||
| * @return {@link Kasse} | |||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | |||||
| */ | |||||
| private static Kasse getKasse(ResultSet rs) throws SQLException { | |||||
| Kasse kasse = new Kasse(); | |||||
| kasse.setKassenID(rs.getInt("kassenid")); | |||||
| kasse.setName(rs.getString("name")); | |||||
| kasse.setAdresse(rs.getString("adresse")); | |||||
| kasse.setPrivat(rs.getBoolean("privat")); | |||||
| setVersionInformation(kasse, rs); | |||||
| return kasse; | |||||
| } | |||||
| } | } | ||||
| @@ -5,14 +5,14 @@ import java.sql.DriverManager; | |||||
| import java.sql.SQLException; | import java.sql.SQLException; | ||||
| /** | /** | ||||
| * Created by nils on 15.11.2015. | |||||
| * MySQL Connection Factory. | |||||
| */ | */ | ||||
| public class MySqlConnFactory { | public class MySqlConnFactory { | ||||
| private static MySqlConnFactory instance = new MySqlConnFactory(); | |||||
| public static final String URL = "jdbc:mysql://127.0.0.1:3306/pmiw15g06_v01"; | |||||
| public static final String URL = "jdbc:mysql://141.83.20.84:3306/pmiw15g06_v01"; | |||||
| public static final String USER = "pmiw15g06"; | public static final String USER = "pmiw15g06"; | ||||
| public static final String PASS = "AX3yQSYJSH43PrSz"; | public static final String PASS = "AX3yQSYJSH43PrSz"; | ||||
| public static final String DRIVER = "com.mysql.jdbc.Driver"; | public static final String DRIVER = "com.mysql.jdbc.Driver"; | ||||
| private static MySqlConnFactory instance = new MySqlConnFactory(); | |||||
| private MySqlConnFactory() { | private MySqlConnFactory() { | ||||
| try { | try { | ||||
| @@ -22,6 +22,10 @@ public class MySqlConnFactory { | |||||
| } | } | ||||
| } | } | ||||
| protected static Connection getConnection() { | |||||
| return instance.createConnection(); | |||||
| } | |||||
| private Connection createConnection() { | private Connection createConnection() { | ||||
| Connection conn = null; | Connection conn = null; | ||||
| try { | try { | ||||
| @@ -31,8 +35,4 @@ public class MySqlConnFactory { | |||||
| } | } | ||||
| return conn; | return conn; | ||||
| } | } | ||||
| public static Connection getConnection() { | |||||
| return instance.createConnection(); | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,4 @@ | |||||
| /** | |||||
| * Klassen fuer DB Zugriff. | |||||
| */ | |||||
| package de.uniluebeck.mi.projmi6.db; | |||||
| @@ -8,11 +8,19 @@ import javafx.beans.property.SimpleStringProperty; | |||||
| public class Diagnose extends Version { | public class Diagnose extends Version { | ||||
| private Fall fall; | private Fall fall; | ||||
| //ICDCODE | //ICDCODE | ||||
| private int diagID; | |||||
| private Icd10Code icd10code; | private Icd10Code icd10code; | ||||
| private Mitarbeiter arzt; | private Mitarbeiter arzt; | ||||
| private SimpleStringProperty freiText = new SimpleStringProperty(this, "freiText"); | private SimpleStringProperty freiText = new SimpleStringProperty(this, "freiText"); | ||||
| private DiagArt diagArt; | private DiagArt diagArt; | ||||
| public int getDiagID() { | |||||
| return diagID; | |||||
| } | |||||
| public void setDiagID(int diagID) { | |||||
| this.diagID = diagID; | |||||
| } | |||||
| public Fall getFall() { | public Fall getFall() { | ||||
| return fall; | return fall; | ||||
| @@ -34,6 +42,11 @@ public class Diagnose extends Version { | |||||
| return freiText.get(); | return freiText.get(); | ||||
| } | } | ||||
| @Override | |||||
| public String toString() { | |||||
| return icd10code+""; | |||||
| } | |||||
| public SimpleStringProperty freiTextProperty() { | public SimpleStringProperty freiTextProperty() { | ||||
| return freiText; | return freiText; | ||||
| } | } | ||||
| @@ -94,13 +94,17 @@ public class Fall extends Version { | |||||
| this.einweisenderArzt = einweisenderArzt; | this.einweisenderArzt = einweisenderArzt; | ||||
| } | } | ||||
| public Enum<FallArt> getFallArt() { | |||||
| public FallArt getFallArt() { | |||||
| return fallArt; | return fallArt; | ||||
| } | } | ||||
| @Override | @Override | ||||
| public String toString() { | public String toString() { | ||||
| return Integer.toString(getFallID()); | |||||
| if(getAufnahmeDatum()!=null){ | |||||
| return getAufnahmeDatum().toLocalDate().toString(); | |||||
| }else{ | |||||
| return Integer.toString(getFallID()); | |||||
| } | |||||
| } | } | ||||
| public void setFallArt(FallArt fallArt) { | public void setFallArt(FallArt fallArt) { | ||||
| @@ -27,6 +27,10 @@ public enum FallArt { | |||||
| } | } | ||||
| } | } | ||||
| public String id() { | |||||
| return id; | |||||
| } | |||||
| @Override | @Override | ||||
| public String toString() { | public String toString() { | ||||
| return fallArt; | return fallArt; | ||||
| @@ -6,7 +6,7 @@ import javafx.beans.property.SimpleStringProperty; | |||||
| /** | /** | ||||
| * Created by 627933 on 12.11.15. | * Created by 627933 on 12.11.15. | ||||
| */ | */ | ||||
| public class Kasse { | |||||
| public class Kasse extends Version { | |||||
| private SimpleStringProperty adresse = new SimpleStringProperty(this, "adresse"); | private SimpleStringProperty adresse = new SimpleStringProperty(this, "adresse"); | ||||
| private SimpleIntegerProperty kassenID = new SimpleIntegerProperty(this, "kassenID"); | private SimpleIntegerProperty kassenID = new SimpleIntegerProperty(this, "kassenID"); | ||||
| private SimpleStringProperty name = new SimpleStringProperty(this, "name"); | private SimpleStringProperty name = new SimpleStringProperty(this, "name"); | ||||
| @@ -238,6 +238,10 @@ public class Patient extends Version { | |||||
| public String toString() { | public String toString() { | ||||
| return geschlecht; | return geschlecht; | ||||
| } | } | ||||
| public char id() { | |||||
| return id; | |||||
| } | |||||
| } | } | ||||
| public enum Familienstand { | public enum Familienstand { | ||||
| @@ -270,6 +274,10 @@ public class Patient extends Version { | |||||
| } | } | ||||
| } | } | ||||
| public char id() { | |||||
| return id; | |||||
| } | |||||
| @Override | @Override | ||||
| public String toString() { | public String toString() { | ||||
| return familienstand; | return familienstand; | ||||
| @@ -0,0 +1,76 @@ | |||||
| package de.uniluebeck.mi.projmi6.model; | |||||
| import javafx.beans.property.SimpleObjectProperty; | |||||
| import javafx.collections.ObservableList; | |||||
| /** | |||||
| * Created by Johannes on 15/11/2015. | |||||
| */ | |||||
| public class Stammdaten { | |||||
| private SimpleObjectProperty<ObservableList<OpsCode>> opsCodes = new SimpleObjectProperty<>(); | |||||
| private SimpleObjectProperty<ObservableList<Icd10Code>> icd10Codes = new SimpleObjectProperty<>(); | |||||
| private SimpleObjectProperty<ObservableList<Mitarbeiter>> mitarbeiter = new SimpleObjectProperty<>(); | |||||
| private SimpleObjectProperty<ObservableList<Kasse>> kassen = new SimpleObjectProperty<>(); | |||||
| private SimpleObjectProperty<ObservableList<Station>> stationen = new SimpleObjectProperty<>(); | |||||
| public ObservableList<OpsCode> getOpsCodes() { | |||||
| return opsCodes.get(); | |||||
| } | |||||
| public SimpleObjectProperty<ObservableList<OpsCode>> opsCodesProperty() { | |||||
| return opsCodes; | |||||
| } | |||||
| public void setOpsCodes(ObservableList<OpsCode> opsCodes){ | |||||
| this.opsCodesProperty().set(opsCodes); | |||||
| } | |||||
| public ObservableList<Icd10Code> getIcd10Codes() { | |||||
| return icd10Codes.get(); | |||||
| } | |||||
| public SimpleObjectProperty<ObservableList<Icd10Code>> icd10CodesProperty() { | |||||
| return icd10Codes; | |||||
| } | |||||
| public void setIcd10Codes(ObservableList<Icd10Code> icd10Codes) { | |||||
| this.icd10Codes.set(icd10Codes); | |||||
| } | |||||
| public ObservableList<Station> getStationen() { | |||||
| return stationen.get(); | |||||
| } | |||||
| public SimpleObjectProperty<ObservableList<Station>> stationenProperty() { | |||||
| return stationen; | |||||
| } | |||||
| public void setStationen(ObservableList<Station> stationen) { | |||||
| this.stationen.set(stationen); | |||||
| } | |||||
| public ObservableList<Mitarbeiter> getMitarbeiter() { | |||||
| return mitarbeiter.get(); | |||||
| } | |||||
| public SimpleObjectProperty<ObservableList<Mitarbeiter>> mitarbeiterProperty() { | |||||
| return mitarbeiter; | |||||
| } | |||||
| public void setMitarbeiter(ObservableList<Mitarbeiter> mitarbeiter) { | |||||
| this.mitarbeiter.set(mitarbeiter); | |||||
| } | |||||
| public ObservableList<Kasse> getKassen() { | |||||
| return kassen.get(); | |||||
| } | |||||
| public SimpleObjectProperty<ObservableList<Kasse>> kassenProperty() { | |||||
| return kassen; | |||||
| } | |||||
| public void setKassen(ObservableList<Kasse> kassen) { | |||||
| this.kassen.set(kassen); | |||||
| } | |||||
| } | |||||
| @@ -62,6 +62,11 @@ public class Untersuchung extends Version { | |||||
| return untersuchungsdatum; | return untersuchungsdatum; | ||||
| } | } | ||||
| @Override | |||||
| public String toString() { | |||||
| return getUntersuchungsdatum()+": "+getOpscode().getText(); | |||||
| } | |||||
| public void setUntersuchungsdatum(LocalDateTime untersuchungsdatum) { | public void setUntersuchungsdatum(LocalDateTime untersuchungsdatum) { | ||||
| this.untersuchungsdatum.set(untersuchungsdatum); | this.untersuchungsdatum.set(untersuchungsdatum); | ||||
| } | } | ||||
| @@ -0,0 +1,4 @@ | |||||
| /** | |||||
| * Model Klassen. | |||||
| */ | |||||
| package de.uniluebeck.mi.projmi6.model; | |||||
| @@ -0,0 +1,4 @@ | |||||
| /** | |||||
| * Projekt MI - Gruppe 6 - KIS | |||||
| */ | |||||
| package de.uniluebeck.mi.projmi6; | |||||
| @@ -94,9 +94,12 @@ public class DateTimePicker extends HBox { | |||||
| btnNow.setOnAction(event -> setToCurrentDateTime()); | btnNow.setOnAction(event -> setToCurrentDateTime()); | ||||
| //Make it large enough to read the text | //Make it large enough to read the text | ||||
| btnNow.setMinWidth(50); | btnNow.setMinWidth(50); | ||||
| btnNow.getStyleClass().add("now-button"); | |||||
| //Add the subcomponents to the view. | //Add the subcomponents to the view. | ||||
| this.getChildren().addAll(datePicker,timePicker,btnNow); | this.getChildren().addAll(datePicker,timePicker,btnNow); | ||||
| this.setSpacing(5); | this.setSpacing(5); | ||||
| } | } | ||||
| @@ -108,9 +111,15 @@ public class DateTimePicker extends HBox { | |||||
| * @param localDateTime The date to be set in the view. | * @param localDateTime The date to be set in the view. | ||||
| */ | */ | ||||
| public void setDateTime(LocalDateTime localDateTime){ | public void setDateTime(LocalDateTime localDateTime){ | ||||
| hourText.setText(Integer.toString(localDateTime.getHour())); | |||||
| minuteText.setText(Integer.toString(localDateTime.getMinute())); | |||||
| datePicker.setValue(LocalDate.from(localDateTime)); | |||||
| if(localDateTime==null){ | |||||
| hourText.setText(""); | |||||
| minuteText.setText(""); | |||||
| datePicker.setValue(null); | |||||
| }else{ | |||||
| hourText.setText(Integer.toString(localDateTime.getHour())); | |||||
| minuteText.setText(Integer.toString(localDateTime.getMinute())); | |||||
| datePicker.setValue(LocalDate.from(localDateTime)); | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -0,0 +1,4 @@ | |||||
| /** | |||||
| * View Klassen. | |||||
| */ | |||||
| package de.uniluebeck.mi.projmi6.view; | |||||
| @@ -17,7 +17,7 @@ | |||||
| <Button fx:id="btnDiagCreate" mnemonicParsing="false" onAction="#clickedDiagCreate" text="Neue Diagnose erstellen" /> | <Button fx:id="btnDiagCreate" mnemonicParsing="false" onAction="#clickedDiagCreate" text="Neue Diagnose erstellen" /> | ||||
| </items> | </items> | ||||
| </ToolBar> | </ToolBar> | ||||
| <ListView prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" /> | |||||
| <ListView prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" fx:id="diagnoseList"/> | |||||
| </children> | </children> | ||||
| </VBox> | </VBox> | ||||
| <VBox> | <VBox> | ||||
| @@ -10,7 +10,7 @@ | |||||
| <?import de.uniluebeck.mi.projmi6.view.DateTimePicker?> | <?import de.uniluebeck.mi.projmi6.view.DateTimePicker?> | ||||
| <VBox fx:controller="de.uniluebeck.mi.projmi6.controller.FallController" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> | <VBox fx:controller="de.uniluebeck.mi.projmi6.controller.FallController" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> | ||||
| <children> | <children> | ||||
| <GridPane vgap="5.0" fx:id="fallFields"> | |||||
| <GridPane vgap="5.0" fx:id="fallFields" id="fallFields"> | |||||
| <children> | <children> | ||||
| <Label text="Patient:"/> | <Label text="Patient:"/> | ||||
| <Label fx:id="fallPatID" text="John Doe (PatID = XXX)" GridPane.columnIndex="1"/> | <Label fx:id="fallPatID" text="John Doe (PatID = XXX)" GridPane.columnIndex="1"/> | ||||
| @@ -27,7 +27,9 @@ | |||||
| <Button fx:id="btnFallCreate" text="Neuen _Fall erstellen" onAction="#clickedCreateFall"/> | <Button fx:id="btnFallCreate" text="Neuen _Fall erstellen" onAction="#clickedCreateFall"/> | ||||
| </items> | </items> | ||||
| </ToolBar> | </ToolBar> | ||||
| <ListView VBox.vgrow="ALWAYS" fx:id="lvFall" /> | |||||
| <ListView VBox.vgrow="ALWAYS" fx:id="lvFall" > | |||||
| <placeholder><Label fx:id="lvFallPlaceholder" /></placeholder> | |||||
| </ListView> | |||||
| </children> | </children> | ||||
| </VBox> | </VBox> | ||||
| <TabPane fx:id="tabPaneFall" prefHeight="200.0" prefWidth="200.0" tabClosingPolicy="UNAVAILABLE"> | <TabPane fx:id="tabPaneFall" prefHeight="200.0" prefWidth="200.0" tabClosingPolicy="UNAVAILABLE"> | ||||
| @@ -1,23 +1,22 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
| <?import java.net.*?> | |||||
| <?import javafx.geometry.*?> | <?import javafx.geometry.*?> | ||||
| <?import javafx.scene.text.*?> | <?import javafx.scene.text.*?> | ||||
| <?import javafx.scene.control.*?> | <?import javafx.scene.control.*?> | ||||
| <?import java.lang.*?> | <?import java.lang.*?> | ||||
| <?import javafx.scene.layout.*?> | <?import javafx.scene.layout.*?> | ||||
| <?import java.net.URL?> | <?import java.net.URL?> | ||||
| <VBox fx:controller="de.uniluebeck.mi.projmi6.controller.PatientEditorController" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="633.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> | |||||
| <VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="633.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.uniluebeck.mi.projmi6.controller.PatientEditorController"> | |||||
| <children> | <children> | ||||
| <GridPane> | <GridPane> | ||||
| <columnConstraints> | <columnConstraints> | ||||
| <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> | |||||
| <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="35.0" prefWidth="100.0" /> | |||||
| <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> | <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> | ||||
| </columnConstraints> | </columnConstraints> | ||||
| <rowConstraints> | <rowConstraints> | ||||
| <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | ||||
| <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> | |||||
| <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | |||||
| <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | ||||
| <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | ||||
| <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | ||||
| @@ -29,49 +28,60 @@ | |||||
| <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | ||||
| <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | ||||
| <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | ||||
| <RowConstraints maxHeight="1.7976931348623157E308" minHeight="10.0" vgrow="SOMETIMES" /> | |||||
| </rowConstraints> | </rowConstraints> | ||||
| <children> | <children> | ||||
| <Label text="PatID:" /> | <Label text="PatID:" /> | ||||
| <Label fx:id="patId" text="xxxx" GridPane.columnIndex="1" /> | <Label fx:id="patId" text="xxxx" GridPane.columnIndex="1" /> | ||||
| <Label text="Vorname:" GridPane.rowIndex="1" /> | <Label text="Vorname:" GridPane.rowIndex="1" /> | ||||
| <TextField fx:id="patVorname" GridPane.columnIndex="1" GridPane.rowIndex="1" /> | |||||
| <TextField fx:id="patVorname" promptText="Vorname" GridPane.columnIndex="1" GridPane.rowIndex="1" /> | |||||
| <Label text="Geburtsname:" GridPane.rowIndex="2" /> | <Label text="Geburtsname:" GridPane.rowIndex="2" /> | ||||
| <TextField fx:id="patGeburtsname" GridPane.columnIndex="1" GridPane.rowIndex="2" /> | |||||
| <TextField fx:id="patGeburtsname" promptText="Geburtsname" GridPane.columnIndex="1" GridPane.rowIndex="2" /> | |||||
| <Label text="Nachname:" GridPane.rowIndex="3" /> | <Label text="Nachname:" GridPane.rowIndex="3" /> | ||||
| <TextField fx:id="patNachname" GridPane.columnIndex="1" GridPane.rowIndex="3" /> | |||||
| <TextField fx:id="patNachname" promptText="Nachname" GridPane.columnIndex="1" GridPane.rowIndex="3" /> | |||||
| <Label text="Straße:" GridPane.rowIndex="4" /> | |||||
| <TextField fx:id="patStrasse" GridPane.columnIndex="1" GridPane.rowIndex="4" /> | |||||
| <Label text="Straße / Hausnummer:" GridPane.rowIndex="4" /> | |||||
| <HBox alignment="CENTER_RIGHT" spacing="5.0" GridPane.columnIndex="1" GridPane.rowIndex="4"> | |||||
| <children> | |||||
| <TextField fx:id="patStrasse" promptText="Straße" GridPane.columnIndex="1" GridPane.rowIndex="4" HBox.hgrow="ALWAYS" /> | |||||
| <TextField fx:id="patHausnummer" promptText="Hausnummer" HBox.hgrow="SOMETIMES" /> | |||||
| </children> | |||||
| </HBox> | |||||
| <Label text="Hausnummer:" GridPane.rowIndex="5" /> | |||||
| <TextField fx:id="patHausnummer" GridPane.columnIndex="1" GridPane.rowIndex="5" /> | |||||
| <Label text="PLZ / Ort:" GridPane.rowIndex="5" /> | |||||
| <HBox alignment="CENTER_RIGHT" spacing="5.0" GridPane.columnIndex="1" GridPane.rowIndex="5"> | |||||
| <children> | |||||
| <TextField fx:id="patPlz" promptText="PLZ" GridPane.columnIndex="1" GridPane.rowIndex="6" HBox.hgrow="SOMETIMES" /> | |||||
| <TextField fx:id="patOrt" promptText="Ort" HBox.hgrow="ALWAYS" /> | |||||
| </children> | |||||
| </HBox> | |||||
| <Label text="PLZ:" GridPane.rowIndex="6" /> | |||||
| <TextField fx:id="patPlz" GridPane.columnIndex="1" GridPane.rowIndex="6" /> | |||||
| <Label text="Telefonnummer:" GridPane.rowIndex="6" /> | |||||
| <TextField fx:id="patTelefonnummer" promptText="Telefonnummer" GridPane.columnIndex="1" GridPane.rowIndex="6" /> | |||||
| <Label text="Ort:" GridPane.rowIndex="7" /> | |||||
| <TextField fx:id="patOrt" GridPane.columnIndex="1" GridPane.rowIndex="7" /> | |||||
| <Label text="Geburtsdatum:" GridPane.rowIndex="8" /> | |||||
| <DatePicker fx:id="patGeburtsdatum" GridPane.columnIndex="1" GridPane.rowIndex="8" /> | |||||
| <Label text="Geburtsdatum:" GridPane.rowIndex="7" /> | |||||
| <DatePicker fx:id="patGeburtsdatum" promptText="Geburtsdatum" GridPane.columnIndex="1" GridPane.rowIndex="7" /> | |||||
| <Label text="Familienstand:" GridPane.rowIndex="9" /> | |||||
| <ComboBox fx:id="patFamilienstand" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="9" /> | |||||
| <Label text="Familienstand:" GridPane.rowIndex="8" /> | |||||
| <ComboBox fx:id="patFamilienstand" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="8" /> | |||||
| <Label text="Geschlecht:" GridPane.rowIndex="10" /> | |||||
| <ComboBox fx:id="patGeschlecht" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="10" /> | |||||
| <Label text="Geschlecht:" GridPane.rowIndex="9" /> | |||||
| <ComboBox fx:id="patGeschlecht" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="9" /> | |||||
| <Label text="Versicherungsnummer:" GridPane.rowIndex="11" /> | |||||
| <TextField fx:id="patVersicherungsnummer" GridPane.columnIndex="1" GridPane.rowIndex="11" /> | |||||
| <Label text="Versicherungsnummer:" GridPane.rowIndex="10" /> | |||||
| <TextField fx:id="patVersicherungsnummer" promptText="Versicherungsnummer" GridPane.columnIndex="1" GridPane.rowIndex="10" /> | |||||
| <Label text="Versicherung:" GridPane.rowIndex="12" /> | |||||
| <ComboBox fx:id="patVersicherung" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="12" /> | |||||
| <Label text="Versicherung:" GridPane.rowIndex="11" /> | |||||
| <ComboBox fx:id="patVersicherung" prefWidth="225.0" GridPane.columnIndex="1" GridPane.rowIndex="11" /> | |||||
| <Label text="CAVE:" GridPane.rowIndex="13" /> | |||||
| <TextArea fx:id="patCave" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="13" /> | |||||
| <Label text="CAVE:" GridPane.rowIndex="12" /> | |||||
| <TextArea fx:id="patCave" maxHeight="100.0" prefHeight="56.0" prefWidth="383.0" promptText="CAVE" GridPane.columnIndex="1" GridPane.rowIndex="12"> | |||||
| <GridPane.margin> | |||||
| <Insets top="5.0" /> | |||||
| </GridPane.margin></TextArea> | |||||
| </children> | </children> | ||||
| <VBox.margin> | <VBox.margin> | ||||
| @@ -105,8 +115,8 @@ | |||||
| <children> | <children> | ||||
| <Label styleClass="ersteller-label" text="Ersteller: " GridPane.rowIndex="0" /> | <Label styleClass="ersteller-label" text="Ersteller: " GridPane.rowIndex="0" /> | ||||
| <Label styleClass="ersteller-label" text="Erstelldatum:" GridPane.rowIndex="1" /> | <Label styleClass="ersteller-label" text="Erstelldatum:" GridPane.rowIndex="1" /> | ||||
| <Label styleClass="ersteller-value" fx:id="patCreator" GridPane.columnIndex="1" GridPane.rowIndex="0" /> | |||||
| <Label styleClass="ersteller-value" fx:id="patCreateTime" GridPane.columnIndex="1" GridPane.rowIndex="1" /> | |||||
| <Label fx:id="patCreator" styleClass="ersteller-value" GridPane.columnIndex="1" GridPane.rowIndex="0" /> | |||||
| <Label fx:id="patCreateTime" styleClass="ersteller-value" GridPane.columnIndex="1" GridPane.rowIndex="1" /> | |||||
| </children> | </children> | ||||
| <columnConstraints> | <columnConstraints> | ||||
| <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="50.0" /> | <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="50.0" /> | ||||
| @@ -123,19 +133,19 @@ | |||||
| <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> | <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> | ||||
| </columnConstraints> | </columnConstraints> | ||||
| <rowConstraints> | <rowConstraints> | ||||
| <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | |||||
| <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | |||||
| <RowConstraints minHeight="10.0" vgrow="SOMETIMES" /> | |||||
| <RowConstraints minHeight="10.0" vgrow="SOMETIMES" /> | |||||
| </rowConstraints> | </rowConstraints> | ||||
| <children> | <children> | ||||
| <Label styleClass="ersteller-label" text="Letzter Bearbeiter:" GridPane.rowIndex="0" /> | <Label styleClass="ersteller-label" text="Letzter Bearbeiter:" GridPane.rowIndex="0" /> | ||||
| <Label styleClass="ersteller-label" text="Letzte Änderung:" GridPane.rowIndex="1" /> | <Label styleClass="ersteller-label" text="Letzte Änderung:" GridPane.rowIndex="1" /> | ||||
| <Label styleClass="ersteller-value" fx:id="patChanger" GridPane.columnIndex="1" GridPane.rowIndex="0" /> | |||||
| <Label styleClass="ersteller-value" fx:id="patChangeTime" GridPane.columnIndex="1" GridPane.rowIndex="1" /> | |||||
| <Label fx:id="patChanger" styleClass="ersteller-value" GridPane.columnIndex="1" GridPane.rowIndex="0" /> | |||||
| <Label fx:id="patChangeTime" styleClass="ersteller-value" GridPane.columnIndex="1" GridPane.rowIndex="1" /> | |||||
| </children> | </children> | ||||
| </GridPane> | </GridPane> | ||||
| </children> | </children> | ||||
| <VBox.margin> | <VBox.margin> | ||||
| <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> | |||||
| <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> | |||||
| </VBox.margin> | </VBox.margin> | ||||
| </GridPane> | </GridPane> | ||||
| </children> | </children> | ||||
| @@ -17,6 +17,8 @@ | |||||
| <items> | <items> | ||||
| <Button fx:id="btnPatCreate" text="Neuen _Patient erstellen" onAction="#clickedCreatePatient" /> | <Button fx:id="btnPatCreate" text="Neuen _Patient erstellen" onAction="#clickedCreatePatient" /> | ||||
| <Button fx:id="btnPatEdit" text="Patient _bearbeiten" onAction="#clickedEditPatient"/> | <Button fx:id="btnPatEdit" text="Patient _bearbeiten" onAction="#clickedEditPatient"/> | ||||
| <Pane HBox.hgrow="ALWAYS" /> | |||||
| <Button fx:id="btnPatRefresh" text="Liste aktualisieren" onAction="#clickedRefreshPatient"/> | |||||
| </items> | </items> | ||||
| </ToolBar> | </ToolBar> | ||||
| <TableView fx:id="tblPatientOverview" editable="true" tableMenuButtonVisible="true" VBox.vgrow="ALWAYS"> | <TableView fx:id="tblPatientOverview" editable="true" tableMenuButtonVisible="true" VBox.vgrow="ALWAYS"> | ||||
| @@ -4,4 +4,44 @@ | |||||
| .ersteller-value { | .ersteller-value { | ||||
| /* -fx-text-fill: red; */ | /* -fx-text-fill: red; */ | ||||
| } | |||||
| } | |||||
| DateTimePicker .text-field{ | |||||
| -fx-background-color:transparent; | |||||
| } | |||||
| #fallFields:disabled{ | |||||
| -fx-opacity: 1; | |||||
| } | |||||
| #fallFields:disabled HBox { | |||||
| -fx-opacity: 1; | |||||
| } | |||||
| #fallFields:disabled .text-field{ | |||||
| -fx-text-fill: black; | |||||
| -fx-background-color: transparent; | |||||
| -fx-opacity: 1; | |||||
| } | |||||
| #fallFields:disabled Label{ | |||||
| -fx-opacity: 1; | |||||
| } | |||||
| #fallFields:disabled ComboBox{ | |||||
| -fx-opacity: 1; | |||||
| -fx-background-color: transparent; | |||||
| } | |||||
| #fallFields:disabled .arrow-button{ | |||||
| -fx-opacity: 0; | |||||
| } | |||||
| #fallFields:disabled .arrow{ | |||||
| -fx-opacity: 0; | |||||
| } | |||||
| #fallFields:disabled .date-picker { | |||||
| -fx-opacity: 1; | |||||
| -fx-background-color: transparent; | |||||
| } | |||||
| #fallFields:disabled .now-button { | |||||
| visibility: hidden; | |||||
| } | |||||