| @@ -2,9 +2,7 @@ package de.uniluebeck.mi.projmi6; | |||||
| import de.uniluebeck.mi.projmi6.controller.MainController; | import de.uniluebeck.mi.projmi6.controller.MainController; | ||||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | import de.uniluebeck.mi.projmi6.db.DBHandler; | ||||
| import de.uniluebeck.mi.projmi6.model.Kasse; | |||||
| import de.uniluebeck.mi.projmi6.model.Mitarbeiter; | |||||
| import de.uniluebeck.mi.projmi6.model.OpsCode; | |||||
| import de.uniluebeck.mi.projmi6.hapi2.HL7Server2; | |||||
| import javafx.application.Application; | import javafx.application.Application; | ||||
| import javafx.beans.property.ReadOnlyStringProperty; | import javafx.beans.property.ReadOnlyStringProperty; | ||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||
| @@ -14,7 +12,6 @@ import javafx.geometry.Insets; | |||||
| import javafx.geometry.Pos; | import javafx.geometry.Pos; | ||||
| import javafx.scene.Parent; | import javafx.scene.Parent; | ||||
| import javafx.scene.Scene; | import javafx.scene.Scene; | ||||
| import javafx.scene.control.ProgressIndicator; | |||||
| import javafx.scene.image.Image; | import javafx.scene.image.Image; | ||||
| import javafx.scene.image.ImageView; | import javafx.scene.image.ImageView; | ||||
| import javafx.scene.layout.Background; | import javafx.scene.layout.Background; | ||||
| @@ -72,6 +69,11 @@ public class Main extends Application { | |||||
| Parent root = fxmlLoader.load(); | Parent root = fxmlLoader.load(); | ||||
| // TODO: Jojo, das muss irgendwie am ende noch geschlossen werden! | |||||
| HL7Server2 hl7server = new HL7Server2(mainController); | |||||
| //hl7server.stop(); | |||||
| //hl7server.shutdown(); | |||||
| return root; | return root; | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -81,6 +83,14 @@ public class Main extends Application { | |||||
| */ | */ | ||||
| private Image icon = new Image("icon.png", true); | private Image icon = new Image("icon.png", true); | ||||
| /** | |||||
| * Applications entry point. | |||||
| * | |||||
| * @param args Commandline parameters | |||||
| */ | |||||
| public static void main(String[] args) { | |||||
| launch(args); | |||||
| } | |||||
| @Override | @Override | ||||
| public void start(Stage primaryStage) { | public void start(Stage primaryStage) { | ||||
| @@ -117,7 +127,7 @@ public class Main extends Application { | |||||
| * | * | ||||
| * @return the splash screen | * @return the splash screen | ||||
| */ | */ | ||||
| public Stage createLoadWindow(ReadOnlyStringProperty progressMessage){ | |||||
| public Stage createLoadWindow(ReadOnlyStringProperty progressMessage) { | |||||
| Text kis = new Text("KIS"); | Text kis = new Text("KIS"); | ||||
| kis.setFont(Font.font(50)); | kis.setFont(Font.font(50)); | ||||
| @@ -127,7 +137,7 @@ public class Main extends Application { | |||||
| Text progress = new Text(); | Text progress = new Text(); | ||||
| progress.textProperty().bind(progressMessage); | progress.textProperty().bind(progressMessage); | ||||
| VBox root = new VBox(gruppe6, new ImageView(icon), kis, progress); | |||||
| VBox root = new VBox(gruppe6, new ImageView(icon), kis, progress); | |||||
| root.setSpacing(20); | root.setSpacing(20); | ||||
| root.setAlignment(Pos.CENTER); | root.setAlignment(Pos.CENTER); | ||||
| Scene scene = new Scene(root, 400, 500); | Scene scene = new Scene(root, 400, 500); | ||||
| @@ -140,13 +150,4 @@ public class Main extends Application { | |||||
| return stage; | return stage; | ||||
| } | } | ||||
| /** | |||||
| * Applications entry point. | |||||
| * | |||||
| * @param args Commandline parameters | |||||
| */ | |||||
| public static void main(String[] args) { | |||||
| launch(args); | |||||
| } | |||||
| } | } | ||||
| @@ -155,6 +155,7 @@ public class DBHandler { | |||||
| "`FallID`) " + | "`FallID`) " + | ||||
| "VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; | "VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; | ||||
| private static final String DELETE_STATHIST = "DELETE FROM `stationshistorie` WHERE `StatHistID` =?"; | private static final String DELETE_STATHIST = "DELETE FROM `stationshistorie` WHERE `StatHistID` =?"; | ||||
| private static final String SELECT_FALLIDS_BY_PATID = "SELECT `fallid` FROM `fall` WHERE `patientid` =?"; | |||||
| private DBHandler() { | private DBHandler() { | ||||
| @@ -841,4 +842,16 @@ public class DBHandler { | |||||
| entry.setSource(rs.getString("source")); | entry.setSource(rs.getString("source")); | ||||
| return entry; | return entry; | ||||
| } | } | ||||
| public static List<Integer> getAlleFallIdsByPatID(int patid) throws SQLException { | |||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_FALLIDS_BY_PATID); | |||||
| statement.setInt(1, patid); | |||||
| ResultSet rs = statement.executeQuery(); | |||||
| List<Integer> fallids = new ArrayList<>(); | |||||
| while (rs.next()) { | |||||
| fallids.add(rs.getInt("fallid")); | |||||
| } | |||||
| return fallids; | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,245 @@ | |||||
| package de.uniluebeck.mi.projmi6.hapi2; | |||||
| import ca.uhn.hl7v2.AcknowledgmentCode; | |||||
| import ca.uhn.hl7v2.ErrorCode; | |||||
| import ca.uhn.hl7v2.HL7Exception; | |||||
| import ca.uhn.hl7v2.model.AbstractMessage; | |||||
| import ca.uhn.hl7v2.model.Message; | |||||
| import ca.uhn.hl7v2.model.v251.group.BAR_P05_PROCEDURE; | |||||
| import ca.uhn.hl7v2.model.v251.group.BAR_P05_VISIT; | |||||
| 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.protocol.ReceivingApplication; | |||||
| import ca.uhn.hl7v2.protocol.ReceivingApplicationException; | |||||
| import de.uniluebeck.mi.projmi6.controller.MainController; | |||||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | |||||
| import de.uniluebeck.mi.projmi6.model.*; | |||||
| import java.io.IOException; | |||||
| import java.sql.SQLException; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * Created by nils on 20.11.2015. | |||||
| */ | |||||
| public class HL7Receiver2<T extends AbstractMessage> implements ReceivingApplication { | |||||
| private final Class<T> type; | |||||
| private final MainController mainctrl; | |||||
| public HL7Receiver2(Class<T> type, MainController mainctrl) { | |||||
| this.type = type; | |||||
| this.mainctrl = mainctrl; | |||||
| } | |||||
| @Override | |||||
| public Message processMessage(Message message, Map<String, Object> metadata) throws ReceivingApplicationException, HL7Exception { | |||||
| if (type == ADT_A01.class) { | |||||
| return processADT_A01(message, metadata); | |||||
| } | |||||
| if (type == BAR_P05.class) { | |||||
| return processBAR_P05(message, metadata); | |||||
| } | |||||
| // TODO: Handle unknown Messages, maybe write to database, send ACK and go on. | |||||
| try { | |||||
| return message.generateACK(); | |||||
| } catch (IOException e) { | |||||
| throw new HL7Exception(e); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public boolean canProcess(Message message) { | |||||
| // TODO: Erstmal alles processen. | |||||
| return true; | |||||
| } | |||||
| private Message generateACK(Message message) throws HL7Exception { | |||||
| try { | |||||
| return message.generateACK(); | |||||
| } catch (IOException e) { | |||||
| throw new HL7Exception(e); | |||||
| } | |||||
| } | |||||
| private Message generateACKWithAR(Message message, String s) throws HL7Exception { | |||||
| try { | |||||
| return message.generateACK(AcknowledgmentCode.AR, new HL7Exception(s, ErrorCode.UNKNOWN_KEY_IDENTIFIER)); | |||||
| } catch (IOException e) { | |||||
| throw new HL7Exception(e); | |||||
| } | |||||
| } | |||||
| private Message processBAR_P05(Message message, Map<String, Object> metadata) throws HL7Exception { | |||||
| BAR_P05 bar_p05 = (BAR_P05) message; | |||||
| MSH msh = bar_p05.getMSH(); | |||||
| PID pid = bar_p05.getPID(); | |||||
| int patid = Integer.parseInt(pid.getPatientID().encode()); | |||||
| Patient patient = mainctrl.getStammdaten().getPatienten().stream().filter(p -> p.getPatID() == patid).findFirst().orElse(null); | |||||
| if (patient == null) { | |||||
| return generateACKWithAR(message, "Patient nicht gefunden."); | |||||
| } | |||||
| List<BAR_P05_VISIT> visits = bar_p05.getVISITAll(); | |||||
| // Ab hier wird es dirty. | |||||
| for (BAR_P05_VISIT visit : visits) { | |||||
| PV1 pv1 = visit.getPV1(); | |||||
| int fallid = Integer.parseInt(pv1.getVisitNumber().encode()); | |||||
| List<Integer> fallids = new ArrayList<>(); | |||||
| try { | |||||
| fallids = DBHandler.getAlleFallIdsByPatID(patient.getPatID()); | |||||
| } catch (SQLException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| if (fallids.isEmpty() || !fallids.contains(fallid)) { | |||||
| return generateACKWithAR(message, "Fall nicht gefunden."); | |||||
| } | |||||
| Fall fall = new Fall(); | |||||
| fall.setFallID(fallid); | |||||
| fall.setPatient(patient); | |||||
| List<Diagnose> diagnosen = new ArrayList<>(); | |||||
| List<Untersuchung> untersuchungen = new ArrayList<>(); | |||||
| // Station(PV1-3-1), Fachabteilung(PV1-3-4), Aufnahmedatum(PV1-44), Entlassungsdatum(PV1-45), Fallnummer(PV1-19) | |||||
| Station station = new Station(); | |||||
| station.setStation(pv1.getAssignedPatientLocation().getPointOfCare().encode()); | |||||
| station.setAbteilung(pv1.getAssignedPatientLocation().getFacility().encode()); | |||||
| StationsHistorie hist = new StationsHistorie(); | |||||
| hist.setStationKey(station.getStation()); | |||||
| hist.setAufnahmeDatum(HL7Util2.parseLocalDateTime(pv1.getAdmitDateTime().getTime())); | |||||
| hist.setEntlassungsDatum(HL7Util2.parseLocalDateTime(pv1.getDischargeDateTime()[0].getTime())); // TODO: null? | |||||
| hist.setFallID(fallid); | |||||
| List<DG1> dg1s = visit.getDG1All(); | |||||
| for (DG1 dg1 : dg1s) { | |||||
| Diagnose diagnose = new Diagnose(); | |||||
| diagnose.setErsteller(99999); | |||||
| diagnose.setBearbeiter(99999); | |||||
| diagnose.setFall(fall); | |||||
| String icd10 = dg1.getDiagnosisCodeDG1().getIdentifier().encode(); | |||||
| Icd10Code icd10code = mainctrl.getStammdaten().getIcd10Codes().stream().filter(i -> i.getCode().equals(icd10)).findFirst().orElse(null); | |||||
| if (icd10code == null) { | |||||
| // TODO: Oder einfach ueberspringen? | |||||
| continue; | |||||
| // TODO: Behandeln von sonder Codes. K35.9V (Verdacht...) | |||||
| // return generateACKWithAR(message, "ICD10 Code nicht gefunden."); | |||||
| } | |||||
| diagnose.setIcd10code(icd10code); | |||||
| // Mitarbeiter ID anhand von EinweisenderArzt erkennen. | |||||
| Mitarbeiter mitarbeiter; | |||||
| if (dg1.getDiagnosingClinician().length != 0) { | |||||
| String einweisenderarzt = dg1.getDiagnosingClinician(0).encode(); // Wir holen uns immer den ersten der verantwortlichen Aerzte... // (DG1-16) | |||||
| mitarbeiter = mainctrl.getStammdaten().getMitarbeiter().stream().filter(m -> m.getEinweisenderArzt().equals(einweisenderarzt)).findFirst().orElse(null); | |||||
| if (mitarbeiter == null) { | |||||
| return generateACKWithAR(message, "Mitarbeiter nicht gefunden."); | |||||
| } | |||||
| } else { | |||||
| mitarbeiter = new Mitarbeiter(99999); | |||||
| } | |||||
| diagnose.setArzt(mitarbeiter); | |||||
| // (DG1-6) // TODO: Enum umstellen? Neeee... | |||||
| String diagart = dg1.getDiagnosisType().encode(); | |||||
| switch (diagart) { | |||||
| case "A": | |||||
| diagnose.setDiagArt(DiagArt.EINWEISUNG); | |||||
| break; | |||||
| case "F": | |||||
| diagnose.setDiagArt(DiagArt.ENTLASSUNG); | |||||
| break; | |||||
| case "W": | |||||
| default: | |||||
| diagnose.setDiagArt(DiagArt.VERDACHT); | |||||
| } | |||||
| diagnosen.add(diagnose); | |||||
| } | |||||
| List<BAR_P05_PROCEDURE> procedures = visit.getPROCEDUREAll(); | |||||
| for (BAR_P05_PROCEDURE procedure : procedures) { | |||||
| PR1 pr1 = procedure.getPR1(); | |||||
| Untersuchung untersuchung = new Untersuchung(); | |||||
| untersuchung.setErsteller(99999); | |||||
| untersuchung.setBearbeiter(99999); | |||||
| untersuchung.setFall(fall); | |||||
| String ops = pr1.getProcedureCode().encode(); | |||||
| OpsCode opscode = mainctrl.getStammdaten().getOpsCodes().stream().filter(o -> o.getOpsCode().equals(ops)).findFirst().orElse(null); | |||||
| if (opscode == null) { | |||||
| // TODO: Oder einfach ueberspringen? | |||||
| continue; | |||||
| // TODO: Behandeln von sonder Codes. | |||||
| // return generateACKWithAR(message, "OPS Code nicht gefunden."); | |||||
| } | |||||
| untersuchung.setOpscode(opscode); | |||||
| untersuchung.setUntersuchungsdatum(HL7Util2.parseLocalDateTime(pr1.getProcedureDateTime().getTime())); | |||||
| // Mitarbeiter ID anhand von EinweisenderArzt erkennen. | |||||
| Mitarbeiter mitarbeiter; | |||||
| if (pr1.getProcedurePractitioner().length != 0) { | |||||
| String einweisenderarzt = pr1.getProcedurePractitioner(0).encode(); // Wir holen uns immer den ersten der verantwortlichen Aerzte... | |||||
| mitarbeiter = mainctrl.getStammdaten().getMitarbeiter().stream().filter(m -> m.getEinweisenderArzt().equals(einweisenderarzt)).findFirst().orElse(null); | |||||
| if (mitarbeiter == null) { | |||||
| return generateACKWithAR(message, "Mitarbeiter nicht gefunden."); | |||||
| } | |||||
| } else { | |||||
| mitarbeiter = new Mitarbeiter(99999); | |||||
| } | |||||
| untersuchung.setDurchfuehrenderArzt(mitarbeiter); | |||||
| untersuchungen.add(untersuchung); | |||||
| } | |||||
| // Hier jeweils Untersuchung und Diagnose in die Datenbank schreiben. | |||||
| diagnosen.forEach(d -> { | |||||
| try { | |||||
| DBHandler.setDiagnose(d); | |||||
| } catch (SQLException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| }); | |||||
| untersuchungen.forEach(u -> { | |||||
| try { | |||||
| DBHandler.setUntersuchung(u, 99999, false); | |||||
| } catch (SQLException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| }); | |||||
| } | |||||
| // HL7 Nachricht loggen. | |||||
| try { | |||||
| String sendind_ip = metadata.get("SENDING_IP").toString(); | |||||
| String sendind_port = metadata.get("SENDING_PORT").toString(); | |||||
| DBHandler.setHL7Nachricht(message.encode(), HL7Util2.parseLocalDateTime(msh.getDateTimeOfMessage().getTime()), sendind_ip + ":" + sendind_port); | |||||
| } catch (SQLException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return generateACK(message); | |||||
| } | |||||
| private Message processADT_A01(Message message, Map<String, Object> metadata) throws HL7Exception { | |||||
| ADT_A01 adt_a01 = (ADT_A01) message; | |||||
| System.out.println(adt_a01.toString()); | |||||
| return generateACK(message); | |||||
| } | |||||
| } | |||||
| @@ -1,160 +0,0 @@ | |||||
| package de.uniluebeck.mi.projmi6.hapi2; | |||||
| import ca.uhn.hl7v2.AcknowledgmentCode; | |||||
| import ca.uhn.hl7v2.ErrorCode; | |||||
| import ca.uhn.hl7v2.HL7Exception; | |||||
| import ca.uhn.hl7v2.model.AbstractMessage; | |||||
| import ca.uhn.hl7v2.model.Message; | |||||
| import ca.uhn.hl7v2.model.v251.group.BAR_P05_PROCEDURE; | |||||
| import ca.uhn.hl7v2.model.v251.group.BAR_P05_VISIT; | |||||
| 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.protocol.ReceivingApplication; | |||||
| import ca.uhn.hl7v2.protocol.ReceivingApplicationException; | |||||
| import de.uniluebeck.mi.projmi6.model.*; | |||||
| import java.io.IOException; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * Created by nils on 20.11.2015. | |||||
| */ | |||||
| public class HL7Recever2<T extends AbstractMessage> implements ReceivingApplication { | |||||
| private final Class<T> type; | |||||
| public HL7Recever2(Class<T> type) { | |||||
| this.type = type; | |||||
| } | |||||
| @Override | |||||
| public Message processMessage(Message message, Map<String, Object> metadata) throws ReceivingApplicationException, HL7Exception { | |||||
| if (type == ADT_A01.class) { | |||||
| return processADT_A01(message, metadata); | |||||
| } | |||||
| if (type == BAR_P05.class) { | |||||
| return processBAR_P05(message, metadata); | |||||
| } | |||||
| // TODO: Handle unknown Messages, maybe write to database, sen ACK and go on. | |||||
| try { | |||||
| return message.generateACK(); | |||||
| } catch (IOException e) { | |||||
| throw new HL7Exception(e); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public boolean canProcess(Message message) { | |||||
| // TODO: Erstmal alles processen. | |||||
| return true; | |||||
| } | |||||
| private Message generateACK(Message message) throws HL7Exception { | |||||
| try { | |||||
| return message.generateACK(); | |||||
| } catch (IOException e) { | |||||
| throw new HL7Exception(e); | |||||
| } | |||||
| } | |||||
| private Message generateACKWithAR(Message message, String s) throws HL7Exception { | |||||
| try { | |||||
| return message.generateACK(AcknowledgmentCode.AR, new HL7Exception(s, ErrorCode.TABLE_VALUE_NOT_FOUND)); | |||||
| } catch (IOException e) { | |||||
| throw new HL7Exception(e); | |||||
| } | |||||
| } | |||||
| private Message processBAR_P05(Message message, Map<String, Object> metadata) throws HL7Exception { | |||||
| Patient patient = new Patient(); | |||||
| List<Fall> faelle = new ArrayList<>(); | |||||
| List<Untersuchung> ALLE_UNTERSUCHUNGEN = new ArrayList<>(); | |||||
| List<Diagnose> ALLE_DIAGNOSEN = new ArrayList<>(); | |||||
| BAR_P05 bar_p05 = (BAR_P05) message; | |||||
| MSH msh = bar_p05.getMSH(); | |||||
| PID pid = bar_p05.getPID(); | |||||
| patient.setPatID(Integer.parseInt(pid.getPatientID().encode())); | |||||
| List<BAR_P05_VISIT> visits = bar_p05.getVISITAll(); | |||||
| // Ab hier wird es dirty. | |||||
| for (BAR_P05_VISIT visit : visits) { | |||||
| Fall fall = new Fall(); | |||||
| fall.setPatient(patient); | |||||
| List<Diagnose> diagnosen = new ArrayList<>(); | |||||
| List<Untersuchung> untersuchungen = new ArrayList<>(); | |||||
| PV1 pv1 = visit.getPV1(); | |||||
| // TODO: Extract Station(PV1-3-1),Fachabteilung(PV1-3-4),Aufnahmedatum(PV1-44),Entlassungsdatum(PV1-45),Fallnummer(PV1-19) | |||||
| Station station = new Station(); | |||||
| station.setStation(pv1.getAssignedPatientLocation().getPointOfCare().encode()); | |||||
| station.setAbteilung(pv1.getAssignedPatientLocation().getFacility().encode()); | |||||
| StationsHistorie hist = new StationsHistorie(); | |||||
| hist.setStationKey(station.getStation()); | |||||
| hist.setAufnahmeDatum(HL7Util2.parseLocalDateTime(pv1.getAdmitDateTime().getTime())); | |||||
| hist.setEntlassungsDatum(HL7Util2.parseLocalDateTime(pv1.getDischargeDateTime()[0].getTime())); | |||||
| fall.setFallID(Integer.parseInt(pv1.getVisitNumber().encode())); | |||||
| List<DG1> dg1s = visit.getDG1All(); | |||||
| for (DG1 dg1 : dg1s) { | |||||
| Icd10Code icd10code = new Icd10Code(dg1.getDiagnosisCodeDG1().getIdentifier().encode(), "", 20); // TODO: Version hard gecoded. | |||||
| // TODO: Mitarbeiter ID anhand von EinweisenderArzt erkennen! | |||||
| String einweisenderarzt = dg1.getDiagnosingClinician(0).encode(); // TODO: Wir holen uns immer den ersten der verantwortlichen Aerzte... | |||||
| int mitarbid = 1000; // TODO: SQL: SELECT * FROM Mitarbeiter WHERE einweisenderarzt = ... | |||||
| Mitarbeiter mitarbeiter = new Mitarbeiter(mitarbid); | |||||
| Diagnose diagnose = new Diagnose(); | |||||
| diagnose.setIcd10code(icd10code); | |||||
| diagnose.setArzt(mitarbeiter); // TODO: (DG1-16) | |||||
| diagnose.setFall(fall); | |||||
| // diagnose.setDiagArt(); // TODO: (DG1-6) // Enum umstellen???? | |||||
| diagnosen.add(diagnose); | |||||
| } | |||||
| List<BAR_P05_PROCEDURE> procedures = visit.getPROCEDUREAll(); | |||||
| for (BAR_P05_PROCEDURE procedure : procedures) { | |||||
| PR1 pr1 = procedure.getPR1(); | |||||
| Untersuchung untersuchung = new Untersuchung(); | |||||
| untersuchung.setFall(fall); | |||||
| OpsCode opscode = new OpsCode(pr1.getProcedureCode().encode(), "", 20); // TODO: Version hardcoded... | |||||
| untersuchung.setOpscode(opscode); | |||||
| untersuchung.setUntersuchungsdatum(HL7Util2.parseLocalDateTime(pr1.getProcedureDateTime().getTime())); | |||||
| String einweisenderarzt = pr1.getPr112_ProcedurePractitioner(0).encode(); // TODO: Wieder nur den ersten Arzt.. | |||||
| int mitarbid = 1000; // TODO: Siehe oben | |||||
| untersuchung.setDurchfuehrenderArzt(new Mitarbeiter(mitarbid)); | |||||
| // TODO: Extract OPS(3), Zeitpunkt(5), Arzt(12) | |||||
| untersuchungen.add(untersuchung); | |||||
| } | |||||
| // TODO: hier jeweils Fall, Untersuchung und Diagnosen in die Datenbank schreiben... | |||||
| faelle.add(fall); | |||||
| ALLE_DIAGNOSEN.addAll(diagnosen); | |||||
| ALLE_UNTERSUCHUNGEN.addAll(untersuchungen); | |||||
| } | |||||
| return generateACK(message); | |||||
| } | |||||
| private Message processADT_A01(Message message, Map<String, Object> metadata) throws HL7Exception { | |||||
| ADT_A01 adt_a01 = (ADT_A01) message; | |||||
| System.out.println(adt_a01.toString()); | |||||
| return generateACK(message); | |||||
| } | |||||
| } | |||||
| @@ -5,6 +5,7 @@ import ca.uhn.hl7v2.HapiContext; | |||||
| import ca.uhn.hl7v2.app.HL7Service; | import ca.uhn.hl7v2.app.HL7Service; | ||||
| import ca.uhn.hl7v2.model.v251.message.ADT_A01; | import ca.uhn.hl7v2.model.v251.message.ADT_A01; | ||||
| import ca.uhn.hl7v2.model.v251.message.BAR_P05; | import ca.uhn.hl7v2.model.v251.message.BAR_P05; | ||||
| import de.uniluebeck.mi.projmi6.controller.MainController; | |||||
| import java.util.concurrent.ArrayBlockingQueue; | import java.util.concurrent.ArrayBlockingQueue; | ||||
| import java.util.concurrent.ThreadPoolExecutor; | import java.util.concurrent.ThreadPoolExecutor; | ||||
| @@ -20,7 +21,7 @@ public class HL7Server2 { | |||||
| private final HL7Service server; | private final HL7Service server; | ||||
| private final ThreadPoolExecutor executor; | private final ThreadPoolExecutor executor; | ||||
| public HL7Server2() throws InterruptedException { | |||||
| public HL7Server2(MainController mainctrl) throws InterruptedException { | |||||
| executor = new ThreadPoolExecutor(10, 100, 30, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(100)); | executor = new ThreadPoolExecutor(10, 100, 30, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(100)); | ||||
| executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); | executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); | ||||
| @@ -28,8 +29,8 @@ public class HL7Server2 { | |||||
| context.setExecutorService(executor); | context.setExecutorService(executor); | ||||
| server = context.newServer(PORT, false); | server = context.newServer(PORT, false); | ||||
| server.registerApplication("ADT", "A01", new HL7Recever2<ADT_A01>(ADT_A01.class)); | |||||
| server.registerApplication("BAR", "P05", new HL7Recever2<BAR_P05>(BAR_P05.class)); | |||||
| server.registerApplication("ADT", "A01", new HL7Receiver2<ADT_A01>(ADT_A01.class, mainctrl)); | |||||
| server.registerApplication("BAR", "P05", new HL7Receiver2<BAR_P05>(BAR_P05.class, mainctrl)); | |||||
| server.registerConnectionListener(new HL7ConnectionListener2()); | server.registerConnectionListener(new HL7ConnectionListener2()); | ||||
| server.setExceptionHandler(new HL7ExceptionHandler2()); | server.setExceptionHandler(new HL7ExceptionHandler2()); | ||||
| @@ -40,7 +41,7 @@ public class HL7Server2 { | |||||
| // TODO: Remove, for testing purpose only! | // TODO: Remove, for testing purpose only! | ||||
| public static void main(String[] args) throws InterruptedException { | public static void main(String[] args) throws InterruptedException { | ||||
| HL7Server2 srv = new HL7Server2(); | |||||
| HL7Server2 srv = new HL7Server2(null); | |||||
| for (; ; ) { | for (; ; ) { | ||||
| } | } | ||||