taschi 10 лет назад
Родитель
Сommit
111380fee4
1 измененных файлов: 17 добавлений и 6 удалений
  1. +17
    -6
      src/main/java/de/uniluebeck/mi/projmi6/hapi/HL7Sender.java

+ 17
- 6
src/main/java/de/uniluebeck/mi/projmi6/hapi/HL7Sender.java Просмотреть файл

@@ -28,17 +28,17 @@ import java.util.List;
public class HL7Sender {

/**
* 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.
* generates an ADT_A05 message for data exchange with OPS group
*
* @param fall nach dem Erstellen eines neuen Falls wird diese Methode aufgerufen um Hl7 Nachricht zu erzeugen
*
* @param fall to create the message from this content. patient and diagnosis are linked to fall
* @throws Exception
*/
public static void createMessageADT_A01(Fall fall) throws HL7Exception, IOException, SQLException {
Patient patient = fall.getPatient();
ADT_A01 adt = new ADT_A01();

//default MSH Values (Sets Segments: 1,2,7,9,11
//default MSH Values (Sets Segments: 1,2,7,9,10,11
adt.initQuickstart("ADT", "A01", "P");

//MSH Segment:
@@ -47,7 +47,6 @@ public class HL7Sender {
mshSegment.getMsh5_ReceivingApplication().getNamespaceID().parse("OPS Gruppe von Maurice und Torben");
mshSegment.getMsh12_VersionID().getVersionID().parse("2.5.1");
mshSegment.getMsh15_AcceptAcknowledgmentType().parse("AL");
//TODO check ob segment 10 gesetzt wurde

//EVN Segment:
EVN evnSegment = adt.getEVN();
@@ -69,7 +68,7 @@ public class HL7Sender {
pidSegment.getPid13_PhoneNumberHome(0).getTelephoneNumber().parse(patient.getTelefon());
pidSegment.getPid16_MaritalStatus().getAlternateIdentifier().parse(patient.getFamilienstand().toString());

//Diagnosen
//Diagnosen (DG1 Segmente des PV1 Segments
List<Diagnose> diagnosen = DBHandler.getDiagnosenByFall(fall);
PV1 pv1Segment = adt.getPV1();
pv1Segment.getPv12_PatientClass().parse("U");
@@ -92,12 +91,24 @@ public class HL7Sender {
sendMessage(adt);
}

/**
* Sending message handler. Calls function to send current message
* @param message
* @throws HL7Exception
*/
private static void sendMessage(Message message) throws HL7Exception {
if (message instanceof ADT_A01) {
sendMessageADT_A01(message);
}
}

/**
* sends an ADT_A01 message and waits ca 5 seconds for an ACK. If no ACK occurs it sends the message ONLY 5 times again
* if after 5 times no ack occurs log message
* write log historie in database
* @param message you want to send
* @throws HL7Exception
*/
private static void sendMessageADT_A01(Message message) throws HL7Exception {
ADT_A01 adt_a01 = (ADT_A01) message;
HapiContext context = new DefaultHapiContext();


Загрузка…
Отмена
Сохранить