Kostenträgerdatei Reader Grundstruktur
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DakotaConfig.cs" />
|
||||
<Compile Include="Logic\DakotaKTDReader.cs" />
|
||||
<Compile Include="Logic\DakotaManager.cs" />
|
||||
<Compile Include="Logic\DakotaUtils.cs" />
|
||||
<Compile Include="Models\Auftragsdatei\Auftragsdatei.cs" />
|
||||
@@ -82,12 +83,15 @@
|
||||
<Compile Include="Models\Infos\InfoParameterInvoiceItem.cs" />
|
||||
<Compile Include="Models\IRowable.cs" />
|
||||
<Compile Include="Models\Nachrichten\Nachricht.cs" />
|
||||
<Compile Include="Models\Nachrichten\NachrichtKTD.cs" />
|
||||
<Compile Include="Models\Nachrichten\NachrichtSLGA.cs" />
|
||||
<Compile Include="Models\Nachrichten\NachrichtSLLA.cs" />
|
||||
<Compile Include="Models\Schlüssels\Schlüssel.cs" />
|
||||
<Compile Include="Models\Schlüssels\SchlüsselAbrechnungscode.cs" />
|
||||
<Compile Include="Models\Schlüssels\SchlüsselArtDerGenehmigung.cs" />
|
||||
<Compile Include="Models\Schlüssels\SchlüsselArtDerVerknüpfung.cs" />
|
||||
<Compile Include="Models\Schlüssels\SchlüsselBVG.cs" />
|
||||
<Compile Include="Models\Schlüssels\SchlüsselKTDVerarbeitungskennzeichen.cs" />
|
||||
<Compile Include="Models\Schlüssels\SchlüsselPosVergütungsart.cs" />
|
||||
<Compile Include="Models\Schlüssels\SchlüsselPosBehandlungsart.cs" />
|
||||
<Compile Include="Models\Schlüssels\SchlüsselPosArtDerEinrichtung.cs" />
|
||||
@@ -104,6 +108,11 @@
|
||||
<Compile Include="Models\Schlüssels\SchlüsselVerarbeitungskennzeichen.cs" />
|
||||
<Compile Include="Models\Schlüssels\SchlüsselVerordnungsbesonderheiten.cs" />
|
||||
<Compile Include="Models\Schlüssels\SchlüsselZuzahlung.cs" />
|
||||
<Compile Include="Models\Segmente\KTD\SegmentKTD.cs" />
|
||||
<Compile Include="Models\Segmente\KTD\SegmentKTDFKT.cs" />
|
||||
<Compile Include="Models\Segmente\KTD\SegmentKTDIDK.cs" />
|
||||
<Compile Include="Models\Segmente\KTD\SegmentKTDVDT.cs" />
|
||||
<Compile Include="Models\Segmente\KTD\SegmentKTDVKG.cs" />
|
||||
<Compile Include="Models\Segmente\SLLA\SegmentSLLABES.cs" />
|
||||
<Compile Include="Models\Segmente\SLLA\SegmentSLLADIA.cs" />
|
||||
<Compile Include="Models\Segmente\SLLA\SegmentSLLAMWS.cs" />
|
||||
|
||||
71
Dakota/Logic/DakotaKTDReader.cs
Normal file
71
Dakota/Logic/DakotaKTDReader.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using Dakota.Models.Nachrichten;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dakota.Logic
|
||||
{
|
||||
public class DakotaKTDReader
|
||||
{
|
||||
private static readonly string[] accept = new string[] { "UNH", "IDK", "VDT", "VKG", "UNT"};
|
||||
|
||||
internal Dictionary<string, NachrichtKTD> IK2NachrichtKTD { get; set; }
|
||||
|
||||
public DakotaKTDReader(string ktd_folder_path)
|
||||
{
|
||||
var dir = new DirectoryInfo(ktd_folder_path);
|
||||
|
||||
var files = dir.GetFiles();
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
var file_lines = File.ReadAllLines(file.FullName);
|
||||
|
||||
foo(file.Name, file_lines);
|
||||
}
|
||||
}
|
||||
|
||||
public void foo(string filename, string[] lines)
|
||||
{
|
||||
var length = lines.Length;
|
||||
|
||||
Queue<string> queue = new Queue<string>();
|
||||
int first_line = 0;
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
var line = lines[i];
|
||||
|
||||
var type = GetType(line);
|
||||
|
||||
if (type is null)
|
||||
continue;
|
||||
|
||||
if (type == "UNH")
|
||||
{
|
||||
first_line = i;
|
||||
}
|
||||
else if (type == "UNT")
|
||||
{
|
||||
if (NachrichtKTD.TryParse(queue.ToArray(), filename, first_line, out var nachricht))
|
||||
{
|
||||
IK2NachrichtKTD.Add(nachricht.IKNummer, nachricht);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
queue.Enqueue(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string GetType(string line)
|
||||
{
|
||||
var type = line.Substring(0, 3);
|
||||
|
||||
return accept.Contains(type) ? type : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Dakota.Models.Auftragsdatei
|
||||
{
|
||||
internal class Auftragsdatei : IRow
|
||||
internal class Auftragsdatei : IRowable
|
||||
{
|
||||
public DakotaFile Parent { get; set; }
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Dakota.Models.Auftragsdatei
|
||||
{
|
||||
internal class AuftragssatzPart1 : IRow
|
||||
internal class AuftragssatzPart1 : IRowable
|
||||
{
|
||||
public Auftragsdatei ParentAuftragsdatei { get; set; }
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Dakota.Models.Auftragsdatei
|
||||
{
|
||||
public class AuftragssatzPart2 : IRow
|
||||
public class AuftragssatzPart2 : IRowable
|
||||
{
|
||||
public DatenelementAuftragsdatei Satzformat { get; private set; }
|
||||
public DatenelementAuftragsdatei Satzlange { get; private set; }
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Dakota.Models.Auftragsdatei
|
||||
{
|
||||
public class AuftragssatzPart3 : IRow
|
||||
public class AuftragssatzPart3 : IRowable
|
||||
{
|
||||
public DatenelementAuftragsdatei Status { get; private set; }
|
||||
public DatenelementAuftragsdatei Wiederholung { get; private set; }
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Dakota.Models.Auftragsdatei
|
||||
{
|
||||
public class AuftragssatzPart4 : IRow
|
||||
public class AuftragssatzPart4 : IRowable
|
||||
{
|
||||
public DatenelementAuftragsdatei EMailAdresseAbsender { get; private set; }
|
||||
public DatenelementAuftragsdatei DateiBezeichnung { get; private set; }
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Dakota.Models
|
||||
{
|
||||
internal interface IRow
|
||||
internal interface IRowable
|
||||
{
|
||||
string GetRows();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Dakota.Models.Nachrichten
|
||||
{
|
||||
internal abstract class Nachricht : IRow
|
||||
internal abstract class Nachricht : IRowable
|
||||
{
|
||||
public abstract List<Segment> GetAllSegments();
|
||||
|
||||
|
||||
71
Dakota/Models/Nachrichten/NachrichtKTD.cs
Normal file
71
Dakota/Models/Nachrichten/NachrichtKTD.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using Dakota.Models.Segmente;
|
||||
using Dakota.Models.Segmente.KTD;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dakota.Models.Nachrichten
|
||||
{
|
||||
internal class NachrichtKTD : Nachricht
|
||||
{
|
||||
public string FileName { get; set; }
|
||||
public int FirstLine { get; set; }
|
||||
|
||||
public SegmentKTDIDK SegmentIDK { get; set; }
|
||||
public SegmentKTDFKT SegmentFKT { get; set; }
|
||||
public List<SegmentKTDVKG> SegmentVKG { get; set; }
|
||||
|
||||
public NachrichtKTD()
|
||||
{
|
||||
SegmentVKG = new List<SegmentKTDVKG>();
|
||||
}
|
||||
|
||||
public string IKNummer
|
||||
{
|
||||
get { return SegmentIDK.Institutionskennzeichen; }
|
||||
}
|
||||
|
||||
|
||||
public override List<Segment> GetAllSegments()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static bool TryParse(string[] rows, string filename, int firstline, out NachrichtKTD nachricht)
|
||||
{
|
||||
try
|
||||
{
|
||||
nachricht = Parse(rows, filename, firstline);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
nachricht = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static NachrichtKTD Parse(string[] rows, string filename, int firstline)
|
||||
{
|
||||
var nachricht = new NachrichtKTD();
|
||||
|
||||
nachricht.SegmentIDK = SegmentKTDIDK.Parse(rows[0]);
|
||||
nachricht.SegmentFKT = SegmentKTDFKT.Parse(rows[1]);
|
||||
|
||||
var length = rows.Length;
|
||||
|
||||
for (int i = 2; i < length; i++)
|
||||
{
|
||||
nachricht.SegmentVKG.Add(SegmentKTDVKG.Parse(rows[2]));
|
||||
}
|
||||
|
||||
nachricht.FileName = filename;
|
||||
nachricht.FirstLine = firstline;
|
||||
|
||||
return nachricht;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,5 +14,16 @@ namespace Dakota.Models.Schlüssels
|
||||
{
|
||||
Value = val;
|
||||
}
|
||||
|
||||
public static T GetSchlüsselSafe<T>(IEnumerable<T> list, string schlüssel) where T : Schlüssel
|
||||
{
|
||||
foreach (var t_schlüssel in list)
|
||||
{
|
||||
if (t_schlüssel.Value == schlüssel)
|
||||
return t_schlüssel;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
32
Dakota/Models/Schlüssels/SchlüsselArtDerVerknüpfung.cs
Normal file
32
Dakota/Models/Schlüssels/SchlüsselArtDerVerknüpfung.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dakota.Models.Schlüssels
|
||||
{
|
||||
public class SchlüsselArtDerVerknüpfung : Schlüssel
|
||||
{
|
||||
public SchlüsselArtDerVerknüpfung(string val) : base(val) { }
|
||||
|
||||
public static SchlüsselArtDerVerknüpfung VerweisVomIKderKvKarteZumKostentrager => new SchlüsselArtDerVerknüpfung("01");
|
||||
public static SchlüsselArtDerVerknüpfung VerweisAufDatenannahmestelleOhneEntschlusselungsbefugnis => new SchlüsselArtDerVerknüpfung("02");
|
||||
public static SchlüsselArtDerVerknüpfung VerweisAufDatenannahmestelleMitEntschlusselungsbefugnis => new SchlüsselArtDerVerknüpfung("03");
|
||||
|
||||
public static SchlüsselArtDerVerknüpfung Parse(string str)
|
||||
{
|
||||
var list = new SchlüsselArtDerVerknüpfung[] {
|
||||
VerweisVomIKderKvKarteZumKostentrager ,
|
||||
VerweisAufDatenannahmestelleOhneEntschlusselungsbefugnis ,
|
||||
VerweisAufDatenannahmestelleMitEntschlusselungsbefugnis };
|
||||
|
||||
var schlüssel = GetSchlüsselSafe(list, str);
|
||||
|
||||
if (schlüssel is null)
|
||||
throw new DakotaException($"ArtDerVerknüpfung {str} nicht gefunden.");
|
||||
|
||||
return schlüssel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using BS.Shared.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dakota.Models.Schlüssels
|
||||
{
|
||||
public class SchlüsselKTDVerarbeitungskennzeichen : Schlüssel
|
||||
{
|
||||
public SchlüsselKTDVerarbeitungskennzeichen(string val) : base(val) { }
|
||||
|
||||
public static SchlüsselKTDVerarbeitungskennzeichen Neuanmeldung => new SchlüsselKTDVerarbeitungskennzeichen("01");
|
||||
public static SchlüsselKTDVerarbeitungskennzeichen Änderung => new SchlüsselKTDVerarbeitungskennzeichen("02");
|
||||
public static SchlüsselKTDVerarbeitungskennzeichen Stornierung => new SchlüsselKTDVerarbeitungskennzeichen("03");
|
||||
public static SchlüsselKTDVerarbeitungskennzeichen Unverändert => new SchlüsselKTDVerarbeitungskennzeichen("04");
|
||||
|
||||
public static SchlüsselKTDVerarbeitungskennzeichen Parse(string str)
|
||||
{
|
||||
var list = new SchlüsselKTDVerarbeitungskennzeichen[] {
|
||||
Neuanmeldung ,
|
||||
Änderung ,
|
||||
Stornierung,
|
||||
Unverändert};
|
||||
|
||||
var schlüssel = GetSchlüsselSafe(list, str);
|
||||
|
||||
if (schlüssel is null)
|
||||
throw new DakotaException($"KTDVerarbeitungskennzeichen {str} nicht gefunden.");
|
||||
|
||||
return schlüssel;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Dakota/Models/Segmente/KTD/SegmentKTD.cs
Normal file
15
Dakota/Models/Segmente/KTD/SegmentKTD.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Dakota.Models.Daten;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dakota.Models.Segmente.KTD
|
||||
{
|
||||
internal abstract class SegmentKTD
|
||||
{
|
||||
public static char Trennzeichen => DakotaConfig.Trennzeichen[0];
|
||||
public static char Segmentendezeichen => DakotaConfig.Segmentendezeichen[0];
|
||||
}
|
||||
}
|
||||
21
Dakota/Models/Segmente/KTD/SegmentKTDFKT.cs
Normal file
21
Dakota/Models/Segmente/KTD/SegmentKTDFKT.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Dakota.Models.Schlüssels;
|
||||
using System;
|
||||
|
||||
namespace Dakota.Models.Segmente.KTD
|
||||
{
|
||||
internal class SegmentKTDFKT : SegmentKTD
|
||||
{
|
||||
public SchlüsselKTDVerarbeitungskennzeichen Verarbeitungskennzeichen { get; set; }
|
||||
|
||||
public static SegmentKTDFKT Parse(string row)
|
||||
{
|
||||
var segment = new SegmentKTDFKT();
|
||||
|
||||
var split = row.Trim(Segmentendezeichen).Split(Trennzeichen);
|
||||
|
||||
segment.Verarbeitungskennzeichen = SchlüsselKTDVerarbeitungskennzeichen.Parse(split[1]);
|
||||
|
||||
return segment;
|
||||
}
|
||||
}
|
||||
}
|
||||
32
Dakota/Models/Segmente/KTD/SegmentKTDIDK.cs
Normal file
32
Dakota/Models/Segmente/KTD/SegmentKTDIDK.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dakota.Models.Segmente.KTD
|
||||
{
|
||||
internal class SegmentKTDIDK : SegmentKTD
|
||||
{
|
||||
public string Institutionskennzeichen { get; set; }
|
||||
public string ArtDerInstitution { get; set; }
|
||||
public string Kurzbezeichnung { get; set; }
|
||||
public string VKNR { get; set; }
|
||||
|
||||
public static SegmentKTDIDK Parse(string row)
|
||||
{
|
||||
var segment = new SegmentKTDIDK();
|
||||
|
||||
var split = row.Trim(Segmentendezeichen).Split(Trennzeichen);
|
||||
|
||||
segment.Institutionskennzeichen = split[1];
|
||||
segment.ArtDerInstitution = split[2];
|
||||
segment.Kurzbezeichnung = split[3];
|
||||
|
||||
if(split.Length > 4)
|
||||
segment.VKNR = split[4];
|
||||
|
||||
return segment;
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Dakota/Models/Segmente/KTD/SegmentKTDVDT.cs
Normal file
16
Dakota/Models/Segmente/KTD/SegmentKTDVDT.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dakota.Models.Segmente.KTD
|
||||
{
|
||||
internal class SegmentKTDVDT : SegmentKTD
|
||||
{
|
||||
public static SegmentKTDVDT Parse(string row)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
52
Dakota/Models/Segmente/KTD/SegmentKTDVKG.cs
Normal file
52
Dakota/Models/Segmente/KTD/SegmentKTDVKG.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Dakota.Models.Schlüssels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dakota.Models.Segmente.KTD
|
||||
{
|
||||
internal class SegmentKTDVKG : SegmentKTD
|
||||
{
|
||||
public SchlüsselArtDerVerknüpfung ArtDerVerknüpfung { get; set; }
|
||||
public string IKVerknüpfungspartners { get; set; }
|
||||
public string Leistungserbringergruppe { get; set; }
|
||||
public string IKAbrechnungsstelle { get; set; }
|
||||
public string ArtDerDatenlieferung { get; set; }
|
||||
public string ArtDesÜbermittlungsmediums { get; set; }
|
||||
public string StandortDesLeistungserbringersNachBundesland { get; set; }
|
||||
public string StandortDesLeistungserbringersNachKVBezirk { get; set; }
|
||||
public string Abrechnungscode { get; set; }
|
||||
public string Tarifkennzeichen { get; set; }
|
||||
|
||||
public static SegmentKTDVKG Parse(string row)
|
||||
{
|
||||
var segment = new SegmentKTDVKG();
|
||||
|
||||
var split = row.Trim(Segmentendezeichen).Split(Trennzeichen);
|
||||
|
||||
segment.ArtDerVerknüpfung = SchlüsselArtDerVerknüpfung.Parse(split[1]);
|
||||
segment.IKVerknüpfungspartners = split[2];
|
||||
|
||||
if (split.Length > 3)
|
||||
segment.Leistungserbringergruppe = split[3];
|
||||
if (split.Length > 4)
|
||||
segment.IKAbrechnungsstelle = split[4];
|
||||
if (split.Length > 5)
|
||||
segment.ArtDerDatenlieferung = split[5];
|
||||
if (split.Length > 6)
|
||||
segment.ArtDesÜbermittlungsmediums = split[6];
|
||||
if (split.Length > 7)
|
||||
segment.StandortDesLeistungserbringersNachBundesland = split[7];
|
||||
if (split.Length > 8)
|
||||
segment.StandortDesLeistungserbringersNachKVBezirk = split[8];
|
||||
if (split.Length > 9)
|
||||
segment.Abrechnungscode = split[9];
|
||||
if (split.Length > 10)
|
||||
segment.Tarifkennzeichen = split[10];
|
||||
|
||||
return segment;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<NameOfLastUsedPublishProfile>BeWo2.0</NameOfLastUsedPublishProfile>
|
||||
<UseIISExpress>true</UseIISExpress>
|
||||
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<Use64BitIISExpress>false</Use64BitIISExpress>
|
||||
<IISExpressSSLPort />
|
||||
<IISExpressAnonymousAuthentication />
|
||||
|
||||
Reference in New Issue
Block a user