Browse Source

Merge branch 'hapi' of gogs.dittberner.it:nils/projmi into hapi

hapi
630030 10 years ago
parent
commit
8fa89b93f3
6 changed files with 99 additions and 53 deletions
  1. +38
    -7
      src/main/java/de/uniluebeck/mi/projmi6/HL7.java
  2. +1
    -1
      src/main/java/de/uniluebeck/mi/projmi6/controller/PatientEditorController.java
  3. +5
    -1
      src/main/java/de/uniluebeck/mi/projmi6/db/DBHandler.java
  4. +40
    -38
      src/main/java/de/uniluebeck/mi/projmi6/model/Fall.java
  5. +14
    -5
      src/main/resources/fall.fxml
  6. +1
    -1
      src/main/resources/stationshistorie.fxml

+ 38
- 7
src/main/java/de/uniluebeck/mi/projmi6/HL7.java View File

@@ -7,15 +7,22 @@ import ca.uhn.hl7v2.model.DataTypeException;
import ca.uhn.hl7v2.model.Message; import ca.uhn.hl7v2.model.Message;
import ca.uhn.hl7v2.model.v25.datatype.DTM; import ca.uhn.hl7v2.model.v25.datatype.DTM;
import ca.uhn.hl7v2.model.v251.datatype.FN; 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.ADT_A01;
import ca.uhn.hl7v2.model.v251.message.BAR_P05; import ca.uhn.hl7v2.model.v251.message.BAR_P05;
import ca.uhn.hl7v2.model.v251.segment.*; import ca.uhn.hl7v2.model.v251.segment.*;
import ca.uhn.hl7v2.parser.Parser; 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.db.DBHandler;
import de.uniluebeck.mi.projmi6.model.Diagnose; import de.uniluebeck.mi.projmi6.model.Diagnose;
import de.uniluebeck.mi.projmi6.model.Fall; import de.uniluebeck.mi.projmi6.model.Fall;
import de.uniluebeck.mi.projmi6.model.Patient; 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.io.IOException;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Time; import java.sql.Time;
@@ -35,10 +42,9 @@ public class HL7 {
* erstellt eine ADT_A0 nachricht, welche anschließend an die OPS Gruppe verschickt werden soll. * 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. * 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 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 * @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 (); Patient patient = fall.getPatient ();
ADT_A01 adt = new ADT_A01 (); ADT_A01 adt = new ADT_A01 ();


@@ -80,6 +86,8 @@ public class HL7 {
pidSegment.getPid13_PhoneNumberHome (0).getTelephoneNumber ().setValue ( patient.getTelefon () ); pidSegment.getPid13_PhoneNumberHome (0).getTelephoneNumber ().setValue ( patient.getTelefon () );
pidSegment.getPid16_MaritalStatus ().getAlternateIdentifier ().setValue ( patient.getFamilienstand ().toString()); pidSegment.getPid16_MaritalStatus ().getAlternateIdentifier ().setValue ( patient.getFamilienstand ().toString());


validateMessage(adt);
/*
//Dg1 (Diagnosen) //Dg1 (Diagnosen)
List<DG1> dg1List = new ArrayList<> ( ); List<DG1> dg1List = new ArrayList<> ( );
diagnosen.add(fall.getHauptDiagnose ()); diagnosen.add(fall.getHauptDiagnose ());
@@ -92,24 +100,32 @@ public class HL7 {
dg1Segment.getDg14_DiagnosisDescription ().setValue ( aDiagnosen.getFreiText () ); dg1Segment.getDg14_DiagnosisDescription ().setValue ( aDiagnosen.getFreiText () );
dg1List.add ( dg1Segment ); dg1List.add ( dg1Segment );
} }
*/
//print generated message //print generated message
// printXMLEncodedMessageADT(adt);
printXMLEncodedMessageADT(adt);


} }


public DG1 parseDiagnosen() {


}


/** /**
* gibt erzeugte hl7 Nachricht auf der Konsole aus (Kann nach Debug phase wieder geloescht werden) * gibt erzeugte hl7 Nachricht auf der Konsole aus (Kann nach Debug phase wieder geloescht werden)
* @param msg * @param msg
* @throws HL7Exception * @throws HL7Exception
*/ */
public void printXMLEncodedMessageADT(Message msg) throws HL7Exception {
public void printXMLEncodedMessageADT(Message msg) throws HL7Exception, IOException {
HapiContext context = new DefaultHapiContext (); HapiContext context = new DefaultHapiContext ();
Parser parser = context.getXMLParser(); 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); System.out.println (encodedMessage);
} }


