122 lines
3.4 KiB
C#
122 lines
3.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Services;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using Castle.Components.DictionaryAdapter;
|
|
using NHibernate.Linq;
|
|
|
|
namespace BeWo.Service.Reporting
|
|
{
|
|
public class JahresBerichtNachDiagnose : JahresBerichtBase
|
|
{
|
|
|
|
private DateTime datum;
|
|
|
|
private Dictionary<String, int> diagM = new Dictionary<String, int>();
|
|
private Dictionary<String, int> diagF = new Dictionary<String, int>();
|
|
private Dictionary<String, int> diagD = new Dictionary<String, int>();
|
|
private Dictionary<String, int> diagUnbekannt = new Dictionary<String, int>();
|
|
|
|
private List<string> diagnosen = new List<string>();
|
|
|
|
public JahresBerichtNachDiagnose(String titel, DateTime datum) : base(titel)
|
|
{
|
|
this.datum = datum;
|
|
}
|
|
|
|
public override void ProcessCustomer(Customer customer)
|
|
{
|
|
Sex? geschlecht = null;
|
|
if (customer.Person.Sex.HasValue)
|
|
{
|
|
geschlecht = customer.Person.Sex;
|
|
}
|
|
|
|
foreach (var d2c in customer.Diagnosis2CustomerList)
|
|
{
|
|
String d = d2c.ICD10DiagnosisCode;
|
|
if (!diagnosen.Contains(d))
|
|
{
|
|
diagnosen.Add(d);
|
|
}
|
|
Dictionary<String, int> dict = null;
|
|
|
|
if (geschlecht == null)
|
|
{
|
|
dict = diagUnbekannt;
|
|
}
|
|
else if (geschlecht.Value == Sex.Male)
|
|
{
|
|
dict = diagM;
|
|
}
|
|
else if (geschlecht.Value == Sex.Female)
|
|
{
|
|
dict = diagF;
|
|
}
|
|
else if (geschlecht.Value == Sex.Divers)
|
|
{
|
|
dict = diagD;
|
|
}
|
|
else
|
|
{
|
|
dict = diagUnbekannt;
|
|
}
|
|
if (!dict.ContainsKey(d))
|
|
{
|
|
dict.Add(d, 0);
|
|
}
|
|
|
|
dict[d]++;
|
|
}
|
|
|
|
}
|
|
|
|
public override AnnualReportDC CreateAuswertung()
|
|
{
|
|
var report = new AnnualReportDC();
|
|
report.Name = Titel;
|
|
report.Data = new List<AnnualReportDataDC>();
|
|
var index = 1;
|
|
|
|
foreach (var dia in diagnosen.OrderBy(d => d))
|
|
{
|
|
var d = new AnnualReportDataDC();
|
|
report.Data.Add(d);
|
|
d.Index = index++;
|
|
d.Name = dia;
|
|
d.Value = 0;
|
|
|
|
if (diagM.ContainsKey(dia))
|
|
{
|
|
d.Value += diagM[dia];
|
|
d.Male += diagM[dia];
|
|
}
|
|
if (diagF.ContainsKey(dia))
|
|
{
|
|
d.Value += diagF[dia];
|
|
d.Female += diagF[dia];
|
|
}
|
|
if (diagD.ContainsKey(dia))
|
|
{
|
|
d.Value += diagD[dia];
|
|
d.Divers += diagD[dia];
|
|
}
|
|
if (diagUnbekannt.ContainsKey(dia))
|
|
{
|
|
d.Value += diagUnbekannt[dia];
|
|
d.NoSex += diagUnbekannt[dia];
|
|
}
|
|
}
|
|
|
|
return report;
|
|
}
|
|
|
|
}
|
|
|
|
} |