From d19c20cf82a766143de8dd180a6df756f64001ea Mon Sep 17 00:00:00 2001 From: rene Date: Fri, 23 Jun 2023 12:06:48 +0200 Subject: [PATCH] =?UTF-8?q?Mehr=20logik,=20IRows,=20Gesamte=20Datei=20wird?= =?UTF-8?q?=20erstellt,=20jetzt=20Bef=C3=BCllung=20der=20Daten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 ++- Dakota/Dakota.csproj | 3 ++ Dakota/DakotaConfig.cs | 1 + Dakota/DakotaEnums.cs | 6 ++++ Dakota/DakotaFileGenerator.cs | 34 +++++++++++++----- Dakota/Models/BlockKostenträger.cs | 33 +++++++++++++++++ Dakota/Models/BlockKrankenkarteVerordnung.cs | 38 ++++++++++++++++++++ Dakota/Models/Dateneinheit.cs | 2 +- Dakota/Models/Datenelement.cs | 8 +++++ Dakota/Models/IRowable.cs | 13 +++++++ Dakota/Models/Nachricht.cs | 15 ++++---- Dakota/Models/NachrichtSLGA.cs | 17 ++++++++- Dakota/Models/NachrichtSLLA.cs | 10 +++++- Dakota/Models/Segmente/Segment.cs | 6 ++-- Dakota/Models/Segmente/SegmentUNB.cs | 2 +- Dakota/Models/SozioTherapieDatei.cs | 14 ++++++-- 16 files changed, 180 insertions(+), 26 deletions(-) create mode 100644 Dakota/Models/BlockKostenträger.cs create mode 100644 Dakota/Models/BlockKrankenkarteVerordnung.cs create mode 100644 Dakota/Models/IRowable.cs diff --git a/.gitignore b/.gitignore index 46df8dddc..587aa4b24 100644 --- a/.gitignore +++ b/.gitignore @@ -593,4 +593,6 @@ obj /UnitTestProject472/bin /UnitTestProject472/obj /UnitTestProject45/bin -/UnitTestProject45/obj \ No newline at end of file +/UnitTestProject45/obj +/Dakota/bin +/Dakota/obj \ No newline at end of file diff --git a/Dakota/Dakota.csproj b/Dakota/Dakota.csproj index 95578f7cd..42546f2c8 100644 --- a/Dakota/Dakota.csproj +++ b/Dakota/Dakota.csproj @@ -45,9 +45,12 @@ + + + diff --git a/Dakota/DakotaConfig.cs b/Dakota/DakotaConfig.cs index 0dad55362..0409b8f8b 100644 --- a/Dakota/DakotaConfig.cs +++ b/Dakota/DakotaConfig.cs @@ -12,6 +12,7 @@ namespace Dakota public static string Trennzeichen => "+"; public static string Aufhebungszeichen => "?"; public static string Segmentendezeichen => "'"; + public static string NewLine => "\n"; public static List SpecialCollection => new List { TrennzeichenInnerhalb, Trennzeichen, Aufhebungszeichen, Segmentendezeichen }; } diff --git a/Dakota/DakotaEnums.cs b/Dakota/DakotaEnums.cs index 0549a62f3..ed1dbcc47 100644 --- a/Dakota/DakotaEnums.cs +++ b/Dakota/DakotaEnums.cs @@ -11,4 +11,10 @@ namespace Dakota Kann, Muss } + + public enum Feldtyp + { + Alpha, + Numerisch + } } diff --git a/Dakota/DakotaFileGenerator.cs b/Dakota/DakotaFileGenerator.cs index 89f87e507..72266b483 100644 --- a/Dakota/DakotaFileGenerator.cs +++ b/Dakota/DakotaFileGenerator.cs @@ -10,20 +10,24 @@ namespace Dakota public class DakotaFileGenerator { internal SozioTherapieDatei SozioTherapieDatei { get; set; } + internal int Counter { get; private set; } + internal DateTime Created { get; private set; } - public DakotaFileGenerator() + public DakotaFileGenerator(int counter) { SozioTherapieDatei = new SozioTherapieDatei(); + Counter = counter; + Created = DateTime.Now; } public void Generate() { - var now = DateTime.Now; - - GenerateUNB(now); + GenerateUNB(); + Generatexyz(); + GenerateUNZ(); } - public void GenerateUNB(DateTime created) + public void GenerateUNB() { SozioTherapieDatei.UNB.SyntaxKennung.SetValue("UNOC"); SozioTherapieDatei.UNB.SyntaxVersionsnummer.SetValue("3"); @@ -31,14 +35,26 @@ namespace Dakota // - IK //SozioTherapieDatei.UNB.Empfangdatei // - IK - SozioTherapieDatei.UNB.Datum.SetValue(created.ToString("yyyyMMdd")); - SozioTherapieDatei.UNB.Uhrzeit.SetValue(created.ToString("HHmm")); - //SozioTherapieDatei.UNB.Datenaustauschreferenz - // - Fortlaufende Nummer + SozioTherapieDatei.UNB.Datum.SetValue(Created.ToString("yyyyMMdd")); + SozioTherapieDatei.UNB.Uhrzeit.SetValue(Created.ToString("HHmm")); + SozioTherapieDatei.UNB.Datenaustauschreferenz.SetFilledIntValue(Counter, 5); SozioTherapieDatei.UNB.Leistungsbereich.SetValue("O"); //SozioTherapieDatei.UNB.Anwengundsreferenz // - Logischer Dateiname SozioTherapieDatei.UNB.Testindikator.SetValue("0"); } + + public void Generatexyz() + { + var block = new BlockKostenträger(); + + SozioTherapieDatei.BlockKostenträger.Add(block); + } + + public void GenerateUNZ() + { + //SozioTherapieDatei.UNZ.AnzahlNachrichten + SozioTherapieDatei.UNZ.Datenaustauschreferenz.SetFilledIntValue(Counter, 5); + } } } diff --git a/Dakota/Models/BlockKostenträger.cs b/Dakota/Models/BlockKostenträger.cs new file mode 100644 index 000000000..74d54e5d6 --- /dev/null +++ b/Dakota/Models/BlockKostenträger.cs @@ -0,0 +1,33 @@ +using Dakota.Models.Segmente; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Dakota.Models +{ + /// + /// Wiederhole folgenden Block je IK des Kostenträgers + /// + internal class BlockKostenträger : IRowable + { + public SegmentUNH UNH { get; private set; } + public NachrichtSLGA NachrichtSLGA { get; private set; } + public SegmentUNT UNT { get; private set; } + public List BlockKrankenkarteVerordnung { get; set; } + + internal BlockKostenträger() + { + UNH = new SegmentUNH(); + NachrichtSLGA = new NachrichtSLGA(); + UNT = new SegmentUNT(); + BlockKrankenkarteVerordnung = new List(); + } + + public string GetRows() + { + return UNH.GetValue() + NachrichtSLGA.GetRows() + UNT.GetValue() + string.Join("", BlockKrankenkarteVerordnung.Select(x => x.GetRows())); + } + } +} diff --git a/Dakota/Models/BlockKrankenkarteVerordnung.cs b/Dakota/Models/BlockKrankenkarteVerordnung.cs new file mode 100644 index 000000000..a191db478 --- /dev/null +++ b/Dakota/Models/BlockKrankenkarteVerordnung.cs @@ -0,0 +1,38 @@ +using Dakota.Models.Segmente; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Dakota.Models +{ + /// + /// Wiederhole folgenden Block je IK der Krankenkarte bzw der Verordnung + /// + internal class BlockKrankenkarteVerordnung : IRowable + { + public SegmentUNH SLGAUNH { get; private set; } + public NachrichtSLGA SLGANachricht { get; private set; } + public SegmentUNT SLGAUNT { get; private set; } + public SegmentUNH SLLAUNH { get; private set; } + public NachrichtSLLA SLLANachricht { get; private set; } + public SegmentUNT SLLAUNT { get; private set; } + + public BlockKrankenkarteVerordnung() + { + SLGAUNH = new SegmentUNH(); + SLGANachricht = new NachrichtSLGA(); + SLGAUNT = new SegmentUNT(); + SLLAUNH = new SegmentUNH(); + SLLANachricht = new NachrichtSLLA(); + SLLAUNT = new SegmentUNT(); + } + + public string GetRows() + { + return SLGAUNH.GetValue() + SLGANachricht.GetRows() + SLGAUNT.GetValue() + + SLLAUNH.GetValue() + SLLANachricht.GetRows() + SLLAUNT.GetValue(); + } + } +} diff --git a/Dakota/Models/Dateneinheit.cs b/Dakota/Models/Dateneinheit.cs index 2aef0b12f..8afc60ecd 100644 --- a/Dakota/Models/Dateneinheit.cs +++ b/Dakota/Models/Dateneinheit.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace Dakota.Models { - internal abstract class Dateneinheit + public abstract class Dateneinheit { public abstract string GetValue(); diff --git a/Dakota/Models/Datenelement.cs b/Dakota/Models/Datenelement.cs index 7a9537004..2ed791a1f 100644 --- a/Dakota/Models/Datenelement.cs +++ b/Dakota/Models/Datenelement.cs @@ -55,6 +55,14 @@ namespace Dakota.Models return _Value; } + public void SetFilledIntValue(int value, int length) + { + if (value.ToString().Length > length) + throw new ArgumentOutOfRangeException("length", $"the length of {value} is bigger than len {length}"); + + SetValue(value.ToString("D" + length.ToString())); + } + public void SetValue(string value) { if (value is string) diff --git a/Dakota/Models/IRowable.cs b/Dakota/Models/IRowable.cs new file mode 100644 index 000000000..e424e319e --- /dev/null +++ b/Dakota/Models/IRowable.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Dakota.Models +{ + public interface IRowable + { + string GetRows(); + } +} diff --git a/Dakota/Models/Nachricht.cs b/Dakota/Models/Nachricht.cs index 7101c0f75..abbc2b5cf 100644 --- a/Dakota/Models/Nachricht.cs +++ b/Dakota/Models/Nachricht.cs @@ -1,4 +1,5 @@ -using System; +using Dakota.Models.Segmente; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,13 +7,13 @@ using System.Threading.Tasks; namespace Dakota.Models { - internal class Nachricht + internal abstract class Nachricht : IRowable { - //public List Segmente { get; set; } + public abstract List GetSegments(); - //public Nachricht() - //{ - // Segmente = new List(); - //} + public string GetRows() + { + return string.Join(DakotaConfig.NewLine, GetSegments()); + } } } diff --git a/Dakota/Models/NachrichtSLGA.cs b/Dakota/Models/NachrichtSLGA.cs index af66960f6..b71ae4d8d 100644 --- a/Dakota/Models/NachrichtSLGA.cs +++ b/Dakota/Models/NachrichtSLGA.cs @@ -11,7 +11,7 @@ namespace Dakota.Models /// Gesamtaufstellung der /// Abrechnung(Rechnung) /// - internal class NachrichtSLGA + internal class NachrichtSLGA : Nachricht { /// /// Das Segment enthält Informationen über die zu verarbeitende Rechnung, den Rechnungssteller @@ -40,5 +40,20 @@ namespace Dakota.Models /// Das Segment enthält den Namen und die Firmenbezeichnung des Leistungserbringers /// public SegmentSLGANAM SegmentNAM { get; set; } + + public NachrichtSLGA() + { + SegmentFKT = new SegmentSLGAFKT(); + SegmentREC = new SegmentSLGAREC(); + SegmentUST = new SegmentSLGAUST(); + SegmentSKO = new SegmentSLGASKO(); + SegmentGES = new SegmentSLGAGES(); + SegmentNAM = new SegmentSLGANAM(); + } + + public override List GetSegments() + { + return new List() { SegmentFKT, SegmentREC, SegmentUST, SegmentSKO, SegmentGES, SegmentNAM }; + } } } diff --git a/Dakota/Models/NachrichtSLLA.cs b/Dakota/Models/NachrichtSLLA.cs index 5ca93466e..f897fcaea 100644 --- a/Dakota/Models/NachrichtSLLA.cs +++ b/Dakota/Models/NachrichtSLLA.cs @@ -10,7 +10,7 @@ namespace Dakota.Models /// /// Leistungserbringer /// - internal class NachrichtSLLA + internal class NachrichtSLLA : Nachricht { /// /// Das Segment enthält Informationen über den tatsächlichen @@ -115,5 +115,13 @@ namespace Dakota.Models SegmentSLLASKZ = new SegmentSLLASKZ(); SegmentSLLABES = new SegmentSLLABES(); } + + public override List GetSegments() + { + return new List() { SegmentSLLAFKT, SegmentSLLAREC, SegmentSLLAINV, SegmentSLLAURI, SegmentSLLANAD, SegmentSLLAIMG, + SegmentSLLAENF, SegmentSLLASUT, SegmentSLLATXT, SegmentSLLAMWS, + SegmentSLLAZUZ, SegmentSLLAZUV, SegmentSLLADIA, SegmentSLLASKZ, SegmentSLLABES + }; + } } } diff --git a/Dakota/Models/Segmente/Segment.cs b/Dakota/Models/Segmente/Segment.cs index e07581929..cf93a274e 100644 --- a/Dakota/Models/Segmente/Segment.cs +++ b/Dakota/Models/Segmente/Segment.cs @@ -6,14 +6,14 @@ using System.Threading.Tasks; namespace Dakota.Models.Segmente { - internal abstract class Segment + internal abstract class Segment : Dateneinheit { //public List Datenelemente { get; set; } public abstract string GetHead(); public abstract List GetBody(); - public string ToString() + public override string GetValue() { Dateneinheit lastzero = null; var body = GetBody(); @@ -28,7 +28,7 @@ namespace Dakota.Models.Segmente body.Remove(item); } - return GetHead() + DakotaConfig.Trennzeichen + string.Join(DakotaConfig.Trennzeichen, body.Select(x => x.GetValue())) + DakotaConfig.Segmentendezeichen; + return GetHead() + DakotaConfig.Trennzeichen + string.Join(DakotaConfig.Trennzeichen, body.Select(x => x.GetValue())) + DakotaConfig.Segmentendezeichen + DakotaConfig.NewLine; } } } diff --git a/Dakota/Models/Segmente/SegmentUNB.cs b/Dakota/Models/Segmente/SegmentUNB.cs index 60529a3d2..f0fd438c6 100644 --- a/Dakota/Models/Segmente/SegmentUNB.cs +++ b/Dakota/Models/Segmente/SegmentUNB.cs @@ -58,7 +58,7 @@ namespace Dakota.Models.Segmente /// Bei Überlauf der Datenaustauschreferenz („99999“) ist wieder /// bei Eins(„00001“) zu beginnen /// - public Dateneinheit Datenaustauschreferenz { get; private set; } + public Datenelement Datenaustauschreferenz { get; private set; } /// /// Einzutragen ist der Leistungserbringer-Sammelgruppenschlüssel, /// siehe Schlüssel Anlage 3 Abschnitt 8.1.14 diff --git a/Dakota/Models/SozioTherapieDatei.cs b/Dakota/Models/SozioTherapieDatei.cs index 8aa51ab92..d660b9d6a 100644 --- a/Dakota/Models/SozioTherapieDatei.cs +++ b/Dakota/Models/SozioTherapieDatei.cs @@ -7,10 +7,20 @@ using System.Threading.Tasks; namespace Dakota.Models { - internal class SozioTherapieDatei : Nutzdatendatei + internal class SozioTherapieDatei : IRowable { public SegmentUNB UNB { get; set; } - + public List BlockKostenträger { get; set; } public SegmentUNZ UNZ { get; set; } + + internal SozioTherapieDatei() + { + BlockKostenträger = new List(); + } + + public string GetRows() + { + return UNB.GetValue() + string.Join(string.Empty, BlockKostenträger.Select(x => x.GetRows())) + UNZ.GetValue(); + } } }