| @@ -1,7 +1,10 @@ | |||
| package de.uniluebeck.mi.projmi6; | |||
| import ca.uhn.hl7v2.model.v251.message.ADT_A01; | |||
| import ca.uhn.hl7v2.model.v251.message.BAR_P05; | |||
| import de.uniluebeck.mi.projmi6.controller.MainController; | |||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | |||
| import de.uniluebeck.mi.projmi6.hapi.HL7Receiver; | |||
| import de.uniluebeck.mi.projmi6.hapi.HL7Server; | |||
| import javafx.application.Application; | |||
| import javafx.beans.property.ReadOnlyStringProperty; | |||
| @@ -27,6 +30,10 @@ import javafx.stage.StageStyle; | |||
| public class Main extends Application { | |||
| public static String OPS_IP = "127.0.0.1"; | |||
| public static int OPS_PORT = 1112; | |||
| private HL7Server server; | |||
| /** | |||
| @@ -72,8 +79,10 @@ public class Main extends Application { | |||
| Parent root = fxmlLoader.load(); | |||
| // TODO: Jojo, das muss irgendwie am ende noch geschlossen werden! | |||
| server = new HL7Server(mainController); | |||
| server.registerApplication("ADT", "A01", new HL7Receiver<>(ADT_A01.class, mainController)); // ADT_A01 parsen | |||
| server.registerApplication("BAR", "P05", new HL7Receiver<>(BAR_P05.class, mainController)); // BAR_P05 parsen | |||
| server.start(); | |||
| return root; | |||
| } | |||
| @@ -4,7 +4,9 @@ package de.uniluebeck.mi.projmi6.controller; | |||
| * Created by 626947 on 12.11.15. | |||
| */ | |||
| import de.uniluebeck.mi.projmi6.Main; | |||
| import javafx.fxml.FXML; | |||
| import javafx.scene.control.Alert; | |||
| import javafx.scene.control.Button; | |||
| import javafx.scene.control.TextField; | |||
| @@ -14,25 +16,50 @@ public class SettingsController { | |||
| public SettingsController (MainController mainController){ | |||
| this.mainController = mainController; | |||
| } | |||
| @FXML | |||
| private Button opsServerSave; | |||
| private void initialize(){ | |||
| opsServerIp.setText(Main.OPS_IP); | |||
| opsServerPort.setText(Integer.toString(Main.OPS_PORT)); | |||
| @FXML | |||
| private Button opsServerSave1; | |||
| } | |||
| private void showMessage(String title, String message) { | |||
| Alert alert = new Alert(Alert.AlertType.INFORMATION); | |||
| alert.setTitle("Ung\u00fcltige Daten!"); | |||
| alert.setHeaderText(title); | |||
| alert.setContentText(message); | |||
| alert.showAndWait(); | |||
| } | |||
| private boolean validateData(String server, String portStr){ | |||
| int port = -1; | |||
| try{ | |||
| port = Integer.parseInt(portStr); | |||
| }catch (Exception e){ | |||
| showMessage("Portnummer ist nicht valide", "Die Portnummer muss eine Zahl zwischen 1024 und 65535 sein!"); | |||
| return false; | |||
| } | |||
| if(!(port >= 1024 && port <= 65535)){ | |||
| showMessage("Portnummer ist nicht valide", "Die Portnummer muss eine Zahl zwischen 1024 und 65535 sein!"); | |||
| return false; | |||
| } | |||
| return true; | |||
| } | |||
| @FXML | |||
| private TextField opsServerIp1; | |||
| private Button opsServerSave; | |||
| @FXML | |||
| private TextField opsServerIp; | |||
| @FXML | |||
| private TextField opsServerCode; | |||
| private TextField opsServerPort; | |||
| @FXML | |||
| private TextField opsServerCode1; | |||
| } | |||
| @@ -111,8 +111,8 @@ public class StationsHistorieController { | |||
| } | |||
| private void initButtons(){ | |||
| btnStatHistCancel.visibleProperty().bind(state.isEqualTo(State.VIEW).and(tblStationsHistorie.getSelectionModel().selectedItemProperty().isNotNull())); | |||
| btnStatHistCancel.managedProperty().bind(btnStatHistCancel.visibleProperty()); | |||
| // btnStatHistCancel.visibleProperty().bind(state.isEqualTo(State.VIEW).and(tblStationsHistorie.getSelectionModel().selectedItemProperty().isNotNull())); | |||
| // btnStatHistCancel.managedProperty().bind(btnStatHistCancel.visibleProperty()); | |||
| btnStatHistSave.visibleProperty().bind(state.isEqualTo(State.VIEW).not()); | |||
| btnStatHistSave.managedProperty().bind(btnStatHistSave.visibleProperty()); | |||
| @@ -124,6 +124,11 @@ public class HL7Receiver<T extends AbstractMessage> implements ReceivingApplicat | |||
| Station station = mainctrl.getStammdaten().getStationen().stream().filter(s -> s.getStation().equals(stat)).findFirst().orElse(null); | |||
| // TODO: Stationen mit falschen Abteilungen werden einfach umgeschrieben^^ | |||
| if (station == null) { | |||
| HL7Util.logInHL7MessageToDatabase(message, msh, metadata); | |||
| updateUI(new HL7Message(patient, -1, LocalDateTime.now(), "Station nicht gefunden.", true)); | |||
| return generateACKWithAR(message, "Station nicht gefunden."); | |||
| } | |||
| StationsHistorie hist = new StationsHistorie(); // TODO: StationsHist schreiben/schon vorhanden! | |||
| hist.setStationKey(station.getStation()); | |||
| hist.setAufnahmeDatum(HL7Util.parseLocalDateTime(pv1.getAdmitDateTime().getTime())); | |||
| @@ -243,8 +248,7 @@ public class HL7Receiver<T extends AbstractMessage> implements ReceivingApplicat | |||
| // HL7 Nachricht loggen. | |||
| HL7Util.logInHL7MessageToDatabase(message, msh, metadata); | |||
| // TODO: Runnable...??? Jojo??? | |||
| updatedFallIDs.forEach(id -> updateUI(new HL7Message(patient, id, LocalDateTime.now(), "Was soll hier wohl stehen?", false))); | |||
| updatedFallIDs.forEach(id -> updateUI(new HL7Message(patient, id, LocalDateTime.now(), "", false))); | |||
| return generateACK(message); | |||
| } | |||
| @@ -3,8 +3,7 @@ package de.uniluebeck.mi.projmi6.hapi; | |||
| import ca.uhn.hl7v2.DefaultHapiContext; | |||
| import ca.uhn.hl7v2.HapiContext; | |||
| import ca.uhn.hl7v2.app.HL7Service; | |||
| import ca.uhn.hl7v2.model.v251.message.ADT_A01; | |||
| import ca.uhn.hl7v2.model.v251.message.BAR_P05; | |||
| import ca.uhn.hl7v2.protocol.ReceivingApplication; | |||
| import de.uniluebeck.mi.projmi6.controller.MainController; | |||
| import java.util.concurrent.ArrayBlockingQueue; | |||
| @@ -29,14 +28,18 @@ public class HL7Server { | |||
| context.setExecutorService(executor); | |||
| server = context.newServer(PORT, false); | |||
| server.registerApplication("ADT", "A01", new HL7Receiver<ADT_A01>(ADT_A01.class, mainctrl)); | |||
| server.registerApplication("BAR", "P05", new HL7Receiver<BAR_P05>(BAR_P05.class, mainctrl)); | |||
| server.registerConnectionListener(new HL7ConnectionListener()); | |||
| server.setExceptionHandler(new HL7ExceptionHandler()); | |||
| } | |||
| //server.startAndWait(); | |||
| server.start(); | |||
| public void registerApplication(String messageType, String triggerEvent, ReceivingApplication handler) { | |||
| server.registerApplication(messageType, triggerEvent, handler); | |||
| } | |||
| public void start() { | |||
| if (server != null) { | |||
| server.start(); | |||
| } | |||
| } | |||
| public void stop() { | |||
| @@ -18,7 +18,7 @@ | |||
| <TableView fx:id="tblLog" VBox.vgrow="ALWAYS"> | |||
| <columns> | |||
| <TableColumn fx:id="colLogDirection" editable="false" maxWidth="50.0" minWidth="75.0" text="Richtung" /> | |||
| <TableColumn fx:id="colLogIp" editable="false" maxWidth="200.0" minWidth="150.0" text="Ursprungs-IP" /> | |||
| <TableColumn fx:id="colLogIp" editable="false" maxWidth="200.0" minWidth="150.0" text="Source / Destination" /> | |||
| <TableColumn fx:id="colLogTime" editable="false" maxWidth="200.0" minWidth="150.0" text="Uhrzeit" /> | |||
| <TableColumn fx:id="colLogMessage" editable="false" prefWidth="75.0" text="Nachricht" /> | |||
| </columns> | |||
| @@ -1,16 +1,17 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <?import javafx.scene.paint.*?> | |||
| <?import java.net.*?> | |||
| <?import java.lang.*?> | |||
| <?import javafx.geometry.*?> | |||
| <?import javafx.scene.control.*?> | |||
| <?import javafx.scene.layout.*?> | |||
| <?import javafx.scene.text.*?> | |||
| <?import java.net.URL?> | |||
| <TilePane prefHeight="240.0" prefWidth="702.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.uniluebeck.mi.projmi6.controller.SettingsController"> | |||
| <children> | |||
| <VBox prefHeight="200.0" prefWidth="300.0" style="-fx-background-color: white; -fx-background-radius: 10;" styleClass="settings-box"> | |||
| <!-- <VBox prefHeight="200.0" prefWidth="300.0" style="-fx-background-color: white; -fx-background-radius: 10;" styleClass="settings-box"> | |||
| <children> | |||
| <Text strokeType="OUTSIDE" strokeWidth="0.0" text="MySQL-Datenbank"> | |||
| <font> | |||
| @@ -52,7 +53,7 @@ | |||
| <TilePane.margin> | |||
| <Insets bottom="20.0" left="20.0" right="20.0" top="20.0" /> | |||
| </TilePane.margin> | |||
| </VBox> | |||
| </VBox> --> | |||
| <VBox prefHeight="200.0" prefWidth="300.0" style="-fx-background-color: white; -fx-background-radius: 10;" styleClass="settings-box"> | |||
| <children> | |||
| <Text strokeType="OUTSIDE" strokeWidth="0.0" text="OPS-Server"> | |||
| @@ -77,7 +78,7 @@ | |||
| <Label text="Port:" GridPane.rowIndex="1" /> | |||
| <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Text" GridPane.columnIndex="1" /> | |||
| <TextField fx:id="opsServerIp" GridPane.columnIndex="1" /> | |||
| <TextField fx:id="opsServerCode" GridPane.columnIndex="1" GridPane.rowIndex="1" /> | |||
| <TextField fx:id="opsServerPort" GridPane.columnIndex="1" GridPane.rowIndex="1" /> | |||
| </children> | |||
| </GridPane> | |||
| <HBox alignment="BOTTOM_RIGHT" VBox.vgrow="ALWAYS"> | |||
| @@ -93,6 +94,42 @@ | |||
| <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> | |||
| </padding> | |||
| </VBox> | |||
| <VBox prefHeight="200.0" prefWidth="300.0" style="-fx-background-color: white; -fx-background-radius: 10;" styleClass="settings-box"> | |||
| <children> | |||
| <Text strokeType="OUTSIDE" strokeWidth="0.0" text="KIS Gruppe 6"> | |||
| <font> | |||
| <Font size="18.0" /> | |||
| </font> | |||
| <VBox.margin> | |||
| <Insets bottom="10.0" /> | |||
| </VBox.margin> | |||
| </Text> | |||
| <Label text="Eine Projeketarbeit von:"> | |||
| <VBox.margin> | |||
| <Insets bottom="6.0" /> | |||
| </VBox.margin> | |||
| </Label> | |||
| <Label text=" - Ileana Krontsi" /> | |||
| <Label layoutX="20.0" layoutY="71.0" text=" - Natascha Koch" /> | |||
| <Label layoutX="20.0" layoutY="88.0" text=" - Johannes Oehm" /> | |||
| <Label layoutX="20.0" layoutY="105.0" text=" - Nils Dittberner" /> | |||
| <Label text="Projektpraktikum Medizinische Informatik"> | |||
| <VBox.margin> | |||
| <Insets top="10.0" /> | |||
| </VBox.margin> | |||
| </Label> | |||
| <Label layoutX="20.0" layoutY="155.0" text="Wintersemester 2015/16" textFill="#777777" /> | |||
| <Label layoutX="20.0" layoutY="172.0" text="Universität zu Lübeck" textFill="#777777" /> | |||
| </children> | |||
| <padding> | |||
| <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> | |||
| </padding> | |||
| <TilePane.margin> | |||
| <Insets bottom="20.0" left="20.0" right="20.0" top="20.0" /> | |||
| </TilePane.margin> | |||
| </VBox> | |||
| </children> | |||
| <stylesheets> | |||
| <URL value="@style.css" /> | |||
| @@ -64,7 +64,7 @@ | |||
| <Button mnemonicParsing="false" text="Abbrechen" onAction="#clickedAbort" fx:id="btnStatHistAbort"/> | |||
| <Button mnemonicParsing="false" text="Speichern" onAction="#clickedSave" fx:id="btnStatHistSave"/> | |||
| <Button mnemonicParsing="false" text="Entfernen" onAction="#clickedDelete" fx:id="btnStatHistDelete"/> | |||
| <Button disable="true" mnemonicParsing="false" text="Eintrag entfernen" fx:id="btnStatHistCancel" onAction="#clickedCancel"/> | |||
| <!-- <Button disable="true" mnemonicParsing="false" text="Eintrag entfernen" fx:id="btnStatHistCancel" onAction="#clickedCancel"/> --> | |||
| </children> | |||
| </HBox> | |||
| <GridPane> | |||