diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java index 4f0168a..46566c8 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java @@ -14,33 +14,48 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; -import javafx.scene.control.*; +import javafx.scene.control.Button; +import javafx.scene.control.CheckBox; +import javafx.scene.control.ComboBox; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import java.sql.SQLException; public class FallController { - SimpleObjectProperty state = new SimpleObjectProperty<>(State.VIEW); - @FXML - Button btnFallSendHl7; private MainController mainController; + + public FallController (MainController mainController){ + this.mainController = mainController; + } + @FXML private DateTimePicker dtTmAufnahme, dtTmEntlassung; + @FXML private Label fallPatID; + @FXML private ComboBox fallFallart; + @FXML private ComboBox fallKasse; + @FXML private TextField fallVersichertennummer; + @FXML private TextField fallEinweisenderArzt; @FXML private CheckBox fallSelbsteinweisung; + + @FXML private ComboBox fallHauptdiagnose; + + @FXML private Label fallCreator; @FXML @@ -51,30 +66,34 @@ public class FallController { private Label fallEditTime; @FXML private Button btnFallSave; + @FXML private Button btnFallAbort; @FXML private Button btnFallCancel; @FXML private Button btnFallEnableEdit; + @FXML private GridPane fallFields; - private SimpleObjectProperty fallProperty = new SimpleObjectProperty<>(); - public FallController(MainController mainController) { - this.mainController = mainController; - } + + private SimpleObjectProperty fallProperty = new SimpleObjectProperty<>(); public Fall getFall() { return fallProperty.get(); } + public SimpleObjectProperty fallPropertyProperty() { + return fallProperty; + } + public void setFall(Fall fall) { this.fallProperty.set(fall); } - public SimpleObjectProperty fallPropertyProperty() { - return fallProperty; + public enum State { + CREATE, EDIT, VIEW } public State getState() { @@ -85,6 +104,12 @@ public class FallController { return state; } + + + SimpleObjectProperty state = new SimpleObjectProperty<>(State.VIEW); + + + public ObjectProperty> diagnosenProperty(){ return fallHauptdiagnose.itemsProperty(); } @@ -115,6 +140,10 @@ public class FallController { } })); + fallHauptdiagnose.itemsProperty().addListener((observable1, oldValue1, newValue1) -> { + copyHauptdiagnoseToComboBox(fallProperty.get()); + }); + state.addListener((observable, oldValue, newValue) -> { if(newValue==State.EDIT || newValue == State.CREATE){ @@ -155,6 +184,9 @@ public class FallController { } @FXML + Button btnFallSendHl7; + + @FXML private void clickedSendHl7(){ /* Natascha */ //TODO send funny message @@ -166,6 +198,7 @@ public class FallController { this.state.set(State.EDIT); } + @FXML void clickedFallEnableEdit(ActionEvent event) { editFall(); @@ -173,11 +206,11 @@ public class FallController { @FXML void clickedFallCancel(ActionEvent event) { - if (fallProperty.get() != null) { + if(fallProperty.get()!=null){ fallProperty.get().setStorniert(true); try { DBHandler.setFall(fallProperty.get(), mainController.getCurrentMitarbeiter().getMitarbID(), true); - } catch (Exception e) { + }catch (Exception e){ e.printStackTrace(); } mainController.refreshCasesFromDb(mainController.getPatientTablesController().getSelectedPatient()); @@ -230,6 +263,9 @@ public class FallController { fallVersichertennummer.setText(patient.getVersichertennummer()); } + + + private void clearFields(){ if(state.get() == State.CREATE) { dtTmAufnahme.setToCurrentDateTime(); @@ -258,6 +294,7 @@ public class FallController { fallFallart.setValue(null); } + private void copyFieldDataIntoFall(Fall fall){ fall.setPatient(mainController.getPatientTablesController().getSelectedPatient()); fall.setAufnahmeDatum(dtTmAufnahme.getDateTime()); @@ -282,6 +319,7 @@ public class FallController { //fall.setVorstellDatum(); //TODO } + private void copyFallDataIntoField(Fall fall){ if(fall==null){ System.out.println("copyFallDataIntoFiled - Fall ist null"); @@ -305,24 +343,29 @@ public class FallController { fallVersichertennummer.setText(fall.getVersichertenNummer()); fallKasse.setValue(fall.getKasse()); - if (fallHauptdiagnose.getItems() != null) { - for (Diagnose diagnose : fallHauptdiagnose.getItems()) { - if (diagnose.getDiagID() == fall.getHauptdiagnoseId()) { - fallHauptdiagnose.setValue(diagnose); - return; - } - } - } - - - //fallHauptdiagnose.setValue(fall.getHauptDiagnose()); TODO - // fallHauptdiagnose.setItems(fall.getD); TODO + copyHauptdiagnoseToComboBox(fall); fallFallart.setValue(fall.getFallArt()); } - - public enum State { - CREATE, EDIT, VIEW + private void copyHauptdiagnoseToComboBox(Fall fall){ + if (fallHauptdiagnose.getItems() == null + || fall == null) { + fallHauptdiagnose.setValue(null); + return; + } + System.out.println("Suche Diagnose..."); + + for (Diagnose diagnose : fallHauptdiagnose.getItems()) { + System.out.println(diagnose.getDiagID()+"="+fall.getHauptdiagnoseId()); + if (diagnose.getDiagID() == fall.getHauptdiagnoseId()) { + fallHauptdiagnose.getSelectionModel().select(diagnose); + System.out.println("Diagnose wiedergefunden!!"); + return; + } + } } + + + } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java index 7952009..d4463da 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java @@ -2,6 +2,7 @@ package de.uniluebeck.mi.projmi6.controller; import de.uniluebeck.mi.projmi6.db.DBHandler; import de.uniluebeck.mi.projmi6.model.*; +import de.uniluebeck.mi.projmi6.view.MessageIcon; import javafx.beans.binding.Bindings; import javafx.beans.property.ReadOnlyObjectProperty; import javafx.beans.property.SimpleObjectProperty; @@ -30,6 +31,8 @@ public class MainController { private StationsHistorieController stationsHistorieController; private UntersuchungenController untersuchungenController; private LogController logController; + private MessageController messageController; + private int parallelTaskCount = 0; @@ -73,8 +76,10 @@ public class MainController { return untersuchungenController; } else if (clazz.equals(StationsHistorieController.class)) { return stationsHistorieController; - } else if (clazz.equals(LogController.class)){ + } else if (clazz.equals(LogController.class)) { return logController; + }else if(clazz.equals(MessageController.class)){ + return messageController; } else { System.err.println("Keine Controller-Klasse des Typs " + clazz + " gefunden!!!"); return null; @@ -90,6 +95,7 @@ public class MainController { untersuchungenController = new UntersuchungenController(this); stationsHistorieController = new StationsHistorieController(this); logController = new LogController(this); + messageController = new MessageController(this); } @@ -122,6 +128,10 @@ public class MainController { return untersuchungenController; } + public MessageController getMessageController(){ + return messageController; + } + public void increaseParallelTaskCount() { parallelTaskCount++; if (parallelTaskCount > 0 && progressIndicator != null) { @@ -250,7 +260,6 @@ public class MainController { } - private Task loadCaseData = null; @@ -296,7 +305,6 @@ public class MainController { protected void succeeded() { super.succeeded(); if (isCancelled()) { - System.out.println("Task wurde gecancelt"); return; } ObservableList diagnoses = FXCollections.observableArrayList(diagnoseList); diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageController.java new file mode 100644 index 0000000..82c4c71 --- /dev/null +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageController.java @@ -0,0 +1,44 @@ +package de.uniluebeck.mi.projmi6.controller; + +import de.uniluebeck.mi.projmi6.model.Fall; +import de.uniluebeck.mi.projmi6.model.HL7Message; +import de.uniluebeck.mi.projmi6.model.Patient; +import de.uniluebeck.mi.projmi6.view.MessageIcon; +import javafx.collections.ObservableList; +import javafx.fxml.FXML; + +/** + * Created by Johannes on 21/11/2015. + */ +public class MessageController { + final MainController mainController; + + @FXML + private MessageIcon messageIcon; + + + + + public MessageController(MainController mainController){ + this.mainController = mainController; + } + + @FXML + private void initialize(){ + + + } + + @FXML + private void onMessageIconClicked(){ + + } + + + public void addMessage(HL7Message message){ + + } + +} + + diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java index 93cc4b0..c0cef19 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java @@ -120,6 +120,8 @@ public class PatientTablesController { }); return tableRow; }); + + tblPatientOverview.itemsProperty().bind(mainController.getStammdaten().patientenProperty()); lblTablePatientEmpty.setText("Liste ist leer."); tblStationOverview.disableProperty().bind(cmbStationenFilter.valueProperty().isNull()); @@ -229,7 +231,7 @@ public class PatientTablesController { btnPatRefresh.setDisable(true); - tblPatientOverview.setItems(null); + mainController.getStammdaten().setPatienten(null); mainController.increaseParallelTaskCount(); @@ -247,7 +249,7 @@ public class PatientTablesController { super.succeeded(); btnPatRefresh.setDisable(false); lblTablePatientEmpty.setText("Liste ist leer."); - tblPatientOverview.setItems(FXCollections.observableArrayList(this.getValue())); + mainController.getStammdaten().setPatienten(FXCollections.observableArrayList(this.getValue())); mainController.decreaseParallelTaskCount(); } @@ -257,7 +259,6 @@ public class PatientTablesController { btnPatRefresh.setDisable(false); lblTablePatientEmpty.setText("Laden fehlgeschlagen!"); mainController.decreaseParallelTaskCount(); - tblPatientOverview.setItems(null); if (getException() != null) { getException().printStackTrace(); } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/HL7Message.java b/src/main/java/de/uniluebeck/mi/projmi6/model/HL7Message.java new file mode 100644 index 0000000..d0985e7 --- /dev/null +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/HL7Message.java @@ -0,0 +1,65 @@ +package de.uniluebeck.mi.projmi6.model; + +import java.time.LocalDateTime; + +/** + * Created by Johannes on 21/11/2015. + */ +public class HL7Message { + private LocalDateTime dateTime; + private String messageContent; + + private boolean failed; + + private Patient patient; + private int fallId; + + public HL7Message(Patient patient, int fallId, LocalDateTime dateTime, String messageContent, boolean failed) { + this.patient = patient; + this.fallId = fallId; + this.dateTime = dateTime; + this.messageContent = messageContent; + this.failed = failed; + } + + public LocalDateTime getDateTime() { + + return dateTime; + } + + public void setDateTime(LocalDateTime dateTime) { + this.dateTime = dateTime; + } + + public String getMessageContent() { + return messageContent; + } + + public void setMessageContent(String messageContent) { + this.messageContent = messageContent; + } + + public boolean isFailed() { + return failed; + } + + public void setFailed(boolean failed) { + this.failed = failed; + } + + public Patient getPatient() { + return patient; + } + + public void setPatient(Patient patient) { + this.patient = patient; + } + + public int getFallId() { + return fallId; + } + + public void setFallId(int fallId) { + this.fallId = fallId; + } +} diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/Stammdaten.java b/src/main/java/de/uniluebeck/mi/projmi6/model/Stammdaten.java index 99502e8..ce38686 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/model/Stammdaten.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/Stammdaten.java @@ -14,6 +14,22 @@ public class Stammdaten { private SimpleObjectProperty> kassen = new SimpleObjectProperty<>(); private SimpleObjectProperty> stationen = new SimpleObjectProperty<>(); + public ObservableList getPatienten() { + return patienten.get(); + } + + public SimpleObjectProperty> patientenProperty() { + return patienten; + } + + public void setPatienten(ObservableList patienten) { + this.patienten.set(patienten); + } + + private SimpleObjectProperty> patienten = new SimpleObjectProperty<>(); + + + public ObservableList getOpsCodes() { return opsCodes.get(); } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/view/MessageIcon.java b/src/main/java/de/uniluebeck/mi/projmi6/view/MessageIcon.java new file mode 100644 index 0000000..9ae96a6 --- /dev/null +++ b/src/main/java/de/uniluebeck/mi/projmi6/view/MessageIcon.java @@ -0,0 +1,82 @@ +package de.uniluebeck.mi.projmi6.view; + +import javafx.animation.FadeTransition; +import javafx.animation.Timeline; +import javafx.animation.Transition; +import javafx.beans.binding.Bindings; +import javafx.beans.property.SimpleIntegerProperty; +import javafx.geometry.Pos; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.layout.StackPane; +import javafx.scene.paint.Color; +import javafx.util.Duration; + +/** + * Created by Johannes on 21/11/2015. + */ +public class MessageIcon extends Button { + + private ImageView imageView; + + private Label messageCountLabel; + + private final SimpleIntegerProperty messageCount = new SimpleIntegerProperty(this, "messageCount", 0); + + FadeTransition transition; + + public MessageIcon(){ + imageView = new ImageView(new Image("message.png")); + imageView.setFitHeight(30); + imageView.setFitWidth(30); + /* imageView.opacityProperty().bind(Bindings.createDoubleBinding( + ()->messageCount.get()>0? 1.0 : 0.5, messageCount));*/ + + + messageCountLabel = new Label(); + messageCountLabel.textProperty().bind(messageCount.asString()); + StackPane.setAlignment(messageCountLabel, Pos.BOTTOM_RIGHT); + messageCountLabel.setTextFill(Color.BLACK); + + this.disableProperty().bind(messageCount.lessThanOrEqualTo(0)); + + StackPane graphic = new StackPane(imageView, messageCountLabel); + this.setGraphic(graphic); + + initTransition(); + + } + + private void initTransition(){ + transition = new FadeTransition(Duration.millis(500), imageView); + transition.setFromValue(0.5); + transition.setToValue(1.0); + transition.setCycleCount(Timeline.INDEFINITE); + transition.setAutoReverse(true); + messageCount.addListener((observable, oldValue, newValue) -> { + if(messageCount.get()>0){ + transition.play(); + }else{ + transition.stop(); + + } + }); + } + + public int getMessageCount() { + return messageCount.get(); + } + + public SimpleIntegerProperty messageCountProperty() { + return messageCount; + } + + public void setMessageCount(int messageCount) { + this.messageCount.set(messageCount); + } + + + +} diff --git a/src/main/resources/main.fxml b/src/main/resources/main.fxml index 7feeee6..8cdcbb3 100644 --- a/src/main/resources/main.fxml +++ b/src/main/resources/main.fxml @@ -5,8 +5,10 @@ + + @@ -82,6 +84,7 @@ + diff --git a/src/main/resources/message.fxml b/src/main/resources/message.fxml new file mode 100644 index 0000000..8770a6f --- /dev/null +++ b/src/main/resources/message.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/message.png b/src/main/resources/message.png new file mode 100644 index 0000000..28fe88d Binary files /dev/null and b/src/main/resources/message.png differ