| @@ -2,7 +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.hapi2.HL7Server2; | |||||
| import de.uniluebeck.mi.projmi6.hapi.HL7Server; | |||||
| 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; | ||||
| @@ -27,7 +27,7 @@ import javafx.stage.StageStyle; | |||||
| public class Main extends Application { | public class Main extends Application { | ||||
| private HL7Server2 server; | |||||
| private HL7Server server; | |||||
| /** | /** | ||||
| * Cuz building the GUI from FXML is a bit costly, | * Cuz building the GUI from FXML is a bit costly, | ||||
| @@ -73,7 +73,7 @@ public class Main extends Application { | |||||
| Parent root = fxmlLoader.load(); | Parent root = fxmlLoader.load(); | ||||
| // TODO: Jojo, das muss irgendwie am ende noch geschlossen werden! | // TODO: Jojo, das muss irgendwie am ende noch geschlossen werden! | ||||
| server = new HL7Server2(mainController); | |||||
| server = new HL7Server(mainController); | |||||
| return root; | return root; | ||||
| } | } | ||||
| @@ -1,4 +1,4 @@ | |||||
| package de.uniluebeck.mi.projmi6.hapi2; | |||||
| package de.uniluebeck.mi.projmi6.hapi; | |||||
| import ca.uhn.hl7v2.app.Connection; | import ca.uhn.hl7v2.app.Connection; | ||||
| import ca.uhn.hl7v2.app.ConnectionListener; | import ca.uhn.hl7v2.app.ConnectionListener; | ||||
| @@ -6,7 +6,7 @@ import ca.uhn.hl7v2.app.ConnectionListener; | |||||
| /** | /** | ||||
| * Created by nils on 20.11.2015. | * Created by nils on 20.11.2015. | ||||
| */ | */ | ||||
| class HL7ConnectionListener2 implements ConnectionListener { | |||||
| class HL7ConnectionListener implements ConnectionListener { | |||||
| @Override | @Override | ||||
| public void connectionReceived(Connection c) { | public void connectionReceived(Connection c) { | ||||
| @@ -1,4 +1,4 @@ | |||||
| package de.uniluebeck.mi.projmi6.hapi2; | |||||
| package de.uniluebeck.mi.projmi6.hapi; | |||||
| import ca.uhn.hl7v2.HL7Exception; | import ca.uhn.hl7v2.HL7Exception; | ||||
| import ca.uhn.hl7v2.protocol.ReceivingApplicationExceptionHandler; | import ca.uhn.hl7v2.protocol.ReceivingApplicationExceptionHandler; | ||||
| @@ -8,7 +8,7 @@ import java.util.Map; | |||||
| /** | /** | ||||
| * Created by nils on 20.11.2015. | * Created by nils on 20.11.2015. | ||||
| */ | */ | ||||
| public class HL7ExceptionHandler2 implements ReceivingApplicationExceptionHandler { | |||||
| public class HL7ExceptionHandler implements ReceivingApplicationExceptionHandler { | |||||
| @Override | @Override | ||||
| public String processException(String incomingMessage, Map<String, Object> incomingMetadata, String outgoingMessage, Exception e) throws HL7Exception { | public String processException(String incomingMessage, Map<String, Object> incomingMetadata, String outgoingMessage, Exception e) throws HL7Exception { | ||||
| return outgoingMessage; | return outgoingMessage; | ||||
| @@ -1,4 +1,4 @@ | |||||
| package de.uniluebeck.mi.projmi6.hapi2; | |||||
| package de.uniluebeck.mi.projmi6.hapi; | |||||
| import ca.uhn.hl7v2.AcknowledgmentCode; | import ca.uhn.hl7v2.AcknowledgmentCode; | ||||
| import ca.uhn.hl7v2.ErrorCode; | import ca.uhn.hl7v2.ErrorCode; | ||||
| @@ -27,11 +27,11 @@ import java.util.Map; | |||||
| /** | /** | ||||
| * Created by nils on 20.11.2015. | * Created by nils on 20.11.2015. | ||||
| */ | */ | ||||
| public class HL7Receiver2<T extends AbstractMessage> implements ReceivingApplication { | |||||
| public class HL7Receiver<T extends AbstractMessage> implements ReceivingApplication { | |||||
| private final Class<T> type; | private final Class<T> type; | ||||
| private final MainController mainctrl; | private final MainController mainctrl; | ||||
| public HL7Receiver2(Class<T> type, MainController mainctrl) { | |||||
| public HL7Receiver(Class<T> type, MainController mainctrl) { | |||||
| this.type = type; | this.type = type; | ||||
| this.mainctrl = mainctrl; | this.mainctrl = mainctrl; | ||||
| } | } | ||||
| @@ -127,8 +127,8 @@ public class HL7Receiver2<T extends AbstractMessage> implements ReceivingApplica | |||||
| StationsHistorie hist = new StationsHistorie(); // TODO: StationsHist schreiben/schon vorhanden! | StationsHistorie hist = new StationsHistorie(); // TODO: StationsHist schreiben/schon vorhanden! | ||||
| hist.setStationKey(station.getStation()); | hist.setStationKey(station.getStation()); | ||||
| hist.setAufnahmeDatum(HL7Util2.parseLocalDateTime(pv1.getAdmitDateTime().getTime())); | |||||
| hist.setEntlassungsDatum(HL7Util2.parseLocalDateTime(pv1.getDischargeDateTime()[0].getTime())); // TODO: null? | |||||
| hist.setAufnahmeDatum(HL7Util.parseLocalDateTime(pv1.getAdmitDateTime().getTime())); | |||||
| hist.setEntlassungsDatum(HL7Util.parseLocalDateTime(pv1.getDischargeDateTime()[0].getTime())); // TODO: null? | |||||
| hist.setFallID(fallid); | hist.setFallID(fallid); | ||||
| List<DG1> dg1s = visit.getDG1All(); | List<DG1> dg1s = visit.getDG1All(); | ||||
| @@ -201,7 +201,7 @@ public class HL7Receiver2<T extends AbstractMessage> implements ReceivingApplica | |||||
| } | } | ||||
| untersuchung.setOpscode(opscode); | untersuchung.setOpscode(opscode); | ||||
| untersuchung.setUntersuchungsdatum(HL7Util2.parseLocalDateTime(pr1.getProcedureDateTime().getTime())); | |||||
| untersuchung.setUntersuchungsdatum(HL7Util.parseLocalDateTime(pr1.getProcedureDateTime().getTime())); | |||||
| // Mitarbeiter ID anhand von EinweisenderArzt erkennen. | // Mitarbeiter ID anhand von EinweisenderArzt erkennen. | ||||
| Mitarbeiter mitarbeiter; | Mitarbeiter mitarbeiter; | ||||
| @@ -261,7 +261,7 @@ public class HL7Receiver2<T extends AbstractMessage> implements ReceivingApplica | |||||
| private void logHL7MessageToDatabase(Message message, MSH msh, Map<String, Object> metadata, HL7LogEntry.Direction direction) throws HL7Exception { | private void logHL7MessageToDatabase(Message message, MSH msh, Map<String, Object> metadata, HL7LogEntry.Direction direction) throws HL7Exception { | ||||
| String sendind_ip = metadata.get("SENDING_IP").toString(); | String sendind_ip = metadata.get("SENDING_IP").toString(); | ||||
| String sendind_port = metadata.get("SENDING_PORT").toString(); | String sendind_port = metadata.get("SENDING_PORT").toString(); | ||||
| LocalDateTime ldt = HL7Util2.parseLocalDateTime(msh.getDateTimeOfMessage().getTime()); | |||||
| LocalDateTime ldt = HL7Util.parseLocalDateTime(msh.getDateTimeOfMessage().getTime()); | |||||
| HL7LogEntry entry = new HL7LogEntry(); | HL7LogEntry entry = new HL7LogEntry(); | ||||
| @@ -1,4 +1,4 @@ | |||||
| package de.uniluebeck.mi.projmi6.hapi2; | |||||
| package de.uniluebeck.mi.projmi6.hapi; | |||||
| import ca.uhn.hl7v2.DefaultHapiContext; | import ca.uhn.hl7v2.DefaultHapiContext; | ||||
| import ca.uhn.hl7v2.HapiContext; | import ca.uhn.hl7v2.HapiContext; | ||||
| @@ -14,14 +14,14 @@ import java.util.concurrent.TimeUnit; | |||||
| /** | /** | ||||
| * Created by nils on 20.11.2015. | * Created by nils on 20.11.2015. | ||||
| */ | */ | ||||
| public class HL7Server2 { | |||||
| public class HL7Server { | |||||
| private static final int PORT = 1111; | private static final int PORT = 1111; | ||||
| private final HapiContext context; | private final HapiContext context; | ||||
| private final HL7Service server; | private final HL7Service server; | ||||
| private final ThreadPoolExecutor executor; | private final ThreadPoolExecutor executor; | ||||
| public HL7Server2(MainController mainctrl) throws InterruptedException { | |||||
| public HL7Server(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()); | ||||
| @@ -29,11 +29,11 @@ public class HL7Server2 { | |||||
| context.setExecutorService(executor); | context.setExecutorService(executor); | ||||
| server = context.newServer(PORT, false); | server = context.newServer(PORT, false); | ||||
| 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.registerApplication("ADT", "A01", new HL7Receiver<ADT_A01>(ADT_A01.class, mainctrl)); | |||||
| server.registerApplication("BAR", "P05", new HL7Receiver<BAR_P05>(BAR_P05.class, mainctrl)); | |||||
| server.registerConnectionListener(new HL7ConnectionListener2()); | |||||
| server.setExceptionHandler(new HL7ExceptionHandler2()); | |||||
| server.registerConnectionListener(new HL7ConnectionListener()); | |||||
| server.setExceptionHandler(new HL7ExceptionHandler()); | |||||
| //server.startAndWait(); | //server.startAndWait(); | ||||
| server.start(); | server.start(); | ||||
| @@ -1,4 +1,4 @@ | |||||
| package de.uniluebeck.mi.projmi6.hapi2; | |||||
| package de.uniluebeck.mi.projmi6.hapi; | |||||
| import ca.uhn.hl7v2.model.DataTypeException; | import ca.uhn.hl7v2.model.DataTypeException; | ||||
| import ca.uhn.hl7v2.model.v251.datatype.DTM; | import ca.uhn.hl7v2.model.v251.datatype.DTM; | ||||
| @@ -9,7 +9,7 @@ import java.time.ZoneId; | |||||
| /** | /** | ||||
| * Created by nils on 20.11.2015. | * Created by nils on 20.11.2015. | ||||
| */ | */ | ||||
| public class HL7Util2 { | |||||
| public class HL7Util { | |||||
| public static LocalDateTime parseLocalDateTime(DTM dtm) { | public static LocalDateTime parseLocalDateTime(DTM dtm) { | ||||
| try { | try { | ||||
| return LocalDateTime.ofInstant(dtm.getValueAsDate().toInstant(), ZoneId.systemDefault()); | return LocalDateTime.ofInstant(dtm.getValueAsDate().toInstant(), ZoneId.systemDefault()); | ||||