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 FluentValidation.AspNetCore;
using Hangfire;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Http.Internal;
...@@ -7,7 +6,6 @@ ...@@ -7,7 +6,6 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Services; using Performance.Services;
using Performance.Services.AllotCompute; using Performance.Services.AllotCompute;
...@@ -16,7 +14,6 @@ ...@@ -16,7 +14,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks; using System.Threading.Tasks;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 // 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 ...@@ -27,19 +24,17 @@ namespace Performance.Api.Controllers
public class AllotController : Controller public class AllotController : Controller
{ {
private AllotService _allotService; private AllotService _allotService;
private readonly ResultComputeService resultComputeService; private ResultComputeService _resultComputeService;
private HospitalService _hospitalService;
private ConfigService _configService; private ConfigService _configService;
private IHostingEnvironment _evn; private IHostingEnvironment _evn;
private ILogger<AllotController> _logger; private ILogger<AllotController> _logger;
private ClaimService _claim; private ClaimService _claim;
private readonly LogManageService logManageService; private LogManageService _logManageService;
private IBackgroundTaskQueue _backgroundTaskQueue; private IBackgroundTaskQueue _backgroundTaskQueue;
private IServiceScopeFactory _serviceScopeFactory; private IServiceScopeFactory _serviceScopeFactory;
public AllotController(AllotService allotService, public AllotController(AllotService allotService,
ResultComputeService resultComputeService, ResultComputeService resultComputeService,
HospitalService hospitalService,
ConfigService configService, ConfigService configService,
ILogger<AllotController> logger, ILogger<AllotController> logger,
IHostingEnvironment evn, IHostingEnvironment evn,
...@@ -49,12 +44,11 @@ public class AllotController : Controller ...@@ -49,12 +44,11 @@ public class AllotController : Controller
LogManageService logManageService) LogManageService logManageService)
{ {
_allotService = allotService; _allotService = allotService;
this.resultComputeService = resultComputeService; _resultComputeService = resultComputeService;
_hospitalService = hospitalService;
_logger = logger; _logger = logger;
_evn = evn; _evn = evn;
_claim = claim; _claim = claim;
this.logManageService = logManageService; _logManageService = logManageService;
_configService = configService; _configService = configService;
_backgroundTaskQueue = backgroundTaskQueue; _backgroundTaskQueue = backgroundTaskQueue;
_serviceScopeFactory = serviceScopeFactory; _serviceScopeFactory = serviceScopeFactory;
...@@ -190,7 +184,7 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody] A ...@@ -190,7 +184,7 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody] A
if (allot.States == (int)AllotStates.Wait) if (allot.States == (int)AllotStates.Wait)
return new ApiResponse(ResponseType.OK, "当前绩效正在等待生成"); 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); _allotService.UpdateAllotStates(allot.ID, (int)AllotStates.Wait, EnumHelper.GetDescription(AllotStates.Wait), allot.Generate);
if (_evn.IsEnvironment("Localhost")) if (_evn.IsEnvironment("Localhost"))
{ {
...@@ -211,13 +205,27 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody] A ...@@ -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); //_allotService.Generate(allot, email);
////BackgroundJob.Enqueue(() => _allotService.Generate(allot, email)); ////BackgroundJob.Enqueue(() => _allotService.Generate(allot, email));
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
/// <summary> /// <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> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
...@@ -296,7 +304,7 @@ public ApiResponse Issued([FromBody] AllotRequest request) ...@@ -296,7 +304,7 @@ public ApiResponse Issued([FromBody] AllotRequest request)
throw new PerformanceException("当前绩效记录不存在"); throw new PerformanceException("当前绩效记录不存在");
_allotService.UpdateAllotStates(allot.ID, (int)AllotStates.GenerateSucceed, EnumHelper.GetDescription(AllotStates.GenerateSucceed)); _allotService.UpdateAllotStates(allot.ID, (int)AllotStates.GenerateSucceed, EnumHelper.GetDescription(AllotStates.GenerateSucceed));
// 科室下发 // 科室下发
resultComputeService.GenerateSecondAllot(allot); _resultComputeService.GenerateSecondAllot(allot);
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
......
...@@ -194,58 +194,58 @@ public ConfigController(ConfigService configService, AllotService allotService) ...@@ -194,58 +194,58 @@ public ConfigController(ConfigService configService, AllotService allotService)
#endregion #endregion
#region drugprop #region drugprop
/// <summary> ///// <summary>
/// 获取 药占比配置信息列表 ///// 获取 药占比配置信息列表
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
[Route("drugproplist")] //[Route("drugproplist")]
[HttpPost] //[HttpPost]
public ApiResponse<List<DrugpropResponse>> GetDrugList([CustomizeValidator(RuleSet = "Select"), FromBody] DrugpropRequest request) //public ApiResponse<List<DrugpropResponse>> GetDrugList([CustomizeValidator(RuleSet = "Select"), FromBody] DrugpropRequest request)
{ //{
var list = _configService.GetDrugList(request.AllotID); // var list = _configService.GetDrugList(request.AllotID);
return new ApiResponse<List<DrugpropResponse>>(ResponseType.OK, "ok", list); // return new ApiResponse<List<DrugpropResponse>>(ResponseType.OK, "ok", list);
} //}
/// <summary> ///// <summary>
/// 新增药占比配置 ///// 新增药占比配置
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
[Route("druginsert")] //[Route("druginsert")]
[HttpPost] //[HttpPost]
public ApiResponse<DrugpropResponse> DrugInsert([CustomizeValidator(RuleSet = "Insert"), FromBody] DrugpropRequest request) //public ApiResponse<DrugpropResponse> DrugInsert([CustomizeValidator(RuleSet = "Insert"), FromBody] DrugpropRequest request)
{ //{
var drugprop = _configService.DrugInsert(request); // var drugprop = _configService.DrugInsert(request);
return new ApiResponse<DrugpropResponse>(ResponseType.OK, drugprop); // return new ApiResponse<DrugpropResponse>(ResponseType.OK, drugprop);
} //}
/// <summary> ///// <summary>
/// 修改药占比配置 ///// 修改药占比配置
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
[Route("drugupdate")] //[Route("drugupdate")]
[HttpPost] //[HttpPost]
public ApiResponse<DrugpropResponse> Update([CustomizeValidator(RuleSet = "Update"), FromBody] DrugpropRequest request) //public ApiResponse<DrugpropResponse> Update([CustomizeValidator(RuleSet = "Update"), FromBody] DrugpropRequest request)
{ //{
var drugprop = _configService.DrugUpdate(request); // var drugprop = _configService.DrugUpdate(request);
return new ApiResponse<DrugpropResponse>(ResponseType.OK, drugprop); // return new ApiResponse<DrugpropResponse>(ResponseType.OK, drugprop);
} //}
/// <summary> ///// <summary>
/// 删除药占比配置 ///// 删除药占比配置
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
[Route("drugdelete")] //[Route("drugdelete")]
[HttpPost] //[HttpPost]
public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody] DrugpropRequest request) //public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody] DrugpropRequest request)
{ //{
if (!_configService.DrugDelete(request)) // if (!_configService.DrugDelete(request))
return new ApiResponse(ResponseType.Fail); // return new ApiResponse(ResponseType.Fail);
return new ApiResponse(ResponseType.OK); // return new ApiResponse(ResponseType.OK);
} //}
#endregion #endregion
#region drugtype #region drugtype
...@@ -372,7 +372,7 @@ public ApiResponse<List<cof_workitem>> GetWorkItems([CustomizeValidator(RuleSet ...@@ -372,7 +372,7 @@ public ApiResponse<List<cof_workitem>> GetWorkItems([CustomizeValidator(RuleSet
return new ApiResponse<List<cof_workitem>>(ResponseType.OK, "ok", list); return new ApiResponse<List<cof_workitem>>(ResponseType.OK, "ok", list);
} }
/// <summary> /// <summary>
/// 新增工作量绩效配置 /// 新增工作量绩效配置
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
...@@ -469,58 +469,58 @@ public ApiResponse DepttypeDelete([CustomizeValidator(RuleSet = "Delete"), FromB ...@@ -469,58 +469,58 @@ public ApiResponse DepttypeDelete([CustomizeValidator(RuleSet = "Delete"), FromB
#endregion #endregion
#region cmi #region cmi
/// <summary> ///// <summary>
/// 获取 CMI配置信息 ///// 获取 CMI配置信息
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
[Route("cmilist")] //[Route("cmilist")]
[HttpPost] //[HttpPost]
public ApiResponse GetHosCMIList([FromBody] cof_cmi request) //public ApiResponse GetHosCMIList([FromBody] cof_cmi request)
{ //{
var list = _configService.GetCMIList(request.AllotId); // var list = _configService.GetCMIList(request.AllotId);
return new ApiResponse(ResponseType.OK, "ok", list); // return new ApiResponse(ResponseType.OK, "ok", list);
} //}
/// <summary> ///// <summary>
/// 新增 CMI配置 ///// 新增 CMI配置
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
[Route("cmiinsert")] //[Route("cmiinsert")]
[HttpPost] //[HttpPost]
public ApiResponse HosCMIInsert([FromBody] cof_cmi request) //public ApiResponse HosCMIInsert([FromBody] cof_cmi request)
{ //{
var drugprop = _configService.HosCMIInsert(request); // var drugprop = _configService.HosCMIInsert(request);
return new ApiResponse(ResponseType.OK, drugprop); // return new ApiResponse(ResponseType.OK, drugprop);
} //}
/// <summary> ///// <summary>
/// 修改 CMI配置 ///// 修改 CMI配置
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
[Route("cmiupdate")] //[Route("cmiupdate")]
[HttpPost] //[HttpPost]
public ApiResponse HosCMIUpdate([FromBody] cof_cmi request) //public ApiResponse HosCMIUpdate([FromBody] cof_cmi request)
{ //{
var drugprop = _configService.HosCMIUpdate(request); // var drugprop = _configService.HosCMIUpdate(request);
return new ApiResponse(ResponseType.OK, drugprop); // return new ApiResponse(ResponseType.OK, drugprop);
} //}
/// <summary> ///// <summary>
/// 删除 CMI配置 ///// 删除 CMI配置
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
[Route("cmidelete")] //[Route("cmidelete")]
[HttpPost] //[HttpPost]
public ApiResponse HosCMIDelete([FromBody] cof_cmi request) //public ApiResponse HosCMIDelete([FromBody] cof_cmi request)
{ //{
if (!_configService.HosCMIDelete(request)) // if (!_configService.HosCMIDelete(request))
return new ApiResponse(ResponseType.Fail); // return new ApiResponse(ResponseType.Fail);
return new ApiResponse(ResponseType.OK); // return new ApiResponse(ResponseType.OK);
} //}
#endregion #endregion
/// <summary> /// <summary>
......
...@@ -17,17 +17,18 @@ namespace Performance.Api.Controllers ...@@ -17,17 +17,18 @@ namespace Performance.Api.Controllers
[ApiController] [ApiController]
public class ExConfigController : Controller public class ExConfigController : Controller
{ {
private readonly ILogger<ExConfigController> logger; private ILogger logger;
private WebapiUrl options;
private ExConfigService configService; private ExConfigService configService;
private WebapiUrl url;
public ExConfigController( public ExConfigController(
ILogger<ExConfigController> logger, ILogger<ExConfigController> logger,
ExConfigService configService, IOptions<WebapiUrl> options,
IOptions<WebapiUrl> url) ExConfigService configService)
{ {
this.logger = logger; this.logger = logger;
this.options = options.Value;
this.configService = configService; this.configService = configService;
this.url = url.Value;
} }
/// <summary> /// <summary>
...@@ -43,7 +44,7 @@ public ApiResponse Extract([CustomizeValidator(RuleSet = "Query"), FromBody] Mod ...@@ -43,7 +44,7 @@ public ApiResponse Extract([CustomizeValidator(RuleSet = "Query"), FromBody] Mod
if (request.ExecuteType == null || !request.ExecuteType.Any()) if (request.ExecuteType == null || !request.ExecuteType.Any())
return new ApiResponse(ResponseType.ParameterError, "ExecuteType 不存在,请重新选择!"); 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); return new ApiResponse(ResponseType.OK, list);
} }
...@@ -70,9 +71,24 @@ public ApiResponse FeeSource([FromBody] ModModuleRequest request) ...@@ -70,9 +71,24 @@ public ApiResponse FeeSource([FromBody] ModModuleRequest request)
if (request.HospitalId == null || request.HospitalId.Value == 0) if (request.HospitalId == null || request.HospitalId.Value == 0)
return new ApiResponse(ResponseType.ParameterError, "HospitalId 参数错误!"); return new ApiResponse(ResponseType.ParameterError, "HospitalId 参数错误!");
string retJson = HttpHelper.HttpPost(url.HttpPost + "/modextract/source", JsonHelper.Serialize(request), true); bool isSingle = false;
var ret = JsonHelper.Deserialize<ApiResponse>(retJson); configService.QueryHosConfigs(request.ModuleId.Value, ref isSingle, out int sheetType);
return new ApiResponse(ResponseType.OK, ret.Data);
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> /// <summary>
...@@ -161,14 +177,28 @@ public ApiResponse AddItem([FromBody] ItemListRequest request) ...@@ -161,14 +177,28 @@ public ApiResponse AddItem([FromBody] ItemListRequest request)
[HttpPost] [HttpPost]
public ApiResponse Items([FromBody] ModItemRequest request) 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, "当前医院未配置地址"); return new ApiResponse(ResponseType.Fail, "当前医院未配置地址");
if (sheetType == (int)SheetType.Income) if (sheetType == (int)SheetType.Income)
{ {
logger.LogInformation($"绩效收入模板配置项列表 : 请求地址 {url.HttpPost}/modextract/items"); if (isSingle)
HttpHelper.HttpPost(url.HttpPost + "/modextract/items", JsonHelper.Serialize(request), true); {
logger.LogInformation($"绩效收入模板配置项列表在{DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss完成请求")}"); 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); var list = configService.QueryItems(request.ModuleId.Value);
return new ApiResponse(ResponseType.OK, list); return new ApiResponse(ResponseType.OK, list);
...@@ -204,8 +234,8 @@ public ApiResponse DelItem([FromBody] ModItemRequest request) ...@@ -204,8 +234,8 @@ public ApiResponse DelItem([FromBody] ModItemRequest request)
return new ApiResponse(ResponseType.OK, "删除成功!"); return new ApiResponse(ResponseType.OK, "删除成功!");
} }
#region 特殊科室模板 #region 特殊科室模板
/// <summary> /// <summary>
/// 特殊科室模板配置项新增 /// 特殊科室模板配置项新增
/// </summary> /// </summary>
...@@ -266,7 +296,6 @@ public ApiResponse DelSpecial([FromBody] ModSpecialRequest request) ...@@ -266,7 +296,6 @@ public ApiResponse DelSpecial([FromBody] ModSpecialRequest request)
return new ApiResponse(ResponseType.OK, "删除成功!"); return new ApiResponse(ResponseType.OK, "删除成功!");
} }
/// <summary> /// <summary>
/// 特殊科室人均 /// 特殊科室人均
/// </summary> /// </summary>
...@@ -278,7 +307,8 @@ public ApiResponse PerforType() ...@@ -278,7 +307,8 @@ public ApiResponse PerforType()
var list = configService.PerforType(); var list = configService.PerforType();
return new ApiResponse(ResponseType.OK, list); return new ApiResponse(ResponseType.OK, list);
} }
#endregion
#endregion 特殊科室模板
/// <summary> /// <summary>
/// 数据配置项 /// 数据配置项
......
...@@ -402,10 +402,10 @@ public ApiResponse NursingDeptAuditResult([FromBody] SecondAuditRequest request) ...@@ -402,10 +402,10 @@ public ApiResponse NursingDeptAuditResult([FromBody] SecondAuditRequest request)
public ApiResponse OtherList([FromBody] AgOtherRequest request) public ApiResponse OtherList([FromBody] AgOtherRequest request)
{ {
//var result = secondAllotService.OtherList(request.SecondId, claimService.GetUserId()); //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 var obj = new
{ {
header = secondAllotService.OtherListHeader(request.SecondId, result?.Sum(t => t.RealAmount)), header = secondAllotService.OtherListHeader(request.SecondId, realAmount ?? 0),
body = result, body = result,
}; };
return new ApiResponse(ResponseType.OK, obj); return new ApiResponse(ResponseType.OK, obj);
...@@ -415,12 +415,12 @@ public ApiResponse OtherList([FromBody] AgOtherRequest request) ...@@ -415,12 +415,12 @@ public ApiResponse OtherList([FromBody] AgOtherRequest request)
/// 二次绩效其他绩效保存 /// 二次绩效其他绩效保存
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[Route("api/second/other/save")] [Route("api/second/other/save/{secondId}")]
[HttpPost] [HttpPost]
public ApiResponse OtherSave([FromBody] AgOtherRequest request) public ApiResponse OtherSave(int secondId, [FromBody] SaveCollectData request)
{ {
var result = secondAllotService.OtherSave(request.SecondId, request.Othersources); secondAllotService.OtherSave(secondId, request);
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK);
} }
#endregion 二次绩效其他绩效 #endregion 二次绩效其他绩效
...@@ -448,6 +448,7 @@ public ApiResponse DeptComputeDetail(int allotId) ...@@ -448,6 +448,7 @@ public ApiResponse DeptComputeDetail(int allotId)
var userId = claimService.GetUserId(); var userId = claimService.GetUserId();
//var data = secondAllotService.DeptComputeDetail(userId, allotId, out int isShowManage); //var data = secondAllotService.DeptComputeDetail(userId, allotId, out int isShowManage);
var data = secondAllotService.DeptComputeDetailList(userId, allotId, out int isShowManage); var data = secondAllotService.DeptComputeDetailList(userId, allotId, out int isShowManage);
return new ApiResponse(ResponseType.OK, new { isShowManage, data }); return new ApiResponse(ResponseType.OK, new { isShowManage, data });
} }
} }
......
using FluentValidation.AspNetCore; using FluentValidation.AspNetCore;
using Hangfire;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Http.Internal;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles; using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Performance.DtoModels; using Performance.DtoModels;
...@@ -18,50 +18,52 @@ ...@@ -18,50 +18,52 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
namespace Performance.Api.Controllers namespace Performance.Api.Controllers
{ {
[Route("api/[controller]")] [Route("api/[controller]")]
public class TemplateController : Controller public class TemplateController : Controller
{ {
private readonly ILogger logger;
private readonly IHostingEnvironment env;
private readonly ClaimService claim;
private readonly WebapiUrl url;
private readonly Application application;
private readonly TemplateService templateService; private readonly TemplateService templateService;
private readonly DFExtractService extractService;
private readonly ExtractIncomeService extractIncomeService; private readonly ExtractIncomeService extractIncomeService;
private readonly ExtractService extractEService; private readonly ExConfigService configService;
private HospitalService hospitalService; private readonly HospitalService hospitalService;
private IHostingEnvironment env;
private ClaimService claim;
private Application application;
private WebapiUrl url;
private readonly AllotService allotService; private readonly AllotService allotService;
private readonly LogManageService logService; private readonly LogManageService logService;
private readonly ILogger<ExceptionsFilter> logger; private readonly IServiceScopeFactory serviceScopeFactory;
public TemplateController(TemplateService templateService, public TemplateController(
HospitalService hospitalService, ILogger<ExceptionsFilter> logger,
DFExtractService extractService,
ExtractIncomeService extractIncomeService,
ExtractService extractEService,
IHostingEnvironment env, IHostingEnvironment env,
ClaimService claim, ClaimService claim,
IOptions<Application> options,
IOptions<WebapiUrl> url, IOptions<WebapiUrl> url,
IOptions<Application> options,
TemplateService templateService,
ExtractIncomeService extractIncomeService,
ExConfigService configService,
HospitalService hospitalService,
AllotService allotService, AllotService allotService,
LogManageService logService, LogManageService logService,
ILogger<ExceptionsFilter> logger) IServiceScopeFactory serviceScopeFactory)
{ {
this.templateService = templateService; this.logger = logger;
this.extractService = extractService;
this.extractIncomeService = extractIncomeService;
this.extractEService = extractEService;
this.hospitalService = hospitalService;
this.env = env; this.env = env;
this.claim = claim; this.claim = claim;
this.application = options.Value;
this.url = url.Value; this.url = url.Value;
this.application = options.Value;
this.templateService = templateService;
this.extractIncomeService = extractIncomeService;
this.configService = configService;
this.hospitalService = hospitalService;
this.allotService = allotService; this.allotService = allotService;
this.logService = logService; this.logService = logService;
this.logger = logger; this.serviceScopeFactory = serviceScopeFactory;
} }
/// <summary> /// <summary>
...@@ -79,15 +81,19 @@ public IActionResult DownFile(int type = 1) ...@@ -79,15 +81,19 @@ public IActionResult DownFile(int type = 1)
case 1: case 1:
path = Path.Combine(env.ContentRootPath, "Template", "医院绩效模板.xls"); path = Path.Combine(env.ContentRootPath, "Template", "医院绩效模板.xls");
break; break;
case 2: case 2:
path = Path.Combine(env.ContentRootPath, "Template", "医院二次分配绩效模板.xlsx"); path = Path.Combine(env.ContentRootPath, "Template", "医院二次分配绩效模板.xlsx");
break; break;
case 3: case 3:
path = Path.Combine(env.ContentRootPath, "Template", "医院绩效模板(无执行科室).xlsx"); path = Path.Combine(env.ContentRootPath, "Template", "医院绩效模板(无执行科室).xlsx");
break; break;
case 4: case 4:
path = Path.Combine(env.ContentRootPath, "Template", "医院人员绩效模板.xls"); path = Path.Combine(env.ContentRootPath, "Template", "医院人员绩效模板.xls");
break; break;
case 5: case 5:
path = Path.Combine(env.ContentRootPath, "Template", "工作量数据导入模板.xls"); path = Path.Combine(env.ContentRootPath, "Template", "工作量数据导入模板.xls");
break; break;
...@@ -157,70 +163,8 @@ public ApiResponse Import([FromForm] IFormCollection form) ...@@ -157,70 +163,8 @@ public ApiResponse Import([FromForm] IFormCollection form)
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
#region 老版提取
///// <summary>
///// 提取绩效数据
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("extractdata")]
//[HttpPost]
//public ApiResponse ExtractData([CustomizeValidator(RuleSet = "Template"), FromBody]AllotRequest request)
//{
// try
// {
// var allot = allotService.GetAllot(request.ID);
// if (allot == null)
// return new ApiResponse(ResponseType.Fail, "该绩效无效");
// allot.IsExtracting = allot.IsExtracting ?? 0;
// if (allot.IsExtracting == 1)
// return new ApiResponse(ResponseType.Fail, "正在提取数据,请稍等。");
// var hospital = hospitalService.GetHopital(request.HospitalId.Value);
// if (hospital == null)
// return new ApiResponse(ResponseType.Fail, "医院无效");
// var email = claim.GetUserClaim(JwtClaimTypes.Mail);
// allot.IsExtracting = 1;
// allotService.Update(allot);
// string path = extractService.GetFilepath(hospital.ID, out int type);
// if (!string.IsNullOrEmpty(path) && type != 0)
// {
// //发送请求,返回路径
// string retJson = HttpHelper.HttpClient(url.ImportFirst + $"?type={type}&hospitalId={hospital.ID}&year={allot.Year}&month={allot.Month}", path);
// var ret = JsonHelper.Deserialize<ApiResponse>(retJson);
// if ((int)ret.State != 1)
// return new ApiResponse(ResponseType.Fail, "首次模板地址无效!");
// path = ret.Message;
// }
// string param = JsonHelper.Serialize(new
// {
// id = request.ID,
// hospitalId = hospital.ID,
// mail = email,
// path = path
// });
// HttpHelper.HttpPostNoRequest(url.ExtractData, param, true);
// //extractService.ExtractData(request.ID, user.Mail, hospital);
// //BackgroundJob.Enqueue(() => extractService.ExtractData(request.ID, user.Mail, hospital));
// return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!");
// }
// catch (Exception ex)
// {
// var allot = allotService.GetAllot(request.ID);
// if (allot != null)
// {
// allot.IsExtracting = 3;
// allotService.Update(allot);
// }
// throw ex;
// }
//}
#endregion
#region 新版提取 #region 新版提取
/// <summary> /// <summary>
/// 提取绩效数据 /// 提取绩效数据
/// </summary> /// </summary>
...@@ -237,10 +181,18 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest ...@@ -237,10 +181,18 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
try try
{ {
bool isSingle = false; bool isSingle = false;
string message = extractService.Judge(request.AllotId, request.HospitalId, request.UseScheme, ref isSingle, out string filePath); string message = configService.Judge(request.AllotId, request.HospitalId, request.UseScheme, ref isSingle, out string filePath);
if (!string.IsNullOrEmpty(message)) if (!string.IsNullOrEmpty(message))
return new ApiResponse(ResponseType.Fail, message); return new ApiResponse(ResponseType.Fail, message);
//if (!string.IsNullOrEmpty(filePath))
//{
// var data = configService.CheckHasNewDepartmentOrCategory(request.AllotId);
// return new ApiResponse(ResponseType.Fail, data);
//}
//检验科室、费用类型是否需要补充
allot.IsExtracting = allot.IsExtracting ?? 0; allot.IsExtracting = allot.IsExtracting ?? 0;
if (allot.IsExtracting == 1) if (allot.IsExtracting == 1)
return new ApiResponse(ResponseType.OK, "正在提取数据,请稍等!", new { IsExtracting = true }); return new ApiResponse(ResponseType.OK, "正在提取数据,请稍等!", new { IsExtracting = true });
...@@ -250,15 +202,33 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest ...@@ -250,15 +202,33 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
if (isSingle) if (isSingle)
{ {
string extractFilePath = extractEService.Main(allot.ID, allot.HospitalId, email, "User" + claim.GetUserId(), filePath, true); Task.Run(() =>
{
using (var scope = serviceScopeFactory.CreateScope())
{
var scopedServices = scope.ServiceProvider.GetRequiredService<ExtractService>();
string extractFilePath = scopedServices.Main(allot.ID, allot.HospitalId, email, "User" + claim.GetUserId(), filePath, isSingle);
}
});
} }
else else
{ {
logger.LogInformation("提取绩效数据请求路径:" + url.HttpPost + "/extract/extract"); var http = new RestSharpHelper();
if (string.IsNullOrEmpty(filePath)) string endpoint = "/extract/extract";
HttpHelper.HttpPostNoRequest(url.HttpPost + $"/extract/extract?allotId={request.AllotId}&hospitalId={request.HospitalId}&email={email}&userId={claim.GetUserId()}", ""); var extractUrl = http.SetUrl(url.HttpPost, endpoint);
else
HttpHelper.HttpClient(url.HttpPost + $"/extract/extract?allotId={request.AllotId}&hospitalId={request.HospitalId}&email={email}&userId={claim.GetUserId()}", filePath, true); var obj = new
{
allotId = request.AllotId,
hospitalId = request.HospitalId,
email = email,
userId = claim.GetUserId()
};
string json = JsonHelper.Serialize(obj);
var parameter = JsonHelper.Deserialize<Dictionary<string, object>>(json);
var restRequest = string.IsNullOrEmpty(filePath) ? http.CreatePostRequest(json) : http.CreateFileRequest(new string[] { filePath }, parameter);
Task.Run(() => http.GetResponse(extractUrl, restRequest));
} }
return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!", new { IsExtracting = false }); return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!", new { IsExtracting = false });
...@@ -281,8 +251,8 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest ...@@ -281,8 +251,8 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
// B 使用配置作为模板 // B 使用配置作为模板
} }
#endregion
#endregion 新版提取
/// <summary> /// <summary>
/// 从WebAPI下载文件 /// 从WebAPI下载文件
...@@ -314,26 +284,31 @@ public IActionResult DownFile([FromQuery] AllotRequest request) ...@@ -314,26 +284,31 @@ public IActionResult DownFile([FromQuery] AllotRequest request)
/// <summary> /// <summary>
/// 保存提取文件 /// 保存提取文件
/// </summary> /// </summary>
/// <param name="form"></param>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <returns></returns> /// <returns></returns>
[Route("savefile")] [Route("savefile")]
[HttpPost] [HttpPost]
[AllowAnonymous] [AllowAnonymous]
public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int hospitalId) public ApiResponse SaveFile()
{ {
logger.LogInformation($"保存提取文件请求参数:allotId:{allotId} hospitalId:{hospitalId}"); Dictionary<string, object> dict = new Dictionary<string, object>();
try foreach (var key in Request.Form.Keys)
{ {
var file = ((FormFileCollection)form.Files).FirstOrDefault(); dict.Add(key, Request.Form[key]);
if (file == null) }
{ string json = JsonHelper.Serialize(dict);
logger.LogError($"返回文件为空!"); var request = JsonHelper.Deserialize<ExtractRequest>(json);
return new ApiResponse(ResponseType.Error, "上传文件无效");
} if (Request.Form.Files == null || !Request.Form.Files.Any())
{
logger.LogError($"返回文件为空!");
return new ApiResponse(ResponseType.Error, "上传文件无效");
}
var dpath = Path.Combine(env.ContentRootPath, "Files", $"{hospitalId}", "autoextract"); logger.LogInformation("保存提取文件请求参数:" + json);
try
{
var file = Request.Form.Files[0];
var dpath = Path.Combine(env.ContentRootPath, "Files", $"{request.HospitalId}", "autoextract");
FileHelper.CreateDirectory(dpath); FileHelper.CreateDirectory(dpath);
var path = Path.Combine(dpath, FileHelper.GetFileName(file.FileName)); var path = Path.Combine(dpath, FileHelper.GetFileName(file.FileName));
...@@ -349,24 +324,22 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho ...@@ -349,24 +324,22 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho
return new ApiResponse(ResponseType.Error, "保存失败"); return new ApiResponse(ResponseType.Error, "保存失败");
} }
} }
var allot = allotService.GetAllot(allotId); var allot = allotService.GetAllot(request.AllotId);
allot.ExtractPath = path; allot.ExtractPath = path;
allot.IsExtracting = 2; allot.IsExtracting = 2;
if (string.IsNullOrEmpty(path) || !FileHelper.IsExistFile(path))
{ string success = "上传成功!";
logger.LogInformation($"保存提取文件文件未保存成功,保存文件不存在!"); string message = (string.IsNullOrEmpty(path) || !FileHelper.IsExistFile(path))
return new ApiResponse(ResponseType.Fail, "上传成功!"); ? "保存提取文件文件未保存成功,保存文件不存在!"
} : (!allotService.Update(allot)) ? "保存提取文件更新文件路径失败!" : success;
if (!allotService.Update(allot))
{ if (message == success)
logger.LogInformation($"保存提取文件更新文件路径失败!"); return new ApiResponse(ResponseType.OK, message);
return new ApiResponse(ResponseType.Fail, "上传成功!"); else
} return new ApiResponse(ResponseType.Fail, message);
return new ApiResponse(ResponseType.OK, "上传成功!");
} }
catch (Exception ex) catch (Exception ex)
{ {
logger.LogInformation($"保存提取文件异常{ex.ToString()}");
logger.LogError($"保存提取文件保存失败:" + ex.ToString()); logger.LogError($"保存提取文件保存失败:" + ex.ToString());
return new ApiResponse(ResponseType.Error, ex.Message); return new ApiResponse(ResponseType.Error, ex.Message);
} }
...@@ -375,24 +348,20 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho ...@@ -375,24 +348,20 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho
/// <summary> /// <summary>
/// 返回日志 /// 返回日志
/// </summary> /// </summary>
/// <param name="type">1 进度条 2 信息</param> /// <param name="request"></param>
/// <param name="tag"></param>
/// <param name="message"></param>
/// <param name="level"></param>
/// <param name="groupName"></param>
[Route("returnlog")] [Route("returnlog")]
[HttpPost] [HttpPost]
[AllowAnonymous] [AllowAnonymous]
public void ReturnLog(int type, string tag, string message, int level, string groupName) public void ReturnLog([FromBody] SignalrLogRequest request)
{ {
logger.LogInformation("返回日志:" + JsonHelper.Serialize(new { type, tag, message, level, groupName })); logger.LogInformation("返回日志:" + JsonHelper.Serialize(request));
if (type == 3) if (request.Type == 3)
{ {
logService.Schedule(groupName, ConvertHelper.To<decimal>(message), level); logService.Schedule(request.GroupName, ConvertHelper.To<decimal>(request.Message), request.Level);
} }
else else
{ {
logService.ExtractLog(groupName, tag, message, level); logService.ExtractLog(request.GroupName, request.Tag, request.Message, request.Level);
} }
} }
...@@ -443,4 +412,4 @@ public IActionResult ExtractIncome(int allotId) ...@@ -443,4 +412,4 @@ public IActionResult ExtractIncome(int allotId)
return File(memoryStream, memi, Path.GetFileName(filepath)); return File(memoryStream, memi, Path.GetFileName(filepath));
} }
} }
} }
\ No newline at end of file
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<PropertyGroup> <PropertyGroup>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest> <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
<UserSecretsId>e732666b-5531-4cd8-b713-2fe3db31126c</UserSecretsId>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
}, },
"AppConnection": { "AppConnection": {
//"PerformanceConnectionString": "server=112.124.13.17;database=db_performance;uid=suvalue;pwd=suvalue2016;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;", //"PerformanceConnectionString": "server=112.124.13.17;database=db_performance;uid=suvalue;pwd=suvalue2016;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"PerformanceConnectionString": "server=192.168.18.166;database=db_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;", "HangfireConnectionString": "server=192.168.18.166;database=db_hangfire;uid=root;pwd=1234qwer;port=3306;allow user variables=true;",
"RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2" "RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2"
}, },
......
...@@ -184,6 +184,13 @@ ...@@ -184,6 +184,13 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </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)"> <member name="M:Performance.Api.Controllers.AllotController.Pigeonhole(Performance.DtoModels.AllotRequest)">
<summary> <summary>
归档绩效记录 归档绩效记录
...@@ -426,34 +433,6 @@ ...@@ -426,34 +433,6 @@
<param name="computeId"></param> <param name="computeId"></param>
<returns></returns> <returns></returns>
</member> </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)"> <member name="M:Performance.Api.Controllers.ConfigController.GetDrugtypeList(Performance.DtoModels.DrugpropRequest)">
<summary> <summary>
获取 药占比类型信息列表 获取 药占比类型信息列表
...@@ -518,7 +497,7 @@ ...@@ -518,7 +497,7 @@
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ConfigController.WorkItemInsert(Performance.DtoModels.WorkItemRequest)"> <member name="M:Performance.Api.Controllers.ConfigController.WorkItemInsert(Performance.DtoModels.WorkItemRequest)">
<summary> <summary>
新增工作量绩效配置 新增工作量绩效配置
</summary> </summary>
<param name="request"></param> <param name="request"></param>
...@@ -566,34 +545,6 @@ ...@@ -566,34 +545,6 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </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)"> <member name="M:Performance.Api.Controllers.ConfigController.WorkHeader(Performance.DtoModels.WorkItemRequest)">
<summary> <summary>
获取工作量绩效列头 获取工作量绩效列头
...@@ -1287,7 +1238,7 @@ ...@@ -1287,7 +1238,7 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </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>
二次绩效其他绩效保存 二次绩效其他绩效保存
</summary> </summary>
...@@ -1359,24 +1310,17 @@ ...@@ -1359,24 +1310,17 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </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>
保存提取文件 保存提取文件
</summary> </summary>
<param name="form"></param>
<param name="allotId"></param>
<param name="hospitalId"></param>
<returns></returns> <returns></returns>
</member> </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>
返回日志 返回日志
</summary> </summary>
<param name="type">1 进度条 2 信息</param> <param name="request"></param>
<param name="tag"></param>
<param name="message"></param>
<param name="level"></param>
<param name="groupName"></param>
</member> </member>
<member name="M:Performance.Api.Controllers.TemplateController.ReturnLog(Performance.EntityModels.log_dbug)"> <member name="M:Performance.Api.Controllers.TemplateController.ReturnLog(Performance.EntityModels.log_dbug)">
<summary> <summary>
......
...@@ -180,11 +180,11 @@ ...@@ -180,11 +180,11 @@
<summary> 日期 </summary> <summary> 日期 </summary>
</member> </member>
<member name="M:Performance.DtoModels.HandsonTable.SetRowData(System.Collections.Generic.IEnumerable{Performance.DtoModels.HandsonRowData},System.Boolean)"> <member name="M:Performance.DtoModels.HandsonTable.SetRowData(System.Collections.Generic.IEnumerable{Performance.DtoModels.HandsonRowData},System.Boolean)">
<summary> <summary>
</summary> </summary>
<param name="datas"></param> <param name="datas"></param>
<param name="isTypein">是否是用户录入的 是:true 不是:false</param> <param name="isTypein">是否是用户录入的 是:true 不是:false</param>
</member> </member>
<member name="P:Performance.DtoModels.HistoryData.Year"> <member name="P:Performance.DtoModels.HistoryData.Year">
<summary> <summary>
...@@ -396,11 +396,6 @@ ...@@ -396,11 +396,6 @@
门诊药占比分值 门诊药占比分值
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.CofDrugProp.Prop">
<summary>
占比
</summary>
</member>
<member name="P:Performance.DtoModels.CofDrugProp.Factor"> <member name="P:Performance.DtoModels.CofDrugProp.Factor">
<summary> <summary>
分值 分值
...@@ -804,6 +799,18 @@ ...@@ -804,6 +799,18 @@
<member name="F:Performance.DtoModels.SheetType.PersonPostCoefficient"> <member name="F:Performance.DtoModels.SheetType.PersonPostCoefficient">
<summary> 个人岗位系数 </summary> <summary> 个人岗位系数 </summary>
</member> </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"> <member name="T:Performance.DtoModels.AccountUnitType">
<summary> <summary>
核算单元类型 核算单元类型
...@@ -1037,11 +1044,6 @@ ...@@ -1037,11 +1044,6 @@
应发管理绩效 应发管理绩效
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.PerDataAccountBaisc.MedicineFactor">
<summary>
药占比系数
</summary>
</member>
<member name="P:Performance.DtoModels.PerDataAccountBaisc.Income"> <member name="P:Performance.DtoModels.PerDataAccountBaisc.Income">
<summary> <summary>
科室业绩 科室业绩
...@@ -2014,23 +2016,33 @@ ...@@ -2014,23 +2016,33 @@
<member name="P:Performance.DtoModels.ExtractRequest.AllotId"> <member name="P:Performance.DtoModels.ExtractRequest.AllotId">
<summary> <summary>
绩效ID 绩效ID
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.ExtractRequest.HospitalId"> <member name="P:Performance.DtoModels.ExtractRequest.HospitalId">
<summary> <summary>
医院ID 医院ID
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.ExtractRequest.UseScheme"> <member name="P:Performance.DtoModels.ExtractRequest.UseScheme">
<summary> <summary>
使用方案 使用方案
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.ExtractRequest.Email"> <member name="P:Performance.DtoModels.ExtractRequest.Email">
<summary> <summary>
邮箱 邮箱
</summary> </summary>
</member> </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"> <member name="P:Performance.DtoModels.GuaranteeRequest.Id">
<summary> </summary> <summary> </summary>
</member> </member>
...@@ -2842,6 +2854,9 @@ ...@@ -2842,6 +2854,9 @@
<member name="P:Performance.DtoModels.DetailModule.CMIFactor"> <member name="P:Performance.DtoModels.DetailModule.CMIFactor">
<summary> CMI系数 </summary> <summary> CMI系数 </summary>
</member> </member>
<member name="P:Performance.DtoModels.DetailModule.InclineFactor">
<summary> 工作量倾斜系数 </summary>
</member>
<member name="P:Performance.DtoModels.DetailModule.ItemValue"> <member name="P:Performance.DtoModels.DetailModule.ItemValue">
<summary> 结算值 </summary> <summary> 结算值 </summary>
</member> </member>
......
...@@ -67,18 +67,12 @@ ...@@ -67,18 +67,12 @@
<member name="P:Performance.EntityModels.PerformanceDbContext.cof_check"> <member name="P:Performance.EntityModels.PerformanceDbContext.cof_check">
<summary> 上传excel文件校验配置 </summary> <summary> 上传excel文件校验配置 </summary>
</member> </member>
<member name="P:Performance.EntityModels.PerformanceDbContext.cof_cmi">
<summary> </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.cof_depttype"> <member name="P:Performance.EntityModels.PerformanceDbContext.cof_depttype">
<summary> 科室类型 </summary> <summary> 科室类型 </summary>
</member> </member>
<member name="P:Performance.EntityModels.PerformanceDbContext.cof_director"> <member name="P:Performance.EntityModels.PerformanceDbContext.cof_director">
<summary> 规模绩效、效率绩效计算系数配置 </summary> <summary> 规模绩效、效率绩效计算系数配置 </summary>
</member> </member>
<member name="P:Performance.EntityModels.PerformanceDbContext.cof_drugprop">
<summary> 工作量门诊药占比系数 </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.cof_drugtype"> <member name="P:Performance.EntityModels.PerformanceDbContext.cof_drugtype">
<summary> 药占比费用列头名称 </summary> <summary> 药占比费用列头名称 </summary>
</member> </member>
...@@ -1316,36 +1310,6 @@ ...@@ -1316,36 +1310,6 @@
单元格列头名称 单元格列头名称
</summary> </summary>
</member> </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"> <member name="T:Performance.EntityModels.cof_depttype">
<summary> <summary>
科室类型 科室类型
...@@ -1406,36 +1370,6 @@ ...@@ -1406,36 +1370,6 @@
绩效系数 绩效系数
</summary> </summary>
</member> </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"> <member name="T:Performance.EntityModels.cof_drugtype">
<summary> <summary>
药占比费用列头名称 药占比费用列头名称
...@@ -2136,11 +2070,6 @@ ...@@ -2136,11 +2070,6 @@
核算单元(护理组) 核算单元(护理组)
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.im_accountbasic.Department">
<summary>
科室
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.IncludeAvgCalculate"> <member name="P:Performance.EntityModels.im_accountbasic.IncludeAvgCalculate">
<summary> <summary>
是否带入平均计算 是 否 是否带入平均计算 是 否
...@@ -2151,11 +2080,6 @@ ...@@ -2151,11 +2080,6 @@
定科人数 定科人数
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.im_accountbasic.DoctorDirectorNumber">
<summary>
科主任数量
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.DoctorNumber"> <member name="P:Performance.EntityModels.im_accountbasic.DoctorNumber">
<summary> <summary>
核算单元医生数量 核算单元医生数量
...@@ -2166,11 +2090,6 @@ ...@@ -2166,11 +2090,6 @@
医生基础系数 医生基础系数
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.im_accountbasic.DoctorSlopeFactor">
<summary>
倾斜系数
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.DoctorScale"> <member name="P:Performance.EntityModels.im_accountbasic.DoctorScale">
<summary> <summary>
规模绩效系数 规模绩效系数
...@@ -2206,11 +2125,6 @@ ...@@ -2206,11 +2125,6 @@
材料占比奖罚 材料占比奖罚
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.im_accountbasic.DoctorExtra">
<summary>
医院奖罚
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.DoctorScoringAverage"> <member name="P:Performance.EntityModels.im_accountbasic.DoctorScoringAverage">
<summary> <summary>
考核对分率 考核对分率
...@@ -2231,71 +2145,6 @@ ...@@ -2231,71 +2145,6 @@
保底绩效系数 保底绩效系数
</summary> </summary>
</member> </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"> <member name="P:Performance.EntityModels.im_accountbasic.UpdateDate">
<summary> <summary>
......
...@@ -10,12 +10,12 @@ public class HandsonTable ...@@ -10,12 +10,12 @@ public class HandsonTable
{ {
private IEnumerable<collect_permission> _permissions; private IEnumerable<collect_permission> _permissions;
private List<Dictionary<string, string>> _data; private List<Dictionary<string, string>> _data;
public HandsonTable(int sheetType, string[] cols, List<collect_permission> permissions) public HandsonTable(int sheetType, string[] cols, List<collect_permission> permissions)
{ {
_permissions = permissions; _permissions = permissions;
_data = new List<Dictionary<string, string>>(); _data = new List<Dictionary<string, string>>();
InitColHeaders(sheetType, cols); InitColHeaders(sheetType, cols);
InitColumns(permissions); InitColumns(permissions);
} }
...@@ -25,7 +25,7 @@ public HandsonTable(int sheetType, string[] cols, List<collect_permission> permi ...@@ -25,7 +25,7 @@ public HandsonTable(int sheetType, string[] cols, List<collect_permission> permi
public HandsonColumn[] Columns { get; private set; } public HandsonColumn[] Columns { get; private set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="datas"></param> /// <param name="datas"></param>
/// <param name="isTypein">是否是用户录入的 是:true 不是:false</param> /// <param name="isTypein">是否是用户录入的 是:true 不是:false</param>
...@@ -40,6 +40,8 @@ public void SetRowData(IEnumerable<HandsonRowData> datas, bool isTypein) ...@@ -40,6 +40,8 @@ public void SetRowData(IEnumerable<HandsonRowData> datas, bool isTypein)
dic[item.Name.ToLower()] = item.Value?.ToString() ?? ""; 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)) 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() ?? ""; 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); _data.Add(dic);
} }
...@@ -105,20 +107,25 @@ public HandsonColumn(string data, bool readOnly = false, DataFormat format = Dat ...@@ -105,20 +107,25 @@ public HandsonColumn(string data, bool readOnly = false, DataFormat format = Dat
case DataFormat.普通格式: case DataFormat.普通格式:
Type = "text"; Type = "text";
break; break;
case DataFormat.小数: case DataFormat.小数:
Type = "numeric"; Type = "numeric";
NumericFormat = new NumericFormat { Pattern = "0,00.00" }; NumericFormat = new NumericFormat { Pattern = "0,00.00" };
break; break;
case DataFormat.百分比: case DataFormat.百分比:
Type = "numeric"; Type = "numeric";
NumericFormat = new NumericFormat { Pattern = "0,00.00%" }; NumericFormat = new NumericFormat { Pattern = "0,00.00%" };
break; break;
} }
} }
public string Data { get; set; } public string Data { get; set; }
public bool ReadOnly { get; set; } public bool ReadOnly { get; set; }
public string Type { get; set; } public string Type { get; set; }
public string[] Source { get; set; }
public bool Strict { get; set; } = false;
public NumericFormat NumericFormat { get; set; } public NumericFormat NumericFormat { get; set; }
} }
......
...@@ -9,11 +9,13 @@ namespace Performance.DtoModels ...@@ -9,11 +9,13 @@ namespace Performance.DtoModels
/// </summary> /// </summary>
public class CofDrugProp public class CofDrugProp
{ {
public string AccoutingUnit { get; set; } public string AccountingUnit { get; set; }
/// <summary> public string UnitType { get; set; }
/// 占比 //public string AccoutingUnit { get; set; }
/// </summary> ///// <summary>
public decimal Prop { get; set; } ///// 占比
///// </summary>
//public decimal Prop { get; set; }
/// <summary> /// <summary>
/// 分值 /// 分值
/// </summary> /// </summary>
......
...@@ -11,32 +11,41 @@ public enum ExcelVersion ...@@ -11,32 +11,41 @@ public enum ExcelVersion
xls xls
} }
/// <summary> 核算单元类型 </summary> /// <summary> 核算单元类型 </summary>
public enum UnitType public enum UnitType
{ {
[Description("医生组")] [Description("医生组")]
医生组 = 1, 医生组 = 1,
[Description("护理组")] [Description("护理组")]
护理组 = 2, 护理组 = 2,
[Description("医技组")] [Description("医技组")]
医技组 = 3, 医技组 = 3,
[Description("专家组")] [Description("专家组")]
专家组 = 4, 专家组 = 4,
//[Description("其他")] //[Description("其他")]
//其他 = 5, //其他 = 5,
[Description("特殊核算组")] [Description("特殊核算组")]
特殊核算组 = 6, 特殊核算组 = 6,
[Description("其他医生组")] [Description("其他医生组")]
其他医生组 = 7, 其他医生组 = 7,
[Description("其他护理组")] [Description("其他护理组")]
其他护理组 = 8, 其他护理组 = 8,
[Description("其他医技组")] [Description("其他医技组")]
其他医技组 = 9, 其他医技组 = 9,
[Description("行政高层")] [Description("行政高层")]
行政高层 = 10, 行政高层 = 10,
[Description("行政中层")] [Description("行政中层")]
行政中层 = 11, 行政中层 = 11,
[Description("行政后勤")] [Description("行政后勤")]
行政后勤 = 12, 行政后勤 = 12,
} }
...@@ -46,27 +55,35 @@ public enum SheetType ...@@ -46,27 +55,35 @@ public enum SheetType
/// <summary> 无法识别 </summary> /// <summary> 无法识别 </summary>
[Description("无法识别")] [Description("无法识别")]
Unidentifiable = 1, Unidentifiable = 1,
/// <summary> 行政中高层 </summary> /// <summary> 行政中高层 </summary>
[Description("行政中高层")] [Description("行政中高层")]
Employee = 2, Employee = 2,
/// <summary> 收入 </summary> /// <summary> 收入 </summary>
[Description("收入")] [Description("收入")]
Income = 3, Income = 3,
/// <summary> 其他收入 </summary> /// <summary> 其他收入 </summary>
[Description("其他收入")] [Description("其他收入")]
OtherIncome = 4, OtherIncome = 4,
/// <summary> 支出 </summary> /// <summary> 支出 </summary>
[Description("支出")] [Description("支出")]
Expend = 5, Expend = 5,
/// <summary> 加班 </summary> /// <summary> 加班 </summary>
[Description("加班")] [Description("加班")]
Overtime = 6, Overtime = 6,
/// <summary> 工作量 </summary> /// <summary> 工作量 </summary>
[Description("工作量")] [Description("工作量")]
Workload = 7, Workload = 7,
/// <summary> 特殊核算单元 </summary> /// <summary> 特殊核算单元 </summary>
[Description("特殊核算单元")] [Description("特殊核算单元")]
SpecialUnit = 8, SpecialUnit = 8,
/// <summary> 临床科室医护绩效测算基础 </summary> /// <summary> 临床科室医护绩效测算基础 </summary>
[Description("临床科室医护绩效测算基础")] [Description("临床科室医护绩效测算基础")]
AccountBasic = 9, AccountBasic = 9,
...@@ -74,15 +91,19 @@ public enum SheetType ...@@ -74,15 +91,19 @@ public enum SheetType
/// <summary> 科室经济核算汇总表 </summary> /// <summary> 科室经济核算汇总表 </summary>
[Description("科室经济核算汇总表")] [Description("科室经济核算汇总表")]
ComputeEconomic = 10, ComputeEconomic = 10,
/// <summary> 医生工作量计算 </summary> /// <summary> 医生工作量计算 </summary>
[Description("医生工作量计算")] [Description("医生工作量计算")]
ComputeDoctorWorkload = 11, ComputeDoctorWorkload = 11,
/// <summary> 护士工作量计算 </summary> /// <summary> 护士工作量计算 </summary>
[Description("护士工作量计算")] [Description("护士工作量计算")]
ComputeNurseWorkload = 12, ComputeNurseWorkload = 12,
/// <summary> 临床科室医生绩效测算表 </summary> /// <summary> 临床科室医生绩效测算表 </summary>
[Description("临床科室医生绩效测算表")] [Description("临床科室医生绩效测算表")]
ComputeDoctorAccount = 13, ComputeDoctorAccount = 13,
/// <summary> 临床科室护士绩效测算表 </summary> /// <summary> 临床科室护士绩效测算表 </summary>
[Description("临床科室护士绩效测算表")] [Description("临床科室护士绩效测算表")]
ComputeNurseAccount = 14, ComputeNurseAccount = 14,
...@@ -115,7 +136,6 @@ public enum SheetType ...@@ -115,7 +136,6 @@ public enum SheetType
[Description("行政后勤")] [Description("行政后勤")]
LogisticsEmployee = 21, LogisticsEmployee = 21,
/// <summary> 科室考核 </summary> /// <summary> 科室考核 </summary>
[Description("科室考核")] [Description("科室考核")]
AccountScoreAverage = 25, AccountScoreAverage = 25,
...@@ -132,22 +152,41 @@ public enum SheetType ...@@ -132,22 +152,41 @@ public enum SheetType
[Description("其他工作量")] [Description("其他工作量")]
OtherWorkload = 28, OtherWorkload = 28,
/// <summary> 预算比例 </summary> /// <summary> 预算比例 </summary>
[Description("预算比例")] [Description("预算比例")]
BudgetRatio = 30, BudgetRatio = 30,
/// <summary> 科室考核前其他绩效 </summary> /// <summary> 科室考核前其他绩效 </summary>
[Description("科室考核前其他绩效")] [Description("科室考核前其他绩效")]
AssessBeforeOtherFee = 31, AssessBeforeOtherFee = 31,
/// <summary> 其他管理绩效 </summary> /// <summary> 其他管理绩效 </summary>
[Description("其他管理绩效")] [Description("其他管理绩效")]
PersonOtherManagePerforFee = 32, PersonOtherManagePerforFee = 32,
/// <summary> 调节后其他管理绩效 </summary> /// <summary> 调节后其他管理绩效 </summary>
[Description("调节后其他管理绩效")] [Description("调节后其他管理绩效")]
PersonAdjustLaterOtherManagePerforFee = 33, PersonAdjustLaterOtherManagePerforFee = 33,
/// <summary> 个人岗位系数 </summary> /// <summary> 个人岗位系数 </summary>
[Description("个人岗位系数")] [Description("个人岗位系数")]
PersonPostCoefficient = 34, 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> /// <summary>
...@@ -158,18 +197,23 @@ public enum AccountUnitType ...@@ -158,18 +197,23 @@ public enum AccountUnitType
/// <summary> </summary> /// <summary> </summary>
[Description("")] [Description("")]
Null = 1, Null = 1,
/// <summary> 临床科室 </summary> /// <summary> 临床科室 </summary>
[Description("科主任")] [Description("科主任")]
科主任 = 2, 科主任 = 2,
/// <summary> 临床科室 </summary> /// <summary> 临床科室 </summary>
[Description("护士长")] [Description("护士长")]
护士长 = 3, 护士长 = 3,
/// <summary> 行政高层 </summary> /// <summary> 行政高层 </summary>
[Description("行政高层")] [Description("行政高层")]
行政高层 = 4, 行政高层 = 4,
/// <summary> 临床科室 </summary> /// <summary> 临床科室 </summary>
[Description("行政中层")] [Description("行政中层")]
行政中层 = 5, 行政中层 = 5,
/// <summary> 临床科室 </summary> /// <summary> 临床科室 </summary>
[Description("行政工勤")] [Description("行政工勤")]
行政工勤 = 6, 行政工勤 = 6,
...@@ -179,30 +223,43 @@ public enum PerforType ...@@ -179,30 +223,43 @@ public enum PerforType
{ {
[Description("临床科室主任人均绩效")] [Description("临床科室主任人均绩效")]
临床主任, 临床主任,
[Description("临床科室副主任人均绩效")] [Description("临床科室副主任人均绩效")]
临床副主任, 临床副主任,
[Description("医技科室主任人均绩效")] [Description("医技科室主任人均绩效")]
医技主任, 医技主任,
[Description("医技科室副主任人均绩效")] [Description("医技科室副主任人均绩效")]
医技副主任, 医技副主任,
[Description("护士长人均绩效")] [Description("护士长人均绩效")]
护士长, 护士长,
[Description("护士人均绩效")] [Description("护士人均绩效")]
护士, 护士,
[Description("临床主任护士长平均")] [Description("临床主任护士长平均")]
临床主任护士长平均, 临床主任护士长平均,
[Description("临床主任医技主任护士长平均")] [Description("临床主任医技主任护士长平均")]
临床主任医技主任护士长平均, 临床主任医技主任护士长平均,
[Description("临床医生人均绩效")] [Description("临床医生人均绩效")]
临床医生, 临床医生,
[Description("医技医生人均绩效")] [Description("医技医生人均绩效")]
医技医生, 医技医生,
[Description("行政高层人均绩效")] [Description("行政高层人均绩效")]
行政高层, 行政高层,
[Description("行政中层人均绩效")] [Description("行政中层人均绩效")]
行政中层, 行政中层,
[Description("行政工勤人均绩效")] [Description("行政工勤人均绩效")]
行政工勤, 行政工勤,
[Description("医生护士平均绩效")] [Description("医生护士平均绩效")]
医生护士平均, 医生护士平均,
} }
...@@ -214,12 +271,16 @@ public enum MinimumType ...@@ -214,12 +271,16 @@ public enum MinimumType
{ {
[Description("保底绩效临床医生人均绩效")] [Description("保底绩效临床医生人均绩效")]
保底临床医生 = 1, 保底临床医生 = 1,
[Description("保底绩效医技医生人均绩效")] [Description("保底绩效医技医生人均绩效")]
保底医技医生 = 2, 保底医技医生 = 2,
[Description("保底绩效护士人均绩效")] [Description("保底绩效护士人均绩效")]
保底护士 = 3, 保底护士 = 3,
[Description("保底绩效行政工勤人均绩效")] [Description("保底绩效行政工勤人均绩效")]
保底工勤 = 4, 保底工勤 = 4,
[Description("自定义保底绩效")] [Description("自定义保底绩效")]
自定义保底 = 5, 自定义保底 = 5,
} }
......
...@@ -72,6 +72,6 @@ public class PerData : IPerData ...@@ -72,6 +72,6 @@ public class PerData : IPerData
public int PointCell { get; set; } public int PointCell { get; set; }
public string SignID { 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 ...@@ -177,10 +177,10 @@ public class PerDataAccountBaisc : IPerData
#region 由计算得出 #region 由计算得出
/// <summary> ///// <summary>
/// 药占比系数 ///// 药占比系数
/// </summary> ///// </summary>
public Nullable<decimal> MedicineFactor { get; set; } //public Nullable<decimal> MedicineFactor { get; set; }
///// <summary> ///// <summary>
///// 保底绩效金额 ///// 保底绩效金额
......
...@@ -9,17 +9,17 @@ public class ExtractRequest ...@@ -9,17 +9,17 @@ public class ExtractRequest
{ {
/// <summary> /// <summary>
/// 绩效ID /// 绩效ID
/// </summary> /// </summary>
public int AllotId { get; set; } public int AllotId { get; set; }
/// <summary> /// <summary>
/// 医院ID /// 医院ID
/// </summary> /// </summary>
public int HospitalId { get; set; } public int HospitalId { get; set; }
/// <summary> /// <summary>
/// 使用方案 /// 使用方案
/// </summary> /// </summary>
public int UseScheme { get; set; } public int UseScheme { get; set; }
/// <summary> /// <summary>
...@@ -27,9 +27,16 @@ public class ExtractRequest ...@@ -27,9 +27,16 @@ public class ExtractRequest
/// </summary> /// </summary>
public string Email { get; set; } public string Email { get; set; }
/// <summary>
/// Signalr分组名称
/// </summary>
public string GroupName { get; set; } public string GroupName { get; set; }
}
/// <summary>
/// 用户Id
/// </summary>
public int UserId { get; set; }
}
public class ExtractRequestValidator : AbstractValidator<ExtractRequest> 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 ...@@ -85,6 +85,9 @@ public class DetailModule
/// <summary> CMI系数 </summary> /// <summary> CMI系数 </summary>
public decimal? CMIFactor { get; set; } public decimal? CMIFactor { get; set; }
/// <summary> 工作量倾斜系数 </summary>
public decimal? InclineFactor { get; set; }
/// <summary> 结算值 </summary> /// <summary> 结算值 </summary>
public decimal? ItemValue { get; set; } public decimal? ItemValue { get; set; }
} }
......
...@@ -74,8 +74,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options) ...@@ -74,8 +74,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
/// <summary> 上传excel文件校验配置 </summary> /// <summary> 上传excel文件校验配置 </summary>
public virtual DbSet<cof_check> cof_check { get; set; } public virtual DbSet<cof_check> cof_check { get; set; }
/// <summary> </summary> ///// <summary> </summary>
public virtual DbSet<cof_cmi> cof_cmi { get; set; } //public virtual DbSet<cof_cmi> cof_cmi { get; set; }
/// <summary> 科室类型 </summary> /// <summary> 科室类型 </summary>
public virtual DbSet<cof_depttype> cof_depttype { get; set; } public virtual DbSet<cof_depttype> cof_depttype { get; set; }
...@@ -83,8 +83,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options) ...@@ -83,8 +83,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
/// <summary> 规模绩效、效率绩效计算系数配置 </summary> /// <summary> 规模绩效、效率绩效计算系数配置 </summary>
public virtual DbSet<cof_director> cof_director { get; set; } public virtual DbSet<cof_director> cof_director { get; set; }
/// <summary> 工作量门诊药占比系数 </summary> ///// <summary> 工作量门诊药占比系数 </summary>
public virtual DbSet<cof_drugprop> cof_drugprop { get; set; } //public virtual DbSet<cof_drugprop> cof_drugprop { get; set; }
/// <summary> 药占比费用列头名称 </summary> /// <summary> 药占比费用列头名称 </summary>
public virtual DbSet<cof_drugtype> cof_drugtype { get; set; } public virtual DbSet<cof_drugtype> cof_drugtype { get; set; }
......
//----------------------------------------------------------------------- ////-----------------------------------------------------------------------
// <copyright file=" cof_cmi.cs"> //// <copyright file=" cof_cmi.cs">
// * FileName: .cs //// * FileName: .cs
// </copyright> //// </copyright>
//----------------------------------------------------------------------- ////-----------------------------------------------------------------------
using System; //using System;
using System.ComponentModel.DataAnnotations; //using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; //using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels //namespace Performance.EntityModels
{ //{
/// <summary> // /// <summary>
/// // ///
/// </summary> // /// </summary>
[Table("cof_cmi")] // [Table("cof_cmi")]
public class cof_cmi // public class cof_cmi
{ // {
/// <summary> // /// <summary>
/// // ///
/// </summary> // /// </summary>
[Key] // [Key]
public int Id { get; set; } // public int Id { get; set; }
/// <summary> // /// <summary>
/// // ///
/// </summary> // /// </summary>
public int AllotId { get; set; } // public int AllotId { get; set; }
/// <summary> // /// <summary>
/// // ///
/// </summary> // /// </summary>
public int UnitType { get; set; } // public int UnitType { get; set; }
/// <summary> // /// <summary>
/// // ///
/// </summary> // /// </summary>
public string AccountingUnit { get; set; } // public string AccountingUnit { get; set; }
/// <summary> // /// <summary>
/// // ///
/// </summary> // /// </summary>
public Nullable<decimal> Value { get; set; } // public Nullable<decimal> Value { get; set; }
} // }
} //}
//----------------------------------------------------------------------- ////-----------------------------------------------------------------------
// <copyright file=" cof_drugprop.cs"> //// <copyright file=" cof_drugprop.cs">
// * FileName: 工作量门诊药占比系数.cs //// * FileName: 工作量门诊药占比系数.cs
// </copyright> //// </copyright>
//----------------------------------------------------------------------- ////-----------------------------------------------------------------------
using System; //using System;
using System.ComponentModel.DataAnnotations; //using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; //using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels //namespace Performance.EntityModels
{ //{
/// <summary> // /// <summary>
/// 工作量门诊药占比系数 // /// 工作量门诊药占比系数
/// </summary> // /// </summary>
[Table("cof_drugprop")] // [Table("cof_drugprop")]
public class cof_drugprop // public class cof_drugprop
{ // {
/// <summary> // /// <summary>
/// // ///
/// </summary> // /// </summary>
[Key] // [Key]
public int ID { get; set; } // public int ID { get; set; }
/// <summary> // /// <summary>
/// // ///
/// </summary> // /// </summary>
public Nullable<int> AllotID { get; set; } // public Nullable<int> AllotID { get; set; }
/// <summary> // /// <summary>
/// 药占比最大范围(小于) // /// 药占比最大范围(小于)
/// </summary> // /// </summary>
public Nullable<decimal> MaxRange { get; set; } // public Nullable<decimal> MaxRange { get; set; }
/// <summary> // /// <summary>
/// 药占比最小范围(大于等于) // /// 药占比最小范围(大于等于)
/// </summary> // /// </summary>
public Nullable<decimal> MinRange { get; set; } // public Nullable<decimal> MinRange { get; set; }
/// <summary> // /// <summary>
/// 药占比对应系数 // /// 药占比对应系数
/// </summary> // /// </summary>
public Nullable<decimal> Value { get; set; } // public Nullable<decimal> Value { get; set; }
} // }
} //}
...@@ -46,10 +46,10 @@ public class im_accountbasic ...@@ -46,10 +46,10 @@ public class im_accountbasic
/// </summary> /// </summary>
public string NurseAccountingUnit { get; set; } public string NurseAccountingUnit { get; set; }
/// <summary> ///// <summary>
/// 科室 ///// 科室
/// </summary> ///// </summary>
public string Department { get; set; } //public string Department { get; set; }
/// <summary> /// <summary>
/// 是否带入平均计算 是 否 /// 是否带入平均计算 是 否
...@@ -61,10 +61,10 @@ public class im_accountbasic ...@@ -61,10 +61,10 @@ public class im_accountbasic
/// </summary> /// </summary>
public Nullable<decimal> PermanentStaff { get; set; } public Nullable<decimal> PermanentStaff { get; set; }
/// <summary> ///// <summary>
/// 科主任数量 ///// 科主任数量
/// </summary> ///// </summary>
public Nullable<decimal> DoctorDirectorNumber { get; set; } //public Nullable<decimal> DoctorDirectorNumber { get; set; }
/// <summary> /// <summary>
/// 核算单元医生数量 /// 核算单元医生数量
...@@ -76,10 +76,10 @@ public class im_accountbasic ...@@ -76,10 +76,10 @@ public class im_accountbasic
/// </summary> /// </summary>
public Nullable<decimal> DoctorBasicFactor { get; set; } public Nullable<decimal> DoctorBasicFactor { get; set; }
/// <summary> ///// <summary>
/// 倾斜系数 ///// 倾斜系数
/// </summary> ///// </summary>
public Nullable<decimal> DoctorSlopeFactor { get; set; } //public Nullable<decimal> DoctorSlopeFactor { get; set; }
/// <summary> /// <summary>
/// 规模绩效系数 /// 规模绩效系数
...@@ -116,9 +116,9 @@ public class im_accountbasic ...@@ -116,9 +116,9 @@ public class im_accountbasic
/// </summary> /// </summary>
public Nullable<decimal> MaterialsExtra { get; set; } public Nullable<decimal> MaterialsExtra { get; set; }
/// <summary> ///// <summary>
/// 医院奖罚 ///// 医院奖罚
/// </summary> ///// </summary>
public Nullable<decimal> DoctorExtra { get; set; } public Nullable<decimal> DoctorExtra { get; set; }
/// <summary> /// <summary>
...@@ -141,70 +141,70 @@ public class im_accountbasic ...@@ -141,70 +141,70 @@ public class im_accountbasic
/// </summary> /// </summary>
public Nullable<decimal> MinimumFactor { get; set; } public Nullable<decimal> MinimumFactor { get; set; }
/// <summary> ///// <summary>
/// 护士长人数 ///// 护士长人数
/// </summary> ///// </summary>
public Nullable<decimal> NurseHeadNumber { get; set; } //public Nullable<decimal> NurseHeadNumber { get; set; }
/// <summary> ///// <summary>
/// 护士人数 ///// 护士人数
/// </summary> ///// </summary>
public Nullable<decimal> NurseNumber { get; set; } //public Nullable<decimal> NurseNumber { get; set; }
/// <summary> ///// <summary>
/// 护理基础系数 ///// 护理基础系数
/// </summary> ///// </summary>
public Nullable<decimal> NurseBasicFactor { get; set; } //public Nullable<decimal> NurseBasicFactor { get; set; }
/// <summary> ///// <summary>
/// 倾斜系数 ///// 倾斜系数
/// </summary> ///// </summary>
public Nullable<decimal> NurseSlopeFactor { get; set; } //public Nullable<decimal> NurseSlopeFactor { get; set; }
/// <summary> ///// <summary>
/// 规模绩效系数 ///// 规模绩效系数
/// </summary> ///// </summary>
public Nullable<decimal> NurseScale { get; set; } //public Nullable<decimal> NurseScale { get; set; }
/// <summary> ///// <summary>
/// 效率绩效系数 ///// 效率绩效系数
/// </summary> ///// </summary>
public Nullable<decimal> NurseEffic { get; set; } //public Nullable<decimal> NurseEffic { get; set; }
/// <summary> ///// <summary>
/// 发放系数 ///// 发放系数
/// </summary> ///// </summary>
public Nullable<decimal> NurseGrant { get; set; } //public Nullable<decimal> NurseGrant { get; set; }
/// <summary> ///// <summary>
/// 其他绩效1 ///// 其他绩效1
/// </summary> ///// </summary>
public Nullable<decimal> NurseOtherPerfor1 { get; set; } //public Nullable<decimal> NurseOtherPerfor1 { get; set; }
/// <summary> ///// <summary>
/// 其他绩效2 ///// 其他绩效2
/// </summary> ///// </summary>
public Nullable<decimal> NurseOtherPerfor2 { get; set; } //public Nullable<decimal> NurseOtherPerfor2 { get; set; }
/// <summary> ///// <summary>
/// 医院奖罚 ///// 医院奖罚
/// </summary> ///// </summary>
public Nullable<decimal> NurseExtra { get; set; } //public Nullable<decimal> NurseExtra { get; set; }
/// <summary> ///// <summary>
/// 考核对分率 ///// 考核对分率
/// </summary> ///// </summary>
public Nullable<decimal> NurseScoringAverage { get; set; } //public Nullable<decimal> NurseScoringAverage { get; set; }
/// <summary> ///// <summary>
/// 调节系数 ///// 调节系数
/// </summary> ///// </summary>
public Nullable<decimal> NurseAdjustFactor { get; set; } //public Nullable<decimal> NurseAdjustFactor { get; set; }
/// <summary> ///// <summary>
/// 工作量倾斜系数 ///// 工作量倾斜系数
/// </summary> ///// </summary>
public Nullable<decimal> WorkSlopeFactor { get; set; } //public Nullable<decimal> WorkSlopeFactor { get; set; }
/// <summary> /// <summary>
/// ///
...@@ -215,17 +215,15 @@ public class im_accountbasic ...@@ -215,17 +215,15 @@ public class im_accountbasic
/// ///
/// </summary> /// </summary>
public Nullable<int> UpdateUser { get; set; } public Nullable<int> UpdateUser { get; set; }
/// <summary> /// <summary>
/// 考核前其他绩效 /// 考核前其他绩效
/// </summary> /// </summary>
public Nullable<decimal> AssessBeforeOtherFee { get; set; } public Nullable<decimal> AssessBeforeOtherFee { get; set; }
/// <summary> /// <summary>
/// 考核后其他绩效 /// 考核后其他绩效
/// </summary> /// </summary>
public Nullable<decimal> AssessLaterOtherFee { get; set; } public Nullable<decimal> AssessLaterOtherFee { get; set; }
/// <summary> /// <summary>
/// 调节后其他绩效 /// 调节后其他绩效
/// </summary> /// </summary>
......
using FluentValidation.AspNetCore; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Internal;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.DtoModels.AppSettings; using Performance.DtoModels.AppSettings;
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Services;
using Performance.Services.ExtractExcelService; using Performance.Services.ExtractExcelService;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
namespace Performance.Extract.Api.Controllers namespace Performance.Extract.Api.Controllers
{ {
[Route("api/[controller]")] [Route("api/[controller]")]
public class ExtractController : Controller public class ExtractController : Controller
{ {
private readonly DFExtractService extractService;
private readonly HospitalService hospitalService;
private readonly ExtractService extractService1;
private readonly WebapiUrl url;
private readonly ILogger<ExtractController> logger;
private readonly IHostingEnvironment evn; private readonly IHostingEnvironment evn;
private readonly ILogger logger;
private readonly WebapiUrl options;
private readonly ExtractService extractService1;
public ExtractController(DFExtractService extractService, public ExtractController(
HospitalService hospitalService, IHostingEnvironment evn,
ExtractService extractService1,
IOptions<WebapiUrl> url,
ILogger<ExtractController> logger, ILogger<ExtractController> logger,
IHostingEnvironment evn) IOptions<WebapiUrl> options,
ExtractService extractService1)
{ {
this.extractService = extractService;
this.hospitalService = hospitalService;
this.extractService1 = extractService1;
this.url = url.Value;
this.logger = logger;
this.evn = evn; this.evn = evn;
this.logger = logger;
this.options = options.Value;
this.extractService1 = extractService1;
} }
/// <summary>
/// 保存首次文件
/// </summary>
/// <param name="form"></param>
/// <param name="type">1、历史绩效文件 2、首次模板文件</param>
/// <param name="hospitalId"></param>
/// <returns></returns>
[Route("import")]
[HttpPost]
public ApiResponse Import([FromForm] IFormCollection form, int type, int hospitalId, int year, int month)
{
var file = ((FormFileCollection)form.Files).FirstOrDefault();
if (file == null)
return new ApiResponse(ResponseType.Error, "上传文件无效");
var dpath = Path.Combine(evn.ContentRootPath, "Files", $"{hospitalId}", "first");
if (type == 1)
dpath = Path.Combine(evn.ContentRootPath, "Files", $"{hospitalId}", $"{year}{month.ToString().PadLeft(2, '0')}");
FileHelper.CreateDirectory(dpath);
var path = Path.Combine(dpath, FileHelper.GetFileName(file.FileName));
using (var stream = file.OpenReadStream())
{
byte[] bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
if (!FileHelper.CreateFile(path, bytes))
return new ApiResponse(ResponseType.Error, "保存失败");
}
if (!string.IsNullOrEmpty(path) && FileHelper.IsExistFile(path))
return new ApiResponse(ResponseType.OK, path);
else
return new ApiResponse(ResponseType.Error, "获取首次文件失败!");
}
///// <summary>
///// 提取数据
///// </summary>
///// <param name="request"></param>
//[HttpPost]
//[Route("index")]
//public void Index([FromBody]AllotRequest request)
//{
// var token = Guid.NewGuid().ToString("N");
// logger.LogInformation(token + ",开始提取数据,请求参数:" + JsonHelper.Serialize(request));
// var hospital = hospitalService.GetHopital(request.HospitalId.Value);
// var filepath = extractService.ExtractData(request.ID, request.Mail, hospital, request.Path);
// if (!string.IsNullOrEmpty(filepath) && FileHelper.IsExistFile(filepath))
// {
// int i = 1;
// while (i <= 5)
// {
// string retJson = HttpHelper.HttpClient(url.ImportFile + $"?allotId={request.ID}&hospitalId={hospital.ID}", filepath);
// logger.LogInformation(retJson);
// var ret = JsonHelper.Deserialize<ApiResponse>(retJson);
// if ((int)ret.State == 1)
// break;
// i++;
// }
// }
// logger.LogInformation(token + ",提取结束,请求参数:" + JsonHelper.Serialize(request));
//}
#region 新版提取 #region 新版提取
/// <summary> /// <summary>
...@@ -117,88 +42,98 @@ public ApiResponse Import([FromForm] IFormCollection form, int type, int hospita ...@@ -117,88 +42,98 @@ public ApiResponse Import([FromForm] IFormCollection form, int type, int hospita
/// <returns></returns> /// <returns></returns>
[Route("extract")] [Route("extract")]
[HttpPost] [HttpPost]
public void ExtractData([FromForm] IFormCollection form, int allotId, int hospitalId, string email, string userId) public void ExtractData()
{ {
logger.LogInformation("提取绩效数据请求参数:" + JsonHelper.Serialize(new { allotId, hospitalId, email, userId })); Dictionary<string, object> dict = new Dictionary<string, object>();
if (allotId == 0 || hospitalId == 0) foreach (var key in Request.Form.Keys)
{
dict.Add(key, Request.Form[key]);
}
string json = JsonHelper.Serialize(dict);
var request = JsonHelper.Deserialize<ExtractRequest>(json);
logger.LogInformation("提取绩效数据请求参数:" + json);
if (request == null || request.AllotId == 0 || request.HospitalId == 0)
return; return;
var path = string.Empty; var path = string.Empty;
if (Request.Form.Files == null || !Request.Form.Files.Any())
logger.LogInformation($"文件为空,以模板文件进行数据提取!");
else
path = SaveFileAsTemplate(Request.Form.Files[0], request.HospitalId);
#region 保存历史绩效文件 string filePath = extractService1.Main(request.AllotId, request.HospitalId, request.Email, "User" + request.UserId, path);
if (form.Files == null || !form.Files.Any() || ((FormFileCollection)form.Files).FirstOrDefault() == null) logger.LogInformation($"抽取的文件地址: {filePath}");
logger.LogInformation($"文件为空!");
if (!string.IsNullOrEmpty(filePath) && FileHelper.IsExistFile(filePath))
ImportFileAsAllotExtractFile(request.AllotId, request.HospitalId, filePath);
else else
{ logger.LogInformation($"保存提取文件提取文件不存在!");
var file = ((FormFileCollection)form.Files)?.FirstOrDefault(); }
var dpath = Path.Combine(evn.ContentRootPath, "Files", "HospitalAllot", $"{hospitalId}");
FileHelper.CreateDirectory(dpath);
path = Path.Combine(dpath, FileHelper.GetFileName(file.FileName)); #endregion 新版提取
logger.LogInformation($"保存历史绩效文件保存路径:" + path);
if (!string.IsNullOrEmpty(path) && FileHelper.IsExistFile(path))
FileHelper.DeleteFile(path);
if (!string.IsNullOrEmpty(path) && FileHelper.IsExistFile(path)) #region 保存历史绩效文件
FileHelper.DeleteFile(path);
using (var stream = file.OpenReadStream()) private string SaveFileAsTemplate(IFormFile file, int hospitalId)
{ {
byte[] bytes = new byte[stream.Length]; var dpath = Path.Combine(evn.ContentRootPath, "Files", "HospitalAllot", $"{hospitalId}");
stream.Read(bytes, 0, bytes.Length); FileHelper.CreateDirectory(dpath);
if (!FileHelper.CreateFile(path, bytes))
{ string path = Path.Combine(dpath, FileHelper.GetFileName(file.FileName));
logger.LogInformation($"保存历史绩效文件保存失败"); logger.LogInformation($"保存历史绩效文件保存路径:" + path);
} if (!string.IsNullOrEmpty(path) && FileHelper.IsExistFile(path))
} FileHelper.DeleteFile(path);
if (!string.IsNullOrEmpty(path) && FileHelper.IsExistFile(path))
FileHelper.DeleteFile(path);
using (var stream = file.OpenReadStream())
{
byte[] bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
if (!FileHelper.CreateFile(path, bytes))
logger.LogInformation($"保存历史绩效文件保存失败");
else
return "";
} }
return path;
}
#endregion 保存历史绩效文件 #endregion 保存历史绩效文件
//string filePath = newExtractService.ExtractData(allotId, request.Email, hospitalId); #region 保存文件到网站下
//string filePath = extractService.ExtractData(allotId, email, hospitalId, "User" + userId, path); //抽取
string filePath = extractService1.Main(allotId, hospitalId, email, "User" + userId, path);
logger.LogInformation($"抽取文件地址: {filePath}");
#region 保存文件到网站下 private void ImportFileAsAllotExtractFile(int allotId, int hospitalId, string filePath)
{
var http = new RestSharpHelper();
string endpoint = "/template/savefile";
var importUrl = http.SetUrl(options.ImportFile, endpoint);
if (!string.IsNullOrEmpty(filePath) && FileHelper.IsExistFile(filePath)) var obj = new { allotId, hospitalId };
string json = JsonHelper.Serialize(obj);
var parameter = JsonHelper.Deserialize<Dictionary<string, object>>(json);
var request = http.CreateFileRequest(new string[] { filePath }, parameter);
int i = 1;
while (i <= 5)
{ {
string http = url.ImportFile + $"/template/savefile?allotId={allotId}&hospitalId={hospitalId}"; logger.LogInformation($"正在尝试第{i}次保存!");
logger.LogInformation("请求路径:" + http + ",请求参数" + JsonHelper.Serialize(new
{ var response = http.GetResponse(importUrl, request);
allotId, var result = http.GetContent<ApiResponse>(response);
hospitalId if (result != null && (int)result.State == 1)
}));
int i = 1;
while (i <= 5)
{ {
if (i == 5) logger.LogInformation("保存提取文件保存成功!");
logger.LogInformation($"保存文件失败,已尝试执行五次,请联系开发人员!"); return;
else
logger.LogInformation($"正在尝试第{i}次保存!");
//保存文件
var files = new Dictionary<string, string> { { "file", filePath } };
string retJson = HttpHelper.HttpPost(http, files: files);
logger.LogInformation("保存提取文件返回结果:" + JsonHelper.Serialize(retJson));
logger.LogInformation(retJson);
var ret = JsonHelper.Deserialize<ApiResponse>(retJson);
if (ret != null && (int)ret.State == 1)
{
logger.LogInformation("保存提取文件保存成功!");
break;
}
i++;
} }
i++;
} }
else logger.LogInformation($"保存文件失败,已尝试执行五次,请联系开发人员!");
logger.LogInformation($"保存提取文件提取文件不存在!");
#endregion 保存文件到网站下
} }
#endregion 新版提取 #endregion 保存文件到网站下
} }
} }
\ No newline at end of file
...@@ -16,6 +16,7 @@ public class ModExtractController : Controller ...@@ -16,6 +16,7 @@ public class ModExtractController : Controller
{ {
private readonly ILogger<ModExtractController> logger; private readonly ILogger<ModExtractController> logger;
private ExConfigService service; private ExConfigService service;
public ModExtractController( public ModExtractController(
ILogger<ModExtractController> logger, ILogger<ModExtractController> logger,
ExConfigService service) ExConfigService service)
...@@ -24,34 +25,38 @@ public class ModExtractController : Controller ...@@ -24,34 +25,38 @@ public class ModExtractController : Controller
this.service = service; this.service = service;
} }
/// <summary> #region 弃用
/// 绩效数据抽取模板
/// </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 不存在,请重新选择!");
var list = service.ExtractScheme(request.HospitalId.Value, request.ExecuteType); ///// <summary>
return new ApiResponse(ResponseType.OK, list); ///// 绩效数据抽取模板
} ///// </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> // var list = service.ExtractScheme(request.HospitalId.Value, request.ExecuteType);
/// 费用类型 // return new ApiResponse(ResponseType.OK, list);
/// </summary> //}
/// <returns></returns>
[Route("type")] ///// <summary>
[HttpPost] ///// 费用类型
public ApiResponse FeeType() ///// </summary>
{ ///// <returns></returns>
var list = service.FeeType(); //[Route("type")]
return new ApiResponse(ResponseType.OK, list); //[HttpPost]
} //public ApiResponse FeeType()
//{
// var list = service.FeeType();
// return new ApiResponse(ResponseType.OK, list);
//}
#endregion 弃用
/// <summary> /// <summary>
/// 绩效考核项费用来源 /// 绩效考核项费用来源
...@@ -59,7 +64,7 @@ public ApiResponse FeeType() ...@@ -59,7 +64,7 @@ public ApiResponse FeeType()
/// <returns></returns> /// <returns></returns>
[Route("source")] [Route("source")]
[HttpPost] [HttpPost]
public ApiResponse FeeSource([FromBody]ModModuleRequest request) public ApiResponse FeeSource([FromBody] ModModuleRequest request)
{ {
if (request.HospitalId == null || request.HospitalId.Value == 0) if (request.HospitalId == null || request.HospitalId.Value == 0)
return new ApiResponse(ResponseType.ParameterError, "HospitalId 参数错误!"); return new ApiResponse(ResponseType.ParameterError, "HospitalId 参数错误!");
...@@ -75,11 +80,11 @@ public ApiResponse FeeSource([FromBody]ModModuleRequest request) ...@@ -75,11 +80,11 @@ public ApiResponse FeeSource([FromBody]ModModuleRequest request)
/// <returns></returns> /// <returns></returns>
[Route("items")] [Route("items")]
[HttpPost] [HttpPost]
public ApiResponse Items([FromBody]ModItemRequest request) public ApiResponse Items([FromBody] ModItemRequest request)
{ {
logger.LogInformation($"绩效收入模板配置项列表:{JsonHelper.Serialize(request)}"); logger.LogInformation($"绩效收入模板配置项列表:{JsonHelper.Serialize(request)}");
service.AddItems(request.ModuleId.Value); service.AddItems(request.ModuleId.Value);
return new ApiResponse(ResponseType.OK); 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) ...@@ -28,6 +28,8 @@ public int DeleteData(int allotId)
"im_employee_logistics", "im_employee_logistics",
"im_header", "im_header",
"im_specialunit", "im_specialunit",
"log_check",
"per_employee",
"per_sheet", "per_sheet",
"res_account", "res_account",
"res_accountdoctor", "res_accountdoctor",
...@@ -35,7 +37,13 @@ public int DeleteData(int allotId) ...@@ -35,7 +37,13 @@ public int DeleteData(int allotId)
"res_baiscnorm", "res_baiscnorm",
"res_compute", "res_compute",
"res_specialunit", "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 = ""; string sql = "";
tableArray.ForEach(t => sql += $"delete from {t} where allotid=@allotId;"); tableArray.ForEach(t => sql += $"delete from {t} where allotid=@allotId;");
...@@ -68,21 +76,22 @@ public int DeleteAllotData(int allotId) ...@@ -68,21 +76,22 @@ public int DeleteAllotData(int allotId)
"im_employee_logistics", "im_employee_logistics",
"im_header", "im_header",
"im_specialunit", "im_specialunit",
"per_sheet",
"res_account",
"res_accountdoctor",
"res_accountnurse",
"res_baiscnorm",
"res_compute",
"res_specialunit",
"log_check", "log_check",
"per_employee", "per_employee",
"per_sheet",
"report_allot_crowd", "report_allot_crowd",
"report_allot_summary", "report_allot_summary",
"report_original_income", "report_original_income",
"report_original_persontime", "report_original_persontime",
"report_original_stays", "report_original_stays",
"report_original_surgery", "report_original_surgery",
"report_original_workload",
"res_account",
"res_accountdoctor",
"res_accountnurse",
"res_baiscnorm",
"res_compute",
"res_specialunit",
}; };
string sql = ""; string sql = "";
tableArray.ForEach(t => sql += $"delete from {t} where allotid=@allotId;"); tableArray.ForEach(t => sql += $"delete from {t} where allotid=@allotId;");
...@@ -95,13 +104,20 @@ public int DeleteResData(int allotId) ...@@ -95,13 +104,20 @@ public int DeleteResData(int allotId)
{ {
List<string> tableArray = new List<string> 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_account",
"res_accountdoctor", "res_accountdoctor",
"res_accountnurse", "res_accountnurse",
"res_baiscnorm", "res_baiscnorm",
"res_compute", "res_compute",
"res_specialunit", "res_specialunit",
"log_dbug",
}; };
string sql = ""; string sql = "";
tableArray.ForEach(t => sql += $"delete from {t} where allotid=@allotId;"); tableArray.ForEach(t => sql += $"delete from {t} where allotid=@allotId;");
......
//----------------------------------------------------------------------- ////-----------------------------------------------------------------------
// <copyright file=" cof_cmi.cs"> //// <copyright file=" cof_cmi.cs">
// * FileName: cof_cmi.cs //// * FileName: cof_cmi.cs
// </copyright> //// </copyright>
//----------------------------------------------------------------------- ////-----------------------------------------------------------------------
using System; //using System;
using Performance.EntityModels; //using Performance.EntityModels;
namespace Performance.Repository //namespace Performance.Repository
{ //{
/// <summary> // /// <summary>
/// cof_cmi Repository // /// cof_cmi Repository
/// </summary> // /// </summary>
public partial class PerforCofcmiRepository : PerforRepository<cof_cmi> // public partial class PerforCofcmiRepository : PerforRepository<cof_cmi>
{ // {
public PerforCofcmiRepository(PerformanceDbContext context) : base(context) // public PerforCofcmiRepository(PerformanceDbContext context) : base(context)
{ // {
} // }
} // }
} //}
//----------------------------------------------------------------------- ////-----------------------------------------------------------------------
// <copyright file=" cof_drugprop.cs"> //// <copyright file=" cof_drugprop.cs">
// * FileName: cof_drugprop.cs //// * FileName: cof_drugprop.cs
// </copyright> //// </copyright>
//----------------------------------------------------------------------- ////-----------------------------------------------------------------------
using System; //using System;
using Performance.EntityModels; //using Performance.EntityModels;
namespace Performance.Repository //namespace Performance.Repository
{ //{
/// <summary> // /// <summary>
/// cof_drugprop Repository // /// cof_drugprop Repository
/// </summary> // /// </summary>
public partial class PerforCofdrugpropRepository : PerforRepository<cof_drugprop> // public partial class PerforCofdrugpropRepository : PerforRepository<cof_drugprop>
{ // {
public PerforCofdrugpropRepository(PerformanceDbContext context) : base(context) // public PerforCofdrugpropRepository(PerformanceDbContext context) : base(context)
{ // {
} // }
} // }
} //}
...@@ -18,7 +18,6 @@ public class ProcessComputService : IAutoInjection ...@@ -18,7 +18,6 @@ public class ProcessComputService : IAutoInjection
{ {
private readonly BudgetService _budgetService; private readonly BudgetService _budgetService;
private PerforCofincomeRepository perforCofincomeRepository; private PerforCofincomeRepository perforCofincomeRepository;
private PerforCofdrugpropRepository perforCofdrugpropRepository;
private PerforPersheetRepository perforPerSheetRepository; private PerforPersheetRepository perforPerSheetRepository;
private PerforImdataRepository perforImDataRepository; private PerforImdataRepository perforImDataRepository;
private PerforImheaderRepository perforImHeaderRepository; private PerforImheaderRepository perforImHeaderRepository;
...@@ -27,7 +26,6 @@ public class ProcessComputService : IAutoInjection ...@@ -27,7 +26,6 @@ public class ProcessComputService : IAutoInjection
private PerforResbaiscnormRepository perforResbaiscnormRepository; private PerforResbaiscnormRepository perforResbaiscnormRepository;
private PerforCofdrugtypeRepository perforCofdrugtypeRepository; private PerforCofdrugtypeRepository perforCofdrugtypeRepository;
private PerforCofworkitemRepository perforCofworkitemRepository; private PerforCofworkitemRepository perforCofworkitemRepository;
private PerforCofcmiRepository perforCofcmiRepository;
private readonly PerforRescomputeRepository perforRescomputeRepository; private readonly PerforRescomputeRepository perforRescomputeRepository;
private readonly LogManageService logManageService; private readonly LogManageService logManageService;
private readonly GuaranteeService guaranteeService; private readonly GuaranteeService guaranteeService;
...@@ -37,7 +35,6 @@ public class ProcessComputService : IAutoInjection ...@@ -37,7 +35,6 @@ public class ProcessComputService : IAutoInjection
public ProcessComputService( public ProcessComputService(
BudgetService budgetService, BudgetService budgetService,
PerforCofincomeRepository perforCofincomeRepository, PerforCofincomeRepository perforCofincomeRepository,
PerforCofdrugpropRepository perforCofdrugpropRepository,
PerforPersheetRepository perforPerSheetRepository, PerforPersheetRepository perforPerSheetRepository,
PerforImdataRepository perforImDataRepository, PerforImdataRepository perforImDataRepository,
PerforImheaderRepository perforImHeaderRepository, PerforImheaderRepository perforImHeaderRepository,
...@@ -46,7 +43,6 @@ public class ProcessComputService : IAutoInjection ...@@ -46,7 +43,6 @@ public class ProcessComputService : IAutoInjection
PerforResbaiscnormRepository perforResbaiscnormRepository, PerforResbaiscnormRepository perforResbaiscnormRepository,
PerforCofdrugtypeRepository perforCofdrugtypeRepository, PerforCofdrugtypeRepository perforCofdrugtypeRepository,
PerforCofworkitemRepository perforCofworkitemRepository, PerforCofworkitemRepository perforCofworkitemRepository,
PerforCofcmiRepository perforCofcmiRepository,
PerforRescomputeRepository perforRescomputeRepository, PerforRescomputeRepository perforRescomputeRepository,
LogManageService logManageService, LogManageService logManageService,
GuaranteeService guaranteeService, GuaranteeService guaranteeService,
...@@ -55,7 +51,6 @@ public class ProcessComputService : IAutoInjection ...@@ -55,7 +51,6 @@ public class ProcessComputService : IAutoInjection
{ {
_budgetService = budgetService; _budgetService = budgetService;
this.perforCofincomeRepository = perforCofincomeRepository; this.perforCofincomeRepository = perforCofincomeRepository;
this.perforCofdrugpropRepository = perforCofdrugpropRepository;
this.perforPerSheetRepository = perforPerSheetRepository; this.perforPerSheetRepository = perforPerSheetRepository;
this.perforImDataRepository = perforImDataRepository; this.perforImDataRepository = perforImDataRepository;
this.perforImHeaderRepository = perforImHeaderRepository; this.perforImHeaderRepository = perforImHeaderRepository;
...@@ -64,7 +59,6 @@ public class ProcessComputService : IAutoInjection ...@@ -64,7 +59,6 @@ public class ProcessComputService : IAutoInjection
this.perforResbaiscnormRepository = perforResbaiscnormRepository; this.perforResbaiscnormRepository = perforResbaiscnormRepository;
this.perforCofdrugtypeRepository = perforCofdrugtypeRepository; this.perforCofdrugtypeRepository = perforCofdrugtypeRepository;
this.perforCofworkitemRepository = perforCofworkitemRepository; this.perforCofworkitemRepository = perforCofworkitemRepository;
this.perforCofcmiRepository = perforCofcmiRepository;
this.perforRescomputeRepository = perforRescomputeRepository; this.perforRescomputeRepository = perforRescomputeRepository;
this.logManageService = logManageService; this.logManageService = logManageService;
this.guaranteeService = guaranteeService; this.guaranteeService = guaranteeService;
...@@ -219,14 +213,17 @@ public void Save(List<PerSheet> perSheets, int allotId) ...@@ -219,14 +213,17 @@ public void Save(List<PerSheet> perSheets, int allotId)
workload1.SheetName = "医生组工作量绩效测算表"; workload1.SheetName = "医生组工作量绩效测算表";
logManageService.WriteMsg("正在生成绩效", "获取药品费用分割比例", 1, allotid, "ReceiveMessage"); logManageService.WriteMsg("正在生成绩效", "获取药品费用分割比例", 1, allotid, "ReceiveMessage");
var confs = GetDrugConfig(excel, allotid);
var cmis = perforCofcmiRepository.GetEntities(t => t.AllotId == allotid);
var conitem = perforCofworkitemRepository.GetEntities(t => t.AllotID == allotid); var conitem = perforCofworkitemRepository.GetEntities(t => t.AllotID == allotid);
var medicineProps = GetFactors(excel, SheetType.WorkloadMedicineProp);
var cmis = GetFactors(excel, SheetType.WorkloadCMI);
var inclines = GetFactors(excel, SheetType.WorkloadIncline);
//医生组 一次计算 //医生组 一次计算
//var onceWorkload1 = workloadCompute.OnceCompute(workload1, confs); //var onceWorkload1 = workloadCompute.OnceCompute(workload1, confs);
//医生组 二次计算 //医生组 二次计算
logManageService.WriteMsg("正在生成绩效", "医生组工作量计算", 1, allotid, "ReceiveMessage"); logManageService.WriteMsg("正在生成绩效", "医生组工作量计算", 1, allotid, "ReceiveMessage");
var twiceWorkloadResult1 = workloadCompute.TwiceCompute(workload1, hospital, confs, cmis, conitem, true); var twiceWorkloadResult1 = workloadCompute.TwiceCompute(workload1, hospital, conitem, medicineProps, cmis, inclines, true);
twiceWorkloadResult1.Sheet.SheetType = SheetType.ComputeDoctorWorkload; twiceWorkloadResult1.Sheet.SheetType = SheetType.ComputeDoctorWorkload;
perSheet.Add(twiceWorkloadResult1.Sheet); perSheet.Add(twiceWorkloadResult1.Sheet);
...@@ -237,7 +234,7 @@ public void Save(List<PerSheet> perSheets, int allotId) ...@@ -237,7 +234,7 @@ public void Save(List<PerSheet> perSheets, int allotId)
//var onceWorkload2 = workloadCompute.OnceCompute(workload2); //var onceWorkload2 = workloadCompute.OnceCompute(workload2);
//护理组 二次计算 //护理组 二次计算
logManageService.WriteMsg("正在生成绩效", "护理组工作量计算", 1, allotid, "ReceiveMessage"); logManageService.WriteMsg("正在生成绩效", "护理组工作量计算", 1, allotid, "ReceiveMessage");
var twiceWorkloadResult2 = workloadCompute.TwiceCompute(workload2, hospital, confs, cmis, conitem); var twiceWorkloadResult2 = workloadCompute.TwiceCompute(workload2, hospital, conitem, medicineProps, cmis, inclines);
twiceWorkloadResult2.Sheet.SheetType = SheetType.ComputeNurseWorkload; twiceWorkloadResult2.Sheet.SheetType = SheetType.ComputeNurseWorkload;
perSheet.Add(twiceWorkloadResult2.Sheet); perSheet.Add(twiceWorkloadResult2.Sheet);
...@@ -305,7 +302,7 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot ...@@ -305,7 +302,7 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot
if (UnitType.医技组 == unitType && workDoctor == null) if (UnitType.医技组 == unitType && workDoctor == null)
workDoctor = info.Data.FirstOrDefault(t => t.UnitType == UnitType.医生组.ToString() && t.AccountingUnit == dept.AccountingUnit); workDoctor = info.Data.FirstOrDefault(t => t.UnitType == UnitType.医生组.ToString() && t.AccountingUnit == dept.AccountingUnit);
dept.MedicineFactor = workDoctor?.MedicineFactor; //dept.MedicineFactor = workDoctor?.MedicineFactor;
//dept.ScoringAverage = scoreAverage.HasValue ? scoreAverage ?? 0 : dept.ScoringAverage; //dept.ScoringAverage = scoreAverage.HasValue ? scoreAverage ?? 0 : dept.ScoringAverage;
dept.ScoringAverage = dept.ScoringAverage; dept.ScoringAverage = dept.ScoringAverage;
dept.AdjustFactor = (isBudget ? adjust : dept?.AdjustFactor) ?? 1; dept.AdjustFactor = (isBudget ? adjust : dept?.AdjustFactor) ?? 1;
...@@ -619,40 +616,59 @@ public IEnumerable<AccountUnitTotal> GetAccountScoreAverage(PerExcel excel, Shee ...@@ -619,40 +616,59 @@ public IEnumerable<AccountUnitTotal> GetAccountScoreAverage(PerExcel excel, Shee
/// </summary> /// </summary>
/// <param name="excel"></param> /// <param name="excel"></param>
/// <returns></returns> /// <returns></returns>
private List<CofDrugProp> GetDrugConfig(PerExcel excel, int allotid) private IEnumerable<CofDrugProp> GetFactors(PerExcel excel, SheetType sheetType)
{ {
//计算药占比 var perDatas = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.WorkloadMedicineProp)?.PerData.Select(w => (PerData)w);
List<CofDrugProp> cofs = new List<CofDrugProp>(); var factors = perDatas
?.Where(w => w.IsTotal == 1)
.Select(w => new CofDrugProp
{
AccountingUnit = w.AccountingUnit,
UnitType = w.UnitType,
Factor = w.CellValue ?? 1
});
return factors ?? new List<CofDrugProp>();
}
var incomeSheet = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.Income && t.SheetName.Contains("门诊") && t.SheetName.Contains("开单")); ///// <summary>
var datalist = incomeSheet.PerData.Select(t => (PerData)t); ///// 获取药占比分割比例
var drugtype = perforCofdrugtypeRepository.GetEntities(t => t.AllotID == allotid && t.ChargeType == "药费")?.Select(t => t.Charge).ToList(); ///// </summary>
///// <param name="excel"></param>
///// <returns></returns>
//private List<CofDrugProp> GetDrugConfig(PerExcel excel, int allotid)
//{
// //计算药占比
// List<CofDrugProp> cofs = new List<CofDrugProp>();
var drugData = datalist.Where(t => drugtype.Contains(t.TypeName)).GroupBy(t => t.AccountingUnit).Select(t => new { AccountingUnit = t.Key, SumValue = t.Sum(s => s.CellValue) }); // var incomeSheet = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.Income && t.SheetName.Contains("门诊") && t.SheetName.Contains("开单"));
if (drugtype == null) // var datalist = incomeSheet.PerData.Select(t => (PerData)t);
{ // var drugtype = perforCofdrugtypeRepository.GetEntities(t => t.AllotID == allotid && t.ChargeType == "药费")?.Select(t => t.Charge).ToList();
drugData = null;
//throw new PerformanceException("未配置药占比类型");
}
var allData = datalist.GroupBy(t => t.AccountingUnit).Select(t => new { AccountingUnit = t.Key, SumValue = t.Sum(s => s.CellValue) }); // var drugData = datalist.Where(t => drugtype.Contains(t.TypeName)).GroupBy(t => t.AccountingUnit).Select(t => new { AccountingUnit = t.Key, SumValue = t.Sum(s => s.CellValue) });
// if (drugtype == null)
// {
// drugData = null;
// //throw new PerformanceException("未配置药占比类型");
// }
var cofList = perforCofdrugpropRepository.GetEntities(t => t.AllotID == allotid); // var allData = datalist.GroupBy(t => t.AccountingUnit).Select(t => new { AccountingUnit = t.Key, SumValue = t.Sum(s => s.CellValue) });
if (cofList == null || !cofList.Any()) return cofs;
var unitList = (drugData?.Select(t => t.AccountingUnit) ?? new List<string>()).Union(allData.Select(t => t.AccountingUnit)); // var cofList = perforCofdrugpropRepository.GetEntities(t => t.AllotID == allotid);
// if (cofList == null || !cofList.Any()) return cofs;
foreach (var unit in unitList) // var unitList = (drugData?.Select(t => t.AccountingUnit) ?? new List<string>()).Union(allData.Select(t => t.AccountingUnit));
{
var dsv = drugData?.FirstOrDefault(t => t.AccountingUnit == unit)?.SumValue;
var asv = allData.FirstOrDefault(t => t.AccountingUnit == unit)?.SumValue;
var prop = asv.HasValue && asv.Value > 0 ? Math.Round((dsv ?? 0) / asv.Value, 2) : 0; // foreach (var unit in unitList)
var fvalue = cofList.FirstOrDefault(t => prop > t.MinRange && prop <= t.MaxRange)?.Value ?? 0; // {
cofs.Add(new CofDrugProp { AccoutingUnit = unit, Factor = fvalue, Prop = prop }); // var dsv = drugData?.FirstOrDefault(t => t.AccountingUnit == unit)?.SumValue;
} // var asv = allData.FirstOrDefault(t => t.AccountingUnit == unit)?.SumValue;
return cofs;
} // var prop = asv.HasValue && asv.Value > 0 ? Math.Round((dsv ?? 0) / asv.Value, 2) : 0;
// var fvalue = cofList.FirstOrDefault(t => prop > t.MinRange && prop <= t.MaxRange)?.Value ?? 0;
// cofs.Add(new CofDrugProp { AccoutingUnit = unit, Factor = fvalue, Prop = prop });
// }
// return cofs;
//}
#endregion compute #endregion compute
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Repository; using Performance.Repository;
using Performance.Services.AllotCompute; using Performance.Services.AllotCompute;
using Performance.Services.ExtractExcelService;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
...@@ -32,6 +33,9 @@ public class AllotService : IAutoInjection ...@@ -32,6 +33,9 @@ public class AllotService : IAutoInjection
private PerforPerallotRepository _allotRepository; private PerforPerallotRepository _allotRepository;
private IEmailService emailService; private IEmailService emailService;
private readonly IOptions<Application> options; private readonly IOptions<Application> options;
private readonly ComputeDirector _computeDirector;
private readonly PerforRescomputeRepository _perforRescomputeRepository;
private readonly PerforImemployeeRepository _perforImEmployeeRepository;
private PerforPeragainallotRepository _againallotRepository; private PerforPeragainallotRepository _againallotRepository;
private PerforLogcheckRepository perforLogcheckRepository; private PerforLogcheckRepository perforLogcheckRepository;
private readonly PerforHospitalRepository perforHospitalRepository; private readonly PerforHospitalRepository perforHospitalRepository;
...@@ -59,6 +63,9 @@ public class AllotService : IAutoInjection ...@@ -59,6 +63,9 @@ public class AllotService : IAutoInjection
IHostingEnvironment evn, ILogger<AllotService> logger, IHostingEnvironment evn, ILogger<AllotService> logger,
IEmailService emailService, IEmailService emailService,
IOptions<Application> options, IOptions<Application> options,
ComputeDirector computeDirector,
PerforRescomputeRepository perforRescomputeRepository,
PerforImemployeeRepository perforImEmployeeRepository,
PerforPeragainallotRepository againallotRepository, PerforPeragainallotRepository againallotRepository,
PerforLogcheckRepository perforLogcheckRepository, PerforLogcheckRepository perforLogcheckRepository,
PerforHospitalRepository perforHospitalRepository, PerforHospitalRepository perforHospitalRepository,
...@@ -83,6 +90,9 @@ public class AllotService : IAutoInjection ...@@ -83,6 +90,9 @@ public class AllotService : IAutoInjection
this.resultComputeService = resultComputeService; this.resultComputeService = resultComputeService;
this.emailService = emailService; this.emailService = emailService;
this.options = options; this.options = options;
_computeDirector = computeDirector;
_perforRescomputeRepository = perforRescomputeRepository;
_perforImEmployeeRepository = perforImEmployeeRepository;
this.configService = configService; this.configService = configService;
this.logdbug = logdbug; this.logdbug = logdbug;
this.perforresreservedRepository = perforresreservedRepository; this.perforresreservedRepository = perforresreservedRepository;
...@@ -314,6 +324,8 @@ public void Generate(per_allot allot, string mail) ...@@ -314,6 +324,8 @@ public void Generate(per_allot allot, string mail)
logManageService.WriteMsg("绩效开始执行", $"数据来源:用户上传的Excel。", 1, allot.ID, "ReceiveMessage", true); logManageService.WriteMsg("绩效开始执行", $"数据来源:用户上传的Excel。", 1, allot.ID, "ReceiveMessage", true);
configService.Clear(allot.ID); configService.Clear(allot.ID);
// 关闭筛选功能
ExtractHelper.CloseAutoFilter(allot.Path);
// 导出数据 // 导出数据
excel = importDataService.ReadDataAndSave(allot); excel = importDataService.ReadDataAndSave(allot);
...@@ -451,6 +463,45 @@ public void Generate(per_allot allot, string mail) ...@@ -451,6 +463,45 @@ public void Generate(per_allot allot, string mail)
} }
/// <summary> /// <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> /// </summary>
/// <param name="allot"></param> /// <param name="allot"></param>
......
...@@ -78,8 +78,13 @@ public bool SaveBudgetData(int mainYear, List<BudgetResponse> request, int userI ...@@ -78,8 +78,13 @@ public bool SaveBudgetData(int mainYear, List<BudgetResponse> request, int userI
if (amounts != null && perbudgetamountRepository.AddRange(amounts.ToArray())) if (amounts != null && perbudgetamountRepository.AddRange(amounts.ToArray()))
{ {
var ratios = Mapper.Map<List<per_budget_ratio>>(request.Where(t => t.Type == 2)); 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 => ratios.ForEach(t =>
{ {
t.HospitalRevenue = budgetData?.HospitalRevenue;
t.MeritPayIncrement = budgetData?.MeritPayIncrement;
t.TheDrugIncomeBudget = budgetData?.TheDrugIncomeBudget;
t.MaterialIncomeBudget = budgetData?.MaterialIncomeBudget;
t.MainYear = mainYear; t.MainYear = mainYear;
t.CreateTime = DateTime.Now; t.CreateTime = DateTime.Now;
t.CreateUser = userId; t.CreateUser = userId;
...@@ -136,19 +141,20 @@ public bool ModifyBudgetData(List<BudgetResponse> request) ...@@ -136,19 +141,20 @@ public bool ModifyBudgetData(List<BudgetResponse> request)
foreach (var item in ratios) foreach (var item in ratios)
{ {
var data = request.FirstOrDefault(t => t.Type == 2 && t.Id == item.Id); var data = request.FirstOrDefault(t => t.Type == 2 && t.Id == item.Id);
var budgetData = request.FirstOrDefault(t => t.Type == 2);
if (data == null) continue; if (data == null) continue;
item.HospitalRevenue = data.HospitalRevenue; item.HospitalRevenue = data.HospitalRevenue == 0 ? budgetData?.HospitalRevenue:data.HospitalRevenue;
item.TotalLaborCost = data.TotalLaborCost; item.TotalLaborCost = data.TotalLaborCost;
item.StaffSpendingFixed = data.StaffSpendingFixed; item.StaffSpendingFixed = data.StaffSpendingFixed;
item.StaffSpendingBonus = data.StaffSpendingBonus; item.StaffSpendingBonus = data.StaffSpendingBonus;
item.MeritPayIncrement = data.MeritPayIncrement; item.MeritPayIncrement = data.MeritPayIncrement==0?budgetData?.MeritPayIncrement:data.MeritPayIncrement;
item.TotalMeritPay = data.TotalMeritPay; item.TotalMeritPay = data.TotalMeritPay;
item.Amplification = data.Amplification; item.Amplification = data.Amplification;
item.IncrementCapitaRatio = data.IncrementCapitaRatio; item.IncrementCapitaRatio = data.IncrementCapitaRatio;
item.TheDrugIncome = data.TheDrugIncome; item.TheDrugIncome = data.TheDrugIncome;
item.TheDrugIncomeBudget = data.TheDrugIncomeBudget; item.TheDrugIncomeBudget = data.TheDrugIncomeBudget==0?budgetData?.TheDrugIncomeBudget:data.TheDrugIncomeBudget;
item.MaterialIncome = data.MaterialIncome; item.MaterialIncome = data.MaterialIncome;
item.MaterialIncomeBudget = data.MaterialIncomeBudget; item.MaterialIncomeBudget = data.MaterialIncomeBudget==0?budgetData?.MaterialIncomeBudget:data.MaterialIncomeBudget;
item.TheCostInTotal = data.TheCostInTotal; item.TheCostInTotal = data.TheCostInTotal;
item.DepreOfFixedAssets = data.DepreOfFixedAssets; item.DepreOfFixedAssets = data.DepreOfFixedAssets;
item.AmortOfIntangibleAssets = data.AmortOfIntangibleAssets; item.AmortOfIntangibleAssets = data.AmortOfIntangibleAssets;
......
...@@ -7,9 +7,12 @@ ...@@ -7,9 +7,12 @@
using Performance.Repository; using Performance.Repository;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Text; using System.Text;
using Google.Protobuf.WellKnownTypes;
using HandsonRowData = Performance.DtoModels.HandsonRowData;
namespace Performance.Services namespace Performance.Services
{ {
...@@ -26,6 +29,8 @@ public class CollectService : IAutoInjection ...@@ -26,6 +29,8 @@ public class CollectService : IAutoInjection
private readonly PerforCollectdataRepository perforcollectdataRepository; private readonly PerforCollectdataRepository perforcollectdataRepository;
private readonly PerforCollectpermissionRepository perforcollectpermissionRepository; private readonly PerforCollectpermissionRepository perforcollectpermissionRepository;
private readonly PerforUserroleRepository userroleRepository; private readonly PerforUserroleRepository userroleRepository;
private readonly PerforImaccountbasicRepository perforImaccountbasicRepository;
private readonly SheetSevice sheetSevice;
private readonly Application options; private readonly Application options;
public CollectService( public CollectService(
...@@ -40,6 +45,8 @@ public class CollectService : IAutoInjection ...@@ -40,6 +45,8 @@ public class CollectService : IAutoInjection
PerforCollectdataRepository perforcollectdataRepository, PerforCollectdataRepository perforcollectdataRepository,
PerforCollectpermissionRepository perforcollectpermissionRepository, PerforCollectpermissionRepository perforcollectpermissionRepository,
PerforUserroleRepository userroleRepository, PerforUserroleRepository userroleRepository,
PerforImaccountbasicRepository perforImaccountbasicRepository,
SheetSevice sheetSevice,
IOptions<Application> options) IOptions<Application> options)
{ {
this.userRepository = userRepository; this.userRepository = userRepository;
...@@ -53,6 +60,8 @@ public class CollectService : IAutoInjection ...@@ -53,6 +60,8 @@ public class CollectService : IAutoInjection
this.perforcollectdataRepository = perforcollectdataRepository; this.perforcollectdataRepository = perforcollectdataRepository;
this.perforcollectpermissionRepository = perforcollectpermissionRepository; this.perforcollectpermissionRepository = perforcollectpermissionRepository;
this.userroleRepository = userroleRepository; this.userroleRepository = userroleRepository;
this.perforImaccountbasicRepository = perforImaccountbasicRepository;
this.sheetSevice = sheetSevice;
this.options = options.Value; this.options = options.Value;
} }
...@@ -220,7 +229,7 @@ private IEnumerable<collect_permission> GetCollectSheetByAllot(int hospitalId, i ...@@ -220,7 +229,7 @@ private IEnumerable<collect_permission> GetCollectSheetByAllot(int hospitalId, i
var types = new[] { (int)SheetType.Employee, (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload, var types = new[] { (int)SheetType.Employee, (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload,
(int)SheetType.ClinicEmployee, (int)SheetType.AccountExtra, (int)SheetType.PersonExtra, (int)SheetType.LogisticsEmployee, (int)SheetType.ClinicEmployee, (int)SheetType.AccountExtra, (int)SheetType.PersonExtra, (int)SheetType.LogisticsEmployee,
(int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess, (int)SheetType.AccountScoreAverage, (int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess, (int)SheetType.AccountScoreAverage,
(int)SheetType.BudgetRatio, (int)SheetType.AssessBeforeOtherFee }; (int)SheetType.BudgetRatio, (int)SheetType.AssessBeforeOtherFee,(int)SheetType.AccountBasic };
var sheets = perforPersheetRepository.GetEntities(w => w.AllotID == allot.ID && types.Contains((w.SheetType ?? 0))); var sheets = perforPersheetRepository.GetEntities(w => w.AllotID == allot.ID && types.Contains((w.SheetType ?? 0)));
var headers = perforImheaderRepository.GetEntities(w => w.AllotID == allot.ID); var headers = perforImheaderRepository.GetEntities(w => w.AllotID == allot.ID);
...@@ -296,7 +305,7 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName) ...@@ -296,7 +305,7 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
var types = new[] { (int)SheetType.Employee, (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload, var types = new[] { (int)SheetType.Employee, (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload,
(int)SheetType.ClinicEmployee, (int)SheetType.AccountExtra, (int)SheetType.PersonExtra, (int)SheetType.LogisticsEmployee, (int)SheetType.ClinicEmployee, (int)SheetType.AccountExtra, (int)SheetType.PersonExtra, (int)SheetType.LogisticsEmployee,
(int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess, (int)SheetType.AccountScoreAverage, (int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess, (int)SheetType.AccountScoreAverage,
(int)SheetType.BudgetRatio, (int)SheetType.AssessBeforeOtherFee }; (int)SheetType.BudgetRatio, (int)SheetType.AssessBeforeOtherFee,(int)SheetType.AccountBasic};
var sheet = perforPersheetRepository var sheet = perforPersheetRepository
.GetEntity(w => w.AllotID == allot.ID && w.SheetName == sheetName && types.Contains((w.SheetType ?? 0))); .GetEntity(w => w.AllotID == allot.ID && w.SheetName == sheetName && types.Contains((w.SheetType ?? 0)));
...@@ -325,6 +334,8 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName) ...@@ -325,6 +334,8 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
config = CollectDataConfig.LogisticsEmployee; config = CollectDataConfig.LogisticsEmployee;
else if (sheet.SheetType == (int)SheetType.PersonExtra) else if (sheet.SheetType == (int)SheetType.PersonExtra)
config = CollectDataConfig.PersonExtra; config = CollectDataConfig.PersonExtra;
else if (sheet.SheetType == (int)SheetType.AccountBasic)
config = CollectDataConfig.AccountBasic;
else else
config = CollectDataConfig.Default; config = CollectDataConfig.Default;
...@@ -354,6 +365,8 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName) ...@@ -354,6 +365,8 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
rowDatas = GetClinicEmployee(sheet); rowDatas = GetClinicEmployee(sheet);
else if (sheet.SheetType == (int)SheetType.LogisticsEmployee) else if (sheet.SheetType == (int)SheetType.LogisticsEmployee)
rowDatas = GetLogisticsEmployee(sheet); rowDatas = GetLogisticsEmployee(sheet);
else if (sheet.SheetType == (int)SheetType.AccountBasic)
rowDatas = GetAccountBasic(sheet);
else else
rowDatas = GetCommonData(sheet); rowDatas = GetCommonData(sheet);
} }
...@@ -384,12 +397,21 @@ private List<HandsonRowData> GetCommonData(per_sheet sheet) ...@@ -384,12 +397,21 @@ private List<HandsonRowData> GetCommonData(per_sheet sheet)
var units = rowdata.Where(w => w.UnitType.HasValue).Select(w => new { w.UnitType, w.AccountingUnit }).Distinct(); var units = rowdata.Where(w => w.UnitType.HasValue).Select(w => new { w.UnitType, w.AccountingUnit }).Distinct();
foreach (var item in units) foreach (var item in units)
{ {
if ((new[] { (int)UnitType.医生组, (int)UnitType.其他医生组 }).Contains(item.UnitType.Value)) if ((new[] {(int) UnitType.医生组, (int) UnitType.其他医生组}).Contains(item.UnitType.Value))
{
setdata.Add(new HandsonCellData("核算单元(医生组)", item.AccountingUnit)); setdata.Add(new HandsonCellData("核算单元(医生组)", item.AccountingUnit));
else if ((new[] { (int)UnitType.医技组, (int)UnitType.其他医技组 }).Contains(item.UnitType.Value)) GetUnitClassification(setdata,UnitType.医生组,sheet);
}
else if ((new[] {(int) UnitType.医技组, (int) UnitType.其他医技组}).Contains(item.UnitType.Value))
{
setdata.Add(new HandsonCellData("核算单元(医技组)", item.AccountingUnit)); setdata.Add(new HandsonCellData("核算单元(医技组)", item.AccountingUnit));
else if ((new[] { (int)UnitType.护理组, (int)UnitType.其他护理组 }).Contains(item.UnitType.Value)) GetUnitClassification(setdata,UnitType.医技组,sheet);
}
else if ((new[] {(int) UnitType.护理组, (int) UnitType.其他护理组}).Contains(item.UnitType.Value))
{
setdata.Add(new HandsonCellData("核算单元(护理组)", item.AccountingUnit)); setdata.Add(new HandsonCellData("核算单元(护理组)", item.AccountingUnit));
GetUnitClassification(setdata,UnitType.护理组,sheet);
}
setdata.Add(new HandsonCellData("核算单元", item.AccountingUnit)); setdata.Add(new HandsonCellData("核算单元", item.AccountingUnit));
} }
if (sheet.SheetType == (int)SheetType.PersonExtra) if (sheet.SheetType == (int)SheetType.PersonExtra)
...@@ -443,7 +465,64 @@ private HandsonRowData CreateRowData(int row, ColumnInfo[] columns, SortedDictio ...@@ -443,7 +465,64 @@ private HandsonRowData CreateRowData(int row, ColumnInfo[] columns, SortedDictio
var setdata = from cfg in columns var setdata = from cfg in columns
join d in dic.Keys on cfg.Field.ToUpper() equals d.ToUpper() join d in dic.Keys on cfg.Field.ToUpper() equals d.ToUpper()
select new HandsonCellData(cfg.Description, dic[d]); select new HandsonCellData(cfg.Description, dic[d]);
return new HandsonRowData(row, setdata); var xx = new HandsonRowData(row, setdata);
return xx;
}
private List<HandsonRowData> GetAccountBasic(per_sheet sheet)
{
//var accounts = sheetSevice.SheetExport(sheet.ID);
var result = new List<HandsonRowData>();
var groupAccount = perforImdataRepository.GetEntities(t => t.SheetID == sheet.ID); //.OrderBy(c=>c.RowNumber).GroupBy(c => c.RowNumber);
if (groupAccount != null && groupAccount.Any())
{
foreach (var rowNumber in groupAccount.Select(t=>t.RowNumber).Distinct())
{
var numberData = groupAccount.Where(t => t.RowNumber == rowNumber);
var accountUnit = new HandsonCellData("核算单元",numberData.First().AccountingUnit);
var data = numberData?.Select(t => new HandsonCellData(t.TypeName, t.CellValue)).ToList();
data.Add(accountUnit);
switch (numberData.First().UnitType)
{
case (int)UnitType.医技组:
var unitType = new HandsonCellData("核算单元类型", UnitType.医技组);
data.Add(unitType);
break;
case (int)UnitType.医生组:
unitType = new HandsonCellData("核算单元类型", UnitType.医生组);
data.Add(unitType);
break;
case (int)UnitType.护理组:
unitType = new HandsonCellData("核算单元类型", UnitType.护理组);
data.Add(unitType);
break;
case (int)UnitType.特殊核算组:
unitType = new HandsonCellData("核算单元类型", UnitType.特殊核算组);
data.Add(unitType);
break;
}
var rowData = new HandsonRowData(rowNumber.Value,data);
result.Add(rowData);
}
//var temps = accounts.Row.Select(item => new { row = item.Rownumber, dic = JsonHelper.Deserialize(item) });
//return new List<HandsonRowData>(temps.Select(temp => CreateRowData(temp.row, ExcelReadConfig.AccountBaisc, temp.dic)));
}
return result;
}
private void GetUnitClassification(List<HandsonCellData> setdata,UnitType unitType,per_sheet sheet)
{
if (sheet.SheetType == (int)SheetType.AccountExtra)
setdata.Add(new HandsonCellData("核算组别", unitType));
else if (sheet.SheetType == (int)SheetType.PersonExtra)
setdata.Add(new HandsonCellData("核算单元分类", unitType));
else if (sheet.SheetType == (int)SheetType.BudgetRatio)
setdata.Add(new HandsonCellData("核算单元类型", unitType));
} }
#endregion 加载采集内容 #endregion 加载采集内容
...@@ -579,6 +658,15 @@ public class CollectDataConfig ...@@ -579,6 +658,15 @@ public class CollectDataConfig
{ nameof(collect_data.EmployeeName), "医生姓名" }, { nameof(collect_data.EmployeeName), "医生姓名" },
}; };
public static Dictionary<string, string> AccountBasic { get; } = new Dictionary<string, string>
{
{ nameof(collect_data.UnitType), "核算单元分类" },
{ nameof(collect_data.AccountingUnitDoctor), "核算单元" },
{ nameof(collect_data.Department), "核算单元" },
{ nameof(collect_data.JobNumber), "人员工号" },
{ nameof(collect_data.EmployeeName), "医生姓名" },
};
public static Dictionary<string, string> Default { get; } = new Dictionary<string, string> public static Dictionary<string, string> Default { get; } = new Dictionary<string, string>
{ {
{ nameof(collect_data.UnitType), "核算单元分类" }, { nameof(collect_data.UnitType), "核算单元分类" },
......
using AutoMapper; using AutoMapper;
using NPOI.SS.Formula.Functions;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.EntityModels; using Performance.EntityModels;
using Performance.Infrastructure; using Performance.Infrastructure;
...@@ -7,7 +6,6 @@ ...@@ -7,7 +6,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace Performance.Services namespace Performance.Services
...@@ -28,7 +26,6 @@ public class ComputeService : IAutoInjection ...@@ -28,7 +26,6 @@ public class ComputeService : IAutoInjection
private readonly PerforPerallotRepository perforPerallotRepository; private readonly PerforPerallotRepository perforPerallotRepository;
private readonly PerforHospitalRepository hospitalRepository; private readonly PerforHospitalRepository hospitalRepository;
private readonly PerforPerapramountRepository perapramountRepository; private readonly PerforPerapramountRepository perapramountRepository;
private readonly PerforCofcmiRepository cofcmiRepository;
private readonly PerforPeremployeeRepository perforPeremployeeRepository; private readonly PerforPeremployeeRepository perforPeremployeeRepository;
private readonly PerforCofworkitemRepository cofworkitemRepository; private readonly PerforCofworkitemRepository cofworkitemRepository;
...@@ -46,7 +43,6 @@ public class ComputeService : IAutoInjection ...@@ -46,7 +43,6 @@ public class ComputeService : IAutoInjection
PerforPerallotRepository perforPerallotRepository, PerforPerallotRepository perforPerallotRepository,
PerforHospitalRepository hospitalRepository, PerforHospitalRepository hospitalRepository,
PerforPerapramountRepository perapramountRepository, PerforPerapramountRepository perapramountRepository,
PerforCofcmiRepository cofcmiRepository,
PerforPeremployeeRepository perforPeremployeeRepository, PerforPeremployeeRepository perforPeremployeeRepository,
PerforCofworkitemRepository cofworkitemRepository) PerforCofworkitemRepository cofworkitemRepository)
{ {
...@@ -64,7 +60,6 @@ public class ComputeService : IAutoInjection ...@@ -64,7 +60,6 @@ public class ComputeService : IAutoInjection
this.perforPerallotRepository = perforPerallotRepository; this.perforPerallotRepository = perforPerallotRepository;
this.hospitalRepository = hospitalRepository; this.hospitalRepository = hospitalRepository;
this.perapramountRepository = perapramountRepository; this.perapramountRepository = perapramountRepository;
this.cofcmiRepository = cofcmiRepository;
this.perforPeremployeeRepository = perforPeremployeeRepository; this.perforPeremployeeRepository = perforPeremployeeRepository;
this.cofworkitemRepository = cofworkitemRepository; this.cofworkitemRepository = cofworkitemRepository;
} }
...@@ -763,7 +758,7 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId) ...@@ -763,7 +758,7 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
{ {
(int)SheetType.Income, (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload, (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.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 = ""; int groupbasis = 1; string single = "";
...@@ -791,15 +786,20 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId) ...@@ -791,15 +786,20 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
continue; continue;
var workitems = cofworkitemRepository.GetEntities(t => t.AllotID == account.AllotID); 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) foreach (var dto in items)
{ {
if (workitems != null && workitems.Any(a => a.Type == 1 && a.Item == dto.ItemName)) if (workitems != null && workitems.Any(a => a.Type == 1 && a.Item == dto.ItemName) && medicineFactor != null)
dto.MediFactor = account.MedicineFactor; dto.MediFactor = medicineFactor;
if (workitems != null && workitems.Any(a => a.Type == 2 && a.Item == dto.ItemName) && allotCmi != null) if (workitems != null && workitems.Any(a => a.Type == 2 && a.Item == dto.ItemName) && cmiFactor != null)
dto.CMIFactor = allotCmi.Value; dto.CMIFactor = cmiFactor;
dto.ItemValue = dto.ItemValue * (dto.MediFactor ?? 1) * (dto.CMIFactor ?? 1); 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) ...@@ -818,6 +818,14 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
//return deptDetails; //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) 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; var sheettype = 1;
...@@ -879,7 +887,7 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId) ...@@ -879,7 +887,7 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
SheetType[] pairs = new SheetType[] SheetType[] pairs = new SheetType[]
{ {
SheetType.AccountExtra, SheetType.AccountDrugAssess, SheetType.AccountMaterialsAssess, SheetType.AccountScoreAverage, SheetType.AccountAdjustLaterOtherFee, SheetType.AccountExtra, SheetType.AccountDrugAssess, SheetType.AccountMaterialsAssess, SheetType.AccountScoreAverage, SheetType.AccountAdjustLaterOtherFee,
SheetType.AssessBeforeOtherFee, SheetType.BudgetRatio SheetType.AssessBeforeOtherFee, SheetType.BudgetRatio,
}; };
if (pairs.Contains((SheetType)sheet.SheetType)) if (pairs.Contains((SheetType)sheet.SheetType))
{ {
...@@ -993,6 +1001,7 @@ private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details ...@@ -993,6 +1001,7 @@ private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details
Factor = t.Factor, Factor = t.Factor,
MediFactor = t.MediFactor, MediFactor = t.MediFactor,
CMIFactor = t.CMIFactor, CMIFactor = t.CMIFactor,
InclineFactor = t.InclineFactor,
}).ToList(); }).ToList();
} }
} }
......
...@@ -16,7 +16,7 @@ public class ConfigService : IAutoInjection ...@@ -16,7 +16,7 @@ public class ConfigService : IAutoInjection
{ {
#region #region
private PerforCofdirectorRepository _directorRepository; private PerforCofdirectorRepository _directorRepository;
private PerforCofdrugpropRepository _drugpropRepository; //private PerforCofdrugpropRepository _drugpropRepository;
private PerforCofworkitemRepository _workitemRepository; private PerforCofworkitemRepository _workitemRepository;
private PerforCofagainRepository _againRepository; private PerforCofagainRepository _againRepository;
private PerforCofdrugtypeRepository _drugtypeRepository; private PerforCofdrugtypeRepository _drugtypeRepository;
...@@ -26,13 +26,13 @@ public class ConfigService : IAutoInjection ...@@ -26,13 +26,13 @@ public class ConfigService : IAutoInjection
private PerforImheaderRepository perforImheaderRepository; private PerforImheaderRepository perforImheaderRepository;
private PerforCofdepttypeRepository perforCofdepttypeRepository; private PerforCofdepttypeRepository perforCofdepttypeRepository;
private PerforPerapramountRepository perapramountRepository; private PerforPerapramountRepository perapramountRepository;
private PerforCofcmiRepository perforCofcmiRepository; //private PerforCofcmiRepository perforCofcmiRepository;
private PersonService personService; private PersonService personService;
private LogManageService logManageService; private LogManageService logManageService;
private ILogger<ConfigService> logger; private ILogger<ConfigService> logger;
public ConfigService(PerforCofdirectorRepository cofdirectorRepository, public ConfigService(PerforCofdirectorRepository cofdirectorRepository,
PerforCofdrugpropRepository cofdrugpropRepository, //PerforCofdrugpropRepository cofdrugpropRepository,
PerforCofagainRepository againRepository, PerforCofagainRepository againRepository,
PerforCofdrugtypeRepository drugtypeRepository, PerforCofdrugtypeRepository drugtypeRepository,
PerforPerallotRepository perforPerAllotRepository, PerforPerallotRepository perforPerAllotRepository,
...@@ -42,13 +42,13 @@ public class ConfigService : IAutoInjection ...@@ -42,13 +42,13 @@ public class ConfigService : IAutoInjection
PerforImheaderRepository perforImheaderRepository, PerforImheaderRepository perforImheaderRepository,
PerforCofdepttypeRepository perforCofdepttypeRepository, PerforCofdepttypeRepository perforCofdepttypeRepository,
PerforPerapramountRepository perapramountRepository, PerforPerapramountRepository perapramountRepository,
PerforCofcmiRepository perforCofcmiRepository, //PerforCofcmiRepository perforCofcmiRepository,
PersonService personService, PersonService personService,
LogManageService logManageService, LogManageService logManageService,
ILogger<ConfigService> logger) ILogger<ConfigService> logger)
{ {
this._directorRepository = cofdirectorRepository; this._directorRepository = cofdirectorRepository;
this._drugpropRepository = cofdrugpropRepository; //this._drugpropRepository = cofdrugpropRepository;
this._workitemRepository = workitemRepository; this._workitemRepository = workitemRepository;
this._againRepository = againRepository; this._againRepository = againRepository;
this._drugtypeRepository = drugtypeRepository; this._drugtypeRepository = drugtypeRepository;
...@@ -58,7 +58,7 @@ public class ConfigService : IAutoInjection ...@@ -58,7 +58,7 @@ public class ConfigService : IAutoInjection
this.perforImheaderRepository = perforImheaderRepository; this.perforImheaderRepository = perforImheaderRepository;
this.perforCofdepttypeRepository = perforCofdepttypeRepository; this.perforCofdepttypeRepository = perforCofdepttypeRepository;
this.perapramountRepository = perapramountRepository; this.perapramountRepository = perapramountRepository;
this.perforCofcmiRepository = perforCofcmiRepository; //this.perforCofcmiRepository = perforCofcmiRepository;
this.personService = personService; this.personService = personService;
this.logManageService = logManageService; this.logManageService = logManageService;
this.logger = logger; this.logger = logger;
...@@ -249,62 +249,62 @@ public class ConfigService : IAutoInjection ...@@ -249,62 +249,62 @@ public class ConfigService : IAutoInjection
#region cof_drugprop 药占比系数配置 #region cof_drugprop 药占比系数配置
/// <summary> ///// <summary>
/// 获取cof_drugprop列表 ///// 获取cof_drugprop列表
/// </summary> ///// </summary>
/// <returns></returns> ///// <returns></returns>
public List<DrugpropResponse> GetDrugList(int allotId) //public List<DrugpropResponse> GetDrugList(int allotId)
{ //{
var list = _drugpropRepository.GetEntities(t => t.AllotID == allotId); // var list = _drugpropRepository.GetEntities(t => t.AllotID == allotId);
return Mapper.Map<List<DrugpropResponse>>(list); // return Mapper.Map<List<DrugpropResponse>>(list);
} //}
/// <summary> ///// <summary>
/// 添加数据 ///// 添加数据
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
public DrugpropResponse DrugInsert(DrugpropRequest request) //public DrugpropResponse DrugInsert(DrugpropRequest request)
{ //{
var drugprop = Mapper.Map<cof_drugprop>(request); // var drugprop = Mapper.Map<cof_drugprop>(request);
if (!_drugpropRepository.Add(drugprop)) // if (!_drugpropRepository.Add(drugprop))
throw new PerformanceException("保存失败"); // throw new PerformanceException("保存失败");
return Mapper.Map<DrugpropResponse>(drugprop); // return Mapper.Map<DrugpropResponse>(drugprop);
} //}
/// <summary> ///// <summary>
/// 更新数据 ///// 更新数据
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
public DrugpropResponse DrugUpdate(DrugpropRequest request) //public DrugpropResponse DrugUpdate(DrugpropRequest request)
{ //{
var drugprop = _drugpropRepository.GetEntity(t => t.ID == request.ID); // var drugprop = _drugpropRepository.GetEntity(t => t.ID == request.ID);
if (null == drugprop) // if (null == drugprop)
throw new PerformanceException($"ID不存在 :{request.ID}"); // throw new PerformanceException($"ID不存在 :{request.ID}");
drugprop.MaxRange = request.MaxRange; // drugprop.MaxRange = request.MaxRange;
drugprop.MinRange = request.MinRange; // drugprop.MinRange = request.MinRange;
drugprop.Value = request.Value; // drugprop.Value = request.Value;
if (!_drugpropRepository.Update(drugprop)) // if (!_drugpropRepository.Update(drugprop))
throw new PerformanceException("保存失败"); // throw new PerformanceException("保存失败");
return Mapper.Map<DrugpropResponse>(drugprop); // return Mapper.Map<DrugpropResponse>(drugprop);
} //}
/// <summary> ///// <summary>
/// 删除数据 ///// 删除数据
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
public bool DrugDelete(DrugpropRequest request) //public bool DrugDelete(DrugpropRequest request)
{ //{
var drugprop = _drugpropRepository.GetEntity(t => t.ID == request.ID); // var drugprop = _drugpropRepository.GetEntity(t => t.ID == request.ID);
if (null == drugprop) // if (null == drugprop)
throw new PerformanceException($"ID不存在 :{request.ID}"); // throw new PerformanceException($"ID不存在 :{request.ID}");
return _drugpropRepository.Remove(drugprop); // return _drugpropRepository.Remove(drugprop);
} //}
#endregion #endregion
...@@ -381,7 +381,10 @@ public bool DrugtypeDelete(DrugpropRequest request) ...@@ -381,7 +381,10 @@ public bool DrugtypeDelete(DrugpropRequest request)
/// <returns></returns> /// <returns></returns>
public List<cof_workitem> GetWorkItems(int allotId, int type) public List<cof_workitem> GetWorkItems(int allotId, int type)
{ {
var list = _workitemRepository.GetEntities(t => t.AllotID == allotId && t.Type == type); var list = (type > 0)
? _workitemRepository.GetEntities(t => t.AllotID == allotId && t.Type == type)
: _workitemRepository.GetEntities(t => t.AllotID == allotId);
return Mapper.Map<List<cof_workitem>>(list); return Mapper.Map<List<cof_workitem>>(list);
} }
...@@ -410,6 +413,7 @@ public cof_workitem WorkItemUpdate(WorkItemRequest request) ...@@ -410,6 +413,7 @@ public cof_workitem WorkItemUpdate(WorkItemRequest request)
throw new PerformanceException($"ID不存在 :{request.ID}"); throw new PerformanceException($"ID不存在 :{request.ID}");
workyear.Item = request.Item; workyear.Item = request.Item;
workyear.Type = request.Type;
if (!_workitemRepository.Update(workyear)) if (!_workitemRepository.Update(workyear))
throw new PerformanceException("保存失败"); throw new PerformanceException("保存失败");
...@@ -499,61 +503,61 @@ public bool DepttypeDelete(DrugpropRequest request) ...@@ -499,61 +503,61 @@ public bool DepttypeDelete(DrugpropRequest request)
#region cof_cmi cmi #region cof_cmi cmi
/// <summary> ///// <summary>
/// 获取 CMI配置 ///// 获取 CMI配置
/// </summary> ///// </summary>
/// <returns></returns> ///// <returns></returns>
public List<cof_cmi> GetCMIList(int allotId) //public List<cof_cmi> GetCMIList(int allotId)
{ //{
var list = perforCofcmiRepository.GetEntities(t => t.AllotId == allotId); // var list = perforCofcmiRepository.GetEntities(t => t.AllotId == allotId);
return list; // return list;
} //}
/// <summary> ///// <summary>
/// 添加 CMI配置 ///// 添加 CMI配置
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
public cof_cmi HosCMIInsert(cof_cmi request) //public cof_cmi HosCMIInsert(cof_cmi request)
{ //{
if (!perforCofcmiRepository.Add(request)) // if (!perforCofcmiRepository.Add(request))
throw new PerformanceException("保存失败"); // throw new PerformanceException("保存失败");
return request; // return request;
} //}
/// <summary> ///// <summary>
/// 更新 CMI配置 ///// 更新 CMI配置
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
public cof_cmi HosCMIUpdate(cof_cmi request) //public cof_cmi HosCMIUpdate(cof_cmi request)
{ //{
var entity = perforCofcmiRepository.GetEntity(t => t.Id == request.Id); // var entity = perforCofcmiRepository.GetEntity(t => t.Id == request.Id);
if (null == entity) // if (null == entity)
throw new PerformanceException($"ID不存在 :{request.Id}"); // throw new PerformanceException($"ID不存在 :{request.Id}");
entity.UnitType = request.UnitType; // entity.UnitType = request.UnitType;
entity.AccountingUnit = request.AccountingUnit; // entity.AccountingUnit = request.AccountingUnit;
entity.Value = request.Value; // entity.Value = request.Value;
if (!perforCofcmiRepository.Update(entity)) // if (!perforCofcmiRepository.Update(entity))
throw new PerformanceException("保存失败"); // throw new PerformanceException("保存失败");
return entity; // return entity;
} //}
/// <summary> ///// <summary>
/// 删除 CMI配置 ///// 删除 CMI配置
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
public bool HosCMIDelete(cof_cmi request) //public bool HosCMIDelete(cof_cmi request)
{ //{
var entity = perforCofcmiRepository.GetEntity(t => t.Id == request.Id); // var entity = perforCofcmiRepository.GetEntity(t => t.Id == request.Id);
if (null == entity) // if (null == entity)
throw new PerformanceException($"ID不存在 :{request.Id}"); // throw new PerformanceException($"ID不存在 :{request.Id}");
return perforCofcmiRepository.Remove(entity); // return perforCofcmiRepository.Remove(entity);
} //}
#endregion #endregion
...@@ -642,7 +646,7 @@ public void Copy(per_allot allot) ...@@ -642,7 +646,7 @@ public void Copy(per_allot allot)
personService.CreateAllotPersons(allot.HospitalId, allot.ID, allotId); personService.CreateAllotPersons(allot.HospitalId, allot.ID, allotId);
CopyCMIData(allotId, allot.ID); //CopyCMIData(allotId, allot.ID);
#region 弃用 #region 弃用
...@@ -678,17 +682,17 @@ public void Copy(per_allot allot) ...@@ -678,17 +682,17 @@ public void Copy(per_allot allot)
#endregion #endregion
logger.LogInformation($"orgDurgprop"); //logger.LogInformation($"orgDurgprop");
var orgDurgprop = _drugpropRepository.GetEntities(t => t.AllotID == allot.ID); //var orgDurgprop = _drugpropRepository.GetEntities(t => t.AllotID == allot.ID);
if (orgDurgprop == null || orgDurgprop.Count == 0) //if (orgDurgprop == null || orgDurgprop.Count == 0)
{ //{
var durgprop = _drugpropRepository.GetEntities(t => t.AllotID == allotId) ?? _drugpropRepository.GetEntities(t => t.AllotID == -1); // var durgprop = _drugpropRepository.GetEntities(t => t.AllotID == allotId) ?? _drugpropRepository.GetEntities(t => t.AllotID == -1);
var newDurgprops = durgprop?.Select(t => new cof_drugprop { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = t.Value }); // var newDurgprops = durgprop?.Select(t => new cof_drugprop { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = t.Value });
//if (hospital != null && hospital?.IsOpenDrugprop == 2) // //if (hospital != null && hospital?.IsOpenDrugprop == 2)
// newDurgprops = new List<cof_drugprop> { new cof_drugprop { AllotID = allot.ID, MaxRange = 1000, MinRange = 0, Value = 1 } }; // // newDurgprops = new List<cof_drugprop> { new cof_drugprop { AllotID = allot.ID, MaxRange = 1000, MinRange = 0, Value = 1 } };
if (durgprop != null && durgprop.Any()) // if (durgprop != null && durgprop.Any())
_drugpropRepository.AddRange(newDurgprops.ToArray()); // _drugpropRepository.AddRange(newDurgprops.ToArray());
} //}
logger.LogInformation($"workItem"); logger.LogInformation($"workItem");
var workItem = _workitemRepository.GetEntities(t => t.AllotID == allot.ID); var workItem = _workitemRepository.GetEntities(t => t.AllotID == allot.ID);
...@@ -697,7 +701,7 @@ public void Copy(per_allot allot) ...@@ -697,7 +701,7 @@ public void Copy(per_allot allot)
workItem = _workitemRepository.GetEntities(t => t.AllotID == allotId); workItem = _workitemRepository.GetEntities(t => t.AllotID == allotId);
if (workItem != null && workItem.Count > 0) if (workItem != null && workItem.Count > 0)
{ {
var newWorkItem = workItem.Select(t => new cof_workitem { AllotID = allot.ID, Item = t.Item }); var newWorkItem = workItem.Select(t => new cof_workitem { AllotID = allot.ID, Type = t.Type, Item = t.Item });
_workitemRepository.AddRange(newWorkItem.ToArray()); _workitemRepository.AddRange(newWorkItem.ToArray());
} }
} }
...@@ -830,35 +834,35 @@ private void CopyAprData(int prevAllotId, int allotId) ...@@ -830,35 +834,35 @@ private void CopyAprData(int prevAllotId, int allotId)
} }
} }
/// <summary> ///// <summary>
/// CMI值 ///// CMI值
/// </summary> ///// </summary>
/// <param name="prevAllotId"></param> ///// <param name="prevAllotId"></param>
/// <param name="allotId"></param> ///// <param name="allotId"></param>
private void CopyCMIData(int prevAllotId, int allotId) //private void CopyCMIData(int prevAllotId, int allotId)
{ //{
if (prevAllotId == 0) return; // if (prevAllotId == 0) return;
var list = perforCofcmiRepository.GetEntities(t => new List<int> { prevAllotId, allotId }.Contains(t.AllotId)); // var list = perforCofcmiRepository.GetEntities(t => new List<int> { prevAllotId, allotId }.Contains(t.AllotId));
if (list == null || !list.Any(t => t.AllotId == prevAllotId)) return; // if (list == null || !list.Any(t => t.AllotId == prevAllotId)) return;
if (list.Any(t => t.AllotId == allotId)) // if (list.Any(t => t.AllotId == allotId))
{ // {
var prevData = list.Where(t => t.AllotId == prevAllotId); // var prevData = list.Where(t => t.AllotId == prevAllotId);
var existData = list.Where(t => t.AllotId == allotId); // var existData = list.Where(t => t.AllotId == allotId);
if (existData != null && existData.Any()) // if (existData != null && existData.Any())
list = prevData.Where(t => !existData.Select(w => w.UnitType + w.AccountingUnit).Contains(t.UnitType + t.AccountingUnit)).ToList(); // list = prevData.Where(t => !existData.Select(w => w.UnitType + w.AccountingUnit).Contains(t.UnitType + t.AccountingUnit)).ToList();
} // }
if (list.Any()) // if (list.Any())
{ // {
var data = list.Select(t => new cof_cmi // var data = list.Select(t => new cof_cmi
{ // {
AllotId = allotId, // AllotId = allotId,
UnitType = t.UnitType, // UnitType = t.UnitType,
AccountingUnit = t.AccountingUnit, // AccountingUnit = t.AccountingUnit,
Value = t.Value, // Value = t.Value,
}); // });
perforCofcmiRepository.AddRange(data.ToArray()); // perforCofcmiRepository.AddRange(data.ToArray());
} // }
} //}
} }
} }
...@@ -107,7 +107,7 @@ public SecondResponse GetSecondDetails(int userId, int secondId, int hospitalId, ...@@ -107,7 +107,7 @@ public SecondResponse GetSecondDetails(int userId, int secondId, int hospitalId,
SupplyHeaderByWorkItem(hospitalId, result, secondAllot, savedDataList); 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.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; return result;
} }
...@@ -565,7 +565,58 @@ private void SupplyHeaderByWorkItem(int hospitalId, SecondResponse result, ag_se ...@@ -565,7 +565,58 @@ private void SupplyHeaderByWorkItem(int hospitalId, SecondResponse result, ag_se
#region 其他模板详情 #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); var secondAllot = agsecondallotRepository.GetEntity(t => t.Id == secondId);
if (secondAllot == null) throw new PerformanceException("二次绩效信息无效!"); if (secondAllot == null) throw new PerformanceException("二次绩效信息无效!");
...@@ -598,21 +649,22 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is ...@@ -598,21 +649,22 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
// 如果已经保存>>走保存加载逻辑 // 如果已经保存>>走保存加载逻辑
if (employeeSource == (int)EmployeeSource.Initial) if (employeeSource == (int)EmployeeSource.Initial)
{ {
result = savedDataList.OrderBy(t => t.Id).ToList(); result = savedDataList.OrderBy(t => t.WorkNumber).ToList();
} }
// 如果没保存>>走加载im_employee_logistics人员名单逻辑 // 如果没保存>>走加载im_employee_logistics人员名单逻辑
else else
{ {
var types = new string[] { "行政后勤", "行政工勤" }; var types = new string[] { "行政后勤", "行政工勤" };
var logistics = _imemployeelogisticsRepository.GetEntities(w => w.AllotID == secondAllot.AllotId && types.Contains(w.AccountType) && w.AccountingUnit == secondAllot.Department); 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 result = (logistics ?? new List<im_employee_logistics>())
{ .OrderBy(t => Convert.ToInt32(t.PersonnelNumber)).Select(w => new ag_othersource
SecondId = secondId, {
WorkNumber = w.PersonnelNumber, SecondId = secondId,
Name = w.DoctorName, WorkNumber = w.PersonnelNumber,
Department = w.AccountingUnit, Name = w.DoctorName,
WorkPost = w.JobTitle, Department = w.AccountingUnit,
}).ToDistinct().ToList(); WorkPost = w.JobTitle,
}).ToDistinct().ToList();
} }
} }
//非行政科室 有三种逻辑,或从保存中加载,或从人员字典加载,或从上次绩效中加载 //非行政科室 有三种逻辑,或从保存中加载,或从人员字典加载,或从上次绩效中加载
...@@ -621,12 +673,12 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is ...@@ -621,12 +673,12 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
switch (employeeSource) switch (employeeSource)
{ {
case (int)EmployeeSource.Initial: case (int)EmployeeSource.Initial:
result = savedDataList.OrderBy(t => t.Id).ToList(); result = savedDataList.OrderBy(t => t.WorkNumber).ToList();
break; break;
case (int)EmployeeSource.EmployeeDict: case (int)EmployeeSource.EmployeeDict:
if (employees == null || !employees.Any()) return new List<ag_othersource>(); 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, SecondId = secondId,
WorkNumber = t.PersonnelNumber, WorkNumber = t.PersonnelNumber,
...@@ -641,7 +693,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is ...@@ -641,7 +693,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
isSupplementTitlePerformance = prevSavedDataList == null || !prevSavedDataList.Any(); isSupplementTitlePerformance = prevSavedDataList == null || !prevSavedDataList.Any();
if (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 .Select(t => new ag_othersource
{ {
SecondId = secondId, SecondId = secondId,
...@@ -655,6 +707,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is ...@@ -655,6 +707,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
} }
} }
var originalEmployees = personService.GetPerEmployee(secondAllot.AllotId.Value); var originalEmployees = personService.GetPerEmployee(secondAllot.AllotId.Value);
workNumbers = originalEmployees?.Select(t => t.PersonnelNumber).Distinct().ToArray();
SupplementSecondDetail(secondAllot, originalEmployees, result, isSupplementTitlePerformance); SupplementSecondDetail(secondAllot, originalEmployees, result, isSupplementTitlePerformance);
return result; return result;
...@@ -700,8 +753,27 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em ...@@ -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 其他模板详情 #endregion 其他模板详情
#region Common
/// <summary> /// <summary>
/// 获取上一次的二次绩效 /// 获取上一次的二次绩效
/// </summary> /// </summary>
...@@ -724,6 +796,8 @@ private ag_secondallot GetPreviousSecondAllot(int hospitalId, ag_secondallot sec ...@@ -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); var prevSecondAllot = agsecondallotRepository.GetEntity(w => w.AllotId == prevAllot.ID && w.UnitType == secondAllot.UnitType && w.Department == secondAllot.Department);
return prevSecondAllot; return prevSecondAllot;
} }
#endregion Common
} }
/// <summary> /// <summary>
......
...@@ -516,17 +516,15 @@ public void ImpoerAprEmployees(int allotid, string path, int userid) ...@@ -516,17 +516,15 @@ public void ImpoerAprEmployees(int allotid, string path, int userid)
var sheet = workbook.GetSheetAt(0); var sheet = workbook.GetSheetAt(0);
var firstRow = sheet.GetRow(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++) for (int cellindex = 0; cellindex < firstRow.LastCellNum + 1; cellindex++)
{ {
var cell = firstRow.GetCell(cellindex); var value = firstRow.GetCell(cellindex).GetValue();
if (cell == null) continue; if (!string.IsNullOrEmpty(value) && !excelheader.ContainsKey(cellindex))
excelheader.Add(cellindex, value);
if (!string.IsNullOrEmpty(cell.ToString()))
excelheader.Add((cell.ToString(), cellindex));
} }
if (excelheader == null || !excelheader.Any()) if (excelheader == null || excelheader.Count == 0)
throw new PerformanceException("上传excel内容错误"); throw new PerformanceException("上传excel内容错误");
Dictionary<string, int> dict = new Dictionary<string, int> Dictionary<string, int> dict = new Dictionary<string, int>
...@@ -534,16 +532,12 @@ public void ImpoerAprEmployees(int allotid, string path, int userid) ...@@ -534,16 +532,12 @@ public void ImpoerAprEmployees(int allotid, string path, int userid)
{ "录入科室", -1 },{ "核算单元", -1 },{ "人员工号", -1 }, { "姓名", -1 }, { "绩效类型", -1 }, { "金额", -1 }, { "录入科室", -1 },{ "核算单元", -1 },{ "人员工号", -1 }, { "姓名", -1 }, { "绩效类型", -1 }, { "金额", -1 },
}; };
List<string> errorHeaders = new List<string>();
foreach (var key in dict.Keys.ToList()) foreach (var key in dict.Keys.ToList())
{ {
if (!excelheader.Select(t => t.Item1).Contains(key)) errorHeaders.Add(key); if (excelheader.Any(w => w.Value == key))
else dict[key] = excelheader.First(t => t.Item1 == key).Item2; 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 entities = new List<per_apr_amount>();
var createtime = DateTime.Now; var createtime = DateTime.Now;
...@@ -555,19 +549,40 @@ public void ImpoerAprEmployees(int allotid, string path, int userid) ...@@ -555,19 +549,40 @@ public void ImpoerAprEmployees(int allotid, string path, int userid)
var entity = new per_apr_amount var entity = new per_apr_amount
{ {
Status = 2, Status = 2,
PersonnelNumber = row.GetCell(dict["人员工号"]).GetValue(), PersonnelNumber = dict["人员工号"] < 0 ? "" : row.GetCell(dict["人员工号"]).GetValue(),
DoctorName = row.GetCell(dict["姓名"]).GetValue(), DoctorName = dict["姓名"] < 0 ? "" : row.GetCell(dict["姓名"]).GetValue(),
PerforType = row.GetCell(dict["绩效类型"]).GetValue(), PerforType = dict["绩效类型"] < 0 ? "" : row.GetCell(dict["绩效类型"]).GetValue(),
Amount = ConvertHelper.To<decimal>(row.GetCell(dict["金额"]).GetValue(), 0), Amount = dict["金额"] < 0 ? 0 : ConvertHelper.To<decimal>(row.GetCell(dict["金额"]).GetValue(), 0),
TypeInDepartment = row.GetCell(dict["录入科室"]).GetValue(), TypeInDepartment = dict["录入科室"] < 0 ? "" : row.GetCell(dict["录入科室"]).GetValue(),
AccountingUnit = row.GetCell(dict["核算单元"]).GetValue(), AccountingUnit = dict["核算单元"] < 0 ? "" : row.GetCell(dict["核算单元"]).GetValue(),
AllotId = allotid, AllotId = allotid,
CreateDate = createtime, CreateDate = createtime,
CreateUser = userid, CreateUser = userid,
}; };
entities.Add(entity); 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) catch (Exception ex)
{ {
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
using Performance.EntityModels; using Performance.EntityModels;
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Repository; using Performance.Repository;
using Performance.Services.ExtractExcelService;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
...@@ -22,9 +23,13 @@ public class ExConfigService : IAutoInjection ...@@ -22,9 +23,13 @@ public class ExConfigService : IAutoInjection
private readonly PerforExitemRepository exitemRepository; private readonly PerforExitemRepository exitemRepository;
private readonly PerforExspecialRepository exspecialRepository; private readonly PerforExspecialRepository exspecialRepository;
private readonly PerforPerallotRepository perallotRepository; private readonly PerforPerallotRepository perallotRepository;
private readonly PerforPersheetRepository persheetRepository;
private readonly PerforImdataRepository imdataRepository;
private readonly PerforHospitalconfigRepository hospitalconfigRepository; private readonly PerforHospitalconfigRepository hospitalconfigRepository;
private readonly PerforHospitalRepository hospitalRepository;
private readonly PerforExtractRepository extractRepository; private readonly PerforExtractRepository extractRepository;
private readonly PerforModdicRepository moddicRepository; private readonly PerforModdicRepository moddicRepository;
private readonly QueryService queryService;
private readonly ILogger logger; private readonly ILogger logger;
public ExConfigService(PerforExtypeRepository extypeRepository, public ExConfigService(PerforExtypeRepository extypeRepository,
...@@ -33,10 +38,15 @@ public class ExConfigService : IAutoInjection ...@@ -33,10 +38,15 @@ public class ExConfigService : IAutoInjection
PerforExitemRepository exitemRepository, PerforExitemRepository exitemRepository,
PerforExspecialRepository exspecialRepository, PerforExspecialRepository exspecialRepository,
PerforPerallotRepository perallotRepository, PerforPerallotRepository perallotRepository,
PerforPersheetRepository persheetRepository,
PerforImdataRepository imdataRepository,
PerforHospitalconfigRepository hospitalconfigRepository, PerforHospitalconfigRepository hospitalconfigRepository,
PerforHospitalRepository hospitalRepository,
PerforExtractRepository extractRepository, PerforExtractRepository extractRepository,
PerforModdicRepository moddicRepository, PerforModdicRepository moddicRepository,
ILogger<ExConfigService> logger) QueryService queryService,
ILogger<ExConfigService> logger
)
{ {
this.extypeRepository = extypeRepository; this.extypeRepository = extypeRepository;
this.exscriptRepository = exscriptRepository; this.exscriptRepository = exscriptRepository;
...@@ -44,9 +54,13 @@ public class ExConfigService : IAutoInjection ...@@ -44,9 +54,13 @@ public class ExConfigService : IAutoInjection
this.exitemRepository = exitemRepository; this.exitemRepository = exitemRepository;
this.exspecialRepository = exspecialRepository; this.exspecialRepository = exspecialRepository;
this.perallotRepository = perallotRepository; this.perallotRepository = perallotRepository;
this.persheetRepository = persheetRepository;
this.imdataRepository = imdataRepository;
this.hospitalconfigRepository = hospitalconfigRepository; this.hospitalconfigRepository = hospitalconfigRepository;
this.hospitalRepository = hospitalRepository;
this.extractRepository = extractRepository; this.extractRepository = extractRepository;
this.moddicRepository = moddicRepository; this.moddicRepository = moddicRepository;
this.queryService = queryService;
this.logger = logger; this.logger = logger;
} }
...@@ -328,7 +342,7 @@ public void DelSpecial(int specialId) ...@@ -328,7 +342,7 @@ public void DelSpecial(int specialId)
#endregion 特殊科室 #endregion 特殊科室
public bool QueryHosConfigs(int moduleId, out int sheetType) public bool QueryHosConfigs(int moduleId, ref bool isSingle, out int sheetType)
{ {
var module = exmoduleRepository.GetEntity(t => t.Id == moduleId); var module = exmoduleRepository.GetEntity(t => t.Id == moduleId);
if (module == null) if (module == null)
...@@ -338,6 +352,11 @@ public bool QueryHosConfigs(int moduleId, out int sheetType) ...@@ -338,6 +352,11 @@ public bool QueryHosConfigs(int moduleId, out int sheetType)
//if (module.SheetType != (int)SheetType.Income) //if (module.SheetType != (int)SheetType.Income)
// throw new PerformanceException("当前模板不能进行考核项目自动添加"); // throw new PerformanceException("当前模板不能进行考核项目自动添加");
var hospital = hospitalRepository.GetEntity(t => t.ID == module.HospitalId);
if (hospital == null) throw new PerformanceException("医院信息错误!");
isSingle = hospital.IsSingleProject == 1;
var hospitalConfigs = hospitalconfigRepository.GetEntities(t => t.HospitalId == module.HospitalId); var hospitalConfigs = hospitalconfigRepository.GetEntities(t => t.HospitalId == module.HospitalId);
if (hospitalConfigs != null && hospitalConfigs.Any()) if (hospitalConfigs != null && hospitalConfigs.Any())
return true; return true;
...@@ -468,12 +487,14 @@ public List<sys_hospitalconfig> GetHospitalconfigs(int hospitalId) ...@@ -468,12 +487,14 @@ public List<sys_hospitalconfig> GetHospitalconfigs(int hospitalId)
/// 绩效数据抽取模板 /// 绩效数据抽取模板
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<TitleValue> ExtractScheme(int hospitalId, List<int> executeType) public List<TitleValue> ExtractScheme(int hospitalId, List<int> executeType, int? sheetType)
{ {
var titlevalue = new List<TitleValue>(); var titlevalue = new List<TitleValue>();
Expression<Func<ex_type, bool>> exp = t => new List<int> { 0, hospitalId }.Contains(t.HospitalId); Expression<Func<ex_type, bool>> exp = t => new List<int> { 0, hospitalId }.Contains(t.HospitalId);
if (executeType.FirstOrDefault() == 1) if (executeType.FirstOrDefault() == 1)
exp = exp.And(t => t.Source == (int)SheetType.Income); exp = exp.And(t => t.Source == (int)SheetType.Income);
else if (sheetType != null && !new int[] { 0, (int)SheetType.Income }.Contains(sheetType.Value))
exp = exp.And(t => t.Source == sheetType);
else else
exp = exp.And(t => t.Source != (int)SheetType.Income); exp = exp.And(t => t.Source != (int)SheetType.Income);
...@@ -505,7 +526,15 @@ public List<TitleValue> ExtractScheme(int hospitalId, List<int> executeType) ...@@ -505,7 +526,15 @@ public List<TitleValue> ExtractScheme(int hospitalId, List<int> executeType)
public List<TitleValue> FeeType() public List<TitleValue> FeeType()
{ {
var titlevalue = new List<TitleValue>(); var titlevalue = new List<TitleValue>();
var type = EnumHelper.GetItems<SheetType>().Where(t => new List<int> { (int)SheetType.Income, (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload, (int)SheetType.SpecialUnit, (int)SheetType.OtherWorkload }.Contains(t.Value)); var type = EnumHelper.GetItems<SheetType>().Where(t => new List<int>
{
(int)SheetType.Income,
(int)SheetType.OtherIncome,
(int)SheetType.Expend,
(int)SheetType.Workload,
(int)SheetType.SpecialUnit,
(int)SheetType.OtherWorkload
}.Contains(t.Value));
if (type != null && type.Any()) if (type != null && type.Any())
{ {
titlevalue = type.Select(t => new TitleValue titlevalue = type.Select(t => new TitleValue
...@@ -563,5 +592,124 @@ public ModFeeResponse FeeSource(ModModuleRequest request) ...@@ -563,5 +592,124 @@ public ModFeeResponse FeeSource(ModModuleRequest request)
return new ModFeeResponse(); return new ModFeeResponse();
} }
#region 配置校验
/// <summary>
/// 配置校验
/// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <param name="useTemplate"></param>
public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSingle, out string filePath)
{
string result = null;
filePath = "";
try
{
// 获取绩效信息
var allot = perallotRepository.GetEntity(t => t.ID == allotId);
if (allot == null)
throw new PerformanceException("AllotID错误");
// 获取医院信息
var hospital = hospitalRepository.GetEntity(t => t.ID == hospitalId);
if (hospital == null)
throw new PerformanceException("医院ID错误");
isSingle = (hospital.IsSingleProject ?? 2) == 1;
// 获取医院配置信息
var hospitalConfigList = hospitalconfigRepository.GetEntities(t => t.HospitalId == hospitalId);
if (hospitalConfigList == null || hospitalConfigList.Count == 0)
throw new PerformanceException("当前医院暂不支持HIS数据抽取");
// 获取最近一次绩效
var statesArray = new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive };
var allotList = perallotRepository.GetEntities(t => t.HospitalId == hospitalId && statesArray.Contains(t.States));
var allotLast = allotList?.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).First();
if (allotLast != null)
filePath = allotLast.Path;
// 获取当前医院模版信息
var modulesList = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId);
if (modulesList == null || modulesList.Count == 0)
throw new PerformanceException("当前医院还未配置模版");
// 获取模板项
var moduleIdList = modulesList.Select(t => t.Id).ToList();
var itemsList = exitemRepository.GetEntities(t => t.ModuleId.HasValue && moduleIdList.Contains(t.ModuleId.Value));
if (itemsList == null || itemsList.Count == 0)
throw new PerformanceException("当前医院还未配置模版项");
// 获取当前模板所有相关抽取SQL语句
var extypeIds = itemsList.Select(t => t.TypeId).Union(modulesList.Select(t => t.TypeId)).Distinct().ToList();
var extractList = exscriptRepository.GetEntities(t => extypeIds.Contains(t.TypeId));
if (extractList == null || extractList.Count == 0)
throw new PerformanceException("当前医院配置模板无需抽取");
}
catch (PerformanceException ex)
{
logger.LogError($"提取绩效数据异常 {ex.ToString()}");
result = ex.Message;
}
catch (Exception ex)
{
logger.LogError($"提取绩效数据异常 {ex.ToString()}");
throw new Exception(ex.Message);
}
return result;
}
#endregion 配置校验
#region 检查是否有新增的科室或费用类别
public Dictionary<string, object> CheckHasNewDepartmentOrCategory(int allotId)
{
var allot = perallotRepository.GetEntity(t => t.ID == allotId);
var allotList = perallotRepository.GetEntities(t => t.HospitalId == allot.HospitalId && new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive }.Contains(t.States));
var prevAllot = allotList?.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).First();
if (prevAllot == null) return null;
var modDics = moddicRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.Type == "checksql");
if (modDics == null || !modDics.Any()) return null;
var hospitalconfigs = hospitalconfigRepository.GetEntities(t => modDics.Select(s => s.ConfigId).Distinct().Contains(t.Id));
if (hospitalconfigs == null || !hospitalconfigs.Any()) return null;
var sheets = persheetRepository.GetEntities(t => t.AllotID == prevAllot.ID && t.SheetType == (int)SheetType.Income) ?? new List<per_sheet>();
var importdata = imdataRepository.GetEntities(t => sheets.Select(s => s.ID).Contains(t.SheetID.Value)) ?? new List<im_data>();
Dictionary<string, object> paramtemers = new Dictionary<string, object>();
foreach (var dic in modDics)
{
if (paramtemers.ContainsKey(dic.Remark)) continue;
var config = hospitalconfigs.FirstOrDefault(t => t.Id == dic.ConfigId);
if (config == null) continue;
var data = queryService.QueryData(config, allot, dic.Content);
if (data == null || !data.Any()) continue;
var sheet = sheets.FirstOrDefault(t => t.SheetName.Contains(dic.Remark));
if (sheet == null) continue;
var sheetdata = importdata.Where(t => t.SheetID == sheet.ID)?.ToList() ?? new List<im_data>();
var departments = sheetdata.Select(t => t.Department).Distinct();
var noExistedDepartment = data.Select(t => t.Department).Distinct().Except(departments);
var typenames = sheetdata.Select(t => t.TypeName).Distinct();
var noExistedTypename = data.Select(t => t.Category).Distinct().Except(typenames);
StringBuilder stringBuilder = new StringBuilder();
if (noExistedDepartment != null && noExistedDepartment.Any())
stringBuilder.AppendLine($"新增科室:{string.Join(",", noExistedDepartment)}");
if (noExistedTypename != null && noExistedTypename.Any())
stringBuilder.AppendLine($"新增费用类型:{string.Join(",", noExistedTypename)}");
paramtemers.Add(dic.Remark, stringBuilder.ToString());
}
return paramtemers;
}
#endregion 检查是否有新增的科室或费用类别
} }
} }
\ No newline at end of file
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 NPOI.SS.UserModel;
using OfficeOpenXml;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.EntityModels; using Performance.EntityModels;
using Performance.Infrastructure; using Performance.Infrastructure;
...@@ -17,6 +18,7 @@ public static string GetExtractFile(int hospitalId, ref string newFilePath, stri ...@@ -17,6 +18,7 @@ public static string GetExtractFile(int hospitalId, ref string newFilePath, stri
string originalPath = string.IsNullOrEmpty(allotFilePath) string originalPath = string.IsNullOrEmpty(allotFilePath)
? Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Template", "医院绩效模板.xls") ? Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Template", "医院绩效模板.xls")
: allotFilePath; : allotFilePath;
CloseAutoFilter(originalPath);
var (tempPath, filePath) = CopyOriginalFile(hospitalId, originalPath); var (tempPath, filePath) = CopyOriginalFile(hospitalId, originalPath);
newFilePath = filePath; newFilePath = filePath;
return tempPath; return tempPath;
...@@ -36,7 +38,7 @@ private static (string TempPath, string FilePath) CopyOriginalFile(int hospitalI ...@@ -36,7 +38,7 @@ private static (string TempPath, string FilePath) CopyOriginalFile(int hospitalI
FileHelper.CreateDirectory(dpath); FileHelper.CreateDirectory(dpath);
string tempPath = Path.Combine(dpath, $"Template{DateTime.Now.ToString("yyyyMMddHHmmssfff")}{ext}"); string tempPath = Path.Combine(dpath, $"Template{DateTime.Now.ToString("yyyyMMddHHmmssfff")}{ext}");
FileHelper.Copy(originalPath, tempPath); 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); return (tempPath, filePath);
} }
...@@ -66,7 +68,8 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo ...@@ -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()); var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank());
if (sheet == null) if (sheet == null)
...@@ -78,6 +81,9 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo ...@@ -78,6 +81,9 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
var copysheet = workbook.GetSheet(item.Key); var copysheet = workbook.GetSheet(item.Key);
var newSheet = copysheet.CopySheet(module.ModuleName, true); var newSheet = copysheet.CopySheet(module.ModuleName, true);
workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1); 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 ...@@ -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 ...@@ -34,17 +34,18 @@ public static void WriteSheetHeader(ISheet sheet, PerSheetPoint point, SheetType
// 去除excel中已存在的列 // 去除excel中已存在的列
int headerFirstCellNum = point.DataFirstCellNum.Value; 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(); var column = columnHeader.GetCell(index).GetDecodeEscapes();
if (string.IsNullOrEmpty(column)) continue; if (string.IsNullOrEmpty(column)) continue;
if (index > headerFirstCellNum) headerFirstCellNum = index;
columns.RemoveAll(t => t.ColumnName.NoBlank() == column); 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; if (columns == null || !columns.Any()) return;
...@@ -53,7 +54,6 @@ public static void WriteSheetHeader(ISheet sheet, PerSheetPoint point, SheetType ...@@ -53,7 +54,6 @@ public static void WriteSheetHeader(ISheet sheet, PerSheetPoint point, SheetType
: style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.系数, CellFormat.百分比); : style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.系数, CellFormat.百分比);
var columnStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.列头); var columnStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.列头);
headerFirstCellNum += 1;
// 补充excel中不存在的列 // 补充excel中不存在的列
foreach (var item in columns) foreach (var item in columns)
{ {
...@@ -111,7 +111,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -111,7 +111,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
int dataFirstCellNum = point.DataFirstCellNum.Value; 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); var row = sheet.GetRow(rowIndex);
if (row == null) continue; if (row == null) continue;
...@@ -119,6 +119,8 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -119,6 +119,8 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes(); string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes();
if (string.IsNullOrEmpty(department)) continue; if (string.IsNullOrEmpty(department)) continue;
if (rowIndex > dataFirstRowNum) dataFirstRowNum = rowIndex;
var deptData = data.Where(t => t.Department == department); var deptData = data.Where(t => t.Department == department);
if (deptData == null || !deptData.Any()) continue; if (deptData == null || !deptData.Any()) continue;
...@@ -146,8 +148,8 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -146,8 +148,8 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
} }
data.RemoveAll(t => t.Department == department); 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, 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 ...@@ -166,7 +168,6 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
headers = headers.Select(t => t.NoBlank()).ToList(); headers = headers.Select(t => t.NoBlank()).ToList();
dataFirstRowNum += 1;
foreach (string department in departments) foreach (string department in departments)
{ {
var deptData = data.Where(t => t.Department == department); var deptData = data.Where(t => t.Department == department);
...@@ -266,7 +267,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType ...@@ -266,7 +267,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
int dataFirstCellNum = point.DataFirstCellNum.Value; 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); var row = sheet.GetRow(rowIndex);
if (row == null) continue; if (row == null) continue;
...@@ -274,6 +275,8 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType ...@@ -274,6 +275,8 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes(); string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes();
if (string.IsNullOrEmpty(department)) continue; if (string.IsNullOrEmpty(department)) continue;
if (rowIndex > dataFirstRowNum) dataFirstRowNum = rowIndex;
var deptData = data.Where(t => t.Department == department); var deptData = data.Where(t => t.Department == department);
if (deptData == null || !deptData.Any()) continue; if (deptData == null || !deptData.Any()) continue;
...@@ -300,8 +303,8 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType ...@@ -300,8 +303,8 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
} }
data.RemoveAll(t => t.Department == department); 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, 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 ...@@ -318,7 +321,6 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
headers = headers.Select(t => t.NoBlank()).ToList(); headers = headers.Select(t => t.NoBlank()).ToList();
dataFirstRowNum += 1;
foreach (string department in departments) foreach (string department in departments)
{ {
var deptData = data.Where(t => t.Department == department); var deptData = data.Where(t => t.Department == department);
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
namespace Performance.Services.ExtractExcelService namespace Performance.Services.ExtractExcelService
{ {
...@@ -19,7 +18,7 @@ public class ExtractService : IAutoInjection ...@@ -19,7 +18,7 @@ public class ExtractService : IAutoInjection
private readonly QueryService queryService; private readonly QueryService queryService;
private readonly PersonService personService; private readonly PersonService personService;
private readonly PerSheetService perSheetService; private readonly PerSheetService perSheetService;
private readonly PerforHospitalRepository hospitalRepository; private readonly DictionaryService dictionaryService;
private readonly PerforPerallotRepository perallotRepository; private readonly PerforPerallotRepository perallotRepository;
private readonly PerforCollectdataRepository collectdataRepository; private readonly PerforCollectdataRepository collectdataRepository;
private readonly PerforPeremployeeRepository peremployeeRepository; private readonly PerforPeremployeeRepository peremployeeRepository;
...@@ -30,7 +29,7 @@ public class ExtractService : IAutoInjection ...@@ -30,7 +29,7 @@ public class ExtractService : IAutoInjection
QueryService queryService, QueryService queryService,
PersonService personService, PersonService personService,
PerSheetService perSheetService, PerSheetService perSheetService,
PerforHospitalRepository hospitalRepository, DictionaryService dictionaryService,
PerforPerallotRepository perallotRepository, PerforPerallotRepository perallotRepository,
PerforCollectdataRepository collectdataRepository, PerforCollectdataRepository collectdataRepository,
PerforPeremployeeRepository peremployeeRepository PerforPeremployeeRepository peremployeeRepository
...@@ -41,7 +40,7 @@ PerforPeremployeeRepository peremployeeRepository ...@@ -41,7 +40,7 @@ PerforPeremployeeRepository peremployeeRepository
this.queryService = queryService; this.queryService = queryService;
this.personService = personService; this.personService = personService;
this.perSheetService = perSheetService; this.perSheetService = perSheetService;
this.hospitalRepository = hospitalRepository; this.dictionaryService = dictionaryService;
this.perallotRepository = perallotRepository; this.perallotRepository = perallotRepository;
this.collectdataRepository = collectdataRepository; this.collectdataRepository = collectdataRepository;
this.peremployeeRepository = peremployeeRepository; this.peremployeeRepository = peremployeeRepository;
...@@ -74,6 +73,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -74,6 +73,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
var dict = new Dictionary<ExDataDict, object>(); var dict = new Dictionary<ExDataDict, object>();
logService.ReturnTheLog(allotId, groupName, 3, "", 5, 1, isSingle); 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 data = queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict);
var standData = StandDataFormat(hospitalId, data); var standData = StandDataFormat(hospitalId, data);
...@@ -90,6 +90,8 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -90,6 +90,8 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
WriteDataToFile(workbook, allotId, dict, standData, groupName, isSingle); WriteDataToFile(workbook, allotId, dict, standData, groupName, isSingle);
logService.ReturnTheLog(allotId, groupName, 2, "提取完成", $"绩效数据提取成功", 5, isSingle); logService.ReturnTheLog(allotId, groupName, 2, "提取完成", $"绩效数据提取成功", 5, isSingle);
workbook.GetCreationHelper().CreateFormulaEvaluator().EvaluateAll(); //实时更新公式的结果
allot.IsExtracting = isSingle ? 2 : 0; allot.IsExtracting = isSingle ? 2 : 0;
allot.ExtractPath = extractFilePath; allot.ExtractPath = extractFilePath;
} }
......
...@@ -80,7 +80,7 @@ public List<ex_result> Handler(int hospitalId, per_allot allot, string groupName ...@@ -80,7 +80,7 @@ public List<ex_result> Handler(int hospitalId, per_allot allot, string groupName
var data = new List<ex_result>(); 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)); var scripts = exscriptRepository.GetEntities(t => extypeIds.Contains(t.TypeId));
if (scripts != null && scripts.Any()) if (scripts != null && scripts.Any())
...@@ -367,7 +367,7 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo ...@@ -367,7 +367,7 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
/// <param name="source"></param> /// <param name="source"></param>
/// <param name="category"></param> /// <param name="category"></param>
/// <returns></returns> /// <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); var parameters = GetParameters(allot);
using (var connection = ConnectionBuilder.Create((DatabaseType)config.DataBaseType, config.DbSource, config.DbName, config.DbUser, config.DbPassword)) 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 ...@@ -386,6 +386,33 @@ private IEnumerable<ExtractDto> QueryData(sys_hospitalconfig config, per_allot a
} }
/// <summary> /// <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> /// </summary>
/// <param name="allot"></param> /// <param name="allot"></param>
......
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Performance.DtoModels;
using Performance.DtoModels.AppSettings; using Performance.DtoModels.AppSettings;
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Repository; using Performance.Repository;
using System; using System;
using System.Threading.Tasks;
namespace Performance.Services namespace Performance.Services
{ {
...@@ -28,7 +30,7 @@ public class LogManageService : IAutoInjection ...@@ -28,7 +30,7 @@ public class LogManageService : IAutoInjection
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="tag">标签</param> /// <param name="tag">标签</param>
/// <param name="message">内容</param> /// <param name="message">内容</param>
...@@ -70,7 +72,7 @@ public void ExtractLog(string groupName, string tag, string message, int level) ...@@ -70,7 +72,7 @@ public void ExtractLog(string groupName, string tag, string message, int level)
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="allotId"></param> /// <param name="allotId"></param>
/// <param name="groupName"></param> /// <param name="groupName"></param>
...@@ -102,8 +104,20 @@ public void ReturnTheLog(int allotId, string groupName, int type, string tag, ob ...@@ -102,8 +104,20 @@ public void ReturnTheLog(int allotId, string groupName, int type, string tag, ob
logdbug.Add(allotId, tag, content, level, type); logdbug.Add(allotId, tag, content, level, type);
if (!isSingle) if (!isSingle)
{ {
var http = url.ImportFile + $"/template/returnlog?type={type}&tag={tag}&message={content}&level={level}&groupName={groupName}"; var http = new RestSharpHelper();
HttpHelper.HttpPost(http); 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) catch (Exception ex)
......
...@@ -101,6 +101,16 @@ public static IPerSheetDataRead GetDataRead(SheetType sheetType, bool isnew = fa ...@@ -101,6 +101,16 @@ public static IPerSheetDataRead GetDataRead(SheetType sheetType, bool isnew = fa
case SheetType.PersonPostCoefficient: case SheetType.PersonPostCoefficient:
dataread = new PerSheetDataReadPersonExtra(); // 个人岗位系数 dataread = new PerSheetDataReadPersonExtra(); // 个人岗位系数
break; 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; return dataread;
} }
......
...@@ -14,14 +14,14 @@ namespace Performance.Services ...@@ -14,14 +14,14 @@ namespace Performance.Services
public class PerSheetService : IAutoInjection public class PerSheetService : IAutoInjection
{ {
private PerHeaderService _perHeader; private PerHeaderService _perHeader;
private PerforCofdrugpropRepository _perforCofdrugpropRepository; //private PerforCofdrugpropRepository _perforCofdrugpropRepository;
private PerforCofdrugtypeRepository _perforCofdrugtypeRepository; private PerforCofdrugtypeRepository _perforCofdrugtypeRepository;
public PerSheetService(PerHeaderService perHeader, public PerSheetService(PerHeaderService perHeader,
PerforCofdrugpropRepository perforCofdrugpropRepository, //PerforCofdrugpropRepository perforCofdrugpropRepository,
PerforCofdrugtypeRepository perforCofdrugtypeRepository) PerforCofdrugtypeRepository perforCofdrugtypeRepository)
{ {
_perHeader = perHeader; _perHeader = perHeader;
_perforCofdrugpropRepository = perforCofdrugpropRepository; //_perforCofdrugpropRepository = perforCofdrugpropRepository;
_perforCofdrugtypeRepository = perforCofdrugtypeRepository; _perforCofdrugtypeRepository = perforCofdrugtypeRepository;
} }
/// <summary> /// <summary>
...@@ -113,6 +113,14 @@ public SheetType GetSheetType(string sheetName) ...@@ -113,6 +113,14 @@ public SheetType GetSheetType(string sheetName)
return SheetType.PersonAdjustLaterOtherManagePerforFee; return SheetType.PersonAdjustLaterOtherManagePerforFee;
else if (sheetName.StartsWith("6.11")) // 个人岗位系数 else if (sheetName.StartsWith("6.11")) // 个人岗位系数
return SheetType.PersonPostCoefficient; 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")) else if (sheetName.StartsWith("6.1"))
return SheetType.AccountScoreAverage; return SheetType.AccountScoreAverage;
else if (sheetName.StartsWith("6.2")) else if (sheetName.StartsWith("6.2"))
......
...@@ -84,7 +84,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null) ...@@ -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); var value = group.Sum(s => s.IsFactor ? s.CellValue * s.FactorValue : s.CellValue);
if (header.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; value = value * factor;
} }
...@@ -99,7 +99,8 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null) ...@@ -99,7 +99,8 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
/// </summary> /// </summary>
/// <param name="sheet"></param> /// <param name="sheet"></param>
/// <returns></returns> /// <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; int thiscell = sheet.PerHeader.OrderByDescending(t => t.PointCell).FirstOrDefault().PointCell + 1;
...@@ -115,7 +116,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null) ...@@ -115,7 +116,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
{ {
var ds = group.Select(t => 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 var dto = new PerData
{ {
...@@ -123,7 +124,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null) ...@@ -123,7 +124,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
AccountingUnit = group.Key.AccountingUnit, AccountingUnit = group.Key.AccountingUnit,
//CellValue = group.Sum(s => s.CellValue), //CellValue = group.Sum(s => s.CellValue),
CellValue = cellvalue, CellValue = cellvalue,
MedicineFactor = factor, //MedicineFactor = factor,
TypeName = group.Key.UnitType, TypeName = group.Key.UnitType,
RowNumber = group.FirstOrDefault()?.RowNumber ?? 0, RowNumber = group.FirstOrDefault()?.RowNumber ?? 0,
IsTotal = 1, IsTotal = 1,
...@@ -140,45 +141,32 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null) ...@@ -140,45 +141,32 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
return (sheet, perDataList); 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) decimal medicinefactor = medicineProps?.FirstOrDefault(t => t.AccountingUnit == group.First().AccountingUnit && unittype.Contains(t.UnitType))?.Factor ?? 1;
return (group.Sum(s => s.IsFactor ? s.CellValue * s.FactorValue : s.CellValue), null); decimal cmifactor = cmis?.FirstOrDefault(t => t.AccountingUnit == group.First().AccountingUnit && unittype.Contains(t.UnitType))?.Factor ?? 1;
else decimal inclinefactor = inclines?.FirstOrDefault(t => t.AccountingUnit == group.First().AccountingUnit && unittype.Contains(t.UnitType))?.Factor ?? 1;
{
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;
});
value += ngroup.Sum(s => var value = group.Sum(s =>
{ {
var cellvalue = s.IsFactor ? s.CellValue * s.FactorValue : s.CellValue; 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)) if (workitems.Any(w => w.Type == 3 && w.Item == s.TypeName))
{ cellvalue = cellvalue * inclinefactor;
cellvalue = factor * cellvalue; if (workitems.Any(w => w.Type == 2 && w.Item == s.TypeName))
} cellvalue = cellvalue * cmifactor;
return cellvalue; if (workitems.Any(w => w.Type == 1 && w.Item == s.TypeName))
}); cellvalue = cellvalue * medicinefactor;
return (value, factor); return cellvalue;
} });
return value;
} }
#endregion #endregion
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="CSRedisCore" Version="3.0.45" /> <PackageReference Include="CSRedisCore" Version="3.0.45" />
<PackageReference Include="DotNetCore.NPOI" Version="1.2.1" /> <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" /> <PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" />
</ItemGroup> </ItemGroup>
......
...@@ -1688,6 +1688,39 @@ public List<ag_othersource> OtherSave(int secondId, List<ag_othersource> request ...@@ -1688,6 +1688,39 @@ public List<ag_othersource> OtherSave(int secondId, List<ag_othersource> request
return perforAgothersourceRepository.GetEntities(t => t.SecondId == secondId); 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 二次绩效其他来源 #endregion 二次绩效其他来源
#region 打印 #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