Commit d4c9a2da by lcx

Merge branch 'develop' into 手工录入_

parents 15e90cb5 3bacd8be
...@@ -38,7 +38,6 @@ public class TemplateController : Controller ...@@ -38,7 +38,6 @@ public class TemplateController : Controller
private readonly AllotService allotService; private readonly AllotService allotService;
private readonly LogManageService logService; private readonly LogManageService logService;
private readonly IServiceScopeFactory serviceScopeFactory; private readonly IServiceScopeFactory serviceScopeFactory;
private readonly IBackgroundTaskQueue _backgroundTaskQueue;
private readonly ExtractService extractService; private readonly ExtractService extractService;
public TemplateController( public TemplateController(
...@@ -53,7 +52,6 @@ public class TemplateController : Controller ...@@ -53,7 +52,6 @@ public class TemplateController : Controller
HospitalService hospitalService, HospitalService hospitalService,
AllotService allotService, AllotService allotService,
LogManageService logService, LogManageService logService,
IBackgroundTaskQueue backgroundTaskQueue,
IServiceScopeFactory serviceScopeFactory, IServiceScopeFactory serviceScopeFactory,
ExtractService extractService) ExtractService extractService)
{ {
...@@ -69,7 +67,6 @@ public class TemplateController : Controller ...@@ -69,7 +67,6 @@ public class TemplateController : Controller
this.allotService = allotService; this.allotService = allotService;
this.logService = logService; this.logService = logService;
this.serviceScopeFactory = serviceScopeFactory; this.serviceScopeFactory = serviceScopeFactory;
_backgroundTaskQueue = backgroundTaskQueue;
this.extractService = extractService; this.extractService = extractService;
} }
...@@ -240,8 +237,9 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest ...@@ -240,8 +237,9 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
{ {
logger.LogInformation("同一项目中进行提取"); logger.LogInformation("同一项目中进行提取");
_backgroundTaskQueue.QueueBackgroundWorkItem(async token => Task.Run(() =>
{ {
Thread.Sleep(1000);
using (var scope = serviceScopeFactory.CreateScope()) using (var scope = serviceScopeFactory.CreateScope())
{ {
var scopedServices = scope.ServiceProvider.GetRequiredService<ExtractService>(); var scopedServices = scope.ServiceProvider.GetRequiredService<ExtractService>();
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
}, },
"AppConnection": { "AppConnection": {
//"PerformanceConnectionString": "server=112.124.13.17;database=db_performance;uid=suvalue;pwd=suvalue2016;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;", //"PerformanceConnectionString": "server=112.124.13.17;database=db_performance;uid=suvalue;pwd=suvalue2016;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"PerformanceConnectionString": "server=192.168.18.166;database=db_test_srfy;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;", "PerformanceConnectionString": "server=192.168.18.166;database=db_performance_screen;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"HangfireConnectionString": "server=192.168.18.166;database=db_hangfire;uid=root;pwd=1234qwer;port=3306;allow user variables=true;", "HangfireConnectionString": "server=192.168.18.166;database=db_hangfire;uid=root;pwd=1234qwer;port=3306;allow user variables=true;",
"RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2" "RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2"
}, },
......
...@@ -1651,6 +1651,48 @@ ...@@ -1651,6 +1651,48 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ReportController.GetAllComputeView(Performance.DtoModels.BeginEndTime)">
<summary>
全院绩效发放(视图)
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.AllComputeViewDownload(Performance.DtoModels.BeginEndTimeDown)">
<summary>
全院绩效发放(视图)下载
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.GethosdataView(Performance.DtoModels.BeginEndTime)">
<summary>
全院核算绩效发放(视图)
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.GethosdataView(Performance.DtoModels.BeginEndTimeDown)">
<summary>
全院核算绩效发放(视图) 下载
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.AllComputeViewByPM(Performance.DtoModels.BeginEndTime)">
<summary>
获取财务全院绩效列表(视图)
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.AllComputeByPMViewDownLoad(Performance.DtoModels.BeginEndTimeDown)">
<summary>
获取财务全院绩效列表(视图)下载
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportGlobalController.GetAllReportGlobal(System.Int32)"> <member name="M:Performance.Api.Controllers.ReportGlobalController.GetAllReportGlobal(System.Int32)">
<summary> <summary>
获取报表配置信息 获取报表配置信息
......
using AutoMapper; using AutoMapper;
using Performance.DtoModels.Request;
using Performance.EntityModels; using Performance.EntityModels;
using Performance.Infrastructure; using Performance.Infrastructure;
using System; using System;
...@@ -79,6 +80,7 @@ public AutoMapperConfigs() ...@@ -79,6 +80,7 @@ public AutoMapperConfigs()
CreateMap<PerDataEmployee, im_employee>(); CreateMap<PerDataEmployee, im_employee>();
CreateMap<im_employee, PerDataEmployee>(); CreateMap<im_employee, PerDataEmployee>();
CreateMap<res_baiscnorm, ComputerAvgRequest>().ReverseMap();
//CreateMap<PerDataAccountBaisc, PerDataAccount>() //CreateMap<PerDataAccountBaisc, PerDataAccount>()
// .ForMember(dest => dest.AccountingUnit, opt => opt.MapFrom(src => src.AccountingUnit)) // .ForMember(dest => dest.AccountingUnit, opt => opt.MapFrom(src => src.AccountingUnit))
......
...@@ -52,4 +52,28 @@ public class ComputerAliasRequest ...@@ -52,4 +52,28 @@ public class ComputerAliasRequest
public string Route { get; set; } public string Route { get; set; }
} }
public class BeginEndTime
{
public string BeginTime { get; set; } // 2021-01
public string EndTime { get; set; } // 2021-08
public int CurrentPage { get; set; }
public int PageSize { get; set; }
}
public class BeginEndTimeDown
{
public string BeginTime { get; set; } // 2021-01
public string EndTime { get; set; } // 2021-08
public int HospitalId { get; set; }
}
public class QueryComputeByDateGetPage
{
public List<dynamic> Data { get; set; }
public Dictionary<string, decimal> TotalData { get; set; }
public int CurrentPage { get; set; }
public int TotalPages { get; set; }
public int PageSize { get; set; }
public int TotalCount { get; set; }
}
} }
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.EntityModels; using Performance.EntityModels;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -396,6 +397,14 @@ public List<dynamic> QueryCompute(int allotId, string viewName) ...@@ -396,6 +397,14 @@ public List<dynamic> QueryCompute(int allotId, string viewName)
return DapperQuery<dynamic>(sql, new { allotId })?.ToList(); return DapperQuery<dynamic>(sql, new { allotId })?.ToList();
} }
public List<dynamic> QueryComputeByDate(string viewName, DateTime beginTime, DateTime endTime)
{
var sql = $@"SELECT * FROM {viewName}
where STR_TO_DATE(concat(Year,'-',Month,'-01'),'%Y-%m-%d') >= @beginTime
and STR_TO_DATE(concat(Year,'-',Month,'-01'),'%Y-%m-%d') < @endTime";
return DapperQuery<dynamic>(sql, new { beginTime = beginTime.ToString("yyyy-MM-dd"), endTime = endTime.ToString("yyyy-MM-dd") }).ToList();
}
public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead) public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead)
{ {
...@@ -426,7 +435,7 @@ public bool QueryIsAllotId(string tableName) ...@@ -426,7 +435,7 @@ public bool QueryIsAllotId(string tableName)
var sql = $@"SELECT column_name FROM information_schema.COLUMNS s var sql = $@"SELECT column_name FROM information_schema.COLUMNS s
WHERE table_name = @table_name AND TABLE_SCHEMA = @database AND (column_name='allotId' or column_name='AccountingUnit' or column_name='UnitType');"; WHERE table_name = @table_name AND TABLE_SCHEMA = @database AND (column_name='allotId' or column_name='AccountingUnit' or column_name='UnitType');";
var result = DapperQuery<string>(sql, new { database = database, table_name = tableName }); var result = DapperQuery<string>(sql, new { database = database, table_name = tableName });
var isExist=result ?.Count() == 3; var isExist = result?.Count() == 3;
return isExist; return isExist;
......
...@@ -729,7 +729,15 @@ public List<IssuedPromptResponse> IssuedPrompt(per_allot allot, AllotRequest req ...@@ -729,7 +729,15 @@ public List<IssuedPromptResponse> IssuedPrompt(per_allot allot, AllotRequest req
{ {
var updSecondQuery = promptSeconds.Where(t => t.IssueStatus != 1); var updSecondQuery = promptSeconds.Where(t => t.IssueStatus != 1);
var updSeconds = secondList.Where(w => updSecondQuery.Select(t => t.Id).Contains(w.Id)) ?? new List<ag_secondallot>(); var updSeconds = secondList.Where(w => updSecondQuery.Select(t => t.Id).Contains(w.Id)) ?? new List<ag_secondallot>();
updSeconds.ToList().ForEach(t => t.RealGiveFee = t.PreRealGiveFee); updSeconds.ToList().ForEach(t =>
{
var second = updSecondQuery.FirstOrDefault(c => c.Id == t.Id);
t.RealGiveFee = t.PreRealGiveFee;
t.Status = second.Status;
t.Remark = second.Remark;
t.NursingDeptStatus = second.NursingDeptStatus;
t.NursingDeptRemark = second.NursingDeptRemark;
});
perforAgsecondallotRepository.UpdateRange(updSeconds.ToArray()); perforAgsecondallotRepository.UpdateRange(updSeconds.ToArray());
} }
if (promptSeconds.Any(t => t.IssueStatus == 1)) if (promptSeconds.Any(t => t.IssueStatus == 1))
......
...@@ -2012,6 +2012,10 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route) ...@@ -2012,6 +2012,10 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route)
{ "/result/compute" , ComputeConfig.AllComputeView }, { "/result/compute" , ComputeConfig.AllComputeView },
{ "/result/wholehospital" , ComputeConfig.AllComputePersonView }, { "/result/wholehospital" , ComputeConfig.AllComputePersonView },
{ "/result/print/compute" , ComputeConfig.AllComputeDepartmentView }, { "/result/print/compute" , ComputeConfig.AllComputeDepartmentView },
{ "/report/wholehospital_grant" , ComputeConfig.AllComputeViewByDate },
{ "/report/wholehospital_accounting_grant" , ComputeConfig.AllComputeDepartmentViewByDate },
{ "/report/wholehospital_finance_grant" , ComputeConfig.AllComputePersonViewByDate },
}; };
init = pairs.ContainsKey(route.ToLower()) ? pairs[route.ToLower()] : new List<cof_alias>(); init = pairs.ContainsKey(route.ToLower()) ? pairs[route.ToLower()] : new List<cof_alias>();
} }
...@@ -2065,6 +2069,48 @@ public List<dynamic> GetAllComputeView(int hospitalId, int AllotId, string viewN ...@@ -2065,6 +2069,48 @@ public List<dynamic> GetAllComputeView(int hospitalId, int AllotId, string viewN
{ {
return reportRepository.QueryCompute(AllotId, viewName); return reportRepository.QueryCompute(AllotId, viewName);
} }
public List<dynamic> GetAllComputeViewByDate(string viewName, DateTime beginTime, DateTime endTime)
{
return reportRepository.QueryComputeByDate(viewName, beginTime, endTime);
}
/// <summary>
///
/// </summary>
/// <param name="datas"></param>
/// <returns></returns>
public Dictionary<string, decimal> SumDatas(List<dynamic> datas)
{
string[] notSum = new string[] { "hospitalid", "allotid", "year", "month", "jobnumber", "bankcard", "jobtitle", "secondid", "states", "isshowmanage", "batch" };
Dictionary<string, decimal> pairs = new Dictionary<string, decimal>();
foreach (var dt in datas)
{
var row = (IDictionary<string, object>)dt;
foreach (var item in row)
{
if (notSum.Contains(item.Key.ToLower())) continue;
if (decimal.TryParse(item.Value?.ToString(), out decimal v))
{
if (pairs.TryGetValue(item.Key, out decimal sum))
{
sum += v;
pairs[item.Key] = sum;
}
else
{
pairs[item.Key] = v;
}
}
}
}
foreach (var item in pairs)
{
pairs[item.Key] = Math.Round(item.Value, 2, MidpointRounding.AwayFromZero);
}
return pairs;
}
} }
public class ComputeConfig public class ComputeConfig
...@@ -2081,7 +2127,7 @@ public class ComputeConfig ...@@ -2081,7 +2127,7 @@ public class ComputeConfig
new cof_alias{ Alias = "批次", Name = nameof(view_allot_sign_emp.Batch), States = 1}, new cof_alias{ Alias = "批次", Name = nameof(view_allot_sign_emp.Batch), States = 1},
new cof_alias{ Alias = "银行卡号", Name = nameof(view_allot_sign_emp.BankCard), States = 1}, new cof_alias{ Alias = "银行卡号", Name = nameof(view_allot_sign_emp.BankCard), States = 1},
new cof_alias{ Alias = "正式/临聘", Name = nameof(view_allot_sign_emp.JobCategory), States = 1}, new cof_alias{ Alias = "正式/临聘", Name = nameof(view_allot_sign_emp.JobCategory), States = 1},
new cof_alias{ Alias = "职务", Name = nameof(view_allot_sign_emp.Duty), States = 1}, //new cof_alias{ Alias = "职务", Name = nameof(view_allot_sign_emp.Duty), States = 1},
new cof_alias{ Alias = "职称", Name = nameof(view_allot_sign_emp.TitlePosition), States = 1}, new cof_alias{ Alias = "职称", Name = nameof(view_allot_sign_emp.TitlePosition), States = 1},
new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1}, new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1},
...@@ -2095,6 +2141,22 @@ public class ComputeConfig ...@@ -2095,6 +2141,22 @@ public class ComputeConfig
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1}, new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1},
}; };
private static List<cof_alias> _allComputeViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputeViewByDate
{
get
{
if (_allComputeViewByDate == null || _allComputeViewByDate.Count == 0)
{
_allComputeViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1 });
_allComputeViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1 });
_allComputeViewByDate.AddRange(AllComputeView);
}
return _allComputeViewByDate;
}
}
public static List<cof_alias> AllComputePersonView { get; } = new List<cof_alias> public static List<cof_alias> AllComputePersonView { get; } = new List<cof_alias>
{ {
new cof_alias{ Alias = "科室类别", Name = nameof(view_allot_sign_emp.UnitType), States = 1}, new cof_alias{ Alias = "科室类别", Name = nameof(view_allot_sign_emp.UnitType), States = 1},
...@@ -2111,6 +2173,21 @@ public class ComputeConfig ...@@ -2111,6 +2173,21 @@ public class ComputeConfig
new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1}, new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1},
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1}, new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1},
}; };
private static List<cof_alias> _allComputePersonViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputePersonViewByDate
{
get
{
if (_allComputePersonViewByDate == null || _allComputePersonViewByDate.Count == 0)
{
_allComputePersonViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1 });
_allComputePersonViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1 });
_allComputePersonViewByDate.AddRange(AllComputePersonView);
}
return _allComputePersonViewByDate;
}
}
public static List<cof_alias> AllComputeDepartmentView { get; } = new List<cof_alias> public static List<cof_alias> AllComputeDepartmentView { get; } = new List<cof_alias>
{ {
new cof_alias{ Alias = "核算群体", Name = nameof(view_allot_sign_dept.UnitName), States = 1}, new cof_alias{ Alias = "核算群体", Name = nameof(view_allot_sign_dept.UnitName), States = 1},
...@@ -2132,5 +2209,19 @@ public class ComputeConfig ...@@ -2132,5 +2209,19 @@ public class ComputeConfig
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_dept.HideAprOtherPerforAmount), States = 1}, new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_dept.HideAprOtherPerforAmount), States = 1},
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_dept.RealGiveFee), States = 1}, new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_dept.RealGiveFee), States = 1},
}; };
private static List<cof_alias> _allComputeDepartmentViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputeDepartmentViewByDate
{
get
{
if (_allComputeDepartmentViewByDate == null || _allComputeDepartmentViewByDate.Count == 0)
{
_allComputeDepartmentViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1 });
_allComputeDepartmentViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1 });
_allComputeDepartmentViewByDate.AddRange(AllComputeDepartmentView);
}
return _allComputeDepartmentViewByDate;
}
}
} }
} }
...@@ -181,15 +181,34 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string ...@@ -181,15 +181,34 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
{ {
var allot = perallotRepository.GetEntity(t => t.ID == allotId); var allot = perallotRepository.GetEntity(t => t.ID == allotId);
var hospital = perforHospital.GetEntity(t => t.ID == allot.HospitalId); var hospital = perforHospital.GetEntity(t => t.ID == allot.HospitalId);
var alias = perforCofalias.GetEntities(t => t.HospitalId == hospital.ID); var title = $"{allot.Year}{allot.Month}{hospital.HosName}医院 --- {name}";
return AllComputerDown(hospital, dynamics, route, title, name);
}
/// <summary>
/// 财务、全院绩效发放下载(时间段)
/// </summary>
/// <param name="allotId"></param>
/// <param name="allData"></param>
/// <param name="isAll"></param>
/// <returns></returns>
public string AllComputerViewReportByDate(int hospitalId, List<dynamic> dynamics, string route, string name, DateTime beginTime, DateTime endTime)
{
var hospital = perforHospital.GetEntity(t => t.ID == hospitalId);
var title = (beginTime.AddMonths(1).Date == endTime.Date)
? $"{beginTime.ToString("yyyy年MM月")}{hospital.HosName}医院 --- {name}"
: $"{beginTime.ToString("yyyy年MM月")}{endTime.ToString("yyyy年MM月")}{hospital.HosName}医院 --- {name}";
return AllComputerDown(hospital, dynamics, route, title, name);
}
public string AllComputerDown(sys_hospital hospital, List<dynamic> dynamics, string route, string title, string name)
{
var headList = _computeService.CustomColumnHeaders(hospital.ID, route).Where(w => w.States == 1).ToList(); var headList = _computeService.CustomColumnHeaders(hospital.ID, route).Where(w => w.States == 1).ToList();
var dpath = Path.Combine(evn.ContentRootPath, "Files", "PerformanceRelease", $"{hospital.ID}");
var dpath = Path.Combine(evn.ContentRootPath, "Files", "PerformanceRelease", $"{allot.HospitalId}");
FileHelper.CreateDirectory(dpath); FileHelper.CreateDirectory(dpath);
string filepath = Path.Combine(dpath, $"{hospital.HosName}-{name}-{DateTime.Now:yyyyMMdd}"); string filepath = Path.Combine(dpath, $"{hospital.HosName}-{name}-{DateTime.Now:yyyyMMdd}");
FileHelper.DeleteFile(filepath); FileHelper.DeleteFile(filepath);
string[] notSum = new string[] { "year", "month" };
using (FileStream fs = new FileStream(filepath, FileMode.OpenOrCreate)) using (FileStream fs = new FileStream(filepath, FileMode.OpenOrCreate))
using (ExcelPackage package = new ExcelPackage(fs)) using (ExcelPackage package = new ExcelPackage(fs))
{ {
...@@ -197,11 +216,12 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string ...@@ -197,11 +216,12 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
if (dynamics != null && dynamics.Count() > 0) if (dynamics != null && dynamics.Count() > 0)
{ {
worksheet.SetValue(1, 1, title);
var headers = ((IDictionary<string, object>)dynamics.ElementAt(0)).Keys; var headers = ((IDictionary<string, object>)dynamics.ElementAt(0)).Keys;
for (int col = 0; col < headList.Count; col++) for (int col = 0; col < headList.Count; col++)
{ {
worksheet.SetValue(1, col + 1, headList[col].Alias); worksheet.SetValue(2, col + 1, headList[col].Alias);
} }
for (int col = 0; col < headList.Count; col++) for (int col = 0; col < headList.Count; col++)
{ {
...@@ -211,23 +231,41 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string ...@@ -211,23 +231,41 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
var temp = (IDictionary<string, object>)data; var temp = (IDictionary<string, object>)data;
var value = temp[headList[col].Name]; var value = temp[headList[col].Name];
worksheet.Cells[row + 2, col + 1].Value = value; worksheet.Cells[row + 3, col + 1].Value = value;
} }
if (col == 0) if (col == 0)
worksheet.SetValue(dynamics.Count() + 2, col + 1, "合计"); worksheet.SetValue(dynamics.Count() + 3, col + 1, "合计");
else else if (!notSum.Contains(headList[col].Name.ToLower()))
worksheet.Cells[dynamics.Count() + 2, col + 1].Formula = string.Format("SUM({0})", new ExcelAddress(2, col + 1, dynamics.Count() + 1, col + 1).Address); worksheet.Cells[dynamics.Count() + 3, col + 1].Formula = string.Format("SUM({0})", new ExcelAddress(3, col + 1, dynamics.Count() + 2, col + 1).Address);
}
} }
worksheet.View.FreezePanes(2, 1); #region 样式设置
for (int row = worksheet.Dimension.Start.Row; row <= worksheet.Dimension.End.Row; row++) for (int row = worksheet.Dimension.Start.Row; row <= worksheet.Dimension.End.Row; row++)
{ {
worksheet.Row(row).Height = 20;
for (int col = worksheet.Dimension.Start.Column; col <= worksheet.Dimension.End.Column; col++) for (int col = worksheet.Dimension.Start.Column; col <= worksheet.Dimension.End.Column; col++)
{ {
worksheet.Cells[row, col].Style.Border.BorderAround(ExcelBorderStyle.Thin); if (headList.Count < col && !notSum.Contains(headList[col - 1].Name.ToLower()))
worksheet.Cells[row, col].Style.Numberformat.Format = "#,##0.00"; worksheet.Cells[row, col].Style.Numberformat.Format = "#,##0.00";
worksheet.Cells[row, col].Style.Border.BorderAround(ExcelBorderStyle.Thin);
worksheet.Cells[row, col].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
}
}
worksheet.Cells[1, 1, 1, headList.Count].Merge = true;
worksheet.Cells[1, 1, 1, headList.Count].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
worksheet.Cells[1, 1, 1, headList.Count].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
worksheet.Cells[1, 1, 1, headList.Count].Style.Font.Bold = true;
worksheet.Cells[1, 1, 1, headList.Count].Style.Font.Size = 16;
worksheet.Row(1).Height = 24;
worksheet.Cells[2, 1, 2, headList.Count].Style.Font.Bold = true;
worksheet.View.FreezePanes(3, 1);
worksheet.Cells.AutoFitColumns();
for (int col = worksheet.Dimension.Start.Column; col <= worksheet.Dimension.End.Column; col++)
{
worksheet.Column(col).Width = worksheet.Column(col).Width > 20 ? 20 : worksheet.Column(col).Width;
} }
#endregion
} }
package.Save(); package.Save();
} }
......
...@@ -204,7 +204,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -204,7 +204,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
filed = sheet.SheetName.Contains("住院") ? fieldInpat : fieldOut; filed = sheet.SheetName.Contains("住院") ? fieldInpat : fieldOut;
var ename = data.Where(w => w.SheetName == sheet.SheetName)?.FirstOrDefault(w => !string.IsNullOrEmpty(w.EName))?.EName; var ename = data.Where(w => w.SheetName == sheet.SheetName)?.FirstOrDefault(w => !string.IsNullOrEmpty(w.EName))?.EName;
if (ename.Contains("住院") || ename.Contains("门诊")) if (string.IsNullOrEmpty(ename) || ename.Contains("住院") || ename.Contains("门诊"))
filed = ename.Contains("住院") ? fieldInpatOut : fieldOutInpat; filed = ename.Contains("住院") ? fieldInpatOut : fieldOutInpat;
} }
else if (sheet.SheetName.Contains("工作量")) else if (sheet.SheetName.Contains("工作量"))
......
...@@ -102,7 +102,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -102,7 +102,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
queryService.ClearHistoryData(allot.ID, groupName, isSingle); queryService.ClearHistoryData(allot.ID, groupName, isSingle);
employeeService.SyncDataToResult(allotId); //employeeService.SyncDataToResult(allotId);
var data = exresultRepository.GetEntities(t => t.AllotId == allotId && t.IsDelete == 0); var data = exresultRepository.GetEntities(t => t.AllotId == allotId && t.IsDelete == 0);
data.AddRange(queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict)); data.AddRange(queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict));
...@@ -115,17 +115,18 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -115,17 +115,18 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
var templateFilePath = ExtractHelper.GetExtractFile(hospitalId, allot, ref extractFilePath, filePath); var templateFilePath = ExtractHelper.GetExtractFile(hospitalId, allot, ref extractFilePath, filePath);
logService.ReturnTheLog(allotId, groupName, 2, "创建文件", $"模板文件: {templateFilePath}", 1, isSingle); logService.ReturnTheLog(allotId, groupName, 2, "创建文件", $"模板文件: {templateFilePath}", 1, isSingle);
if (!FileHelper.IsExistFile(templateFilePath)) throw new PerformanceException("抽取文件创建失败"); if (!FileHelper.IsExistFile(templateFilePath)) throw new Exception("抽取文件创建失败");
workbook = ExcelHelper.GetWorkbook(templateFilePath); workbook = ExcelHelper.GetWorkbook(templateFilePath);
if (workbook == null) throw new PerformanceException("文件读取失败"); if (workbook == null) throw new Exception("文件读取失败");
WriteDataToFile(workbook, allot, dict, standData, groupName, isSingle); WriteDataToFile(workbook, allot, dict, standData, groupName, isSingle);
logService.ReturnTheLog(allotId, groupName, 2, "提取完成", $"绩效数据提取成功", 5, isSingle);
allot.IsExtracting = isSingle ? 2 : 0; allot.IsExtracting = isSingle ? 2 : 0;
allot.ExtractPath = extractFilePath; allot.ExtractPath = extractFilePath;
logService.ReturnTheLog(allotId, groupName, 2, "写入数据", $"写入数据至Excel文件", 1, isSingle);
workbook.EvaluateAll(); workbook.EvaluateAll();
using (FileStream file = new FileStream(extractFilePath, FileMode.OpenOrCreate)) using (FileStream file = new FileStream(extractFilePath, FileMode.OpenOrCreate))
{ {
...@@ -142,6 +143,8 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -142,6 +143,8 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
finally finally
{ {
logService.ReturnTheLog(allotId, groupName, 3, "", 100, 5, isSingle); logService.ReturnTheLog(allotId, groupName, 3, "", 100, 5, isSingle);
if (allot.IsExtracting != 3)
logService.ReturnTheLog(allotId, groupName, 2, "提取完成", $"绩效数据提取成功", 5, isSingle);
UpdateAllot(connection, allot); UpdateAllot(connection, allot);
} }
return extractFilePath; return extractFilePath;
......
...@@ -272,7 +272,8 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool ...@@ -272,7 +272,8 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
{ {
var config = configs.FirstOrDefault(t => t.Id == script.ConfigId); var config = configs.FirstOrDefault(t => t.Id == script.ConfigId);
if (config == null) continue; if (config == null) continue;
try
{
var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle); var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle);
if (querydata != null && querydata.Any()) if (querydata != null && querydata.Any())
{ {
...@@ -298,7 +299,11 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool ...@@ -298,7 +299,11 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
}); });
} }
} }
catch (Exception ex)
{
logger.LogError($"typeId: {typeId}提取数据异常{ex}{Infrastructure.JsonHelper.Serialize(script)}");
}
}
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"项目“{string.Join("、", thisItems.Select(t => t.ItemName))}”的数据已完成提取", 1, isSingle); logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"项目“{string.Join("、", thisItems.Select(t => t.ItemName))}”的数据已完成提取", 1, isSingle);
} }
} }
...@@ -336,7 +341,8 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo ...@@ -336,7 +341,8 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
{ {
var config = configs.FirstOrDefault(t => t.Id == script.ConfigId); var config = configs.FirstOrDefault(t => t.Id == script.ConfigId);
if (config == null) continue; if (config == null) continue;
try
{
var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle); var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle);
if (querydata != null && querydata.Any()) if (querydata != null && querydata.Any())
{ {
...@@ -361,6 +367,11 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo ...@@ -361,6 +367,11 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
}); });
} }
} }
catch (Exception ex)
{
logger.LogError($"typeId: {typeId}提取数据异常{ex}{Infrastructure.JsonHelper.Serialize(script)}");
}
}
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"项目“{string.Join("、", thisSpecials.Select(t => t.Target))}”的数据已完成提取", 1, isSingle); logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"项目“{string.Join("、", thisSpecials.Select(t => t.Target))}”的数据已完成提取", 1, isSingle);
} }
......
...@@ -49,7 +49,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp ...@@ -49,7 +49,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp
if (exdict.ContainsKey(ExDataDict.IncomeFactor) && exdict[ExDataDict.IncomeFactor] is List<cof_drugtype_factor> factors && factors.Any(t => t.ExModuleId == module.Id)) if (exdict.ContainsKey(ExDataDict.IncomeFactor) && exdict[ExDataDict.IncomeFactor] is List<cof_drugtype_factor> factors && factors.Any(t => t.ExModuleId == module.Id))
{ {
factors = factors.Where(t => t.ExModuleId == module.Id).ToList(); factors = factors.Where(t => t.ExModuleId == module.Id).ToList();
categories = categories.Union(factors.Select(t => t.Charge)).Distinct(); // categories = categories.Union(factors.Select(t => t.Charge)).Distinct();
headers = categories.GroupJoin(factors, inner => new { category = inner.NoBlank() }, outer => new { category = outer.Charge.NoBlank() }, (inner, outer) => new { inner, outer }) headers = categories.GroupJoin(factors, inner => new { category = inner.NoBlank() }, outer => new { category = outer.Charge.NoBlank() }, (inner, outer) => new { inner, outer })
.Select(t => new ExcelHeader .Select(t => new ExcelHeader
{ {
......
...@@ -2376,17 +2376,17 @@ public List<DeptDataDetails> DeptComputeDetailList(int userId, int allotId, out ...@@ -2376,17 +2376,17 @@ public List<DeptDataDetails> DeptComputeDetailList(int userId, int allotId, out
var userrole = userroleRepository.GetEntity(t => t.UserID == userId); var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
var role = roleRepository.GetEntity(t => t.ID == userrole.RoleID); var role = roleRepository.GetEntity(t => t.ID == userrole.RoleID);
Dictionary<int, string> dict = new Dictionary<int, string> Dictionary<int, List<string>> dict = new Dictionary<int, List<string>>
{ {
{ application.DirectorRole, AccountUnitType.科主任.ToString() }, { application.DirectorRole, new List<string>{ AccountUnitType.科主任.ToString()} },
{ application.NurseRole, AccountUnitType.护士长.ToString() }, { application.NurseRole, new List<string>{ AccountUnitType.护士长.ToString() } },
{ application.OfficeRole, AccountUnitType.行政中层.ToString() }, { application.OfficeRole, new List<string> { AccountUnitType.行政中层.ToString() } },
{ application.SpecialRole, AccountUnitType.科主任.ToString() }, { application.SpecialRole, new List<string> { AccountUnitType.科主任.ToString() , AccountUnitType.护士长.ToString() } },
}; };
if (!dict.Keys.Contains(role.Type.Value)) return new List<DeptDataDetails>(); if (!dict.Keys.Contains(role.Type.Value)) return new List<DeptDataDetails>();
var computes = rescomputeRepository.GetEntities(t => t.AllotID == allotId && t.AccountingUnit == user.Department && t.AccountType == dict[role.Type.Value]); var computes = rescomputeRepository.GetEntities(t => t.AllotID == allotId && t.AccountingUnit == user.Department && dict[role.Type.Value].Contains(t.AccountType));
if (computes == null || !computes.Any()) return new List<DeptDataDetails>(); if (computes == null || !computes.Any()) return new List<DeptDataDetails>();
foreach (var item in computes) foreach (var item in computes)
{ {
......
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