| @@ -7,15 +7,22 @@ import ca.uhn.hl7v2.model.DataTypeException; | |||
| import ca.uhn.hl7v2.model.Message; | |||
| import ca.uhn.hl7v2.model.v25.datatype.DTM; | |||
| 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.BAR_P05; | |||
| import ca.uhn.hl7v2.model.v251.segment.*; | |||
| 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.model.Diagnose; | |||
| import de.uniluebeck.mi.projmi6.model.Fall; | |||
| 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.sql.SQLException; | |||
| 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. | |||
| * 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 diagnosen Liste aller Nebendiagnosen momentan noch als einzelne Liste uebereben. eventuell die Nebendiagnosen direkt im Fall speichern? | |||
| * @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 (); | |||
| ADT_A01 adt = new ADT_A01 (); | |||
| @@ -80,6 +86,8 @@ public class HL7 { | |||
| pidSegment.getPid13_PhoneNumberHome (0).getTelephoneNumber ().setValue ( patient.getTelefon () ); | |||
| pidSegment.getPid16_MaritalStatus ().getAlternateIdentifier ().setValue ( patient.getFamilienstand ().toString()); | |||
| validateMessage(adt); | |||
| /* | |||
| //Dg1 (Diagnosen) | |||
| List<DG1> dg1List = new ArrayList<> ( ); | |||
| diagnosen.add(fall.getHauptDiagnose ()); | |||
| @@ -92,24 +100,32 @@ public class HL7 { | |||
| dg1Segment.getDg14_DiagnosisDescription ().setValue ( aDiagnosen.getFreiText () ); | |||
| dg1List.add ( dg1Segment ); | |||
| } | |||
| */ | |||
| //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) | |||
| * @param msg | |||
| * @throws HL7Exception | |||
| */ | |||
| public void printXMLEncodedMessageADT(Message msg) throws HL7Exception { | |||
| public void printXMLEncodedMessageADT(Message msg) throws HL7Exception, IOException { | |||
| HapiContext context = new DefaultHapiContext (); | |||
| 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); | |||
| } | |||
| @@ -120,11 +136,14 @@ public class HL7 { | |||
| public void parseMessage(Message msg) throws DataTypeException, SQLException { | |||
| if (msg instanceof BAR_P05) { | |||
| BAR_P05 p05 = (BAR_P05) msg; | |||
| EVN evnSegment = p05.getEVN(); | |||
| PID pidSegment = p05.getPID(); | |||
| DBHandler dh = new DBHandler(); | |||
| Patient patient =dh.getPatient(Integer.valueOf(pidSegment.getPid3_PatientIdentifierList(0).getIDNumber().getValue())); | |||
| Fall fall = new Fall(); | |||
| LocalDateTime ldt = generateLocalDateTimeFromHl7(p05); | |||
| patient.setBearbeitetDatumZeit(ldt); | |||
| 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 { | |||
| EVN evnSegment = msg.getEVN(); | |||
| @@ -148,7 +148,7 @@ public class PatientEditorController { | |||
| patient.setOrt(patOrt.getText()); | |||
| patient.setGeburtsdatum(patGeburtsdatum.getValue()); | |||
| patient.setFamilienstand(patFamilienstand.getValue()); | |||
| patient.setGeschlecht(patient.getGeschlecht()); | |||
| patient.setGeschlecht(patGeschlecht.getValue()); | |||
| patient.setVersichertennummer(patVersicherungsnummer.getText()); | |||
| if (patVersicherung.getSelectionModel().getSelectedItem() != null) | |||
| patient.setKassenID(patVersicherung.getSelectionModel().getSelectedItem().getKassenID()); | |||
| @@ -369,6 +369,8 @@ public class DBHandler { | |||
| // hist.setFall(null); | |||
| // hist.setStation(null); | |||
| hist.setStationKey(rs.getString("station")); | |||
| return hist; | |||
| } | |||
| @@ -412,6 +414,8 @@ public class DBHandler { | |||
| fall.setKasse(getKasse(rs.getInt("kassenid"))); | |||
| } | |||
| fall.setFallArt(FallArt.parseString(rs.getString("fallart"))); | |||
| fall.setEinweisenderArzt(rs.getString("einweisenderarzt")); | |||
| fall.setStorniert(rs.getBoolean("storniert")); | |||
| return fall; | |||
| } | |||
| @@ -448,7 +452,7 @@ public class DBHandler { | |||
| statement.setTimestamp(3, null); | |||
| } | |||
| if (fall.getEinweisenderArzt() != null) { | |||
| statement.setInt(4, fall.getEinweisenderArzt().getMitarbID()); // EinweisenderArzt | |||
| statement.setString(4, fall.getEinweisenderArzt()); // EinweisenderArzt | |||
| } else { | |||
| statement.setTimestamp(4, null); | |||
| } | |||
| @@ -5,7 +5,6 @@ import javafx.beans.property.SimpleIntegerProperty; | |||
| import javafx.beans.property.SimpleObjectProperty; | |||
| import javafx.beans.property.SimpleStringProperty; | |||
| import java.text.SimpleDateFormat; | |||
| import java.time.LocalDateTime; | |||
| /** | |||
| @@ -15,7 +14,7 @@ public class Fall extends Version { | |||
| private Patient patient; | |||
| private Kasse kasse; | |||
| private Diagnose hauptDiagnose; | |||
| private Mitarbeiter einweisenderArzt; | |||
| private SimpleStringProperty einweisenderArzt = new SimpleStringProperty(this, "einweiser"); | |||
| private FallArt fallArt; | |||
| private SimpleBooleanProperty selbsteinweisung = new SimpleBooleanProperty(this, "selbsteinweisung"); | |||
| private SimpleStringProperty versichertenNummer = new SimpleStringProperty(this, "versichertenNummer"); | |||
| @@ -29,38 +28,37 @@ public class Fall extends Version { | |||
| return vorstellDatum.get(); | |||
| } | |||
| public SimpleObjectProperty<LocalDateTime> vorstellDatumProperty() { | |||
| return vorstellDatum; | |||
| } | |||
| public void setVorstellDatum(LocalDateTime 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) { | |||
| 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) { | |||
| this.entlassungsDatum.set(entlassungsDatum); | |||
| } | |||
| public SimpleObjectProperty<LocalDateTime> entlassungsDatumProperty() { | |||
| return entlassungsDatum; | |||
| } | |||
| public Patient getPatient() { | |||
| return patient; | |||
| @@ -86,18 +84,26 @@ public class Fall extends Version { | |||
| 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() { | |||
| return fallArt; | |||
| } | |||
| public void setFallArt(FallArt fallArt) { | |||
| this.fallArt = fallArt; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| if(getAufnahmeDatum()!=null){ | |||
| @@ -107,46 +113,42 @@ public class Fall extends Version { | |||
| } | |||
| } | |||
| public void setFallArt(FallArt fallArt) { | |||
| this.fallArt = fallArt; | |||
| } | |||
| public boolean getSelbsteinweisung() { | |||
| return selbsteinweisung.get(); | |||
| } | |||
| public SimpleBooleanProperty selbsteinweisungProperty() { | |||
| return selbsteinweisung; | |||
| } | |||
| public void setSelbsteinweisung(boolean 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) { | |||
| 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) { | |||
| this.storniert.set(storniert); | |||
| } | |||
| public SimpleBooleanProperty storniertProperty() { | |||
| return storniert; | |||
| } | |||
| public SimpleStringProperty versichertenNummerProperty() { | |||
| return versichertenNummer; | |||
| } | |||
| @@ -155,12 +157,12 @@ public class Fall extends Version { | |||
| return fallID.get(); | |||
| } | |||
| public SimpleIntegerProperty fallIDProperty() { | |||
| return fallID; | |||
| } | |||
| public void setFallID(int fallID) { | |||
| this.fallID.set(fallID); | |||
| } | |||
| public SimpleIntegerProperty fallIDProperty() { | |||
| return fallID; | |||
| } | |||
| } | |||
| @@ -67,7 +67,16 @@ | |||
| <Insets right="5.0"/> | |||
| </HBox.margin> | |||
| </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" | |||
| text="Abbrechen"> | |||
| <HBox.margin> | |||
| @@ -87,8 +96,8 @@ | |||
| <children> | |||
| <Label styleClass="ersteller-label" text="Ersteller: "/> | |||
| <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"/> | |||
| </children> | |||
| <columnConstraints> | |||
| @@ -112,8 +121,8 @@ | |||
| <children> | |||
| <Label styleClass="ersteller-label" text="Letzter Bearbeiter"/> | |||
| <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"/> | |||
| </children> | |||
| </GridPane> | |||
| @@ -16,7 +16,7 @@ | |||
| <children> | |||
| <ToolBar prefHeight="40.0" prefWidth="200.0"> | |||
| <items> | |||
| <Button mnemonicParsing="false" text="Neuen Aufenthalt erstellen" onAction="#clickedCreateAufenthalt"/> | |||
| <Button mnemonicParsing="false" text="Neuen Aufenthalt erstellen" fx:id="btnStatHistCreate" onAction="#clickedCreateAufenthalt"/> | |||
| </items> | |||
| </ToolBar> | |||
| <TableView prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" fx:id="tblStationsHistorie" > | |||