@@ -120,11 +136,14 @@ public class HL7 {
public void parseMessage(Message msg) throws DataTypeException, SQLException { public void parseMessage(Message msg) throws DataTypeException, SQLException {
if (msg instanceof BAR_P05) { if (msg instanceof BAR_P05) {
BAR_P05 p05 = (BAR_P05) msg; BAR_P05 p05 = (BAR_P05) msg;

EVN evnSegment = p05.getEVN(); EVN evnSegment = p05.getEVN();
PID pidSegment = p05.getPID(); PID pidSegment = p05.getPID();

DBHandler dh = new DBHandler(); DBHandler dh = new DBHandler();
Patient patient =dh.getPatient(Integer.valueOf(pidSegment.getPid3_PatientIdentifierList(0).getIDNumber().getValue())); Patient patient =dh.getPatient(Integer.valueOf(pidSegment.getPid3_PatientIdentifierList(0).getIDNumber().getValue()));
Fall fall = new Fall(); Fall fall = new Fall();

LocalDateTime ldt = generateLocalDateTimeFromHl7(p05); LocalDateTime ldt = generateLocalDateTimeFromHl7(p05);
patient.setBearbeitetDatumZeit(ldt); patient.setBearbeitetDatumZeit(ldt);
patient.setBearbeiter(Integer.valueOf(evnSegment.getEvn5_OperatorID(0).getIDNumber().getValue())); patient.setBearbeiter(Integer.valueOf(evnSegment.getEvn5_OperatorID(0).getIDNumber().getValue()));
@@ -147,6 +166,18 @@ public class HL7 {
} }
} }


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 { public LocalDateTime generateLocalDateTimeFromHl7(BAR_P05 msg) throws DataTypeException {
EVN evnSegment = msg.getEVN(); EVN evnSegment = msg.getEVN();




+ 1
- 1
src/main/java/de/uniluebeck/mi/projmi6/controller/PatientEditorController.java View File

@@ -148,7 +148,7 @@ public class PatientEditorController {
patient.setOrt(patOrt.getText()); patient.setOrt(patOrt.getText());
patient.setGeburtsdatum(patGeburtsdatum.getValue()); patient.setGeburtsdatum(patGeburtsdatum.getValue());
patient.setFamilienstand(patFamilienstand.getValue()); patient.setFamilienstand(patFamilienstand.getValue());
patient.setGeschlecht(patient.getGeschlecht());
patient.setGeschlecht(patGeschlecht.getValue());
patient.setVersichertennummer(patVersicherungsnummer.getText()); patient.setVersichertennummer(patVersicherungsnummer.getText());
if (patVersicherung.getSelectionModel().getSelectedItem() != null) if (patVersicherung.getSelectionModel().getSelectedItem() != null)
patient.setKassenID(patVersicherung.getSelectionModel().getSelectedItem().getKassenID()); patient.setKassenID(patVersicherung.getSelectionModel().getSelectedItem().getKassenID());


+ 5
- 1
src/main/java/de/uniluebeck/mi/projmi6/db/DBHandler.java View File

@@ -369,6 +369,8 @@ public class DBHandler {
// hist.setFall(null); // hist.setFall(null);
// hist.setStation(null); // hist.setStation(null);


hist.setStationKey(rs.getString("station"));

return hist; return hist;
} }


@@ -412,6 +414,8 @@ public class DBHandler {
fall.setKasse(getKasse(rs.getInt("kassenid"))); fall.setKasse(getKasse(rs.getInt("kassenid")));
} }
fall.setFallArt(FallArt.parseString(rs.getString("fallart"))); fall.setFallArt(FallArt.parseString(rs.getString("fallart")));
fall.setEinweisenderArzt(rs.getString("einweisenderarzt"));
fall.setStorniert(rs.getBoolean("storniert"));


return fall; return fall;
} }
@@ -448,7 +452,7 @@ public class DBHandler {
statement.setTimestamp(3, null); statement.setTimestamp(3, null);
} }
if (fall.getEinweisenderArzt() != null) { if (fall.getEinweisenderArzt() != null) {
statement.setInt(4, fall.getEinweisenderArzt().getMitarbID()); // EinweisenderArzt
statement.setString(4, fall.getEinweisenderArzt()); // EinweisenderArzt
} else { } else {
statement.setTimestamp(4, null); statement.setTimestamp(4, null);
} }


+ 40
- 38
src/main/java/de/uniluebeck/mi/projmi6/model/Fall.java View File

@@ -5,7 +5,6 @@ import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;


import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;


