Commit cf8d50a4 by lcx

Merge branch 'v2020morge' into v2020morge-graphql

# Conflicts:
#	performance/Performance.Api/Controllers/SecondAllotController.cs
#	performance/Performance.EntityModels/Entity/im_accountbasic.cs
#	performance/Performance.Repository/PerforCofdirectorRepository.cs
#	performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
parents 26996e64 7ffa0d8c
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "5.0.1",
"commands": [
"dotnet-ef"
]
}
}
}
\ No newline at end of file
using FluentValidation.AspNetCore;
using Hangfire;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Internal;
......@@ -7,7 +6,6 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Infrastructure;
using Performance.Services;
using Performance.Services.AllotCompute;
......@@ -16,7 +14,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
......@@ -27,19 +24,17 @@ namespace Performance.Api.Controllers
public class AllotController : Controller
{
private AllotService _allotService;
private readonly ResultComputeService resultComputeService;
private HospitalService _hospitalService;
private ResultComputeService _resultComputeService;
private ConfigService _configService;
private IHostingEnvironment _evn;
private ILogger<AllotController> _logger;
private ClaimService _claim;
private readonly LogManageService logManageService;
private LogManageService _logManageService;
private IBackgroundTaskQueue _backgroundTaskQueue;
private IServiceScopeFactory _serviceScopeFactory;
public AllotController(AllotService allotService,
ResultComputeService resultComputeService,
HospitalService hospitalService,
ConfigService configService,
ILogger<AllotController> logger,
IHostingEnvironment evn,
......@@ -49,12 +44,11 @@ public class AllotController : Controller
LogManageService logManageService)
{
_allotService = allotService;
this.resultComputeService = resultComputeService;
_hospitalService = hospitalService;
_resultComputeService = resultComputeService;
_logger = logger;
_evn = evn;
_claim = claim;
this.logManageService = logManageService;
_logManageService = logManageService;
_configService = configService;
_backgroundTaskQueue = backgroundTaskQueue;
_serviceScopeFactory = serviceScopeFactory;
......@@ -190,7 +184,7 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody] A
if (allot.States == (int)AllotStates.Wait)
return new ApiResponse(ResponseType.OK, "当前绩效正在等待生成");
logManageService.WriteMsg("生成绩效准备中", $"准备生成{allot.Year}-{allot.Month.ToString().PadLeft(2, '0')}月份绩效,请稍等!", 1, allot.ID, "ReceiveMessage", true);
_logManageService.WriteMsg("生成绩效准备中", $"准备生成{allot.Year}-{allot.Month.ToString().PadLeft(2, '0')}月份绩效,请稍等!", 1, allot.ID, "ReceiveMessage", true);
_allotService.UpdateAllotStates(allot.ID, (int)AllotStates.Wait, EnumHelper.GetDescription(AllotStates.Wait), allot.Generate);
if (_evn.IsEnvironment("Localhost"))
{
......@@ -211,13 +205,27 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody] A
});
}
logManageService.WriteMsg("等待绩效生成", $"等待绩效生成{allot.Year}-{allot.Month.ToString().PadLeft(2, '0')}月份绩效!", 1, allot.ID, "ReceiveMessage");
_logManageService.WriteMsg("等待绩效生成", $"等待绩效生成{allot.Year}-{allot.Month.ToString().PadLeft(2, '0')}月份绩效!", 1, allot.ID, "ReceiveMessage");
//_allotService.Generate(allot, email);
////BackgroundJob.Enqueue(() => _allotService.Generate(allot, email));
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 重新计算院领导绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("recalculation")]
[HttpPost]
public ApiResponse Recalculation([FromBody] RecalculationRequest request)
{
if (request.Money.HasValue)
_allotService.Recalculation(request.AllotId, request.Money.Value);
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 归档绩效记录
/// </summary>
/// <param name="request"></param>
......@@ -296,7 +304,7 @@ public ApiResponse Issued([FromBody] AllotRequest request)
throw new PerformanceException("当前绩效记录不存在");
_allotService.UpdateAllotStates(allot.ID, (int)AllotStates.GenerateSucceed, EnumHelper.GetDescription(AllotStates.GenerateSucceed));
// 科室下发
resultComputeService.GenerateSecondAllot(allot);
_resultComputeService.GenerateSecondAllot(allot);
return new ApiResponse(ResponseType.OK);
}
......
......@@ -194,58 +194,58 @@ public ConfigController(ConfigService configService, AllotService allotService)
#endregion
#region drugprop
/// <summary>
/// 获取 药占比配置信息列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("drugproplist")]
[HttpPost]
public ApiResponse<List<DrugpropResponse>> GetDrugList([CustomizeValidator(RuleSet = "Select"), FromBody] DrugpropRequest request)
{
var list = _configService.GetDrugList(request.AllotID);
return new ApiResponse<List<DrugpropResponse>>(ResponseType.OK, "ok", list);
}
///// <summary>
///// 获取 药占比配置信息列表
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("drugproplist")]
//[HttpPost]
//public ApiResponse<List<DrugpropResponse>> GetDrugList([CustomizeValidator(RuleSet = "Select"), FromBody] DrugpropRequest request)
//{
// var list = _configService.GetDrugList(request.AllotID);
// return new ApiResponse<List<DrugpropResponse>>(ResponseType.OK, "ok", list);
//}
/// <summary>
/// 新增药占比配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("druginsert")]
[HttpPost]
public ApiResponse<DrugpropResponse> DrugInsert([CustomizeValidator(RuleSet = "Insert"), FromBody] DrugpropRequest request)
{
var drugprop = _configService.DrugInsert(request);
return new ApiResponse<DrugpropResponse>(ResponseType.OK, drugprop);
}
///// <summary>
///// 新增药占比配置
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("druginsert")]
//[HttpPost]
//public ApiResponse<DrugpropResponse> DrugInsert([CustomizeValidator(RuleSet = "Insert"), FromBody] DrugpropRequest request)
//{
// var drugprop = _configService.DrugInsert(request);
// return new ApiResponse<DrugpropResponse>(ResponseType.OK, drugprop);
//}
/// <summary>
/// 修改药占比配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("drugupdate")]
[HttpPost]
public ApiResponse<DrugpropResponse> Update([CustomizeValidator(RuleSet = "Update"), FromBody] DrugpropRequest request)
{
var drugprop = _configService.DrugUpdate(request);
return new ApiResponse<DrugpropResponse>(ResponseType.OK, drugprop);
}
///// <summary>
///// 修改药占比配置
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("drugupdate")]
//[HttpPost]
//public ApiResponse<DrugpropResponse> Update([CustomizeValidator(RuleSet = "Update"), FromBody] DrugpropRequest request)
//{
// var drugprop = _configService.DrugUpdate(request);
// return new ApiResponse<DrugpropResponse>(ResponseType.OK, drugprop);
//}
/// <summary>
/// 删除药占比配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("drugdelete")]
[HttpPost]
public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody] DrugpropRequest request)
{
if (!_configService.DrugDelete(request))
return new ApiResponse(ResponseType.Fail);
return new ApiResponse(ResponseType.OK);
}
///// <summary>
///// 删除药占比配置
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("drugdelete")]
//[HttpPost]
//public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody] DrugpropRequest request)
//{
// if (!_configService.DrugDelete(request))
// return new ApiResponse(ResponseType.Fail);
// return new ApiResponse(ResponseType.OK);
//}
#endregion
#region drugtype
......@@ -372,7 +372,7 @@ public ApiResponse<List<cof_workitem>> GetWorkItems([CustomizeValidator(RuleSet
return new ApiResponse<List<cof_workitem>>(ResponseType.OK, "ok", list);
}
/// <summary>
/// <summary>
/// 新增工作量绩效配置
/// </summary>
/// <param name="request"></param>
......@@ -469,58 +469,58 @@ public ApiResponse DepttypeDelete([CustomizeValidator(RuleSet = "Delete"), FromB
#endregion
#region cmi
/// <summary>
/// 获取 CMI配置信息
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("cmilist")]
[HttpPost]
public ApiResponse GetHosCMIList([FromBody] cof_cmi request)
{
var list = _configService.GetCMIList(request.AllotId);
return new ApiResponse(ResponseType.OK, "ok", list);
}
///// <summary>
///// 获取 CMI配置信息
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("cmilist")]
//[HttpPost]
//public ApiResponse GetHosCMIList([FromBody] cof_cmi request)
//{
// var list = _configService.GetCMIList(request.AllotId);
// return new ApiResponse(ResponseType.OK, "ok", list);
//}
/// <summary>
/// 新增 CMI配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("cmiinsert")]
[HttpPost]
public ApiResponse HosCMIInsert([FromBody] cof_cmi request)
{
var drugprop = _configService.HosCMIInsert(request);
return new ApiResponse(ResponseType.OK, drugprop);
}
///// <summary>
///// 新增 CMI配置
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("cmiinsert")]
//[HttpPost]
//public ApiResponse HosCMIInsert([FromBody] cof_cmi request)
//{
// var drugprop = _configService.HosCMIInsert(request);
// return new ApiResponse(ResponseType.OK, drugprop);
//}
/// <summary>
/// 修改 CMI配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("cmiupdate")]
[HttpPost]
public ApiResponse HosCMIUpdate([FromBody] cof_cmi request)
{
var drugprop = _configService.HosCMIUpdate(request);
return new ApiResponse(ResponseType.OK, drugprop);
}
///// <summary>
///// 修改 CMI配置
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("cmiupdate")]
//[HttpPost]
//public ApiResponse HosCMIUpdate([FromBody] cof_cmi request)
//{
// var drugprop = _configService.HosCMIUpdate(request);
// return new ApiResponse(ResponseType.OK, drugprop);
//}
/// <summary>
/// 删除 CMI配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("cmidelete")]
[HttpPost]
public ApiResponse HosCMIDelete([FromBody] cof_cmi request)
{
if (!_configService.HosCMIDelete(request))
return new ApiResponse(ResponseType.Fail);
return new ApiResponse(ResponseType.OK);
}
///// <summary>
///// 删除 CMI配置
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("cmidelete")]
//[HttpPost]
//public ApiResponse HosCMIDelete([FromBody] cof_cmi request)
//{
// if (!_configService.HosCMIDelete(request))
// return new ApiResponse(ResponseType.Fail);
// return new ApiResponse(ResponseType.OK);
//}
#endregion
/// <summary>
......
......@@ -17,17 +17,18 @@ namespace Performance.Api.Controllers
[ApiController]
public class ExConfigController : Controller
{
private readonly ILogger<ExConfigController> logger;
private ILogger logger;
private WebapiUrl options;
private ExConfigService configService;
private WebapiUrl url;
public ExConfigController(
ILogger<ExConfigController> logger,
ExConfigService configService,
IOptions<WebapiUrl> url)
IOptions<WebapiUrl> options,
ExConfigService configService)
{
this.logger = logger;
this.options = options.Value;
this.configService = configService;
this.url = url.Value;
}
/// <summary>
......@@ -43,7 +44,7 @@ public ApiResponse Extract([CustomizeValidator(RuleSet = "Query"), FromBody] Mod
if (request.ExecuteType == null || !request.ExecuteType.Any())
return new ApiResponse(ResponseType.ParameterError, "ExecuteType 不存在,请重新选择!");
var list = configService.ExtractScheme(request.HospitalId.Value, request.ExecuteType);
var list = configService.ExtractScheme(request.HospitalId.Value, request.ExecuteType, request.SheetType);
return new ApiResponse(ResponseType.OK, list);
}
......@@ -70,9 +71,24 @@ public ApiResponse FeeSource([FromBody] ModModuleRequest request)
if (request.HospitalId == null || request.HospitalId.Value == 0)
return new ApiResponse(ResponseType.ParameterError, "HospitalId 参数错误!");
string retJson = HttpHelper.HttpPost(url.HttpPost + "/modextract/source", JsonHelper.Serialize(request), true);
var ret = JsonHelper.Deserialize<ApiResponse>(retJson);
return new ApiResponse(ResponseType.OK, ret.Data);
bool isSingle = false;
configService.QueryHosConfigs(request.ModuleId.Value, ref isSingle, out int sheetType);
ModFeeResponse response;
if (isSingle)
{
response = configService.FeeSource(request);
}
else
{
var http = new RestSharpHelper();
var url = http.SetUrl(options.HttpPost, "/modextract/source");
var req = http.CreatePostRequest(JsonHelper.Serialize(request));
var res = http.GetResponse(url, req);
var ret = http.GetContent<ApiResponse<ModFeeResponse>>(res);
response = ret.Data;
}
return new ApiResponse(ResponseType.OK, response);
}
/// <summary>
......@@ -161,14 +177,28 @@ public ApiResponse AddItem([FromBody] ItemListRequest request)
[HttpPost]
public ApiResponse Items([FromBody] ModItemRequest request)
{
if (!configService.QueryHosConfigs(request.ModuleId.Value, out int sheetType))
bool isSingle = false;
if (!configService.QueryHosConfigs(request.ModuleId.Value, ref isSingle, out int sheetType))
return new ApiResponse(ResponseType.Fail, "当前医院未配置地址");
if (sheetType == (int)SheetType.Income)
{
logger.LogInformation($"绩效收入模板配置项列表 : 请求地址 {url.HttpPost}/modextract/items");
HttpHelper.HttpPost(url.HttpPost + "/modextract/items", JsonHelper.Serialize(request), true);
logger.LogInformation($"绩效收入模板配置项列表在{DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss完成请求")}");
if (isSingle)
{
configService.AddItems(request.ModuleId.Value);
}
else
{
logger.LogInformation($"绩效收入模板配置项列表 : 请求地址 {options.HttpPost}/modextract/items");
var http = new RestSharpHelper();
var url = http.SetUrl(options.HttpPost, "/modextract/items");
var req = http.CreatePostRequest(JsonHelper.Serialize(request));
var res = http.GetResponse(url, req);
var ret = http.GetContent<ApiResponse>(res);
logger.LogInformation($"绩效收入模板配置项列表在{DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss完成请求")}");
}
}
var list = configService.QueryItems(request.ModuleId.Value);
return new ApiResponse(ResponseType.OK, list);
......@@ -204,8 +234,8 @@ public ApiResponse DelItem([FromBody] ModItemRequest request)
return new ApiResponse(ResponseType.OK, "删除成功!");
}
#region 特殊科室模板
/// <summary>
/// 特殊科室模板配置项新增
/// </summary>
......@@ -266,7 +296,6 @@ public ApiResponse DelSpecial([FromBody] ModSpecialRequest request)
return new ApiResponse(ResponseType.OK, "删除成功!");
}
/// <summary>
/// 特殊科室人均
/// </summary>
......@@ -278,7 +307,8 @@ public ApiResponse PerforType()
var list = configService.PerforType();
return new ApiResponse(ResponseType.OK, list);
}
#endregion
#endregion 特殊科室模板
/// <summary>
/// 数据配置项
......
......@@ -402,10 +402,10 @@ public ApiResponse NursingDeptAuditResult([FromBody] SecondAuditRequest request)
public ApiResponse OtherList([FromBody] AgOtherRequest request)
{
//var result = secondAllotService.OtherList(request.SecondId, claimService.GetUserId());
var result = secondAllotDetails.GetOtherTempDetails(claimService.GetUserId(), request.SecondId, request.IsArchive, request.EmployeeSource);
var result = secondAllotDetails.GetOtherTempData(claimService.GetUserId(), request.SecondId, request.IsArchive, request.EmployeeSource, out decimal? realAmount);
var obj = new
{
header = secondAllotService.OtherListHeader(request.SecondId, result?.Sum(t => t.RealAmount)),
header = secondAllotService.OtherListHeader(request.SecondId, realAmount ?? 0),
body = result,
};
return new ApiResponse(ResponseType.OK, obj);
......@@ -415,12 +415,12 @@ public ApiResponse OtherList([FromBody] AgOtherRequest request)
/// 二次绩效其他绩效保存
/// </summary>
/// <returns></returns>
[Route("api/second/other/save")]
[Route("api/second/other/save/{secondId}")]
[HttpPost]
public ApiResponse OtherSave([FromBody] AgOtherRequest request)
public ApiResponse OtherSave(int secondId, [FromBody] SaveCollectData request)
{
var result = secondAllotService.OtherSave(request.SecondId, request.Othersources);
return new ApiResponse(ResponseType.OK, result);
secondAllotService.OtherSave(secondId, request);
return new ApiResponse(ResponseType.OK);
}
#endregion 二次绩效其他绩效
......@@ -448,6 +448,7 @@ public ApiResponse DeptComputeDetail(int allotId)
var userId = claimService.GetUserId();
//var data = secondAllotService.DeptComputeDetail(userId, allotId, out int isShowManage);
var data = secondAllotService.DeptComputeDetailList(userId, allotId, out int isShowManage);
return new ApiResponse(ResponseType.OK, new { isShowManage, data });
}
}
......
......@@ -32,6 +32,7 @@
<PropertyGroup>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
<UserSecretsId>e732666b-5531-4cd8-b713-2fe3db31126c</UserSecretsId>
</PropertyGroup>
<ItemGroup>
......
......@@ -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;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_yubei;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"
},
......
......@@ -184,6 +184,13 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AllotController.Recalculation(Performance.DtoModels.RecalculationRequest)">
<summary>
重新计算院领导绩效
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AllotController.Pigeonhole(Performance.DtoModels.AllotRequest)">
<summary>
归档绩效记录
......@@ -426,34 +433,6 @@
<param name="computeId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.GetDrugList(Performance.DtoModels.DrugpropRequest)">
<summary>
获取 药占比配置信息列表
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.DrugInsert(Performance.DtoModels.DrugpropRequest)">
<summary>
新增药占比配置
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.Update(Performance.DtoModels.DrugpropRequest)">
<summary>
修改药占比配置
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.Delete(Performance.DtoModels.DrugpropRequest)">
<summary>
删除药占比配置
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.GetDrugtypeList(Performance.DtoModels.DrugpropRequest)">
<summary>
获取 药占比类型信息列表
......@@ -518,7 +497,7 @@
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.WorkItemInsert(Performance.DtoModels.WorkItemRequest)">
<summary>
<summary>
新增工作量绩效配置
</summary>
<param name="request"></param>
......@@ -566,34 +545,6 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.GetHosCMIList(Performance.EntityModels.cof_cmi)">
<summary>
获取 CMI配置信息
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.HosCMIInsert(Performance.EntityModels.cof_cmi)">
<summary>
新增 CMI配置
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.HosCMIUpdate(Performance.EntityModels.cof_cmi)">
<summary>
修改 CMI配置
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.HosCMIDelete(Performance.EntityModels.cof_cmi)">
<summary>
删除 CMI配置
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.WorkHeader(Performance.DtoModels.WorkItemRequest)">
<summary>
获取工作量绩效列头
......@@ -1287,7 +1238,7 @@
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.SecondAllotController.OtherSave(Performance.DtoModels.AgOtherRequest)">
<member name="M:Performance.Api.Controllers.SecondAllotController.OtherSave(System.Int32,Performance.DtoModels.SaveCollectData)">
<summary>
二次绩效其他绩效保存
</summary>
......@@ -1359,24 +1310,17 @@
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.TemplateController.SaveFile(Microsoft.AspNetCore.Http.IFormCollection,System.Int32,System.Int32)">
<member name="M:Performance.Api.Controllers.TemplateController.SaveFile">
<summary>
保存提取文件
</summary>
<param name="form"></param>
<param name="allotId"></param>
<param name="hospitalId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.TemplateController.ReturnLog(System.Int32,System.String,System.String,System.Int32,System.String)">
<member name="M:Performance.Api.Controllers.TemplateController.ReturnLog(Performance.DtoModels.SignalrLogRequest)">
<summary>
返回日志
</summary>
<param name="type">1 进度条 2 信息</param>
<param name="tag"></param>
<param name="message"></param>
<param name="level"></param>
<param name="groupName"></param>
<param name="request"></param>
</member>
<member name="M:Performance.Api.Controllers.TemplateController.ReturnLog(Performance.EntityModels.log_dbug)">
<summary>
......
......@@ -180,11 +180,11 @@
<summary> 日期 </summary>
</member>
<member name="M:Performance.DtoModels.HandsonTable.SetRowData(System.Collections.Generic.IEnumerable{Performance.DtoModels.HandsonRowData},System.Boolean)">
<summary>
<summary>
</summary>
<param name="datas"></param>
<param name="isTypein">是否是用户录入的 是:true 不是:false</param>
</summary>
<param name="datas"></param>
<param name="isTypein">是否是用户录入的 是:true 不是:false</param>
</member>
<member name="P:Performance.DtoModels.HistoryData.Year">
<summary>
......@@ -396,11 +396,6 @@
门诊药占比分值
</summary>
</member>
<member name="P:Performance.DtoModels.CofDrugProp.Prop">
<summary>
占比
</summary>
</member>
<member name="P:Performance.DtoModels.CofDrugProp.Factor">
<summary>
分值
......@@ -804,6 +799,18 @@
<member name="F:Performance.DtoModels.SheetType.PersonPostCoefficient">
<summary> 个人岗位系数 </summary>
</member>
<member name="F:Performance.DtoModels.SheetType.WorkloadMedicineProp">
<summary> 药占比系数 </summary>
</member>
<member name="F:Performance.DtoModels.SheetType.WorkloadCMI">
<summary> CMI系数 </summary>
</member>
<member name="F:Performance.DtoModels.SheetType.WorkloadIncline">
<summary> 工作量倾斜系数 </summary>
</member>
<member name="F:Performance.DtoModels.SheetType.Assess">
<summary> 考核 </summary>
</member>
<member name="T:Performance.DtoModels.AccountUnitType">
<summary>
核算单元类型
......@@ -1037,11 +1044,6 @@
应发管理绩效
</summary>
</member>
<member name="P:Performance.DtoModels.PerDataAccountBaisc.MedicineFactor">
<summary>
药占比系数
</summary>
</member>
<member name="P:Performance.DtoModels.PerDataAccountBaisc.Income">
<summary>
科室业绩
......@@ -2014,23 +2016,33 @@
<member name="P:Performance.DtoModels.ExtractRequest.AllotId">
<summary>
绩效ID
</summary>
</summary>
</member>
<member name="P:Performance.DtoModels.ExtractRequest.HospitalId">
<summary>
医院ID
</summary>
</summary>
</member>
<member name="P:Performance.DtoModels.ExtractRequest.UseScheme">
<summary>
使用方案
</summary>
</summary>
</member>
<member name="P:Performance.DtoModels.ExtractRequest.Email">
<summary>
邮箱
</summary>
</member>
<member name="P:Performance.DtoModels.ExtractRequest.GroupName">
<summary>
Signalr分组名称
</summary>
</member>
<member name="P:Performance.DtoModels.ExtractRequest.UserId">
<summary>
用户Id
</summary>
</member>
<member name="P:Performance.DtoModels.GuaranteeRequest.Id">
<summary> </summary>
</member>
......@@ -2842,6 +2854,9 @@
<member name="P:Performance.DtoModels.DetailModule.CMIFactor">
<summary> CMI系数 </summary>
</member>
<member name="P:Performance.DtoModels.DetailModule.InclineFactor">
<summary> 工作量倾斜系数 </summary>
</member>
<member name="P:Performance.DtoModels.DetailModule.ItemValue">
<summary> 结算值 </summary>
</member>
......
......@@ -67,18 +67,12 @@
<member name="P:Performance.EntityModels.PerformanceDbContext.cof_check">
<summary> 上传excel文件校验配置 </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.cof_cmi">
<summary> </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.cof_depttype">
<summary> 科室类型 </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.cof_director">
<summary> 规模绩效、效率绩效计算系数配置 </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.cof_drugprop">
<summary> 工作量门诊药占比系数 </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.cof_drugtype">
<summary> 药占比费用列头名称 </summary>
</member>
......@@ -1316,36 +1310,6 @@
单元格列头名称
</summary>
</member>
<member name="T:Performance.EntityModels.cof_cmi">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.cof_cmi.Id">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.cof_cmi.AllotId">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.cof_cmi.UnitType">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.cof_cmi.AccountingUnit">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.cof_cmi.Value">
<summary>
</summary>
</member>
<member name="T:Performance.EntityModels.cof_depttype">
<summary>
科室类型
......@@ -1406,36 +1370,6 @@
绩效系数
</summary>
</member>
<member name="T:Performance.EntityModels.cof_drugprop">
<summary>
工作量门诊药占比系数
</summary>
</member>
<member name="P:Performance.EntityModels.cof_drugprop.ID">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.cof_drugprop.AllotID">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.cof_drugprop.MaxRange">
<summary>
药占比最大范围(小于)
</summary>
</member>
<member name="P:Performance.EntityModels.cof_drugprop.MinRange">
<summary>
药占比最小范围(大于等于)
</summary>
</member>
<member name="P:Performance.EntityModels.cof_drugprop.Value">
<summary>
药占比对应系数
</summary>
</member>
<member name="T:Performance.EntityModels.cof_drugtype">
<summary>
药占比费用列头名称
......@@ -2136,11 +2070,6 @@
核算单元(护理组)
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.Department">
<summary>
科室
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.IncludeAvgCalculate">
<summary>
是否带入平均计算 是 否
......@@ -2151,11 +2080,6 @@
定科人数
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.DoctorDirectorNumber">
<summary>
科主任数量
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.DoctorNumber">
<summary>
核算单元医生数量
......@@ -2166,11 +2090,6 @@
医生基础系数
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.DoctorSlopeFactor">
<summary>
倾斜系数
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.DoctorScale">
<summary>
规模绩效系数
......@@ -2206,11 +2125,6 @@
材料占比奖罚
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.DoctorExtra">
<summary>
医院奖罚
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.DoctorScoringAverage">
<summary>
考核对分率
......@@ -2231,71 +2145,6 @@
保底绩效系数
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.NurseHeadNumber">
<summary>
护士长人数
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.NurseNumber">
<summary>
护士人数
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.NurseBasicFactor">
<summary>
护理基础系数
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.NurseSlopeFactor">
<summary>
倾斜系数
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.NurseScale">
<summary>
规模绩效系数
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.NurseEffic">
<summary>
效率绩效系数
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.NurseGrant">
<summary>
发放系数
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.NurseOtherPerfor1">
<summary>
其他绩效1
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.NurseOtherPerfor2">
<summary>
其他绩效2
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.NurseExtra">
<summary>
医院奖罚
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.NurseScoringAverage">
<summary>
考核对分率
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.NurseAdjustFactor">
<summary>
调节系数
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.WorkSlopeFactor">
<summary>
工作量倾斜系数
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.UpdateDate">
<summary>
......
......@@ -10,12 +10,12 @@ public class HandsonTable
{
private IEnumerable<collect_permission> _permissions;
private List<Dictionary<string, string>> _data;
public HandsonTable(int sheetType, string[] cols, List<collect_permission> permissions)
{
_permissions = permissions;
_data = new List<Dictionary<string, string>>();
InitColHeaders(sheetType, cols);
InitColumns(permissions);
}
......@@ -25,7 +25,7 @@ public HandsonTable(int sheetType, string[] cols, List<collect_permission> permi
public HandsonColumn[] Columns { get; private set; }
/// <summary>
///
///
/// </summary>
/// <param name="datas"></param>
/// <param name="isTypein">是否是用户录入的 是:true 不是:false</param>
......@@ -40,6 +40,8 @@ public void SetRowData(IEnumerable<HandsonRowData> datas, bool isTypein)
dic[item.Name.ToLower()] = item.Value?.ToString() ?? "";
else if (dic.ContainsKey(item.Name.ToLower()) && _permissions.Any(w => w.HeadName.ToLower() == item.Name.ToLower() && w.AttachLast > 0))
dic[item.Name.ToLower()] = item.Value?.ToString() ?? "";
else if (dic.ContainsKey(item.Name.ToLower()) && _permissions.Any(w => w.HeadName.ToLower() == item.Name.ToLower()))
dic[item.Name.ToLower()] = item.Value?.ToString() ?? "";
}
_data.Add(dic);
}
......@@ -105,20 +107,25 @@ public HandsonColumn(string data, bool readOnly = false, DataFormat format = Dat
case DataFormat.普通格式:
Type = "text";
break;
case DataFormat.小数:
Type = "numeric";
NumericFormat = new NumericFormat { Pattern = "0,00.00" };
break;
case DataFormat.百分比:
Type = "numeric";
NumericFormat = new NumericFormat { Pattern = "0,00.00%" };
break;
}
}
public string Data { get; set; }
public bool ReadOnly { get; set; }
public string Type { get; set; }
public string[] Source { get; set; }
public bool Strict { get; set; } = false;
public NumericFormat NumericFormat { get; set; }
}
......
......@@ -9,11 +9,13 @@ namespace Performance.DtoModels
/// </summary>
public class CofDrugProp
{
public string AccoutingUnit { get; set; }
/// <summary>
/// 占比
/// </summary>
public decimal Prop { get; set; }
public string AccountingUnit { get; set; }
public string UnitType { get; set; }
//public string AccoutingUnit { get; set; }
///// <summary>
///// 占比
///// </summary>
//public decimal Prop { get; set; }
/// <summary>
/// 分值
/// </summary>
......
......@@ -11,32 +11,41 @@ public enum ExcelVersion
xls
}
/// <summary> 核算单元类型 </summary>
public enum UnitType
{
[Description("医生组")]
医生组 = 1,
[Description("护理组")]
护理组 = 2,
[Description("医技组")]
医技组 = 3,
[Description("专家组")]
专家组 = 4,
//[Description("其他")]
//其他 = 5,
[Description("特殊核算组")]
特殊核算组 = 6,
[Description("其他医生组")]
其他医生组 = 7,
[Description("其他护理组")]
其他护理组 = 8,
[Description("其他医技组")]
其他医技组 = 9,
[Description("行政高层")]
行政高层 = 10,
[Description("行政中层")]
行政中层 = 11,
[Description("行政后勤")]
行政后勤 = 12,
}
......@@ -46,27 +55,35 @@ public enum SheetType
/// <summary> 无法识别 </summary>
[Description("无法识别")]
Unidentifiable = 1,
/// <summary> 行政中高层 </summary>
[Description("行政中高层")]
Employee = 2,
/// <summary> 收入 </summary>
[Description("收入")]
Income = 3,
/// <summary> 其他收入 </summary>
[Description("其他收入")]
OtherIncome = 4,
/// <summary> 支出 </summary>
[Description("支出")]
Expend = 5,
/// <summary> 加班 </summary>
[Description("加班")]
Overtime = 6,
/// <summary> 工作量 </summary>
[Description("工作量")]
Workload = 7,
/// <summary> 特殊核算单元 </summary>
[Description("特殊核算单元")]
SpecialUnit = 8,
/// <summary> 临床科室医护绩效测算基础 </summary>
[Description("临床科室医护绩效测算基础")]
AccountBasic = 9,
......@@ -74,15 +91,19 @@ public enum SheetType
/// <summary> 科室经济核算汇总表 </summary>
[Description("科室经济核算汇总表")]
ComputeEconomic = 10,
/// <summary> 医生工作量计算 </summary>
[Description("医生工作量计算")]
ComputeDoctorWorkload = 11,
/// <summary> 护士工作量计算 </summary>
[Description("护士工作量计算")]
ComputeNurseWorkload = 12,
/// <summary> 临床科室医生绩效测算表 </summary>
[Description("临床科室医生绩效测算表")]
ComputeDoctorAccount = 13,
/// <summary> 临床科室护士绩效测算表 </summary>
[Description("临床科室护士绩效测算表")]
ComputeNurseAccount = 14,
......@@ -115,7 +136,6 @@ public enum SheetType
[Description("行政后勤")]
LogisticsEmployee = 21,
/// <summary> 科室考核 </summary>
[Description("科室考核")]
AccountScoreAverage = 25,
......@@ -132,22 +152,41 @@ public enum SheetType
[Description("其他工作量")]
OtherWorkload = 28,
/// <summary> 预算比例 </summary>
[Description("预算比例")]
BudgetRatio = 30,
/// <summary> 科室考核前其他绩效 </summary>
[Description("科室考核前其他绩效")]
AssessBeforeOtherFee = 31,
/// <summary> 其他管理绩效 </summary>
[Description("其他管理绩效")]
PersonOtherManagePerforFee = 32,
/// <summary> 调节后其他管理绩效 </summary>
[Description("调节后其他管理绩效")]
PersonAdjustLaterOtherManagePerforFee = 33,
/// <summary> 个人岗位系数 </summary>
[Description("个人岗位系数")]
PersonPostCoefficient = 34,
/// <summary> 药占比系数 </summary>
[Description("药占比系数")]
WorkloadMedicineProp = 35,
/// <summary> CMI系数 </summary>
[Description("CMI系数")]
WorkloadCMI = 36,
/// <summary> 工作量倾斜系数 </summary>
[Description("工作量倾斜系数")]
WorkloadIncline = 37,
/// <summary> 考核 </summary>
[Description("考核")]
Assess = 38, //该参数作用类似于 其他工作量
}
/// <summary>
......@@ -158,18 +197,23 @@ public enum AccountUnitType
/// <summary> </summary>
[Description("")]
Null = 1,
/// <summary> 临床科室 </summary>
[Description("科主任")]
科主任 = 2,
/// <summary> 临床科室 </summary>
[Description("护士长")]
护士长 = 3,
/// <summary> 行政高层 </summary>
[Description("行政高层")]
行政高层 = 4,
/// <summary> 临床科室 </summary>
[Description("行政中层")]
行政中层 = 5,
/// <summary> 临床科室 </summary>
[Description("行政工勤")]
行政工勤 = 6,
......@@ -179,30 +223,43 @@ public enum PerforType
{
[Description("临床科室主任人均绩效")]
临床主任,
[Description("临床科室副主任人均绩效")]
临床副主任,
[Description("医技科室主任人均绩效")]
医技主任,
[Description("医技科室副主任人均绩效")]
医技副主任,
[Description("护士长人均绩效")]
护士长,
[Description("护士人均绩效")]
护士,
[Description("临床主任护士长平均")]
临床主任护士长平均,
[Description("临床主任医技主任护士长平均")]
临床主任医技主任护士长平均,
[Description("临床医生人均绩效")]
临床医生,
[Description("医技医生人均绩效")]
医技医生,
[Description("行政高层人均绩效")]
行政高层,
[Description("行政中层人均绩效")]
行政中层,
[Description("行政工勤人均绩效")]
行政工勤,
[Description("医生护士平均绩效")]
医生护士平均,
}
......@@ -214,12 +271,16 @@ public enum MinimumType
{
[Description("保底绩效临床医生人均绩效")]
保底临床医生 = 1,
[Description("保底绩效医技医生人均绩效")]
保底医技医生 = 2,
[Description("保底绩效护士人均绩效")]
保底护士 = 3,
[Description("保底绩效行政工勤人均绩效")]
保底工勤 = 4,
[Description("自定义保底绩效")]
自定义保底 = 5,
}
......
......@@ -72,6 +72,6 @@ public class PerData : IPerData
public int PointCell { get; set; }
public string SignID { get; set; }
public decimal? MedicineFactor { get; set; }
//public decimal? MedicineFactor { get; set; }
}
}
......@@ -177,10 +177,10 @@ public class PerDataAccountBaisc : IPerData
#region 由计算得出
/// <summary>
/// 药占比系数
/// </summary>
public Nullable<decimal> MedicineFactor { get; set; }
///// <summary>
///// 药占比系数
///// </summary>
//public Nullable<decimal> MedicineFactor { get; set; }
///// <summary>
///// 保底绩效金额
......
......@@ -9,17 +9,17 @@ public class ExtractRequest
{
/// <summary>
/// 绩效ID
/// </summary>
/// </summary>
public int AllotId { get; set; }
/// <summary>
/// 医院ID
/// </summary>
/// </summary>
public int HospitalId { get; set; }
/// <summary>
/// 使用方案
/// </summary>
/// </summary>
public int UseScheme { get; set; }
/// <summary>
......@@ -27,9 +27,16 @@ public class ExtractRequest
/// </summary>
public string Email { get; set; }
/// <summary>
/// Signalr分组名称
/// </summary>
public string GroupName { get; set; }
}
/// <summary>
/// 用户Id
/// </summary>
public int UserId { get; set; }
}
public class ExtractRequestValidator : AbstractValidator<ExtractRequest>
{
......
namespace Performance.DtoModels
{
public class RecalculationRequest
{
public int AllotId { get; set; }
public decimal? Money { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class SignalrLogRequest
{
public int Type { get; set; }
public string Tag { get; set; }
public string Message { get; set; }
public int Level { get; set; }
public string GroupName { get; set; }
}
}
......@@ -85,6 +85,9 @@ public class DetailModule
/// <summary> CMI系数 </summary>
public decimal? CMIFactor { get; set; }
/// <summary> 工作量倾斜系数 </summary>
public decimal? InclineFactor { get; set; }
/// <summary> 结算值 </summary>
public decimal? ItemValue { get; set; }
}
......
......@@ -74,8 +74,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
/// <summary> 上传excel文件校验配置 </summary>
public virtual DbSet<cof_check> cof_check { get; set; }
/// <summary> </summary>
public virtual DbSet<cof_cmi> cof_cmi { get; set; }
///// <summary> </summary>
//public virtual DbSet<cof_cmi> cof_cmi { get; set; }
/// <summary> 科室类型 </summary>
public virtual DbSet<cof_depttype> cof_depttype { get; set; }
......@@ -83,8 +83,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
/// <summary> 规模绩效、效率绩效计算系数配置 </summary>
public virtual DbSet<cof_director> cof_director { get; set; }
/// <summary> 工作量门诊药占比系数 </summary>
public virtual DbSet<cof_drugprop> cof_drugprop { get; set; }
///// <summary> 工作量门诊药占比系数 </summary>
//public virtual DbSet<cof_drugprop> cof_drugprop { get; set; }
/// <summary> 药占比费用列头名称 </summary>
public virtual DbSet<cof_drugtype> cof_drugtype { get; set; }
......
//-----------------------------------------------------------------------
// <copyright file=" cof_cmi.cs">
// * FileName: .cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
////-----------------------------------------------------------------------
//// <copyright file=" cof_cmi.cs">
//// * FileName: .cs
//// </copyright>
////-----------------------------------------------------------------------
//using System;
//using System.ComponentModel.DataAnnotations;
//using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
///
/// </summary>
[Table("cof_cmi")]
public class cof_cmi
{
/// <summary>
///
/// </summary>
[Key]
public int Id { get; set; }
//namespace Performance.EntityModels
//{
// /// <summary>
// ///
// /// </summary>
// [Table("cof_cmi")]
// public class cof_cmi
// {
// /// <summary>
// ///
// /// </summary>
// [Key]
// public int Id { get; set; }
/// <summary>
///
/// </summary>
public int AllotId { get; set; }
// /// <summary>
// ///
// /// </summary>
// public int AllotId { get; set; }
/// <summary>
///
/// </summary>
public int UnitType { get; set; }
// /// <summary>
// ///
// /// </summary>
// public int UnitType { get; set; }
/// <summary>
///
/// </summary>
public string AccountingUnit { get; set; }
// /// <summary>
// ///
// /// </summary>
// public string AccountingUnit { get; set; }
/// <summary>
///
/// </summary>
public Nullable<decimal> Value { get; set; }
}
}
// /// <summary>
// ///
// /// </summary>
// public Nullable<decimal> Value { get; set; }
// }
//}
//-----------------------------------------------------------------------
// <copyright file=" cof_drugprop.cs">
// * FileName: 工作量门诊药占比系数.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
////-----------------------------------------------------------------------
//// <copyright file=" cof_drugprop.cs">
//// * FileName: 工作量门诊药占比系数.cs
//// </copyright>
////-----------------------------------------------------------------------
//using System;
//using System.ComponentModel.DataAnnotations;
//using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
/// 工作量门诊药占比系数
/// </summary>
[Table("cof_drugprop")]
public class cof_drugprop
{
/// <summary>
///
/// </summary>
[Key]
public int ID { get; set; }
//namespace Performance.EntityModels
//{
// /// <summary>
// /// 工作量门诊药占比系数
// /// </summary>
// [Table("cof_drugprop")]
// public class cof_drugprop
// {
// /// <summary>
// ///
// /// </summary>
// [Key]
// public int ID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> AllotID { get; set; }
// /// <summary>
// ///
// /// </summary>
// public Nullable<int> AllotID { get; set; }
/// <summary>
/// 药占比最大范围(小于)
/// </summary>
public Nullable<decimal> MaxRange { get; set; }
// /// <summary>
// /// 药占比最大范围(小于)
// /// </summary>
// public Nullable<decimal> MaxRange { get; set; }
/// <summary>
/// 药占比最小范围(大于等于)
/// </summary>
public Nullable<decimal> MinRange { get; set; }
// /// <summary>
// /// 药占比最小范围(大于等于)
// /// </summary>
// public Nullable<decimal> MinRange { get; set; }
/// <summary>
/// 药占比对应系数
/// </summary>
public Nullable<decimal> Value { get; set; }
}
}
// /// <summary>
// /// 药占比对应系数
// /// </summary>
// public Nullable<decimal> Value { get; set; }
// }
//}
......@@ -46,10 +46,10 @@ public class im_accountbasic
/// </summary>
public string NurseAccountingUnit { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
///// <summary>
///// 科室
///// </summary>
//public string Department { get; set; }
/// <summary>
/// 是否带入平均计算 是 否
......@@ -61,10 +61,10 @@ public class im_accountbasic
/// </summary>
public Nullable<decimal> PermanentStaff { get; set; }
/// <summary>
/// 科主任数量
/// </summary>
public Nullable<decimal> DoctorDirectorNumber { get; set; }
///// <summary>
///// 科主任数量
///// </summary>
//public Nullable<decimal> DoctorDirectorNumber { get; set; }
/// <summary>
/// 核算单元医生数量
......@@ -76,10 +76,10 @@ public class im_accountbasic
/// </summary>
public Nullable<decimal> DoctorBasicFactor { get; set; }
/// <summary>
/// 倾斜系数
/// </summary>
public Nullable<decimal> DoctorSlopeFactor { get; set; }
///// <summary>
///// 倾斜系数
///// </summary>
//public Nullable<decimal> DoctorSlopeFactor { get; set; }
/// <summary>
/// 规模绩效系数
......@@ -116,9 +116,9 @@ public class im_accountbasic
/// </summary>
public Nullable<decimal> MaterialsExtra { get; set; }
/// <summary>
/// 医院奖罚
/// </summary>
///// <summary>
///// 医院奖罚
///// </summary>
public Nullable<decimal> DoctorExtra { get; set; }
/// <summary>
......@@ -141,70 +141,70 @@ public class im_accountbasic
/// </summary>
public Nullable<decimal> MinimumFactor { get; set; }
/// <summary>
/// 护士长人数
/// </summary>
public Nullable<decimal> NurseHeadNumber { get; set; }
/// <summary>
/// 护士人数
/// </summary>
public Nullable<decimal> NurseNumber { get; set; }
/// <summary>
/// 护理基础系数
/// </summary>
public Nullable<decimal> NurseBasicFactor { get; set; }
/// <summary>
/// 倾斜系数
/// </summary>
public Nullable<decimal> NurseSlopeFactor { get; set; }
/// <summary>
/// 规模绩效系数
/// </summary>
public Nullable<decimal> NurseScale { get; set; }
/// <summary>
/// 效率绩效系数
/// </summary>
public Nullable<decimal> NurseEffic { get; set; }
/// <summary>
/// 发放系数
/// </summary>
public Nullable<decimal> NurseGrant { get; set; }
/// <summary>
/// 其他绩效1
/// </summary>
public Nullable<decimal> NurseOtherPerfor1 { get; set; }
/// <summary>
/// 其他绩效2
/// </summary>
public Nullable<decimal> NurseOtherPerfor2 { get; set; }
/// <summary>
/// 医院奖罚
/// </summary>
public Nullable<decimal> NurseExtra { get; set; }
/// <summary>
/// 考核对分率
/// </summary>
public Nullable<decimal> NurseScoringAverage { get; set; }
/// <summary>
/// 调节系数
/// </summary>
public Nullable<decimal> NurseAdjustFactor { get; set; }
/// <summary>
/// 工作量倾斜系数
/// </summary>
public Nullable<decimal> WorkSlopeFactor { get; set; }
///// <summary>
///// 护士长人数
///// </summary>
//public Nullable<decimal> NurseHeadNumber { get; set; }
///// <summary>
///// 护士人数
///// </summary>
//public Nullable<decimal> NurseNumber { get; set; }
///// <summary>
///// 护理基础系数
///// </summary>
//public Nullable<decimal> NurseBasicFactor { get; set; }
///// <summary>
///// 倾斜系数
///// </summary>
//public Nullable<decimal> NurseSlopeFactor { get; set; }
///// <summary>
///// 规模绩效系数
///// </summary>
//public Nullable<decimal> NurseScale { get; set; }
///// <summary>
///// 效率绩效系数
///// </summary>
//public Nullable<decimal> NurseEffic { get; set; }
///// <summary>
///// 发放系数
///// </summary>
//public Nullable<decimal> NurseGrant { get; set; }
///// <summary>
///// 其他绩效1
///// </summary>
//public Nullable<decimal> NurseOtherPerfor1 { get; set; }
///// <summary>
///// 其他绩效2
///// </summary>
//public Nullable<decimal> NurseOtherPerfor2 { get; set; }
///// <summary>
///// 医院奖罚
///// </summary>
//public Nullable<decimal> NurseExtra { get; set; }
///// <summary>
///// 考核对分率
///// </summary>
//public Nullable<decimal> NurseScoringAverage { get; set; }
///// <summary>
///// 调节系数
///// </summary>
//public Nullable<decimal> NurseAdjustFactor { get; set; }
///// <summary>
///// 工作量倾斜系数
///// </summary>
//public Nullable<decimal> WorkSlopeFactor { get; set; }
/// <summary>
///
......@@ -215,17 +215,15 @@ public class im_accountbasic
///
/// </summary>
public Nullable<int> UpdateUser { get; set; }
/// <summary>
/// 考核前其他绩效
/// </summary>
public Nullable<decimal> AssessBeforeOtherFee { get; set; }
/// <summary>
/// 考核后其他绩效
/// </summary>
public Nullable<decimal> AssessLaterOtherFee { get; set; }
/// <summary>
/// 调节后其他绩效
/// </summary>
......
......@@ -16,6 +16,7 @@ public class ModExtractController : Controller
{
private readonly ILogger<ModExtractController> logger;
private ExConfigService service;
public ModExtractController(
ILogger<ModExtractController> logger,
ExConfigService service)
......@@ -24,34 +25,38 @@ public class ModExtractController : Controller
this.service = service;
}
/// <summary>
/// 绩效数据抽取模板
/// </summary>
/// <returns></returns>
[Route("scheme")]
[HttpPost]
public ApiResponse Extract([CustomizeValidator(RuleSet = "Query"), FromBody]ModModuleRequest request)
{
if (request.HospitalId == null || request.HospitalId.Value == 0)
return new ApiResponse(ResponseType.ParameterError, "HospitalId 不存在,请重新选择!");
if (request.ExecuteType == null || !request.ExecuteType.Any())
return new ApiResponse(ResponseType.ParameterError, "ExecuteType 不存在,请重新选择!");
#region 弃用
var list = service.ExtractScheme(request.HospitalId.Value, request.ExecuteType);
return new ApiResponse(ResponseType.OK, list);
}
///// <summary>
///// 绩效数据抽取模板
///// </summary>
///// <returns></returns>
//[Route("scheme")]
//[HttpPost]
//public ApiResponse Extract([CustomizeValidator(RuleSet = "Query"), FromBody]ModModuleRequest request)
//{
// if (request.HospitalId == null || request.HospitalId.Value == 0)
// return new ApiResponse(ResponseType.ParameterError, "HospitalId 不存在,请重新选择!");
// if (request.ExecuteType == null || !request.ExecuteType.Any())
// return new ApiResponse(ResponseType.ParameterError, "ExecuteType 不存在,请重新选择!");
/// <summary>
/// 费用类型
/// </summary>
/// <returns></returns>
[Route("type")]
[HttpPost]
public ApiResponse FeeType()
{
var list = service.FeeType();
return new ApiResponse(ResponseType.OK, list);
}
// var list = service.ExtractScheme(request.HospitalId.Value, request.ExecuteType);
// return new ApiResponse(ResponseType.OK, list);
//}
///// <summary>
///// 费用类型
///// </summary>
///// <returns></returns>
//[Route("type")]
//[HttpPost]
//public ApiResponse FeeType()
//{
// var list = service.FeeType();
// return new ApiResponse(ResponseType.OK, list);
//}
#endregion 弃用
/// <summary>
/// 绩效考核项费用来源
......@@ -59,7 +64,7 @@ public ApiResponse FeeType()
/// <returns></returns>
[Route("source")]
[HttpPost]
public ApiResponse FeeSource([FromBody]ModModuleRequest request)
public ApiResponse FeeSource([FromBody] ModModuleRequest request)
{
if (request.HospitalId == null || request.HospitalId.Value == 0)
return new ApiResponse(ResponseType.ParameterError, "HospitalId 参数错误!");
......@@ -75,11 +80,11 @@ public ApiResponse FeeSource([FromBody]ModModuleRequest request)
/// <returns></returns>
[Route("items")]
[HttpPost]
public ApiResponse Items([FromBody]ModItemRequest request)
public ApiResponse Items([FromBody] ModItemRequest request)
{
logger.LogInformation($"绩效收入模板配置项列表:{JsonHelper.Serialize(request)}");
service.AddItems(request.ModuleId.Value);
return new ApiResponse(ResponseType.OK);
}
}
}
\ No newline at end of file
}
using RestSharp;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Performance.Infrastructure
{
public class RestSharpHelper
{
public const string tokenHeader = "Authorization";
public RestClient SetUrl(string baseUrl, string endpoint)
{
var url = Path.Combine(baseUrl, endpoint);
var restClient = new RestClient(url);
return restClient;
}
public RestRequest CreateGetRequest(string tokenHeader = tokenHeader, string token = null, int timeout = -1)
{
var restRequest = new RestRequest(Method.GET);
restRequest.AddHeader(tokenHeader, token);
restRequest.AddHeader("Accept", "application/json");
restRequest.Timeout = timeout;
return restRequest;
}
public RestRequest CreatePostRequest(string payload, string tokenHeader = tokenHeader, string token = null, int timeout = -1)
{
var restRequest = new RestRequest(Method.POST);
restRequest.AddHeader(tokenHeader, token);
restRequest.AddHeader("Accept", "application/json");
restRequest.AddParameter("application/json", payload, ParameterType.RequestBody);
restRequest.Timeout = timeout;
return restRequest;
}
public RestRequest CreateFileRequest(string[] files, Dictionary<string, object> parameter = null, string tokenHeader = tokenHeader, string token = null, int timeout = -1)
{
var restRequest = new RestRequest(Method.POST);
restRequest.AddHeader(tokenHeader, token);
if (files != null && files.Any(t => !string.IsNullOrEmpty(t)))
{
int i = 1;
foreach (var file in files.Where(t => !string.IsNullOrEmpty(t)))
{
restRequest.AddFile(i.ToString(), file);
i++;
}
}
if (parameter != null)
{
foreach (var item in parameter)
{
restRequest.AddParameter(item.Key, item.Value);
}
}
restRequest.Timeout = timeout;
return restRequest;
}
public RestRequest CreatePutRequest(string payload, string tokenHeader = tokenHeader, string token = null, int timeout = -1)
{
var restRequest = new RestRequest(Method.PUT);
restRequest.AddHeader(tokenHeader, token);
restRequest.AddHeader("Accept", "application/json");
restRequest.AddParameter("application/json", payload, ParameterType.RequestBody);
restRequest.Timeout = timeout;
return restRequest;
}
public RestRequest CreateDeleteRequest(string tokenHeader = tokenHeader, string token = null, int timeout = -1)
{
var restRequest = new RestRequest(Method.DELETE);
restRequest.AddHeader(tokenHeader, token);
restRequest.AddHeader("Accept", "application/json");
restRequest.Timeout = timeout;
return restRequest;
}
public IRestResponse GetResponse(RestClient client, RestRequest request)
{
return client.Execute(request);
}
public async Task<IRestResponse> GetResponseAsync(RestClient client, RestRequest request)
{
return await client.ExecuteAsync(request);
}
public DTO GetContent<DTO>(IRestResponse response)
{
var content = response.Content;
DTO dtoObject = JsonHelper.Deserialize<DTO>(content);
return dtoObject;
}
}
}
......@@ -28,6 +28,8 @@ public int DeleteData(int allotId)
"im_employee_logistics",
"im_header",
"im_specialunit",
"log_check",
"per_employee",
"per_sheet",
"res_account",
"res_accountdoctor",
......@@ -35,7 +37,13 @@ public int DeleteData(int allotId)
"res_baiscnorm",
"res_compute",
"res_specialunit",
"log_check",
"report_allot_crowd",
"report_allot_summary",
"report_original_income",
"report_original_persontime",
"report_original_stays",
"report_original_surgery",
"report_original_workload",
};
string sql = "";
tableArray.ForEach(t => sql += $"delete from {t} where allotid=@allotId;");
......@@ -68,21 +76,22 @@ public int DeleteAllotData(int allotId)
"im_employee_logistics",
"im_header",
"im_specialunit",
"per_sheet",
"res_account",
"res_accountdoctor",
"res_accountnurse",
"res_baiscnorm",
"res_compute",
"res_specialunit",
"log_check",
"per_employee",
"per_sheet",
"report_allot_crowd",
"report_allot_summary",
"report_original_income",
"report_original_persontime",
"report_original_stays",
"report_original_surgery",
"report_original_workload",
"res_account",
"res_accountdoctor",
"res_accountnurse",
"res_baiscnorm",
"res_compute",
"res_specialunit",
};
string sql = "";
tableArray.ForEach(t => sql += $"delete from {t} where allotid=@allotId;");
......@@ -95,13 +104,20 @@ public int DeleteResData(int allotId)
{
List<string> tableArray = new List<string>
{
"log_dbug",
"report_allot_crowd",
"report_allot_summary",
"report_original_income",
"report_original_persontime",
"report_original_stays",
"report_original_surgery",
"report_original_workload",
"res_account",
"res_accountdoctor",
"res_accountnurse",
"res_baiscnorm",
"res_compute",
"res_specialunit",
"log_dbug",
};
string sql = "";
tableArray.ForEach(t => sql += $"delete from {t} where allotid=@allotId;");
......
//-----------------------------------------------------------------------
// <copyright file=" cof_cmi.cs">
// * FileName: cof_cmi.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
////-----------------------------------------------------------------------
//// <copyright file=" cof_cmi.cs">
//// * FileName: cof_cmi.cs
//// </copyright>
////-----------------------------------------------------------------------
//using System;
//using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// cof_cmi Repository
/// </summary>
public partial class PerforCofcmiRepository : PerforRepository<cof_cmi>
{
public PerforCofcmiRepository(PerformanceDbContext context) : base(context)
{
}
}
}
//namespace Performance.Repository
//{
// /// <summary>
// /// cof_cmi Repository
// /// </summary>
// public partial class PerforCofcmiRepository : PerforRepository<cof_cmi>
// {
// public PerforCofcmiRepository(PerformanceDbContext context) : base(context)
// {
// }
// }
//}
//-----------------------------------------------------------------------
// <copyright file=" cof_drugprop.cs">
// * FileName: cof_drugprop.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
////-----------------------------------------------------------------------
//// <copyright file=" cof_drugprop.cs">
//// * FileName: cof_drugprop.cs
//// </copyright>
////-----------------------------------------------------------------------
//using System;
//using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// cof_drugprop Repository
/// </summary>
public partial class PerforCofdrugpropRepository : PerforRepository<cof_drugprop>
{
public PerforCofdrugpropRepository(PerformanceDbContext context) : base(context)
{
}
}
}
//namespace Performance.Repository
//{
// /// <summary>
// /// cof_drugprop Repository
// /// </summary>
// public partial class PerforCofdrugpropRepository : PerforRepository<cof_drugprop>
// {
// public PerforCofdrugpropRepository(PerformanceDbContext context) : base(context)
// {
// }
// }
//}
......@@ -9,6 +9,7 @@
using Performance.Infrastructure;
using Performance.Repository;
using Performance.Services.AllotCompute;
using Performance.Services.ExtractExcelService;
using System;
using System.Collections.Generic;
using System.IO;
......@@ -32,6 +33,9 @@ public class AllotService : IAutoInjection
private PerforPerallotRepository _allotRepository;
private IEmailService emailService;
private readonly IOptions<Application> options;
private readonly ComputeDirector _computeDirector;
private readonly PerforRescomputeRepository _perforRescomputeRepository;
private readonly PerforImemployeeRepository _perforImEmployeeRepository;
private PerforPeragainallotRepository _againallotRepository;
private PerforLogcheckRepository perforLogcheckRepository;
private readonly PerforHospitalRepository perforHospitalRepository;
......@@ -59,6 +63,9 @@ public class AllotService : IAutoInjection
IHostingEnvironment evn, ILogger<AllotService> logger,
IEmailService emailService,
IOptions<Application> options,
ComputeDirector computeDirector,
PerforRescomputeRepository perforRescomputeRepository,
PerforImemployeeRepository perforImEmployeeRepository,
PerforPeragainallotRepository againallotRepository,
PerforLogcheckRepository perforLogcheckRepository,
PerforHospitalRepository perforHospitalRepository,
......@@ -83,6 +90,9 @@ public class AllotService : IAutoInjection
this.resultComputeService = resultComputeService;
this.emailService = emailService;
this.options = options;
_computeDirector = computeDirector;
_perforRescomputeRepository = perforRescomputeRepository;
_perforImEmployeeRepository = perforImEmployeeRepository;
this.configService = configService;
this.logdbug = logdbug;
this.perforresreservedRepository = perforresreservedRepository;
......@@ -314,6 +324,8 @@ public void Generate(per_allot allot, string mail)
logManageService.WriteMsg("绩效开始执行", $"数据来源:用户上传的Excel。", 1, allot.ID, "ReceiveMessage", true);
configService.Clear(allot.ID);
// 关闭筛选功能
ExtractHelper.CloseAutoFilter(allot.Path);
// 导出数据
excel = importDataService.ReadDataAndSave(allot);
......@@ -451,6 +463,45 @@ public void Generate(per_allot allot, string mail)
}
/// <summary>
/// 重新计算院领导绩效
/// </summary>
/// <param name="allotId"></param>
/// <param name="money"></param>
public void Recalculation(int allotId, decimal money)
{
var allot = _allotRepository.GetEntity(w => w.ID == allotId);
var empolyeeList = _perforImEmployeeRepository.GetEntities(t => t.AllotID == allotId && t.AccountType == AccountUnitType.行政高层.ToString());
if (empolyeeList == null) return;
var computeEmployees = Mapper.Map<List<ComputeEmployee>>(empolyeeList);
computeEmployees.ForEach(w => w.FitPeopleValue = money);
List<res_baiscnorm> baiscnormList = new List<res_baiscnorm>();
var computResult = _computeDirector.Compute(computeEmployees, allot, baiscnormList);
if (computResult == null) return;
baiscnormList = baiscNormService.ComputeOtherAvg(baiscnormList, computResult, empolyeeList);
baiscnormList.ForEach(t => t.AllotID = allot.ID);
var historyRescompute = _perforRescomputeRepository.GetEntities(w => w.AllotID == allotId && w.AccountType == AccountUnitType.行政高层.ToString());
if (historyRescompute != null && historyRescompute.Any())
_perforRescomputeRepository.RemoveRange(historyRescompute.ToArray());
var computes = Mapper.Map<List<res_compute>>(computResult);
computes.ForEach(t => t.AllotID = allot.ID);
_perforRescomputeRepository.AddRange(computes.ToArray());
var names = baiscnormList.Select(b => b.PositionName).ToList();
var historyResbaiscnorm = perforResbaiscnormRepository.GetEntities(w => w.AllotID == allotId && names.Contains(w.PositionName));
if (historyResbaiscnorm != null && historyResbaiscnorm.Any())
perforResbaiscnormRepository.RemoveRange(historyResbaiscnorm.ToArray());
perforResbaiscnormRepository.AddRange(Mapper.Map<res_baiscnorm[]>(baiscnormList));
}
/// <summary>
/// 发送邮件
/// </summary>
/// <param name="allot"></param>
......
......@@ -78,8 +78,13 @@ public bool SaveBudgetData(int mainYear, List<BudgetResponse> request, int userI
if (amounts != null && perbudgetamountRepository.AddRange(amounts.ToArray()))
{
var ratios = Mapper.Map<List<per_budget_ratio>>(request.Where(t => t.Type == 2));
var budgetData = request.FirstOrDefault(t => t.Type == 2);
ratios.ForEach(t =>
{
t.HospitalRevenue = budgetData?.HospitalRevenue;
t.MeritPayIncrement = budgetData?.MeritPayIncrement;
t.TheDrugIncomeBudget = budgetData?.TheDrugIncomeBudget;
t.MaterialIncomeBudget = budgetData?.MaterialIncomeBudget;
t.MainYear = mainYear;
t.CreateTime = DateTime.Now;
t.CreateUser = userId;
......@@ -136,19 +141,20 @@ public bool ModifyBudgetData(List<BudgetResponse> request)
foreach (var item in ratios)
{
var data = request.FirstOrDefault(t => t.Type == 2 && t.Id == item.Id);
var budgetData = request.FirstOrDefault(t => t.Type == 2);
if (data == null) continue;
item.HospitalRevenue = data.HospitalRevenue;
item.HospitalRevenue = data.HospitalRevenue == 0 ? budgetData?.HospitalRevenue:data.HospitalRevenue;
item.TotalLaborCost = data.TotalLaborCost;
item.StaffSpendingFixed = data.StaffSpendingFixed;
item.StaffSpendingBonus = data.StaffSpendingBonus;
item.MeritPayIncrement = data.MeritPayIncrement;
item.MeritPayIncrement = data.MeritPayIncrement==0?budgetData?.MeritPayIncrement:data.MeritPayIncrement;
item.TotalMeritPay = data.TotalMeritPay;
item.Amplification = data.Amplification;
item.IncrementCapitaRatio = data.IncrementCapitaRatio;
item.TheDrugIncome = data.TheDrugIncome;
item.TheDrugIncomeBudget = data.TheDrugIncomeBudget;
item.TheDrugIncomeBudget = data.TheDrugIncomeBudget==0?budgetData?.TheDrugIncomeBudget:data.TheDrugIncomeBudget;
item.MaterialIncome = data.MaterialIncome;
item.MaterialIncomeBudget = data.MaterialIncomeBudget;
item.MaterialIncomeBudget = data.MaterialIncomeBudget==0?budgetData?.MaterialIncomeBudget:data.MaterialIncomeBudget;
item.TheCostInTotal = data.TheCostInTotal;
item.DepreOfFixedAssets = data.DepreOfFixedAssets;
item.AmortOfIntangibleAssets = data.AmortOfIntangibleAssets;
......
using AutoMapper;
using NPOI.SS.Formula.Functions;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Infrastructure;
......@@ -7,7 +6,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Performance.Services
......@@ -28,7 +26,6 @@ public class ComputeService : IAutoInjection
private readonly PerforPerallotRepository perforPerallotRepository;
private readonly PerforHospitalRepository hospitalRepository;
private readonly PerforPerapramountRepository perapramountRepository;
private readonly PerforCofcmiRepository cofcmiRepository;
private readonly PerforPeremployeeRepository perforPeremployeeRepository;
private readonly PerforCofworkitemRepository cofworkitemRepository;
......@@ -46,7 +43,6 @@ public class ComputeService : IAutoInjection
PerforPerallotRepository perforPerallotRepository,
PerforHospitalRepository hospitalRepository,
PerforPerapramountRepository perapramountRepository,
PerforCofcmiRepository cofcmiRepository,
PerforPeremployeeRepository perforPeremployeeRepository,
PerforCofworkitemRepository cofworkitemRepository)
{
......@@ -64,7 +60,6 @@ public class ComputeService : IAutoInjection
this.perforPerallotRepository = perforPerallotRepository;
this.hospitalRepository = hospitalRepository;
this.perapramountRepository = perapramountRepository;
this.cofcmiRepository = cofcmiRepository;
this.perforPeremployeeRepository = perforPeremployeeRepository;
this.cofworkitemRepository = cofworkitemRepository;
}
......@@ -763,7 +758,7 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
{
(int)SheetType.Income, (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload,
(int)SheetType.AccountExtra,(int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess, (int)SheetType.AccountScoreAverage,
(int)SheetType.AccountAdjustLaterOtherFee, (int)SheetType.BudgetRatio, (int)SheetType.AssessBeforeOtherFee
(int)SheetType.AccountAdjustLaterOtherFee, (int)SheetType.BudgetRatio, (int)SheetType.AssessBeforeOtherFee,
};
int groupbasis = 1; string single = "";
......@@ -791,15 +786,20 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
continue;
var workitems = cofworkitemRepository.GetEntities(t => t.AllotID == account.AllotID);
var allotCmi = cofcmiRepository.GetEntity(t => t.AllotId == account.AllotID && t.UnitType == account.UnitType && t.AccountingUnit == account.AccountingUnit);
//var allotCmi = cofcmiRepository.GetEntity(t => t.AllotId == account.AllotID && t.UnitType == account.UnitType && t.AccountingUnit == account.AccountingUnit);
var medicineFactor = GetFactors(persheet, basicData, type, SheetType.WorkloadMedicineProp);
var cmiFactor = GetFactors(persheet, basicData, type, SheetType.WorkloadCMI);
var inclineFactor = GetFactors(persheet, basicData, type, SheetType.WorkloadIncline);
foreach (var dto in items)
{
if (workitems != null && workitems.Any(a => a.Type == 1 && a.Item == dto.ItemName))
dto.MediFactor = account.MedicineFactor;
if (workitems != null && workitems.Any(a => a.Type == 2 && a.Item == dto.ItemName) && allotCmi != null)
dto.CMIFactor = allotCmi.Value;
dto.ItemValue = dto.ItemValue * (dto.MediFactor ?? 1) * (dto.CMIFactor ?? 1);
if (workitems != null && workitems.Any(a => a.Type == 1 && a.Item == dto.ItemName) && medicineFactor != null)
dto.MediFactor = medicineFactor;
if (workitems != null && workitems.Any(a => a.Type == 2 && a.Item == dto.ItemName) && cmiFactor != null)
dto.CMIFactor = cmiFactor;
if (workitems != null && workitems.Any(a => a.Type == 3 && a.Item == dto.ItemName) && inclineFactor != null)
dto.InclineFactor = inclineFactor;
dto.ItemValue = dto.ItemValue * (dto.MediFactor ?? 1) * (dto.CMIFactor ?? 1) * (dto.InclineFactor ?? 1);
}
}
......@@ -818,6 +818,14 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
//return deptDetails;
}
private decimal? GetFactors(List<per_sheet> persheet, List<im_data> basicData, UnitType type, SheetType sheetType)
{
var sheet = persheet.FirstOrDefault(w => w.SheetType == (int)sheetType);
if (sheet == null)
return null;
return basicData.FirstOrDefault(t => t.SheetID == sheet.ID && t.UnitType == (int)type && t.IsTotal == 1)?.CellValue;
}
private (int sheettype, decimal amount) ClinicDepartmentDetail(List<per_sheet> persheet, res_account account, List<im_data> basicData, per_sheet sheet, UnitType type, string sheetName)
{
var sheettype = 1;
......@@ -879,7 +887,7 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
SheetType[] pairs = new SheetType[]
{
SheetType.AccountExtra, SheetType.AccountDrugAssess, SheetType.AccountMaterialsAssess, SheetType.AccountScoreAverage, SheetType.AccountAdjustLaterOtherFee,
SheetType.AssessBeforeOtherFee, SheetType.BudgetRatio
SheetType.AssessBeforeOtherFee, SheetType.BudgetRatio,
};
if (pairs.Contains((SheetType)sheet.SheetType))
{
......@@ -993,6 +1001,7 @@ private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details
Factor = t.Factor,
MediFactor = t.MediFactor,
CMIFactor = t.CMIFactor,
InclineFactor = t.InclineFactor,
}).ToList();
}
}
......
......@@ -107,7 +107,7 @@ public SecondResponse GetSecondDetails(int userId, int secondId, int hospitalId,
SupplyHeaderByWorkItem(hospitalId, result, secondAllot, savedDataList);
result.HeadItems = result.HeadItems.OrderBy(t => t.Type).ThenBy(t => t.WorkType).ThenBy(t => t.Sort).ThenBy(t => t.FiledName).ToList();
result.BodyItems = result.BodyItems.OrderBy(t => t.RowNumber).ThenBy(t => t.Type).ThenBy(t => t.Sort).ToList();
result.BodyItems = result.BodyItems.OrderBy(t => t.RowNumber).ToList();
return result;
}
......@@ -565,7 +565,58 @@ private void SupplyHeaderByWorkItem(int hospitalId, SecondResponse result, ag_se
#region 其他模板详情
public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int isArchive, int employeeSource)
public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, int employeeSource, out decimal? realAmount)
{
var result = new HandsonTable((int)SheetType.Unidentifiable, OtherTemp.Select(t => t.Value).ToArray(), OtherTemp.Select(t => new collect_permission
{
HeadName = t.Value,
Visible = 1,
Readnoly = new string[] { "可分配绩效", "医院其他绩效", "预留比例", "预留金额", "实发绩效工资金额" }.Contains(t.Value) ? 1 : 0
}).ToList());
string[] workNumbers = new string[] { };
var details = GetOtherTempDetails(userId, secondId, isArchive, employeeSource, ref workNumbers);
if (result.Columns != null && result.Columns.Any())
{
foreach (var column in result.Columns)
{
if (column.Data == "工号")
{
column.Type = "autocomplete";
column.Source = workNumbers;
column.Strict = true;
}
}
}
realAmount = details?.Sum(t => t.RealAmount);
if (details == null || !details.Any()) return result;
details.ForEach(t =>
{
if (!t.OtherPerformance.HasValue) t.OtherPerformance = 0;
});
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 1;
foreach (var item in details)
{
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in OtherTemp
join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList();
cells.Add(new HandsonCellData(nameof(ag_othersource.Id), item.Id));
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
result.SetRowData(rowDatas, rowDatas != null);
return result;
}
public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int isArchive, int employeeSource, ref string[] workNumbers)
{
var secondAllot = agsecondallotRepository.GetEntity(t => t.Id == secondId);
if (secondAllot == null) throw new PerformanceException("二次绩效信息无效!");
......@@ -598,21 +649,22 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
// 如果已经保存>>走保存加载逻辑
if (employeeSource == (int)EmployeeSource.Initial)
{
result = savedDataList.OrderBy(t => t.Id).ToList();
result = savedDataList.OrderBy(t => t.WorkNumber).ToList();
}
// 如果没保存>>走加载im_employee_logistics人员名单逻辑
else
{
var types = new string[] { "行政后勤", "行政工勤" };
var logistics = _imemployeelogisticsRepository.GetEntities(w => w.AllotID == secondAllot.AllotId && types.Contains(w.AccountType) && w.AccountingUnit == secondAllot.Department);
result = (logistics ?? new List<im_employee_logistics>()).Select(w => new ag_othersource
{
SecondId = secondId,
WorkNumber = w.PersonnelNumber,
Name = w.DoctorName,
Department = w.AccountingUnit,
WorkPost = w.JobTitle,
}).ToDistinct().ToList();
result = (logistics ?? new List<im_employee_logistics>())
.OrderBy(t => Convert.ToInt32(t.PersonnelNumber)).Select(w => new ag_othersource
{
SecondId = secondId,
WorkNumber = w.PersonnelNumber,
Name = w.DoctorName,
Department = w.AccountingUnit,
WorkPost = w.JobTitle,
}).ToDistinct().ToList();
}
}
//非行政科室 有三种逻辑,或从保存中加载,或从人员字典加载,或从上次绩效中加载
......@@ -621,12 +673,12 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
switch (employeeSource)
{
case (int)EmployeeSource.Initial:
result = savedDataList.OrderBy(t => t.Id).ToList();
result = savedDataList.OrderBy(t => t.WorkNumber).ToList();
break;
case (int)EmployeeSource.EmployeeDict:
if (employees == null || !employees.Any()) return new List<ag_othersource>();
result = employees.Select(t => new ag_othersource
result = employees.OrderBy(t => t.PersonnelNumber).Select(t => new ag_othersource
{
SecondId = secondId,
WorkNumber = t.PersonnelNumber,
......@@ -641,7 +693,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
isSupplementTitlePerformance = prevSavedDataList == null || !prevSavedDataList.Any();
if (prevSavedDataList != null && prevSavedDataList.Any())
{
result = prevSavedDataList.OrderBy(t => t.Id)
result = prevSavedDataList.OrderBy(t => t.WorkNumber)
.Select(t => new ag_othersource
{
SecondId = secondId,
......@@ -655,6 +707,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
}
}
var originalEmployees = personService.GetPerEmployee(secondAllot.AllotId.Value);
workNumbers = originalEmployees?.Select(t => t.PersonnelNumber).Distinct().ToArray();
SupplementSecondDetail(secondAllot, originalEmployees, result, isSupplementTitlePerformance);
return result;
......@@ -700,8 +753,27 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em
}
}
public static Dictionary<string, string> OtherTemp { get; } = new Dictionary<string, string>
{
{ nameof(ag_othersource.WorkNumber), "工号" },
{ nameof(ag_othersource.Name), "姓名" },
{ nameof(ag_othersource.Department), "科室" },
{ nameof(ag_othersource.WorkPost), "职称" },
{ nameof(ag_othersource.TitlePerformance), "职称绩效" },
{ nameof(ag_othersource.WorkPerformance), "工作量绩效工资" },
{ nameof(ag_othersource.DeptReward), "科室单项奖励" },
{ nameof(ag_othersource.DistPerformance), "可分配绩效" },
{ nameof(ag_othersource.OtherPerformance), "医院其他绩效" },
{ nameof(ag_othersource.NightWorkPerformance), "夜班工作量绩效" },
{ nameof(ag_othersource.ReservedRatio), "预留比例" },
{ nameof(ag_othersource.ReservedAmount), "预留金额" },
{ nameof(ag_othersource.RealAmount), "实发绩效工资金额" },
};
#endregion 其他模板详情
#region Common
/// <summary>
/// 获取上一次的二次绩效
/// </summary>
......@@ -724,6 +796,8 @@ private ag_secondallot GetPreviousSecondAllot(int hospitalId, ag_secondallot sec
var prevSecondAllot = agsecondallotRepository.GetEntity(w => w.AllotId == prevAllot.ID && w.UnitType == secondAllot.UnitType && w.Department == secondAllot.Department);
return prevSecondAllot;
}
#endregion Common
}
/// <summary>
......
......@@ -516,17 +516,15 @@ public void ImpoerAprEmployees(int allotid, string path, int userid)
var sheet = workbook.GetSheetAt(0);
var firstRow = sheet.GetRow(0);
List<(string, int)> excelheader = new List<(string, int)>();
Dictionary<int, string> excelheader = new Dictionary<int, string>();
for (int cellindex = 0; cellindex < firstRow.LastCellNum + 1; cellindex++)
{
var cell = firstRow.GetCell(cellindex);
if (cell == null) continue;
if (!string.IsNullOrEmpty(cell.ToString()))
excelheader.Add((cell.ToString(), cellindex));
var value = firstRow.GetCell(cellindex).GetValue();
if (!string.IsNullOrEmpty(value) && !excelheader.ContainsKey(cellindex))
excelheader.Add(cellindex, value);
}
if (excelheader == null || !excelheader.Any())
if (excelheader == null || excelheader.Count == 0)
throw new PerformanceException("上传excel内容错误");
Dictionary<string, int> dict = new Dictionary<string, int>
......@@ -534,16 +532,12 @@ public void ImpoerAprEmployees(int allotid, string path, int userid)
{ "录入科室", -1 },{ "核算单元", -1 },{ "人员工号", -1 }, { "姓名", -1 }, { "绩效类型", -1 }, { "金额", -1 },
};
List<string> errorHeaders = new List<string>();
foreach (var key in dict.Keys.ToList())
{
if (!excelheader.Select(t => t.Item1).Contains(key)) errorHeaders.Add(key);
else dict[key] = excelheader.First(t => t.Item1 == key).Item2;
if (excelheader.Any(w => w.Value == key))
dict[key] = excelheader.First(w => w.Value == key).Key;
}
if (errorHeaders != null && errorHeaders.Any())
throw new PerformanceException($"excel缺少列{string.Join(", ", errorHeaders)}");
var entities = new List<per_apr_amount>();
var createtime = DateTime.Now;
......@@ -555,19 +549,40 @@ public void ImpoerAprEmployees(int allotid, string path, int userid)
var entity = new per_apr_amount
{
Status = 2,
PersonnelNumber = row.GetCell(dict["人员工号"]).GetValue(),
DoctorName = row.GetCell(dict["姓名"]).GetValue(),
PerforType = row.GetCell(dict["绩效类型"]).GetValue(),
Amount = ConvertHelper.To<decimal>(row.GetCell(dict["金额"]).GetValue(), 0),
TypeInDepartment = row.GetCell(dict["录入科室"]).GetValue(),
AccountingUnit = row.GetCell(dict["核算单元"]).GetValue(),
PersonnelNumber = dict["人员工号"] < 0 ? "" : row.GetCell(dict["人员工号"]).GetValue(),
DoctorName = dict["姓名"] < 0 ? "" : row.GetCell(dict["姓名"]).GetValue(),
PerforType = dict["绩效类型"] < 0 ? "" : row.GetCell(dict["绩效类型"]).GetValue(),
Amount = dict["金额"] < 0 ? 0 : ConvertHelper.To<decimal>(row.GetCell(dict["金额"]).GetValue(), 0),
TypeInDepartment = dict["录入科室"] < 0 ? "" : row.GetCell(dict["录入科室"]).GetValue(),
AccountingUnit = dict["核算单元"] < 0 ? "" : row.GetCell(dict["核算单元"]).GetValue(),
AllotId = allotid,
CreateDate = createtime,
CreateUser = userid,
};
entities.Add(entity);
}
perapramountRepository.AddRange(entities.ToArray());
// 补充核算单元
if (entities.Any())
{
if (entities.Any(w => string.IsNullOrEmpty(w.PersonnelNumber) && w.Amount != 0))
throw new PerformanceException("文件中存在“工号”为空的数据");
if (entities.Any(w => string.IsNullOrEmpty(w.PerforType) && w.Amount != 0))
throw new PerformanceException("文件中存在“绩效类型”为空的数据");
if (entities.Any(w => string.IsNullOrEmpty(w.TypeInDepartment) && w.Amount != 0))
throw new PerformanceException("文件中存在“录入科室”为空的数据");
var employees = peremployeeRepository.GetEntities(w => w.AllotId == allotid);
foreach (var item in entities.Where(w => !string.IsNullOrEmpty(w.PersonnelNumber) && !string.IsNullOrEmpty(w.AccountingUnit)))
{
item.AccountingUnit = employees?.FirstOrDefault(w => w.PersonnelNumber == item.PersonnelNumber)?.AccountingUnit ?? "";
}
perapramountRepository.AddRange(entities.ToArray());
}
}
catch (PerformanceException ex)
{
throw ex;
}
catch (Exception ex)
{
......
using Dapper;
using Microsoft.Extensions.Logging;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Performance.Services.ExtractExcelService
{
public class DictionaryService : IAutoInjection
{
private readonly ILogger<DictionaryService> logger;
private readonly QueryService queryService;
private readonly LogManageService logService;
private readonly PerforPeremployeeRepository peremployeeRepository;
private readonly PerforHospitalconfigRepository hospitalconfigRepository;
private readonly PerforExtypeRepository extypeRepository;
private readonly PerforExscriptRepository exscriptRepository;
public DictionaryService(
ILogger<DictionaryService> logger,
QueryService queryService,
LogManageService logService,
PerforPeremployeeRepository peremployeeRepository,
PerforHospitalconfigRepository hospitalconfigRepository,
PerforExtypeRepository extypeRepository,
PerforExscriptRepository exscriptRepository
)
{
this.logger = logger;
this.queryService = queryService;
this.logService = logService;
this.peremployeeRepository = peremployeeRepository;
this.hospitalconfigRepository = hospitalconfigRepository;
this.extypeRepository = extypeRepository;
this.exscriptRepository = exscriptRepository;
}
public void Handler(int hospitalId, per_allot allot, string groupName, bool isSingle)
{
try
{
var configs = hospitalconfigRepository.GetEntities(t => t.HospitalId == hospitalId);
if (configs == null || !configs.Any()) throw new Exception("医院未配置绩效抽取信息");
var types = extypeRepository.GetEntities(t => t.HospitalId == hospitalId && new int[] { 2 }.Contains(t.Source));
if (types == null || !types.Any()) return;
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取人员信息数据", isSingle: isSingle);
var scripts = exscriptRepository.GetEntities(t => types.Select(s => s.Id).Contains(t.TypeId) && t.IsEnable == 1);
if (scripts != null && scripts.Any())
{
if (types.Any(t => t.Source == (int)SheetType.Employee)) //人员字典抽取配置
{
var typeIds = types.Where(t => t.Source == (int)SheetType.Employee).Select(t => t.Id);
var script = scripts.FirstOrDefault(t => typeIds.Contains(t.TypeId));
if (script == null) return;
Employee(allot, configs.FirstOrDefault(t => t.Id == script.ConfigId), script.ExecScript);
}
}
}
catch (Exception ex)
{
logger.LogError("获取数据时发生异常");
throw ex;
}
}
private void Employee(per_allot allot, sys_hospitalconfig config, string sql)
{
try
{
if (config == null || string.IsNullOrEmpty(sql)) return;
var data = queryService.QueryData<per_employee>(config, allot, sql);
if (data == null || !data.Any()) return;
var employees = peremployeeRepository.GetEntities(t => t.AllotId == allot.ID);
if (employees != null && employees.Any())
{
peremployeeRepository.RemoveRange(employees.ToArray());
}
peremployeeRepository.AddRange(data.ToArray());
}
catch (Exception ex)
{
logger.LogError("获取人员名单时发生异常:" + ex.ToString());
}
}
private void Department()
{
}
}
}
using NPOI.SS.UserModel;
using OfficeOpenXml;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Infrastructure;
......@@ -17,6 +18,7 @@ public static string GetExtractFile(int hospitalId, ref string newFilePath, stri
string originalPath = string.IsNullOrEmpty(allotFilePath)
? Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Template", "医院绩效模板.xls")
: allotFilePath;
CloseAutoFilter(originalPath);
var (tempPath, filePath) = CopyOriginalFile(hospitalId, originalPath);
newFilePath = filePath;
return tempPath;
......@@ -36,7 +38,7 @@ private static (string TempPath, string FilePath) CopyOriginalFile(int hospitalI
FileHelper.CreateDirectory(dpath);
string tempPath = Path.Combine(dpath, $"Template{DateTime.Now.ToString("yyyyMMddHHmmssfff")}{ext}");
FileHelper.Copy(originalPath, tempPath);
string filePath = Path.Combine(dpath, $"绩效提取数据{DateTime.Now.ToString("yyyyMMddHHmmssfff")}{ext}");
string filePath = Path.Combine(dpath, $"绩效提取数据{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.xls");
return (tempPath, filePath);
}
......@@ -66,7 +68,8 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
}
}
foreach (var module in modulesList.Where(t => t.SheetType == (int)SheetType.OtherWorkload)?.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 sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank());
if (sheet == null)
......@@ -78,6 +81,9 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
var copysheet = workbook.GetSheet(item.Key);
var newSheet = copysheet.CopySheet(module.ModuleName, true);
workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
var point = PerSheetDataFactory.GetDataRead(SheetType.Workload)?.Point;
ClearSheetTemplate(newSheet, point, (SheetType)module.SheetType);
//}
}
}
......@@ -108,5 +114,64 @@ public static void ClearSheetPartialData(ISheet sheet, PerSheetPoint point, Shee
}
}
}
public static void ClearSheetTemplate(ISheet sheet, PerSheetPoint point, SheetType sheetType)
{
if (sheet == null)
return;
for (int i = point.HeaderFirstRowNum.Value; i < sheet.LastRowNum + 1; i++)
{
var row = sheet.GetRow(i);
if (row != null)
{
row.ZeroHeight = false; //取消隐藏行
int dataFirstCellRowNum = point.DataFirstCellNum.Value;
//跳过核算单元和科室
for (int j = dataFirstCellRowNum; j < row.LastCellNum; j++)
{
var cell = row.GetCell(j);
if (cell != null)
{
cell.RemoveCellComment(); //删除批注
row.RemoveCell(cell);
}
}
}
}
if (!new SheetType[] { SheetType.Workload, SheetType.OtherWorkload }.Contains(sheetType))
{
var row = sheet.GetRow(0);
if (row != null) sheet.RemoveRow(row);
sheet.ShiftRows(point.DataFirstRowNum.Value, sheet.LastRowNum + 1, -1);
}
}
public static void CloseAutoFilter(string path)
{
try
{
var fileInfo = new FileInfo(path);
using (ExcelPackage package = new ExcelPackage(fileInfo))
{
ExcelWorkbook workbook = package.Workbook;
if (workbook == null) return;
foreach (var sheet in workbook.Worksheets)
{
if (sheet.AutoFilterAddress != null)
{
sheet.Cells[sheet.AutoFilterAddress.Address].AutoFilter = false;
}
}
package.Save();
}
}
catch (Exception ex)
{
}
}
}
}
......@@ -34,17 +34,18 @@ public static void WriteSheetHeader(ISheet sheet, PerSheetPoint point, SheetType
// 去除excel中已存在的列
int headerFirstCellNum = point.DataFirstCellNum.Value;
if (columnHeader.LastCellNum > point.DataFirstCellNum)
if (columnHeader.LastCellNum > point.DataFirstCellNum.Value)
{
for (int index = headerFirstCellNum; index < columnHeader.LastCellNum; index++)
for (int index = point.DataFirstCellNum.Value; index < columnHeader.LastCellNum; index++)
{
var column = columnHeader.GetCell(index).GetDecodeEscapes();
if (string.IsNullOrEmpty(column)) continue;
if (index > headerFirstCellNum) headerFirstCellNum = index;
columns.RemoveAll(t => t.ColumnName.NoBlank() == column);
if (index > headerFirstCellNum)
headerFirstCellNum = index + 1;
}
if (headerFirstCellNum > point.DataFirstCellNum.Value)
headerFirstCellNum += 1;
}
if (columns == null || !columns.Any()) return;
......@@ -53,7 +54,6 @@ public static void WriteSheetHeader(ISheet sheet, PerSheetPoint point, SheetType
: style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.系数, CellFormat.百分比);
var columnStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.列头);
headerFirstCellNum += 1;
// 补充excel中不存在的列
foreach (var item in columns)
{
......@@ -111,7 +111,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
int dataFirstCellNum = point.DataFirstCellNum.Value;
for (int rowIndex = dataFirstRowNum; rowIndex < sheet.LastRowNum + 1; rowIndex++)
for (int rowIndex = point.DataFirstRowNum.Value; rowIndex < sheet.LastRowNum + 1; rowIndex++)
{
var row = sheet.GetRow(rowIndex);
if (row == null) continue;
......@@ -119,6 +119,8 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes();
if (string.IsNullOrEmpty(department)) continue;
if (rowIndex > dataFirstRowNum) dataFirstRowNum = rowIndex;
var deptData = data.Where(t => t.Department == department);
if (deptData == null || !deptData.Any()) continue;
......@@ -146,8 +148,8 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
}
data.RemoveAll(t => t.Department == department);
if (rowIndex > dataFirstRowNum) dataFirstRowNum = rowIndex + 1;
}
dataFirstRowNum += 1;
}
private static void WriteSheetDataNonexistent(ISheet sheet, IRow columnHeader, PerSheetPoint point, SheetType sheetType, ExcelStyle style,
......@@ -166,7 +168,6 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
headers = headers.Select(t => t.NoBlank()).ToList();
dataFirstRowNum += 1;
foreach (string department in departments)
{
var deptData = data.Where(t => t.Department == department);
......@@ -266,7 +267,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
int dataFirstCellNum = point.DataFirstCellNum.Value;
for (int rowIndex = dataFirstRowNum; rowIndex < sheet.LastRowNum + 1; rowIndex++)
for (int rowIndex = point.DataFirstRowNum.Value; rowIndex < sheet.LastRowNum + 1; rowIndex++)
{
var row = sheet.GetRow(rowIndex);
if (row == null) continue;
......@@ -274,6 +275,8 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes();
if (string.IsNullOrEmpty(department)) continue;
if (rowIndex > dataFirstRowNum) dataFirstRowNum = rowIndex;
var deptData = data.Where(t => t.Department == department);
if (deptData == null || !deptData.Any()) continue;
......@@ -300,8 +303,8 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
}
data.RemoveAll(t => t.Department == department);
if (rowIndex > dataFirstRowNum) dataFirstRowNum = rowIndex + 1;
}
dataFirstRowNum += 1;
}
private static void WriteCollectDataNonexistent(ISheet sheet, IRow columnHeader, PerSheetPoint point, SheetType sheetType, ExcelStyle style,
......@@ -318,7 +321,6 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
headers = headers.Select(t => t.NoBlank()).ToList();
dataFirstRowNum += 1;
foreach (string department in departments)
{
var deptData = data.Where(t => t.Department == department);
......
......@@ -8,7 +8,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace Performance.Services.ExtractExcelService
{
......@@ -19,7 +18,7 @@ public class ExtractService : IAutoInjection
private readonly QueryService queryService;
private readonly PersonService personService;
private readonly PerSheetService perSheetService;
private readonly PerforHospitalRepository hospitalRepository;
private readonly DictionaryService dictionaryService;
private readonly PerforPerallotRepository perallotRepository;
private readonly PerforCollectdataRepository collectdataRepository;
private readonly PerforPeremployeeRepository peremployeeRepository;
......@@ -30,7 +29,7 @@ public class ExtractService : IAutoInjection
QueryService queryService,
PersonService personService,
PerSheetService perSheetService,
PerforHospitalRepository hospitalRepository,
DictionaryService dictionaryService,
PerforPerallotRepository perallotRepository,
PerforCollectdataRepository collectdataRepository,
PerforPeremployeeRepository peremployeeRepository
......@@ -41,7 +40,7 @@ PerforPeremployeeRepository peremployeeRepository
this.queryService = queryService;
this.personService = personService;
this.perSheetService = perSheetService;
this.hospitalRepository = hospitalRepository;
this.dictionaryService = dictionaryService;
this.perallotRepository = perallotRepository;
this.collectdataRepository = collectdataRepository;
this.peremployeeRepository = peremployeeRepository;
......@@ -74,6 +73,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
var dict = new Dictionary<ExDataDict, object>();
logService.ReturnTheLog(allotId, groupName, 3, "", 5, 1, isSingle);
dictionaryService.Handler(hospitalId, allot, groupName, isSingle);
var data = queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict);
var standData = StandDataFormat(hospitalId, data);
......@@ -90,6 +90,8 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
WriteDataToFile(workbook, allotId, dict, standData, groupName, isSingle);
logService.ReturnTheLog(allotId, groupName, 2, "提取完成", $"绩效数据提取成功", 5, isSingle);
workbook.GetCreationHelper().CreateFormulaEvaluator().EvaluateAll(); //实时更新公式的结果
allot.IsExtracting = isSingle ? 2 : 0;
allot.ExtractPath = extractFilePath;
}
......
......@@ -80,7 +80,7 @@ public List<ex_result> Handler(int hospitalId, per_allot allot, string groupName
var data = new List<ex_result>();
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"开始提取数据");
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"开始提取数据", isSingle: isSingle);
var scripts = exscriptRepository.GetEntities(t => extypeIds.Contains(t.TypeId));
if (scripts != null && scripts.Any())
......@@ -367,7 +367,7 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
/// <param name="source"></param>
/// <param name="category"></param>
/// <returns></returns>
private IEnumerable<ExtractDto> QueryData(sys_hospitalconfig config, per_allot allot, string execsql)
public IEnumerable<ExtractDto> QueryData(sys_hospitalconfig config, per_allot allot, string execsql)
{
var parameters = GetParameters(allot);
using (var connection = ConnectionBuilder.Create((DatabaseType)config.DataBaseType, config.DbSource, config.DbName, config.DbUser, config.DbPassword))
......@@ -386,6 +386,33 @@ private IEnumerable<ExtractDto> QueryData(sys_hospitalconfig config, per_allot a
}
/// <summary>
/// 查询数据
/// </summary>
/// <param name="config"></param>
/// <param name="allot"></param>
/// <param name="execsql"></param>
/// <param name="source"></param>
/// <param name="category"></param>
/// <returns></returns>
public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, per_allot allot, string execsql)
{
var parameters = GetParameters(allot);
using (var connection = ConnectionBuilder.Create((DatabaseType)config.DataBaseType, config.DbSource, config.DbName, config.DbUser, config.DbPassword))
{
foreach (var item in parameters)
{
execsql = Regex.Replace(execsql, item.Key, item.Value, RegexOptions.IgnoreCase);
}
logger.LogInformation($"提取绩效数据SQL脚本{execsql}");
var result = connection.Query<T>(execsql, commandTimeout: 20000);
logger.LogInformation($"提取绩效数据执行脚本获取数据{result?.Count() ?? 0}条记录");
return result;
}
}
/// <summary>
/// 获取参数
/// </summary>
/// <param name="allot"></param>
......
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Performance.DtoModels;
using Performance.DtoModels.AppSettings;
using Performance.Infrastructure;
using Performance.Repository;
using System;
using System.Threading.Tasks;
namespace Performance.Services
{
......@@ -28,7 +30,7 @@ public class LogManageService : IAutoInjection
}
/// <summary>
///
///
/// </summary>
/// <param name="tag">标签</param>
/// <param name="message">内容</param>
......@@ -70,7 +72,7 @@ public void ExtractLog(string groupName, string tag, string message, int level)
}
/// <summary>
///
///
/// </summary>
/// <param name="allotId"></param>
/// <param name="groupName"></param>
......@@ -102,8 +104,20 @@ public void ReturnTheLog(int allotId, string groupName, int type, string tag, ob
logdbug.Add(allotId, tag, content, level, type);
if (!isSingle)
{
var http = url.ImportFile + $"/template/returnlog?type={type}&tag={tag}&message={content}&level={level}&groupName={groupName}";
HttpHelper.HttpPost(http);
var http = new RestSharpHelper();
var importUrl = http.SetUrl(url.ImportFile, "/template/returnlog");
var info = new SignalrLogRequest()
{
Type = type,
Tag = tag,
Message = content,
Level = level,
GroupName = groupName
};
string json = JsonHelper.Serialize(info);
var request = http.CreatePostRequest(json);
Task.Run(() => http.GetResponse(importUrl, request));
}
}
catch (Exception ex)
......
......@@ -101,6 +101,16 @@ public static IPerSheetDataRead GetDataRead(SheetType sheetType, bool isnew = fa
case SheetType.PersonPostCoefficient:
dataread = new PerSheetDataReadPersonExtra(); // 个人岗位系数
break;
case SheetType.WorkloadMedicineProp:
dataread = new PerSheetDataReadAccountExtra(); // 药占比系数
break;
case SheetType.WorkloadCMI:
dataread = new PerSheetDataReadAccountExtra(); // CMI系数
break;
case SheetType.WorkloadIncline:
dataread = new PerSheetDataReadAccountExtra(); // 工作量倾斜系数
break;
}
return dataread;
}
......
......@@ -14,14 +14,14 @@ namespace Performance.Services
public class PerSheetService : IAutoInjection
{
private PerHeaderService _perHeader;
private PerforCofdrugpropRepository _perforCofdrugpropRepository;
//private PerforCofdrugpropRepository _perforCofdrugpropRepository;
private PerforCofdrugtypeRepository _perforCofdrugtypeRepository;
public PerSheetService(PerHeaderService perHeader,
PerforCofdrugpropRepository perforCofdrugpropRepository,
//PerforCofdrugpropRepository perforCofdrugpropRepository,
PerforCofdrugtypeRepository perforCofdrugtypeRepository)
{
_perHeader = perHeader;
_perforCofdrugpropRepository = perforCofdrugpropRepository;
//_perforCofdrugpropRepository = perforCofdrugpropRepository;
_perforCofdrugtypeRepository = perforCofdrugtypeRepository;
}
/// <summary>
......@@ -113,6 +113,14 @@ public SheetType GetSheetType(string sheetName)
return SheetType.PersonAdjustLaterOtherManagePerforFee;
else if (sheetName.StartsWith("6.11")) // 个人岗位系数
return SheetType.PersonPostCoefficient;
else if (sheetName.StartsWith("6.12")) // 药占比系数
return SheetType.WorkloadMedicineProp;
else if (sheetName.StartsWith("6.13")) // CMI系数
return SheetType.WorkloadCMI;
else if (sheetName.StartsWith("6.14")) // 工作量倾斜系数
return SheetType.WorkloadIncline;
else if (sheetName.StartsWith("6.1"))
return SheetType.AccountScoreAverage;
else if (sheetName.StartsWith("6.2"))
......
......@@ -84,7 +84,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
var value = group.Sum(s => s.IsFactor ? s.CellValue * s.FactorValue : s.CellValue);
if (header.CellValue == "门急诊工作量")
{
var factor = confs.FirstOrDefault(t => t.AccoutingUnit == group.Key)?.Factor ?? 0;
var factor = confs.FirstOrDefault(t => t.AccountingUnit == group.Key)?.Factor ?? 0;
value = value * factor;
}
......@@ -99,7 +99,8 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
/// </summary>
/// <param name="sheet"></param>
/// <returns></returns>
public (PerSheet Sheet, List<PerData> PerData) TwiceCompute(PerSheet sheet, sys_hospital hospital, List<CofDrugProp> confs = null, List<cof_cmi> cmis = null, List<cof_workitem> workitems = null, bool isDoctor = false)
public (PerSheet Sheet, List<PerData> PerData) TwiceCompute(PerSheet sheet, sys_hospital hospital,
IEnumerable<cof_workitem> workitems, IEnumerable<CofDrugProp> medicineProps, IEnumerable<CofDrugProp> cmis, IEnumerable<CofDrugProp> inclines, bool isDoctor = false)
{
//获取最大列坐标位置
int thiscell = sheet.PerHeader.OrderByDescending(t => t.PointCell).FirstOrDefault().PointCell + 1;
......@@ -115,7 +116,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
{
var ds = group.Select(t =>
{
var (cellvalue, factor) = ComputValue(group, hospital, confs, cmis, workitems, isDoctor);
var cellvalue = ComputValue(group, hospital, workitems, medicineProps, cmis, inclines, isDoctor);
var dto = new PerData
{
......@@ -123,7 +124,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
AccountingUnit = group.Key.AccountingUnit,
//CellValue = group.Sum(s => s.CellValue),
CellValue = cellvalue,
MedicineFactor = factor,
//MedicineFactor = factor,
TypeName = group.Key.UnitType,
RowNumber = group.FirstOrDefault()?.RowNumber ?? 0,
IsTotal = 1,
......@@ -140,45 +141,32 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
return (sheet, perDataList);
}
private (decimal?, decimal?) ComputValue(IGrouping<object, PerData> group, sys_hospital hospital, List<CofDrugProp> confs = null, List<cof_cmi> cmis = null, List<cof_workitem> workitems = null, bool isDoctor = false)
private decimal? ComputValue(IGrouping<object, PerData> group, sys_hospital hospital,
IEnumerable<cof_workitem> workitems, IEnumerable<CofDrugProp> medicineProps, IEnumerable<CofDrugProp> cmis, IEnumerable<CofDrugProp> inclines, bool isDoctor = false)
{
var unittype = isDoctor ? new List<int> { (int)UnitType.医生组, (int)UnitType.医技组, (int)UnitType.专家组, (int)UnitType.其他医生组, (int)UnitType.其他医技组, (int)UnitType.特殊核算组 } : new List<int> { (int)UnitType.护理组, (int)UnitType.其他护理组 };
var unittype = isDoctor
? new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString(), UnitType.专家组.ToString(), UnitType.其他医生组.ToString(), UnitType.其他医技组.ToString(), UnitType.特殊核算组.ToString() }
: new List<string> { UnitType.护理组.ToString(), UnitType.其他护理组.ToString() };
if ((medicineProps == null && cmis == null && inclines == null) || workitems == null)
return group.Sum(s => s.IsFactor ? s.CellValue * s.FactorValue : s.CellValue);
if ((confs == null && cmis == null) || workitems == null)
return (group.Sum(s => s.IsFactor ? s.CellValue * s.FactorValue : s.CellValue), null);
else
{
var factor = hospital.IsOpenDrugprop == 2 ? 1 : (confs?.FirstOrDefault(t => t.AccoutingUnit == group.First().AccountingUnit)?.Factor ?? 1);
var cmifactor = hospital.IsOpenCMIPercent == 2 ? 1 : (cmis?.FirstOrDefault(t => t.AccountingUnit == group.First().AccountingUnit && unittype.Contains(t.UnitType))?.Value ?? 1);
//需要乘系数的项
var fgroup = group.Where(t => workitems.Select(s => s.Item).Contains(t.TypeName));
//需要乘系数的项
var ngroup = group.Where(t => !workitems.Select(s => s.Item).Contains(t.TypeName));
//var value = fgroup.Sum(s => s.IsFactor ? s.CellValue * s.FactorValue : s.CellValue) * factor;
//value += ngroup.Sum(s => s.IsFactor ? s.CellValue * s.FactorValue : s.CellValue);
var value = fgroup.Sum(s =>
{
var cellvalue = s.IsFactor ? s.CellValue * s.FactorValue : s.CellValue;
if (workitems.Any(w => w.Type == 2) && workitems.Where(w => w.Type == 2).Select(q => q.Item).Contains(s.TypeName))
{
cellvalue = cmifactor * cellvalue;
}
return cellvalue;
});
decimal medicinefactor = medicineProps?.FirstOrDefault(t => t.AccountingUnit == group.First().AccountingUnit && unittype.Contains(t.UnitType))?.Factor ?? 1;
decimal cmifactor = cmis?.FirstOrDefault(t => t.AccountingUnit == group.First().AccountingUnit && unittype.Contains(t.UnitType))?.Factor ?? 1;
decimal inclinefactor = inclines?.FirstOrDefault(t => t.AccountingUnit == group.First().AccountingUnit && unittype.Contains(t.UnitType))?.Factor ?? 1;
value += ngroup.Sum(s =>
{
var cellvalue = s.IsFactor ? s.CellValue * s.FactorValue : s.CellValue;
if (workitems.Any(w => w.Type == 1) && workitems.Where(w => w.Type == 1).Select(q => q.Item).Contains(s.TypeName))
{
cellvalue = factor * cellvalue;
}
return cellvalue;
});
return (value, factor);
}
var value = group.Sum(s =>
{
var cellvalue = s.IsFactor ? s.CellValue * s.FactorValue : s.CellValue;
if (workitems.Any(w => w.Type == 3 && w.Item == s.TypeName))
cellvalue = cellvalue * inclinefactor;
if (workitems.Any(w => w.Type == 2 && w.Item == s.TypeName))
cellvalue = cellvalue * cmifactor;
if (workitems.Any(w => w.Type == 1 && w.Item == s.TypeName))
cellvalue = cellvalue * medicinefactor;
return cellvalue;
});
return value;
}
#endregion
}
......
......@@ -13,6 +13,7 @@
<ItemGroup>
<PackageReference Include="CSRedisCore" Version="3.0.45" />
<PackageReference Include="DotNetCore.NPOI" Version="1.2.1" />
<PackageReference Include="EPPlus" Version="4.5.3.2" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" />
</ItemGroup>
......
......@@ -1688,6 +1688,39 @@ public List<ag_othersource> OtherSave(int secondId, List<ag_othersource> request
return perforAgothersourceRepository.GetEntities(t => t.SecondId == secondId);
}
public void OtherSave(int secondId, SaveCollectData collectData)
{
if (collectData.ColHeaders == null || !collectData.ColHeaders.Any()) return;
var parameters = new List<string>();
foreach (var item in collectData.ColHeaders)
{
if (!SecondAllotDetails.OtherTemp.ContainsValue(item)) throw new PerformanceException($"请确认列'{item}'是否正确");
parameters.Add(SecondAllotDetails.OtherTemp.FirstOrDefault(t => t.Value == item).Key);
}
if (parameters == null || !parameters.Any()) return;
List<string> josn = new List<string>();
foreach (var item in collectData.Data)
{
var list = item.ToList();
var itemList = list.Select(t => $"\"{parameters[list.IndexOf(t)]}\":\"{t}\"");
josn.Add($"{{{string.Join(",", itemList)}}}");
}
var data = JsonHelper.Deserialize<List<ag_othersource>>($"[{string.Join(",", josn)}]");
data = data.Where(t => !string.IsNullOrEmpty(t.WorkNumber) || !string.IsNullOrEmpty(t.Name))?.ToList();
if (data == null || !data.Any()) return;
var existEntities = perforAgothersourceRepository.GetEntities(t => t.SecondId == secondId);
if (existEntities != null && existEntities.Any())
{
perforAgothersourceRepository.RemoveRange(existEntities.ToArray());
}
data.ForEach(t => t.SecondId = secondId);
perforAgothersourceRepository.AddRange(data.ToArray());
}
#endregion 二次绩效其他来源
#region 打印
......
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