Commit 2905106b by ruyun.zhang@suvalue.com

Merge branch 'develop' into feature/新二次分配

parents 25323596 b83c5740
using FluentScheduler;
using Microsoft.Extensions.DependencyInjection;
using Performance.Services;
using System;
using System.Linq;
using System.Reflection;
namespace Performance.Api.Configurations
{
public static class FluentSchedulerConfig
{
public static void AddFluentSchedulerConfiguration(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
ServiceLocator.Instance = services.BuildServiceProvider();
JobManager.Initialize(new JobRegistry());
////扫描当前程序集中实现了Registry的类
//var registrys = Assembly.GetExecutingAssembly().GetTypes()
// .Where(t => !t.IsInterface && !t.IsSealed && !t.IsAbstract && typeof(Registry).IsAssignableFrom(t))
// .Select(s => s.Assembly.CreateInstance(s.FullName) as Registry)?.ToArray();
//// 注册同步服务
//JobManager.Initialize(registrys);
}
}
}
......@@ -22,14 +22,19 @@ public class EmployeeController : Controller
private AllotService allotService;
private ClaimService claim;
private IHostingEnvironment evn;
private readonly RoleService roleService;
private readonly UserService userService;
public EmployeeController(EmployeeService employeeService, AllotService allotService,
ClaimService claim, IHostingEnvironment evn)
ClaimService claim, IHostingEnvironment evn, RoleService roleService,
UserService userService)
{
this.employeeService = employeeService;
this.allotService = allotService;
this.claim = claim;
this.evn = evn;
this.roleService = roleService;
this.userService = userService;
}
/// <summary>
......@@ -456,8 +461,20 @@ public ApiResponse<List<TitleValue>> GetPerforTypeDict([FromRoute] int allotId)
[HttpPost]
public ApiResponse AprOverview(int allotId)
{
var relust = employeeService.GetOtherPerStats(allotId);
return new ApiResponse(ResponseType.OK, relust);
var roleType = new[] { 3, 4, 9, 10 };
var userid = claim.GetUserId();
var user = userService.GetUser(userid);
var role = roleService.GetUserRole(user.UserID);
var result = new List<Dictionary<string, string>>();
if (role.Any(t => roleType.Contains(t.Type.Value)))
result = employeeService.GetOtherPerStats(allotId,user.Department??"");
else
result = employeeService.GetOtherPerStats(allotId);
return new ApiResponse(ResponseType.OK, result);
}
#endregion
......
......@@ -8,7 +8,7 @@ public JobRegistry()
{
//Schedule<ExtractDataJob>().ToRunNow().AndEvery(1).Days().At(23, 0);
//Schedule<ExtractDataJob>().ToRunEvery(1).Days().At(23, 0);
Schedule<ExtractGenerateJob>().ToRunEvery(1).Days().At(1, 0);
Schedule<ExtractGenerateJob>().ToRunEvery(1).Days().At(14, 00);
}
}
}
......@@ -87,6 +87,9 @@ public void ConfigureServices(IServiceCollection services)
policy.SetIsOriginAllowed(origin => true).AllowAnyHeader().AllowAnyMethod().AllowCredentials();
});
});
// fluentscheduler
services.AddFluentSchedulerConfiguration();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
......
......@@ -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_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;",
"PerformanceConnectionString": "server=192.168.18.166;database=db_test_yuyao;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"
},
......
......@@ -10,7 +10,7 @@
<PackageReference Include="MySql.Data" Version="8.0.15" />
<PackageReference Include="MySql.Data.EntityFrameworkCore" Version="8.0.15" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="2.19.60" />
<PackageReference Include="Z.EntityFramework.Extensions.EFCore" Version="2.8.20" />
<PackageReference Include="Z.EntityFramework.Extensions.EFCore" Version="2.8.40" />
</ItemGroup>
<ItemGroup>
......
......@@ -665,10 +665,12 @@ public List<TitleValue> GetPerforTypeDict(int allotId)
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public List<Dictionary<string, string>> GetOtherPerStats(int allotId)
public List<Dictionary<string, string>> GetOtherPerStats(int allotId, string department=null)
{
var others = new List<Dictionary<string, string>>();
var aprAmountList = perapramountRepository.GetFullAmount(w => w.AllotId == allotId && w.Status == 3);
if (department != null)
aprAmountList = aprAmountList.Where(t => t.AccountingUnit == department).ToList();
var perForType = aprAmountList.Select(t => t.PerforType).Distinct();
foreach (var num in aprAmountList.Select(t => t.PersonnelNumber).Distinct())
......
......@@ -21,5 +21,19 @@ public class SpecialUnitColumns
public const string AssessBefore = "考核前绩效";
public const string Avg = "人均";
#region Extend
public const string AssessBeforeTotal = "考核前绩效合计";
public const string NewAvg = "新人均";
public const string OldPerformanceTotal = "旧绩效合计";
public const string OldAvg = "旧人均";
public const string AvgDifference = "人均差额";
#endregion
}
}
......@@ -105,7 +105,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
dataFirstRowNum = point.DataFirstRowNum.Value + rows.Count;
}
if (data == null || !data.Any(t => !string.IsNullOrEmpty(t.Department))) return;
if (data == null || !data.Any()) return;
WriteSheetDataNonexistent(sheet, columnHeader, point, sheetType, style, headers, data, dataFirstRowNum);
}
......@@ -171,7 +171,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
private static void WriteSheetDataNonexistent(ISheet sheet, IRow columnHeader, PerSheetPoint point, SheetType sheetType, ExcelStyle style,
List<string> headers, List<ExtractTransDto> data, int dataFirstRowNum)
{
var departments = data.Select(s => s.Department).Where(w => !string.IsNullOrEmpty(w)).Distinct().ToList();
var departments = data.Select(s => s.Department ?? "")/*.Where(w => !string.IsNullOrEmpty(w))*/.Distinct().ToList();
var filed = sheet.SheetName.Contains("住院") ? fieldInpat : fieldOut;
if (sheet.SheetName.Contains("工作量"))
......@@ -186,7 +186,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
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()) continue;
var row = sheet.GetOrCreate(dataFirstRowNum);
......@@ -327,7 +327,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
dataFirstRowNum = point.DataFirstRowNum.Value + rows.Count;
}
if (data == null || !data.Any(t => !string.IsNullOrEmpty(t.Department))) return;
if (data == null || !data.Any()) return;
WriteCollectDataNonexistent(sheet, columnHeader, point, sheetType, style, headers, data, dataFirstRowNum);
}
......@@ -393,7 +393,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
private static void WriteCollectDataNonexistent(ISheet sheet, IRow columnHeader, PerSheetPoint point, SheetType sheetType, ExcelStyle style,
List<string> headers, List<collect_data> data, int dataFirstRowNum)
{
var departments = data.Select(s => s.Department).Where(w => !string.IsNullOrEmpty(w)).Distinct().ToList();
var departments = data.Select(s => s.Department ?? "")/*.Where(w => !string.IsNullOrEmpty(w))*/.Distinct().ToList();
var filed = new SheetType[] { SheetType.Workload, SheetType.OtherWorkload }.Contains(sheetType)
? collectWork
......@@ -406,7 +406,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
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()) continue;
var row = sheet.GetOrCreate(dataFirstRowNum);
......
......@@ -238,6 +238,12 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
{
if (results == null || !results.Any()) return new List<ExtractTransDto>();
results.ForEach(t =>
{
t.Category = string.IsNullOrEmpty(t.Category) ? "(空白)" : t.Category;
t.Department = string.IsNullOrEmpty(t.Department) ? "(空白)" : t.Department;
});
var dict = personService.GetDepartments(hospitalId)?.ToList();
if (dict == null || !dict.Any())
return results.GroupBy(t => new { t.Department, t.Category, t.Source }).Select(t => new ExtractTransDto
......
......@@ -44,7 +44,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp
if (data is List<ExtractTransDto> extractDto && extractDto.Any())
{
var headers = extractDto.Select(t => t.Category.Trim()).Distinct()
var headers = extractDto.Select(t => t.Category?.Trim() ?? "").Distinct()
.Select(t => new ExcelHeader
{
ColumnName = t,
......
......@@ -329,8 +329,13 @@ private void AddMergedRegion(ISheet sheet, List<SpecialCellRange> ranges, List<s
SpecialUnitColumns.Department,
SpecialUnitColumns.PeopleNumber,
SpecialUnitColumns.AdjustFactor,
SpecialUnitColumns.AssessBefore,
SpecialUnitColumns.Avg
//SpecialUnitColumns.AssessBefore,
SpecialUnitColumns.Avg,
SpecialUnitColumns.AssessBeforeTotal,
SpecialUnitColumns.NewAvg,
SpecialUnitColumns.OldPerformanceTotal,
SpecialUnitColumns.OldAvg,
SpecialUnitColumns.AvgDifference
}.Select(t => columns.IndexOf(t));
if (columnIndexs == null || !columnIndexs.Any(t => t > -1)) return;
......
......@@ -36,9 +36,9 @@ public ISheetDataWrite GetWriteData(SheetType sheetType, ILogger logger)
factory = new WorkloadDataWrite(logger);
break;
case SheetType.AccountBasic:
factory = new AccountBasicDataWrite(logger);
break;
//case SheetType.AccountBasic:
// factory = new AccountBasicDataWrite(logger);
// break;
case SheetType.SpecialUnit:
factory = new SpecialUnitDataWrite(logger);
......@@ -52,18 +52,18 @@ public ISheetDataWrite GetWriteData(SheetType sheetType, ILogger logger)
// factory = new DepartmentDataWrite(logger);
// break;
case SheetType.AccountExtra:
case SheetType.AccountDrugAssess:
case SheetType.AccountMaterialsAssess:
case SheetType.AccountScoreAverage:
case SheetType.BudgetRatio:
case SheetType.AssessBeforeOtherFee:
case SheetType.AccountAdjustLaterOtherFee:
case SheetType.WorkloadMedicineProp:
case SheetType.WorkloadCMI:
case SheetType.WorkloadIncline:
factory = new AccountExtraDataWrite(logger);
break;
//case SheetType.AccountExtra:
//case SheetType.AccountDrugAssess:
//case SheetType.AccountMaterialsAssess:
//case SheetType.AccountScoreAverage:
//case SheetType.BudgetRatio:
//case SheetType.AssessBeforeOtherFee:
//case SheetType.AccountAdjustLaterOtherFee:
//case SheetType.WorkloadMedicineProp:
//case SheetType.WorkloadCMI:
//case SheetType.WorkloadIncline:
// factory = new AccountExtraDataWrite(logger);
// break;
default:
return null;
......
......@@ -378,7 +378,7 @@ public IEnumerable<DeptdicResponse> GetDepartments(int hospitalId)
{ application.DirectorRole, new string[]{ UnitType.医生组.ToString(), UnitType.其他医生组.ToString(), UnitType.医技组.ToString(), UnitType.其他医技组.ToString() } },
{ application.NurseRole, new string[]{ UnitType.护理组.ToString() } },
{ application.SpecialRole, new string[]{ UnitType.特殊核算组.ToString() } },
{ application.OfficeRole, new string[]{ UnitType.行政后勤.ToString() } },
{ application.OfficeRole, new string[]{ UnitType.行政后勤.ToString(), "行政工勤" } },
};
if (dict.Keys.Contains(role.Type.Value))
......
......@@ -162,6 +162,7 @@ public List<ag_bodysource> GetEmployeeFromPrevData(ag_secondallot prevSecond, Li
foreach (var item in body.Select(t => new ag_bodysource
{
Id = 0,
WorkNumber = t.WorkNumber,
Name = t.Name,
Post = t.Post,
......
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