Commit b2d6d463 by 1391696987

Merge branch 'feature/手工录入审核' into develop

parents 477996d8 810ff77e
......@@ -3,7 +3,6 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Performance.DtoModels;
using Performance.DtoModels.Request;
using Performance.DtoModels.Response;
using Performance.EntityModels;
using Performance.Infrastructure;
......@@ -854,16 +853,16 @@ public ApiResponse GetDeptComparisonTotal([FromRoute] int allotId)
/// <summary>
/// 手工录入 - 下拉列表
/// </summary>
/// <param name="allotId"></param>
/// <param name="gather"></param>
/// <returns></returns>
[Route("getgatherdrop/{allotId}")]
[Route("getgatherdrop")]
[HttpPost]
public ApiResponse GetGatherDrop([FromRoute] int allotId)
public ApiResponse GetGatherDrop([FromBody] Gather gather)
{
if (allotId <= 0)
if (gather.AllotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
var relust = employeeService.GetGatherDrop(allotId);
var relust = employeeService.GetGatherDrop(gather);
return new ApiResponse(ResponseType.OK, relust);
}
......@@ -896,34 +895,27 @@ public ApiResponse SaveGatherHands([FromRoute] int allotId, [FromBody] SaveGathe
{
if (allotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
if (string.IsNullOrEmpty(request.Source) || string.IsNullOrEmpty(request.Category))
return new ApiResponse(ResponseType.Fail);
if (request.Data == null || !request.Data.Any())
return new ApiResponse(ResponseType.Fail, "用户提交数据为空");
employeeService.CheckGatherData(allotId, request);
employeeService.SaveGatherHands(allotId, request);
employeeService.AddCategoryToConfig(allotId);
return new ApiResponse(ResponseType.OK);
;
return employeeService.SaveGatherHands(allotId, request);
}
/// <summary>
/// 手工录入列表 - 明细
/// </summary>
/// <param name="allotId"></param>
/// <param name="department">科室</param>
/// <param name="source">来源</param>
/// <param name="request">分页</param>
/// <param name="gather"></param>
/// <returns></returns>
[Route("getgather/{allotId},{department},{source}")]
[Route("getgather")]
[HttpPost]
public ApiResponse GetGather([FromRoute] int allotId, string department, string source, [FromBody] PersonParamsRequest request)
public ApiResponse GetGather([FromBody] Gather gather)
{
if (allotId <= 0 || string.IsNullOrEmpty(department) || string.IsNullOrEmpty(source))
return new ApiResponse(ResponseType.Fail, "参数错误", "请检查allotId,department,source是否正确");
if (gather.AllotId <= 0 || string.IsNullOrEmpty(gather.Source) || string.IsNullOrEmpty(gather.Category) || string.IsNullOrEmpty(gather.Department) )
return new ApiResponse(ResponseType.Fail, "参数错误", "请检查allotId,source,category,department是否正确");
var result = employeeService.GetGather(allotId, department, source, request);
var result = employeeService.GetGather(gather);
return new ApiResponse(ResponseType.OK, result);
......@@ -932,20 +924,50 @@ public ApiResponse GetGather([FromRoute] int allotId, string department, string
/// <summary>
/// 手工录入列表 - 汇总
/// </summary>
/// <param name="allotId"></param>
/// <param name="request">分页</param>
/// <param name="gather"></param>
/// <returns></returns>
[Route("getgathertotal/{allotId}")]
[Route("getgathertotal")]
[HttpPost]
public ApiResponse GetGatherTotal([FromRoute] int allotId, [FromBody] PersonParamsRequest request)
public ApiResponse GetGatherTotal([FromBody] Gather gather)
{
if (allotId <= 0)
if (gather.AllotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
var result = employeeService.GetGatherTotal(allotId, request);
var result = employeeService.GetGatherTotal(gather);
return new ApiResponse(ResponseType.OK, result);
}
/// <summary>
/// 手工录入列表 - 删除
/// </summary>
/// <param name="gather"></param>
/// <returns></returns>
[Route("deleteGather")]
[HttpPost]
public ApiResponse DeleteGather([FromBody] Gather gather)
{
if (gather.AllotId <= 0 || string.IsNullOrEmpty(gather.Source) || string.IsNullOrEmpty(gather.Category) || string.IsNullOrEmpty(gather.Department))
return new ApiResponse(ResponseType.Fail, "参数错误", "请检查allotId,source,category,department是否正确");
var result = employeeService.DeleteGather(gather);
if(result) return new ApiResponse(ResponseType.OK, "删除成功");
else return new ApiResponse(ResponseType.Fail, "删除失败");
}
/// <summary>
/// 批量审核
/// </summary>
/// <param name="gather"></param>
/// <returns></returns>
[Route("auditGather")]
[HttpPost]
public ApiResponse AuditGather([FromBody] List<Gather> gather)
{
employeeService.AuditGather(gather);
return new ApiResponse(ResponseType.OK,"");
}
#endregion
}
}
......@@ -1355,11 +1355,11 @@
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetGatherDrop(System.Int32)">
<member name="M:Performance.Api.Controllers.EmployeeController.GetGatherDrop(Performance.DtoModels.Gather)">
<summary>
手工录入 - 下拉列表
</summary>
<param name="allotId"></param>
<param name="gather"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetGatherHands(System.Int32,Performance.DtoModels.GatherRequest)">
......@@ -1378,22 +1378,32 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetGather(System.Int32,System.String,System.String,Performance.DtoModels.PersonParamsRequest)">
<member name="M:Performance.Api.Controllers.EmployeeController.GetGather(Performance.DtoModels.Gather)">
<summary>
手工录入列表 - 明细
</summary>
<param name="allotId"></param>
<param name="department">科室</param>
<param name="source">来源</param>
<param name="request">分页</param>
<param name="gather"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetGatherTotal(System.Int32,Performance.DtoModels.PersonParamsRequest)">
<member name="M:Performance.Api.Controllers.EmployeeController.GetGatherTotal(Performance.DtoModels.Gather)">
<summary>
手工录入列表 - 汇总
</summary>
<param name="allotId"></param>
<param name="request">分页</param>
<param name="gather"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.DeleteGather(Performance.DtoModels.Gather)">
<summary>
手工录入列表 - 删除
</summary>
<param name="gather"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.AuditGather(System.Collections.Generic.List{Performance.DtoModels.Gather})">
<summary>
批量审核
</summary>
<param name="gather"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ExConfigController.Extract(Performance.DtoModels.ModModuleRequest)">
......
......@@ -3489,6 +3489,36 @@
汇总
</summary>
</member>
<member name="P:Performance.DtoModels.Gather.UserId">
<summary>
用户Id
</summary>
</member>
<member name="P:Performance.DtoModels.Gather.Department">
<summary>
科室
</summary>
</member>
<member name="P:Performance.DtoModels.Gather.Source">
<summary>
来源
</summary>
</member>
<member name="P:Performance.DtoModels.Gather.Category">
<summary>
核算项目
</summary>
</member>
<member name="P:Performance.DtoModels.Gather.Status">
<summary>
状态
</summary>
</member>
<member name="P:Performance.DtoModels.Gather.Remark">
<summary>
失败理由
</summary>
</member>
<member name="P:Performance.DtoModels.GuaranteeResponse.AllotId">
<summary>
......
......@@ -3624,14 +3624,29 @@
来源
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.Submitter">
<summary>
提交人
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.CreateTime">
<summary>
创建时间
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.AuditTime">
<summary>
审核时间
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.States">
<summary>
审核状态 0未审核 1 未通过 2 通过 3审核中
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.Remark">
<summary>
备注
失败理由
</summary>
</member>
<member name="T:Performance.EntityModels.ex_script">
......@@ -6590,6 +6605,11 @@
</summary>
</member>
<member name="P:Performance.EntityModels.per_dept_dic.AllotId">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.per_dept_dic.HISDeptName">
<summary>
his系统科室名称
......
......@@ -78,6 +78,7 @@ public AutoMapperConfigs()
CreateMap<PerDataEmployee, im_employee>();
CreateMap<im_employee, PerDataEmployee>();
CreateMap<res_baiscnorm, ComputerAvgRequest>().ReverseMap();
CreateMap<ex_result_gather, GatherTotalRequest>();
//CreateMap<PerDataAccountBaisc, PerDataAccount>()
// .ForMember(dest => dest.AccountingUnit, opt => opt.MapFrom(src => src.AccountingUnit))
......
......@@ -171,4 +171,11 @@ public enum Deduction
}
}
public enum AuditGatherEnum
{
未审核 = 0,
未通过 = 1,
已通过 = 2,
}
}
......@@ -95,18 +95,23 @@ public class ColumnHeadsConfig
public static List<Heads> GatherHeads { get; } = new List<Heads>
{
new Heads{Column="来源",Name=nameof(GatherInfoRequest.Source)},
new Heads{Column="科室",Name=nameof(GatherInfoRequest.Department)},
new Heads{Column="His科室",Name=nameof(GatherInfoRequest.Department)},
new Heads{Column="医生姓名",Name=nameof(GatherInfoRequest.DoctorName)},
new Heads{Column="人员工号",Name=nameof(GatherInfoRequest.PersonnelNumber)},
new Heads{Column="费用类型",Name=nameof(GatherInfoFee.Category)},
new Heads{Column="费用",Name=nameof(GatherInfoFee.Fee)},
new Heads{Column="数值类型",Name=nameof(GatherInfoFee.Category)},
new Heads{Column="数值",Name=nameof(GatherInfoFee.Fee)},
};
public static List<Heads> GatherTotal { get; } = new List<Heads>
{
new Heads{Column="科室",Name=nameof(GatherTotalRequest.Department)},
new Heads{Column="His科室",Name=nameof(GatherTotalRequest.Department)},
new Heads{Column="来源",Name=nameof(GatherTotalRequest.Source)},
new Heads{Column="费用",Name=nameof(GatherTotalRequest.Fee)}
new Heads{Column="核算项目",Name=nameof(GatherTotalRequest.Category)},
new Heads{Column="提交人",Name=nameof(UserRequest.Login)},
new Heads{Column="提交日期",Name=nameof(GatherTotalRequest.CreateTime)},
new Heads{Column="审核日期",Name=nameof(GatherTotalRequest.AuditTime)},
new Heads{Column="审核状态",Name=nameof(GatherTotalRequest.States)},
new Heads{Column="失败理由",Name=nameof(GatherTotalRequest.Remark)},
};
}
......
using Performance.DtoModels.Request;
using Performance.EntityModels;
using Performance.Infrastructure.Models;
using System;
using System.Collections.Generic;
namespace Performance.DtoModels
......@@ -8,7 +9,7 @@ namespace Performance.DtoModels
public class GatherResponse
{
public List<Heads> Heads { get; set; }
public List<GatherTotalRequest> Datas { get; set; }
public List<Dictionary<string, object>> Datas { get; set; }
public int CurrentPage { get; set; }
public int TotalPages { get; set; }
public int PageSize { get; set; }
......@@ -26,8 +27,6 @@ public class GatherInfo
public class GatherDropResponse
{
public string Label { get; set; }
public string Value { get; set; }
public List<GatherDropResponse> Children { get; set; }
......@@ -41,18 +40,52 @@ public class GatherRequest
public class GatherTotalRequest
{
public int ID { get; set; }
public string Department { get; set; }
public string Source { get; set; }
public decimal Fee { get; set; }
public string Category { get; set; }
public string CreateTime { get; set; }
public string AuditTime { get; set; }
public string States { get; set; }
public string Remark { get; set; }
}
public class Gather: PersonParamsRequest
{
public int AllotId { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public int UserId { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 来源
/// </summary>
public string Source { get; set; }
/// <summary>
/// 核算项目
/// </summary>
public string Category { get; set; }
/// <summary>
/// 状态
/// </summary>
public string Status { get; set; }
/// <summary>
/// 失败理由
/// </summary>
public string Remark { get; set; }
}
public class GatherInfoRequest
{
public int UserId { get; set; }
public string Source { get; set; }
public string CreateTime { get; set; }
public string Department { get; set; }
public string DoctorName { get; set; }
public string PersonnelNumber { get; set; }
public List<GatherInfoFee> Detail { get; set; }
public GatherInfoFee[] Detail { get; set; }
}
public class GatherInfoFee
......
......@@ -32,6 +32,7 @@ public class SaveCustomData
public class SaveGatherData
{
public int UserId { get; set; }
public string Source { get; set; }
public string Category { get; set; }
public string[] ColHeaders { get; set; }
......
......@@ -39,16 +39,24 @@ public class ex_result_gather
/// </summary>
public string Source { get; set; }
/// <summary>
/// 提交人
/// </summary>
public int Submitter { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 备注
/// 审核时间
/// </summary>
public DateTime? AuditTime { get; set; }
/// <summary>
/// 审核状态 0未审核 1 未通过 2 通过 3审核中
/// </summary>
public int States { get; set; }
/// <summary>
/// 失败理由
/// </summary>
public string Remark { get; set; }
// /// <summary>
// /// 1 未通过 2 通过
// /// </summary>
// public int States { get; set; }
}
}
......@@ -18,8 +18,8 @@ public class per_attendance_vacation
public string PersonnelNumber { get; set; } //工号
public string PersonnelName { get; set; } //姓名
public int TypeId { get; set; } //per_attendance_type表中ID
public DateTime BegDate { get; set; } //开始时间
public DateTime EndDate { get; set; } //结束时间
public DateTime? BegDate { get; set; } //开始时间
public DateTime? EndDate { get; set; } //结束时间
}
}
......@@ -20,6 +20,10 @@ public class per_dept_dic
/// </summary>
[Key]
public int Id { get; set; }
/// <summary>
///
/// </summary>
public int AllotId { get; set; }
/// <summary>
/// his系统科室名称
......
......@@ -240,7 +240,7 @@ public ApiResponse BatchCallIn(int allotId, int hospitalId, SaveCollectData requ
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "调入核算单元", newAttendanceVacatione[i].CallInAccountingUnit??"" },
{ "调入组别", newAttendanceVacatione[i].CallInUnitType??"" },
{ "调入时间", newAttendanceVacatione[i].CallInDate.ToString()??"" },
{ "调入时间", newAttendanceVacatione[i].CallInDate?.ToString("d")??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "“关键信息缺失”请补全或删除" },
});
......@@ -255,9 +255,9 @@ public ApiResponse BatchCallIn(int allotId, int hospitalId, SaveCollectData requ
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "调入核算单元", newAttendanceVacatione[i].CallInAccountingUnit??"" },
{ "调入组别", newAttendanceVacatione[i].CallInUnitType??"" },
{ "调入时间", newAttendanceVacatione[i].CallInDate.ToString()??"" },
{ "调入时间", newAttendanceVacatione[i].CallInDate?.ToString("d")??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "调入时间不在当前绩效月份范围内" },
{ "错误原因", $"调入时间不在当前绩效月份范围内,已超出{SplitEveryDay(dt.AddDays(-1),newAttendanceVacatione[i].CallInDate.Value).Count-1}天"},
});
}
......@@ -270,7 +270,7 @@ public ApiResponse BatchCallIn(int allotId, int hospitalId, SaveCollectData requ
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "调入核算单元", newAttendanceVacatione[i].CallInAccountingUnit??"" },
{ "调入组别", newAttendanceVacatione[i].CallInUnitType??"" },
{ "调入时间", newAttendanceVacatione[i].CallInDate.ToString()??"" },
{ "调入时间", newAttendanceVacatione[i].CallInDate?.ToString("d")??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "该核算单元的调入组别不一致或不存在" },
});
......@@ -285,7 +285,7 @@ public ApiResponse BatchCallIn(int allotId, int hospitalId, SaveCollectData requ
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "调入核算单元", newAttendanceVacatione[i].CallInAccountingUnit??"" },
{ "调入组别", newAttendanceVacatione[i].CallInUnitType??"" },
{ "调入时间", newAttendanceVacatione[i].CallInDate.ToString()??"" },
{ "调入时间", newAttendanceVacatione[i].CallInDate?.ToString("d")??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "该人员与人员字典不一致或不存在" },
});
......@@ -300,7 +300,7 @@ public ApiResponse BatchCallIn(int allotId, int hospitalId, SaveCollectData requ
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "调入核算单元", newAttendanceVacatione[i].CallInAccountingUnit??"" },
{ "调入组别", newAttendanceVacatione[i].CallInUnitType??"" },
{ "调入时间", newAttendanceVacatione[i].CallInDate.ToString()??"" },
{ "调入时间", newAttendanceVacatione[i].CallInDate?.ToString("d")??"" },
{ "来源", "“粘贴数据”与“历史数据”比对" },
{ "错误原因", $"原名“{oldEmp.PersonnelName}”,工号相同但姓名不同,请删除“历史数据”中该员工" },
});
......@@ -422,8 +422,8 @@ public HandsonTable GetAttendanceVacationHandsonTable(int allotId)
t.PersonnelName,
t.PersonnelNumber,
t.AttendanceName,
BegDate = t.BegDate > DateTime.MinValue ? t.BegDate.ToString("d") : t.BegDate.ToString(),
EndDate = t.EndDate > DateTime.MinValue ? t.EndDate.ToString("d") : t.EndDate.ToString()
BegDate = t.BegDate > DateTime.MinValue ? t.BegDate?.ToString("d") : t.BegDate.ToString(),
EndDate = t.EndDate > DateTime.MinValue ? t.EndDate?.ToString("d") : t.EndDate.ToString()
});
if (convertDate == null)
return handson;
......@@ -494,14 +494,13 @@ public ApiResponse AttendanceBatch(int allotId, int hospitalId, SaveCollectData
if (dicData == null || dicData.Count == 0)
return new ApiResponse(ResponseType.Error, "空数据,无效操作");
var convertDicData = dicData.Select(w => new RecordAttendcance
{
PersonnelNumber = w["PersonnelNumber"],
PersonnelName = w["PersonnelName"],
AttendanceName = w["AttendanceName"],
BegDate = ConvertHelper.To<DateTime>(w["BegDate"]),
EndDate = ConvertHelper.To<DateTime>(w["EndDate"]),
BegDate = ConvertHelper.To<DateTime?>(w["BegDate"]),
EndDate = ConvertHelper.To<DateTime?>(w["EndDate"]),
});
var jsons = JsonHelper.Serialize(convertDicData);
......@@ -529,8 +528,8 @@ public ApiResponse AttendanceBatch(int allotId, int hospitalId, SaveCollectData
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "考勤类型", newAttendanceVacatione[i].AttendanceName??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate.ToString()??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate.ToString()??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate?.ToString("d")??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate?.ToString("d")??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "“关键信息缺失”请补全或删除" },
});
......@@ -545,8 +544,8 @@ public ApiResponse AttendanceBatch(int allotId, int hospitalId, SaveCollectData
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "考勤类型", newAttendanceVacatione[i].AttendanceName??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate.ToString()??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate.ToString()??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate?.ToString("d")??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate?.ToString("d")??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "没有该考勤类型" },
});
......@@ -559,8 +558,8 @@ public ApiResponse AttendanceBatch(int allotId, int hospitalId, SaveCollectData
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "考勤类型", newAttendanceVacatione[i].AttendanceName??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate.ToString()??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate.ToString()??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate?.ToString("d")??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate?.ToString("d")??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "该人员与人员字典不一致或不存在" },
});
......@@ -574,16 +573,16 @@ public ApiResponse AttendanceBatch(int allotId, int hospitalId, SaveCollectData
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "考勤类型", newAttendanceVacatione[i].AttendanceName??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate.ToString()??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate.ToString()??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate?.ToString("d")??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate?.ToString("d")??"" },
{ "来源", "“粘贴数据”与“历史数据”比对" },
{ "错误原因", $"原名“{oldEmp.PersonnelName}”,工号相同但姓名不同,请删除“历史数据”中该员工" },
});
}
DateTime dt = new DateTime(per_allot.Year, per_allot.Month, 1);
if (newAttendanceVacatione[i].BegDate >= dt && newAttendanceVacatione[i].EndDate > dt.AddMonths(1))
DateTime dt = new DateTime(per_allot.Year, per_allot.Month, 1).AddMonths(1);
if (newAttendanceVacatione[i].BegDate >= dt && newAttendanceVacatione[i].EndDate > dt)
{
error.Add(new Dictionary<string, string>
{
......@@ -591,10 +590,10 @@ public ApiResponse AttendanceBatch(int allotId, int hospitalId, SaveCollectData
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "考勤类型", newAttendanceVacatione[i].AttendanceName??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate.ToString()??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate.ToString()??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate?.ToString("d")??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate?.ToString("d")??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "考勤时间不在该绩效月份内" },
{ "错误原因", $"考勤时间不在该绩效月份内,已超出{SplitEveryDay(dt.AddDays(-1),newAttendanceVacatione[i].EndDate.Value).Count-1}" },
});
}
if (newAttendanceVacatione[i].BegDate > newAttendanceVacatione[i].EndDate)
......@@ -605,8 +604,8 @@ public ApiResponse AttendanceBatch(int allotId, int hospitalId, SaveCollectData
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "考勤类型", newAttendanceVacatione[i].AttendanceName??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate.ToString()??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate.ToString()??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate?.ToString("d")??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate?.ToString("d")??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "开始时间不能大于结束时间" },
});
......@@ -713,7 +712,7 @@ public ApiResponse<List<AttendanceStatistics>> GetAttendanceStatistics(int allot
{
w.PersonnelNumber,
Type = types.FirstOrDefault(p => p.Id == w.TypeId)?.AttendanceName ?? "考勤类型缺失",
Dates = SplitEveryDay(w.BegDate.Date, w.EndDate.Date),
Dates = SplitEveryDay(w.BegDate.Value.Date, w.EndDate.Value.Date),
Remark = types.FirstOrDefault(p => p.Id == w.TypeId)?.IsDeduction == (int)Attendance.Deduction.核减 ? "核减" : "不核减",
});
......
using AutoMapper;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.SS.Util;
......@@ -45,6 +46,7 @@ public class EmployeeService : IAutoInjection
private readonly PerforExitemRepository exitemRepository;
private readonly PerforExspecialRepository exspecialRepository;
private readonly PerforExresultRepository exresultRepository;
private readonly PerforCollectpermissionRepository perforcollectpermissionRepository;
private ILogger<EmployeeService> logger;
public EmployeeService(
......@@ -70,6 +72,7 @@ public class EmployeeService : IAutoInjection
PerforExitemRepository exitemRepository,
PerforExspecialRepository exspecialRepository,
PerforExresultRepository exresultRepository,
PerforCollectpermissionRepository perforcollectpermissionRepository,
ILogger<EmployeeService> logger)
{
_mapper = mapper;
......@@ -94,6 +97,7 @@ public class EmployeeService : IAutoInjection
this.exitemRepository = exitemRepository;
this.exspecialRepository = exspecialRepository;
this.exresultRepository = exresultRepository;
this.perforcollectpermissionRepository = perforcollectpermissionRepository;
this.logger = logger;
}
......@@ -1247,58 +1251,64 @@ public ComparisonResponse<DtoModels.Comparison<DeptComparisonTotal>> GetDeptComp
#region 手工数据录入
public List<GatherDropResponse> GetGatherDrop(int allotId)
public List<GatherDropResponse> GetGatherDrop(Gather gather)
{
var perSheets = perforPersheetRepository.GetEntities(t => t.AllotID == allotId && new[] { 3, 4, 7 }.Contains(t.SheetType.Value));
if (perSheets == null || !perSheets.Any())
{
var allot = perallotRepository.GetEntity(t => t.ID == allotId);
var list = perallotRepository.GetEntities(t => t.HospitalId == allot.HospitalId);
if (list == null || !list.Any(t => t.ID == allot.ID)) return new List<GatherDropResponse>();
List<GatherDropResponse> result = new List<GatherDropResponse>();
list = list.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).ToList();
var username = userRepository.GetEntity(t => t.ID == gather.UserId);
var index = list.IndexOf(list.First(t => t.ID == allot.ID));
if (username.Login == "admin")
{
var types = new[] { (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload, (int)SheetType.SpecialUnit };
// 先取上一个月的绩效Id,若没有取最后一个月的绩效Id,若都不存在则获取allotId为-1的数据
allotId = index + 1 < list.Count ? list[index + 1].ID : list.First().ID;
if (allotId == allot.ID) return new List<GatherDropResponse>();
}
var sheets = exmoduleRepository.GetEntities(w => types.Contains(w.SheetType ?? 0));
var specials = exspecialRepository.GetEntities();
var takeOut = new[] { "核算单元(医技组)", "核算单元(医生组)", "核算单元(护理组)" };
//var sheets = perSheets.Select(t => new GatherDropResponse() { Label = t.SheetName, Value = t.SheetName });
var headers = exitemRepository.GetEntities(w => sheets.Select(m => m.Id).Contains(w.ModuleId ?? 0) && !takeOut.Contains(w.ItemName)) ?? new List<ex_item>();
var imHeaders = imheaderRepository.GetEntities(t => t.AllotID == allotId);
if (specials != null && specials.Any())
{
sheets.Add(new ex_module
{
SheetType = (int)SheetType.SpecialUnit,
ModuleName = "4.2 特殊核算单元绩效测算表",
Id = 0,
});
var exresultgather = exresultgatherRepository.GetEntities(t => t.AllotId == allotId);
headers.AddRange(specials.Select(t => new ex_item { ItemName = t.Target, ModuleId = 0 }));
}
// 查询sheet和列头对应
var sheetHeads = from sheet in sheets
join head in headers on sheet.Id equals head.ModuleId
select new { sheet.ModuleName, sheet.SheetType, HeadName = head.ItemName };
foreach (var item in exresultgather.Select(t => new { t.Category, t.Source }).Distinct())
{
int id = perSheets.Where(t => t.SheetName.Contains(item.Source)).Select(t => new { t.ID }).ToList()[0].ID;
imHeaders.Add(
new im_header
result = sheetHeads.GroupBy(t => t.ModuleName).Select(s => new GatherDropResponse
{
Value = Regex.Replace(s.Key.Replace(" ", "").Replace(".", ""), "[0-9]", ""),
Children = sheetHeads.Where(t => t.ModuleName == s.Key).Select(t => new GatherDropResponse()
{
SheetID = id,
CellValue = item.Category
}
);
Value = Regex.Replace(t.HeadName.Replace(" ", "").Replace(".", ""), "[0-9]", "")
}).ToList()
}).ToList();
}
var result = new List<GatherDropResponse>();
var cellValue = new[] { "核算单元(医技组)", "核算单元(医生组)", "核算单元(护理组)", "科室名称" };
foreach (var sheet in perSheets)
else
{
var drop = new GatherDropResponse();
var header = imHeaders.Where(t => t.SheetID == sheet.ID && !cellValue.Contains(t.CellValue)).Select(t => t.CellValue).Distinct();
drop.Label = Regex.Replace(sheet.SheetName.Replace(" ", "").Replace(".", ""), "[0-9]", "")/*sheet.SheetName.Split(' ')[1]*/;
drop.Value = Regex.Replace(sheet.SheetName.Replace(" ", "").Replace(".", ""), "[0-9]", "")/*sheet.SheetName.Split(' ')[1]*/;
drop.Children = header.Select(t => new GatherDropResponse() { Label = t, Value = t }).ToList();
result.Add(drop);
}
var permissions = perforcollectpermissionRepository.GetEntities(w => w.UserId == gather.UserId);
result = permissions.GroupBy(t => t.SheetName).Select(s => new GatherDropResponse
{
Value = Regex.Replace(s.Key.Replace(" ", "").Replace(".", ""), "[0-9]", ""),
Children = permissions.Where(t => t.SheetName == s.Key).Select(t => new GatherDropResponse()
{
Value = Regex.Replace(t.HeadName.Replace(" ", "").Replace(".", ""), "[0-9]", "")
}).ToList()
}).ToList();
}
return result;
}
......@@ -1350,75 +1360,32 @@ public HandsonTable GetGatherHands(int AllotId, GatherRequest request)
return result;
}
public void SaveGatherHands(int allotId, SaveGatherData request)
public bool DeleteGather(Gather gather)
{
var dicData = CreateDataRow(0, allotId, request, Gather);
List<ex_result_gather> depts = new List<ex_result_gather>();
DateTime timeNow = DateTime.Now;
foreach (var item in dicData)
{
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<ex_result_gather>(json);
if (!string.IsNullOrEmpty(data.Department) && !string.IsNullOrEmpty(data.Fee.ToString()))
{
data.Source = request.Source;
data.Category = request.Category;
data.AllotId = allotId;
data.CreateTime = timeNow;
depts.Add(data);
}
}
exresultgatherRepository.Execute($@"delete from ex_result_gather where allotid = @allotid and source like '%{request.Source}%' and category = '{request.Category}' ", new { allotId });
exresultgatherRepository.AddRange(depts.ToArray());
var delete = exresultgatherRepository.GetEntities(t => t.AllotId == gather.AllotId && t.Department == gather.Department && t.Source == gather.Source && t.Category == gather.Category);
//exresultgatherRepository.Execute($@"delete from ex_result_gather where allotid = @allotid and department like '%{request.Department}%'and source like '%{request.Source}%' and category like '%{request.Category}%' ", new { allotId });
return exresultgatherRepository.RemoveRange(delete.ToArray());
}
public GatherInfo GetGather(int allotId, string department, string source, PersonParamsRequest request)
public GatherInfo GetGather(Gather gather)
{
Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == allotId && t.Department.Contains(department) && t.Source.Contains(source);
if (request != null && !string.IsNullOrEmpty(request.SearchQuery))
exp = exp.And(t => t.AllotId == allotId && t.Department.Contains(department) && t.Source.Contains(source) && t.DoctorName.Contains(request.SearchQuery) || t.PersonnelNumber.Contains(request.SearchQuery));
Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == gather.AllotId && t.Department == gather.Department && t.Source.Contains(gather.Source) && t.Category.Contains(gather.Category);
var datas = exresultgatherRepository.GetEntities(exp);
if (gather != null && !string.IsNullOrEmpty(gather.SearchQuery))
exp = exp.And(t => t.DoctorName.Contains(gather.SearchQuery) || t.PersonnelNumber.Contains(gather.SearchQuery));
var datas = exresultgatherRepository.GetEntities(exp).OrderByDescending(t => t.CreateTime);
var result = datas.GroupBy(a => new { a.Source, a.Department, a.DoctorName, a.PersonnelNumber }).Select(t => new
var result = datas.Select(t => new GatherInfoRequest
{
Source = t.Key.Source,
Department = t.Key.Department,
DoctorName = t.Key.DoctorName,
PersonnelNumber = t.Key.PersonnelNumber,
Detail = t.GroupBy(group => group.Category).Select(s => new TitleValue<decimal>
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Value = s.Sum(sum => sum.Fee)
})
Source = Regex.Replace(t.Source.Replace(" ", "").Replace(".", ""), "[0-9]", ""),
CreateTime = t.CreateTime.ToString("d"),
Department = t.Department,
UserId = t.Submitter,
PersonnelNumber = t.PersonnelNumber,
DoctorName = t.DoctorName,
Detail = new GatherInfoFee[] { new GatherInfoFee { Category = gather.Category, Fee = t.Fee } }
});
List<GatherInfoRequest> gatherInfoRequests = new List<GatherInfoRequest>();
foreach (var item in result.ToList())
{
GatherInfoRequest gatherInfoRequest = new GatherInfoRequest()
{
Source = Regex.Replace(item.Source.Replace(" ", "").Replace(".", ""), "[0-9]", ""),
Department = item.Department,
DoctorName = item.DoctorName,
PersonnelNumber = item.PersonnelNumber,
Detail = new List<GatherInfoFee>()
};
foreach (var item2 in item.Detail)
{
GatherInfoFee gatherInfoFee = new GatherInfoFee()
{
Category = item2.Title,
Fee = item2.Value
};
gatherInfoRequest.Detail.Add(gatherInfoFee);
}
gatherInfoRequests.Add(gatherInfoRequest);
}
var head = ColumnHeadsConfig.GatherHeads;
head.ForEach(t =>
{
......@@ -1428,48 +1395,69 @@ public GatherInfo GetGather(int allotId, string department, string source, Perso
GatherInfo gatherInfo = new GatherInfo()
{
Heads = head,
Datas = gatherInfoRequests.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize).ToList(),
CurrentPage = request.PageNumber,
TotalCount = gatherInfoRequests.Count(),
PageSize = request.PageSize,
TotalPages = (int)Math.Ceiling((double)gatherInfoRequests.Count() / request.PageSize)
Datas = result.Skip((gather.PageNumber - 1) * gather.PageSize).Take(gather.PageSize).ToList(),
CurrentPage = gather.PageNumber,
TotalCount = result.Count(),
PageSize = gather.PageSize,
TotalPages = (int)Math.Ceiling((double)result.Count() / gather.PageSize)
};
return gatherInfo;
}
public GatherResponse GetGatherTotal(int allotId, PersonParamsRequest request)
public GatherResponse GetGatherTotal(Gather gather)
{
List<GatherTotalRequest> gatherTotalRequests = new List<GatherTotalRequest>();
Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == allotId;
Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == gather.AllotId;
if (request != null && !string.IsNullOrEmpty(request.SearchQuery))
if (gather != null && !string.IsNullOrEmpty(gather.SearchQuery))
{
exp = exp.And(t => t.Department.Contains(request.SearchQuery) || t.Source.Contains(request.SearchQuery));
exp = exp.And(t => t.Category.Contains(gather.SearchQuery) || t.Source.Contains(gather.SearchQuery) || t.Department.Contains(gather.SearchQuery));
}
var datas = exresultgatherRepository.GetEntities(exp);
if (datas != null && datas.Any())
var user = userRepository.GetEntities();
var userLogin= user.FirstOrDefault(t => t.ID == gather.UserId);
if (userLogin.Login != "admin")
{
var result = datas.GroupBy(a => new { a.AllotId, a.Department, a.Source }).Select(t => new
var userSource = perforcollectpermissionRepository.GetEntities(t => t.UserId == gather.UserId)
.Select(s => Regex.Replace(s.SheetName.Replace(" ", "").Replace(".", ""), "[0-9]", ""))
.Distinct().ToList();
exp = exp.And(t => userSource.Contains(t.Source));
var hasDepartment = perdeptdicRepository.GetEntities(p=>p.AccountingUnit.Contains(userLogin.Department)).Select(s=>s.HISDeptName).Distinct().ToList();
exp = exp.And(t => hasDepartment.Contains(t.Department));
}
var datas = exresultgatherRepository.GetEntities(exp)
.GroupBy(t => new { t.Department, t.Source, t.Category, t.Submitter })
.Select(s => new
{
ID = t.Key.AllotId,
Department = t.Key.Department,
Source = t.Key.Source,
Fee = t.Sum(a => a.Fee)
Department = s.Key.Department,
Source = s.Key.Source,
Category = s.Key.Category,
UserId = s.Key.Submitter,
Login = user.FirstOrDefault(t => t.ID == s.Key.Submitter).Login,
CreateTime = s.Max(t => t.CreateTime).ToString("d"),
AuditTime = s.Max(t => t.AuditTime)?.ToString("d"),
States = s.Any(w => w.States == (int)AuditGatherEnum.未通过) ? "未通过"
: s.Count() == s.Where(w => w.States == (int)AuditGatherEnum.已通过).Count() ? "已通过"
: s.Count() == s.Where(w => w.States == (int)AuditGatherEnum.未审核).Count() ? "未审核" : "未知",
Remark = s.FirstOrDefault()?.Remark,
});
foreach (var item in result.ToList())
if (gather.Status == "失败") datas = datas.Where(w => w.States == "未通过");
if (gather.Status == "通过") datas = datas.Where(w => w.States == "已通过");
var ser = JsonConvert.SerializeObject(datas.OrderByDescending(t => t.CreateTime));
var rows = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(ser);
var data = new List<Dictionary<string, object>>();
foreach (var obj in rows)
{
Dictionary<string, object> nobj = new Dictionary<string, object>();
foreach (var item in obj)
{
GatherTotalRequest gatherTotalRequest = new GatherTotalRequest()
{
ID = item.ID,
Department = item.Department,
Source = Regex.Replace(item.Source.Replace(" ", "").Replace(".", ""), "[0-9]", "")/*item.Source.Split(' ')[1]*/,
Fee = item.Fee
};
gatherTotalRequests.Add(gatherTotalRequest);
nobj[item.Key.ToLower()] = item.Value;
}
data.Add(nobj);
}
var head = ColumnHeadsConfig.GatherTotal;
......@@ -1480,11 +1468,11 @@ public GatherResponse GetGatherTotal(int allotId, PersonParamsRequest request)
GatherResponse gatherResponse = new GatherResponse()
{
Heads = head,
Datas = gatherTotalRequests.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize).ToList(),
CurrentPage = request.PageNumber,
TotalCount = gatherTotalRequests.Count(),
PageSize = request.PageSize,
TotalPages = (int)Math.Ceiling((double)gatherTotalRequests.Count() / request.PageSize)
Datas = data.Skip((gather.PageNumber - 1) * gather.PageSize).Take(gather.PageSize).ToList(),
CurrentPage = gather.PageNumber,
TotalCount = data.Count(),
PageSize = gather.PageSize,
TotalPages = (int)Math.Ceiling((double)data.Count() / gather.PageSize)
};
return gatherResponse;
......@@ -1537,33 +1525,16 @@ public GatherResponse GetGatherTotal(int allotId, PersonParamsRequest request)
#endregion
#region 录入校验
public void CheckGatherData(int allotId, SaveGatherData saveGather)
public ApiResponse SaveGatherHands(int allotId, SaveGatherData saveGather)
{
var allot = perallotRepository.GetEntity(w => w.ID == allotId);
if (allot == null) throw new PerformanceException("绩效记录不存在");
var data = saveGather.Data;
var departments = perdeptdicRepository.GetEntities(w => w.HospitalId == allot.HospitalId);
if (departments == null || !departments.Any()) throw new PerformanceException("未配置科室字典");
var notExistsDeptData = data.Where(w => !departments.Select(t => t.Department).Contains(w[0]));
if (notExistsDeptData != null && notExistsDeptData.Any())
throw new PerformanceException($"科室字典中不存在科室[{string.Join(",", notExistsDeptData.Select(t => t[0]).Distinct())}]");
var employees = peremployeeRepository.GetEntities(w => w.AllotId == allotId);
if (employees == null || !employees.Any()) throw new PerformanceException("未配置人员字典");
var notExistNameData = data.Where(w => !employees.Select(t => t.DoctorName).Contains(w[1]) && !string.IsNullOrEmpty(w[1]));
if (notExistNameData != null && notExistNameData.Any())
throw new PerformanceException($"人员字典中不存在医生姓名[{string.Join(",", notExistNameData.Select(t => t[1]).Distinct())}]");
var notExistNumberData = data.Where(w => !employees.Select(t => t.PersonnelNumber).Contains(w[2]) && !string.IsNullOrEmpty(w[2]));
if (notExistNumberData != null && notExistNumberData.Any())
throw new PerformanceException($"人员字典中不存在工号[{string.Join(",", notExistNumberData.Select(t => t[2]).Distinct())}]");
var departments = perdeptdicRepository.GetEntities(w => w.HospitalId == allot.HospitalId);
if (departments == null || !departments.Any()) throw new PerformanceException("未配置科室字典");
var sheets = perforPersheetRepository.GetEntities(w => w.AllotID == allotId);
if (sheets != null && sheets.Any())
......@@ -1571,22 +1542,156 @@ public void CheckGatherData(int allotId, SaveGatherData saveGather)
if (!sheets.Select(t => t.SheetName).Any(t => t.Contains(saveGather.Source)))
throw new PerformanceException($"来源错误[{saveGather.Source}]");
}
}
private static void SetDataStatesAndRemark(IEnumerable<ex_result_gather> data, int states, string remark, Func<ex_result_gather, string> func = null)
{
if (new int[] { 1, 2 }.Contains(states)) return;
var accountingUnit = userRepository.GetEntity(t => t.ID == saveGather.UserId);
if (accountingUnit == null) throw new PerformanceException($"核算单元不存在");
if (data == null || !data.Any()) return;
var depts = new List<string>();
for (int i = 0; i < saveGather.Data.Length; i++)
{
depts.Add(saveGather.Data[i][0]);
}
foreach (var item in data)
var dict = new Dictionary<string, string>();
Gather.ToList().ForEach(t => dict.Add(t.Key, t.Value));
var dicData = CreateDataRow(0, allotId, saveGather, dict);
if (dicData == null || dicData.Count == 0)
return new ApiResponse(ResponseType.Error, "空数据,无效操作");
var jsons = JsonHelper.Serialize(dicData);
var newGather = JsonHelper.Deserialize<List<ex_result_gather>>(jsons);
var oldGather = exresultgatherRepository.GetEntities(t => t.AllotId == allotId && t.Source == saveGather.Source && t.Category == saveGather.Category && depts.Distinct().Contains(t.Department));
var perdeptdic = perdeptdicRepository.GetEntities(d => d.AccountingUnit == accountingUnit.Department);
var hasDepartment = perdeptdic.Select(s => s.Department).Union(perdeptdic.Select(s => s.HISDeptName));
List<Dictionary<string, string>> error = new List<Dictionary<string, string>>();
for (int i = 0; i < newGather.Count; i++)
{
if (func != null)
remark = string.Format(remark, func.Invoke(item));
//item.States = states;
item.Remark = (!string.IsNullOrEmpty(item.Remark) && item.Remark.Length > 0) ? item.Remark + ", " + remark : remark;
if (string.IsNullOrEmpty(newGather[i].Department)
|| string.IsNullOrEmpty(newGather[i].PersonnelNumber)
|| string.IsNullOrEmpty(newGather[i].DoctorName)
)
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "科室", newGather[i].Department??"" },
{ "医生姓名", newGather[i].DoctorName??"" },
{ "人员工号", newGather[i].PersonnelNumber??"" },
{ "数值", newGather[i].Fee.ToString() },
{ "来源", "粘贴数据" },
{ "错误原因", "关键信息缺失”请补全或删除" },
});
if (newGather[i].Fee == 0)
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "科室", newGather[i].Department??"" },
{ "医生姓名", newGather[i].DoctorName??"" },
{ "人员工号", newGather[i].PersonnelNumber??"" },
{ "数值", newGather[i].Fee.ToString() },
{ "来源", "粘贴数据" },
{ "错误原因", "数值不能等于0" },
});
var ExistsDeptData = departments.FirstOrDefault(w => w.AllotId == allotId
&& (w.Department != null && w.Department.Contains(newGather[i].Department))
|| (w.HISDeptName !=null && w.HISDeptName.Contains(newGather[i].Department))
);
if (ExistsDeptData == null)
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "科室", newGather[i].Department??"" },
{ "医生姓名", newGather[i].DoctorName??"" },
{ "人员工号", newGather[i].PersonnelNumber??"" },
{ "数值", newGather[i].Fee.ToString() },
{ "来源", "粘贴数据" },
{ "错误原因", $"科室字典中不存在科室[{newGather[i].Department}]" },
});
var ExistNameData = employees.FirstOrDefault(w => w.AllotId == allotId && (w.DoctorName!=null && w.DoctorName == newGather[i].DoctorName));
if (ExistNameData == null)
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "科室", newGather[i].Department??"" },
{ "医生姓名", newGather[i].DoctorName??"" },
{ "人员工号", newGather[i].PersonnelNumber??"" },
{ "数值", newGather[i].Fee.ToString() },
{ "来源", "粘贴数据" },
{ "错误原因", $"人员字典中不存在医生姓名[{newGather[i].DoctorName}]" },
});
var ExistNumberData = employees.FirstOrDefault(w => w.AllotId == allotId && (w.PersonnelNumber!= null && w.PersonnelNumber == newGather[i].PersonnelNumber));
if (ExistNumberData == null)
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "科室", newGather[i].Department??"" },
{ "医生姓名", newGather[i].DoctorName??"" },
{ "人员工号", newGather[i].PersonnelNumber??"" },
{ "数值", newGather[i].Fee.ToString() },
{ "来源", "粘贴数据" },
{ "错误原因", $"人员字典中不存在工号[{newGather[i].PersonnelNumber}]" },
});
if((ExistNumberData == null || ExistNumberData.DoctorName != newGather[i].DoctorName)
|| (ExistNameData == null || ExistNameData.PersonnelNumber != newGather[i].PersonnelNumber))
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "科室", newGather[i].Department??"" },
{ "医生姓名", newGather[i].DoctorName??"" },
{ "人员工号", newGather[i].PersonnelNumber??"" },
{ "数值", newGather[i].Fee.ToString() },
{ "来源", "粘贴数据" },
{ "错误原因", $"该人员姓名和工号与人员字典中不匹配" },
});
if (accountingUnit.Login != "admin")
{
if (!hasDepartment.Contains(newGather[i].Department))
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "科室", newGather[i].Department??"" },
{ "医生姓名", newGather[i].DoctorName??"" },
{ "人员工号", newGather[i].PersonnelNumber??"" },
{ "数值", newGather[i].Fee.ToString() },
{ "来源", "粘贴数据" },
{ "错误原因", $"[{newGather[i].Department}]科室不属于[{accountingUnit.Department}]核算单元,[{accountingUnit.Department}]核算单元有【{string.Join("】【", hasDepartment)}】科室" },
});
}
}
if (error.Count > 0)
return new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", error);
newGather.ForEach(t =>
{
t.AllotId = allotId;
t.States = 0;
t.Source = saveGather.Source;
t.Category = saveGather.Category;
t.Submitter = saveGather.UserId;
t.CreateTime = DateTime.Now;
});
exresultgatherRepository.RemoveRange(oldGather.ToArray());
if (newGather != null && newGather.Any())
exresultgatherRepository.AddRange(newGather.ToArray());
AddCategoryToConfig(allotId);
return new ApiResponse(ResponseType.OK, "");
}
public void AddCategoryToConfig(int allotId)
......@@ -1672,7 +1777,53 @@ public void SyncDataToResult(int allotId)
exresultRepository.AddRange(syncData.ToArray());
}
#endregion
public void AuditGather(List<Gather> gather)
{
List<ex_result_gather> ex_Result_Gathers = new List<ex_result_gather>();
var submitter = userRepository.GetEntities(u => gather.Select(g => g.UserId).Contains(u.ID));
var audit = gather.GroupBy(g => new
{
g.AllotId,
g.UserId,
g.Department,
g.Source,
g.Category
}).Select(s => new
{
s.Key.AllotId,
s.Key.UserId,
s.Key.Department,
s.Key.Source,
s.Key.Category
}).ToList();
var datas = exresultgatherRepository.GetEntities(t =>
t.AllotId == audit.FirstOrDefault().AllotId
&& audit.Select(a => a.UserId).Contains(t.Submitter)
&& audit.Select(a => a.Department).Contains(t.Department)
&& audit.Select(a => a.Source).Contains(t.Source)
&& audit.Select(a => a.Category).Contains(t.Category)
);
var gatherFirst = gather.FirstOrDefault();
if (gatherFirst.Status == "通过")
datas.ForEach(d =>
{
d.AuditTime = DateTime.Now;
d.States = (int)AuditGatherEnum.已通过;
d.Remark = null;
});
else if (gatherFirst.Status == "失败")
datas.ForEach(d =>
{
d.AuditTime = DateTime.Now;
d.States = (int)AuditGatherEnum.未通过;
d.Remark = gatherFirst.Remark;
});
exresultgatherRepository.UpdateRange(datas.ToArray());
}
}
public class ComparisonConfig
......@@ -1703,5 +1854,6 @@ public class ComparisonConfig
new Heads{Column="实发不一致",Name="Count"},
new Heads{Column="总额",Name="SumFee"},
};
}
}
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