/** /**
@@ -15,7 +14,7 @@ public class Fall extends Version {
private Patient patient; private Patient patient;
private Kasse kasse; private Kasse kasse;
private Diagnose hauptDiagnose; private Diagnose hauptDiagnose;
private Mitarbeiter einweisenderArzt;
private SimpleStringProperty einweisenderArzt = new SimpleStringProperty(this, "einweiser");
private FallArt fallArt; private FallArt fallArt;
private SimpleBooleanProperty selbsteinweisung = new SimpleBooleanProperty(this, "selbsteinweisung"); private SimpleBooleanProperty selbsteinweisung = new SimpleBooleanProperty(this, "selbsteinweisung");
private SimpleStringProperty versichertenNummer = new SimpleStringProperty(this, "versichertenNummer"); private SimpleStringProperty versichertenNummer = new SimpleStringProperty(this, "versichertenNummer");
@@ -29,38 +28,37 @@ public class Fall extends Version {
return vorstellDatum.get(); return vorstellDatum.get();
} }


public SimpleObjectProperty<LocalDateTime> vorstellDatumProperty() {
return vorstellDatum;
}

public void setVorstellDatum(LocalDateTime vorstellDatum) { public void setVorstellDatum(LocalDateTime vorstellDatum) {
this.vorstellDatum.set(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) { public void setAufnahmeDatum(LocalDateTime aufnahmeDatum) {
this.aufnahmeDatum.set(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) { public void setEntlassungsDatum(LocalDateTime entlassungsDatum) {
this.entlassungsDatum.set(entlassungsDatum); this.entlassungsDatum.set(entlassungsDatum);
} }


public SimpleObjectProperty<LocalDateTime> entlassungsDatumProperty() {
return entlassungsDatum;
}


public Patient getPatient() { public Patient getPatient() {
return patient; return patient;
@@ -86,18 +84,26 @@ public class Fall extends Version {
this.hauptDiagnose = hauptDiagnose; 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 SimpleStringProperty einweisenderArztProperty() {
return einweisenderArzt;
} }


public FallArt getFallArt() { public FallArt getFallArt() {
return fallArt; return fallArt;
} }


public void setFallArt(FallArt fallArt) {
this.fallArt = fallArt;
}

@Override @Override
public String toString() { public String toString() {
if(getAufnahmeDatum()!=null){ if(getAufnahmeDatum()!=null){
@@ -107,46 +113,42 @@ public class Fall extends Version {
} }
} }


public void setFallArt(FallArt fallArt) {
this.fallArt = fallArt;
}

public boolean getSelbsteinweisung() { public boolean getSelbsteinweisung() {
return selbsteinweisung.get(); return selbsteinweisung.get();
} }


public SimpleBooleanProperty selbsteinweisungProperty() {
return selbsteinweisung;
}

public void setSelbsteinweisung(boolean selbsteinweisung) { public void setSelbsteinweisung(boolean selbsteinweisung) {
this.selbsteinweisung.set(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) { public void setVersichertenNummer(String versichertenNummer) {
this.versichertenNummer.set(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) { public void setStorniert(boolean storniert) {
this.storniert.set(storniert); this.storniert.set(storniert);
} }


public SimpleBooleanProperty storniertProperty() {
return storniert;
}

public SimpleStringProperty versichertenNummerProperty() { public SimpleStringProperty versichertenNummerProperty() {
return versichertenNummer; return versichertenNummer;
} }
@@ -155,12 +157,12 @@ public class Fall extends Version {
return fallID.get(); return fallID.get();
} }


public SimpleIntegerProperty fallIDProperty() {
return fallID;
}

public void setFallID(int fallID) { public void setFallID(int fallID) {
this.fallID.set(fallID); this.fallID.set(fallID);
} }


public SimpleIntegerProperty fallIDProperty() {
return fallID;
}

} }

+ 14
- 5
src/main/resources/fall.fxml View File

@@ -67,7 +67,16 @@
<Insets right="5.0"/> <Insets right="5.0"/>
</HBox.margin> </HBox.margin>
</Button> </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" <Button fx:id="btnFallAbort" cancelButton="true" mnemonicParsing="false" onAction="#clickedFallAbort"
text="Abbrechen"> text="Abbrechen">
<HBox.margin> <HBox.margin>
@@ -87,8 +96,8 @@
<children> <children>
<Label styleClass="ersteller-label" text="Ersteller: "/> <Label styleClass="ersteller-label" text="Ersteller: "/>
<Label styleClass="ersteller-label" text="Erstelldatum:" GridPane.rowIndex="1"/> <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"/> GridPane.rowIndex="1"/>
</children> </children>
<columnConstraints> <columnConstraints>
@@ -112,8 +121,8 @@
<children> <children>
<Label styleClass="ersteller-label" text="Letzter Bearbeiter"/> <Label styleClass="ersteller-label" text="Letzter Bearbeiter"/>
<Label styleClass="ersteller-label" text="Letzte Änderung:" GridPane.rowIndex="1"/> <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"/> GridPane.rowIndex="1"/>
</children> </children>
</GridPane> </GridPane>


+ 1
- 1
src/main/resources/stationshistorie.fxml View File

@@ -16,7 +16,7 @@
<children> <children>
<ToolBar prefHeight="40.0" prefWidth="200.0"> <ToolBar prefHeight="40.0" prefWidth="200.0">
<items> <items>
<Button mnemonicParsing="false" text="Neuen Aufenthalt erstellen" onAction="#clickedCreateAufenthalt"/>
<Button mnemonicParsing="false" text="Neuen Aufenthalt erstellen" fx:id="btnStatHistCreate" onAction="#clickedCreateAufenthalt"/>
</items> </items>
</ToolBar> </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" >


Loading…
Cancel
Save