Commit 06b5675c by lcx

Merge branch 'v2020morge' into v2020morge-graphql

parents 2922823f dc1b6188
......@@ -274,6 +274,16 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody] A
////BackgroundJob.Enqueue(() => _allotService.Generate(allot, email));
return new ApiResponse(ResponseType.OK);
}
/*
[Route("recalculation")]
[HttpPost]
public ApiResponse Recalculation([FromBody] RecalculationRequest request)
{
if (request.Money.HasValue && request.Money.Value > 0)
_allotService.Recalculation(request.AllotId, request.Money.Value);
return new ApiResponse(ResponseType.OK);
}
*/
/// <summary>
/// 重新计算院领导绩效
......
......@@ -13,6 +13,7 @@
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Performance.DtoModels.Request;
namespace Performance.Api.Controllers
{
......@@ -22,12 +23,15 @@ public class ComputeController : Controller
private ComputeService _computeService;
private AllotService _allotService;
private ClaimService _claim;
private EmployeeService _employeeService;
public ComputeController(AllotService allotService,
ComputeService computeService,
EmployeeService employeeService,
ClaimService claim)
{
_allotService = allotService;
_computeService = computeService;
_employeeService = employeeService;
_claim = claim;
}
......@@ -253,7 +257,7 @@ public ApiResponse AllComputeAvg([FromBody] ComputerRequest request)
// ? 0 : Math.Round(gc.Sum(s => s.RealGiveFee) / gc.Select(p => new { p.JobNumber, p.EmployeeName }).Distinct().Count() ?? 0)
// }));
return new ApiResponse(ResponseType.OK, "ok", avgs.Select(w => new { w.PositionName, w.TotelNumber, w.TotelValue, w.AvgValue }));
return new ApiResponse(ResponseType.OK, "ok", avgs.Select(w => new {w.ID, w.PositionName, w.TotelNumber, w.TotelValue, w.AvgValue }));
}
/// <summary>
......@@ -366,5 +370,45 @@ public ApiResponse DoctorDetail(int computeId)
var result = _computeService.GetDoctorDetail(computeId);
return new ApiResponse(ResponseType.OK, result);
}
#region 人均绩效修改
/// <summary>
/// 编辑全院绩效平均
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("EditHospitalAvg")]
[HttpPost]
public ApiResponse<res_baiscnorm> EditHospitalAvg([FromBody] ComputerAvgRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var result = _computeService.EditHospitalAvg(request);
return new ApiResponse<res_baiscnorm>(ResponseType.OK, result);
}
#endregion
#region 其他绩效统计
/// <summary>
/// 其他医院绩效统计
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("OtherPerStats/{allotId}")]
[HttpPost]
public ApiResponse OtherPerStats(int allotId)
{
var employee = _employeeService.GetAprList(allotId, _claim.GetUserId());
var relust= _computeService.GetOtherPerStats(employee);
return new ApiResponse(ResponseType.OK,relust);
}
#endregion
}
}
\ No newline at end of file
......@@ -535,5 +535,44 @@ public ApiResponse WorkHeader([CustomizeValidator(RuleSet = "Select"), FromBody]
var list = _configService.WorkHeader(request.AllotID);
return new ApiResponse(ResponseType.OK, "ok", list);
}
#region HRP人员科室
/// <summary>
/// 获取HRP人员科室
/// </summary>
/// <param name="hospitalId"></param>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("hrpdepthands/{hospitalId}/allot/{allotId}")]
[HttpPost]
public ApiResponse GetHrpDeptHands([FromRoute] int hospitalId, int allotId)
{
if (hospitalId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "HospitalId无效");
if (allotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
var relust = _configService.GetHrpDeptHands(hospitalId, allotId);
return new ApiResponse(ResponseType.OK, relust);
}
/// <summary>
/// 保存HRP人员科室
/// </summary>
/// <param name=""></param>
/// <returns></returns>
[Route("savehrpdept/{hospitalId}/allot/{allotId}")]
[HttpPost]
public ApiResponse SaveHrpDept(int hospitalId, int allotId, [FromBody] SaveCollectData request)
{
if (hospitalId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "HospitalId无效");
if (allotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
_configService.SaveDepttypeHands(hospitalId, allotId, request);
return new ApiResponse(ResponseType.OK);
}
#endregion
}
}
\ No newline at end of file
......@@ -466,5 +466,20 @@ public ApiResponse<List<TitleValue>> GetPerforTypeDict([FromRoute] int allotId)
var result = employeeService.GetPerforTypeDict(allotId);
return new ApiResponse<List<TitleValue>>(ResponseType.OK, "绩效类型字典", result);
}
/// <summary>
/// 材料科室考核
/// </summary>
/// <returns></returns>
[Route("deptAssessment/{allotId}")]
[HttpPost]
public ApiResponse GetDeptAssessment(int allotId)
{
if (allotId<=0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var result=employeeService.GetDeptAssessment(allotId);
return new ApiResponse(ResponseType.OK,result);
}
}
}
......@@ -401,11 +401,11 @@ public ApiResponse NursingDeptAuditResult([FromBody] SecondAuditRequest request)
[HttpPost]
public ApiResponse OtherList([FromBody] AgOtherRequest request)
{
//var result = secondAllotService.OtherList(request.SecondId, claimService.GetUserId());
var result = secondAllotDetails.GetOtherTempData(claimService.GetUserId(), request.SecondId, request.IsArchive, request.EmployeeSource, out decimal? realAmount);
var result = secondAllotDetails.GetOtherTempDetails(claimService.GetUserId(), request.SecondId, request.IsArchive, request.EmployeeSource);
//var result = secondAllotDetails.GetOtherTempData(claimService.GetUserId(), request.SecondId, request.IsArchive, request.EmployeeSource, out decimal? realAmount);
var obj = new
{
header = secondAllotService.OtherListHeader(request.SecondId, realAmount),
header = secondAllotService.OtherListHeader(request.SecondId, result?.Sum(t=>t.RealAmount)),
body = result,
};
return new ApiResponse(ResponseType.OK, obj);
......
......@@ -467,6 +467,20 @@
<param name="computeId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.EditHospitalAvg(Performance.DtoModels.Request.ComputerAvgRequest)">
<summary>
编辑全院绩效平均
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.OtherPerStats(System.Int32)">
<summary>
其他医院绩效统计
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.GetDrugtypeList(Performance.DtoModels.DrugpropRequest)">
<summary>
获取 药占比类型信息列表
......@@ -756,6 +770,12 @@
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetDeptAssessment(System.Int32)">
<summary>
材料科室考核
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ExConfigController.Extract(Performance.DtoModels.ModModuleRequest)">
<summary>
绩效数据抽取模板
......
......@@ -1104,6 +1104,11 @@
是否需要二次分配
</summary>
</member>
<member name="P:Performance.DtoModels.PerDataAccountBaisc.NightShiftWorkPerforFee">
<summary>
夜班绩效
</summary>
</member>
<member name="P:Performance.DtoModels.PerDataClinicEmployee.UnitType">
<summary>
核算单元分类
......@@ -1818,6 +1823,26 @@
<member name="P:Performance.DtoModels.AprAmountAuditRequest.Remark">
<summary> 备注 </summary>
</member>
<member name="P:Performance.DtoModels.Request.ComputerAvgRequest.PositionName">
<summary>
绩效核算人群
</summary>
</member>
<member name="P:Performance.DtoModels.Request.ComputerAvgRequest.TotelValue">
<summary>
绩效总额
</summary>
</member>
<member name="P:Performance.DtoModels.Request.ComputerAvgRequest.AvgValue">
<summary>
人均绩效
</summary>
</member>
<member name="P:Performance.DtoModels.Request.ComputerAvgRequest.TotelNumber">
<summary>
总人数
</summary>
</member>
<member name="P:Performance.DtoModels.Request.SmsCodeRequest.Type">
<summary>
短信验证类型 1 手机号登录 2 其他
......
......@@ -5598,6 +5598,11 @@
是否需要二次分配
</summary>
</member>
<member name="P:Performance.EntityModels.res_account.NightShiftWorkPerforFee">
<summary>
夜班绩效
</summary>
</member>
<member name="T:Performance.EntityModels.res_accountdoctor">
<summary>
医生科室核算结果
......@@ -6378,6 +6383,11 @@
调节后其他绩效
</summary>
</member>
<member name="P:Performance.EntityModels.res_specialunit.NightShiftWorkPerforFee">
<summary>
夜班绩效
</summary>
</member>
<member name="T:Performance.EntityModels.sys_extract">
<summary>
医院数据提取脚本
......
......@@ -237,6 +237,11 @@ public class PerDataAccountBaisc : IPerData
/// </summary>
public string NeedSecondAllot { get; set; }
/// <summary>
/// 夜班绩效
/// </summary>
public Nullable<decimal> NightShiftWorkPerforFee { get; set; }
#endregion 由计算得出
}
}
using System;
using System.Collections.Generic;
using System.Text;
using FluentValidation;
namespace Performance.DtoModels.Request
{
public class ComputerAvgRequest
{
public int Id { get; set; }
public int AllotId { get; set; }
public int SheetId { get; set; }
/// <summary>
/// 绩效核算人群
/// </summary>
public string PositionName { get; set; }
/// <summary>
/// 绩效总额
/// </summary>
public decimal TotelValue { get; set; }
/// <summary>
/// 人均绩效
/// </summary>
public decimal AvgValue { get; set; }
/// <summary>
/// 总人数
/// </summary>
public decimal TotelNumber { get; set; }
}
public class ComputerRequestValidator : AbstractValidator<ComputerAvgRequest>
{
public ComputerRequestValidator()
{
RuleFor(x => x.Id).NotNull();
RuleFor(x => x.AllotId).NotNull().GreaterThan(0);
RuleFor(x => x.PositionName).NotNull().NotEmpty();
RuleFor(x => x.TotelNumber).NotNull();
RuleFor(x => x.TotelValue).NotNull();
RuleFor(x => x.AvgValue).NotNull();
}
}
}
......@@ -78,6 +78,7 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public virtual DbSet<cof_workloadtype> cof_workloadtype { get; set; }
/// <summary> 工龄对应绩效系数配置 </summary>
public virtual DbSet<cof_workyear> cof_workyear { get; set; }
/// <summary> </summary>
public virtual DbSet<collect_data> collect_data { get; set; }
/// <summary> </summary>
......
......@@ -125,5 +125,9 @@ public class ag_secondallot
/// 护理部审核状态 2 等待审核 3 审核通过 4 驳回
/// </summary>
public Nullable<int> NursingDeptStatus { get; set; }
/// <summary>
/// 夜班绩效
/// </summary>
public decimal? NightShiftWorkPerforFee { get; set; }
}
}
......@@ -195,5 +195,9 @@ public class res_account
/// 是否需要二次分配
/// </summary>
public string NeedSecondAllot { get; set; }
/// <summary>
/// 夜班绩效
/// </summary>
public Nullable<decimal> NightShiftWorkPerforFee { get; set; }
}
}
......@@ -135,5 +135,9 @@ public class res_specialunit
/// 调节后其他绩效
/// </summary>
public Nullable<decimal> AdjustLaterOtherFee { get; set; }
/// <summary>
/// 夜班绩效
/// </summary>
public Nullable<decimal> NightShiftWorkPerforFee { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Performance.EntityModels;
namespace Performance.Repository.Repository
{
public partial class PerforCofHrpDeptRepository:PerforRepository<cof_hrp_department>
{
public PerforCofHrpDeptRepository(PerformanceDbContext context) : base(context)
{
}
}
}
......@@ -268,6 +268,7 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot
var economicData = perSheet.FirstOrDefault(t => t.SheetType == SheetType.ComputeEconomic)?.PerData?.Select(t => (PerData)t);
var doctorWorkloadData = perSheet.FirstOrDefault(t => t.SheetType == SheetType.ComputeDoctorWorkload)?.PerData?.Select(t => (PerData)t);
var nurseWorkloadData = perSheet.FirstOrDefault(t => t.SheetType == SheetType.ComputeNurseWorkload)?.PerData?.Select(t => (PerData)t);
var accountExtraData = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountExtra)?.PerData?.Select(t => (PerData)t);
var pairs = new[]
{
......@@ -301,7 +302,10 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot
}
if (UnitType.医技组 == unitType && workDoctor == null)
workDoctor = info.Data.FirstOrDefault(t => t.UnitType == UnitType.医生组.ToString() && t.AccountingUnit == dept.AccountingUnit);
// 夜班绩效 从医院奖罚的明细项中获取
var nightShift = accountExtraData.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0;
dept.NightShiftWorkPerforFee = nightShift;
//dept.MedicineFactor = workDoctor?.MedicineFactor;
//dept.ScoringAverage = scoreAverage.HasValue ? scoreAverage ?? 0 : dept.ScoringAverage;
dept.ScoringAverage = dept.ScoringAverage;
......@@ -325,6 +329,7 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot
dept.RealGiveFee = Math.Round((dept.AssessLaterPerforTotal * dept.AdjustFactor + dept.AdjustLaterOtherFee) ?? 0);
//dept.Avg = dept.ManagerNumber + dept.Number == 0 ? 0 : dept.PerforTotal / (dept.ManagerNumber + dept.Number);
dept.Avg = dept.Number == 0 ? 0 : dept.PerforTotal / dept.Number;
}
sheet.PerData.AddRange(atDataList);
......
......@@ -136,6 +136,7 @@ public void SpecialUnitCompute(PerExcel excel, per_allot allot, List<res_baiscno
//取出科室
var accountList = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountBasic)?.PerData?.Select(t => (PerDataAccountBaisc)t);
var accountExtraData = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountExtra)?.PerData?.Select(t => (PerData)t);
List<res_specialunit> resDataList = new List<res_specialunit>();
......@@ -173,6 +174,9 @@ public void SpecialUnitCompute(PerExcel excel, per_allot allot, List<res_baiscno
//var materialsExtra = materialsExtras?.FirstOrDefault(w => w.UnitType == UnitType.特殊核算组.ToString() && w.AccountingUnit == dept?.AccountingUnit)?.TotelValue;
//var scoreAverage = accountScoreAverages?.FirstOrDefault(w => w.UnitType == UnitType.特殊核算组.ToString() && w.AccountingUnit == dept?.AccountingUnit)?.TotelValue;
// 夜班绩效 从医院奖罚的明细项中获取
var nightShift = accountExtraData.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0;
decimal? headcount = null;
if (typeList.Any(o => o.Description == item.QuantitativeIndicators))
headcount = group.Number;
......@@ -207,6 +211,7 @@ public void SpecialUnitCompute(PerExcel excel, per_allot allot, List<res_baiscno
AssessBeforeOtherFee = dept?.AssessBeforeOtherFee ?? 0,
AssessLaterOtherFee = dept?.AssessLaterOtherFee ?? 0,
AdjustLaterOtherFee = dept?.AdjustLaterOtherFee ?? 0,
NightShiftWorkPerforFee = nightShift,
};
res.PerforTotal = (sumValue ?? 0) + res.AssessBeforeOtherFee;
res.GiveFee = Math.Round(res.PerforTotal + res.AssessLaterOtherFee ?? 0);
......@@ -541,6 +546,7 @@ public void GenerateSecondAllot(per_allot allot)
Month = allot.Month,
UnitType = ((UnitType)item.UnitType).ToString(),
Department = item.AccountingUnit,
NightShiftWorkPerforFee = item.NightShiftWorkPerforFee,
RealGiveFee = item.RealGiveFee,
});
}
......@@ -548,7 +554,7 @@ public void GenerateSecondAllot(per_allot allot)
}
if (specialList != null)
{
foreach (var item in specialList.Select(w => new { w.AccountingUnit, w.RealGiveFee }).Distinct())
foreach (var item in specialList.Select(w => new { w.AccountingUnit, w.NightShiftWorkPerforFee, w.RealGiveFee }).Distinct())
{
if (!tempSecond.Any(f => f.UnitType == UnitType.特殊核算组.ToString() && f.Department == item.AccountingUnit))
{
......@@ -559,6 +565,7 @@ public void GenerateSecondAllot(per_allot allot)
Month = allot.Month,
UnitType = UnitType.特殊核算组.ToString(),
Department = item.AccountingUnit,
NightShiftWorkPerforFee = item.NightShiftWorkPerforFee,
RealGiveFee = item.RealGiveFee,
});
}
......@@ -580,13 +587,16 @@ public void GenerateSecondAllot(per_allot allot)
UnitType = item.UnitType,
Department = item.Department,
RealGiveFee = item.RealGiveFee,
NightShiftWorkPerforFee = item.NightShiftWorkPerforFee,
Status = 1,
NursingDeptStatus = 1,
});
}
else
{
if (Math.Abs((second.RealGiveFee ?? 0) - (item.RealGiveFee ?? 0)) >= 0.5m && second.Status > 1)
var backResult = Math.Abs((second.RealGiveFee ?? 0) - (item.RealGiveFee ?? 0)) >= 0.5m
|| Math.Abs((second.NightShiftWorkPerforFee ?? 0) - (item.NightShiftWorkPerforFee ?? 0)) >= 0.5m;
if (backResult && second.Status > 1)
{
second.Status = 4;
second.Remark = "科室绩效结果发生变更,需要重新提交";
......
......@@ -9,6 +9,8 @@
using System.Linq.Expressions;
using System.Text;
using System.Text.RegularExpressions;
using Performance.DtoModels.Request;
using Performance.DtoModels.Response;
namespace Performance.Services
{
......@@ -210,8 +212,15 @@ public List<res_baiscnorm> AllComputeAvg(int allotId, List<ComputeResponse> list
List<res_baiscnorm> avgs = new List<res_baiscnorm>();
var emps = perforPeremployeeRepository.GetEntities(w => w.AllotId == allotId);
var jobCategory = emps?.Select(w => string.IsNullOrEmpty(w.JobCategory) ? "未知" : w.JobCategory).Distinct() ?? new List<string>();
var basicnorm = perforResbaiscnormRepository.GetEntities(t => t.AllotID == allotId);
var position = basicnorm?.Select(t => string.IsNullOrEmpty(t.PositionName) ? "" : t.PositionName).Distinct() ?? new List<string>();
foreach (var item in jobCategory)
{
if (position.Contains(item))
{
avgs.Add(basicnorm.First(t => t.PositionName == item));
continue;
}
var sumfee = (from com in list
join emp in emps?.Where(w => w.JobCategory == item)
on com.JobNumber equals emp.PersonnelNumber
......@@ -1416,5 +1425,70 @@ public DeptDataDetails GetDoctorDetail(int computeId)
}
return doctorDetails;
}
public res_baiscnorm EditHospitalAvg(ComputerAvgRequest request)
{
if (request.Id == 0)
{
var baiscnorm = Mapper.Map<res_baiscnorm>(request);
if (!perforResbaiscnormRepository.Add(baiscnorm))
throw new PerformanceException("保存失败");
return Mapper.Map<res_baiscnorm>(baiscnorm);
}
else
{
var baiscnorm = perforResbaiscnormRepository.GetEntity(t => t.ID == request.Id);
if (baiscnorm == null)
throw new PerformanceException($"ID不存在 :{request.Id}");
baiscnorm.TotelNumber = request.TotelNumber;
baiscnorm.TotelValue = request.TotelValue;
baiscnorm.AvgValue = request.AvgValue;
//var baiscnorm = Mapper.Map<res_baiscnorm>(request);
if (!perforResbaiscnormRepository.Update(baiscnorm))
throw new PerformanceException("保存失败");
return Mapper.Map<res_baiscnorm>(baiscnorm);
}
}
public List<Dictionary<string, string>> GetOtherPerStats(List<per_apr_amount> employees)
{
var others = new List<Dictionary<string, string>>();
if (employees==null)
return others;
var perForType = employees.Where(c=>c.Status==3).Select(t => t.PerforType).Distinct();
var doctorNum = employees.Where(c=>c.Status==3).Select(t => t.PersonnelNumber).Distinct().ToList();
if (!doctorNum.Any())
return others;
foreach (var num in doctorNum)
{
var dicData = new Dictionary<string, string>();
var amount = employees.Find(t => t.PersonnelNumber == num);
if (amount == null)
continue;
dicData.Add("核算单元",amount?.AccountingUnit??"");
dicData.Add("工号",amount?.PersonnelNumber??"");
dicData.Add("人员姓名",amount?.DoctorName??"");
foreach (var type in perForType)
{
var emp = employees.Where(t => t.PerforType == type && t.PersonnelNumber == num)?.ToList();
if (!emp.Any())
dicData.Add(type,"0");
else
dicData.Add(type,Math.Round(Convert.ToDecimal(emp?.First()?.Amount),0).ToString());
}
var sum = employees.Where(c=>c.PersonnelNumber==num)?.Sum(t => t.Amount);
dicData.Add("合计",Math.Round(Convert.ToDecimal(sum),0).ToString());
others.Add(dicData);
}
return others;
}
}
}
......@@ -9,6 +9,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Performance.Repository.Repository;
namespace Performance.Services
{
......@@ -27,6 +28,7 @@ public class ConfigService : IAutoInjection
private PerforCofdepttypeRepository perforCofdepttypeRepository;
private PerforPerapramountRepository perapramountRepository;
//private PerforCofcmiRepository perforCofcmiRepository;
private PerforCofHrpDeptRepository perforCofHrpDeptRepository;
private PersonService personService;
private LogManageService logManageService;
private ILogger<ConfigService> logger;
......@@ -43,6 +45,7 @@ public class ConfigService : IAutoInjection
PerforCofdepttypeRepository perforCofdepttypeRepository,
PerforPerapramountRepository perapramountRepository,
//PerforCofcmiRepository perforCofcmiRepository,
PerforCofHrpDeptRepository perforCofHrpDeptRepository,
PersonService personService,
LogManageService logManageService,
ILogger<ConfigService> logger)
......@@ -59,6 +62,7 @@ public class ConfigService : IAutoInjection
this.perforCofdepttypeRepository = perforCofdepttypeRepository;
this.perapramountRepository = perapramountRepository;
//this.perforCofcmiRepository = perforCofcmiRepository;
this.perforCofHrpDeptRepository = perforCofHrpDeptRepository;
this.personService = personService;
this.logManageService = logManageService;
this.logger = logger;
......@@ -834,6 +838,95 @@ private void CopyAprData(int prevAllotId, int allotId)
}
}
public HandsonTable GetHrpDeptHands(int HospitalId,int AllotId)
{
var result = new HandsonTable((int)SheetType.Unidentifiable, HrpDept.Select(t => t.Value).ToArray(), HrpDept.Select(t => new collect_permission
{
HeadName = t.Value,
Visible = 1
}).ToList());
var data = perforCofHrpDeptRepository.GetEntities(t => t.HospitalId == HospitalId && t.AllotId == AllotId);
if (data == null)
return result;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 1;
foreach (var item in data)
{
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in HrpDept join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper() select new HandsonCellData(conf.Value, fst.Value)).ToList();
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
result.SetRowData(rowDatas, rowDatas != null);
return result;
}
public void SaveDepttypeHands(int hospitalId, int allotId,SaveCollectData request)
{
var dicData = CreateDataRow(hospitalId,allotId, request, HrpDept);
List<cof_hrp_department> depts = new List<cof_hrp_department>();
foreach (var item in dicData)
{
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<cof_hrp_department>(json);
if (!string.IsNullOrEmpty(data.HRPDepartment) && !string.IsNullOrEmpty(data.AccountingUnit))
{
data.HospitalId = hospitalId;
data.AllotId = allotId;
depts.Add(data);
}
}
perforCofHrpDeptRepository.Execute("delete from cof_hrp_department where HospitalId=@hospitalId and allotid = @allotid"
, new {hospitalId, allotId });
perforCofHrpDeptRepository.AddRange(depts.ToArray());
}
private List<Dictionary<string, string>> CreateDataRow(int hospitalId, int allotId, SaveCollectData request, Dictionary<string, string> config)
{
List<Dictionary<string, string>> allData = new List<Dictionary<string, string>>();
for (int r = 0; r < request.Data.Length; r++)
{
// 创建固定数据列
Dictionary<string, string> baseData = CreateBaseData(request, config, r);
baseData.Add(nameof(cof_hrp_department.AllotId), allotId.ToString());
baseData.Add(nameof(cof_hrp_department.HospitalId),hospitalId.ToString());
allData.Add(baseData);
}
return allData;
}
private Dictionary<string, string> CreateBaseData(SaveCollectData request, Dictionary<string, string> config, int rownumber)
{
Dictionary<string, string> result = new Dictionary<string, string>();
for (int c = 0; c < request.ColHeaders.Length; c++)
{
var header = request.ColHeaders[c];
var first = config.FirstOrDefault(w => w.Value == header);
if (!default(KeyValuePair<string, string>).Equals(first)
&& !result.ContainsKey(header)
&& request.Data[rownumber].Length > c)
{
result.Add(first.Key, request.Data[rownumber][c]);
}
}
return result;
}
public static Dictionary<string, string> HrpDept { get; } = new Dictionary<string, string>
{
{nameof(cof_hrp_department.HRPDepartment), "hrp人员科室"},
{nameof(cof_hrp_department.AccountingUnit), "核算单元"},
};
///// <summary>
///// CMI值
///// </summary>
......
......@@ -635,7 +635,7 @@ private void SupplyHeaderByWorkItem(int hospitalId, SecondResponse result, ag_se
public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, int employeeSource, out decimal? realAmount)
{
string[] workNumbers = new string[] { };
var details = GetOtherTempDetails(userId, secondId, isArchive, employeeSource, ref workNumbers);
var details = GetOtherTempDetails(userId, secondId, isArchive, employeeSource);
var secondAllot = agsecondallotRepository.GetEntity(t => t.Id == secondId);
......@@ -689,7 +689,7 @@ public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, in
return result;
}
public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int isArchive, int employeeSource, ref string[] workNumbers)
public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int isArchive, int employeeSource)
{
var secondAllot = agsecondallotRepository.GetEntity(t => t.Id == secondId);
if (secondAllot == null) throw new PerformanceException("二次绩效信息无效!");
......@@ -780,7 +780,6 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
}
}
var originalEmployees = personService.GetPerEmployee(secondAllot.AllotId.Value);
workNumbers = originalEmployees?.Select(t => t.PersonnelNumber).Distinct().ToArray();
SupplementSecondDetail(secondAllot, originalEmployees, result, isSupplementTitlePerformance);
return result;
......
......@@ -21,6 +21,7 @@ public class EmployeeService : IAutoInjection
{
private PerforImemployeeRepository perforImemployeeRepository;
private PerforPersheetRepository perforPersheetRepository;
private PerforImdataRepository perforImdataRepository;
private PerforPerallotRepository perforPerallotRepository;
private PerforImemployeeclinicRepository perforImemployeeclinicRepository;
private PerforUserhospitalRepository perforUserhospitalRepository;
......@@ -34,6 +35,7 @@ public class EmployeeService : IAutoInjection
public EmployeeService(PerforImemployeeRepository perforImemployeeRepository,
PerforPersheetRepository perforPersheetRepository,
PerforImdataRepository perforImdataRepository,
PerforPerallotRepository perforPerallotRepository,
PerforImemployeeclinicRepository perforImemployeeclinicRepository,
PerforUserhospitalRepository perforUserhospitalRepository,
......@@ -47,6 +49,7 @@ public class EmployeeService : IAutoInjection
{
this.perforImemployeeRepository = perforImemployeeRepository;
this.perforPersheetRepository = perforPersheetRepository;
this.perforImdataRepository = perforImdataRepository;
this.perforPerallotRepository = perforPerallotRepository;
this.perforImemployeeclinicRepository = perforImemployeeclinicRepository;
this.perforUserhospitalRepository = perforUserhospitalRepository;
......@@ -637,5 +640,55 @@ public List<TitleValue> GetPerforTypeDict(int allotId)
Value = t
}).ToList();
}
#region 科室考核
public List<Dictionary<string, string>> GetDeptAssessment(int allotId)
{
var sheet = perforPersheetRepository.GetEntity(t => t.AllotID == allotId && t.SheetName == "5.4 科室材料考核2");
if (sheet == null)
return new List<Dictionary<string, string>>();
var imData = perforImdataRepository.GetEntities(t => t.AllotID == allotId && t.SheetID == sheet.ID);
var headers = imData.OrderByDescending(c=>c.IsTotal).Select(t => t.TypeName).Distinct();
var dataNum = imData.Select(t => t.RowNumber)?.OrderBy(c => c.Value).Distinct().ToList();
if (!dataNum.Any())
return new List<Dictionary<string, string>>();
var rowData = new List<Dictionary<string, string>>();
foreach (var num in dataNum)
{
var dicData = new Dictionary<string, string>();
var fisHeader = false;
foreach (var header in headers)
{
var headData = imData.Find(t => t.RowNumber == num && t.TypeName == header)?.CellValue;
dicData.Add(header, Math.Round((decimal)headData * 100) + "%");
if (!fisHeader)
{
var data = imData?.First(t => t.RowNumber == num);
switch (data.UnitType)
{
case (int)UnitType.医技组:
dicData.Add("核算单元类型", "医技组");
break;
case (int)UnitType.医生组:
dicData.Add("核算单元类型", "医生组");
break;
case (int)UnitType.护理组:
dicData.Add("核算单元类型", "护理组");
break;
}
dicData.Add("核算单元", data.AccountingUnit);
fisHeader = true;
}
}
rowData.Add(dicData);
}
return rowData;
}
#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