Commit f8cac7ae by 799284587@qq.com

优化

parent 5bbc5a35
...@@ -159,13 +159,12 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody]Al ...@@ -159,13 +159,12 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody]Al
if (allot.States == (int)AllotStates.Wait) if (allot.States == (int)AllotStates.Wait)
return new ApiResponse(ResponseType.OK, "当前绩效正在等待生成"); return new ApiResponse(ResponseType.OK, "当前绩效正在等待生成");
_allotService.UpdateAllotStates(allot.ID, (int)AllotStates.Wait, EnumHelper.GetDescription(AllotStates.Wait));
if (_evn.IsEnvironment("Localhost")) if (_evn.IsEnvironment("Localhost"))
_allotService.Generate(allot, email); _allotService.Generate(allot, email);
else else
BackgroundJob.Enqueue(() => _allotService.Generate(allot, email)); BackgroundJob.Enqueue(() => _allotService.Generate(allot, email));
_allotService.UpdateAllotStates(allot.ID, (int)AllotStates.Wait, EnumHelper.GetDescription(AllotStates.Wait));
//_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);
......
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Performance.DtoModels; using Performance.DtoModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -12,6 +13,7 @@ public class NotFoundController : ControllerBase ...@@ -12,6 +13,7 @@ public class NotFoundController : ControllerBase
{ {
[Route("error/404")] [Route("error/404")]
[HttpGet] [HttpGet]
[AllowAnonymous]
public ActionResult<ApiResponse> Get() public ActionResult<ApiResponse> Get()
{ {
return new ApiResponse(ResponseType.NotFound, "not found"); return new ApiResponse(ResponseType.NotFound, "not found");
......
...@@ -26,7 +26,7 @@ public class TemplateController : Controller ...@@ -26,7 +26,7 @@ public class TemplateController : Controller
private readonly TemplateService templateService; private readonly TemplateService templateService;
private readonly ExtractService extractService; private readonly ExtractService extractService;
private HospitalService hospitalService; private HospitalService hospitalService;
private IHostingEnvironment evn; private IHostingEnvironment env;
private ClaimService claim; private ClaimService claim;
private Application application; private Application application;
private WebapiUrl url; private WebapiUrl url;
...@@ -36,7 +36,7 @@ public class TemplateController : Controller ...@@ -36,7 +36,7 @@ public class TemplateController : Controller
public TemplateController(TemplateService templateService, public TemplateController(TemplateService templateService,
HospitalService hospitalService, HospitalService hospitalService,
ExtractService extractService, ExtractService extractService,
IHostingEnvironment evn, IHostingEnvironment env,
ClaimService claim, ClaimService claim,
IOptions<Application> options, IOptions<Application> options,
IOptions<WebapiUrl> url, IOptions<WebapiUrl> url,
...@@ -46,7 +46,7 @@ public class TemplateController : Controller ...@@ -46,7 +46,7 @@ public class TemplateController : Controller
this.templateService = templateService; this.templateService = templateService;
this.extractService = extractService; this.extractService = extractService;
this.hospitalService = hospitalService; this.hospitalService = hospitalService;
this.evn = evn; this.env = env;
this.claim = claim; this.claim = claim;
this.application = options.Value; this.application = options.Value;
this.url = url.Value; this.url = url.Value;
...@@ -55,6 +55,30 @@ public class TemplateController : Controller ...@@ -55,6 +55,30 @@ public class TemplateController : Controller
} }
/// <summary> /// <summary>
/// 从WebAPI下载模板
/// </summary>
/// <returns></returns>
[Route("downtemplate")]
[HttpGet]
[AllowAnonymous]
public IActionResult DownFile(int type = 1)
{
string path = (type == 1)
? Path.Combine(env.ContentRootPath, "Template", "医院绩效模板.xlsx")
: Path.Combine(env.ContentRootPath, "Template", "医院二次分配绩效模板.xlsx");
var memoryStream = new MemoryStream();
using (var stream = new FileStream(path, FileMode.Open))
{
stream.CopyToAsync(memoryStream).Wait();
}
memoryStream.Seek(0, SeekOrigin.Begin);
var provider = new FileExtensionContentTypeProvider();
var memi = provider.Mappings[".xlsx"];
return File(memoryStream, memi, Path.GetFileName(path));
}
/// <summary>
/// 上传文件 /// 上传文件
/// </summary> /// </summary>
/// <param name="form"></param> /// <param name="form"></param>
...@@ -78,7 +102,7 @@ public ApiResponse Import([FromForm] IFormCollection form) ...@@ -78,7 +102,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
var name = FileHelper.GetFileNameNoExtension(file.FileName) + DateTime.Now.ToString("yyyyMMddHHmmssfff"); var name = FileHelper.GetFileNameNoExtension(file.FileName) + DateTime.Now.ToString("yyyyMMddHHmmssfff");
var ext = FileHelper.GetExtension(file.FileName); var ext = FileHelper.GetExtension(file.FileName);
var dpath = Path.Combine(evn.ContentRootPath, "Files", $"{hospitalid}", "first"); var dpath = Path.Combine(env.ContentRootPath, "Files", $"{hospitalid}", "first");
FileHelper.CreateDirectory(dpath); FileHelper.CreateDirectory(dpath);
var path = Path.Combine(dpath, $"{name}{ext}"); var path = Path.Combine(dpath, $"{name}{ext}");
...@@ -213,7 +237,7 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho ...@@ -213,7 +237,7 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho
if (file == null) if (file == null)
return new ApiResponse(ResponseType.Error, "上传文件无效"); return new ApiResponse(ResponseType.Error, "上传文件无效");
var dpath = Path.Combine(evn.ContentRootPath, "Files", $"{hospitalId}", "autoextract"); var dpath = Path.Combine(env.ContentRootPath, "Files", $"{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));
......
...@@ -23,10 +23,6 @@ ...@@ -23,10 +23,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Remove="Template\~%24医院绩效模板.xlsx" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="8.0.0" /> <PackageReference Include="AutoMapper" Version="8.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" /> <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" />
<PackageReference Include="CSRedisCore" Version="3.0.45" /> <PackageReference Include="CSRedisCore" Version="3.0.45" />
......
...@@ -557,6 +557,12 @@ ...@@ -557,6 +557,12 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.TemplateController.DownFile(System.Int32)">
<summary>
从WebAPI下载模板
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.TemplateController.Import(Microsoft.AspNetCore.Http.IFormCollection)"> <member name="M:Performance.Api.Controllers.TemplateController.Import(Microsoft.AspNetCore.Http.IFormCollection)">
<summary> <summary>
上传文件 上传文件
......
...@@ -114,6 +114,9 @@ ...@@ -114,6 +114,9 @@
<member name="F:Performance.DtoModels.AllotStates.Archive"> <member name="F:Performance.DtoModels.AllotStates.Archive">
<summary> 归档 </summary> <summary> 归档 </summary>
</member> </member>
<member name="F:Performance.DtoModels.AllotStates.Wait">
<summary> 归档 </summary>
</member>
<member name="P:Performance.DtoModels.PerAgainData.RowNumber"> <member name="P:Performance.DtoModels.PerAgainData.RowNumber">
<summary> <summary>
行号 行号
...@@ -542,10 +545,10 @@ ...@@ -542,10 +545,10 @@
<member name="F:Performance.DtoModels.AccountUnitType.Null"> <member name="F:Performance.DtoModels.AccountUnitType.Null">
<summary> </summary> <summary> </summary>
</member> </member>
<member name="F:Performance.DtoModels.AccountUnitType.临床科室"> <member name="F:Performance.DtoModels.AccountUnitType.科主任">
<summary> 临床科室 </summary> <summary> 临床科室 </summary>
</member> </member>
<member name="F:Performance.DtoModels.AccountUnitType.医技科室"> <member name="F:Performance.DtoModels.AccountUnitType.护士长">
<summary> 临床科室 </summary> <summary> 临床科室 </summary>
</member> </member>
<member name="F:Performance.DtoModels.AccountUnitType.行政高层"> <member name="F:Performance.DtoModels.AccountUnitType.行政高层">
......
...@@ -79,11 +79,11 @@ public enum AccountUnitType ...@@ -79,11 +79,11 @@ public enum AccountUnitType
[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,
......
...@@ -55,38 +55,14 @@ public class ComputeService : IAutoInjection ...@@ -55,38 +55,14 @@ public class ComputeService : IAutoInjection
public List<ResComputeResponse> GetCompute(int allotId, int type) public List<ResComputeResponse> GetCompute(int allotId, int type)
{ {
var data = new List<ResComputeResponse>(); var data = new List<ResComputeResponse>();
List<res_compute> conpute = new List<res_compute>();
if ((new int[] { 1, 2, 3 }).Contains(type)) var items = EnumHelper.GetItems<AccountUnitType>();
{ if (!items.Any(t => t.Value == type))
var keyValues2 = new[]
{
new { type = 1, accounttype = AccountUnitType.行政高层 },
new { type = 2, accounttype = AccountUnitType.行政中层 },
new { type = 3, accounttype = AccountUnitType.行政工勤 },
};
var obj = keyValues2.First(t => t.type == type);
conpute = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && t.AccountType == obj.accounttype.ToString())
?.OrderByDescending(t => t.RealGiveFee).ThenBy(t => t.FitPeople).ThenBy(t => t.AccountingUnit).ToList();
}
else if ((new int[] { 4, 5 }).Contains(type))
{
var types = new PerforType[] { PerforType.临床主任, PerforType.临床副主任, PerforType.医技主任, PerforType.医技副主任 };
var keyValues2 = new[]
{
new { type = 4, accounttype = types.Select(t=>EnumHelper.GetDescription(t)).ToList() },
new { type = 5, accounttype = new List<string>{ EnumHelper.GetDescription(PerforType.护士长) }},
};
var obj = keyValues2.First(t => t.type == type);
var dept = new string[] { AccountUnitType.临床科室.ToString(), AccountUnitType.医技科室.ToString() };
conpute = _perforRescomputeRepository
.GetEntities(t => t.AllotID == allotId && dept.Contains(t.AccountType) && obj.accounttype.Contains(t.FitPeople))
?.OrderByDescending(t => t.RealGiveFee).ThenBy(t => t.FitPeople).ThenBy(t => t.AccountingUnit).ToList();
}
else
{
throw new PerformanceException("参数错误,type无效"); throw new PerformanceException("参数错误,type无效");
}
var conpute = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && t.AccountType == items.FirstOrDefault(p => p.Value == type).Name)
?.OrderByDescending(t => t.RealGiveFee).ThenBy(t => t.FitPeople).ThenBy(t => t.AccountingUnit).ToList();
data = Mapper.Map<List<ResComputeResponse>>(conpute); data = Mapper.Map<List<ResComputeResponse>>(conpute);
data?.ForEach(t => t.WorkTime = string.IsNullOrEmpty(t.WorkTime) ? null : Convert.ToDateTime(t.WorkTime).ToString("yyyy-MM-dd")); data?.ForEach(t => t.WorkTime = string.IsNullOrEmpty(t.WorkTime) ? null : Convert.ToDateTime(t.WorkTime).ToString("yyyy-MM-dd"));
return data?.OrderByDescending(t => t.AccountingUnit).ToList(); return data?.OrderByDescending(t => t.AccountingUnit).ToList();
......
...@@ -141,9 +141,9 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, List<im_a ...@@ -141,9 +141,9 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, List<im_a
{ {
var basicRuleList = new[] var basicRuleList = new[]
{ {
new { AccountUnitType = AccountUnitType.临床科室, PerforType = PerforType.临床主任, UnitType = UnitType.医生组 }, new { AccountUnitType = AccountUnitType.主任, UnitType = UnitType.医生组 },
new { AccountUnitType = AccountUnitType.临床科室, PerforType = PerforType.护士长, UnitType = UnitType.护理组 }, new { AccountUnitType = AccountUnitType.护士长, UnitType = UnitType.护理组 },
new { AccountUnitType = AccountUnitType.医技科室, PerforType = PerforType.医技主任, UnitType = UnitType.医技组 }, new { AccountUnitType = AccountUnitType.主任, UnitType = UnitType.医技组 },
}; };
//取出科室 //取出科室
var dataList = perforResaccountRepository.GetEntities(t => t.AllotID == allot.ID); var dataList = perforResaccountRepository.GetEntities(t => t.AllotID == allot.ID);
...@@ -162,10 +162,7 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, List<im_a ...@@ -162,10 +162,7 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, List<im_a
var avg = resAccount.Max(t => t.Avg); var avg = resAccount.Max(t => t.Avg);
var basicRule = basicRuleList.FirstOrDefault(t => t.UnitType == (UnitType)accountbasic.UnitType); var basicRule = basicRuleList.FirstOrDefault(t => t.UnitType == (UnitType)accountbasic.UnitType);
var empolyee = empolyeeList.FirstOrDefault(t => var empolyee = empolyeeList.FirstOrDefault(t => t.AccountType == basicRule.AccountUnitType.ToString() && t.AccountingUnit == accountbasic.DoctorAccountingUnit);
t.AccountType == basicRule.AccountUnitType.ToString()
&& t.AccountingUnit == accountbasic.DoctorAccountingUnit
&& t.FitPeople.Trim() == EnumHelper.GetDescription(basicRule.PerforType));
if (empolyee == null) if (empolyee == null)
{ {
...@@ -173,7 +170,7 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, List<im_a ...@@ -173,7 +170,7 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, List<im_a
{ {
AccountType = basicRule.AccountUnitType.ToString(), AccountType = basicRule.AccountUnitType.ToString(),
DoctorName = "人员信息缺失", DoctorName = "人员信息缺失",
FitPeople = EnumHelper.GetDescription(basicRule.PerforType), FitPeople = "",
}; };
} }
var compute = new ComputeResult var compute = new ComputeResult
......
...@@ -39,7 +39,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -39,7 +39,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
JobTitle = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "职称").PointCell)?.ToString(), JobTitle = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "职称").PointCell)?.ToString(),
FitPeople = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "绩效基数核算参考对象").PointCell)?.ToString(), FitPeople = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "绩效基数核算参考对象").PointCell)?.ToString(),
FitPeopleRatio = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "绩效基数核算系数").PointCell)?.ToString()), FitPeopleRatio = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "绩效基数核算系数").PointCell)?.ToString()),
AccountType = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元分类").PointCell)?.ToString(), AccountType = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "人员分类").PointCell)?.ToString(),
PostCoefficient = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "岗位系数").PointCell)?.ToString()), PostCoefficient = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "岗位系数").PointCell)?.ToString()),
WorkTime = NopiSevice.GetCellDatetimeValue(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "参加工作时间").PointCell)), WorkTime = NopiSevice.GetCellDatetimeValue(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "参加工作时间").PointCell)),
ScoreAverageRate = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "考核得分率").PointCell)?.ToString()), ScoreAverageRate = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "考核得分率").PointCell)?.ToString()),
......
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