Commit 05379d2e by ruyun.zhang@suvalue.com

合并梧州

parents c260facc 9dc0c4ab
...@@ -92,7 +92,6 @@ public void ConfigureServices(IServiceCollection services) ...@@ -92,7 +92,6 @@ public void ConfigureServices(IServiceCollection services)
services.AddSignalR(hubOptions => services.AddSignalR(hubOptions =>
{ {
hubOptions.EnableDetailedErrors = true; hubOptions.EnableDetailedErrors = true;
hubOptions.KeepAliveInterval = TimeSpan.FromMinutes(1);
}); });
// cors // cors
...@@ -141,7 +140,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) ...@@ -141,7 +140,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
endpoints.MapHub<AllotLogHub>("/performance/allotLogHub", options => endpoints.MapHub<AllotLogHub>("/performance/allotLogHub", options =>
{ {
options.Transports = HttpTransportType.WebSockets | HttpTransportType.LongPolling; options.Transports = HttpTransportType.WebSockets | HttpTransportType.LongPolling;
options.WebSockets.CloseTimeout = TimeSpan.FromMinutes(1); options.WebSockets.CloseTimeout = TimeSpan.FromMinutes(20);
}); });
endpoints.MapControllers(); endpoints.MapControllers();
}); });
......
...@@ -3684,6 +3684,11 @@ ...@@ -3684,6 +3684,11 @@
语句执行完成所需时间 语句执行完成所需时间
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ex_script.IsOrgDepartment">
<summary>
是否使用原始科室 1 是 2 否
</summary>
</member>
<member name="T:Performance.EntityModels.ex_special"> <member name="T:Performance.EntityModels.ex_special">
<summary> <summary>
......
...@@ -59,5 +59,10 @@ public class ex_script ...@@ -59,5 +59,10 @@ public class ex_script
/// 语句执行完成所需时间 /// 语句执行完成所需时间
/// </summary> /// </summary>
public decimal TimeConsuming { get; set; } = 0; public decimal TimeConsuming { get; set; } = 0;
/// <summary>
/// 是否使用原始科室 1 是 2 否
/// </summary>
public int IsOrgDepartment { get; set; }
} }
} }
...@@ -112,14 +112,14 @@ public void DefaultModules(int hospitalId) ...@@ -112,14 +112,14 @@ public void DefaultModules(int hospitalId)
public ex_module AddModule(ModModuleRequest request) public ex_module AddModule(ModModuleRequest request)
{ {
if (!new int[] { (int)SheetType.Income, (int)SheetType.OtherWorkload, (int)SheetType.Assess }.Contains(request.SheetType.Value)) if (!new int[] { (int)SheetType.Income, (int)SheetType.OtherIncome, (int)SheetType.OtherWorkload, (int)SheetType.Assess }.Contains(request.SheetType.Value))
throw new PerformanceException("模块类型错误,只支持收入模板配置"); throw new PerformanceException("模块类型错误,只支持收入模板配置");
string addname = ""; string addname = "";
if (request.SheetType == (int)SheetType.Income) if (request.SheetType == (int)SheetType.Income)
{ {
if (request.ModuleName.IndexOf("开单收入") == -1 && request.ModuleName.IndexOf("就诊收入") == -1 && request.ModuleName.IndexOf("执行收入") == -1) //if (request.ModuleName.IndexOf("开单收入") == -1 && request.ModuleName.IndexOf("就诊收入") == -1 && request.ModuleName.IndexOf("执行收入") == -1)
throw new PerformanceException("模块名称规则错误"); // throw new PerformanceException("模块名称规则错误");
//if (!Regex.IsMatch(request.ModuleName, @"^[\u4e00-\u9fa5]+$")) //if (!Regex.IsMatch(request.ModuleName, @"^[\u4e00-\u9fa5]+$"))
// throw new PerformanceException("模块名称规则错误,请使用全中文命名"); // throw new PerformanceException("模块名称规则错误,请使用全中文命名");
...@@ -172,7 +172,10 @@ public ex_module AddModule(ModModuleRequest request) ...@@ -172,7 +172,10 @@ public ex_module AddModule(ModModuleRequest request)
sort[1] += 1; sort[1] += 1;
addname = $"{sort[0]}.{sort[1]} " + request.ModuleName; addname = $"{sort[0]}.{sort[1]} " + request.ModuleName;
} }
else
{
addname = request.ModuleName;
}
ex_module entity = new ex_module ex_module entity = new ex_module
{ {
ModuleName = addname, ModuleName = addname,
......
...@@ -54,8 +54,31 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo ...@@ -54,8 +54,31 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
try try
{ {
//foreach (var module in modulesList.Where(t => t.SheetType == (int)SheetType.Income)?.OrderBy(t => t.ModuleName))
//{
// var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank());
// if (sheet == null)
// {
// string[] keyArray = new string[] { "开单", "就诊", "执行" };
// if (keyArray.Any(key => module.ModuleName.Contains(key)))
// {
// var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("1.")).OrderByDescending(t => t.Key).First();
// var copysheet = workbook.GetSheet(item.Key);
// if (copysheet == null) continue;
// try
// {
// var newSheet = copysheet.CopySheet(module.ModuleName, true);
// workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
// }
// catch (Exception)
// {
// }
// }
// }
//}
var sheetNames = workbook.GetAllNames().Select(w => w.SheetName); var sheetNames = workbook.GetAllNames().Select(w => w.SheetName);
foreach (var module in modulesList.Where(t => t.SheetType == (int)SheetType.Income)?.OrderBy(t => t.ModuleName)) foreach (var module in modulesList.Where(t => new int[] { (int)SheetType.Income, (int)SheetType.OtherIncome }.Contains(t.SheetType.Value))?.OrderBy(t => t.ModuleName))
{ {
var no = module.ModuleName.GetNo(); var no = module.ModuleName.GetNo();
var name = sheetNames.FirstOrDefault(name => name.StartsWith(no)) ?? module.ModuleName; var name = sheetNames.FirstOrDefault(name => name.StartsWith(no)) ?? module.ModuleName;
...@@ -63,18 +86,35 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo ...@@ -63,18 +86,35 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
if (sheet == null) if (sheet == null)
{ {
string[] keyArray = new string[] { "开单", "就诊", "执行" }; ExcelStyle style = new ExcelStyle(workbook);
if (keyArray.Any(key => name.Contains(key))) var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.列头, CellFormat.默认);
{
var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("1.")).OrderByDescending(t => t.Key).First(); var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("1.0.")).OrderByDescending(t => t.Key).First();
var copysheet = workbook.GetSheet(item.Key); var newSheet = workbook.CreateSheet(module.ModuleName);
if (copysheet == null) continue; newSheet.GetOrCreate(1).GetOrCreate(6).SetCellValue("护理组分割比例:");
var newSheet = copysheet.CopySheet(name, true); newSheet.GetOrCreate(1).GetOrCreate(6).CellStyle = cellStyle;
workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1); newSheet.GetOrCreate(2).GetOrCreate(6).SetCellValue("医生组分割比例:");
} newSheet.GetOrCreate(2).GetOrCreate(6).CellStyle = cellStyle;
newSheet.GetOrCreate(3).GetOrCreate(6).SetCellValue("医技组分割比例:");
newSheet.GetOrCreate(3).GetOrCreate(6).CellStyle = cellStyle;
var r5 = newSheet.GetOrCreate(4);
r5.GetOrCreate(0).SetCellValue("核算收入(医技组)");
r5.GetOrCreate(1).SetCellValue("核算收入(医生组)");
r5.GetOrCreate(2).SetCellValue("核算收入(护理组)");
r5.GetOrCreate(3).SetCellValue("核算单元(医技组)");
r5.GetOrCreate(4).SetCellValue("核算单元(医生组)");
r5.GetOrCreate(5).SetCellValue("核算单元(护理组)");
r5.GetOrCreate(6).SetCellValue("科室名称");
r5.GetOrCreate(0).CellStyle = cellStyle;
r5.GetOrCreate(1).CellStyle = cellStyle;
r5.GetOrCreate(2).CellStyle = cellStyle;
r5.GetOrCreate(3).CellStyle = cellStyle;
r5.GetOrCreate(4).CellStyle = cellStyle;
r5.GetOrCreate(5).CellStyle = cellStyle;
r5.GetOrCreate(6).CellStyle = cellStyle;
workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
} }
} }
foreach (var module in modulesList.Where(t => new int[] { (int)SheetType.OtherWorkload, (int)SheetType.Assess }.Contains(t.SheetType.Value))?.OrderBy(t => t.ModuleName)) foreach (var module in modulesList.Where(t => new int[] { (int)SheetType.OtherWorkload, (int)SheetType.Assess }.Contains(t.SheetType.Value))?.OrderBy(t => t.ModuleName))
{ {
var no = module.ModuleName.GetNo(); var no = module.ModuleName.GetNo();
...@@ -93,7 +133,7 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo ...@@ -93,7 +133,7 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
} }
} }
} }
catch catch (Exception ex)
{ {
} }
} }
......
...@@ -131,8 +131,8 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -131,8 +131,8 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
{ {
dataFirstRowNum = point.DataFirstRowNum.Value; dataFirstRowNum = point.DataFirstRowNum.Value;
RemoveIncomeRow(sheet, point); RemoveIncomeRow(sheet, point);
WriteSheetIncomeData(sheet, columnHeader, point, style, headers, data, rows, dataFirstRowNum); var endRowNum = WriteSheetIncomeData(sheet, columnHeader, point, style, headers, data, rows, dataFirstRowNum);
dataFirstRowNum = point.DataFirstRowNum.Value + rows.Count; dataFirstRowNum = endRowNum;
} }
if (data == null || !data.Any()) return; if (data == null || !data.Any()) return;
...@@ -180,19 +180,20 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -180,19 +180,20 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
if (string.IsNullOrEmpty(column)) continue; if (string.IsNullOrEmpty(column)) continue;
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value; var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
//数据为空,且单元格值不为空,不写入数据(保留原始值) //数据为空,且单元格值不为空,不写入数据(保留原始值)
if (value.HasValue && value != 0) // 22.3.29 ry 只要是提取的列头全部覆盖数据
if (headers != null && headers.Contains(column) && value.HasValue && value != 0)
{
cell.SetCellValue<decimal>(value); cell.SetCellValue<decimal>(value);
if (headers != null && headers.Contains(column))
cell.CellStyle = cellStyle; cell.CellStyle = cellStyle;
} }
#endregion #endregion
data.RemoveAll(t => t.Department == department); data.RemoveAll(t => t.Department == department);
} }
//if (point.DataFirstRowNum.Value < dataFirstRowNum) dataFirstRowNum += 1; //if (point.DataFirstRowNum.Value < dataFirstRowNum) dataFirstRowNum += 1;
}
} }
private static void WriteSheetDataNonexistent(ISheet sheet, IRow columnHeader, PerSheetPoint point, SheetType sheetType, ExcelStyle style, private static void WriteSheetDataNonexistent(ISheet sheet, IRow columnHeader, PerSheetPoint point, SheetType sheetType, ExcelStyle style,
...@@ -223,33 +224,38 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -223,33 +224,38 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
foreach (string department in departments) foreach (string department in departments)
{ {
var deptData = data.Where(t => (t.Department ?? "") == department); var deptData = data.Where(t => (t.Department ?? "") == department);
if (deptData != null && deptData.Any())
var row = sheet.GetOrCreate(dataFirstRowNum);
for (int cellIndex = point.HeaderFirstCellNum.Value; cellIndex < columnHeader.LastCellNum; cellIndex++)
{ {
var column = columnHeader.GetCell(cellIndex).GetDecodeEscapes()?.Replace("(", "(").Replace(")", ")"); var row = sheet.GetOrCreate(dataFirstRowNum);
var cell = row.CreateCell(cellIndex); for (int cellIndex = point.HeaderFirstCellNum.Value; cellIndex < columnHeader.LastCellNum; cellIndex++)
if (filed.ContainsKey(column))
{ {
var value = (deptData != null && deptData.Any()) ? filed[column]?.Invoke(deptData.First()) : ""; var column = columnHeader.GetCell(cellIndex).GetDecodeEscapes();
cell.SetCellOValue(value); List<string> uts = new List<string> { "核算单元(医技组)", "核算单元(医生组)", "核算单元(护理组)" };
cell.CellStyle = cellStyle; if (uts.Contains(column))
} column = column?.Replace("(", "(").Replace(")", ")");
else if (sheetType == SheetType.Income || (headers != null && headers.Contains(column)))
{ var cell = row.CreateCell(cellIndex);
var value = (deptData != null && deptData.Any())
? deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value if (filed.ContainsKey(column))
: 0; {
cell.SetCellValue<decimal>(value); var value = filed[column]?.Invoke(deptData.First());
cell.CellStyle = cellStyle; cell.SetCellOValue(value);
cell.CellStyle = cellStyle;
}
else if (sheetType == SheetType.Income || (headers != null && headers.Contains(column)))
{
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle;
}
} }
dataFirstRowNum++;
} }
dataFirstRowNum++;
} }
} }
private static void WriteSheetIncomeData(ISheet sheet, IRow columnHeader, PerSheetPoint point, ExcelStyle style, List<string> headers, private static int WriteSheetIncomeData(ISheet sheet, IRow columnHeader, PerSheetPoint point, ExcelStyle style, List<string> headers,
List<ExtractTransDto> data, List<IncomeRow> incomes, int dataFirstRowNum) List<ExtractTransDto> data, List<IncomeRow> incomes, int dataFirstRowNum)
{ {
var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.数据); var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.数据);
...@@ -286,22 +292,28 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -286,22 +292,28 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
cell.SetCellValue(content.Value); cell.SetCellValue(content.Value);
cell.CellStyle = cellStyle; cell.CellStyle = cellStyle;
} }
}
for (int cellIndex = dataFirstCellNum; cellIndex < columnHeader.LastCellNum; cellIndex++)
{
var column = columnHeader.GetOrCreate(cellIndex).GetDecodeEscapes();
var cell = row.GetOrCreate(cellIndex);
for (int cellIndex = dataFirstCellNum; cellIndex < columnHeader.LastCellNum; cellIndex++) var value = (deptData != null && deptData.Any())
{ ? deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value
var column = columnHeader.GetOrCreate(cellIndex).GetDecodeEscapes(); : 0;
var cell = row.GetOrCreate(cellIndex); //if (cell.CellType != CellType.Formula)
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value; //{
if (value.HasValue && value != 0) // cell.SetCellValue<decimal>(value);
// cell.CellStyle = cellStyle;
//}
cell.SetCellValue<decimal>(value); cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle; cell.CellStyle = cellStyle;
}
dataFirstRowNum++;
data.RemoveAll(t => t.Department == item.Department);
} }
dataFirstRowNum++;
data.RemoveAll(t => t.Department == item.Department);
} }
return dataFirstRowNum;
} }
public static string HasValue(params string[] list) public static string HasValue(params string[] list)
......
...@@ -79,10 +79,11 @@ public void Execute() ...@@ -79,10 +79,11 @@ public void Execute()
if (allot == null || allot.ID == 0) continue; if (allot == null || allot.ID == 0) continue;
var dict = new Dictionary<ExDataDict, object>(); var dict = new Dictionary<ExDataDict, object>();
var scripts = new List<ex_script>();
var isSingle = hospital.IsSingleProject == 1; var isSingle = hospital.IsSingleProject == 1;
dictionaryService.Handler(hospital.ID, allot, "", isSingle); dictionaryService.Handler(hospital.ID, allot, "", isSingle);
var data = queryService.Handler(hospital.ID, allot, "", isSingle, ref dict); var data = queryService.Handler(hospital.ID, allot, "", isSingle, ref dict, ref scripts);
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -97,6 +97,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -97,6 +97,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
allot = allots.First(t => t.ID == allotId); allot = allots.First(t => t.ID == allotId);
var dict = new Dictionary<ExDataDict, object>(); var dict = new Dictionary<ExDataDict, object>();
var scripts = new List<ex_script>();
logService.ReturnTheLog(allotId, groupName, 3, "", 5, 1, isSingle); logService.ReturnTheLog(allotId, groupName, 3, "", 5, 1, isSingle);
...@@ -106,9 +107,9 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -106,9 +107,9 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
employeeService.SyncDataToResult(allotId); employeeService.SyncDataToResult(allotId);
var data = exresultRepository.GetEntities(t => t.AllotId == allotId); var data = exresultRepository.GetEntities(t => t.AllotId == allotId);
data.AddRange(queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict)); data.AddRange(queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict, ref scripts));
var standData = StandDataFormat(hospitalId, allotId, data); var standData = StandDataFormat(hospitalId, allotId, scripts, data);
dictionaryService.Handler(hospitalId, allot, groupName, isSingle); dictionaryService.Handler(hospitalId, allot, groupName, isSingle);
var statesArray = new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive }; var statesArray = new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive };
...@@ -279,7 +280,7 @@ private object GetDataBySheetType(int hospitalId, SheetType sheetType, List<Extr ...@@ -279,7 +280,7 @@ private object GetDataBySheetType(int hospitalId, SheetType sheetType, List<Extr
/// <param name="hospitalId"></param> /// <param name="hospitalId"></param>
/// <param name="results"></param> /// <param name="results"></param>
/// <returns></returns> /// <returns></returns>
private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List<ex_result> results) private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List<ex_script> scripts, List<ex_result> results)
{ {
if (results == null || !results.Any()) return new List<ExtractTransDto>(); if (results == null || !results.Any()) return new List<ExtractTransDto>();
...@@ -306,51 +307,53 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List< ...@@ -306,51 +307,53 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List<
dict.ForEach(t => dict.ForEach(t =>
{ {
t.HISDeptName = WriteDataHelper.HasValue(t.HISDeptName, t.Department); t.Department = WriteDataHelper.HasValue(t.Department, t.HISDeptName);
}); });
var data = new List<ExtractTransDto>(); var data = results
foreach (var item in results) .GroupJoin(dict, outer => new { Department = outer.Department }, inner => new { Department = inner.HISDeptName }, (outer, inner) => new { outer, inner })
{ .Select(t =>
var firstDic = dict.FirstOrDefault(w => w.HISDeptName == item.Department) ?? dict.FirstOrDefault(w => w.Department == item.Department);
var dept = !string.IsNullOrEmpty(firstDic?.Department) ? firstDic?.Department : item.Department;
var d = new ExtractTransDto
{
SheetName = item.Source,
Department = dept,
Category = item.Category,
DoctorName = item.DoctorName,
PersonnelNumber = item.PersonnelNumber,
Value = item.Fee ?? 0,
OutDoctorAccounting = firstDic?.OutDoctorAccounting?.AccountingUnit,
OutNurseAccounting = firstDic?.OutNurseAccounting?.AccountingUnit,
OutTechnicAccounting = firstDic?.OutTechnicAccounting?.AccountingUnit,
InpatDoctorAccounting = firstDic?.InpatDoctorAccounting?.AccountingUnit,
InpatNurseAccounting = firstDic?.InpatNurseAccounting?.AccountingUnit,
InpatTechnicAccounting = firstDic?.InpatTechnicAccounting?.AccountingUnit,
SpecialAccounting = firstDic?.SpecialAccounting?.AccountingUnit ?? dept,
EName = types.FirstOrDefault(w => w.Id == item.TypeId)?.EName,
};
data.Add(d);
}
var groupdata = data.GroupBy(t => new { t.Department, t.Category, t.SheetName })
.Select(t => new ExtractTransDto
{ {
SheetName = t.Key.SheetName, var dept = !string.IsNullOrEmpty(t.inner.FirstOrDefault()?.Department) ? t.inner.FirstOrDefault()?.Department : t.outer.Department;
Department = t.Key.Department, if (scripts.Any(w => w.TypeId == t.outer.TypeId && w.IsOrgDepartment == 1))
Category = t.Key.Category, dept = t.outer.Department;
Value = t.Sum(group => group.Value) == 0 ? null : t.Sum(group => group.Value),
OutDoctorAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.OutDoctorAccounting))?.OutDoctorAccounting, return new ExtractTransDto
OutNurseAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.OutNurseAccounting))?.OutNurseAccounting, {
OutTechnicAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.OutTechnicAccounting))?.OutTechnicAccounting, SheetName = t.outer.Source,
InpatDoctorAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.InpatDoctorAccounting))?.InpatDoctorAccounting, Department = dept,
InpatNurseAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.InpatNurseAccounting))?.InpatNurseAccounting, Category = t.outer.Category,
InpatTechnicAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.InpatTechnicAccounting))?.InpatTechnicAccounting, DoctorName = t.outer.DoctorName,
SpecialAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.SpecialAccounting))?.SpecialAccounting, PersonnelNumber = t.outer.PersonnelNumber,
EName = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.EName))?.EName Value = t.outer.Fee ?? 0,
OutDoctorAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutDoctorAccounting?.AccountingUnit,
OutNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutNurseAccounting?.AccountingUnit,
OutTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutTechnicAccounting?.AccountingUnit,
InpatDoctorAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatDoctorAccounting?.AccountingUnit,
InpatNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatNurseAccounting?.AccountingUnit,
InpatTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatTechnicAccounting?.AccountingUnit,
SpecialAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.SpecialAccounting?.AccountingUnit ?? dept,
EName = types.FirstOrDefault(w => w.Id == t.outer.TypeId)?.EName,
};
}); });
return groupdata.ToList(); var groupdata = data.GroupBy(t => new { t.Department, t.Category, t.SheetName }).Select(t => new ExtractTransDto
{
SheetName = t.Key.SheetName,
Department = t.Key.Department,
Category = t.Key.Category,
Value = t.Sum(group => group.Value) == 0 ? null : t.Sum(group => group.Value),
OutDoctorAccounting = t.FirstOrDefault()?.OutDoctorAccounting,
OutNurseAccounting = t.FirstOrDefault()?.OutNurseAccounting,
OutTechnicAccounting = t.FirstOrDefault()?.OutTechnicAccounting,
InpatDoctorAccounting = t.FirstOrDefault()?.InpatDoctorAccounting,
InpatNurseAccounting = t.FirstOrDefault()?.InpatNurseAccounting,
InpatTechnicAccounting = t.FirstOrDefault()?.InpatTechnicAccounting,
SpecialAccounting = t.FirstOrDefault()?.SpecialAccounting,
EName = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.EName))?.EName
});
return groupdata.Where(w => w.Value.HasValue && w.Value != 0).ToList();
} }
private void UpdateAllot(IDbConnection connection, per_allot allot) private void UpdateAllot(IDbConnection connection, per_allot allot)
......
...@@ -75,7 +75,7 @@ public void ClearConnectionPools() ...@@ -75,7 +75,7 @@ public void ClearConnectionPools()
/// <param name="hospitalId"></param> /// <param name="hospitalId"></param>
/// <param name="allot"></param> /// <param name="allot"></param>
/// <returns></returns> /// <returns></returns>
public List<ex_result> Handler(int hospitalId, per_allot allot, string groupName, bool isSingle, ref Dictionary<ExDataDict, object> dict) public List<ex_result> Handler(int hospitalId, per_allot allot, string groupName, bool isSingle, ref Dictionary<ExDataDict, object> dict, ref List<ex_script> scripts)
{ {
try try
{ {
...@@ -97,7 +97,7 @@ public List<ex_result> Handler(int hospitalId, per_allot allot, string groupName ...@@ -97,7 +97,7 @@ public List<ex_result> Handler(int hospitalId, per_allot allot, string groupName
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"开始提取数据", isSingle: isSingle); logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"开始提取数据", isSingle: isSingle);
var scripts = exscriptRepository.GetEntities(t => extypeIds.Contains(t.TypeId)); scripts = exscriptRepository.GetEntities(t => extypeIds.Contains(t.TypeId));
if (scripts != null && scripts.Any()) if (scripts != null && scripts.Any())
{ {
var allmodules = dict[ExDataDict.ExModule] as List<ex_module>; var allmodules = dict[ExDataDict.ExModule] as List<ex_module>;
......
...@@ -453,7 +453,7 @@ Deptdic GetDeptdic(List<per_dept_dic> dics, string department, string hISDeptNam ...@@ -453,7 +453,7 @@ Deptdic GetDeptdic(List<per_dept_dic> dics, string department, string hISDeptNam
CreateTime = t.Max(group => group.CreateTime), CreateTime = t.Max(group => group.CreateTime),
IsVerify = t.Min(w => w.IsVerify) ?? 1, IsVerify = t.Min(w => w.IsVerify) ?? 1,
}); });
return result.OrderBy(w => w.IsVerify).ThenByDescending(t => t.CreateTime).ThenBy(t => t.Department); return result.OrderBy(w => w.IsVerify).ThenByDescending(t => t.CreateTime).ThenBy(t => t.Department);
} }
......
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