ICF wird nun auf Basis der XML Datei erstellt (Vorher Datenbank)
This commit is contained in:
@@ -431,6 +431,9 @@ namespace BeWo.View.Detail.Report
|
||||
}
|
||||
|
||||
private void MyPivotGridControl_CustomFieldSort(object sender, PivotCustomFieldSortEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void ButtonShowOptions_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -274,6 +274,7 @@
|
||||
<Compile Include="Entities\VarFieldValue.cs" />
|
||||
<Compile Include="Entities\Wohnheimbuchung.cs" />
|
||||
<Compile Include="ICD10\ICD10DAO.cs" />
|
||||
<Compile Include="ICF\ICFDAO.cs" />
|
||||
<Compile Include="LoggedInUserOperationContextExt.cs" />
|
||||
<Compile Include="MultitenancyOperationContextExt.cs" />
|
||||
<Compile Include="Security\BCrypt.cs" />
|
||||
@@ -591,6 +592,9 @@
|
||||
<EmbeddedResource Include="Mappings\ReportTemplate.hbm.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Content Include="ICF\icf.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Mappings\DeletionHistory.hbm.xml" />
|
||||
<EmbeddedResource Include="Mappings\FlexibleReportLayout.hbm.xml">
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -31,92 +31,92 @@ namespace BeWo.Data.ICD10
|
||||
//_File = XDocument.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\ICD10\icd10gm2009syst_claml_20080929.xml"));
|
||||
//_File = XDocument.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\ICD10\icd10gm2012syst_claml_20110923.xml"));
|
||||
string file = ConfigurationManager.AppSettings.Get("ICD10File");
|
||||
if (String.IsNullOrEmpty(file) ||
|
||||
!File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\ICD10\" + file)))
|
||||
{
|
||||
file = "icd10.xml";
|
||||
}
|
||||
file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\ICD10\" + file);
|
||||
_File = XDocument.Load(file);
|
||||
|
||||
|
||||
if (String.IsNullOrEmpty(file) ||
|
||||
!File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\ICD10\" + file)))
|
||||
{
|
||||
file = "icd10.xml";
|
||||
}
|
||||
file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\ICD10\" + file);
|
||||
_File = XDocument.Load(file);
|
||||
|
||||
var classes = _File.Root.Descendants("Class").Where(n => n.Attribute("kind").Value.Equals("category"));
|
||||
|
||||
var modifier2ModifierClasses = new Dictionary<String, IList<XElement>>();
|
||||
foreach (var mc in _File.Root.Descendants("ModifierClass"))
|
||||
{
|
||||
String code = mc.Attribute("modifier").Value;
|
||||
|
||||
if (!String.IsNullOrEmpty(code))
|
||||
{
|
||||
IList<XElement> elements = null;
|
||||
if (!modifier2ModifierClasses.ContainsKey(code))
|
||||
{
|
||||
elements = new List<XElement>();
|
||||
modifier2ModifierClasses.Add(code, elements);
|
||||
}
|
||||
else
|
||||
{
|
||||
elements = modifier2ModifierClasses[code];
|
||||
}
|
||||
elements.Add(mc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach (var c in classes)
|
||||
{
|
||||
String classCode = c.Attribute("code").Value;
|
||||
var diagnosis = c.Descendants()
|
||||
.Single(m => m.Attribute("kind") != null && m.Attribute("kind").Value.Equals("preferred"))
|
||||
.Descendants().First().Value;
|
||||
var classes = _File.Root.Descendants("Class").Where(n => n.Attribute("kind").Value.Equals("category"));
|
||||
|
||||
_Codes2Diagnosis.Add(classCode, diagnosis);
|
||||
var modifiedBy = c.Descendants("ModifiedBy").FirstOrDefault();
|
||||
if (modifiedBy != null)
|
||||
{
|
||||
String code = modifiedBy.Attribute("code").Value;
|
||||
var modifier2ModifierClasses = new Dictionary<String, IList<XElement>>();
|
||||
foreach (var mc in _File.Root.Descendants("ModifierClass"))
|
||||
{
|
||||
String code = mc.Attribute("modifier").Value;
|
||||
|
||||
if (modifier2ModifierClasses.ContainsKey(code))
|
||||
{
|
||||
var modifierList = modifier2ModifierClasses[code];
|
||||
foreach (var xElement in modifierList)
|
||||
{
|
||||
String modifierCode = xElement.Attribute("code").Value;
|
||||
var modifiedDiagnosis = xElement.Descendants()
|
||||
.Single(m => m.Attribute("kind") != null && m.Attribute("kind").Value.Equals("preferred"))
|
||||
.Descendants().First().Value;
|
||||
if (!String.IsNullOrEmpty(code))
|
||||
{
|
||||
IList<XElement> elements = null;
|
||||
if (!modifier2ModifierClasses.ContainsKey(code))
|
||||
{
|
||||
elements = new List<XElement>();
|
||||
modifier2ModifierClasses.Add(code, elements);
|
||||
}
|
||||
else
|
||||
{
|
||||
elements = modifier2ModifierClasses[code];
|
||||
}
|
||||
elements.Add(mc);
|
||||
}
|
||||
|
||||
_Codes2Diagnosis.Add(classCode + modifierCode, diagnosis + ": " + modifiedDiagnosis);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
foreach (var c in classes)
|
||||
{
|
||||
String classCode = c.Attribute("code").Value;
|
||||
var diagnosis = c.Descendants()
|
||||
.Single(m => m.Attribute("kind") != null && m.Attribute("kind").Value.Equals("preferred"))
|
||||
.Descendants().First().Value;
|
||||
|
||||
_Codes2Diagnosis.Add(classCode, diagnosis);
|
||||
var modifiedBy = c.Descendants("ModifiedBy").FirstOrDefault();
|
||||
if (modifiedBy != null)
|
||||
{
|
||||
String code = modifiedBy.Attribute("code").Value;
|
||||
|
||||
if (modifier2ModifierClasses.ContainsKey(code))
|
||||
{
|
||||
var modifierList = modifier2ModifierClasses[code];
|
||||
foreach (var xElement in modifierList)
|
||||
{
|
||||
String modifierCode = xElement.Attribute("code").Value;
|
||||
var modifiedDiagnosis = xElement.Descendants()
|
||||
.Single(m => m.Attribute("kind") != null && m.Attribute("kind").Value.Equals("preferred"))
|
||||
.Descendants().First().Value;
|
||||
|
||||
_Codes2Diagnosis.Add(classCode + modifierCode, diagnosis + ": " + modifiedDiagnosis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//_Codes2Diagnosis = _File.Root.Descendants("Class").Where(n => n.Attribute("kind").Value.Equals("category"))
|
||||
// .ToDictionary(n => n.Attribute("code").Value, n => n.Descendants().Single(m => m.Attribute("kind") != null && m.Attribute("kind").Value.Equals("preferred")).Descendants().First().Value);
|
||||
|
||||
try
|
||||
{
|
||||
// Codes ohne Punkt kann man ignorieren
|
||||
// E10.2 "Mit Nierenkomplikationen" -> .2 = code, "Mit Nierenkomplikationen" = val
|
||||
// Zusammenhang (E10, E11 etc.) über ModifiedBy der Class in _Codes2Diagnosis
|
||||
// ModifiedBy ist der Modifier in ModifierClass
|
||||
// Codes ohne Punkt kann man ignorieren
|
||||
// E10.2 "Mit Nierenkomplikationen" -> .2 = code, "Mit Nierenkomplikationen" = val
|
||||
// Zusammenhang (E10, E11 etc.) über ModifiedBy der Class in _Codes2Diagnosis
|
||||
// ModifiedBy ist der Modifier in ModifierClass
|
||||
var modifierClasses = _File.Root.Descendants("ModifierClass").ToList();
|
||||
|
||||
foreach (var modifierClass in modifierClasses)
|
||||
foreach (var modifierClass in modifierClasses)
|
||||
{
|
||||
var modifier = modifierClass.Attribute("modifier").Value;
|
||||
var code = modifierClass.Attribute("code").Value;
|
||||
var modifier = modifierClass.Attribute("modifier").Value;
|
||||
var code = modifierClass.Attribute("code").Value;
|
||||
|
||||
if (!code.StartsWith("."))
|
||||
continue;
|
||||
|
||||
var val = modifierClass.Descendants().Single(m => m.Attribute("kind") != null && m.Attribute("kind").Value.Equals("preferred")).Descendants().First().Value;
|
||||
var val = modifierClass.Descendants().Single(m => m.Attribute("kind") != null && m.Attribute("kind").Value.Equals("preferred")).Descendants().First().Value;
|
||||
|
||||
var innen = new Dictionary<string, string> { { code, val } };
|
||||
if (aussen.ContainsKey(modifier))
|
||||
@@ -125,13 +125,13 @@ namespace BeWo.Data.ICD10
|
||||
}
|
||||
else
|
||||
{
|
||||
aussen.Add(modifier, new List<Dictionary<string, string>> {innen});
|
||||
aussen.Add(modifier, new List<Dictionary<string, string>> { innen });
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
var e = DateTime.Now - s;
|
||||
@@ -146,7 +146,7 @@ namespace BeWo.Data.ICD10
|
||||
{
|
||||
var sr = new StringBuilder();
|
||||
|
||||
if(_Codes2Diagnosis != null)
|
||||
if (_Codes2Diagnosis != null)
|
||||
{
|
||||
foreach (var kvp in _Codes2Diagnosis)
|
||||
{
|
||||
|
||||
114
Data/ICF/ICFDAO.cs
Normal file
114
Data/ICF/ICFDAO.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
using BS.Shared.DataContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace BeWo.Data.ICF
|
||||
{
|
||||
public static class ICFDAO
|
||||
{
|
||||
private static readonly XDocument _File;
|
||||
private static readonly XElement _Root;
|
||||
|
||||
static ICFDAO()
|
||||
{
|
||||
try
|
||||
{
|
||||
_File = XDocument.Load(@"D:\Projects\BeWoPlaner\BeWo\Data\ICF\icf.xml");
|
||||
Debug.WriteLine("Dokument geladen");
|
||||
_Root = _File.Descendants("Class").Where(x => x.Attribute("code")?.Value == "d").First();
|
||||
Debug.WriteLine("Root gefunden");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static IList<ValueListEntryDC> GetIcf()
|
||||
{
|
||||
if (_Root == null) return null;
|
||||
|
||||
long id = 1;
|
||||
|
||||
return GetChildren(_Root, 0, ref id);
|
||||
}
|
||||
|
||||
|
||||
//var chapters = root.Descendants("SubClass");
|
||||
|
||||
public static IList<ValueListEntryDC> GetChildren(XElement xElement, long? parentId, ref long id)
|
||||
{
|
||||
var icfs = new List<ValueListEntryDC>();
|
||||
var actualEntry = GenerateValueListEntryDC(xElement, parentId, ref id);
|
||||
|
||||
icfs.Add(actualEntry);
|
||||
|
||||
var xElementSubClasses = xElement.Descendants("SubClass");
|
||||
var xElementSubClassesCodes = xElementSubClasses.Select(x => x.Attribute("code").Value);
|
||||
var allClasses = _File.Descendants("Class");
|
||||
var subClasses = allClasses.Where(x => xElementSubClassesCodes.Contains(x.Attribute("code").Value));
|
||||
|
||||
if (subClasses.Any())
|
||||
{
|
||||
foreach (var subClass in subClasses)
|
||||
{
|
||||
icfs.AddRange(GetChildren(subClass, actualEntry.ValueListEntryOid, ref id));
|
||||
}
|
||||
}
|
||||
|
||||
return icfs;
|
||||
}
|
||||
|
||||
// ValueListEntryOid = x.Oid,
|
||||
// ParentOid = x.ParentOID,
|
||||
// TypeDescription = x.Bezeichnung,
|
||||
// Abbreviation = x.Code,
|
||||
// Notice = x.Beschreibung
|
||||
|
||||
public static ValueListEntryDC GenerateValueListEntryDC(XElement xElement, long? parentId, ref long id)
|
||||
{
|
||||
id++;
|
||||
|
||||
switch (xElement.Attribute("kind").Value)
|
||||
{
|
||||
case "component":
|
||||
return new ValueListEntryDC() { ParentOid = -1, TypeDescription = "ICF" };
|
||||
case "chapter":
|
||||
return new ValueListEntryDC()
|
||||
{
|
||||
ValueListEntryOid = id,
|
||||
ParentOid = parentId,
|
||||
TypeDescription = "Kapitel " + xElement.Attribute("code").Value[1] + ": " + xElement.Descendants("Rubric").Where(x => x.Attribute("kind").Value == "preferred").First().Descendants("Label").First().Value,
|
||||
Abbreviation = null,
|
||||
Notice = xElement.Descendants("Rubric").Where(x => x.Attribute("kind").Value == "coding-hint").First().Descendants("Label").First().Value
|
||||
};
|
||||
case "block":
|
||||
return new ValueListEntryDC()
|
||||
{
|
||||
ValueListEntryOid = id,
|
||||
ParentOid = parentId,
|
||||
TypeDescription = xElement.Descendants("Rubric").Where(x => x.Attribute("kind").Value == "preferred").First().Descendants("Label").First().Value,
|
||||
Abbreviation = null,
|
||||
Notice = null
|
||||
};
|
||||
case "fourdigit": case "fivedigit":
|
||||
return new ValueListEntryDC()
|
||||
{
|
||||
ValueListEntryOid = id,
|
||||
ParentOid = parentId,
|
||||
TypeDescription = xElement.Descendants("Rubric").Where(x => x.Attribute("kind").Value == "preferred").FirstOrDefault()?.Descendants("Label").First().Value,
|
||||
Abbreviation = xElement.Attribute("code").Value,
|
||||
Notice = xElement.Descendants("Rubric").Where(x => x.Attribute("kind").Value == "coding-hint").FirstOrDefault()?.Descendants("Label").First().Value
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
14426
Data/ICF/icf.xml
Normal file
14426
Data/ICF/icf.xml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,7 @@ using BeWo.Data;
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Data.ICD10;
|
||||
using BeWo.Data.ICF;
|
||||
using BeWo.Service.Configuration;
|
||||
using BeWo.Service.Core;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
@@ -5796,57 +5797,56 @@ namespace BeWo.Service.ServiceImplementations
|
||||
{
|
||||
try
|
||||
{
|
||||
string key = "2BT%eGprU\"E$!\"5Flq@l^^KZaYa\"u/icq@MMSWsy$XFo@#q3Arbnx@Plzv7s\\+$a";
|
||||
//string key = "2BT%eGprU\"E$!\"5Flq@l^^KZaYa\"u/icq@MMSWsy$XFo@#q3Arbnx@Plzv7s\\+$a";
|
||||
|
||||
string url = "https://support.bewoplaner.de/api/geticf.php?k=[TENANT]";
|
||||
//string url = "https://support.bewoplaner.de/api/geticf.php?k=[TENANT]";
|
||||
|
||||
|
||||
if (MultitenancyOperationContextExt.Current != null)
|
||||
{
|
||||
url = url.Replace("[TENANT]", MultitenancyOperationContextExt.Current.Tenant);
|
||||
}
|
||||
else
|
||||
{
|
||||
url = url.Replace("[TENANT]", SessionFacade.Tenant);
|
||||
}
|
||||
//if (MultitenancyOperationContextExt.Current != null)
|
||||
//{
|
||||
// url = url.Replace("[TENANT]", MultitenancyOperationContextExt.Current.Tenant);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// url = url.Replace("[TENANT]", SessionFacade.Tenant);
|
||||
//}
|
||||
|
||||
String json = "";
|
||||
//String json = "";
|
||||
|
||||
using (var client = new WebClient())
|
||||
{
|
||||
byte[] response = client.UploadValues(url, "POST", new NameValueCollection()
|
||||
{
|
||||
{"API-KEY", key}
|
||||
});
|
||||
//using (var client = new WebClient())
|
||||
//{
|
||||
// byte[] response = client.UploadValues(url, "POST", new NameValueCollection()
|
||||
// {
|
||||
// {"API-KEY", key}
|
||||
// });
|
||||
|
||||
json = System.Text.Encoding.ASCII.GetString(response);
|
||||
|
||||
// json = System.Text.Encoding.ASCII.GetString(response);
|
||||
|
||||
}
|
||||
|
||||
//}
|
||||
|
||||
//[{"Oid":"1","Code":"","Bezeichnung":"Kapitel 1: Lernen und Wissensanwendung","Beschreibung":"","ParentOID":""}
|
||||
//var icfentry = new { Oid = 0, Code = "", Bezeichnung = "", Beschreibung = "", ParentOid = 0 };
|
||||
|
||||
var icfList = JsonConvert.DeserializeObject<List<Icf>>(json);
|
||||
//var icfList = JsonConvert.DeserializeObject<List<Icf>>(json);
|
||||
|
||||
|
||||
//var rawList = DAOFactory.GenericDAO.GetAll<Icf>().ToList();
|
||||
////var rawList = DAOFactory.GenericDAO.GetAll<Icf>().ToList();
|
||||
|
||||
var icfs = new List<ValueListEntryDC>
|
||||
{
|
||||
new ValueListEntryDC() {ParentOid = -1, TypeDescription = "ICF"}
|
||||
};
|
||||
//var icfs = new List<ValueListEntryDC>
|
||||
//{
|
||||
// new ValueListEntryDC() {ParentOid = -1, TypeDescription = "ICF"}
|
||||
//};
|
||||
|
||||
icfs.AddRange(icfList.Select(x => new ValueListEntryDC()
|
||||
{
|
||||
ValueListEntryOid = x.Oid,
|
||||
ParentOid = x.ParentOID,
|
||||
TypeDescription = x.Bezeichnung,
|
||||
Abbreviation = x.Code,
|
||||
Notice = x.Beschreibung
|
||||
}));
|
||||
|
||||
return icfs;
|
||||
//icfs.AddRange(icfList.Select(x => new ValueListEntryDC()
|
||||
//{
|
||||
// ValueListEntryOid = x.Oid,
|
||||
// ParentOid = x.ParentOID,
|
||||
// TypeDescription = x.Bezeichnung,
|
||||
// Abbreviation = x.Code,
|
||||
// Notice = x.Beschreibung
|
||||
//}));
|
||||
return ICFDAO.GetIcf();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user