Mehr logik, IRows, Gesamte Datei wird erstellt, jetzt Befüllung der Daten

This commit is contained in:
2023-06-23 12:06:48 +02:00
parent 07c4b05a39
commit d19c20cf82
16 changed files with 180 additions and 26 deletions

4
.gitignore vendored
View File

@@ -593,4 +593,6 @@ obj
/UnitTestProject472/bin
/UnitTestProject472/obj
/UnitTestProject45/bin
/UnitTestProject45/obj
/UnitTestProject45/obj
/Dakota/bin
/Dakota/obj

View File

@@ -45,9 +45,12 @@
<Compile Include="DakotaEnums.cs" />
<Compile Include="DakotaFileGenerator.cs" />
<Compile Include="DakotaValidator.cs" />
<Compile Include="Models\BlockKostenträger.cs" />
<Compile Include="Models\BlockKrankenkarteVerordnung.cs" />
<Compile Include="Models\Dateneinheit.cs" />
<Compile Include="Models\Datenelement.cs" />
<Compile Include="Models\Datenelementgruppe.cs" />
<Compile Include="Models\IRowable.cs" />
<Compile Include="Models\Nachricht.cs" />
<Compile Include="Models\NachrichtSLGA.cs" />
<Compile Include="Models\NachrichtSLLA.cs" />

View File

@@ -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<string> SpecialCollection => new List<string> { TrennzeichenInnerhalb, Trennzeichen, Aufhebungszeichen, Segmentendezeichen };
}

View File

@@ -11,4 +11,10 @@ namespace Dakota
Kann,
Muss
}
public enum Feldtyp
{
Alpha,
Numerisch
}
}

View File

@@ -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);
}
}
}

View File

@@ -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
{
/// <summary>
/// Wiederhole folgenden Block je IK des Kostenträgers
/// </summary>
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> BlockKrankenkarteVerordnung { get; set; }
internal BlockKostenträger()
{
UNH = new SegmentUNH();
NachrichtSLGA = new NachrichtSLGA();
UNT = new SegmentUNT();
BlockKrankenkarteVerordnung = new List<BlockKrankenkarteVerordnung>();
}
public string GetRows()
{
return UNH.GetValue() + NachrichtSLGA.GetRows() + UNT.GetValue() + string.Join("", BlockKrankenkarteVerordnung.Select(x => x.GetRows()));
}
}
}

View File

@@ -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
{
/// <summary>
/// Wiederhole folgenden Block je IK der Krankenkarte bzw der Verordnung
/// </summary>
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();
}
}
}

View File

@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Dakota.Models
{
internal abstract class Dateneinheit
public abstract class Dateneinheit
{
public abstract string GetValue();

View File

@@ -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)

13
Dakota/Models/IRowable.cs Normal file
View File

@@ -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();
}
}

View File

@@ -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<Segment> Segmente { get; set; }
public abstract List<Segment> GetSegments();
//public Nachricht()
//{
// Segmente = new List<Segment>();
//}
public string GetRows()
{
return string.Join(DakotaConfig.NewLine, GetSegments());
}
}
}

View File

@@ -11,7 +11,7 @@ namespace Dakota.Models
/// Gesamtaufstellung der
/// Abrechnung(Rechnung)
/// </summary>
internal class NachrichtSLGA
internal class NachrichtSLGA : Nachricht
{
/// <summary>
/// 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
/// </summary>
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<Segment> GetSegments()
{
return new List<Segment>() { SegmentFKT, SegmentREC, SegmentUST, SegmentSKO, SegmentGES, SegmentNAM };
}
}
}

View File

@@ -10,7 +10,7 @@ namespace Dakota.Models
/// <summary>
/// Leistungserbringer
/// </summary>
internal class NachrichtSLLA
internal class NachrichtSLLA : Nachricht
{
/// <summary>
/// Das Segment enthält Informationen über den tatsächlichen
@@ -115,5 +115,13 @@ namespace Dakota.Models
SegmentSLLASUT = new SegmentSLLASUT();
SegmentSLLATXT = new SegmentSLLATXT();
SegmentSLLAMWS = new SegmentSLLAMWS();
SegmentSLLAZUZ = new SegmentSLLAZUZ();
SegmentSLLAZUV = new SegmentSLLAZUV();
SegmentSLLADIA = new SegmentSLLADIA();
SegmentSLLASKZ = new SegmentSLLASKZ();
SegmentSLLABES = new SegmentSLLABES();
}
public override List<Segment> GetSegments()
{
return new List<Segment>() { SegmentSLLAFKT, SegmentSLLAREC, SegmentSLLAINV, SegmentSLLAURI, SegmentSLLANAD, SegmentSLLAIMG,

View File

@@ -6,14 +6,14 @@ using System.Threading.Tasks;
namespace Dakota.Models.Segmente
{
internal abstract class Segment
internal abstract class Segment : Dateneinheit
{
//public List<Datenelement> Datenelemente { get; set; }
public abstract string GetHead();
public abstract List<Dateneinheit> 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;
}
}
}

View File

@@ -58,7 +58,7 @@ namespace Dakota.Models.Segmente
/// Bei Überlauf der Datenaustauschreferenz („99999“) ist wieder
/// bei Eins(„00001“) zu beginnen
/// </summary>
public Dateneinheit Datenaustauschreferenz { get; private set; }
public Datenelement Datenaustauschreferenz { get; private set; }
/// <summary>
/// Einzutragen ist der Leistungserbringer-Sammelgruppenschlüssel,
/// siehe Schlüssel Anlage 3 Abschnitt 8.1.14

View File

@@ -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> BlockKostenträger { get; set; }
public SegmentUNZ UNZ { get; set; }
internal SozioTherapieDatei()
{
BlockKostenträger = new List<BlockKostenträger>();
}
public string GetRows()
{
return UNB.GetValue() + string.Join(string.Empty, BlockKostenträger.Select(x => x.GetRows())) + UNZ.GetValue();
}
}
}