Commit b0b22508 by ruyun.zhang@suvalue.com

Merge branch 'develop' into release/v22.2.10-Beta-ninghai

parents 2e872508 c48b87fb
......@@ -226,8 +226,8 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
//检验科室、费用类型是否需要补充
if (allot.IsExtracting == 1 && allot.ExtractTime.HasValue && DateTime.Now.AddHours(-3) < allot.ExtractTime)
return new ApiResponse(ResponseType.OK, "正在提取数据,请稍等!", new { IsExtracting = true });
//if (allot.IsExtracting == 1 && allot.ExtractTime.HasValue && DateTime.Now.AddHours(-3) < allot.ExtractTime)
// return new ApiResponse(ResponseType.OK, "正在提取数据,请稍等!", new { IsExtracting = true });
_taskService.Add(Background.JobType.提取数据, JsonHelper.Serialize(new { request.AllotId, request.HospitalId, request.UseScheme, isSingle, filePath }));
......
......@@ -79,6 +79,6 @@ public class ex_result
// /// <summary>
// /// 1 删除 0 未删除
// /// </summary>
// public int IsDelete { get; set; }
public int IsDelete { get; set; }
}
}
......@@ -799,7 +799,7 @@ public cof_accounting AccountingInsert(cof_accounting request)
var existed = cofaccountingRepository.GetEntity(w => w.Code == request.Code);
if (existed != null) throw new PerformanceException("核算单元编码重复");
existed = cofaccountingRepository.GetEntity(w => w.UnitType == request.UnitType && w.AccountingUnit == request.AccountingUnit);
existed = cofaccountingRepository.GetEntity(w => w.AllotId == request.AllotId && w.UnitType == request.UnitType && w.AccountingUnit == request.AccountingUnit);
if (existed != null) throw new PerformanceException("核算单元、核算组别已存在");
var entity = new cof_accounting
......@@ -1767,7 +1767,7 @@ public HandsonTable GetDrugtypeFactorConfig(int hospitalId, int allotId)
var models = perforExmoduleRepository.GetEntities(t => t.HospitalId == hospitalId && t.SheetType == (int)SheetType.Income);
if (models == null || !models.Any())
{
exConfigService.DefaultModules(hospitalId);
//exConfigService.DefaultModules(hospitalId);
models = perforExmoduleRepository.GetEntities(t => t.HospitalId == hospitalId && t.SheetType == (int)SheetType.Income);
if (models == null || !models.Any()) return table;
......
......@@ -299,6 +299,7 @@ private void ExResult(per_allot allot, sys_hospitalconfig config, string sql, st
ConfigId = config.Id,
AllotId = allot.ID,
CreateTime = createTime,
IsDelete = 0,
}).ToList();
exresultRepository.AddRange(result.ToArray());
}
......
......@@ -282,7 +282,9 @@ public static void EvaluateAll(this IWorkbook workbook)
{
try
{
workbook.GetCreationHelper().CreateFormulaEvaluator().EvaluateAll();
var creation = workbook.GetCreationHelper();
var formula = creation?.CreateFormulaEvaluator();
formula?.EvaluateAll();
}
catch
{
......
......@@ -65,9 +65,15 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
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)
{
}
}
}
}
......
......@@ -157,16 +157,12 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
if (row == null) continue;
string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes();
if (string.IsNullOrEmpty(department)) continue;
if (rowIndex >= dataFirstRowNum) dataFirstRowNum = rowIndex + 1;
var deptData = data.Where(t => t.Department.NoBlank() == department);
if (deptData == null || !deptData.Any(t => t.Value.HasValue && t.Value != 0)) continue;
#region 写入数据
if (sheetType == SheetType.Income)
if (sheetType == SheetType.Income && !string.IsNullOrEmpty(department))
{
if (!incomes.Any(t => t.Department == department))
incomes.Add(GetIncomeRowMessage(row, dataFirstCellNum, department, rowIndex));
......@@ -179,14 +175,25 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var cell = row.GetOrCreate(cellIndex);
if (string.IsNullOrEmpty(column)) continue;
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
decimal? value = 0m;
if (!string.IsNullOrEmpty(department))
{
var deptData = data.Where(t => t.Department.NoBlank() == department);
if (deptData != null && deptData.Any(t => t.Value.HasValue && t.Value != 0))
value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
}
//数据为空,且单元格值不为空,不写入数据(保留原始值)
if (value.HasValue && value != 0)
cell.SetCellValue<decimal>(value);
// 22.3.29 ry 只要是提取的列头全部覆盖数据
//if (value.HasValue && value != 0)
if (headers != null && headers.Contains(column))
{
cell.SetCellValue<decimal>(value ?? 0);
cell.CellStyle = cellStyle;
}
}
#endregion
......@@ -216,7 +223,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
filed = sheet.SheetName.Contains("医生") ? fieldDoctor : fieldNurse;
}
var deptStyle = style.GetCellStyle();
//var deptStyle = style.GetCellStyle();
var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.数据);
headers = headers.Select(t => t.NoBlank()).ToList();
......@@ -224,23 +231,24 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
foreach (string department in departments)
{
var deptData = data.Where(t => (t.Department ?? "") == department);
if (deptData == null || !deptData.Any()) continue;
var row = sheet.GetOrCreate(dataFirstRowNum);
for (int cellIndex = point.HeaderFirstCellNum.Value; cellIndex < columnHeader.LastCellNum; cellIndex++)
{
var column = columnHeader.GetCell(cellIndex).GetDecodeEscapes();
var column = columnHeader.GetCell(cellIndex).GetDecodeEscapes()?.Replace("(", "(").Replace(")", ")"); ;
var cell = row.CreateCell(cellIndex);
if (filed.ContainsKey(column))
{
cell.SetCellOValue(filed[column]?.Invoke(deptData.First()));
cell.CellStyle = deptStyle;
var value = (deptData != null && deptData.Any()) ? filed[column]?.Invoke(deptData.First()) : "";
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;
if (value.HasValue && value != 0)
var value = (deptData != null && deptData.Any())
? deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value
: 0;
cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle;
}
......@@ -253,7 +261,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
List<ExtractTransDto> data, List<IncomeRow> incomes, int dataFirstRowNum)
{
var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.数据);
var deptStyle = style.GetCellStyle();
//var deptStyle = style.GetCellStyle();
headers = headers.Select(t => t.NoBlank()).ToList();
......@@ -264,8 +272,8 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var row = sheet.GetOrCreate(dataFirstRowNum);
var deptData = data.Where(t => t.Department == item.Department);
if (deptData == null || !deptData.Any()) continue;
if (deptData != null && deptData.Any())
{
var deptContents = new Dictionary<int, string>
{
{ 1, item.Department },
......@@ -284,21 +292,24 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
{
var cell = row.GetOrCreate(dataFirstCellNum - content.Key);
cell.SetCellValue(content.Value);
cell.CellStyle = deptStyle;
cell.CellStyle = cellStyle;
}
}
for (int cellIndex = dataFirstCellNum; cellIndex < columnHeader.LastCellNum; cellIndex++)
{
var column = columnHeader.GetOrCreate(cellIndex).GetDecodeEscapes();
var cell = row.GetOrCreate(cellIndex);
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
var value = (deptData != null && deptData.Any())
? deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value
: 0;
//if (cell.CellType != CellType.Formula)
//{
// cell.SetCellValue<decimal>(value);
// cell.CellStyle = cellStyle;
//}
if (value.HasValue && value != 0)
cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle;
}
......@@ -355,12 +366,7 @@ public static string HasValue(params string[] list)
private static readonly Dictionary<string, Func<ExtractTransDto, string>> fieldDoctor = new Dictionary<string, Func<ExtractTransDto, string>>
{
{ "科室名称", (dto) => dto.Department },
{ "核算单元", (dto) =>
{
var obj = new string []{ dto.OutDoctorAccounting, dto.InpatDoctorAccounting, dto.OutTechnicAccounting, dto.InpatTechnicAccounting }
.FirstOrDefault(t => !string.IsNullOrEmpty(t));
return obj;
}
{ "核算单元", (dto) => new string []{ dto.OutDoctorAccounting, dto.InpatDoctorAccounting, dto.OutTechnicAccounting, dto.InpatTechnicAccounting }.FirstOrDefault(t => !string.IsNullOrEmpty(t))
},
};
......@@ -464,7 +470,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
? collectWork
: new SheetType[] { SheetType.OtherIncome, SheetType.Expend }.Contains(sheetType) ? collectIncome : collectDept;
var deptStyle = style.GetCellStyle();
//var deptStyle = style.GetCellStyle();
var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.数据);
headers = headers.Select(t => t.NoBlank()).ToList();
......@@ -477,13 +483,13 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
var row = sheet.GetOrCreate(dataFirstRowNum);
for (int cellIndex = point.HeaderFirstCellNum.Value; cellIndex < columnHeader.LastCellNum; cellIndex++)
{
var column = columnHeader.GetCell(cellIndex).GetDecodeEscapes();
var column = columnHeader.GetCell(cellIndex).GetDecodeEscapes()?.Replace("(", "(").Replace(")", ")");
var cell = row.CreateCell(cellIndex);
if (filed.ContainsKey(column))
{
cell.SetCellOValue(filed[column]?.Invoke(deptData.First()));
cell.CellStyle = deptStyle;
cell.CellStyle = cellStyle;
}
else if (sheetType == SheetType.Income || (headers != null && headers.Contains(column)))
{
......@@ -500,7 +506,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
List<collect_data> data, List<IncomeRow> incomes, int dataFirstRowNum)
{
var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.数据);
var deptStyle = style.GetCellStyle();
//var deptStyle = style.GetCellStyle();
headers = headers.Select(t => t.NoBlank()).ToList();
......@@ -525,7 +531,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
{
var cell = row.GetOrCreate(dataFirstCellNum - content.Key);
cell.SetCellValue(content.Value);
cell.CellStyle = deptStyle;
cell.CellStyle = cellStyle;
}
for (int cellIndex = dataFirstCellNum; cellIndex < columnHeader.LastCellNum; cellIndex++)
......
......@@ -307,7 +307,7 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
dict.ForEach(t =>
{
t.HISDeptName = WriteDataHelper.HasValue(t.HISDeptName, t.Department);
t.Department = WriteDataHelper.HasValue(t.HISDeptName, t.Department);
});
var data = results.GroupJoin(dict, outer => new { Department = outer.Department }, inner => new { Department = inner.HISDeptName }, (outer, inner) => new { outer, inner })
......
......@@ -225,6 +225,7 @@ private List<ex_result> ExtractModuleData(per_allot allot, string groupName, boo
ConfigId = config.Id,
AllotId = allot.ID,
CreateTime = CreateTime,
IsDelete = 0,
}).ToList();
exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result);
......@@ -303,6 +304,7 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
ConfigId = config.Id,
AllotId = allot.ID,
CreateTime = CreateTime,
IsDelete = 0,
}).ToList();
exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result);
......@@ -377,6 +379,7 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
ConfigId = config.Id,
AllotId = allot.ID,
CreateTime = CreateTime,
IsDelete = 0,
}).ToList();
exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result);
......
......@@ -788,7 +788,7 @@ private HandsonTableBase ComputeMode_Format2(per_allot allot, List<string> colHe
{
getAlias(nameof(ag_bodysource.WorkNumber), "工号"),
getAlias(nameof(ag_bodysource.Name), "姓名"),
getAlias(nameof(ag_bodysource.Post), "人员系数"),
getAlias(nameof(ag_bodysource.Post), "领取平均绩效"),
getAlias(nameof(ag_bodysource.StaffCoefficient), "人员系数"),
getAlias(nameof(ag_bodysource.ActualAttendance), "出勤"),
getAlias(nameof(ag_bodysource.JobTitle), "职称"),
......
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