Commit d4c9a2da by lcx

Merge branch 'develop' into 手工录入_

parents 15e90cb5 3bacd8be
......@@ -38,7 +38,6 @@ public class TemplateController : Controller
private readonly AllotService allotService;
private readonly LogManageService logService;
private readonly IServiceScopeFactory serviceScopeFactory;
private readonly IBackgroundTaskQueue _backgroundTaskQueue;
private readonly ExtractService extractService;
public TemplateController(
......@@ -53,7 +52,6 @@ public class TemplateController : Controller
HospitalService hospitalService,
AllotService allotService,
LogManageService logService,
IBackgroundTaskQueue backgroundTaskQueue,
IServiceScopeFactory serviceScopeFactory,
ExtractService extractService)
{
......@@ -69,7 +67,6 @@ public class TemplateController : Controller
this.allotService = allotService;
this.logService = logService;
this.serviceScopeFactory = serviceScopeFactory;
_backgroundTaskQueue = backgroundTaskQueue;
this.extractService = extractService;
}
......@@ -240,8 +237,9 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
{
logger.LogInformation("同一项目中进行提取");
_backgroundTaskQueue.QueueBackgroundWorkItem(async token =>
Task.Run(() =>
{
Thread.Sleep(1000);
using (var scope = serviceScopeFactory.CreateScope())
{
var scopedServices = scope.ServiceProvider.GetRequiredService<ExtractService>();
......
......@@ -8,7 +8,7 @@
},
"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=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;",
"RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2"
},
......
......@@ -1651,6 +1651,48 @@
<param name="request"></param>
<returns></returns>
</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)">
<summary>
获取报表配置信息
......
using AutoMapper;
using Performance.DtoModels.Request;
using Performance.EntityModels;
using Performance.Infrastructure;
using System;
......@@ -79,6 +80,7 @@ public AutoMapperConfigs()
CreateMap<PerDataEmployee, im_employee>();
CreateMap<im_employee, PerDataEmployee>();
CreateMap<res_baiscnorm, ComputerAvgRequest>().ReverseMap();
//CreateMap<PerDataAccountBaisc, PerDataAccount>()
// .ForMember(dest => dest.AccountingUnit, opt => opt.MapFrom(src => src.AccountingUnit))
......
......@@ -52,4 +52,28 @@ public class ComputerAliasRequest
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 Performance.DtoModels;
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -396,6 +397,14 @@ public List<dynamic> QueryCompute(int allotId, string viewName)
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)
{
......@@ -412,7 +421,7 @@ public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead)
else
sql = $@"SELECT * FROM {request.TableName} WHERE AllotId = @AllotId {Query} order by UnitType,AccountingUnit LIMIT {(request.PageIndex - 1) * request.PageSize},{request.PageSize} ";
result.DataList = DapperQuery<dynamic>(sql, new { request.AllotId })?.ToList();
sql = $@"SELECT COUNT(*) FROM {request.TableName} WHERE AllotId = @AllotId {Query} ";
......@@ -426,7 +435,7 @@ public bool QueryIsAllotId(string tableName)
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');";
var result = DapperQuery<string>(sql, new { database = database, table_name = tableName });
var isExist=result ?.Count() == 3;
var isExist = result?.Count() == 3;
return isExist;
......
......@@ -729,7 +729,15 @@ public List<IssuedPromptResponse> IssuedPrompt(per_allot allot, AllotRequest req
{
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>();
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());
}
if (promptSeconds.Any(t => t.IssueStatus == 1))
......
......@@ -2012,6 +2012,10 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route)
{ "/result/compute" , ComputeConfig.AllComputeView },
{ "/result/wholehospital" , ComputeConfig.AllComputePersonView },
{ "/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>();
}
......@@ -2065,6 +2069,48 @@ public List<dynamic> GetAllComputeView(int hospitalId, int AllotId, string viewN
{
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
......@@ -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.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.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.PerforSumFee), States = 1},
......@@ -2095,6 +2141,22 @@ public class ComputeConfig
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>
{
new cof_alias{ Alias = "科室类别", Name = nameof(view_allot_sign_emp.UnitType), States = 1},
......@@ -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.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>
{
new cof_alias{ Alias = "核算群体", Name = nameof(view_allot_sign_dept.UnitName), States = 1},
......@@ -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.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
{
var allot = perallotRepository.GetEntity(t => t.ID == allotId);
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 dpath = Path.Combine(evn.ContentRootPath, "Files", "PerformanceRelease", $"{allot.HospitalId}");
var dpath = Path.Combine(evn.ContentRootPath, "Files", "PerformanceRelease", $"{hospital.ID}");
FileHelper.CreateDirectory(dpath);
string filepath = Path.Combine(dpath, $"{hospital.HosName}-{name}-{DateTime.Now:yyyyMMdd}");
FileHelper.DeleteFile(filepath);
string[] notSum = new string[] { "year", "month" };
using (FileStream fs = new FileStream(filepath, FileMode.OpenOrCreate))
using (ExcelPackage package = new ExcelPackage(fs))
{
......@@ -197,11 +216,12 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
if (dynamics != null && dynamics.Count() > 0)
{
worksheet.SetValue(1, 1, title);
var headers = ((IDictionary<string, object>)dynamics.ElementAt(0)).Keys;
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++)
{
......@@ -211,23 +231,41 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
var temp = (IDictionary<string, object>)data;
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)
worksheet.SetValue(dynamics.Count() + 2, col + 1, "合计");
else
worksheet.Cells[dynamics.Count() + 2, col + 1].Formula = string.Format("SUM({0})", new ExcelAddress(2, col + 1, dynamics.Count() + 1, col + 1).Address);
worksheet.SetValue(dynamics.Count() + 3, col + 1, "合计");
else if (!notSum.Contains(headList[col].Name.ToLower()))
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);
for (int row = worksheet.Dimension.Start.Row; row <= worksheet.Dimension.End.Row; row++)
{
#region 样式设置
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++)
{
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.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.Cells[row, col].Style.Border.BorderAround(ExcelBorderStyle.Thin);
worksheet.Cells[row, col].Style.Numberformat.Format = "#,##0.00";
worksheet.Column(col).Width = worksheet.Column(col).Width > 20 ? 20 : worksheet.Column(col).Width;
}
#endregion
}
package.Save();
}
......
......@@ -204,7 +204,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
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("门诊"))
if (string.IsNullOrEmpty(ename) || ename.Contains("住院") || ename.Contains("门诊"))
filed = ename.Contains("住院") ? fieldInpatOut : fieldOutInpat;
}
else if (sheet.SheetName.Contains("工作量"))
......
......@@ -102,7 +102,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
queryService.ClearHistoryData(allot.ID, groupName, isSingle);
employeeService.SyncDataToResult(allotId);
//employeeService.SyncDataToResult(allotId);
var data = exresultRepository.GetEntities(t => t.AllotId == allotId && t.IsDelete == 0);
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,
var templateFilePath = ExtractHelper.GetExtractFile(hospitalId, allot, ref extractFilePath, filePath);
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);
if (workbook == null) throw new PerformanceException("文件读取失败");
if (workbook == null) throw new Exception("文件读取失败");
WriteDataToFile(workbook, allot, dict, standData, groupName, isSingle);
logService.ReturnTheLog(allotId, groupName, 2, "提取完成", $"绩效数据提取成功", 5, isSingle);
allot.IsExtracting = isSingle ? 2 : 0;
allot.ExtractPath = extractFilePath;
logService.ReturnTheLog(allotId, groupName, 2, "写入数据", $"写入数据至Excel文件", 1, isSingle);
workbook.EvaluateAll();
using (FileStream file = new FileStream(extractFilePath, FileMode.OpenOrCreate))
{
......@@ -142,6 +143,8 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
finally
{
logService.ReturnTheLog(allotId, groupName, 3, "", 100, 5, isSingle);
if (allot.IsExtracting != 3)
logService.ReturnTheLog(allotId, groupName, 2, "提取完成", $"绩效数据提取成功", 5, isSingle);
UpdateAllot(connection, allot);
}
return extractFilePath;
......
......@@ -272,33 +272,38 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
{
var config = configs.FirstOrDefault(t => t.Id == script.ConfigId);
if (config == null) continue;
var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle);
if (querydata != null && querydata.Any())
try
{
thisItems.ForEach(f =>
var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle);
if (querydata != null && querydata.Any())
{
var modulename = modules.FirstOrDefault(t => t.Id == f.ModuleId)?.ModuleName;
var result = querydata.Select(t => new ex_result
thisItems.ForEach(f =>
{
Department = t.Department,
Category = f.ItemName,
Fee = t.Value,
DoctorName = t.DoctorName,
PersonnelNumber = t.PersonnelNumber,
Source = modulename,
TypeId = typeId,
DatabaseType = config.DataBaseType,
ConfigId = config.Id,
AllotId = allot.ID,
CreateTime = CreateTime,
}).ToList();
exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result);
});
var modulename = modules.FirstOrDefault(t => t.Id == f.ModuleId)?.ModuleName;
var result = querydata.Select(t => new ex_result
{
Department = t.Department,
Category = f.ItemName,
Fee = t.Value,
DoctorName = t.DoctorName,
PersonnelNumber = t.PersonnelNumber,
Source = modulename,
TypeId = typeId,
DatabaseType = config.DataBaseType,
ConfigId = config.Id,
AllotId = allot.ID,
CreateTime = CreateTime,
}).ToList();
exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result);
});
}
}
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);
}
}
......@@ -336,29 +341,35 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
{
var config = configs.FirstOrDefault(t => t.Id == script.ConfigId);
if (config == null) continue;
var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle);
if (querydata != null && querydata.Any())
try
{
thisSpecials.ForEach(f =>
var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle);
if (querydata != null && querydata.Any())
{
var result = querydata.Select(t => new ex_result
thisSpecials.ForEach(f =>
{
Department = f.Department,
Category = f.Target,
Fee = t.Value,
DoctorName = t.DoctorName,
PersonnelNumber = t.PersonnelNumber,
Source = "4.2 特殊核算单元绩效测算表",
TypeId = typeId,
DatabaseType = config.DataBaseType,
ConfigId = config.Id,
AllotId = allot.ID,
CreateTime = CreateTime,
}).ToList();
exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result);
});
var result = querydata.Select(t => new ex_result
{
Department = f.Department,
Category = f.Target,
Fee = t.Value,
DoctorName = t.DoctorName,
PersonnelNumber = t.PersonnelNumber,
Source = "4.2 特殊核算单元绩效测算表",
TypeId = typeId,
DatabaseType = config.DataBaseType,
ConfigId = config.Id,
AllotId = allot.ID,
CreateTime = CreateTime,
}).ToList();
exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result);
});
}
}
catch (Exception ex)
{
logger.LogError($"typeId: {typeId}提取数据异常{ex}{Infrastructure.JsonHelper.Serialize(script)}");
}
}
......
......@@ -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))
{
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 })
.Select(t => new ExcelHeader
{
......
......@@ -2376,17 +2376,17 @@ public List<DeptDataDetails> DeptComputeDetailList(int userId, int allotId, out
var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
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.NurseRole, AccountUnitType.护士长.ToString() },
{ application.OfficeRole, AccountUnitType.行政中层.ToString() },
{ application.SpecialRole, AccountUnitType.科主任.ToString() },
{ application.DirectorRole, new List<string>{ AccountUnitType.科主任.ToString()} },
{ application.NurseRole, new List<string>{ AccountUnitType.护士长.ToString() } },
{ application.OfficeRole, new List<string> { AccountUnitType.行政中层.ToString() } },
{ application.SpecialRole, new List<string> { AccountUnitType.科主任.ToString() , AccountUnitType.护士长.ToString() } },
};
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>();
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