Commit 7f51942a by 李承祥

额外收入、二次绩效

parent 796c7a54
......@@ -252,5 +252,31 @@ public ApiResponse AuditResult([FromBody] SecondAuditRequest request)
return result ? new ApiResponse(ResponseType.OK, "操作成功") : new ApiResponse(ResponseType.Fail, "操作失败");
}
#endregion
#region 二次绩效其他绩效
/// <summary>
/// 二次绩效其他绩效详情
/// </summary>
/// <returns></returns>
[Route("api/second/other/list")]
[HttpPost]
public ApiResponse OtherList([FromBody]AgOtherRequest request)
{
var result = secondAllotService.OtherList(request.SecondId);
return new ApiResponse(ResponseType.OK, result);
}
/// <summary>
/// 二次绩效其他绩效保存
/// </summary>
/// <returns></returns>
[Route("api/second/other/save")]
[HttpPost]
public ApiResponse OtherSave([FromBody]AgOtherRequest request)
{
var result = secondAllotService.OtherSave(request.SecondId, request.Othersources);
return new ApiResponse(ResponseType.OK, result);
}
#endregion
}
}
\ No newline at end of file
......@@ -852,6 +852,18 @@
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.SecondAllotController.OtherDetail(Performance.DtoModels.AgOtherRequest)">
<summary>
二次绩效其他绩效详情
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.SecondAllotController.OtherSave(Performance.DtoModels.AgOtherRequest)">
<summary>
二次绩效其他绩效保存
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.SheetController.SheetList(Performance.DtoModels.SheetRequest)">
<summary>
sheet 列表
......
......@@ -25,6 +25,9 @@
<member name="P:Performance.EntityModels.PerformanceDbContext.ag_itemvalue">
<summary> 科室二次绩效录入内容 </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.ag_othersource">
<summary> 二次绩效其他绩效来源 </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.ag_secondallot">
<summary> 二次绩效列表 </summary>
</member>
......@@ -97,6 +100,9 @@
<member name="P:Performance.EntityModels.PerformanceDbContext.im_employee">
<summary> </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.im_employee_clinic">
<summary> </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.im_header">
<summary> </summary>
</member>
......@@ -609,6 +615,46 @@
</summary>
</member>
<member name="T:Performance.EntityModels.ag_othersource">
<summary>
二次绩效其他绩效来源
</summary>
</member>
<member name="P:Performance.EntityModels.ag_othersource.Id">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.ag_othersource.SecondId">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.ag_othersource.WorkNumber">
<summary>
工号
</summary>
</member>
<member name="P:Performance.EntityModels.ag_othersource.Name">
<summary>
姓名
</summary>
</member>
<member name="P:Performance.EntityModels.ag_othersource.Department">
<summary>
科室
</summary>
</member>
<member name="P:Performance.EntityModels.ag_othersource.WorkPost">
<summary>
职称
</summary>
</member>
<member name="P:Performance.EntityModels.ag_othersource.Amount">
<summary>
金额
</summary>
</member>
<member name="T:Performance.EntityModels.ag_secondallot">
<summary>
二次绩效列表
......
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class AgOtherRequest
{
public int SecondId { get; set; }
public List<ag_othersource> Othersources { get; set; }
}
}
......@@ -26,6 +26,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public virtual DbSet<ag_header> ag_header { get; set; }
/// <summary> 科室二次绩效录入内容 </summary>
public virtual DbSet<ag_itemvalue> ag_itemvalue { get; set; }
/// <summary> 二次绩效其他绩效来源 </summary>
public virtual DbSet<ag_othersource> ag_othersource { get; set; }
/// <summary> 二次绩效列表 </summary>
public virtual DbSet<ag_secondallot> ag_secondallot { get; set; }
/// <summary> 二次绩效模板 </summary>
......@@ -74,10 +76,11 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public virtual DbSet<im_data> im_data { get; set; }
/// <summary> </summary>
public virtual DbSet<im_employee> im_employee { get; set; }
/// <summary> </summary>
public virtual DbSet<im_employee_clinic> im_employee_clinic { get; set; }
/// <summary> </summary>
public virtual DbSet<im_header> im_header { get; set; }
/// <summary> 特殊科室核算 </summary>
/// <summary> </summary>
public virtual DbSet<im_header> im_header { get; set; }
/// <summary> 特殊科室核算 </summary>
public virtual DbSet<im_specialunit> im_specialunit { get; set; }
/// <summary> </summary>
public virtual DbSet<log_check> log_check { get; set; }
......
//-----------------------------------------------------------------------
// <copyright file=" ag_othersource.cs">
// * FileName: 二次绩效其他绩效来源.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
/// 二次绩效其他绩效来源
/// </summary>
[Table("ag_othersource")]
public class ag_othersource
{
/// <summary>
///
/// </summary>
[Key]
public int Id { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> SecondId { get; set; }
/// <summary>
/// 工号
/// </summary>
public string WorkNumber { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 职称
/// </summary>
public string WorkPost { get; set; }
/// <summary>
/// 金额
/// </summary>
public Nullable<decimal> Amount { get; set; }
}
}
......@@ -180,7 +180,7 @@ public class im_accountbasic
/// 调节系数
/// </summary>
public Nullable<decimal> NurseAdjustFactor { get; set; }
/// <summary>
/// 工作量倾斜系数
/// </summary>
......
......@@ -95,7 +95,7 @@ public class res_specialunit
/// 实发绩效
/// </summary>
public Nullable<decimal> RealGiveFee { get; set; }
/// <summary>
/// 业绩总绩效
/// </summary>
......
//-----------------------------------------------------------------------
// <copyright file=" ag_othersource.cs">
// * FileName: ag_othersource.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// ag_othersource Repository
/// </summary>
public partial class PerforAgothersourceRepository : PerforRepository<ag_othersource>
{
public PerforAgothersourceRepository(PerformanceDbContext context) : base(context)
{
}
}
}
......@@ -150,7 +150,7 @@ public string ExtractData(int allotId, string email, int hospitalId)
WriteIncome(sheet, hospital.ID, unitList, sheetRead, allot, modulesList, hospitalConfigList);
break;
case SheetType.OtherIncome:
WriteOtherIncome(sheet, hospital.ID, sheetRead);
WriteOtherIncome(sheet, hospital.ID, unitList, sheetRead, allot, modulesList, hospitalConfigList);
break;
case SheetType.Expend:
WriteExpend(sheet, hospital.ID, sheetRead);
......@@ -215,7 +215,7 @@ private static void CreateNotExistSheet(List<mod_module> modulesList, IWorkbook
}
}
private void WriteOtherIncome(ISheet sheet, int hospitalId, IPerSheetDataRead sheetRead)
private void WriteOtherIncome(ISheet sheet, int hospitalId, List<AccountUnitEntity> unitList, IPerSheetDataRead sheetRead, per_allot allot, List<mod_module> moduleList, List<sys_hospitalconfig> hospitalConfigList)
{
var module = perforModmoduleRepository.GetEntity(t => t.SheetType == (int)SheetType.OtherIncome && t.HospitalId == hospitalId);
var itemList = perforModitemRepository.GetEntities(t => t.ModuleId == module.Id);
......@@ -250,6 +250,66 @@ private void WriteOtherIncome(ISheet sheet, int hospitalId, IPerSheetDataRead sh
techniciancell.CellStyle = CellStyle.CreateCellStyle(workbook, StyleType.系数, CellFormat.百分比);
cellStartIndex++;
}
//查询数据
var extractList = perforModextractRepository.GetEntities(t => module.ExtractId == t.Id);
if (extractList == null || extractList.Count == 0) return;
List<ExtractDto> allExtract = new List<ExtractDto>();
foreach (var item in extractList)
{
logManageService.WriteMsg("提取绩效数据", $"执行SQL脚本获取数据 -- {module.ModuleName}", 1, AllotId, "ReceiveMessage");
LogHelper.Information($"执行SQL脚本获取数据 -- {module.ModuleName}", "提取绩效数据");
var result = QueryDatabase(hospitalConfigList, item, allot);
if (result != null)
allExtract.AddRange(result);
}
logManageService.WriteMsg("提取绩效数据", $"填充数据 -- {module.ModuleName}", 1, AllotId, "ReceiveMessage");
LogHelper.Information($"填充数据 -- {module.ModuleName}", "提取绩效数据");
//写入数据
var rowIndex = sheetRead.Point.HeaderFirstRowNum.Value + 1;
foreach (var department in allExtract.Select(t => t.Department).Distinct())
{
var row = sheet.CreateRow(rowIndex);
for (int i = head.FirstCellNum; i < head.LastCellNum; i++)
{
var headName = head.GetCell(i).StringCellValue;
var newCell = row.CreateCell(i);
if (headName.Replace("\n", "") == "核算单元(医生组)")
{
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department && t.UnitType == 1)?.AccountingUnit;
newCell.SetCellValue(dept ?? "");
newCell.CellStyle = CellStyle.CreateCellStyle(workbook, StyleType.默认);
}
else if (headName.Replace("\n", "") == "核算单元(护理组)")
{
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department && t.UnitType == 2)?.AccountingUnit;
newCell.SetCellValue(dept ?? "");
newCell.CellStyle = CellStyle.CreateCellStyle(workbook, StyleType.默认);
}
else if (headName.Replace("\n", "") == "核算单元(医技组)")
{
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department && t.UnitType == 3)?.AccountingUnit;
newCell.SetCellValue(dept ?? "");
newCell.CellStyle = CellStyle.CreateCellStyle(workbook, StyleType.默认);
}
else if (headName == "科室名称")
{
newCell.SetCellValue(department ?? "");
newCell.CellStyle = CellStyle.CreateCellStyle(workbook, StyleType.默认);
}
else
{
var value = allExtract.FirstOrDefault(t => t.Department == department && t.Category == headName)?.Value;
value = value == 0 ? null : value;
OutToExcelCell(newCell, value);
//newCell.SetCellValue(value == null || value == 0 ? "" : value.ToString());
newCell.CellStyle = style;
}
}
rowIndex++;
}
}
private void WriteIncome(ISheet sheet, int hospitalId, List<AccountUnitEntity> unitList, IPerSheetDataRead sheetRead, per_allot allot, List<mod_module> moduleList, List<sys_hospitalconfig> hospitalConfigList)
......
......@@ -28,6 +28,7 @@ public class SecondAllotService : IAutoInjection
private readonly PerforAgusetempRepository perforAgusetempRepository;
private readonly PerforAgcomputeRepository perforAgcomputeRepository;
private readonly PerforCofagainRepository perforCofagainRepository;
private readonly PerforAgothersourceRepository perforAgothersourceRepository;
public SecondAllotService(IOptions<Application> application,
PerforUserRepository perforUserRepository,
......@@ -42,7 +43,8 @@ public class SecondAllotService : IAutoInjection
PerforAgfixatitemRepository perforAgfixatitemRepository,
PerforAgusetempRepository perforAgusetempRepository,
PerforAgcomputeRepository perforAgcomputeRepository,
PerforCofagainRepository perforCofagainRepository)
PerforCofagainRepository perforCofagainRepository,
PerforAgothersourceRepository perforAgothersourceRepository)
{
this.application = application.Value;
this.perforUserRepository = perforUserRepository;
......@@ -58,6 +60,7 @@ public class SecondAllotService : IAutoInjection
this.perforAgusetempRepository = perforAgusetempRepository;
this.perforAgcomputeRepository = perforAgcomputeRepository;
this.perforCofagainRepository = perforCofagainRepository;
this.perforAgothersourceRepository = perforAgothersourceRepository;
}
#region 二次绩效列表与数据保存
/// <summary>
......@@ -182,7 +185,7 @@ public SecondResponse GetSecondDetail(UseTempRequest request)
if (bringhead != null && bringhead.Count > 0)
{
var allotIds = perforPerallotRepository.GetEntities(t => t.HospitalId == request.HospitalId).Select(a => a.ID);
var secondIdList = perforAgsecondallotRepository.GetEntities(t => allotIds.Contains(t.AllotId.Value)
var secondIdList = perforAgsecondallotRepository.GetEntities(t => allotIds.Contains(t.AllotId.Value)
&& t.Department == request.Department && t.UnitType == request.UnitType)
.OrderBy(t => t.Year).ThenBy(t => t.Month).Select(t => t.Id).ToList();
var index = secondIdList.IndexOf(request.SecondId);
......@@ -671,5 +674,42 @@ public List<BodyItem> GetBodyItems(List<HeadItem> headItems, int source, List<co
return bodyItems;
}
#endregion
#region 二次绩效其他来源
public List<ag_othersource> OtherList(int secondId)
{
var otherSecondList = perforAgothersourceRepository.GetEntities(t => t.SecondId == secondId);
return otherSecondList?.OrderBy(t => t.Id).ToList();
}
public List<ag_othersource> OtherSave(int secondId, List<ag_othersource> request)
{
var existEntities = perforAgothersourceRepository.GetEntities(t => t.SecondId == secondId);
if (existEntities != null && existEntities.Any())
{
foreach (var item in request.Where(t => t.Id != 0))
{
existEntities.First(t => t.Id == item.Id).WorkNumber = item.WorkNumber;
existEntities.First(t => t.Id == item.Id).Name = item.Name;
existEntities.First(t => t.Id == item.Id).Department = item.Department;
existEntities.First(t => t.Id == item.Id).WorkPost = item.WorkPost;
existEntities.First(t => t.Id == item.Id).Amount = item.Amount;
}
perforAgothersourceRepository.UpdateRange(existEntities.ToArray());
var delIds = existEntities.Select(t => t.Id).Except(request.Select(t => t.Id));
if (delIds != null)
perforAgothersourceRepository.RemoveRange(existEntities.Where(t => delIds.Contains(t.Id)).ToArray());
}
var addEntities = request.Where(t => t.Id == 0).ToList();
if (addEntities != null && addEntities.Any())
{
addEntities.ForEach(t => t.SecondId = secondId);
perforAgothersourceRepository.AddRange(addEntities.ToArray());
}
return perforAgothersourceRepository.GetEntities(t => t.SecondId == secondId);
}
#endregion
}
}
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