Im Rahmen der Veranstaltung "CS3330 - Projektpraktikum MedizinischeInformatik" an der Universität zu Lübeck entstandenes Krankenhausinformationssystem (KIS).
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

63 wiersze
1.9 KiB

  1. package de.uniluebeck.mi.projmi6.hapi2;
  2. import ca.uhn.hl7v2.DefaultHapiContext;
  3. import ca.uhn.hl7v2.HapiContext;
  4. import ca.uhn.hl7v2.app.HL7Service;
  5. import ca.uhn.hl7v2.model.v251.message.ADT_A01;
  6. import ca.uhn.hl7v2.model.v251.message.BAR_P05;
  7. import java.util.concurrent.ArrayBlockingQueue;
  8. import java.util.concurrent.ThreadPoolExecutor;
  9. import java.util.concurrent.TimeUnit;
  10. /**
  11. * Created by nils on 20.11.2015.
  12. */
  13. public class HL7Server2 {
  14. private static final int PORT = 1111;
  15. private final HapiContext context;
  16. private final HL7Service server;
  17. private final ThreadPoolExecutor executor;
  18. public HL7Server2() throws InterruptedException {
  19. executor = new ThreadPoolExecutor(10, 100, 30, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(100));
  20. executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
  21. context = new DefaultHapiContext();
  22. context.setExecutorService(executor);
  23. server = context.newServer(PORT, false);
  24. server.registerApplication("ADT", "A01", new HL7Recever2<ADT_A01>(ADT_A01.class));
  25. server.registerApplication("BAR", "P05", new HL7Recever2<BAR_P05>(BAR_P05.class));
  26. server.registerConnectionListener(new HL7ConnectionListener2());
  27. server.setExceptionHandler(new HL7ExceptionHandler2());
  28. //server.startAndWait();
  29. server.start();
  30. }
  31. // TODO: Remove, for testing purpose only!
  32. public static void main(String[] args) throws InterruptedException {
  33. HL7Server2 srv = new HL7Server2();
  34. for (; ; ) {
  35. }
  36. //srv.stop();
  37. //srv.shutdown();
  38. }
  39. public void stop() {
  40. if (server != null && server.isRunning()) {
  41. server.stop();
  42. }
  43. }
  44. public void shutdown() {
  45. if (executor != null && !executor.isTerminated()) {
  46. executor.shutdown();
  47. }
  48. }
  49. }