| @@ -5,15 +5,26 @@ import ca.uhn.hl7v2.HL7Exception; | |||
| import ca.uhn.hl7v2.HapiContext; | |||
| import ca.uhn.hl7v2.model.DataTypeException; | |||
| import ca.uhn.hl7v2.model.Message; | |||
| import ca.uhn.hl7v2.model.v25.datatype.DTM; | |||
| import ca.uhn.hl7v2.model.v251.datatype.FN; | |||
| import ca.uhn.hl7v2.model.v251.message.ACK; | |||
| import ca.uhn.hl7v2.model.v251.message.ADT_A01; | |||
| import ca.uhn.hl7v2.model.v251.message.BAR_P05; | |||
| import ca.uhn.hl7v2.model.v251.segment.*; | |||
| import ca.uhn.hl7v2.parser.Parser; | |||
| import ca.uhn.hl7v2.parser.PipeParser; | |||
| import ca.uhn.hl7v2.validation.ValidationContext; | |||
| import ca.uhn.hl7v2.validation.impl.ValidationContextFactory; | |||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | |||
| import de.uniluebeck.mi.projmi6.model.Diagnose; | |||
| import de.uniluebeck.mi.projmi6.model.Fall; | |||
| import de.uniluebeck.mi.projmi6.model.Patient; | |||
| import java.io.BufferedWriter; | |||
| import java.io.File; | |||
| import java.io.FileWriter; | |||
| import java.io.IOException; | |||
| import java.sql.SQLException; | |||
| import java.sql.Time; | |||
| import java.time.LocalDate; | |||
| import java.time.LocalDateTime; | |||
| @@ -31,10 +42,9 @@ public class HL7 { | |||
| * erstellt eine ADT_A0 nachricht, welche anschließend an die OPS Gruppe verschickt werden soll. | |||
| * TODO Mit OPS Gruppe absprechen, welche Informationen sie auf jeden Fall benötigen und Code entsprechend anpassen. | |||
| * @param fall nach dem Erstellen eines neuen Falls wird diese Methode aufgerufen um Hl7 Nachricht zu erzeugen | |||
| * @param diagnosen Liste aller Nebendiagnosen momentan noch als einzelne Liste uebereben. eventuell die Nebendiagnosen direkt im Fall speichern? | |||
| * @throws Exception | |||
| */ | |||
| public void createMessageADTA01( Fall fall, List<Diagnose> diagnosen) throws HL7Exception, IOException { | |||
| public void createMessageADTA01( Fall fall) throws HL7Exception, IOException { | |||
| Patient patient = fall.getPatient (); | |||
| ADT_A01 adt = new ADT_A01 (); | |||
| @@ -76,6 +86,8 @@ public class HL7 { | |||
| pidSegment.getPid13_PhoneNumberHome (0).getTelephoneNumber ().setValue ( patient.getTelefon () ); | |||
| pidSegment.getPid16_MaritalStatus ().getAlternateIdentifier ().setValue ( patient.getFamilienstand ().toString()); | |||
| validateMessage(adt); | |||
| /* | |||
| //Dg1 (Diagnosen) | |||
| List<DG1> dg1List = new ArrayList<> ( ); | |||
| diagnosen.add(fall.getHauptDiagnose ()); | |||
| @@ -88,20 +100,32 @@ public class HL7 { | |||
| dg1Segment.getDg14_DiagnosisDescription ().setValue ( aDiagnosen.getFreiText () ); | |||
| dg1List.add ( dg1Segment ); | |||
| } | |||
| */ | |||
| //print generated message | |||
| // printXMLEncodedMessageADT(adt); | |||
| printXMLEncodedMessageADT(adt); | |||
| } | |||
| /** | |||
| * gibt erzeugte hl7 Nachricht auf der Konsole aus (Kann nach Debug phase wieder geloescht werden) | |||
| * @param msg | |||
| * @throws HL7Exception | |||
| */ | |||
| public void printXMLEncodedMessageADT(Message msg) throws HL7Exception { | |||
| public void printXMLEncodedMessageADT(Message msg) throws HL7Exception, IOException { | |||
| HapiContext context = new DefaultHapiContext (); | |||
| Parser parser = context.getXMLParser(); | |||
| String encodedMessage = parser.encode (msg); | |||
| String encodedMessage = parser.encode(msg); | |||
| LocalDateTime ldt = LocalDateTime.now(); | |||
| File file = new File("ADTA01Messafge" +LocalDateTime.now().toString() +"xml" ); | |||
| if (!file.exists()) { | |||
| file.createNewFile(); | |||
| } | |||
| FileWriter fw = new FileWriter(file.getAbsoluteFile()); | |||
| BufferedWriter bw = new BufferedWriter(fw); | |||
| bw.write(encodedMessage); | |||
| bw.close(); | |||
| System.out.println (encodedMessage); | |||
| } | |||
| @@ -109,16 +133,49 @@ public class HL7 { | |||
| * | |||
| * @param msg | |||
| */ | |||
| public void parseMessage(Message msg) throws DataTypeException { | |||
| public void parseMessage(Message msg) throws DataTypeException, SQLException { | |||
| if (msg instanceof BAR_P05) { | |||
| BAR_P05 p05 = (BAR_P05) msg; | |||
| Patient patient = new Patient(); | |||
| Fall fall = new Fall(); | |||
| EVN evnSegment = p05.getEVN (); | |||
| EVN evnSegment = p05.getEVN(); | |||
| PID pidSegment = p05.getPID(); | |||
| DBHandler dh = new DBHandler(); | |||
| Patient patient =dh.getPatient(Integer.valueOf(pidSegment.getPid3_PatientIdentifierList(0).getIDNumber().getValue())); | |||
| Fall fall = new Fall(); | |||
| LocalDateTime ldt = generateLocalDateTimeFromHl7(p05); | |||
| patient.setBearbeitetDatumZeit(ldt); | |||
| patient.setBearbeiter(Integer.valueOf(evnSegment.getEvn5_OperatorID(0).getIDNumber().getValue())); | |||
| /** wenn ein neuer patient angelegt werden sollte | |||
| patient.setNachname(pidSegment.getPid5_PatientName(0).getFamilyName().getName()); | |||
| patient.setVorname(pidSegment.getPid5_PatientName(0).getGivenName().getValue()); | |||
| ca.uhn.hl7v2.model.v251.datatype.DTM geburtsTag = pidSegment.getPid7_DateTimeOfBirth().getTime(); | |||
| LocalDate ld = LocalDate.of(geburtsTag.getYear(), geburtsTag.getMonth(), geburtsTag.getDay()); | |||
| patient.setGeburtsdatum(ld); | |||
| Patient.Geschlecht geschlecht = Patient.Geschlecht.parseStringFromHL7(pidSegment.getPid8_AdministrativeSex().getValue()); | |||
| patient.setGeschlecht(geschlecht); | |||
| patient.setStrasse(pidSegment.getPid11_PatientAddress(0).getStreetAddress().getStreetName().getValue()); | |||
| patient.setOrt(pidSegment.getPid11_PatientAddress(0).getCity().getValue()); | |||
| patient.setHausnummer(pidSegment.getPid11_PatientAddress(0).getStreetAddress().getDwellingNumber().getValue()); | |||
| patient.setTelefon(pidSegment.getPid13_PhoneNumberHome(0).getTelephoneNumber().getValue()); | |||
| Patient.Familienstand familienstand = pidSegment.getPid16_MaritalStatus().getAlternateText().getValue(); | |||
| patient.setFamilienstand(); | |||
| */ | |||
| } | |||
| } | |||
| public void validateMessage(Message msg) { | |||
| HapiContext context = new DefaultHapiContext(); | |||
| context.setValidationContext(ValidationContextFactory.<ValidationContext>defaultValidation()); | |||
| PipeParser parser = context.getPipeParser(); | |||
| try { | |||
| parser.encode(msg); | |||
| } catch (HL7Exception e) { | |||
| System.out.println("invaid message!" +e); | |||
| } | |||
| } | |||
| public LocalDateTime generateLocalDateTimeFromHl7(BAR_P05 msg) throws DataTypeException { | |||
| @@ -133,6 +190,7 @@ public class HL7 { | |||
| LocalTime bearbeitetZeit = LocalTime.of(stunden,minuten,sekunden); | |||
| LocalDate bearbeitetDate = LocalDate.of(jahr, monat, tag); | |||
| LocalDateTime ldt = LocalDateTime.of(bearbeitetDate, bearbeitetZeit); | |||
| return ldt; | |||
| } | |||
| @@ -6,6 +6,7 @@ import de.uniluebeck.mi.projmi6.model.Kasse; | |||
| import de.uniluebeck.mi.projmi6.model.Mitarbeiter; | |||
| import de.uniluebeck.mi.projmi6.model.OpsCode; | |||
| import javafx.application.Application; | |||
| import javafx.beans.property.ReadOnlyStringProperty; | |||
| import javafx.collections.FXCollections; | |||
| import javafx.concurrent.Task; | |||
| import javafx.fxml.FXMLLoader; | |||
| @@ -13,6 +14,7 @@ import javafx.geometry.Insets; | |||
| import javafx.geometry.Pos; | |||
| import javafx.scene.Parent; | |||
| import javafx.scene.Scene; | |||
| import javafx.scene.control.ProgressIndicator; | |||
| import javafx.scene.image.Image; | |||
| import javafx.scene.image.ImageView; | |||
| import javafx.scene.layout.Background; | |||
| @@ -36,33 +38,38 @@ public class Main extends Application { | |||
| @Override | |||
| protected Parent call() throws Exception { | |||
| FXMLLoader fxmlLoader = new FXMLLoader(); | |||
| fxmlLoader.setLocation(getClass().getClassLoader().getResource("main.fxml")); | |||
| MainController mainController = new MainController(); | |||
| fxmlLoader.setControllerFactory(mainController.getControllerFactory()); | |||
| mainController.setOpsCodes(FXCollections.observableArrayList( | |||
| updateMessage("Lade OPS-Codes..."); | |||
| mainController.getStammdaten().setOpsCodes(FXCollections.observableArrayList( | |||
| DBHandler.getAllOpsCodes() | |||
| )); | |||
| mainController.setIcd10Codes(FXCollections.observableArrayList( | |||
| updateMessage("Lade ICD-10-Codes..."); | |||
| mainController.getStammdaten().setIcd10Codes(FXCollections.observableArrayList( | |||
| DBHandler.getAllIcd10Codes() | |||
| )); | |||
| mainController.setKassen(FXCollections.observableArrayList( | |||
| //DBHandler.getAll | |||
| updateMessage("Lade Krankenkassen..."); | |||
| mainController.getStammdaten().setKassen(FXCollections.observableArrayList( | |||
| DBHandler.getAllKassen() | |||
| )); | |||
| mainController.setMitarbeiter(FXCollections.observableArrayList( | |||
| updateMessage("Lade Mitarbeiter..."); | |||
| mainController.getStammdaten().setMitarbeiter(FXCollections.observableArrayList( | |||
| DBHandler.getAllMitarbeiter() | |||
| )); | |||
| mainController.setStationen(FXCollections.observableArrayList( | |||
| 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(); | |||
| return root; | |||
| @@ -81,7 +88,7 @@ public class Main extends Application { | |||
| primaryStage.getIcons().add(icon); | |||
| Stage loadingMessage = createLoadWindow(); | |||
| Stage loadingMessage = createLoadWindow(loadMainWindowTask.messageProperty()); | |||
| loadMainWindowTask.setOnFailed(event -> { | |||
| loadMainWindowTask.getException().printStackTrace(); | |||
| @@ -96,6 +103,7 @@ public class Main extends Application { | |||
| primaryStage.setScene(new Scene(root, 1000, 800)); | |||
| primaryStage.show(); | |||
| }); | |||
| Thread thread = new Thread(loadMainWindowTask); | |||
| thread.setDaemon(true); | |||
| thread.start(); | |||
| @@ -109,17 +117,20 @@ public class Main extends Application { | |||
| * | |||
| * @return the splash screen | |||
| */ | |||
| public Stage createLoadWindow(){ | |||
| public Stage createLoadWindow(ReadOnlyStringProperty progressMessage){ | |||
| Text kis = new Text("KIS"); | |||
| kis.setFont(Font.font(50)); | |||
| Text gruppe6 = new Text("Gruppe 06"); | |||
| 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.setAlignment(Pos.CENTER); | |||
| Scene scene = new Scene(root, 400, 400); | |||
| Scene scene = new Scene(root, 400, 500); | |||
| Stage stage = new Stage(StageStyle.UNDECORATED); | |||
| stage.getIcons().add(icon); | |||
| @@ -43,9 +43,9 @@ public class DiagnoseController { | |||
| @FXML | |||
| public void initialize(){ | |||
| diagDiagnose.itemsProperty().bind(mainController.icd10CodesProperty()); | |||
| diagDiagnose.itemsProperty().bind(mainController.getStammdaten().icd10CodesProperty()); | |||
| 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); | |||
| @@ -3,11 +3,11 @@ package de.uniluebeck.mi.projmi6.controller; | |||
| /** | |||
| * 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 javafx.beans.property.ReadOnlyObjectProperty; | |||
| import javafx.beans.property.SimpleObjectProperty; | |||
| import javafx.collections.FXCollections; | |||
| import javafx.event.ActionEvent; | |||
| @@ -19,6 +19,8 @@ import javafx.scene.control.Label; | |||
| import javafx.scene.control.TextField; | |||
| import javafx.scene.layout.GridPane; | |||
| import java.sql.SQLException; | |||
| public class FallController { | |||
| private MainController mainController; | |||
| @@ -76,7 +78,7 @@ public class FallController { | |||
| private SimpleObjectProperty<Fall> fallProperty = new SimpleObjectProperty<>(); | |||
| public Fall getFallProperty() { | |||
| public Fall getFall() { | |||
| return fallProperty.get(); | |||
| } | |||
| @@ -84,14 +86,24 @@ public class FallController { | |||
| return fallProperty; | |||
| } | |||
| public void setFallProperty(Fall fallProperty) { | |||
| this.fallProperty.set(fallProperty); | |||
| public void setFall(Fall fall) { | |||
| this.fallProperty.set(fall); | |||
| } | |||
| public enum State { | |||
| CREATE, EDIT, VIEW | |||
| } | |||
| public State getState() { | |||
| return state.get(); | |||
| } | |||
| public ReadOnlyObjectProperty<State> stateProperty() { | |||
| return state; | |||
| } | |||
| SimpleObjectProperty<State> state = new SimpleObjectProperty<>(State.VIEW); | |||
| @@ -99,21 +111,10 @@ public class FallController { | |||
| public void initialize(){ | |||
| fallEinweisenderArzt.disableProperty().bind(fallSelbsteinweisung.selectedProperty()); | |||
| fallFallart.setItems(FXCollections.observableArrayList(FallArt.values())); | |||
| fallKasse.setItems(mainController.getKassen()); | |||
| fallKasse.setItems(mainController.getStammdaten().getKassen()); | |||
| btnFallEnableEdit.visibleProperty().bind( | |||
| state.isEqualTo(State.VIEW).and(fallProperty.isNotNull()) | |||
| ); | |||
| btnFallAbort.visibleProperty().bind( | |||
| state.isNotEqualTo(State.VIEW) | |||
| ); | |||
| btnFallSave.visibleProperty().bind( | |||
| state.isNotEqualTo(State.VIEW) | |||
| ); | |||
| btnFallCancel.visibleProperty().bind( | |||
| state.isEqualTo(State.VIEW).and(fallProperty.isNotNull()) | |||
| ); | |||
| initButtons(); | |||
| fallFields.disableProperty().bind(state.isEqualTo(State.VIEW)); | |||
| @@ -122,8 +123,40 @@ public class FallController { | |||
| copyFallDataIntoField(fallProperty.get()); | |||
| } | |||
| })); | |||
| state.addListener((observable, oldValue, newValue) -> { | |||
| if(newValue==State.EDIT || newValue == State.CREATE){ | |||
| mainController.lockForEdit(MainController.TabName.OVERVIEW); | |||
| }else{ | |||
| mainController.unlockFromEdit(); | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * Hide the buttons depending on controller state. | |||
| */ | |||
| private void initButtons(){ | |||
| btnFallEnableEdit.managedProperty().bind( | |||
| state.isEqualTo(State.VIEW).and(fallProperty.isNotNull()) | |||
| ); | |||
| btnFallEnableEdit.visibleProperty().bind(btnFallEnableEdit.managedProperty()); | |||
| btnFallAbort.managedProperty().bind( | |||
| state.isNotEqualTo(State.VIEW) | |||
| ); | |||
| btnFallAbort.visibleProperty().bind(btnFallAbort.managedProperty()); | |||
| btnFallSave.managedProperty().bind( | |||
| state.isNotEqualTo(State.VIEW) | |||
| ); | |||
| btnFallSave.visibleProperty().bind(btnFallSave.managedProperty()); | |||
| btnFallCancel.managedProperty().bind( | |||
| state.isEqualTo(State.VIEW).and(fallProperty.isNotNull()) | |||
| ); | |||
| btnFallCancel.visibleProperty().bind(btnFallCancel.managedProperty()); | |||
| } | |||
| public void editFall(){ | |||
| @@ -138,27 +171,52 @@ public class FallController { | |||
| @FXML | |||
| void clickedFallCancel(ActionEvent event) { | |||
| this.state.set(State.VIEW); | |||
| copyFallDataIntoField(fallProperty.get()); | |||
| //Fall Stornieren... | |||
| } | |||
| @FXML | |||
| void clickedFallAbort(ActionEvent event) { | |||
| this.state.set(State.VIEW); | |||
| copyFallDataIntoField(fallProperty.get()); | |||
| mainController.fallCreationComplete(); | |||
| } | |||
| @FXML | |||
| void clickedFallSave(ActionEvent event) { | |||
| mainController.fallCreationComplete(); | |||
| if (this.state.get() == State.CREATE) { | |||
| Fall fall = new Fall(); | |||
| copyFieldDataIntoFall(fall); | |||
| try { | |||
| DBHandler.setFall(fall, mainController.getCurrentMitarbeiter().getMitarbID()); | |||
| } catch (SQLException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } else { | |||
| try { | |||
| DBHandler.setFall(fallProperty.get(), mainController.getCurrentMitarbeiter().getMitarbID(), true); | |||
| } catch (SQLException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| this.state.set(State.VIEW); | |||
| //TODO Update/create in db | |||
| mainController.refreshCasesFromDb(mainController.getPatientTablesController().getSelectedPatient()); | |||
| } | |||
| public void createNewFall() { | |||
| clearFields(); | |||
| 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()); | |||
| } | |||
| @@ -175,10 +233,10 @@ public class FallController { | |||
| fallPatID.setText(""); //TODO | |||
| fallCreateTime.setText("<auto>"); | |||
| fallCreator.setText("<auto>"); | |||
| fallEditTime.setText("<auto>"); | |||
| fallEditor.setText("<auto>"); | |||
| fallCreateTime.setText(""); | |||
| fallCreator.setText(""); | |||
| fallEditTime.setText(""); | |||
| fallEditor.setText(""); | |||
| fallEinweisenderArzt.setText(""); | |||
| fallSelbsteinweisung.setSelected(false); | |||
| @@ -194,15 +252,14 @@ public class FallController { | |||
| private void copyFieldDataIntoFall(Fall fall){ | |||
| fall.setPatient(mainController.getPatientTablesController().getSelectedPatient()); | |||
| fall.setAufnahmeDatum(dtTmAufnahme.getDateTime()); | |||
| fall.setEntlassungsDatum(dtTmEntlassung.getDateTime()); | |||
| if(fallSelbsteinweisung.isSelected()) { | |||
| fall.setSelbsteinweisung(true); | |||
| fall.setEinweisenderArzt(null); | |||
| }else{ | |||
| // fall.setEinweisenderArzt(fallEinweisenderArzt.getText()); TODO | |||
| //fall.setEinweisenderArzt(fallEinweisenderArzt.getText()); TODO | |||
| fall.setSelbsteinweisung(false); | |||
| } | |||
| fall.setVersichertenNummer(fallVersichertennummer.getText()); | |||
| @@ -3,16 +3,21 @@ package de.uniluebeck.mi.projmi6.controller; | |||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | |||
| import de.uniluebeck.mi.projmi6.model.*; | |||
| import javafx.beans.binding.Bindings; | |||
| import javafx.beans.property.ReadOnlyObjectProperty; | |||
| import javafx.beans.property.SimpleObjectProperty; | |||
| import javafx.beans.value.ChangeListener; | |||
| import javafx.collections.FXCollections; | |||
| import javafx.collections.ObservableList; | |||
| import javafx.concurrent.Task; | |||
| import javafx.fxml.FXML; | |||
| import javafx.scene.control.*; | |||
| import javafx.util.Callback; | |||
| import javax.swing.*; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.Set; | |||
| import java.util.concurrent.ThreadFactory; | |||
| public class MainController { | |||
| @@ -23,49 +28,6 @@ public class MainController { | |||
| private StationsHistorieController stationsHistorieController; | |||
| 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); | |||
| } | |||
| private int parallelTaskCount = 0; | |||
| @@ -74,6 +36,7 @@ public class MainController { | |||
| @FXML | |||
| private ProgressIndicator progressIndicator; | |||
| @FXML | |||
| private Button btnFallCreate; | |||
| @@ -87,33 +50,35 @@ public class MainController { | |||
| private TabPane tabPaneFall; | |||
| @FXML | |||
| private Tab tabFallOverview, tabFallUntersuchungen, tabFallDiagnose, tabFallStationsHistorie ; | |||
| private Tab tabFallOverview, tabFallUntersuchungen, tabFallDiagnose, tabFallStationsHistorie; | |||
| private Stammdaten stammdaten = new Stammdaten(); | |||
| private Callback<Class<?>, Object> controllerFactory = clazz -> { | |||
| if(clazz.equals(MainController.class)) { | |||
| if (clazz.equals(MainController.class)) { | |||
| return this; | |||
| }else if(clazz.equals(FallController.class)){ | |||
| } else if (clazz.equals(FallController.class)) { | |||
| return fallController; | |||
| }else if(clazz.equals(DiagnoseController.class)){ | |||
| } else if (clazz.equals(DiagnoseController.class)) { | |||
| return diagnoseController; | |||
| }else if(clazz.equals(PatientTablesController.class)){ | |||
| } else if (clazz.equals(PatientTablesController.class)) { | |||
| return patientTablesController; | |||
| }else if(clazz.equals(SettingsController.class)){ | |||
| return settingsController; | |||
| } else if(clazz.equals(UntersuchungenController.class)) { | |||
| } else if (clazz.equals(SettingsController.class)) { | |||
| return settingsController; | |||
| } else if (clazz.equals(UntersuchungenController.class)) { | |||
| return untersuchungenController; | |||
| }else if(clazz.equals(StationsHistorieController.class)){ | |||
| } else if (clazz.equals(StationsHistorieController.class)) { | |||
| return stationsHistorieController; | |||
| }else { | |||
| System.err.println("Keine Controller-Klasse des Typs "+clazz+" gefunden!!!"); | |||
| } else { | |||
| System.err.println("Keine Controller-Klasse des Typs " + clazz + " gefunden!!!"); | |||
| return null; | |||
| } | |||
| }; | |||
| public MainController(){ | |||
| public MainController() { | |||
| fallController = new FallController(this); | |||
| diagnoseController = new DiagnoseController(this); | |||
| patientTablesController = new PatientTablesController(this); | |||
| @@ -123,156 +88,294 @@ public class MainController { | |||
| } | |||
| public Stammdaten getStammdaten() { | |||
| return stammdaten; | |||
| } | |||
| public Callback<Class<?>, Object> getControllerFactory(){ | |||
| public Callback<Class<?>, Object> getControllerFactory() { | |||
| return controllerFactory; | |||
| } | |||
| public FallController getFallController(){ | |||
| public FallController getFallController() { | |||
| return fallController; | |||
| } | |||
| public DiagnoseController getDiagnoseController(){ | |||
| public DiagnoseController getDiagnoseController() { | |||
| return diagnoseController; | |||
| } | |||
| public PatientTablesController getPatientTablesController(){ | |||
| return patientTablesController; | |||
| public PatientTablesController getPatientTablesController() { | |||
| return patientTablesController; | |||
| } | |||
| public SettingsController getSettingsController(){ | |||
| public SettingsController getSettingsController() { | |||
| return settingsController; | |||
| } | |||
| public UntersuchungenController getUntersuchungenController(){ | |||
| return untersuchungenController; | |||
| public UntersuchungenController getUntersuchungenController() { | |||
| return untersuchungenController; | |||
| } | |||
| public void increaseParallelTaskCount(){ | |||
| public void increaseParallelTaskCount() { | |||
| parallelTaskCount++; | |||
| if(parallelTaskCount>0){ | |||
| if (parallelTaskCount > 0 && progressIndicator != null) { | |||
| progressIndicator.setVisible(true); | |||
| } | |||
| } | |||
| public void decreaseParallelTaskCount(){ | |||
| parallelTaskCount++; | |||
| if(parallelTaskCount<=0){ | |||
| public void decreaseParallelTaskCount() { | |||
| parallelTaskCount--; | |||
| if (parallelTaskCount <= 0 && progressIndicator != null) { | |||
| parallelTaskCount = 0; | |||
| 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); | |||
| } | |||
| private Task<List<Fall>> loadFallTask = null; | |||
| public ObservableList<Icd10Code> getIcd10Codes() { | |||
| return icd10Codes.get(); | |||
| } | |||
| public SimpleObjectProperty<ObservableList<Icd10Code>> icd10CodesProperty() { | |||
| return icd10Codes; | |||
| } | |||
| public void refreshCasesFromDb(Patient patient) { | |||
| lvFall.setItems(null); //clear list | |||
| if (patient == 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(patient.getPatID()); | |||
| } | |||
| @Override | |||
| protected void succeeded() { | |||
| super.succeeded(); | |||
| if (isCancelled()) { | |||
| return; | |||
| } | |||
| lvFallPlaceholder.setText("Keine F\u00e4lle vorhanden!"); | |||
| lvFall.setItems(FXCollections.observableArrayList(getValue())); | |||
| decreaseParallelTaskCount(); | |||
| } | |||
| public void setIcd10Codes(ObservableList<Icd10Code> icd10Codes) { | |||
| this.icd10Codes.set(icd10Codes); | |||
| @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 | |||
| private void initialize(){ | |||
| cmbUserChoose.itemsProperty().bind(this.mitarbeiterProperty()); | |||
| private void initialize() { | |||
| //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() | |||
| .and(fallController.stateProperty().isNotEqualTo(FallController.State.CREATE))); | |||
| fallOverview.disableProperty().bind(patientTablesController.selectedPatientProperty().isNull()); | |||
| //Load the cases async if patient changes | |||
| patientTablesController.selectedPatientProperty().addListener((observableValue, oldValue, newValue) -> { | |||
| refreshCasesFromDb(newValue); | |||
| }); | |||
| lvFall.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); | |||
| fallController.fallPropertyProperty().bind(lvFall.getSelectionModel().selectedItemProperty()); | |||
| lvFall.getSelectionModel().selectedItemProperty().addListener((observableValue, oldValue, newValue) ->{ | |||
| refreshCaseData(newValue); | |||
| }); | |||
| } | |||
| private Task<Void> loadCaseData = null; | |||
| patientTablesController.selectedPatientProperty().addListener((observableValue,oldValue,newValue)-> { | |||
| if(newValue==null){ | |||
| lvFall.setItems(FXCollections.emptyObservableList()); | |||
| return; | |||
| } | |||
| 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)); | |||
| private void refreshCaseData(Fall fall){ | |||
| if (loadCaseData != null && loadCaseData.isRunning()) { | |||
| loadCaseData.cancel(); | |||
| } | |||
| tabPaneFall.setDisable(false); | |||
| tabFallDiagnose.setDisable(true); | |||
| tabFallStationsHistorie.setDisable(true); | |||
| tabFallUntersuchungen.setDisable(true); | |||
| if (fall == null) { | |||
| tabPaneFall.setDisable(true); | |||
| System.out.println("TODO: Clear tables cuz fall = null!"); | |||
| //fallController.c | |||
| return; | |||
| } | |||
| if (fall == null) { // If no patient is selected | |||
| //lvFallPlaceholder.setText("Kein Patient ausgew\u00e4hlt!"); | |||
| return; | |||
| } | |||
| }catch (Exception e){ | |||
| e.printStackTrace(); | |||
| loadCaseData = new Task<Void>() { | |||
| List<Untersuchung> untersuchungList; | |||
| List<Diagnose> diagnoseList; | |||
| List<StationsHistorie> stationsHistorieList; | |||
| @Override | |||
| protected Void call() throws Exception { | |||
| untersuchungList = DBHandler.getUntersuchungByFall(fall); | |||
| diagnoseList = DBHandler.getDiagnosenByFall(fall); | |||
| stationsHistorieList = DBHandler.getStationsHistorieByFall(fall); | |||
| 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)); | |||
| stationsHistorieController.setStationsHistorie(FXCollections.observableArrayList(stationsHistorieList)); | |||
| fallController.fallPropertyProperty().bind(lvFall.getSelectionModel().selectedItemProperty()); | |||
| lvFall.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); | |||
| tabPaneFall.setDisable(false); | |||
| tabFallDiagnose.setDisable(false); | |||
| tabFallStationsHistorie.setDisable(false); | |||
| tabFallUntersuchungen.setDisable(false); | |||
| decreaseParallelTaskCount(); | |||
| } | |||
| /* untersuchungenController.untersuchungenProperty().bind( | |||
| Bindings.createObjectBinding(() ->{ | |||
| Fall selectedFall = lvFall.getSelectionModel().getSelectedItem(); | |||
| System.out.println("Liste der Untersuchungen ...y"); | |||
| if(selectedFall==null) return null; | |||
| List<Untersuchung> untersuchungList = DBHandler.getUntersuchungByFall(selectedFall); | |||
| System.out.println("Es sind "+untersuchungList.size()+" Untersuchungen vorhanden."); | |||
| return FXCollections.observableArrayList(untersuchungList); | |||
| }, lvFall.getSelectionModel().selectedIndexProperty()));*/ | |||
| lvFall.getSelectionModel().selectedItemProperty().addListener(((observable, oldValue, newValue) -> { | |||
| System.out.println("Changed choosen Fall"); | |||
| if(newValue==null) { | |||
| System.out.println("TODO: Clear tables cuz fall = null!"); | |||
| return; | |||
| @Override | |||
| protected void cancelled() { | |||
| super.cancelled(); | |||
| decreaseParallelTaskCount(); | |||
| } | |||
| try { | |||
| List<Untersuchung> untersuchungList = DBHandler.getUntersuchungByFall(newValue); | |||
| System.out.println("untersuchungenList"+untersuchungList); | |||
| untersuchungenController.untersuchungenProperty().set(FXCollections.observableArrayList(untersuchungList)); | |||
| List<Diagnose> diagnoseList = DBHandler.getDiagnosenByFall(newValue); | |||
| System.out.println("diagnoseList ="+diagnoseList); | |||
| diagnoseController.diagnosenProperty().set(FXCollections.observableArrayList(diagnoseList)); | |||
| }catch(Exception e){ | |||
| e.printStackTrace(); | |||
| @Override | |||
| protected void failed() { | |||
| super.failed(); | |||
| //lvFallPlaceholder.setText("Laden fehlgeschlagen!"); | |||
| getException().printStackTrace(); | |||
| decreaseParallelTaskCount(); | |||
| } | |||
| })); | |||
| }; | |||
| Thread thread = new Thread(loadCaseData); | |||
| thread.setDaemon(true); | |||
| thread.start(); | |||
| increaseParallelTaskCount(); | |||
| } | |||
| public void refreshCaseData(){ | |||
| refreshCaseData(lvFall.getSelectionModel().getSelectedItem()); | |||
| } | |||
| @FXML | |||
| private void clickedCreateFall(){ | |||
| private void clickedCreateFall() { | |||
| // tabFallDiagnose.setDisable(true); | |||
| // tabFallUntersuchungen.setDisable(true); | |||
| // tabFallStationsHistorie.setDisable(true); | |||
| // tabPaneFall.getSelectionModel().select(tabFallOverview); | |||
| // patientTablesController.getPatientOverviewTabPane().setDisable(true); | |||
| // | |||
| // | |||
| fallController.createNewFall(); | |||
| lockForEdit(TabName.OVERVIEW); | |||
| } | |||
| public Fall getFall(){ | |||
| return lvFall.getSelectionModel().getSelectedItem(); | |||
| } | |||
| public enum TabName { | |||
| OVERVIEW, DIAGNOSE, UNTERSUCHUNG, STATIONSHISTORIE; | |||
| } | |||
| public void lockForEdit(TabName exclude) { | |||
| tabFallDiagnose.setDisable(true); | |||
| tabFallUntersuchungen.setDisable(true); | |||
| tabFallStationsHistorie.setDisable(true); | |||
| tabPaneFall.getSelectionModel().select(tabFallOverview); | |||
| tabFallOverview.setDisable(true); | |||
| lvFall.setDisable(true); | |||
| btnFallCreate.setDisable(true); | |||
| patientTablesController.getPatientOverviewTabPane().setDisable(true); | |||
| switch (exclude) { | |||
| case OVERVIEW: | |||
| tabFallOverview.setDisable(false); | |||
| break; | |||
| case DIAGNOSE: | |||
| tabFallDiagnose.setDisable(false); | |||
| break; | |||
| case UNTERSUCHUNG: | |||
| tabFallUntersuchungen.setDisable(false); | |||
| break; | |||
| case STATIONSHISTORIE: | |||
| tabFallStationsHistorie.setDisable(false); | |||
| default: | |||
| break; | |||
| } | |||
| fallController.createNewFall(); | |||
| } | |||
| public void fallCreationComplete(){ | |||
| public void unlockFromEdit() { | |||
| tabFallDiagnose.setDisable(false); | |||
| tabFallUntersuchungen.setDisable(false); | |||
| tabFallStationsHistorie.setDisable(false); | |||
| tabFallOverview.setDisable(false); | |||
| patientTablesController.getPatientOverviewTabPane().setDisable(false); | |||
| lvFall.setDisable(false); | |||
| btnFallCreate.setDisable(false); | |||
| } | |||
| public Mitarbeiter getCurrentMitarbeiter() { | |||
| return cmbUserChoose.getValue(); | |||
| } | |||
| public ReadOnlyObjectProperty<Mitarbeiter> currentMitarbeiterProperty() { | |||
| return cmbUserChoose.valueProperty(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,47 @@ | |||
| package de.uniluebeck.mi.projmi6.controller; | |||
| /** | |||
| * Created by 630030 on 19.11.15. | |||
| */ | |||
| import java.io.IOException; | |||
| import java.util.Map; | |||
| import ca.uhn.hl7v2.DefaultHapiContext; | |||
| import ca.uhn.hl7v2.HL7Exception; | |||
| import ca.uhn.hl7v2.model.Message; | |||
| import ca.uhn.hl7v2.protocol.ReceivingApplication; | |||
| import ca.uhn.hl7v2.protocol.ReceivingApplicationException; | |||
| /** | |||
| * Application class for receiving ADT^A01 messages | |||
| */ | |||
| public class OurReceiverApplication implements ReceivingApplication | |||
| { | |||
| /** | |||
| * {@inheritDoc} | |||
| */ | |||
| public boolean canProcess(Message theIn) { | |||
| return true; | |||
| } | |||
| /** | |||
| * {@inheritDoc} | |||
| */ | |||
| public Message processMessage(Message message, Map<String, Object> theMetadata) throws ReceivingApplicationException, HL7Exception { | |||
| String encodedMessage = new DefaultHapiContext().getPipeParser().encode(message); | |||
| System.out.println("Received message:\n" + encodedMessage + "\n\n"); | |||
| // Now generate a simple acknowledgment message and return it | |||
| try { | |||
| return message.generateACK(); | |||
| } catch (IOException e) { | |||
| throw new HL7Exception(e); | |||
| } | |||
| } | |||
| } | |||
| @@ -8,9 +8,9 @@ import de.uniluebeck.mi.projmi6.db.DBHandler; | |||
| import de.uniluebeck.mi.projmi6.model.Kasse; | |||
| import de.uniluebeck.mi.projmi6.model.Patient; | |||
| import javafx.collections.FXCollections; | |||
| import javafx.event.ActionEvent; | |||
| import javafx.fxml.FXML; | |||
| import javafx.scene.control.*; | |||
| import javafx.event.ActionEvent; | |||
| import javafx.stage.Stage; | |||
| import java.sql.SQLException; | |||
| @@ -45,6 +45,9 @@ public class PatientEditorController { | |||
| private TextField patNachname; | |||
| @FXML | |||
| private TextField patTelefonnummer; | |||
| @FXML | |||
| private TextField patStrasse; | |||
| @FXML | |||
| private TextField patHausnummer; | |||
| @@ -75,36 +78,33 @@ public class PatientEditorController { | |||
| private Button btnPatSave; | |||
| public PatientEditorController(MainController mainController) { | |||
| this.mainController = mainController; | |||
| } | |||
| @FXML | |||
| public void initialize(){ | |||
| public void initialize() { | |||
| patGeschlecht.setItems(FXCollections.observableArrayList(Patient.Geschlecht.values())); | |||
| patFamilienstand.setItems(FXCollections.observableArrayList(Patient.Familienstand.values())); | |||
| patVersicherung.setItems(mainController.getKassen()); | |||
| } | |||
| public PatientEditorController(MainController mainController){ | |||
| this.mainController = mainController; | |||
| patVersicherung.setItems(mainController.getStammdaten().getKassen()); | |||
| } | |||
| public void setPatient(Patient patient){ | |||
| public void setPatient(Patient patient) { | |||
| this.patient = patient; | |||
| if(patient==null){ | |||
| if (patient == null) { | |||
| clearFields(); | |||
| }else { | |||
| } else { | |||
| copyPatientDataIntoFields(); | |||
| } | |||
| } | |||
| private void copyPatientDataIntoFields(){ | |||
| private void copyPatientDataIntoFields() { | |||
| patId.setText(Integer.toString(patient.getPatID())); | |||
| patGeburtsname.setText(patient.getGeburtsname()); | |||
| patNachname.setText(patient.getNachname()); | |||
| patVorname.setText(patient.getVorname()); | |||
| patTelefonnummer.setText(patient.getTelefon()); | |||
| patStrasse.setText(patient.getStrasse()); | |||
| patHausnummer.setText(patient.getHausnummer()); | |||
| patPlz.setText(patient.getPlz()); | |||
| @@ -113,7 +113,12 @@ public class PatientEditorController { | |||
| patFamilienstand.setValue(patient.getFamilienstand()); | |||
| patGeschlecht.setValue(patient.getGeschlecht()); | |||
| 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()); | |||
| patCreator.setText(Integer.toString(patient.getErsteller())); | |||
| @@ -122,7 +127,7 @@ public class PatientEditorController { | |||
| 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.setTitle("Ung\u00fcltige Daten!"); | |||
| alert.setHeaderText(title); | |||
| @@ -131,26 +136,28 @@ public class PatientEditorController { | |||
| alert.showAndWait(); | |||
| } | |||
| private void copyFieldDataIntoPatient(Patient patient){ | |||
| private void copyFieldDataIntoPatient(Patient patient) { | |||
| patient.setGeburtsname(patGeburtsname.getText()); | |||
| patient.setNachname(patNachname.getText()); | |||
| patient.setVorname(patVorname.getText()); | |||
| patient.setTelefon(patTelefonnummer.getText()); | |||
| patient.setStrasse(patStrasse.getText()); | |||
| patient.setHausnummer(patHausnummer.getText()); | |||
| patient.setPlz(patPlz.getText()); | |||
| patient.setOrt(patOrt.getText()); | |||
| patient.setGeburtsdatum(patGeburtsdatum.getValue()); | |||
| patient.setFamilienstand(patFamilienstand.getValue()); | |||
| patient.setGeschlecht(patient.getGeschlecht()); | |||
| patient.setGeschlecht(patGeschlecht.getValue()); | |||
| patient.setVersichertennummer(patVersicherungsnummer.getText()); | |||
| //patient.setVersicherung TODO | |||
| if (patVersicherung.getSelectionModel().getSelectedItem() != null) | |||
| patient.setKassenID(patVersicherung.getSelectionModel().getSelectedItem().getKassenID()); | |||
| 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!", | |||
| "Postleitzahlen m\u00fcssen aus exakt 5 Ziffern bestehen!"); | |||
| return false; | |||
| @@ -161,21 +168,22 @@ public class PatientEditorController { | |||
| // TODO: Remove default values. | |||
| private void clearFields(){ | |||
| private void clearFields() { | |||
| patId.setText("<auto>"); | |||
| patGeburtsname.setText(""); | |||
| patNachname.setText("Peter"); | |||
| patVorname.setText("Hans"); | |||
| patNachname.setText(""); | |||
| patVorname.setText(""); | |||
| patStrasse.setText(""); | |||
| patHausnummer.setText(""); | |||
| patPlz.setText("12345"); | |||
| patPlz.setText(""); | |||
| patOrt.setText(""); | |||
| patGeburtsdatum.setValue(LocalDate.of(1988, 4, 7)); | |||
| patFamilienstand.setValue(Patient.Familienstand.VERWITWET); | |||
| patGeschlecht.setValue(null); | |||
| patTelefonnummer.setText(""); | |||
| patGeburtsdatum.setValue(LocalDate.of(1900, 1, 1)); | |||
| patFamilienstand.setValue(Patient.Familienstand.LEDIG); | |||
| patGeschlecht.setValue(Patient.Geschlecht.FEMALE); | |||
| patVersicherungsnummer.setText(""); | |||
| patVersicherung.setValue(null); | |||
| patCave.setText("Angst"); | |||
| patCave.setText(""); | |||
| patCreator.setText("todo"); | |||
| patCreateTime.setText("<auto>"); | |||
| @@ -185,34 +193,34 @@ public class PatientEditorController { | |||
| @FXML | |||
| void clickedSave(ActionEvent event) { | |||
| if(!validateData()){ | |||
| if (!validateData()) { | |||
| return; | |||
| } | |||
| if(patient==null){ | |||
| if (patient == null) { | |||
| patient = new Patient(); | |||
| copyFieldDataIntoPatient(patient); | |||
| try { | |||
| DBHandler.insertPatient(patient, 1003); | |||
| DBHandler.setPatient(patient, mainController.getCurrentMitarbeiter().getMitarbID(), false); | |||
| mainController.getPatientTablesController().updatePatientsFromDb(); | |||
| ((Stage) patNachname.getScene().getWindow()).close(); | |||
| } catch (SQLException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| //Create new db entry TODO | |||
| }else{ | |||
| } else { | |||
| copyFieldDataIntoPatient(patient); | |||
| //Update db entry... TODO | |||
| try { | |||
| DBHandler.updatePatient(patient, 1005); // TODO: MitarbeiterID uebergeben! | |||
| DBHandler.setPatient(patient, mainController.getCurrentMitarbeiter().getMitarbID(), true); | |||
| ((Stage) patNachname.getScene().getWindow()).close(); | |||
| } catch (SQLException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| ((Stage)patNachname.getScene().getWindow()).close(); | |||
| } | |||
| @FXML | |||
| void clickedAbort(ActionEvent event) { | |||
| ((Stage)patVorname.getScene().getWindow()).close(); //Close Window | |||
| ((Stage) patVorname.getScene().getWindow()).close(); //Close Window | |||
| } | |||
| } | |||
| @@ -3,17 +3,17 @@ package de.uniluebeck.mi.projmi6.controller; | |||
| /** | |||
| * Created by Johannes on 12.11.15. | |||
| */ | |||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | |||
| import de.uniluebeck.mi.projmi6.model.Patient; | |||
| import de.uniluebeck.mi.projmi6.model.Station; | |||
| import de.uniluebeck.mi.projmi6.model.StationsUebersichtsItem; | |||
| import javafx.beans.binding.Bindings; | |||
| import javafx.beans.binding.ObjectBinding; | |||
| import javafx.beans.property.ObjectProperty; | |||
| import javafx.beans.property.ReadOnlyObjectProperty; | |||
| import javafx.beans.property.SimpleObjectProperty; | |||
| import javafx.collections.FXCollections; | |||
| import javafx.collections.ObservableList; | |||
| import javafx.collections.transformation.FilteredList; | |||
| import javafx.concurrent.Task; | |||
| import javafx.fxml.FXML; | |||
| import javafx.fxml.FXMLLoader; | |||
| import javafx.scene.Parent; | |||
| @@ -25,110 +25,86 @@ import javafx.stage.Modality; | |||
| import javafx.stage.Stage; | |||
| import java.io.IOException; | |||
| import java.rmi.server.ExportException; | |||
| import java.sql.SQLException; | |||
| import java.time.LocalDate; | |||
| import java.util.List; | |||
| /** | |||
| * Controller class. | |||
| */ | |||
| public class PatientTablesController{ | |||
| public class PatientTablesController { | |||
| @FXML | |||
| Button btnStatRefresh; | |||
| private MainController mainController; | |||
| @FXML | |||
| private Label lblTablePatientEmpty; | |||
| @FXML | |||
| private Label lblTableStationEmpty; | |||
| @FXML | |||
| private Button btnPatCreate; | |||
| @FXML | |||
| private Button btnPatEdit; | |||
| @FXML | |||
| private TableView<Patient> tblPatientOverview; | |||
| @FXML | |||
| private TableColumn<Patient, String> colPatPatId; | |||
| @FXML | |||
| private TableColumn<Patient, String> colPatGeburtsname; | |||
| @FXML | |||
| private TableColumn<Patient, String> colPatNachname; | |||
| @FXML | |||
| private TableColumn<Patient, String> colPatVorname; | |||
| @FXML | |||
| private TableColumn<Patient, LocalDate> colPatGebDatum; | |||
| @FXML | |||
| private TableColumn<Patient, String> colPatStrasse; | |||
| @FXML | |||
| private TableColumn<Patient, String> colPatPlz; | |||
| @FXML | |||
| private TableColumn<Patient, String> colPatOrt; | |||
| @FXML | |||
| private TableColumn<Patient, String> colPatCave; | |||
| @FXML | |||
| private ToggleButton btnEntlassenePatientenZeigen; | |||
| @FXML | |||
| private ComboBox<Station> cmbStationenFilter; | |||
| @FXML | |||
| private TableView<StationsUebersichtsItem> tblStationOverview; | |||
| @FXML | |||
| private TableColumn<StationsUebersichtsItem, String> colStatPatId; | |||
| private TableColumn<StationsUebersichtsItem, Integer> colStatPatId; | |||
| @FXML | |||
| private TableColumn<StationsUebersichtsItem, String> colStatFullName; | |||
| @FXML | |||
| private TableColumn<StationsUebersichtsItem, String> colStatGebDatum; | |||
| private TableColumn<StationsUebersichtsItem, LocalDate> colStatGebDatum; | |||
| @FXML | |||
| private TableColumn<StationsUebersichtsItem, String> colStatAlter; | |||
| private TableColumn<StationsUebersichtsItem, Integer> colStatAlter; | |||
| @FXML | |||
| private TableColumn<StationsUebersichtsItem, String> colStatAufnahmedatum; | |||
| private TableColumn<StationsUebersichtsItem, LocalDate> colStatAufnahmedatum; | |||
| @FXML | |||
| private TableColumn<StationsUebersichtsItem, String> colStatEntlassungsdatum; | |||
| private TableColumn<StationsUebersichtsItem, LocalDate> colStatEntlassungsdatum; | |||
| @FXML | |||
| private Tab stationOverviewTab; | |||
| public TabPane getPatientOverviewTabPane() { | |||
| return patientOverviewTabPane; | |||
| } | |||
| @FXML | |||
| private Tab patientOverviewTab; | |||
| @FXML | |||
| private TabPane patientOverviewTabPane; | |||
| private TabPane patientOverviewTabPane; | |||
| private ObservableList<StationsUebersichtsItem> stationsUebersicht = FXCollections.observableArrayList(); | |||
| private FilteredList<StationsUebersichtsItem> stationsUebersichtsItemFilteredList = new FilteredList<StationsUebersichtsItem>(stationsUebersicht, | |||
| item -> item.getStationEntlassung() == null || !item.getStationEntlassung().isAfter(LocalDate.now())); | |||
| private Task loadStationsHistorieTask = null; | |||
| private Task loadPatientTask = null; | |||
| @FXML | |||
| private Button btnPatRefresh; | |||
| private ObjectBinding<Patient> patientObjectBinding = null; | |||
| public PatientTablesController(MainController mainController){ | |||
| public PatientTablesController(MainController mainController) { | |||
| this.mainController = mainController; | |||
| } | |||
| public TabPane getPatientOverviewTabPane() { | |||
| return patientOverviewTabPane; | |||
| } | |||
| @FXML | |||
| public void initialize() { | |||
| @@ -136,41 +112,41 @@ public class PatientTablesController{ | |||
| tblPatientOverview.setRowFactory(tableView -> { | |||
| TableRow<Patient> tableRow = new TableRow<>(); | |||
| tableRow.setOnMouseClicked(event -> { | |||
| if(event.getClickCount()==2 && (!tableRow.isEmpty())){ | |||
| if (event.getClickCount() == 2 && (!tableRow.isEmpty())) { | |||
| Patient patient = tableRow.getItem(); | |||
| showEditWindow(patient); | |||
| } | |||
| }); | |||
| return tableRow; | |||
| return tableRow; | |||
| }); | |||
| lblTablePatientEmpty.setText("Liste ist leer."); | |||
| lblTableStationEmpty.setText("Daten werden geladen..."); | |||
| cmbStationenFilter.itemsProperty().bind(mainController.stationenProperty()); | |||
| tblStationOverview.disableProperty().bind(cmbStationenFilter.valueProperty().isNull()); | |||
| 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(() ->{ | |||
| return patientOverviewTabPane.getSelectionModel().getSelectedItem().equals(patientOverviewTab) | |||
| ? tblPatientOverview.getSelectionModel().getSelectedItem() | |||
| : null; //(Patient)tblStationOverview.getSelectionModel().getSelectedItem(); //TODO | |||
| patientObjectBinding = Bindings.<Patient>createObjectBinding(() -> { | |||
| if (patientOverviewTabPane.getSelectionModel().getSelectedItem().equals(patientOverviewTab)) { | |||
| return tblPatientOverview.getSelectionModel().getSelectedItem(); | |||
| } else if (tblStationOverview.getSelectionModel().getSelectedItem() == null) { | |||
| return null; | |||
| } else { | |||
| int selectedPatId = tblStationOverview.getSelectionModel().getSelectedItem().getPatId(); | |||
| Patient selectedPatient = tblPatientOverview.getItems().stream().filter(p -> p.getPatID() == selectedPatId).findFirst().orElse(null); | |||
| return selectedPatient; | |||
| } | |||
| }, tblPatientOverview.getSelectionModel().selectedItemProperty(), | |||
| tblStationOverview.getSelectionModel().selectedItemProperty(), | |||
| patientOverviewTabPane.getSelectionModel().selectedItemProperty()); | |||
| tblPatientOverview.setItems(patientList); | |||
| initColumnsPatient(); | |||
| initColumnsStation(); | |||
| updatePatientsFromDb(); | |||
| } | |||
| private void initColumnsPatient(){ | |||
| private void initColumnsPatient() { | |||
| colPatPatId.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patIDProperty().asString()); | |||
| colPatGeburtsname.setCellValueFactory(new PropertyValueFactory<>("geburtsname")); | |||
| colPatNachname.setCellValueFactory(new PropertyValueFactory<>("nachname")); | |||
| @@ -178,51 +154,61 @@ public class PatientTablesController{ | |||
| colPatGebDatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().geburtsdatumProperty()); | |||
| colPatStrasse.setCellValueFactory(cellDataFeatures -> { | |||
| Patient patient = cellDataFeatures.getValue(); | |||
| return Bindings.concat(patient.strasseProperty(), " ", patient.hausnummerProperty()); | |||
| return Bindings.concat(patient.strasseProperty(), " ", patient.hausnummerProperty()); | |||
| }); | |||
| colPatPlz.setCellValueFactory(new PropertyValueFactory<>("plz")); | |||
| colPatOrt.setCellValueFactory(new PropertyValueFactory<>("ort")); | |||
| colPatCave.setCellValueFactory(new PropertyValueFactory<>("cave")); | |||
| } | |||
| private void initColumnsStation(){ | |||
| colStatPatId.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patIdProperty().asString()); | |||
| private void initColumnsStation() { | |||
| colStatPatId.setCellValueFactory(new PropertyValueFactory<StationsUebersichtsItem, Integer>("patId")); | |||
| 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()); | |||
| cmbStationenFilter.valueProperty().addListener((observableValue, oldValue, newValue) -> { | |||
| updateStationsHistorieFromDb(); | |||
| }); | |||
| tblStationOverview.itemsProperty().bind(Bindings.createObjectBinding(() -> { | |||
| if (btnEntlassenePatientenZeigen.isSelected()) { | |||
| return stationsUebersicht; | |||
| } else { | |||
| return stationsUebersichtsItemFilteredList; | |||
| } | |||
| }, btnEntlassenePatientenZeigen.selectedProperty())); | |||
| } | |||
| @FXML | |||
| private void clickedCreatePatient (){ | |||
| private void clickedCreatePatient() { | |||
| showEditWindow(null); | |||
| } | |||
| @FXML | |||
| private void clickedEditPatient(){ | |||
| private void clickedEditPatient() { | |||
| showEditWindow(tblPatientOverview.getSelectionModel().getSelectedItem()); | |||
| } | |||
| private void showEditWindow(Patient patient){ | |||
| private void showEditWindow(Patient patient) { | |||
| FXMLLoader fxmlLoader = new FXMLLoader(); | |||
| fxmlLoader.setLocation(getClass().getClassLoader().getResource("patient_edit.fxml")); | |||
| PatientEditorController patientEditorController = new PatientEditorController(mainController); | |||
| fxmlLoader.setControllerFactory(clazz -> patientEditorController); | |||
| Parent root = null; | |||
| try{ | |||
| try { | |||
| root = fxmlLoader.load(); | |||
| }catch (IOException e){ | |||
| } catch (IOException e) { | |||
| e.printStackTrace(); | |||
| return; | |||
| } | |||
| Stage stage = new Stage(); | |||
| stage.setTitle(patient==null ? "Neuen Patienten erstellen": "Patient bearbeiten"); | |||
| stage.setTitle(patient == null ? "Neuen Patienten erstellen" : "Patient bearbeiten"); | |||
| stage.setScene(new Scene(root, 600, 600)); | |||
| stage.getIcons().add(new Image("icon.png")); | |||
| @@ -233,15 +219,129 @@ public class PatientTablesController{ | |||
| stage.show(); | |||
| } | |||
| public void updatePatientsFromDb() { | |||
| if (this.loadPatientTask != null && this.loadPatientTask.isRunning()) { | |||
| System.out.println("Patienten werden bereits geladen."); | |||
| return; | |||
| } | |||
| btnPatRefresh.setDisable(true); | |||
| private ObjectBinding<Patient> patientObjectBinding = null; | |||
| 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(); | |||
| } | |||
| @FXML | |||
| private void clickedRefreshStation() { | |||
| updateStationsHistorieFromDb(); | |||
| } | |||
| public void updateStationsHistorieFromDb() { | |||
| if (this.loadStationsHistorieTask != null) { | |||
| loadStationsHistorieTask.cancel(); | |||
| } | |||
| lblTableStationEmpty.setText("Liste wird geladen..."); | |||
| btnStatRefresh.setDisable(true); | |||
| stationsUebersicht.clear(); | |||
| mainController.increaseParallelTaskCount(); | |||
| Task<List<StationsUebersichtsItem>> loadStatHist = new Task<List<StationsUebersichtsItem>>() { | |||
| public ObjectBinding<Patient> selectedPatientProperty(){ | |||
| @Override | |||
| protected List<StationsUebersichtsItem> call() throws Exception { | |||
| return FXCollections.<StationsUebersichtsItem>observableArrayList( | |||
| DBHandler.getStationsUebersichtsItems(cmbStationenFilter.getValue().getStation())); | |||
| } | |||
| @Override | |||
| protected void succeeded() { | |||
| super.succeeded(); | |||
| if (!isCancelled()) { | |||
| lblTableStationEmpty.setText("Liste ist leer."); | |||
| stationsUebersicht.setAll(this.getValue()); | |||
| btnStatRefresh.setDisable(false); | |||
| mainController.decreaseParallelTaskCount(); | |||
| } | |||
| } | |||
| @Override | |||
| protected void cancelled() { | |||
| super.cancelled(); | |||
| mainController.decreaseParallelTaskCount(); | |||
| } | |||
| @Override | |||
| protected void failed() { | |||
| super.failed(); | |||
| if (!isCancelled()) { | |||
| lblTableStationEmpty.setText("Laden fehlgeschlagen!"); | |||
| getException().printStackTrace(); | |||
| btnStatRefresh.setDisable(false); | |||
| mainController.decreaseParallelTaskCount(); | |||
| } | |||
| } | |||
| }; | |||
| this.loadStationsHistorieTask = loadStatHist; | |||
| Thread thread = new Thread(loadStationsHistorieTask); | |||
| thread.setDaemon(true); | |||
| thread.start(); | |||
| } | |||
| @FXML | |||
| private void clickedRefreshPatient() { | |||
| updatePatientsFromDb(); | |||
| } | |||
| public ObjectBinding<Patient> selectedPatientProperty() { | |||
| return patientObjectBinding; | |||
| } | |||
| public Patient getSelectedPatient(){ | |||
| public Patient getSelectedPatient() { | |||
| return selectedPatientProperty().get(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,230 @@ | |||
| package de.uniluebeck.mi.projmi6.controller; | |||
| /** | |||
| * Created by 630030 on 19.11.15. | |||
| */ | |||
| import java.io.IOException; | |||
| import java.util.Map; | |||
| import ca.uhn.hl7v2.DefaultHapiContext; | |||
| import ca.uhn.hl7v2.HL7Exception; | |||
| import ca.uhn.hl7v2.HapiContext; | |||
| import ca.uhn.hl7v2.app.Connection; | |||
| import ca.uhn.hl7v2.app.ConnectionListener; | |||
| import ca.uhn.hl7v2.app.HL7Service; | |||
| import ca.uhn.hl7v2.app.Initiator; | |||
| import ca.uhn.hl7v2.llp.LLPException; | |||
| import ca.uhn.hl7v2.model.Message; | |||
| import ca.uhn.hl7v2.parser.Parser; | |||
| import ca.uhn.hl7v2.protocol.ReceivingApplication; | |||
| import ca.uhn.hl7v2.protocol.ReceivingApplicationExceptionHandler; | |||
| public class SendAndReceiveMessage { | |||
| public static void main(String[] args) throws Exception { | |||
| } | |||
| public void sendMessage(Message message){ | |||
| /* | |||
| * The following section of code establishes a server listening | |||
| * on port 1011 for new connections, and then "handles" them by | |||
| */ | |||
| int port = 1011; // The port to listen on | |||
| boolean useTls = false; // Don't use TLS/SSL | |||
| HapiContext context = new DefaultHapiContext(); | |||
| HL7Service server = context.newServer(port, useTls); | |||
| /* | |||
| * Create a client, which will connect to our waiting | |||
| * server and send messages to it. | |||
| */ | |||
| // A connection object represents a socket attached to an HL7 server | |||
| Connection connection = null; | |||
| try { | |||
| connection = context.newClient("localhost", port, useTls); | |||
| } catch (HL7Exception e) { | |||
| e.printStackTrace(); | |||
| } | |||
| // Create a message to send | |||
| String msg = "MSH|^~\\&|HIS|RIH|EKG|EKG|199904140038||ADT^A01|12345|P|2.2\r" | |||
| + "PID|0001|00009874|00001122|A00977|SMITH^JOHN^M|MOM|19581119|F|NOTREAL^LINDA^M|C|564 SPRING ST^^NEEDHAM^MA^02494^US|0002|(818)565-1551|(425)828-3344|E|S|C|0000444444|252-00-4414||||SA|||SA||||NONE|V1|0001|I|D.ER^50A^M110^01|ER|P00055|11B^M011^02|070615^BATMAN^GEORGE^L|555888^NOTREAL^BOB^K^DR^MD|777889^NOTREAL^SAM^T^DR^MD^PHD|ER|D.WT^1A^M010^01|||ER|AMB|02|070615^NOTREAL^BILL^L|ER|000001916994|D||||||||||||||||GDD|WA|NORM|02|O|02|E.IN^02D^M090^01|E.IN^01D^M080^01|199904072124|199904101200|199904101200||||5555112333|||666097^NOTREAL^MANNY^P\r" | |||
| + "NK1|0222555|NOTREAL^JAMES^R|FA|STREET^OTHER STREET^CITY^ST^55566|(222)111-3333|(888)999-0000|||||||ORGANIZATION\r" | |||
| + "PV1|0001|I|D.ER^1F^M950^01|ER|P000998|11B^M011^02|070615^BATMAN^GEORGE^L|555888^OKNEL^BOB^K^DR^MD|777889^NOTREAL^SAM^T^DR^MD^PHD|ER|D.WT^1A^M010^01|||ER|AMB|02|070615^VOICE^BILL^L|ER|000001916994|D||||||||||||||||GDD|WA|NORM|02|O|02|E.IN^02D^M090^01|E.IN^01D^M080^01|199904072124|199904101200|||||5555112333|||666097^DNOTREAL^MANNY^P\r" | |||
| + "PV2|||0112^TESTING|55555^PATIENT IS NORMAL|NONE|||19990225|19990226|1|1|TESTING|555888^NOTREAL^BOB^K^DR^MD||||||||||PROD^003^099|02|ER||NONE|19990225|19990223|19990316|NONE\r" | |||
| + "AL1||SEV|001^POLLEN\r" | |||
| + "GT1||0222PL|NOTREAL^BOB^B||STREET^OTHER STREET^CITY^ST^77787|(444)999-3333|(222)777-5555||||MO|111-33-5555||||NOTREAL GILL N|STREET^OTHER STREET^CITY^ST^99999|(111)222-3333\r" | |||
| + "IN1||022254P|4558PD|BLUE CROSS|STREET^OTHER STREET^CITY^ST^00990||(333)333-6666||221K|LENIX|||19980515|19990515|||PATIENT01 TEST D||||||||||||||||||02LL|022LP554"; | |||
| Parser p = context.getPipeParser(); | |||
| Message adt = null; | |||
| try { | |||
| adt = p.parse(msg); | |||
| } catch (HL7Exception e) { | |||
| e.printStackTrace(); | |||
| } | |||
| // The initiator is used to transmit unsolicited messages | |||
| Initiator initiator = connection.getInitiator(); | |||
| Message response = null; | |||
| try { | |||
| response = initiator.sendAndReceive(adt); | |||
| } catch (HL7Exception e) { | |||
| e.printStackTrace(); | |||
| } catch (LLPException e) { | |||
| e.printStackTrace(); | |||
| } catch (IOException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| String responseString = null; | |||
| try { | |||
| responseString = p.encode(response); | |||
| } catch (HL7Exception e) { | |||
| e.printStackTrace(); | |||
| } | |||
| System.out.println("Received response:\n" + responseString); | |||
| /* | |||
| * MSH|^~\&|||||20070218200627.515-0500||ACK|54|P|2.2 MSA|AA|12345 | |||
| */ | |||
| /* | |||
| * If you want to send another message to the same destination, it's fine | |||
| * to ask the context again for a client to attach to the same host/port. | |||
| * The context will be smart about it and return the same (already | |||
| * connected) client Connection instance, assuming it hasn't been closed. | |||
| */ | |||
| try { | |||
| connection = context.newClient("localhost", port, useTls); | |||
| } catch (HL7Exception e) { | |||
| e.printStackTrace(); | |||
| } | |||
| initiator = connection.getInitiator(); | |||
| try { | |||
| response = initiator.sendAndReceive(adt); | |||
| } catch (HL7Exception e) { | |||
| e.printStackTrace(); | |||
| } catch (LLPException e) { | |||
| e.printStackTrace(); | |||
| } catch (IOException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| /* | |||
| * Close the connection when you are done with it. | |||
| */ | |||
| connection.close(); | |||
| // Stop the receiving server and client | |||
| server.stopAndWait(); | |||
| } | |||
| public void receiveMessage(Message message){ | |||
| /* | |||
| * The following section of code establishes a server listening | |||
| * on port 1011 for new connections, and then "handles" them by | |||
| */ | |||
| int port = 1011; // The port to listen on | |||
| boolean useTls = false; // Don't use TLS/SSL | |||
| HapiContext context = new DefaultHapiContext(); | |||
| HL7Service server = context.newServer(port, useTls); | |||
| /* | |||
| * The server may have any number of "application" objects registered to | |||
| * handle messages. We are going to create an application to listen to | |||
| * BAR^P05 messages. | |||
| */ | |||
| ReceivingApplication handler = new OurReceiverApplication(); | |||
| server.registerApplication("BAR", "P05", handler); | |||
| /* | |||
| *We want to be notified any time a new connection comes in or is | |||
| * lost, so we register a connection listener | |||
| */ | |||
| server.registerConnectionListener(new MyConnectionListener()); | |||
| /* | |||
| * We want to be notified any processing failures when receiving, | |||
| * processing, or responding to messages with the server, so we | |||
| * register an exception handler. */ | |||
| server.setExceptionHandler(new MyExceptionHandler()); | |||
| // Start the server listening for messages | |||
| try { | |||
| server.startAndWait(); | |||
| } catch (InterruptedException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| /** | |||
| * Connection listener which is notified whenever a new | |||
| * connection comes in or is lost | |||
| */ | |||
| public static class MyConnectionListener implements ConnectionListener { | |||
| public void connectionReceived(Connection theC) { | |||
| System.out.println("New connection received: " + theC.getRemoteAddress().toString()); | |||
| } | |||
| public void connectionDiscarded(Connection theC) { | |||
| System.out.println("Lost connection from: " + theC.getRemoteAddress().toString()); | |||
| } | |||
| } | |||
| /** | |||
| * Exception handler which is notified any time | |||
| */ | |||
| public static class MyExceptionHandler implements ReceivingApplicationExceptionHandler { | |||
| /** | |||
| * Process an exception. | |||
| * | |||
| * @param theIncomingMessage | |||
| * the incoming message. This is the raw message which was | |||
| * received from the external system | |||
| * @param theIncomingMetadata | |||
| * Any metadata that accompanies the incoming message. See {@link ca.uhn.hl7v2.protocol.Transportable#getMetadata()} | |||
| * @param theOutgoingMessage | |||
| * the outgoing message. The response NAK message generated by | |||
| * HAPI. | |||
| * @param theE | |||
| * the exception which was received | |||
| * @return The new outgoing message. This can be set to the value provided | |||
| * by HAPI in <code>outgoingMessage</code>, or may be replaced with | |||
| * another message. <b>This method may not return <code>null</code></b>. | |||
| */ | |||
| public String processException(String theIncomingMessage, Map<String, Object> theIncomingMetadata, String theOutgoingMessage, Exception theE) throws HL7Exception { | |||
| /* | |||
| * Here you can do any processing you like. If you want to change | |||
| * the response (NAK) message which will be returned you may do | |||
| * so, or just return the NAK which HAPI already created (theOutgoingMessage) | |||
| */ | |||
| return theOutgoingMessage; | |||
| } | |||
| } | |||
| } | |||
| @@ -1,14 +1,25 @@ | |||
| package de.uniluebeck.mi.projmi6.controller; | |||
| import de.uniluebeck.mi.projmi6.model.Fall; | |||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | |||
| import de.uniluebeck.mi.projmi6.model.Station; | |||
| import de.uniluebeck.mi.projmi6.model.StationsHistorie; | |||
| import de.uniluebeck.mi.projmi6.model.Untersuchung; | |||
| import de.uniluebeck.mi.projmi6.view.DateTimePicker; | |||
| import javafx.beans.binding.Bindings; | |||
| import javafx.beans.property.ReadOnlyObjectProperty; | |||
| import javafx.beans.property.SimpleObjectProperty; | |||
| import javafx.collections.FXCollections; | |||
| import javafx.collections.ObservableList; | |||
| import javafx.collections.transformation.FilteredList; | |||
| import javafx.event.ActionEvent; | |||
| import javafx.fxml.FXML; | |||
| import javafx.scene.control.Button; | |||
| import javafx.scene.control.Label; | |||
| import javafx.scene.control.TableColumn; | |||
| import javafx.scene.control.TableView; | |||
| import javafx.scene.control.*; | |||
| import javafx.scene.control.cell.PropertyValueFactory; | |||
| import javafx.scene.layout.GridPane; | |||
| import java.sql.SQLException; | |||
| import java.time.LocalDate; | |||
| import java.util.List; | |||
| import java.util.stream.Collectors; | |||
| /** | |||
| * Created by 631806 on 12.11.15. | |||
| @@ -18,46 +29,180 @@ 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 StationsHistorie stationsHistorieSelected = null; | |||
| private MainController mainController; | |||
| @FXML | |||
| private TableView<?>tblStationsHistorie; | |||
| private TableView<StationsHistorie>tblStationsHistorie; | |||
| @FXML | |||
| private Button btnStatHistCancel, btnStatHistSave; | |||
| @FXML | |||
| private Label statHistCreator, statHistCreatTime, statHistEditor, statHistEditTime; | |||
| private Label statHistCreator, statHistCreateTime, statHistEditor, statHistEditTime; | |||
| @FXML | |||
| private TableColumn<StationsHistorie,String> colStatHistStation; | |||
| @FXML | |||
| private TableColumn<?,?> colStatHistAbteilung, colStatHistStation, colStatHistAufnahmeDatum, colStatHistEntlassungsDatum; | |||
| private TableColumn<StationsHistorie,LocalDate> colStatHistAufnahmeDatum, colStatHistEntlassungsDatum; | |||
| @FXML | |||
| private DateTimePicker dtTmAufnahme, dtTmEntlassung; | |||
| @FXML | |||
| private ComboBox<Station> cmbStation; | |||
| @FXML | |||
| private ComboBox<String> cmbAbteilung; | |||
| public StationsHistorieController(MainController mainController){ | |||
| this.mainController = mainController; | |||
| } | |||
| @FXML | |||
| private void clickedCancel(){ | |||
| private void clickedEdit() { | |||
| this.state.set(State.EDIT); | |||
| } | |||
| public enum State { | |||
| CREATE, EDIT, VIEW | |||
| } | |||
| public State getState() { | |||
| return state.get(); | |||
| } | |||
| public ReadOnlyObjectProperty<State> stateProperty() { | |||
| return state; | |||
| } | |||
| SimpleObjectProperty<State> state = new SimpleObjectProperty<>(State.VIEW); | |||
| public void setStationsHistorie(ObservableList<StationsHistorie> stationsHistorie) { | |||
| this.stationsHistorie.set(stationsHistorie); | |||
| } | |||
| private SimpleObjectProperty<ObservableList<StationsHistorie>> stationsHistorie = | |||
| new SimpleObjectProperty<>(); | |||
| @FXML | |||
| GridPane fields; | |||
| @FXML | |||
| private void initialize() { | |||
| initColumns(); | |||
| initStationsFilter(); | |||
| fields.disableProperty().bind(stateProperty().isEqualTo(State.VIEW)); | |||
| state.addListener((observable, oldValue, newValue) -> { | |||
| if(newValue == State.CREATE || newValue == State.EDIT){ | |||
| mainController.lockForEdit(MainController.TabName.STATIONSHISTORIE); | |||
| }else{ | |||
| mainController.unlockFromEdit(); | |||
| } | |||
| }); | |||
| tblStationsHistorie.itemsProperty().bind(stationsHistorie); | |||
| tblStationsHistorie.getSelectionModel().selectedItemProperty().addListener((observableValue, oldValue, newValue) -> { | |||
| setStationsHistorieSelected(newValue); | |||
| }); | |||
| } | |||
| @FXML | |||
| public Button btnStatHistAbort; | |||
| private void initStationsFilter(){ | |||
| final String any = "beliebig"; | |||
| List<String> abteilungen = mainController.getStammdaten().getStationen().stream() | |||
| .map(stat->stat.getAbteilung()).distinct().collect(Collectors.toList()); | |||
| cmbAbteilung.setItems(FXCollections.observableArrayList(abteilungen)); | |||
| cmbAbteilung.getItems().add(0, any); | |||
| cmbAbteilung.getSelectionModel().select(0); | |||
| btnStatHistCancel.visibleProperty().bind(state.isEqualTo(State.VIEW).and(tblStationsHistorie.getSelectionModel().selectedItemProperty().isNotNull())); | |||
| btnStatHistSave.visibleProperty().bind(state.isEqualTo(State.VIEW).not()); | |||
| btnStatHistAbort.visibleProperty().bind(state.isEqualTo(State.VIEW).not()); | |||
| btnStatHistEdit.visibleProperty().bind(state.isEqualTo(State.VIEW)); | |||
| tblStationsHistorie.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { | |||
| setStationsHistorieSelected(newValue); | |||
| }); | |||
| FilteredList<Station> stationenFiltered = new FilteredList<Station>(mainController.getStammdaten().getStationen()); | |||
| stationenFiltered.predicateProperty().bind(Bindings.createObjectBinding(() -> { | |||
| if(cmbAbteilung.getValue()==null || cmbAbteilung.getValue().equals(any)){ | |||
| return p->true; | |||
| } | |||
| return p -> p.getAbteilung().equals(cmbAbteilung.getValue()); | |||
| },cmbAbteilung.valueProperty())); | |||
| cmbStation.setItems(stationenFiltered); | |||
| } | |||
| @FXML | |||
| Button btnStatHistEdit; | |||
| @FXML | |||
| private void clickedCancel(){ | |||
| // this.state.set(State.VIEW); | |||
| } | |||
| @FXML | |||
| private void clickedSave(){ | |||
| if(getState()==State.CREATE){ | |||
| StationsHistorie stationsHistorie = new StationsHistorie(); | |||
| copyFieldDataIntoStationsHistorie(stationsHistorie); | |||
| try { | |||
| DBHandler.setStationsHistorie(stationsHistorie,false); | |||
| } catch (SQLException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| mainController.refreshCaseData(); | |||
| } | |||
| } | |||
| @FXML | |||
| private void clickedAbort(){ | |||
| state.set(State.VIEW); | |||
| copyStationsHistorieDataIntoFields(); | |||
| } | |||
| @FXML | |||
| private void clickedCreateAufenthalt(){ | |||
| this.state.set(State.CREATE); | |||
| setStationsHistorieSelected(null); | |||
| } | |||
| public ObservableList<StationsHistorie> getStationsHistorie() { | |||
| return stationsHistorie.get(); | |||
| } | |||
| public void setStationsHistorie(StationsHistorie stationsHistorie){ | |||
| this.stationsHistorie = stationsHistorie; | |||
| public SimpleObjectProperty<ObservableList<StationsHistorie>> stationsHistorieProperty() { | |||
| return stationsHistorie; | |||
| } | |||
| public void setStationsHistorieSelected(StationsHistorie stationsHistorie){ | |||
| this.stationsHistorieSelected=stationsHistorie; | |||
| if(stationsHistorie==null){ | |||
| clearFields(); | |||
| }else { | |||
| @@ -66,47 +211,57 @@ public class StationsHistorieController { | |||
| } | |||
| 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 initColumns(){ | |||
| // colStatHistStation.setCellValueFactory(new PropertyValueFactory<StationsHistorie, String>()); | |||
| colStatHistAufnahmeDatum.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>("aufnahmeDatum")); | |||
| colStatHistEntlassungsDatum.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>("entlassungsDatum")); | |||
| //colStatHistStation.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>()); | |||
| // | |||
| } | |||
| private void copyFieldDataIntoStationsHistorie(StationsHistorie stationsHistorie){ | |||
| if(stationsHistorie==null){ | |||
| private void copyStationsHistorieDataIntoFields(){ | |||
| if(stationsHistorieSelected==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()); | |||
| //TODO cmbStation.setValue | |||
| dtTmAufnahme.setDateTime(stationsHistorieSelected.getAufnahmeDatum()); | |||
| dtTmEntlassung.setDateTime(stationsHistorieSelected.getEntlassungsDatum()); | |||
| statHistCreator.setText(Integer.toString(stationsHistorieSelected.getErsteller())); | |||
| if(stationsHistorieSelected.getErstellDatumZeit()!=null){ | |||
| statHistCreateTime.setText(stationsHistorieSelected.getErstellDatumZeit().toString()); | |||
| } | |||
| statHistEditor.setText(Integer.toString(stationsHistorieSelected.getBearbeiter())); | |||
| if(stationsHistorieSelected.getBearbeitetDatumZeit()!=null){ | |||
| statHistEditTime.setText(stationsHistorieSelected.getBearbeitetDatumZeit().toString()); | |||
| } | |||
| } | |||
| private void copyFieldDataIntoStationsHistorie(StationsHistorie stationsHistorie){ | |||
| stationsHistorie.setAufnahmeDatum(dtTmAufnahme.getDateTime()); | |||
| stationsHistorie.setEntlassungsDatum(dtTmEntlassung.getDateTime()); | |||
| stationsHistorie.setStation(cmbStation.getValue()); | |||
| stationsHistorie.setFallID(mainController.getFall().getFallID()); | |||
| stationsHistorie.setStationKey(cmbStation.getValue().getStation()); | |||
| } | |||
| private void clearFields(){ | |||
| //statHistCreateTime.setText("<auto>"); | |||
| //statHistCreator.setText("<auto>"); | |||
| //statHistEditTime.setText("<auto>"); | |||
| // statHistEditor.setText("<auto>"); | |||
| statHistCreateTime.setText(""); | |||
| statHistCreator.setText(""); | |||
| statHistEditTime.setText(""); | |||
| statHistEditor.setText(""); | |||
| cmbAbteilung.setValue(null); | |||
| cmbStation.setValue(null); | |||
| colStatHistAbteilung.setText(""); | |||
| colStatHistStation.setText(""); | |||
| // colStatHistAufnahmeDatum.setDateTime(null); | |||
| // colStatHistEntlassungsDatum.setDateTime(null); | |||
| dtTmAufnahme.setDateTime(null); | |||
| dtTmEntlassung.setDateTime(null); | |||
| dtTmEntlassung.setDateTime(null); | |||
| } | |||
| } | |||
| @@ -5,6 +5,7 @@ package de.uniluebeck.mi.projmi6.controller; | |||
| */ | |||
| import de.uniluebeck.mi.projmi6.Main; | |||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | |||
| import de.uniluebeck.mi.projmi6.model.*; | |||
| import de.uniluebeck.mi.projmi6.view.DateTimePicker; | |||
| import javafx.beans.property.SimpleObjectProperty; | |||
| @@ -13,6 +14,8 @@ import javafx.event.ActionEvent; | |||
| import javafx.fxml.FXML; | |||
| import javafx.scene.control.*; | |||
| import java.sql.SQLException; | |||
| public class UntersuchungenController { | |||
| /** | |||
| @@ -77,14 +80,16 @@ public class UntersuchungenController { | |||
| @FXML | |||
| public void initialize(){ | |||
| untsOpsCode.itemsProperty().bind(mainController.opsCodesProperty()); | |||
| untsOpsCode.itemsProperty().bind(mainController.getStammdaten().opsCodesProperty()); | |||
| untsList.itemsProperty().bind(untersuchungen); | |||
| untsArzt.setItems(mainController.getStammdaten().getMitarbeiter()); | |||
| } | |||
| @FXML | |||
| void clickedUntsCreate(ActionEvent event) { | |||
| clearFields(); | |||
| untsArzt.getSelectionModel().select(mainController.getCurrentMitarbeiter()); | |||
| untersuchung = null; | |||
| } | |||
| @FXML | |||
| @@ -94,7 +99,17 @@ public class UntersuchungenController { | |||
| @FXML | |||
| 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){ | |||
| @@ -0,0 +1,4 @@ | |||
| /** | |||
| * Controller Klassen | |||
| */ | |||
| package de.uniluebeck.mi.projmi6.controller; | |||
| @@ -5,51 +5,81 @@ import de.uniluebeck.mi.projmi6.model.*; | |||
| import java.sql.*; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.StringJoiner; | |||
| /** | |||
| * Created by nils on 15.11.2015. | |||
| * Handler fuer alle DB Interaktionen. | |||
| */ | |||
| public class DBHandler { | |||
| 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 UPDATE_PATIENT = "UPDATE `patient` " + | |||
| "SET `CAVE`=?, " + | |||
| "`Familienstand`=?, " + | |||
| "`Geburtsdatum`=?, " + | |||
| "`Geburtsname`=?, " + | |||
| "`Geschlecht`=?, " + // TODO: Hausnummer fehlt | |||
| "`KassenID`=?, " + | |||
| "`LetzterBearbeiter`=?, " + | |||
| "`Nachname`=?, " + | |||
| "`Ort`=?, " + | |||
| "`PLZ`=?, " + | |||
| "`Strasse`=?, " + | |||
| "`Telefon`=?, " + | |||
| "`Versichertennummer`=?, " + | |||
| "`Vorname`=? " + | |||
| 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`, " + | |||
| "`Familienstand`, " + | |||
| "`Geburtsdatum`, " + | |||
| private static final String INSERT_PATIENT = "INSERT INTO `patient`" + | |||
| "(`CAVE`," + | |||
| "`Vorname`," + | |||
| "`Geburtsname`," + | |||
| "`Geschlecht`, " + | |||
| "`Hausnummer`, " + | |||
| "`KassenID`, " + | |||
| "`LetzterBearbeiter`, " + | |||
| "`Nachname`, " + | |||
| "`Ort`, " + | |||
| "`PLZ`, " + | |||
| "`Strasse`, " + | |||
| "`Nachname`," + | |||
| "`Geburtsdatum`," + | |||
| "`Geschlecht`," + | |||
| "`Familienstand`," + | |||
| "`Strasse`," + | |||
| "`Hausnummer`," + | |||
| "`PLZ`," + | |||
| "`Ort`," + | |||
| "`Telefon`," + | |||
| "`Versichertennummer`, " + | |||
| "`Vorname`, " + | |||
| "`Ersteller`) " + | |||
| "`KassenID`," + | |||
| "`Versichertennummer`," + | |||
| "`LetzterBearbeiter`," + | |||
| "`Ersteller`)" + | |||
| "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; | |||
| private static final String SELECT_ALL_STATIONEN = "SELECT * FROM `stammstation`"; | |||
| private static final String SELECT_ALL_STATIONEN = "SELECT *,`r`.`abteilung` AS abteilung " + | |||
| "FROM `stammstation` s " + | |||
| "INNER JOIN `relfachrichtungstation` r ON s.station = r.station"; | |||
| 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_ALL_ICD10CODES = "SELECT * FROM `stammicd10`"; | |||
| private static final String SELECT_ALL_OPSCODES = "SELECT * FROM `stammops`"; | |||
| @@ -57,11 +87,65 @@ public class DBHandler { | |||
| 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_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_FALLID = "SELECT * FROM `stationshistorie` WHERE `stationshistorie`.`fallid` = ?"; | |||
| private static final String SELECT_STATUBERITEMS_BY_STATION = "SELECT p.id AS patid," + | |||
| "concat(p.nachname, ', ', p.vorname) AS patname," + | |||
| "p.geburtsdatum AS dob," + | |||
| "timestampdiff(YEAR, p.geburtsdatum, curdate()) AS patage," + | |||
| "f.aufnahmedatum AS aufnahme," + | |||
| "f.entlassungsdatum AS entlassung," + | |||
| "f.fallid AS fallid " + | |||
| "FROM stationshistorie s " + | |||
| "INNER JOIN fall f ON s.fallid = f.fallid " + | |||
| "INNER JOIN patient p ON f.patientid = p.id " + | |||
| "WHERE s.station = ?"; | |||
| private static final String INSERT_STATHISTENTRY = "INSERT INTO `stationshistorie`" + | |||
| "(`Aufnahmedatum`," + | |||
| "`Entlassungsdatum`," + | |||
| "`FallID`," + | |||
| "`LetzterBearbeiter`," + | |||
| "`Station`," + | |||
| "`Ersteller`)" + | |||
| "VALUES (?, ?, ?, ?, ?, ?)"; | |||
| private static final String UPDATE_STATHISTENTRY = "UPDATE `stationshistorie` " + | |||
| "SET `Aufnahmedatum`=?," + | |||
| "`Entlassungsdatum`=?," + | |||
| "`FallID`=?," + | |||
| "`LetzterBearbeiter`=?," + | |||
| "`Station`=? " + | |||
| "WHERE `StatHistID`=?"; | |||
| /** | |||
| * 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 { | |||
| Statement statement = MySqlConnFactory.getConnection().createStatement(); | |||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | |||
| ResultSet rs = statement.executeQuery(SELECT_ALL_PATIENTS); | |||
| List<Patient> patients = new ArrayList<>(); | |||
| @@ -72,100 +156,104 @@ public class DBHandler { | |||
| 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 { | |||
| Patient patient = new Patient(); | |||
| patient.setPatID(rs.getInt("id")); | |||
| patient.setGeburtsname(rs.getString("geburtsname")); | |||
| patient.setVorname(rs.getString("vorname")); | |||
| patient.setNachname(rs.getString("nachname")); | |||
| if (rs.getDate("geburtsdatum") != null) | |||
| if (rs.getDate("geburtsdatum") != null) { | |||
| patient.setGeburtsdatum(rs.getDate("geburtsdatum").toLocalDate()); | |||
| } | |||
| patient.setCave(rs.getString("cave")); | |||
| patient.setStrasse(rs.getString("strasse")); | |||
| patient.setHausnummer(rs.getString("hausnummer")); | |||
| patient.setPlz(rs.getString("plz")); | |||
| patient.setOrt(rs.getString("ort")); | |||
| 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.setKassenID(rs.getInt("kassenid")); | |||
| setVersionInformation(patient, rs); | |||
| return patient; | |||
| } | |||
| // TODO: Defaultwerte entfernen und so. | |||
| public static void updatePatient(Patient patient, int mitarbid) throws SQLException { | |||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(UPDATE_PATIENT); | |||
| // TODO: Never used. | |||
| public static Patient getPatient(int id) throws SQLException { | |||
| PreparedStatement statement = MySqlConnectionFactory.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 = MySqlConnectionFactory.getConnection().prepareStatement(UPDATE_PATIENT); | |||
| } else { | |||
| statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_PATIENT); | |||
| } | |||
| statement.setString(1, patient.getCave()); // CAVE | |||
| if (patient.getFamilienstand() != null) | |||
| statement.setString(2, patient.getFamilienstand().toString()); // Familienstand | |||
| else | |||
| statement.setString(2, "l"); | |||
| statement.setDate(3, Date.valueOf(patient.getGeburtsdatum())); // Geburtsdatum | |||
| statement.setString(4, patient.getGeburtsname()); // Geburtsname | |||
| if (patient.getGeschlecht() != null) | |||
| statement.setString(5, String.valueOf(patient.getGeschlecht().id())); // Geschlecht | |||
| else | |||
| statement.setString(5, "o"); | |||
| // statement.setInt(6, patient.getKassenID()); // KasseId | |||
| statement.setInt(6, 1); // KasseId | |||
| statement.setInt(7, mitarbid); // Letzterbearbeiter | |||
| statement.setString(8, patient.getNachname()); // Nachname | |||
| statement.setString(9, patient.getOrt()); // Ort | |||
| 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.getStrasse()); // Strasse | |||
| statement.setString(12, patient.getTelefon()); // telefon | |||
| statement.setString(13, patient.getVersichertennummer()); // versichertennummer | |||
| statement.setString(14, patient.getVorname()); // vorname | |||
| statement.setInt(15, patient.getPatID()); // patid | |||
| System.out.println(statement.toString()); | |||
| statement.executeUpdate(); | |||
| } | |||
| public static void insertPatient(Patient patient, int mitarbid) throws SQLException { | |||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(INSERT_PATIENT); | |||
| statement.setString(1, patient.getCave()); // `CAVE` | |||
| if (patient.getFamilienstand() != null) | |||
| statement.setString(2, String.valueOf(patient.getFamilienstand().id())); // `Familienstand` | |||
| else | |||
| statement.setString(2, "l"); | |||
| statement.setDate(3, Date.valueOf(patient.getGeburtsdatum())); // `Geburtdatum` | |||
| statement.setString(4, patient.getGeburtsname()); // `Geburtsname` | |||
| if (patient.getGeschlecht() != null) | |||
| statement.setString(5, String.valueOf(patient.getGeschlecht().id())); // `Geschlecht` | |||
| else | |||
| statement.setString(5, "o"); | |||
| statement.setString(6, patient.getHausnummer()); // `Hausnummer` | |||
| //statement.setInt(7, patient.getKassenID()); // `KassenID` | |||
| statement.setInt(7, 1); // `KassenID` | |||
| statement.setInt(8, mitarbid); // `LetzterBearbeiter` | |||
| statement.setString(9, patient.getNachname()); // `Nachname` | |||
| statement.setString(10, patient.getOrt()); // `Ort` | |||
| statement.setString(11, patient.getPlz()); // `PLZ` | |||
| statement.setString(12, patient.getStrasse()); // `Strasse` | |||
| statement.setString(13, patient.getTelefon()); // `Telefon` | |||
| statement.setString(14, patient.getVersichertennummer()); // `Versichertennummer` | |||
| statement.setString(15, patient.getVorname()); // `Vorname` | |||
| statement.setInt(16, mitarbid); // `Ersteller` | |||
| System.out.println(statement.toString()); | |||
| 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(); | |||
| statement.execute(); | |||
| } | |||
| public static List<Station> getAllStationen() throws SQLException { | |||
| Statement statement = MySqlConnFactory.getConnection().createStatement(); | |||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | |||
| ResultSet rs = statement.executeQuery(SELECT_ALL_STATIONEN); | |||
| List<Station> stationen = new ArrayList<>(); | |||
| @@ -176,18 +264,118 @@ public class DBHandler { | |||
| 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 { | |||
| Station station = new Station(); | |||
| station.setStation(rs.getString("station")); | |||
| station.setBezeichnung(rs.getString("bezeichnung")); | |||
| station.setBezeichnungLang(rs.getString("bezeichnunglang")); | |||
| station.setStationstyp(rs.getInt("stationstyp")); | |||
| station.setAbteilung(rs.getString("abteilung")); | |||
| return station; | |||
| } | |||
| public static List<StationsUebersichtsItem> getStationsUebersichtsItems(String station) throws SQLException { | |||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_STATUBERITEMS_BY_STATION); | |||
| statement.setString(1, station); | |||
| ResultSet rs = statement.executeQuery(); | |||
| List<StationsUebersichtsItem> statUeberItems = new ArrayList<>(); | |||
| while (rs.next()) { | |||
| statUeberItems.add(getStatUeberItem(rs)); | |||
| } | |||
| return statUeberItems; | |||
| } | |||
| private static StationsUebersichtsItem getStatUeberItem(ResultSet rs) throws SQLException { | |||
| StationsUebersichtsItem item = new StationsUebersichtsItem(); | |||
| item.setFallId(rs.getInt("fallid")); | |||
| item.setPatId(rs.getInt("patid")); | |||
| item.setPatName(rs.getString("patname")); | |||
| item.setPatAge(rs.getInt("patage")); | |||
| item.setPatBirthdate(rs.getDate("dob").toLocalDate()); | |||
| if (rs.getDate("aufnahme") != null) { | |||
| item.setStationAufnahme(rs.getDate("aufnahme").toLocalDate()); | |||
| } | |||
| if (rs.getDate("entlassung") != null) { | |||
| item.setStationEntlassung(rs.getDate("entlassung").toLocalDate()); | |||
| } | |||
| return item; | |||
| } | |||
| public static List<StationsHistorie> getStationsHistorieByFall(Fall fall) throws SQLException { | |||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_STATHIST_BY_FALLID); | |||
| statement.setInt(1, fall.getFallID()); | |||
| ResultSet rs = statement.executeQuery(); | |||
| List<StationsHistorie> historie = new ArrayList<>(); | |||
| while (rs.next()) { | |||
| historie.add(getStationsHistorie(rs)); | |||
| } | |||
| return historie; | |||
| } | |||
| public static void setStationsHistorie(StationsHistorie hist, boolean isUpdate) throws SQLException { | |||
| PreparedStatement statement; | |||
| if (isUpdate) { | |||
| statement = MySqlConnectionFactory.getConnection().prepareStatement(UPDATE_STATHISTENTRY); | |||
| } else { | |||
| statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_STATHISTENTRY); | |||
| } | |||
| if (hist.getAufnahmeDatum() != null) { | |||
| statement.setTimestamp(1, Timestamp.valueOf(hist.getAufnahmeDatum())); // `Aufnahmedatum` | |||
| } else { | |||
| statement.setTimestamp(1, null); | |||
| } | |||
| if (hist.getEntlassungsDatum() != null) { | |||
| statement.setTimestamp(2, Timestamp.valueOf(hist.getEntlassungsDatum())); // `Entlassungsdatum` | |||
| } else { | |||
| statement.setTimestamp(2, null); | |||
| } | |||
| statement.setInt(3, hist.getFallID()); // `FallID` | |||
| statement.setInt(4, hist.getBearbeiter()); // `LetzterBearbeiter` | |||
| statement.setString(5, hist.getStationKey()); // `Station` | |||
| if (isUpdate) { | |||
| statement.setInt(6, hist.getStatHistID()); // `StatHistID` | |||
| statement.executeUpdate(); | |||
| } else { | |||
| statement.setInt(6, hist.getErsteller()); // `Ersteller` | |||
| statement.execute(); | |||
| } | |||
| } | |||
| 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); | |||
| hist.setStationKey(rs.getString("station")); | |||
| return hist; | |||
| } | |||
| public static List<Fall> getFaelleByPatID(int id) throws SQLException { | |||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_FAELLE_BY_PATID); | |||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_FAELLE_BY_PATID); | |||
| statement.setInt(1, id); | |||
| ResultSet rs = statement.executeQuery(); | |||
| @@ -199,20 +387,116 @@ public class DBHandler { | |||
| 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 { | |||
| Fall fall = new Fall(); | |||
| fall.setFallID(rs.getInt("fallid")); | |||
| if (rs.getTimestamp("aufnahmedatum") != null) | |||
| if (rs.getTimestamp("aufnahmedatum") != null) { | |||
| fall.setAufnahmeDatum(rs.getTimestamp("aufnahmedatum").toLocalDateTime()); | |||
| if (rs.getTimestamp("entlassungsdatum") != null) | |||
| } | |||
| if (rs.getTimestamp("entlassungsdatum") != null) { | |||
| fall.setEntlassungsDatum(rs.getTimestamp("entlassungsdatum").toLocalDateTime()); | |||
| if (rs.getInt("hauptdiagnose") != 0) | |||
| } | |||
| if (rs.getInt("hauptdiagnose") != 0) { | |||
| 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"))); | |||
| fall.setEinweisenderArzt(rs.getString("einweisenderarzt")); | |||
| fall.setStorniert(rs.getBoolean("storniert")); | |||
| return fall; | |||
| } | |||
| /** | |||
| * 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 = MySqlConnectionFactory.getConnection().prepareStatement(UPDATE_FALL); | |||
| } else { | |||
| statement = MySqlConnectionFactory.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.setString(4, fall.getEinweisenderArzt()); // 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); | |||
| @@ -221,7 +505,7 @@ public class DBHandler { | |||
| } | |||
| private static Diagnose getDiagnose(int id) throws SQLException { | |||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_DIAGNOSE_BY_ID); | |||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_DIAGNOSE_BY_ID); | |||
| statement.setInt(1, id); | |||
| ResultSet rs = statement.executeQuery(); | |||
| @@ -229,6 +513,13 @@ public class DBHandler { | |||
| 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 { | |||
| Diagnose diagnose = new Diagnose(); | |||
| @@ -242,15 +533,17 @@ public class DBHandler { | |||
| private static void setVersionInformation(Version version, ResultSet rs) throws SQLException { | |||
| version.setErsteller(rs.getInt("ersteller")); | |||
| if (rs.getTimestamp("erstelldatum") != null) | |||
| if (rs.getTimestamp("erstelldatum") != null) { | |||
| version.setErstellDatumZeit(rs.getTimestamp("erstelldatum").toLocalDateTime()); | |||
| } | |||
| version.setBearbeiter(rs.getInt("letzterbearbeiter")); | |||
| if (rs.getTimestamp("letztesbearbeitungsdatum") != null) | |||
| if (rs.getTimestamp("letztesbearbeitungsdatum") != null) { | |||
| version.setBearbeitetDatumZeit(rs.getTimestamp("letztesbearbeitungsdatum").toLocalDateTime()); | |||
| } | |||
| } | |||
| public static List<Icd10Code> getAllIcd10Codes() throws SQLException { | |||
| Statement statement = MySqlConnFactory.getConnection().createStatement(); | |||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | |||
| ResultSet rs = statement.executeQuery(SELECT_ALL_ICD10CODES); | |||
| List<Icd10Code> icd10codes = new ArrayList<>(); | |||
| @@ -262,7 +555,7 @@ public class DBHandler { | |||
| } | |||
| private static Icd10Code getIcd10Code(String code, int version) throws SQLException { | |||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_ICD10CODE_BY_ID); | |||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_ICD10CODE_BY_ID); | |||
| ResultSet rs; | |||
| statement.setString(1, code); | |||
| statement.setInt(2, version); | |||
| @@ -272,6 +565,13 @@ public class DBHandler { | |||
| 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 { | |||
| String code = rs.getString("icd10code"); | |||
| String text = rs.getString("text"); | |||
| @@ -281,7 +581,7 @@ public class DBHandler { | |||
| } | |||
| public static List<OpsCode> getAllOpsCodes() throws SQLException { | |||
| Statement statement = MySqlConnFactory.getConnection().createStatement(); | |||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | |||
| ResultSet rs = statement.executeQuery(SELECT_ALL_OPSCODES); | |||
| List<OpsCode> opscodes = new ArrayList<>(); | |||
| @@ -292,8 +592,8 @@ public class DBHandler { | |||
| return opscodes; | |||
| } | |||
| public static OpsCode getOpsCode(String code, int version) throws SQLException { | |||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_OPSCODE_BY_ID); | |||
| private static OpsCode getOpsCode(String code, int version) throws SQLException { | |||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_OPSCODE_BY_ID); | |||
| ResultSet rs; | |||
| statement.setString(1, code); | |||
| statement.setInt(2, version); | |||
| @@ -303,6 +603,13 @@ public class DBHandler { | |||
| 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 { | |||
| String code = rs.getString("opscode"); | |||
| String text = rs.getString("text"); | |||
| @@ -312,7 +619,7 @@ public class DBHandler { | |||
| } | |||
| public static List<Mitarbeiter> getAllMitarbeiter() throws SQLException { | |||
| Statement statement = MySqlConnFactory.getConnection().createStatement(); | |||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | |||
| ResultSet rs = statement.executeQuery(SELECT_ALL_MITARBEITER); | |||
| List<Mitarbeiter> mitarbeiters = new ArrayList<>(); | |||
| @@ -324,7 +631,7 @@ public class DBHandler { | |||
| } | |||
| private static Mitarbeiter getMitarbeiter(int id) throws SQLException { | |||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_MITARBEITER_BY_ID); | |||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_MITARBEITER_BY_ID); | |||
| ResultSet rs; | |||
| statement.setInt(1, id); | |||
| rs = statement.executeQuery(); | |||
| @@ -333,6 +640,13 @@ public class DBHandler { | |||
| 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 { | |||
| Mitarbeiter mitarbeiter = new Mitarbeiter(rs.getInt("mitarbid")); | |||
| mitarbeiter.setTitel(rs.getString("titel")); | |||
| @@ -342,8 +656,15 @@ public class DBHandler { | |||
| 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); | |||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_UNTERS_BY_FALLID); | |||
| statement.setInt(1, fall.getFallID()); | |||
| ResultSet rs = statement.executeQuery(); | |||
| @@ -366,8 +687,39 @@ public class DBHandler { | |||
| 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 = MySqlConnectionFactory.getConnection().prepareStatement(UPDATE_UNTERSUCHUNG); | |||
| } else { | |||
| statement = MySqlConnectionFactory.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); | |||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_DIAGNOSE_BY_FALLID); | |||
| statement.setInt(1, fall.getFallID()); | |||
| ResultSet rs = statement.executeQuery(); | |||
| @@ -378,4 +730,42 @@ public class DBHandler { | |||
| return diagnosen; | |||
| } | |||
| public static List<Kasse> getAllKassen() throws SQLException { | |||
| Statement statement = MySqlConnectionFactory.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 = MySqlConnectionFactory.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,16 +5,16 @@ import java.sql.DriverManager; | |||
| import java.sql.SQLException; | |||
| /** | |||
| * Created by nils on 15.11.2015. | |||
| * MySQL Connection Factory. | |||
| */ | |||
| public class MySqlConnFactory { | |||
| private static MySqlConnFactory instance = new MySqlConnFactory(); | |||
| public static final String URL = "jdbc:mysql://127.0.0.1:3306/pmiw15g06_v01"; | |||
| public class MySqlConnectionFactory { | |||
| public static final String URL = "jdbc:mysql://141.83.20.84:3306/pmiw15g06_v01"; | |||
| public static final String USER = "pmiw15g06"; | |||
| public static final String PASS = "AX3yQSYJSH43PrSz"; | |||
| public static final String DRIVER = "com.mysql.jdbc.Driver"; | |||
| private static MySqlConnectionFactory instance = new MySqlConnectionFactory(); | |||
| private MySqlConnFactory() { | |||
| private MySqlConnectionFactory() { | |||
| try { | |||
| Class.forName(DRIVER); | |||
| } catch (ClassNotFoundException e) { | |||
| @@ -22,6 +22,10 @@ public class MySqlConnFactory { | |||
| } | |||
| } | |||
| protected static Connection getConnection() { | |||
| return instance.createConnection(); | |||
| } | |||
| private Connection createConnection() { | |||
| Connection conn = null; | |||
| try { | |||
| @@ -31,8 +35,4 @@ public class MySqlConnFactory { | |||
| } | |||
| 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 { | |||
| private Fall fall; | |||
| //ICDCODE | |||
| private int diagID; | |||
| private Icd10Code icd10code; | |||
| private Mitarbeiter arzt; | |||
| private SimpleStringProperty freiText = new SimpleStringProperty(this, "freiText"); | |||
| private DiagArt diagArt; | |||
| public int getDiagID() { | |||
| return diagID; | |||
| } | |||
| public void setDiagID(int diagID) { | |||
| this.diagID = diagID; | |||
| } | |||
| public Fall getFall() { | |||
| return fall; | |||
| @@ -5,7 +5,6 @@ import javafx.beans.property.SimpleIntegerProperty; | |||
| import javafx.beans.property.SimpleObjectProperty; | |||
| import javafx.beans.property.SimpleStringProperty; | |||
| import java.text.SimpleDateFormat; | |||
| import java.time.LocalDateTime; | |||
| /** | |||
| @@ -15,7 +14,7 @@ public class Fall extends Version { | |||
| private Patient patient; | |||
| private Kasse kasse; | |||
| private Diagnose hauptDiagnose; | |||
| private Mitarbeiter einweisenderArzt; | |||
| private SimpleStringProperty einweisenderArzt = new SimpleStringProperty(this, "einweiser"); | |||
| private FallArt fallArt; | |||
| private SimpleBooleanProperty selbsteinweisung = new SimpleBooleanProperty(this, "selbsteinweisung"); | |||
| private SimpleStringProperty versichertenNummer = new SimpleStringProperty(this, "versichertenNummer"); | |||
| @@ -29,38 +28,37 @@ public class Fall extends Version { | |||
| return vorstellDatum.get(); | |||
| } | |||
| public SimpleObjectProperty<LocalDateTime> vorstellDatumProperty() { | |||
| return vorstellDatum; | |||
| } | |||
| public void setVorstellDatum(LocalDateTime vorstellDatum) { | |||
| this.vorstellDatum.set(vorstellDatum); | |||
| } | |||
| public LocalDateTime getAufnahmeDatum() { | |||
| return aufnahmeDatum.get(); | |||
| public SimpleObjectProperty<LocalDateTime> vorstellDatumProperty() { | |||
| return vorstellDatum; | |||
| } | |||
| public SimpleObjectProperty<LocalDateTime> aufnahmeDatumProperty() { | |||
| return aufnahmeDatum; | |||
| public LocalDateTime getAufnahmeDatum() { | |||
| return aufnahmeDatum.get(); | |||
| } | |||
| public void setAufnahmeDatum(LocalDateTime aufnahmeDatum) { | |||
| this.aufnahmeDatum.set(aufnahmeDatum); | |||
| } | |||
| public LocalDateTime getEntlassungsDatum() { | |||
| return entlassungsDatum.get(); | |||
| public SimpleObjectProperty<LocalDateTime> aufnahmeDatumProperty() { | |||
| return aufnahmeDatum; | |||
| } | |||
| public SimpleObjectProperty<LocalDateTime> entlassungsDatumProperty() { | |||
| return entlassungsDatum; | |||
| public LocalDateTime getEntlassungsDatum() { | |||
| return entlassungsDatum.get(); | |||
| } | |||
| public void setEntlassungsDatum(LocalDateTime entlassungsDatum) { | |||
| this.entlassungsDatum.set(entlassungsDatum); | |||
| } | |||
| public SimpleObjectProperty<LocalDateTime> entlassungsDatumProperty() { | |||
| return entlassungsDatum; | |||
| } | |||
| public Patient getPatient() { | |||
| return patient; | |||
| @@ -86,63 +84,71 @@ public class Fall extends Version { | |||
| this.hauptDiagnose = hauptDiagnose; | |||
| } | |||
| public Mitarbeiter getEinweisenderArzt() { | |||
| return einweisenderArzt; | |||
| public String getEinweisenderArzt() { | |||
| return einweisenderArzt.get(); | |||
| } | |||
| public void setEinweisenderArzt(Mitarbeiter einweisenderArzt) { | |||
| this.einweisenderArzt = einweisenderArzt; | |||
| public void setEinweisenderArzt(String einweisenderArzt) { | |||
| this.einweisenderArzt.set(einweisenderArzt); | |||
| } | |||
| public Enum<FallArt> getFallArt() { | |||
| return fallArt; | |||
| public SimpleStringProperty einweisenderArztProperty() { | |||
| return einweisenderArzt; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return Integer.toString(getFallID()); | |||
| public FallArt getFallArt() { | |||
| return fallArt; | |||
| } | |||
| public void setFallArt(FallArt fallArt) { | |||
| this.fallArt = fallArt; | |||
| } | |||
| public boolean getSelbsteinweisung() { | |||
| return selbsteinweisung.get(); | |||
| @Override | |||
| public String toString() { | |||
| if(getAufnahmeDatum()!=null){ | |||
| return getAufnahmeDatum().toLocalDate().toString(); | |||
| }else{ | |||
| return Integer.toString(getFallID()); | |||
| } | |||
| } | |||
| public SimpleBooleanProperty selbsteinweisungProperty() { | |||
| return selbsteinweisung; | |||
| public boolean getSelbsteinweisung() { | |||
| return selbsteinweisung.get(); | |||
| } | |||
| public void setSelbsteinweisung(boolean selbsteinweisung) { | |||
| this.selbsteinweisung.set(selbsteinweisung); | |||
| } | |||
| public String getVersichertenNummer() { | |||
| return versichertenNummer.get(); | |||
| public SimpleBooleanProperty selbsteinweisungProperty() { | |||
| return selbsteinweisung; | |||
| } | |||
| public SimpleStringProperty versichertenNummerProperts() { | |||
| return versichertenNummer; | |||
| public String getVersichertenNummer() { | |||
| return versichertenNummer.get(); | |||
| } | |||
| public void setVersichertenNummer(String versichertenNummer) { | |||
| this.versichertenNummer.set(versichertenNummer); | |||
| } | |||
| public boolean getStorniert() { | |||
| return storniert.get(); | |||
| public SimpleStringProperty versichertenNummerProperts() { | |||
| return versichertenNummer; | |||
| } | |||
| public SimpleBooleanProperty storniertProperty() { | |||
| return storniert; | |||
| public boolean getStorniert() { | |||
| return storniert.get(); | |||
| } | |||
| public void setStorniert(boolean storniert) { | |||
| this.storniert.set(storniert); | |||
| } | |||
| public SimpleBooleanProperty storniertProperty() { | |||
| return storniert; | |||
| } | |||
| public SimpleStringProperty versichertenNummerProperty() { | |||
| return versichertenNummer; | |||
| } | |||
| @@ -151,12 +157,12 @@ public class Fall extends Version { | |||
| return fallID.get(); | |||
| } | |||
| public SimpleIntegerProperty fallIDProperty() { | |||
| return fallID; | |||
| } | |||
| public void setFallID(int fallID) { | |||
| this.fallID.set(fallID); | |||
| } | |||
| public SimpleIntegerProperty fallIDProperty() { | |||
| return fallID; | |||
| } | |||
| } | |||
| @@ -27,6 +27,10 @@ public enum FallArt { | |||
| } | |||
| } | |||
| public String id() { | |||
| return id; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return fallArt; | |||
| @@ -6,7 +6,7 @@ import javafx.beans.property.SimpleStringProperty; | |||
| /** | |||
| * Created by 627933 on 12.11.15. | |||
| */ | |||
| public class Kasse { | |||
| public class Kasse extends Version { | |||
| private SimpleStringProperty adresse = new SimpleStringProperty(this, "adresse"); | |||
| private SimpleIntegerProperty kassenID = new SimpleIntegerProperty(this, "kassenID"); | |||
| private SimpleStringProperty name = new SimpleStringProperty(this, "name"); | |||
| @@ -6,7 +6,7 @@ import javafx.beans.property.SimpleStringProperty; | |||
| /** | |||
| * Created by 627933 on 12.11.15. | |||
| */ | |||
| public class Mitarbeiter { | |||
| public class Mitarbeiter implements Comparable { | |||
| private SimpleStringProperty anrede = new SimpleStringProperty(this, "anrede"); | |||
| private SimpleStringProperty einweisenderArzt = new SimpleStringProperty(this, "einweisenderArzt"); | |||
| private SimpleStringProperty fachrichtung = new SimpleStringProperty(this, "fachrichtung"); | |||
| @@ -30,172 +30,177 @@ public class Mitarbeiter { | |||
| return anrede.get(); | |||
| } | |||
| public SimpleStringProperty anredeProperty() { | |||
| return anrede; | |||
| } | |||
| public void setAnrede(String anrede) { | |||
| this.anrede.set(anrede); | |||
| } | |||
| public String getEinweisenderArzt() { | |||
| return einweisenderArzt.get(); | |||
| public SimpleStringProperty anredeProperty() { | |||
| return anrede; | |||
| } | |||
| public SimpleStringProperty einweisenderArztProperty() { | |||
| return einweisenderArzt; | |||
| public String getEinweisenderArzt() { | |||
| return einweisenderArzt.get(); | |||
| } | |||
| public void setEinweisenderArzt(String einweisenderArzt) { | |||
| this.einweisenderArzt.set(einweisenderArzt); | |||
| } | |||
| public String getFachrichtung() { | |||
| return fachrichtung.get(); | |||
| public SimpleStringProperty einweisenderArztProperty() { | |||
| return einweisenderArzt; | |||
| } | |||
| public SimpleStringProperty fachrichtungProperty() { | |||
| return fachrichtung; | |||
| public String getFachrichtung() { | |||
| return fachrichtung.get(); | |||
| } | |||
| public void setFachrichtung(String fachrichtung) { | |||
| this.fachrichtung.set(fachrichtung); | |||
| } | |||
| public String getFachrichtungKurz() { | |||
| return fachrichtungKurz.get(); | |||
| public SimpleStringProperty fachrichtungProperty() { | |||
| return fachrichtung; | |||
| } | |||
| public SimpleStringProperty fachrichtungKurzProperty() { | |||
| return fachrichtungKurz; | |||
| public String getFachrichtungKurz() { | |||
| return fachrichtungKurz.get(); | |||
| } | |||
| public void setFachrichtungKurz(String fachrichtungKurz) { | |||
| this.fachrichtungKurz.set(fachrichtungKurz); | |||
| } | |||
| public String getLand() { | |||
| return land.get(); | |||
| public SimpleStringProperty fachrichtungKurzProperty() { | |||
| return fachrichtungKurz; | |||
| } | |||
| public SimpleStringProperty landProperty() { | |||
| return land; | |||
| public String getLand() { | |||
| return land.get(); | |||
| } | |||
| public void setLand(String land) { | |||
| this.land.set(land); | |||
| } | |||
| public int getMitarbID() { | |||
| return mitarbID.get(); | |||
| public SimpleStringProperty landProperty() { | |||
| return land; | |||
| } | |||
| public SimpleIntegerProperty mitarbIDProperty() { | |||
| return mitarbID; | |||
| public int getMitarbID() { | |||
| return mitarbID.get(); | |||
| } | |||
| public void setMitarbID(int mitarbID) { | |||
| this.mitarbID.set(mitarbID); | |||
| } | |||
| public String getNachname() { | |||
| return nachname.get(); | |||
| public SimpleIntegerProperty mitarbIDProperty() { | |||
| return mitarbID; | |||
| } | |||
| public SimpleStringProperty nachnameProperty() { | |||
| return nachname; | |||
| public String getNachname() { | |||
| return nachname.get(); | |||
| } | |||
| public void setNachname(String nachname) { | |||
| this.nachname.set(nachname); | |||
| } | |||
| public String getPlz() { | |||
| return plz.get(); | |||
| public SimpleStringProperty nachnameProperty() { | |||
| return nachname; | |||
| } | |||
| public SimpleStringProperty plzProperty() { | |||
| return plz; | |||
| public String getPlz() { | |||
| return plz.get(); | |||
| } | |||
| public void setPlz(String plz) { | |||
| this.plz.set(plz); | |||
| } | |||
| public String getStadt() { | |||
| return stadt.get(); | |||
| public SimpleStringProperty plzProperty() { | |||
| return plz; | |||
| } | |||
| public SimpleStringProperty stadtProperty() { | |||
| return stadt; | |||
| public String getStadt() { | |||
| return stadt.get(); | |||
| } | |||
| public void setStadt(String stadt) { | |||
| this.stadt.set(stadt); | |||
| } | |||
| public String getStrasse1() { | |||
| return strasse1.get(); | |||
| public SimpleStringProperty stadtProperty() { | |||
| return stadt; | |||
| } | |||
| public SimpleStringProperty strasse1Property() { | |||
| return strasse1; | |||
| public String getStrasse1() { | |||
| return strasse1.get(); | |||
| } | |||
| public void setStrasse1(String strasse1) { | |||
| this.strasse1.set(strasse1); | |||
| } | |||
| public String getStrasse2() { | |||
| return strasse2.get(); | |||
| public SimpleStringProperty strasse1Property() { | |||
| return strasse1; | |||
| } | |||
| public SimpleStringProperty strasse2Property() { | |||
| return strasse2; | |||
| public String getStrasse2() { | |||
| return strasse2.get(); | |||
| } | |||
| public void setStrasse2(String strasse2) { | |||
| this.strasse2.set(strasse2); | |||
| } | |||
| public String getTelefon() { | |||
| return telefon.get(); | |||
| public SimpleStringProperty strasse2Property() { | |||
| return strasse2; | |||
| } | |||
| public SimpleStringProperty telefonProperty() { | |||
| return telefon; | |||
| public String getTelefon() { | |||
| return telefon.get(); | |||
| } | |||
| public void setTelefon(String telefon) { | |||
| this.telefon.set(telefon); | |||
| } | |||
| public String getTitel() { | |||
| return titel.get(); | |||
| public SimpleStringProperty telefonProperty() { | |||
| return telefon; | |||
| } | |||
| public SimpleStringProperty titelProperty() { | |||
| return titel; | |||
| public String getTitel() { | |||
| return titel.get(); | |||
| } | |||
| public void setTitel(String titel) { | |||
| this.titel.set(titel); | |||
| } | |||
| public String getVorname() { | |||
| return vorname.get(); | |||
| public SimpleStringProperty titelProperty() { | |||
| return titel; | |||
| } | |||
| public SimpleStringProperty vornameProperty() { | |||
| return vorname; | |||
| public String getVorname() { | |||
| return vorname.get(); | |||
| } | |||
| public void setVorname(String vorname) { | |||
| this.vorname.set(vorname); | |||
| } | |||
| public SimpleStringProperty vornameProperty() { | |||
| return vorname; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return getNachname() + ", " + getVorname(); | |||
| } | |||
| @Override | |||
| public int compareTo(Object o) { | |||
| return nachname.get().compareTo(((Mitarbeiter) o).getNachname()); | |||
| } | |||
| } | |||
| @@ -234,6 +234,17 @@ public class Patient extends Version { | |||
| } | |||
| public static Geschlecht parseStringFromHL7(final String geschlecht) { | |||
| geschlecht.toLowerCase(); | |||
| if (geschlecht.startsWith("m")) { | |||
| return MALE; | |||
| } else if (geschlecht.startsWith("f")) { | |||
| return FEMALE; | |||
| } | |||
| return OTHER; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return geschlecht; | |||
| @@ -0,0 +1,79 @@ | |||
| package de.uniluebeck.mi.projmi6.model; | |||
| import javafx.beans.property.SimpleObjectProperty; | |||
| import javafx.collections.FXCollections; | |||
| 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 void setOpsCodes(ObservableList<OpsCode> opsCodes) { | |||
| this.opsCodesProperty().set(opsCodes); | |||
| } | |||
| public SimpleObjectProperty<ObservableList<OpsCode>> opsCodesProperty() { | |||
| return opsCodes; | |||
| } | |||
| public ObservableList<Icd10Code> getIcd10Codes() { | |||
| return icd10Codes.get(); | |||
| } | |||
| public void setIcd10Codes(ObservableList<Icd10Code> icd10Codes) { | |||
| this.icd10Codes.set(icd10Codes); | |||
| } | |||
| public SimpleObjectProperty<ObservableList<Icd10Code>> icd10CodesProperty() { | |||
| return icd10Codes; | |||
| } | |||
| public ObservableList<Station> getStationen() { | |||
| return stationen.get(); | |||
| } | |||
| public void setStationen(ObservableList<Station> stationen) { | |||
| FXCollections.sort(stationen); | |||
| this.stationen.set(stationen); | |||
| } | |||
| public SimpleObjectProperty<ObservableList<Station>> stationenProperty() { | |||
| return stationen; | |||
| } | |||
| public ObservableList<Mitarbeiter> getMitarbeiter() { | |||
| return mitarbeiter.get(); | |||
| } | |||
| public void setMitarbeiter(ObservableList<Mitarbeiter> mitarbeiter) { | |||
| FXCollections.sort(mitarbeiter); | |||
| this.mitarbeiter.set(mitarbeiter); | |||
| } | |||
| public SimpleObjectProperty<ObservableList<Mitarbeiter>> mitarbeiterProperty() { | |||
| return mitarbeiter; | |||
| } | |||
| public ObservableList<Kasse> getKassen() { | |||
| return kassen.get(); | |||
| } | |||
| public void setKassen(ObservableList<Kasse> kassen) { | |||
| this.kassen.set(kassen); | |||
| } | |||
| public SimpleObjectProperty<ObservableList<Kasse>> kassenProperty() { | |||
| return kassen; | |||
| } | |||
| } | |||
| @@ -6,63 +6,80 @@ import javafx.beans.property.SimpleStringProperty; | |||
| /** | |||
| * Created by 630030 on 12.11.15. | |||
| */ | |||
| public class Station { | |||
| public class Station implements Comparable { | |||
| private SimpleStringProperty bezeichnung = new SimpleStringProperty(this, "bezeichnung"); | |||
| private SimpleStringProperty bezeichnungLang = new SimpleStringProperty(this, "bezeichnungLang"); | |||
| private SimpleStringProperty station = new SimpleStringProperty(this, "station"); | |||
| private SimpleIntegerProperty stationstyp = new SimpleIntegerProperty( this, "stationstyp"); | |||
| private SimpleIntegerProperty stationstyp = new SimpleIntegerProperty(this, "stationstyp"); | |||
| private SimpleStringProperty abteilung = new SimpleStringProperty(this, "abteilung"); | |||
| public String getAbteilung() { | |||
| return abteilung.get(); | |||
| } | |||
| public String getBezeichnung() { | |||
| return bezeichnung.get(); | |||
| public void setAbteilung(String abteilung) { | |||
| this.abteilung.set(abteilung); | |||
| } | |||
| public SimpleStringProperty bezeichnungProperty() { | |||
| return bezeichnung; | |||
| public SimpleStringProperty abteilungProperty() { | |||
| return abteilung; | |||
| } | |||
| public String getBezeichnung() { | |||
| return bezeichnung.get(); | |||
| } | |||
| public void setBezeichnung(String bezeichnung) { | |||
| this.bezeichnung.set(bezeichnung); | |||
| } | |||
| public String getBezeichnungLang() { | |||
| return bezeichnungLang.get(); | |||
| public SimpleStringProperty bezeichnungProperty() { | |||
| return bezeichnung; | |||
| } | |||
| public SimpleStringProperty bezeichnungLangProperty() { | |||
| return bezeichnungLang; | |||
| public String getBezeichnungLang() { | |||
| return bezeichnungLang.get(); | |||
| } | |||
| public void setBezeichnungLang(String bezeichnungLang) { | |||
| this.bezeichnungLang.set(bezeichnungLang); | |||
| } | |||
| public String getStation() { | |||
| return station.get(); | |||
| public SimpleStringProperty bezeichnungLangProperty() { | |||
| return bezeichnungLang; | |||
| } | |||
| public SimpleStringProperty stationProperty() { | |||
| return station; | |||
| public String getStation() { | |||
| return station.get(); | |||
| } | |||
| public void setStation(String station) { | |||
| this.station.set(station); | |||
| } | |||
| public int getStationstyp() { | |||
| return stationstyp.get(); | |||
| public SimpleStringProperty stationProperty() { | |||
| return station; | |||
| } | |||
| public SimpleIntegerProperty stationstypProperty() { | |||
| return stationstyp; | |||
| public int getStationstyp() { | |||
| return stationstyp.get(); | |||
| } | |||
| public void setStationstyp(int stationstyp) { | |||
| this.stationstyp.set(stationstyp); | |||
| } | |||
| public SimpleIntegerProperty stationstypProperty() { | |||
| return stationstyp; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return getBezeichnung(); | |||
| } | |||
| @Override | |||
| public int compareTo(Object o) { | |||
| return bezeichnung.get().compareTo(((Station) o).getBezeichnung()); | |||
| } | |||
| } | |||
| @@ -12,33 +12,35 @@ public class StationsHistorie extends Version { | |||
| private SimpleObjectProperty<LocalDateTime> aufnahmeDatum = new SimpleObjectProperty<>(this, "aufnahmeDatum"); | |||
| private SimpleObjectProperty<LocalDateTime> entlassungsDatum = new SimpleObjectProperty<>(this, "entlassungsDatum"); | |||
| private Fall fall; | |||
| private int fallID; // platte Objektstruktur! | |||
| private Station station; | |||
| private String stationKey; // platte Objektstruktur! | |||
| private SimpleIntegerProperty StatHistID = new SimpleIntegerProperty(this, "stathistid"); | |||
| public LocalDateTime getAufnahmeDatum() { | |||
| return aufnahmeDatum.get(); | |||
| } | |||
| public SimpleObjectProperty<LocalDateTime> aufnahmeDatumProperty() { | |||
| return aufnahmeDatum; | |||
| } | |||
| public void setAufnahmeDatum(LocalDateTime aufnahmeDatum) { | |||
| this.aufnahmeDatum.set(aufnahmeDatum); | |||
| } | |||
| public LocalDateTime getEntlassungsDatum() { | |||
| return entlassungsDatum.get(); | |||
| public SimpleObjectProperty<LocalDateTime> aufnahmeDatumProperty() { | |||
| return aufnahmeDatum; | |||
| } | |||
| public SimpleObjectProperty<LocalDateTime> entlassungsDatumProperty() { | |||
| return entlassungsDatum; | |||
| public LocalDateTime getEntlassungsDatum() { | |||
| return entlassungsDatum.get(); | |||
| } | |||
| public void setEntlassungsDatum(LocalDateTime entlassungsDatum) { | |||
| this.entlassungsDatum.set(entlassungsDatum); | |||
| } | |||
| public SimpleObjectProperty<LocalDateTime> entlassungsDatumProperty() { | |||
| return entlassungsDatum; | |||
| } | |||
| public Fall getFall() { | |||
| return fall; | |||
| } | |||
| @@ -59,11 +61,27 @@ public class StationsHistorie extends Version { | |||
| return StatHistID.get(); | |||
| } | |||
| public void setStatHistID(int statHistID) { | |||
| this.StatHistID.set(statHistID); | |||
| } | |||
| public SimpleIntegerProperty statHistIDProperty() { | |||
| return StatHistID; | |||
| } | |||
| public void setStatHistID(int statHistID) { | |||
| this.StatHistID.set(statHistID); | |||
| public int getFallID() { | |||
| return fallID; | |||
| } | |||
| public void setFallID(int fallID) { | |||
| this.fallID = fallID; | |||
| } | |||
| public String getStationKey() { | |||
| return stationKey; | |||
| } | |||
| public void setStationKey(String stationKey) { | |||
| this.stationKey = stationKey; | |||
| } | |||
| } | |||
| @@ -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()); | |||
| //Make it large enough to read the text | |||
| btnNow.setMinWidth(50); | |||
| btnNow.getStyleClass().add("now-button"); | |||
| //Add the subcomponents to the view. | |||
| this.getChildren().addAll(datePicker,timePicker,btnNow); | |||
| this.setSpacing(5); | |||
| } | |||
| @@ -0,0 +1,4 @@ | |||
| /** | |||
| * View Klassen. | |||
| */ | |||
| package de.uniluebeck.mi.projmi6.view; | |||
| @@ -10,34 +10,20 @@ | |||
| <?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"> | |||
| <children> | |||
| <GridPane vgap="5.0" fx:id="fallFields"> | |||
| <GridPane vgap="5.0" fx:id="fallFields" id="fallFields"> | |||
| <children> | |||
| <Label text="Patient:"/> | |||
| <Label fx:id="fallPatID" text="John Doe (PatID = XXX)" GridPane.columnIndex="1"/> | |||
| <Label text="Aufnahmedatum:" GridPane.rowIndex="1"/> | |||
| <!-- <HBox prefHeight="100.0" prefWidth="200.0" spacing="5.0" GridPane.columnIndex="1" GridPane.rowIndex="1"> | |||
| <children> | |||
| <DatePicker fx:id="fallAufnDate"/> | |||
| <TextField fx:id="fallAufnTime" prefColumnCount="5" promptText="HH:MM"/> | |||
| <Button fx:id="btnFallAufnNow" mnemonicParsing="false" onAction="#clickedFallAufnNow" | |||
| text="Jetzt"/> | |||
| </children> | |||
| <GridPane.margin> | |||
| <Insets/> | |||
| </GridPane.margin> | |||
| </HBox>--> | |||
| <DateTimePicker GridPane.rowIndex="1" GridPane.columnIndex="1" fx:id="dtTmAufnahme" /> | |||
| <Label text="Entlassungsdatum:" GridPane.rowIndex="2"/> | |||
| <!--<HBox prefHeight="100.0" prefWidth="200.0" spacing="5.0" GridPane.columnIndex="1" GridPane.rowIndex="2"> | |||
| <children> | |||
| <DatePicker fx:id="fallEntlDate"/> | |||
| <TextField fx:id="fallEntlTime" prefColumnCount="5" promptText="HH:MM"/> | |||
| <Button fx:id="btnFallEntlNow" mnemonicParsing="false" onAction="#clickedFallEntlNow" | |||
| text="Jetzt"/> | |||
| </children> | |||
| </HBox>--> | |||
| <DateTimePicker GridPane.rowIndex="2" GridPane.columnIndex="1" fx:id="dtTmEntlassung" /> | |||
| <Label text="Versichertennummer:" GridPane.rowIndex="3"/> | |||
| <TextField fx:id="fallVersichertennummer" GridPane.columnIndex="1" GridPane.rowIndex="3"/> | |||
| <Label text="Einweisender Arzt:" GridPane.rowIndex="4"/> | |||
| <HBox alignment="CENTER_LEFT" spacing="5.0" GridPane.columnIndex="1" GridPane.rowIndex="4"> | |||
| <children> | |||
| @@ -46,11 +32,13 @@ | |||
| <CheckBox fx:id="fallSelbsteinweisung" mnemonicParsing="false" text="Selbsteinweisung"/> | |||
| </children> | |||
| </HBox> | |||
| <Label text="Fallart:" GridPane.rowIndex="5"/> | |||
| <ComboBox fx:id="fallFallart" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="5"/> | |||
| <Label text="Kasse:" GridPane.rowIndex="6"/> | |||
| <ComboBox fx:id="fallKasse" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="6"/> | |||
| <TextField fx:id="fallVersichertennummer" GridPane.columnIndex="1" GridPane.rowIndex="3"/> | |||
| <ComboBox fx:id="fallKasse" prefWidth="250.0" GridPane.columnIndex="1" GridPane.rowIndex="6"/> | |||
| <Label text="Hauptdiagnose:" GridPane.rowIndex="7"/> | |||
| <ComboBox fx:id="fallHauptdiagnose" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="7"/> | |||
| </children> | |||
| @@ -79,7 +67,16 @@ | |||
| <Insets right="5.0"/> | |||
| </HBox.margin> | |||
| </Button> | |||
| <Button fx:id="btnFallCancel" mnemonicParsing="false" onAction="#clickedFallCancel" text="Storno"/> | |||
| <Button fx:id="btnFallSendHl7" mnemonicParsing="false" onAction="#clickedSendHl7" text="Sende HL7"> | |||
| <HBox.margin> | |||
| <Insets left="5.0" right="5.0"/> | |||
| </HBox.margin> | |||
| </Button> | |||
| <Button fx:id="btnFallCancel" mnemonicParsing="false" onAction="#clickedFallCancel" text="Storno"> | |||
| <HBox.margin> | |||
| <Insets left="5.0" right="5.0"/> | |||
| </HBox.margin> | |||
| </Button> | |||
| <Button fx:id="btnFallAbort" cancelButton="true" mnemonicParsing="false" onAction="#clickedFallAbort" | |||
| text="Abbrechen"> | |||
| <HBox.margin> | |||
| @@ -99,8 +96,8 @@ | |||
| <children> | |||
| <Label styleClass="ersteller-label" text="Ersteller: "/> | |||
| <Label styleClass="ersteller-label" text="Erstelldatum:" GridPane.rowIndex="1"/> | |||
| <Label styleClass="ersteller-value" fx:id="fallCreator" text="Doc Holiday" GridPane.columnIndex="1"/> | |||
| <Label styleClass="ersteller-value" fx:id="fallCreateTime" text="12.01.2011 12:50" GridPane.columnIndex="1" | |||
| <Label styleClass="ersteller-value" fx:id="fallCreator" text="" GridPane.columnIndex="1"/> | |||
| <Label styleClass="ersteller-value" fx:id="fallCreateTime" text="" GridPane.columnIndex="1" | |||
| GridPane.rowIndex="1"/> | |||
| </children> | |||
| <columnConstraints> | |||
| @@ -124,8 +121,8 @@ | |||
| <children> | |||
| <Label styleClass="ersteller-label" text="Letzter Bearbeiter"/> | |||
| <Label styleClass="ersteller-label" text="Letzte Änderung:" GridPane.rowIndex="1"/> | |||
| <Label styleClass="ersteller-value" fx:id="fallEditor" text="Dr. House" GridPane.columnIndex="1"/> | |||
| <Label styleClass="ersteller-value" fx:id="fallEditTime" text="11.11.2011 11:11" GridPane.columnIndex="1" | |||
| <Label styleClass="ersteller-value" fx:id="fallEditor" text="" GridPane.columnIndex="1"/> | |||
| <Label styleClass="ersteller-value" fx:id="fallEditTime" text="" GridPane.columnIndex="1" | |||
| GridPane.rowIndex="1"/> | |||
| </children> | |||
| </GridPane> | |||
| @@ -27,7 +27,9 @@ | |||
| <Button fx:id="btnFallCreate" text="Neuen _Fall erstellen" onAction="#clickedCreateFall"/> | |||
| </items> | |||
| </ToolBar> | |||
| <ListView VBox.vgrow="ALWAYS" fx:id="lvFall" /> | |||
| <ListView VBox.vgrow="ALWAYS" fx:id="lvFall" > | |||
| <placeholder><Label fx:id="lvFallPlaceholder" /></placeholder> | |||
| </ListView> | |||
| </children> | |||
| </VBox> | |||
| <TabPane fx:id="tabPaneFall" prefHeight="200.0" prefWidth="200.0" tabClosingPolicy="UNAVAILABLE"> | |||
| @@ -1,23 +1,22 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <?import java.net.*?> | |||
| <?import javafx.geometry.*?> | |||
| <?import javafx.scene.text.*?> | |||
| <?import javafx.scene.control.*?> | |||
| <?import java.lang.*?> | |||
| <?import javafx.scene.layout.*?> | |||
| <?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> | |||
| <GridPane> | |||
| <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> | |||
| <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" /> | |||
| @@ -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 maxHeight="1.7976931348623157E308" minHeight="10.0" vgrow="SOMETIMES" /> | |||
| </rowConstraints> | |||
| <children> | |||
| <Label text="PatID:" /> | |||
| <Label fx:id="patId" text="xxxx" GridPane.columnIndex="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" /> | |||
| <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" /> | |||
| <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> | |||
| <VBox.margin> | |||
| @@ -105,8 +115,8 @@ | |||
| <children> | |||
| <Label styleClass="ersteller-label" text="Ersteller: " GridPane.rowIndex="0" /> | |||
| <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> | |||
| <columnConstraints> | |||
| <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="50.0" /> | |||
| @@ -123,19 +133,19 @@ | |||
| <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> | |||
| </columnConstraints> | |||
| <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> | |||
| <children> | |||
| <Label styleClass="ersteller-label" text="Letzter Bearbeiter:" GridPane.rowIndex="0" /> | |||
| <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> | |||
| </GridPane> | |||
| </children> | |||
| <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> | |||
| </GridPane> | |||
| </children> | |||
| @@ -17,6 +17,8 @@ | |||
| <items> | |||
| <Button fx:id="btnPatCreate" text="Neuen _Patient erstellen" onAction="#clickedCreatePatient" /> | |||
| <Button fx:id="btnPatEdit" text="Patient _bearbeiten" onAction="#clickedEditPatient"/> | |||
| <Pane HBox.hgrow="ALWAYS" /> | |||
| <Button fx:id="btnPatRefresh" text="Liste aktualisieren" onAction="#clickedRefreshPatient"/> | |||
| </items> | |||
| </ToolBar> | |||
| <TableView fx:id="tblPatientOverview" editable="true" tableMenuButtonVisible="true" VBox.vgrow="ALWAYS"> | |||
| @@ -56,9 +58,10 @@ | |||
| <children> | |||
| <ToolBar prefHeight="40.0" prefWidth="200.0"> | |||
| <items> | |||
| <Label text="Station:" /> | |||
| <ComboBox fx:id="cmbStationenFilter" prefWidth="150.0" promptText="Stationen" /> | |||
| <ComboBox fx:id="cmbStationenFilter" prefWidth="250.0" promptText="Station auswählen..." /> | |||
| <ToggleButton fx:id="btnEntlassenePatientenZeigen" mnemonicParsing="false" text="Entlassene Patienten zeigen" /> | |||
| <Pane HBox.hgrow="ALWAYS" /> | |||
| <Button fx:id="btnStatRefresh" text="Liste aktualisieren" onAction="#clickedRefreshStation"/> | |||
| </items> | |||
| </ToolBar> | |||
| <SplitPane prefHeight="160.0" prefWidth="200.0" VBox.vgrow="ALWAYS"> | |||
| @@ -16,22 +16,24 @@ | |||
| <children> | |||
| <ToolBar prefHeight="40.0" prefWidth="200.0"> | |||
| <items> | |||
| <Button mnemonicParsing="false" text="Neuen Aufenthalt erstellen" onAction="#clickedCreateAufenthalt"/> | |||
| <Button mnemonicParsing="false" text="Neuen Aufenthalt erstellen" fx:id="btnStatHistCreate" onAction="#clickedCreateAufenthalt"/> | |||
| </items> | |||
| </ToolBar> | |||
| <TableView prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" fx:id="tblStationsHistorie"> | |||
| <TableView prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" fx:id="tblStationsHistorie" > | |||
| <columns> | |||
| <TableColumn prefWidth="75.0" text="Abteilung" fx:id="colStatHistAbteilung"/> | |||
| <TableColumn prefWidth="75.0" text="Station" fx:id="colStatHistStation"/> | |||
| <TableColumn prefWidth="75.0" text="Aufnahme" fx:id="colStatHistAufnahmeDatum"/> | |||
| <TableColumn prefWidth="75.0" text="Entlassung" fx:id="colStatHistEntlassungsDatum"/> | |||
| </columns> | |||
| <columnResizePolicy> | |||
| <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /> | |||
| </columnResizePolicy> | |||
| </TableView> | |||
| </children> | |||
| </VBox> | |||
| <VBox> | |||
| <children> | |||
| <GridPane VBox.vgrow="ALWAYS"> | |||
| <GridPane VBox.vgrow="ALWAYS" fx:id="fields"> | |||
| <columnConstraints> | |||
| <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/> | |||
| <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/> | |||
| @@ -44,17 +46,22 @@ | |||
| </rowConstraints> | |||
| <children> | |||
| <Label text="Abteilung:"/> | |||
| <ComboBox prefWidth="150.0" GridPane.columnIndex="1" fx:id="cmbAbteilung"/> | |||
| <Label text="Station:" GridPane.rowIndex="1"/> | |||
| <ComboBox prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="1" fx:id="cmbStation"/> | |||
| <Label text="Aufnahmedatum / -Zeit:" GridPane.rowIndex="2" /> | |||
| <DateTimePicker GridPane.columnIndex="1" GridPane.rowIndex="2" fx:id="dtTmAufnahme"/> | |||
| <Label text="Entlassungsdatum/ -Zeit:" GridPane.rowIndex="3"/> | |||
| <DateTimePicker GridPane.columnIndex="1" GridPane.rowIndex="3" fx:id="dtTmEntlassung"/> | |||
| <ComboBox prefWidth="150.0" GridPane.columnIndex="1"/> | |||
| <ComboBox prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="1"/> | |||
| </children> | |||
| </GridPane> | |||
| <HBox alignment="CENTER_RIGHT"> | |||
| <children> | |||
| <Button mnemonicParsing="false" text="Bearbeiten" onAction="#clickedEdit" fx:id="btnStatHistEdit"/> | |||
| <Button mnemonicParsing="false" text="Abbrechen" onAction="#clickedAbort" fx:id="btnStatHistAbort"/> | |||
| <Button mnemonicParsing="false" text="Speichern" onAction="#clickedSave" fx:id="btnStatHistSave"/> | |||
| <Button disable="true" mnemonicParsing="false" text="Eintrag entfernen" fx:id="btnStatHistCancel" onAction="#clickedCancel"/> | |||
| </children> | |||
| @@ -4,4 +4,44 @@ | |||
| .ersteller-value { | |||
| /* -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; | |||
| } | |||