Commit 8f90f001 by lcx

Merge branch 'feature/核算单元' into develop

parents 36fa2023 745fef27
...@@ -40,6 +40,12 @@ public class ExtractTransDto ...@@ -40,6 +40,12 @@ public class ExtractTransDto
public string SheetName { get; set; } public string SheetName { get; set; }
/// <summary> /// <summary>
/// ex_type >> ename
/// 根据ename中的关键字门诊、住院取对应的核算单元
/// </summary>
public string EName { get; set; }
/// <summary>
/// 核算单元(门诊医生) /// 核算单元(门诊医生)
/// </summary> /// </summary>
public string OutDoctorAccounting { get; set; } public string OutDoctorAccounting { get; set; }
......
...@@ -197,8 +197,17 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -197,8 +197,17 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
{ {
var departments = data.Select(s => s.Department ?? "")/*.Where(w => !string.IsNullOrEmpty(w))*/.Distinct().ToList(); var departments = data.Select(s => s.Department ?? "")/*.Where(w => !string.IsNullOrEmpty(w))*/.Distinct().ToList();
var filed = sheet.SheetName.Contains("住院") ? fieldInpat : fieldOut; var filed = new Dictionary<string, Func<ExtractTransDto, string>>();
if (sheet.SheetName.Contains("工作量")) if (sheetType == SheetType.Income)
{
if (sheet.SheetName.Contains("住院") || sheet.SheetName.Contains("门诊"))
filed = sheet.SheetName.Contains("住院") ? fieldInpat : fieldOut;
var ename = data.Where(w => w.SheetName == sheet.SheetName)?.FirstOrDefault(w => !string.IsNullOrEmpty(w.EName))?.EName;
if (ename.Contains("住院") || ename.Contains("门诊"))
filed = ename.Contains("住院") ? fieldInpatOut : fieldOutInpat;
}
else if (sheet.SheetName.Contains("工作量"))
{ {
filed = sheet.SheetName.Contains("医生") ? fieldDoctor : fieldNurse; filed = sheet.SheetName.Contains("医生") ? fieldDoctor : fieldNurse;
} }
...@@ -316,6 +325,24 @@ public static string HasValue(params string[] list) ...@@ -316,6 +325,24 @@ public static string HasValue(params string[] list)
{ "核算单元(医技组)", (dto) => dto.OutTechnicAccounting }, { "核算单元(医技组)", (dto) => dto.OutTechnicAccounting },
}; };
/// <summary> 住院核算单元 </summary>
private static readonly Dictionary<string, Func<ExtractTransDto, string>> fieldInpatOut = new Dictionary<string, Func<ExtractTransDto, string>>
{
{ "科室名称", (dto) => dto.Department },
{ "核算单元(医生组)", (dto) => new string[]{ dto.InpatDoctorAccounting, dto.OutDoctorAccounting }.FirstOrDefault(w=>!string.IsNullOrEmpty(w)) },
{ "核算单元(护理组)", (dto) => new string[]{ dto.InpatNurseAccounting, dto.OutNurseAccounting }.FirstOrDefault(w=>!string.IsNullOrEmpty(w)) },
{ "核算单元(医技组)", (dto) => new string[]{ dto.InpatTechnicAccounting, dto.OutTechnicAccounting }.FirstOrDefault(w=>!string.IsNullOrEmpty(w)) },
};
/// <summary> 门诊核算单元 </summary>
private static readonly Dictionary<string, Func<ExtractTransDto, string>> fieldOutInpat = new Dictionary<string, Func<ExtractTransDto, string>>
{
{ "科室名称", (dto) => dto.Department },
{ "核算单元(医生组)", (dto) => new string[]{ dto.OutDoctorAccounting, dto.InpatDoctorAccounting }.FirstOrDefault(w=>!string.IsNullOrEmpty(w)) },
{ "核算单元(护理组)", (dto) => new string[]{ dto.OutNurseAccounting, dto.InpatNurseAccounting }.FirstOrDefault(w=>!string.IsNullOrEmpty(w)) },
{ "核算单元(医技组)", (dto) => new string[]{ dto.OutTechnicAccounting, dto.InpatTechnicAccounting }.FirstOrDefault(w=>!string.IsNullOrEmpty(w)) },
};
/// <summary> 医生工作量 </summary> /// <summary> 医生工作量 </summary>
private static readonly Dictionary<string, Func<ExtractTransDto, string>> fieldDoctor = new Dictionary<string, Func<ExtractTransDto, string>> private static readonly Dictionary<string, Func<ExtractTransDto, string>> fieldDoctor = new Dictionary<string, Func<ExtractTransDto, string>>
{ {
......
...@@ -24,6 +24,7 @@ public class ExtractService : IAutoInjection ...@@ -24,6 +24,7 @@ public class ExtractService : IAutoInjection
private readonly CustomDataWrite customDataWrite; private readonly CustomDataWrite customDataWrite;
private readonly PerforPerallotRepository perallotRepository; private readonly PerforPerallotRepository perallotRepository;
private readonly PerforCollectdataRepository collectdataRepository; private readonly PerforCollectdataRepository collectdataRepository;
private readonly PerforExtypeRepository extypeRepository;
private readonly PerforPeremployeeRepository peremployeeRepository; private readonly PerforPeremployeeRepository peremployeeRepository;
private readonly PerforPerdeptdicRepository perdeptdicRepository; private readonly PerforPerdeptdicRepository perdeptdicRepository;
private readonly PerforCofdrugtypefactorRepository drugtypefactorRepository; private readonly PerforCofdrugtypefactorRepository drugtypefactorRepository;
...@@ -39,6 +40,7 @@ public class ExtractService : IAutoInjection ...@@ -39,6 +40,7 @@ public class ExtractService : IAutoInjection
CustomDataWrite customDataWrite, CustomDataWrite customDataWrite,
PerforPerallotRepository perallotRepository, PerforPerallotRepository perallotRepository,
PerforCollectdataRepository collectdataRepository, PerforCollectdataRepository collectdataRepository,
PerforExtypeRepository extypeRepository,
PerforPeremployeeRepository peremployeeRepository, PerforPeremployeeRepository peremployeeRepository,
PerforPerdeptdicRepository perdeptdicRepository, PerforPerdeptdicRepository perdeptdicRepository,
PerforCofdrugtypefactorRepository drugtypefactorRepository PerforCofdrugtypefactorRepository drugtypefactorRepository
...@@ -54,6 +56,7 @@ PerforCofdrugtypefactorRepository drugtypefactorRepository ...@@ -54,6 +56,7 @@ PerforCofdrugtypefactorRepository drugtypefactorRepository
this.customDataWrite = customDataWrite; this.customDataWrite = customDataWrite;
this.perallotRepository = perallotRepository; this.perallotRepository = perallotRepository;
this.collectdataRepository = collectdataRepository; this.collectdataRepository = collectdataRepository;
this.extypeRepository = extypeRepository;
this.peremployeeRepository = peremployeeRepository; this.peremployeeRepository = peremployeeRepository;
this.perdeptdicRepository = perdeptdicRepository; this.perdeptdicRepository = perdeptdicRepository;
this.drugtypefactorRepository = drugtypefactorRepository; this.drugtypefactorRepository = drugtypefactorRepository;
...@@ -268,15 +271,20 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re ...@@ -268,15 +271,20 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
t.Department = string.IsNullOrEmpty(t.Department) ? "(空白)" : t.Department; t.Department = string.IsNullOrEmpty(t.Department) ? "(空白)" : t.Department;
}); });
var types = extypeRepository.GetEntities(w => w.HospitalId == hospitalId) ?? new List<ex_type>();
var dict = personService.GetDepartments(hospitalId)?.ToList(); var dict = personService.GetDepartments(hospitalId)?.ToList();
if (dict == null || !dict.Any()) if (dict == null || !dict.Any())
{
return results.GroupBy(t => new { t.Department, t.Category, t.Source }).Select(t => new ExtractTransDto return results.GroupBy(t => new { t.Department, t.Category, t.Source }).Select(t => new ExtractTransDto
{ {
SheetName = t.Key.Source, SheetName = t.Key.Source,
Department = t.Key.Department, Department = t.Key.Department,
Category = t.Key.Category, Category = t.Key.Category,
Value = t.Sum(group => group.Fee) == 0 ? null : t.Sum(group => group.Fee), Value = t.Sum(group => group.Fee) == 0 ? null : t.Sum(group => group.Fee),
EName = types.FirstOrDefault(w => w.Id == t.FirstOrDefault().TypeId)?.EName
}).ToList(); }).ToList();
}
dict.ForEach(t => dict.ForEach(t =>
{ {
...@@ -302,6 +310,7 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re ...@@ -302,6 +310,7 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
InpatNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatNurseAccounting?.AccountingUnit, InpatNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatNurseAccounting?.AccountingUnit,
InpatTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatTechnicAccounting?.AccountingUnit, InpatTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatTechnicAccounting?.AccountingUnit,
SpecialAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.SpecialAccounting?.AccountingUnit ?? dept, SpecialAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.SpecialAccounting?.AccountingUnit ?? dept,
EName = types.FirstOrDefault(w => w.Id == t.outer.TypeId)?.EName,
}; };
}); });
...@@ -317,7 +326,8 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re ...@@ -317,7 +326,8 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
InpatDoctorAccounting = t.First().InpatDoctorAccounting, InpatDoctorAccounting = t.First().InpatDoctorAccounting,
InpatNurseAccounting = t.First().InpatNurseAccounting, InpatNurseAccounting = t.First().InpatNurseAccounting,
InpatTechnicAccounting = t.First().InpatTechnicAccounting, InpatTechnicAccounting = t.First().InpatTechnicAccounting,
SpecialAccounting = t.First().SpecialAccounting SpecialAccounting = t.First().SpecialAccounting,
EName = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.EName)).EName
}); });
return groupdata.ToList(); return groupdata.ToList();
......
...@@ -223,6 +223,7 @@ private List<ex_result> ExtractModuleData(per_allot allot, string groupName, boo ...@@ -223,6 +223,7 @@ private List<ex_result> ExtractModuleData(per_allot allot, string groupName, boo
DoctorName = t.DoctorName, DoctorName = t.DoctorName,
PersonnelNumber = t.PersonnelNumber, PersonnelNumber = t.PersonnelNumber,
Source = f.ModuleName, Source = f.ModuleName,
TypeId = typeId,
DatabaseType = config.DataBaseType, DatabaseType = config.DataBaseType,
ConfigId = config.Id, ConfigId = config.Id,
AllotId = allot.ID, AllotId = allot.ID,
...@@ -294,6 +295,7 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool ...@@ -294,6 +295,7 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
DoctorName = t.DoctorName, DoctorName = t.DoctorName,
PersonnelNumber = t.PersonnelNumber, PersonnelNumber = t.PersonnelNumber,
Source = modulename, Source = modulename,
TypeId = typeId,
DatabaseType = config.DataBaseType, DatabaseType = config.DataBaseType,
ConfigId = config.Id, ConfigId = config.Id,
AllotId = allot.ID, AllotId = allot.ID,
...@@ -356,6 +358,7 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo ...@@ -356,6 +358,7 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
DoctorName = t.DoctorName, DoctorName = t.DoctorName,
PersonnelNumber = t.PersonnelNumber, PersonnelNumber = t.PersonnelNumber,
Source = "4.2 特殊核算单元绩效测算表", Source = "4.2 特殊核算单元绩效测算表",
TypeId = typeId,
DatabaseType = config.DataBaseType, DatabaseType = config.DataBaseType,
ConfigId = config.Id, ConfigId = config.Id,
AllotId = allot.ID, AllotId = allot.ID,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment