Commit a10c4efd by ruyun.zhang@suvalue.com

v22.4.18

parents ee75cac4 7ca51ded
...@@ -556,5 +556,27 @@ public ApiResponse GetOwnerPerformance() ...@@ -556,5 +556,27 @@ public ApiResponse GetOwnerPerformance()
var res = _allotService.GetOwnerPerformance(userid); var res = _allotService.GetOwnerPerformance(userid);
return new ApiResponse(ResponseType.OK, res); return new ApiResponse(ResponseType.OK, res);
} }
/// <summary>
/// H5查询个人绩效
/// </summary>
/// <param name="begin">开始月份:2021-03</param>
/// <param name="end">结束月份:2021-04</param>
/// <returns></returns>
[Route("owner/query/mobile")]
[HttpGet]
public ApiResponse<List<OwnerMobilePerformanceDto>> GetOwnerMobilePerformance(string begin = "", string end = "")
{
var userid = _claim.GetUserId();
var beginDate = begin.ToTryDateTime();
var endDate = end.ToTryDateTime();
if (beginDate == DateTime.MinValue || endDate == DateTime.MinValue)
throw new PerformanceException("您选择的时间范围无效");
endDate = endDate.AddMonths(1);
var dtos = _allotService.GetOwnerMobilePerformance(userid, beginDate, endDate);
return new ApiResponse<List<OwnerMobilePerformanceDto>>(ResponseType.OK, dtos);
}
} }
} }
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Performance.DtoModels;
using Performance.EntityModels.Entity;
using Performance.EntityModels.Other;
using Performance.Services;
using System.Collections.Generic;
using Microsoft.AspNetCore.StaticFiles;
using System;
using System.IO;
using Newtonsoft.Json;
namespace Performance.Api.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class AttendanceController : ControllerBase
{
private readonly AttendanceService _attendanceService;
public AttendanceController(
AttendanceService attendanceService
)
{
_attendanceService = attendanceService;
}
/*
per_attendance 考勤-调动记录表
per_attendance_type 考勤-考勤类型
per_attendance_vacation 考勤-考勤记录表
view_attendance 考勤视图
*/
/// <summary>
/// 查询绩效考勤记录
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[HttpGet("GetAttendance/{allotId}")]
public ApiResponse<List<AttendanceStatistics>> GetAttendance(int allotId)
{
// 查询考勤视图,并按照设计图做格式转换 仅查询开始结束
var result = _attendanceService.GetAttendance(allotId);
return result;
}
#region 调动记录
/// <summary>
/// 查询绩效调动记录
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[HttpGet("CallIn/{allotId}")]
public ApiResponse<List<view_attendance>> GetCallIn(int allotId)
{
// 查询考勤视图,并按照设计图做格式转换 仅查询调入
return _attendanceService.GetCallIn(allotId);
}
/// <summary>
/// 返回HandsonTable格式调动记录
/// </summary>
/// <returns></returns>
[HttpGet("CallIn/GetBatch")]
[ProducesResponseType(typeof(HandsonTable), StatusCodes.Status200OK)]
public ApiResponse GetBatchCallInHandsonTable(int allotId)
{
// 返回HandsonTable格式调动记录
return new ApiResponse(ResponseType.OK, _attendanceService.GetBatchCallInHandsonTable(allotId));
}
/// <summary>
/// 批量插入调动记录
/// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost("CallIn/Batch/{allotId}")]
public ApiResponse BatchCallIn(int allotId, int hospitalId, SaveCollectData request)
{
// obj自己定义结构
// 批量插入调动记录,插入前需要删除所有后重新插入
// 需要验证工号和姓名是否与“人员字典”(per_employee)完全匹配,不匹配则返回表格错误提示
// 需要验证核算组别和核算单元是否与“核算单元及组别”(cof_accounting)完全匹配,不匹配则返回表格错误提示
// 表格错误提醒参考PersonService.CreatePerson方法
return _attendanceService.BatchCallIn(allotId, hospitalId, request);
}
#endregion
#region 考勤类型
/// <summary>
/// 查询绩效考勤类型
/// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <returns></returns>
[HttpGet("Type/{allotId},{hospitalId}")]
public ApiResponse<List<per_attendance_type>> GetAttendanceType(int allotId, int hospitalId)
{
return _attendanceService.GetAttendanceType(allotId);
}
/// <summary>
/// 新增或修改考勤类型
/// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <param name="attendanceType"></param>
/// <returns></returns>
[HttpPost("Type/Edit/{allotId},{hospitalId}")]
public ApiResponse<AttendanceType> InsertAttendanceType(int allotId, int hospitalId, AttendanceType attendanceType)
{
// obj自己定义结构
return _attendanceService.InsertAttendanceType(allotId, hospitalId, attendanceType);
}
/// <summary>
/// 删除考勤类型
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("Type/Delete/{id}")]
public ApiResponse DeleteAttendanceType(int id)
{
// 删除前需要验证当前类型是否被使用,如果被使用则禁止删除
return _attendanceService.DeleteAttendanceType(id);
}
#endregion
#region 考勤记录
/// <summary>
/// 返回HandsonTable格式考勤记录
/// </summary>
/// <returns></returns>
[HttpGet("Vacation")]
[ProducesResponseType(typeof(HandsonTable), StatusCodes.Status200OK)]
public ApiResponse GetAttendanceVacationHandsonTable(int allotId)
{
// 返回HandsonTable格式考勤记录
return new ApiResponse(ResponseType.OK, _attendanceService.GetAttendanceVacationHandsonTable(allotId));
}
/// <summary>
/// 查询考勤记录
/// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <returns></returns>
[HttpGet("Vacation/{allotId},{hospitalId}")]
public ApiResponse<List<RecordAttendcance>> GetAttendanceVacation(int allotId)
{
return _attendanceService.GetAttendanceVacation(allotId);
}
/// <summary>
/// 批量插入考勤记录,插入前需要删除所有后重新插入
/// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost("Vacation/Batch/{allotId}")]
public ApiResponse AttendanceBatch(int allotId, int hospitalId, SaveCollectData request)
{
// obj自己定义结构
// 批量插入考勤记录,插入前需要删除所有后重新插入
// 需要验证考勤类型是否正确
// 需要验证工号和姓名是否与“人员字典”(per_employee)完全匹配,不匹配则返回表格错误提示
// 表格错误提醒参考PersonService.CreatePerson方法
return _attendanceService.AttendanceBatch(allotId, hospitalId, request);
}
#endregion
/// <summary>
/// 考勤结果统计
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[HttpGet("statistics/{allotId}")]
public ApiResponse<List<AttendanceStatistics>> GetAttendanceStatistics(int allotId)
{
// 返回结果参考接口 employee/apr/getdeptdetail
return _attendanceService.GetAttendanceStatistics(allotId);
}
#region 下载
/// <summary>
/// 初始考勤记录下载
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[HttpPost]
[Route("download/attendance/{allotId}")]
public IActionResult DownloadAttendance(int allotId)
{
List<ExcelDownloadHeads> excelDownloadHeads = new List<ExcelDownloadHeads>()
{
new ExcelDownloadHeads { Alias = "核算单元名称", Name = nameof(AttendanceStatistics.AccountingUnit) },
new ExcelDownloadHeads { Alias = "科室名称", Name = nameof(AttendanceStatistics.Department) },
new ExcelDownloadHeads { Alias = "姓名", Name = nameof(AttendanceStatistics.PersonnelName) },
new ExcelDownloadHeads { Alias = "员工号", Name = nameof(AttendanceStatistics.PersonnelNumber) },
new ExcelDownloadHeads { Alias = "人员类别", Name = nameof(AttendanceStatistics.UnitType) },
new ExcelDownloadHeads { Alias = "在科开始时问", Name = nameof(AttendanceStatistics.BeginDate) },
new ExcelDownloadHeads { Alias = "在科结束时间", Name = nameof(AttendanceStatistics.EndDate) },
};
var result = _attendanceService.GetAttendance(allotId).Data;
var ser = JsonConvert.SerializeObject(result);
var rows = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(ser);
var filepath = _attendanceService.ExcelDownload(rows, "初始考勤记录", allotId, excelDownloadHeads);
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
{
stream.CopyToAsync(memoryStream).Wait();
}
memoryStream.Seek(0, SeekOrigin.Begin);
var provider = new FileExtensionContentTypeProvider();
FileInfo fileInfo = new FileInfo(filepath);
var memi = provider.Mappings[".xlsx"];
return File(memoryStream, memi, Path.GetFileName(fileInfo.Name));
}
/// <summary>
/// 考勤记录下载
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[HttpPost]
[Route("download/vacation/{allotId}")]
public IActionResult DownloadVacation(int allotId)
{
List<ExcelDownloadHeads> excelDownloadHeads = new List<ExcelDownloadHeads>()
{
new ExcelDownloadHeads { Alias = "姓名", Name = nameof(RecordAttendcance.PersonnelName) },
new ExcelDownloadHeads { Alias = "员工号", Name = nameof(RecordAttendcance.PersonnelNumber) },
new ExcelDownloadHeads { Alias = "考勤类型", Name = nameof(RecordAttendcance.AttendanceName) },
new ExcelDownloadHeads { Alias = "开始时问", Name = nameof(RecordAttendcance.BegDate) },
new ExcelDownloadHeads { Alias = "结束时间", Name = nameof(RecordAttendcance.EndDate) },
new ExcelDownloadHeads { Alias = "天数", Name = nameof(RecordAttendcance.Days) },
};
var result = _attendanceService.GetAttendanceVacation(allotId).Data;
var ser = JsonConvert.SerializeObject(result);
var rows = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(ser);
var filepath = _attendanceService.ExcelDownload(rows, "考勤记录", allotId, excelDownloadHeads);
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
{
stream.CopyToAsync(memoryStream).Wait();
}
memoryStream.Seek(0, SeekOrigin.Begin);
var provider = new FileExtensionContentTypeProvider();
FileInfo fileInfo = new FileInfo(filepath);
var memi = provider.Mappings[".xlsx"];
return File(memoryStream, memi, Path.GetFileName(fileInfo.Name));
}
/// <summary>
/// 调动记录下载
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[HttpPost]
[Route("download/callin/{allotId}")]
public IActionResult DownloadCallIn(int allotId)
{
List<ExcelDownloadHeads> excelDownloadHeads = new List<ExcelDownloadHeads>()
{
new ExcelDownloadHeads { Alias = "姓名", Name = nameof(view_attendance.PersonnelName) },
new ExcelDownloadHeads { Alias = "员工号", Name = nameof(view_attendance.PersonnelNumber) },
new ExcelDownloadHeads { Alias = "调入核算单元", Name = nameof(view_attendance.AccountingUnit) },
new ExcelDownloadHeads { Alias = "调入组别", Name = nameof(view_attendance.UnitType) },
new ExcelDownloadHeads { Alias = "调入时间", Name = nameof(view_attendance.AttendanceDate) },
};
var result = _attendanceService.GetCallIn(allotId).Data;
var ser = JsonConvert.SerializeObject(result);
var rows = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(ser);
var filepath = _attendanceService.ExcelDownload(rows, "调动记录", allotId, excelDownloadHeads);
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
{
stream.CopyToAsync(memoryStream).Wait();
}
memoryStream.Seek(0, SeekOrigin.Begin);
var provider = new FileExtensionContentTypeProvider();
FileInfo fileInfo = new FileInfo(filepath);
var memi = provider.Mappings[".xlsx"];
return File(memoryStream, memi, Path.GetFileName(fileInfo.Name));
}
/// <summary>
/// 生成最终考勤结果下载
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[HttpPost]
[Route("download/statistics/{allotId}")]
public IActionResult DownloadStatistics(int allotId)
{
List<ExcelDownloadHeads> excelDownloadHeads = new List<ExcelDownloadHeads>()
{
new ExcelDownloadHeads { Alias = "科室名称", Name = nameof(AttendanceStatistics.Department) },
new ExcelDownloadHeads { Alias = "姓名", Name = nameof(AttendanceStatistics.PersonnelName) },
new ExcelDownloadHeads { Alias = "员工号", Name = nameof(AttendanceStatistics.PersonnelNumber) },
new ExcelDownloadHeads { Alias = "人员类别", Name = nameof(AttendanceStatistics.UnitType) },
new ExcelDownloadHeads { Alias = "开始时问", Name = nameof(AttendanceStatistics.BeginDate) },
new ExcelDownloadHeads { Alias = "结束时间", Name = nameof(AttendanceStatistics.EndDate) },
};
var type = _attendanceService.GetAttendanceType(allotId);
foreach (var item in type.Data)
{
excelDownloadHeads.Add(new ExcelDownloadHeads() { Alias = item.AttendanceName, Name = item.AttendanceName });
}
excelDownloadHeads.Add(new ExcelDownloadHeads() { Alias = "考勤天数", Name = "AttendanceDays" });
var result = _attendanceService.GetAttendanceStatistics(allotId).Data;
var ser = JsonConvert.SerializeObject(result);
var rows = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(ser);
var filepath = _attendanceService.ExcelDownload(rows, "最终考勤结果", allotId, excelDownloadHeads);
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
{
stream.CopyToAsync(memoryStream).Wait();
}
memoryStream.Seek(0, SeekOrigin.Begin);
var provider = new FileExtensionContentTypeProvider();
FileInfo fileInfo = new FileInfo(filepath);
var memi = provider.Mappings[".xlsx"];
return File(memoryStream, memi, Path.GetFileName(fileInfo.Name));
/*var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "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));*/
}
#endregion
}
}
...@@ -435,8 +435,19 @@ public ApiResponse CustomColumnHeaders([FromBody] ComputerAliasRequest request) ...@@ -435,8 +435,19 @@ public ApiResponse CustomColumnHeaders([FromBody] ComputerAliasRequest request)
[HttpPost] [HttpPost]
public ApiResponse Batch([FromBody] BatchRequest request) public ApiResponse Batch([FromBody] BatchRequest request)
{ {
var result = _computeService.Batch(request); return _computeService.Batch(request);
return result ? new ApiResponse(ResponseType.OK, "操作成功") : new ApiResponse(ResponseType.Fail, "操作失败"); }
/// <summary>
/// 取消全院绩效进行批次标记
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("allcompute/batch/cancel")]
[HttpPost]
public ApiResponse BatchCancel([FromBody] BatchCancelRequest request)
{
return _computeService.BatchCancel(request);
} }
#region 发放表下载 #region 发放表下载
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.DtoModels.Request; using Performance.DtoModels.Request;
using Performance.DtoModels.Response;
using Performance.EntityModels; using Performance.EntityModels;
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Services; using Performance.Services;
...@@ -294,11 +295,13 @@ public ApiResponse GetAprGroupList([FromBody] AllotIdRequest request) ...@@ -294,11 +295,13 @@ public ApiResponse GetAprGroupList([FromBody] AllotIdRequest request)
return new ApiResponse(ResponseType.OK, "ok", employee); return new ApiResponse(ResponseType.OK, "ok", employee);
var result = employee.GroupBy(t => new { TypeInDepartment = t.TypeInDepartment ?? "" }) var result = employee.GroupBy(t => new { TypeInDepartment = t.TypeInDepartment ?? "" })
.Select(t => new per_apr_amount .Select(t => new OhterAmountAuditResponse
{ {
TypeInDepartment = t.Key.TypeInDepartment, TypeInDepartment = t.Key.TypeInDepartment,
Amount = t.Sum(s => s.Amount ?? 0), Amount = t.Sum(s => s.Amount ?? 0),
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status, Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
AuditTime = t.Any(s => s.Status == 2) ? "" : t.Max(w => w.AuditTime)?.ToString("yyyy-MM-dd HH:mm:ss"),
Remark = t.Any(s => !s.MarkStatus.HasValue) ? "" : $"已审计{t.Max(w => w.MarkTime)?.ToString("(yyyy-MM-dd HH:mm:ss)")}"
}); });
return new ApiResponse(ResponseType.OK, "ok", result); return new ApiResponse(ResponseType.OK, "ok", result);
} }
...@@ -401,6 +404,18 @@ public ApiResponse AuditResult([FromBody] AprAmountAuditRequest request) ...@@ -401,6 +404,18 @@ public ApiResponse AuditResult([FromBody] AprAmountAuditRequest request)
} }
/// <summary> /// <summary>
/// 医院其他绩效审计
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("apr/mark")]
public ApiResponse AprMark([FromBody] AprAmountMarkRequest request)
{
var userid = claim.GetUserId();
return employeeService.AprMark(userid, request);
}
/// <summary>
/// 上传医院其他绩效文件 /// 上传医院其他绩效文件
/// </summary> /// </summary>
/// <param name="form"></param> /// <param name="form"></param>
...@@ -582,11 +597,13 @@ public ApiResponse GetAprHideGroupList([FromBody] AllotIdRequest request) ...@@ -582,11 +597,13 @@ public ApiResponse GetAprHideGroupList([FromBody] AllotIdRequest request)
return new ApiResponse(ResponseType.OK, "ok", employee); return new ApiResponse(ResponseType.OK, "ok", employee);
var result = employee.GroupBy(t => new { TypeInDepartment = t.TypeInDepartment ?? "" }) var result = employee.GroupBy(t => new { TypeInDepartment = t.TypeInDepartment ?? "" })
.Select(t => new per_apr_amount .Select(t => new OhterAmountAuditResponse
{ {
TypeInDepartment = t.Key.TypeInDepartment, TypeInDepartment = t.Key.TypeInDepartment,
Amount = t.Sum(s => s.Amount ?? 0), Amount = t.Sum(s => s.Amount ?? 0),
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status, Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
AuditTime = t.Any(s => s.Status == 2) ? "" : t.Max(w => w.AuditTime)?.ToString("yyyy-MM-dd HH:mm:ss"),
Remark = t.Any(s => !s.MarkStatus.HasValue) ? "" : $"已审计{t.Max(w => w.MarkTime)?.ToString("(yyyy-MM-dd HH:mm:ss)")}"
}); });
return new ApiResponse(ResponseType.OK, "ok", result); return new ApiResponse(ResponseType.OK, "ok", result);
} }
...@@ -688,6 +705,18 @@ public ApiResponse AuditResultHide([FromBody] AprAmountAuditRequest request) ...@@ -688,6 +705,18 @@ public ApiResponse AuditResultHide([FromBody] AprAmountAuditRequest request)
} }
/// <summary> /// <summary>
/// 不公示其他绩效审计
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("apr/hide/mark")]
public ApiResponse AprMarkHide([FromBody] AprAmountMarkRequest request)
{
var userid = claim.GetUserId();
return employeeService.AprMarkHide(userid, request);
}
/// <summary>
/// 上传不公示其他绩效 /// 上传不公示其他绩效
/// </summary> /// </summary>
/// <param name="form"></param> /// <param name="form"></param>
......
...@@ -371,6 +371,11 @@ public ApiResponse SubmitAudit(SubmitAuditRequest request) ...@@ -371,6 +371,11 @@ public ApiResponse SubmitAudit(SubmitAuditRequest request)
public ApiResponse<List<ag_secondallot>> AuditList([FromBody] AllotDeptRequest request) public ApiResponse<List<ag_secondallot>> AuditList([FromBody] AllotDeptRequest request)
{ {
var list = secondAllotService.AuditList(request.AllotId); var list = secondAllotService.AuditList(request.AllotId);
foreach (var item in list)
{
item.Remark += item.MarkStatus.HasValue && item.MarkStatus == 1 ? $" 已审计{item.MarkTime?.ToString("(yyyy-MM-dd HH:mm:ss)")}" : "";
}
return new ApiResponse<List<ag_secondallot>>(ResponseType.OK, "审核列表", list); return new ApiResponse<List<ag_secondallot>>(ResponseType.OK, "审核列表", list);
} }
...@@ -392,6 +397,22 @@ public ApiResponse AuditResult([FromBody] SecondAuditRequest request) ...@@ -392,6 +397,22 @@ public ApiResponse AuditResult([FromBody] SecondAuditRequest request)
} }
/// <summary> /// <summary>
/// 二次绩效审计
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("/api/second/mark")]
public ApiResponse SecondMark([FromBody] SecondMarkRequest request)
{
if (request?.SecondIds == null || !request.SecondIds.Any())
return new ApiResponse(ResponseType.ParameterError, "参数SecondIds无效!");
var userid = claimService.GetUserId();
var result = secondAllotService.SecondMark(userid, request.SecondIds);
return result ? new ApiResponse(ResponseType.OK, "操作成功") : new ApiResponse(ResponseType.Fail, "操作失败");
}
/// <summary>
/// 护理部二次绩效审核列表 /// 护理部二次绩效审核列表
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
...@@ -719,6 +740,7 @@ public ApiResponse RedistributionCompute([FromBody] SecondComputeDto request) ...@@ -719,6 +740,7 @@ public ApiResponse RedistributionCompute([FromBody] SecondComputeDto request)
_redistributionService.ClearInvalidValue(cleanDatas); _redistributionService.ClearInvalidValue(cleanDatas);
var dic = _redistributionService.GetTableHeaderDictionary((ComputeMode)request.ComputeMode, allot, second, loads, workloadGroups); var dic = _redistributionService.GetTableHeaderDictionary((ComputeMode)request.ComputeMode, allot, second, loads, workloadGroups);
_redistributionService.RowsExpand(allot, dic, cleanDatas);
return new ApiResponse(ResponseType.OK, new { Head = request.Head, Body = cleanDatas, Dic = dic }); return new ApiResponse(ResponseType.OK, new { Head = request.Head, Body = cleanDatas, Dic = dic });
} }
catch (PerformanceException ex) catch (PerformanceException ex)
...@@ -918,8 +940,10 @@ public ApiResponse RedistributionDetail([FromBody] SecondBaseDto request) ...@@ -918,8 +940,10 @@ public ApiResponse RedistributionDetail([FromBody] SecondBaseDto request)
// 返回信息 // 返回信息
var (head, rows) = _redistributionService.RedistributionDetail((ComputeMode)request.ComputeMode, allot, second, workloadGroups); var (head, rows) = _redistributionService.RedistributionDetail((ComputeMode)request.ComputeMode, allot, second, workloadGroups);
var dic = _redistributionService.GetTableHeaderDictionary((ComputeMode)request.ComputeMode, allot, second, loads, workloadGroups); var dic = _redistributionService.GetTableHeaderDictionary((ComputeMode)request.ComputeMode, allot, second, loads, workloadGroups);
_redistributionService.RowsExpand(allot, dic, rows);
return new ApiResponse(ResponseType.OK, new { Head = head, Body = rows, Dic = dic }); return new ApiResponse(ResponseType.OK, new { Head = head, Body = rows, Dic = dic });
} }
#endregion #endregion
......
...@@ -46,13 +46,16 @@ ...@@ -46,13 +46,16 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\Performance.Api.xml"> <Content Update="wwwroot\Performance.Api.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\Performance.DtoModels.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\Performance.DtoModels.xml"> <Content Update="wwwroot\Performance.DtoModels.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\Performance.EntityModels.xml"> <Content Update="wwwroot\Performance.EntityModels.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
...@@ -66,6 +69,9 @@ ...@@ -66,6 +69,9 @@
<None Update="Template\医院人员绩效模板.xls"> <None Update="Template\医院人员绩效模板.xls">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Update="Template\医院人员绩效模板.xlsx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Template\医院绩效模板%28无执行科室%29.xlsx"> <None Update="Template\医院绩效模板%28无执行科室%29.xlsx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
...@@ -87,6 +93,13 @@ ...@@ -87,6 +93,13 @@
<None Update="Template\导入数据模板.xlsx"> <None Update="Template\导入数据模板.xlsx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Update="Template\工作量数据导入模板.xlsx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup> </ItemGroup>
<ProjectExtensions> <ProjectExtensions>
......
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DeleteExistingFiles>True</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\net5.0\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<DebugType>embedded</DebugType>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<PublishSingleFile>True</PublishSingleFile>
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishReadyToRun>True</PublishReadyToRun>
<SiteUrlToLaunchAfterPublish />
<PublishTrimmed>True</PublishTrimmed>
<ProjectGuid>3ae00ff5-f0ba-4d72-a23b-770186309327</ProjectGuid>
</PropertyGroup>
</Project>
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Connections;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Authorization; using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
...@@ -15,6 +16,7 @@ ...@@ -15,6 +16,7 @@
using Performance.DtoModels; using Performance.DtoModels;
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Services; using Performance.Services;
using System;
using System.Globalization; using System.Globalization;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
...@@ -87,7 +89,11 @@ public void ConfigureServices(IServiceCollection services) ...@@ -87,7 +89,11 @@ public void ConfigureServices(IServiceCollection services)
services.AddDependencyInjectionConfiguration(); services.AddDependencyInjectionConfiguration();
// signalr // signalr
services.AddSignalR(); services.AddSignalR(hubOptions =>
{
hubOptions.EnableDetailedErrors = true;
hubOptions.KeepAliveInterval = TimeSpan.FromMinutes(1);
});
// cors // cors
services.AddCors(options => services.AddCors(options =>
...@@ -132,7 +138,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) ...@@ -132,7 +138,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
endpoints.MapHub<AllotLogHub>("/performance/allotLogHub"); endpoints.MapHub<AllotLogHub>("/performance/allotLogHub", options =>
{
options.Transports = HttpTransportType.WebSockets | HttpTransportType.LongPolling;
options.WebSockets.CloseTimeout = TimeSpan.FromMinutes(1);
});
endpoints.MapControllers(); endpoints.MapControllers();
}); });
......
...@@ -287,6 +287,125 @@ ...@@ -287,6 +287,125 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.AllotController.GetOwnerMobilePerformance(System.String,System.String)">
<summary>
H5查询个人绩效
</summary>
<param name="begin">开始月份:2021-03</param>
<param name="end">结束月份:2021-04</param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AttendanceController.GetAttendance(System.Int32)">
<summary>
查询绩效考勤记录
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AttendanceController.GetCallIn(System.Int32)">
<summary>
查询绩效调动记录
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AttendanceController.GetBatchCallInHandsonTable(System.Int32)">
<summary>
返回HandsonTable格式调动记录
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AttendanceController.BatchCallIn(System.Int32,System.Int32,Performance.DtoModels.SaveCollectData)">
<summary>
批量插入调动记录
</summary>
<param name="allotId"></param>
<param name="hospitalId"></param>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AttendanceController.GetAttendanceType(System.Int32,System.Int32)">
<summary>
查询绩效考勤类型
</summary>
<param name="allotId"></param>
<param name="hospitalId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AttendanceController.InsertAttendanceType(System.Int32,System.Int32,Performance.EntityModels.Other.AttendanceType)">
<summary>
新增或修改考勤类型
</summary>
<param name="allotId"></param>
<param name="hospitalId"></param>
<param name="attendanceType"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AttendanceController.DeleteAttendanceType(System.Int32)">
<summary>
删除考勤类型
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AttendanceController.GetAttendanceVacationHandsonTable(System.Int32)">
<summary>
返回HandsonTable格式考勤记录
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AttendanceController.GetAttendanceVacation(System.Int32)">
<summary>
查询考勤记录
</summary>
<param name="allotId"></param>
<param name="hospitalId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AttendanceController.AttendanceBatch(System.Int32,System.Int32,Performance.DtoModels.SaveCollectData)">
<summary>
批量插入考勤记录,插入前需要删除所有后重新插入
</summary>
<param name="allotId"></param>
<param name="hospitalId"></param>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AttendanceController.GetAttendanceStatistics(System.Int32)">
<summary>
考勤结果统计
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AttendanceController.DownloadAttendance(System.Int32)">
<summary>
初始考勤记录下载
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AttendanceController.DownloadVacation(System.Int32)">
<summary>
考勤记录下载
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AttendanceController.DownloadCallIn(System.Int32)">
<summary>
调动记录下载
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AttendanceController.DownloadStatistics(System.Int32)">
<summary>
生成最终考勤结果下载
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.BudgetController.Query(Performance.DtoModels.Request.BudgetRequest)"> <member name="M:Performance.Api.Controllers.BudgetController.Query(Performance.DtoModels.Request.BudgetRequest)">
<summary> <summary>
预算管理查询(包含金额、占比) 预算管理查询(包含金额、占比)
...@@ -541,6 +660,13 @@ ...@@ -541,6 +660,13 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ComputeController.BatchCancel(Performance.DtoModels.Request.BatchCancelRequest)">
<summary>
取消全院绩效进行批次标记
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.GetAdminPerDownload(System.Int32)"> <member name="M:Performance.Api.Controllers.ComputeController.GetAdminPerDownload(System.Int32)">
<summary> <summary>
下载院领导、中层、工勤组绩效 下载院领导、中层、工勤组绩效
...@@ -1066,6 +1192,12 @@ ...@@ -1066,6 +1192,12 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.EmployeeController.AprMark(Performance.DtoModels.AprAmountMarkRequest)">
<summary>
医院其他绩效审计
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.Import(Microsoft.AspNetCore.Http.IFormCollection)"> <member name="M:Performance.Api.Controllers.EmployeeController.Import(Microsoft.AspNetCore.Http.IFormCollection)">
<summary> <summary>
上传医院其他绩效文件 上传医院其他绩效文件
...@@ -1158,6 +1290,12 @@ ...@@ -1158,6 +1290,12 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.EmployeeController.AprMarkHide(Performance.DtoModels.AprAmountMarkRequest)">
<summary>
不公示其他绩效审计
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.ImportAprHide(Microsoft.AspNetCore.Http.IFormCollection)"> <member name="M:Performance.Api.Controllers.EmployeeController.ImportAprHide(Microsoft.AspNetCore.Http.IFormCollection)">
<summary> <summary>
上传不公示其他绩效 上传不公示其他绩效
...@@ -2031,6 +2169,12 @@ ...@@ -2031,6 +2169,12 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.SecondAllotController.SecondMark(Performance.DtoModels.SecondMarkRequest)">
<summary>
二次绩效审计
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.SecondAllotController.NursingDeptlist(Performance.DtoModels.AllotDeptRequest)"> <member name="M:Performance.Api.Controllers.SecondAllotController.NursingDeptlist(Performance.DtoModels.AllotDeptRequest)">
<summary> <summary>
护理部二次绩效审核列表 护理部二次绩效审核列表
......
...@@ -202,16 +202,9 @@ ...@@ -202,16 +202,9 @@
<member name="F:Performance.DtoModels.DataFormat.分数"> <member name="F:Performance.DtoModels.DataFormat.分数">
<summary> 分数 </summary> <summary> 分数 </summary>
</member> </member>
<member name="F:Performance.DtoModels.DataFormat.日期"> <member name="F:Performance.DtoModels.DataFormat.日期YYYYMMDD">
<summary> 日期 </summary> <summary> 日期 </summary>
</member> </member>
<member name="M:Performance.DtoModels.HandsonTable.SetRowData(System.Collections.Generic.IEnumerable{Performance.DtoModels.HandsonRowData},System.Boolean)">
<summary>
</summary>
<param name="datas"></param>
<param name="isTypein">是否是用户录入的 是:true 不是:false</param>
</member>
<member name="P:Performance.DtoModels.HistoryData.Year"> <member name="P:Performance.DtoModels.HistoryData.Year">
<summary> <summary>
...@@ -1918,6 +1911,27 @@ ...@@ -1918,6 +1911,27 @@
<member name="P:Performance.DtoModels.AprAmountAuditRequest.Remark"> <member name="P:Performance.DtoModels.AprAmountAuditRequest.Remark">
<summary> 备注 </summary> <summary> 备注 </summary>
</member> </member>
<member name="P:Performance.DtoModels.AprAmountMarkRequest.AllotId">
<summary> 绩效ID </summary>
</member>
<member name="P:Performance.DtoModels.AprAmountMarkRequest.TypeInDepartments">
<summary> 需要审计的科室,支持多个科室一起审计 </summary>
</member>
<member name="P:Performance.DtoModels.Request.BatchRequest.Batch">
<summary>
批次号
</summary>
</member>
<member name="P:Performance.DtoModels.Request.BatchRequest.BatchDate">
<summary>
发放时间
</summary>
</member>
<member name="P:Performance.DtoModels.Request.BatchRequest.BankName">
<summary>
发放银行
</summary>
</member>
<member name="P:Performance.DtoModels.Request.BatchDetail.UnitType"> <member name="P:Performance.DtoModels.Request.BatchDetail.UnitType">
<summary> <summary>
核算单元分类 核算单元分类
...@@ -1938,11 +1952,6 @@ ...@@ -1938,11 +1952,6 @@
工号 工号
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.Request.BatchDetail.Batch">
<summary>
批次
</summary>
</member>
<member name="P:Performance.DtoModels.Request.ComputerAvgRequest.PositionName"> <member name="P:Performance.DtoModels.Request.ComputerAvgRequest.PositionName">
<summary> <summary>
绩效核算人群 绩效核算人群
...@@ -2436,6 +2445,9 @@ ...@@ -2436,6 +2445,9 @@
<member name="P:Performance.DtoModels.SecondAuditRequest.Remark"> <member name="P:Performance.DtoModels.SecondAuditRequest.Remark">
<summary> 备注 </summary> <summary> 备注 </summary>
</member> </member>
<member name="P:Performance.DtoModels.SecondMarkRequest.SecondIds">
<summary> 二次绩效Id </summary>
</member>
<member name="T:Performance.DtoModels.SetDepartmentRequest"> <member name="T:Performance.DtoModels.SetDepartmentRequest">
<summary> <summary>
登录请求 登录请求
...@@ -2703,6 +2715,56 @@ ...@@ -2703,6 +2715,56 @@
科室 科室
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.AttendanceStatistics.UnitType">
<summary>
核算组别
</summary>
</member>
<member name="P:Performance.DtoModels.AttendanceStatistics.AccountingUnit">
<summary>
核算单元
</summary>
</member>
<member name="P:Performance.DtoModels.AttendanceStatistics.Department">
<summary>
科室名称
</summary>
</member>
<member name="P:Performance.DtoModels.AttendanceStatistics.PersonnelNumber">
<summary>
工号
</summary>
</member>
<member name="P:Performance.DtoModels.AttendanceStatistics.PersonnelName">
<summary>
姓名
</summary>
</member>
<member name="P:Performance.DtoModels.AttendanceStatistics.BeginDate">
<summary>
在科开始时间
</summary>
</member>
<member name="P:Performance.DtoModels.AttendanceStatistics.EndDate">
<summary>
在科结束时间
</summary>
</member>
<member name="P:Performance.DtoModels.AttendanceStatisticsDetial.Value">
<summary>
请假天数
</summary>
</member>
<member name="P:Performance.DtoModels.AttendanceStatisticsDetial.Title">
<summary>
考勤类型
</summary>
</member>
<member name="P:Performance.DtoModels.AttendanceStatisticsDetial.Remark">
<summary>
备注
</summary>
</member>
<member name="P:Performance.DtoModels.BudgetRatioResponse.HospitalId"> <member name="P:Performance.DtoModels.BudgetRatioResponse.HospitalId">
<summary> <summary>
医院Id 医院Id
...@@ -3532,6 +3594,51 @@ ...@@ -3532,6 +3594,51 @@
实发绩效 实发绩效
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.OwnerPerformanceDto.IssueDate">
<summary>
发放时间
</summary>
</member>
<member name="P:Performance.DtoModels.OwnerMobilePerformanceDto.Total">
<summary>
绩效发放总额
</summary>
</member>
<member name="P:Performance.DtoModels.OwnerMobilePerformanceDto.Items">
<summary>
绩效明细
</summary>
</member>
<member name="P:Performance.DtoModels.OwnerMobileItemDto.Title">
<summary>
类型名称
</summary>
</member>
<member name="P:Performance.DtoModels.OwnerMobileItemDto.Amount">
<summary>
金额
</summary>
</member>
<member name="P:Performance.DtoModels.OwnerMobileItemDto.Details">
<summary>
明细项
</summary>
</member>
<member name="P:Performance.DtoModels.OwnerMobileItemDetailDto.Title">
<summary>
类型名称
</summary>
</member>
<member name="P:Performance.DtoModels.OwnerMobileItemDetailDto.Amount">
<summary>
金额
</summary>
</member>
<member name="P:Performance.DtoModels.OwnerMobileItemDetailDto.Date">
<summary>
发放时间,空则不显示
</summary>
</member>
<member name="P:Performance.DtoModels.PerEmployeeResponse.WorkTime"> <member name="P:Performance.DtoModels.PerEmployeeResponse.WorkTime">
<summary> <summary>
参加工作时间 参加工作时间
...@@ -4103,6 +4210,11 @@ ...@@ -4103,6 +4210,11 @@
格式 格式
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.SecondColumnDictionary.Expand">
<summary>
true 扩展字段,通过配置额外展示
</summary>
</member>
<member name="P:Performance.DtoModels.SecondEmployeeDto.ComputeMode"> <member name="P:Performance.DtoModels.SecondEmployeeDto.ComputeMode">
<summary> <summary>
计算方式:11 不计算 12 横向计算 13 纵向计算 计算方式:11 不计算 12 横向计算 13 纵向计算
......
...@@ -1070,11 +1070,6 @@ ...@@ -1070,11 +1070,6 @@
二次绩效列表 二次绩效列表
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ag_secondallot.Id">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.AllotId"> <member name="P:Performance.EntityModels.ag_secondallot.AllotId">
<summary> <summary>
绩效ID 绩效ID
...@@ -1115,26 +1110,6 @@ ...@@ -1115,26 +1110,6 @@
预发金额 预发金额
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ag_secondallot.Efficiency">
<summary>
效率绩效
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.Scale">
<summary>
规模绩效
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.Grant">
<summary>
发放系数
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.ShouldGiveFee">
<summary>
应发管理绩效
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.Status"> <member name="P:Performance.EntityModels.ag_secondallot.Status">
<summary> <summary>
状态 1 未提交 2 等待审核 3 审核通过 4 驳回 状态 1 未提交 2 等待审核 3 审核通过 4 驳回
...@@ -1190,6 +1165,11 @@ ...@@ -1190,6 +1165,11 @@
夜班绩效 夜班绩效
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ag_secondallot.MarkStatus">
<summary>
审计状态 1 已审计
</summary>
</member>
<member name="T:Performance.EntityModels.ag_temp"> <member name="T:Performance.EntityModels.ag_temp">
<summary> <summary>
二次绩效模板 二次绩效模板
...@@ -5960,6 +5940,11 @@ ...@@ -5960,6 +5940,11 @@
是否修改过配置 1修改过 0未修改 是否修改过配置 1修改过 0未修改
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.per_allot.PigeonholeDate">
<summary>
归档日期
</summary>
</member>
<member name="T:Performance.EntityModels.per_apr_amount"> <member name="T:Performance.EntityModels.per_apr_amount">
<summary> <summary>
...@@ -6040,6 +6025,11 @@ ...@@ -6040,6 +6025,11 @@
验证失败描述 验证失败描述
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.per_apr_amount.MarkStatus">
<summary>
审计状态 1 已审计
</summary>
</member>
<member name="T:Performance.EntityModels.per_apr_amount_hide"> <member name="T:Performance.EntityModels.per_apr_amount_hide">
<summary> <summary>
医院其他绩效 医院其他绩效
...@@ -6120,6 +6110,16 @@ ...@@ -6120,6 +6110,16 @@
验证失败描述 验证失败描述
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.MarkStatus">
<summary>
审计状态 1 已审计
</summary>
</member>
<member name="P:Performance.EntityModels.Entity.per_attendance_type.IsDeduction">
<summary>
是否核减出勤 1 核减 2 不核减
</summary>
</member>
<member name="T:Performance.EntityModels.per_batch"> <member name="T:Performance.EntityModels.per_batch">
<summary> <summary>
分批发放记录 分批发放记录
...@@ -8845,6 +8845,56 @@ ...@@ -8845,6 +8845,56 @@
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.Other.view_attendance.UnitType">
<summary>
人员类别
</summary>
</member>
<member name="P:Performance.EntityModels.Other.view_attendance.AccountingUnit">
<summary>
核算单元
</summary>
</member>
<member name="P:Performance.EntityModels.Other.view_attendance.PersonnelNumber">
<summary>
工号
</summary>
</member>
<member name="P:Performance.EntityModels.Other.view_attendance.PersonnelName">
<summary>
姓名
</summary>
</member>
<member name="P:Performance.EntityModels.Other.view_attendance.AttendanceDate">
<summary>
考勤时间
</summary>
</member>
<member name="P:Performance.EntityModels.Other.view_attendance.Source">
<summary>
来源
</summary>
</member>
<member name="P:Performance.EntityModels.Other.view_attendance.Department">
<summary>
科室名称
</summary>
</member>
<member name="P:Performance.EntityModels.Other.AttendanceType.Id">
<summary>
Id
</summary>
</member>
<member name="P:Performance.EntityModels.Other.AttendanceType.AttendanceName">
<summary>
考勤类型名称
</summary>
</member>
<member name="P:Performance.EntityModels.Other.AttendanceType.IsDeduction">
<summary>
是否核减出勤 1 核减 2 不核减
</summary>
</member>
<member name="P:Performance.EntityModels.HisData.HisDepartment"> <member name="P:Performance.EntityModels.HisData.HisDepartment">
<summary> <summary>
His科室 His科室
......
...@@ -116,7 +116,7 @@ public enum DataFormat ...@@ -116,7 +116,7 @@ public enum DataFormat
/// <summary> 分数 </summary> /// <summary> 分数 </summary>
分数, 分数,
/// <summary> 日期 </summary> /// <summary> 日期 </summary>
日期 日期YYYYMMDD
} }
public enum Role public enum Role
...@@ -134,6 +134,7 @@ public enum Role ...@@ -134,6 +134,7 @@ public enum Role
数据收集 = 11, 数据收集 = 11,
护理部审核 = 12, 护理部审核 = 12,
绩效查询 = 13, 绩效查询 = 13,
审计 = 14,
} }
public class Background public class Background
...@@ -165,4 +166,18 @@ public enum Status ...@@ -165,4 +166,18 @@ public enum Status
驳回 = 4, 驳回 = 4,
} }
} }
public class Attendance
{
public enum Type
{
开始,
调入,
结束,
}
public enum Deduction
{
核减 = 1,
不核减 = 2,
}
}
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Performance.DtoModels
{
public class ExcelDownloadHeads
{
public string Alias { get; set; }
public string Name { get; set; }
}
}
...@@ -37,12 +37,6 @@ public HandsonTable(int sheetType, string[] cols, List<collect_permission> permi ...@@ -37,12 +37,6 @@ public HandsonTable(int sheetType, string[] cols, List<collect_permission> permi
InitColumns(permissions); InitColumns(permissions);
} }
/// <summary>
///
/// </summary>
/// <param name="datas"></param>
/// <param name="isTypein">是否是用户录入的 是:true 不是:false</param>
public void SetRowData(IEnumerable<HandsonRowData> datas, bool isTypein) public void SetRowData(IEnumerable<HandsonRowData> datas, bool isTypein)
{ {
foreach (var dt in datas) foreach (var dt in datas)
...@@ -127,6 +121,11 @@ public HandsonColumn(string data, bool readOnly = false, DataFormat format = Dat ...@@ -127,6 +121,11 @@ public HandsonColumn(string data, bool readOnly = false, DataFormat format = Dat
Type = "text"; Type = "text";
break; break;
case DataFormat.日期YYYYMMDD:
Type = "DateFormat";
DateFormat = "YYYY/MM/DD";
break;
case DataFormat.小数: case DataFormat.小数:
Type = "numeric"; Type = "numeric";
NumericFormat = new NumericFormat { Pattern = "0,00.00" }; NumericFormat = new NumericFormat { Pattern = "0,00.00" };
...@@ -152,6 +151,7 @@ public HandsonColumn(string data, bool readOnly = false, DataFormat format = Dat ...@@ -152,6 +151,7 @@ public HandsonColumn(string data, bool readOnly = false, DataFormat format = Dat
public string Data { get; set; } public string Data { get; set; }
public bool ReadOnly { get; set; } public bool ReadOnly { get; set; }
public string Type { get; set; } public string Type { get; set; }
public string DateFormat { get; set; }
public string[] Source { get; set; } public string[] Source { get; set; }
public bool Strict { get; set; } = false; public bool Strict { get; set; } = false;
......
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class AprAmountMarkRequest
{
/// <summary> 绩效ID </summary>
public int AllotId { get; set; }
/// <summary> 需要审计的科室,支持多个科室一起审计 </summary>
public string[] TypeInDepartments { get; set; }
}
}
using System.Collections.Generic; using System;
using System.Collections.Generic;
namespace Performance.DtoModels.Request namespace Performance.DtoModels.Request
{ {
public class BatchCancelRequest
{
public int HospitalId { get; set; }
public int AllotId { get; set; }
public List<BatchDetail> Details { get; set; }
}
public class BatchRequest public class BatchRequest
{ {
public int HospitalId { get; set; } public int HospitalId { get; set; }
public int AllotId { get; set; } public int AllotId { get; set; }
/// <summary>
/// 批次号
/// </summary>
public string Batch { get; set; }
/// <summary>
/// 发放时间
/// </summary>
public DateTime? BatchDate { get; set; }
/// <summary>
/// 发放银行
/// </summary>
public string BankName { get; set; }
public List<BatchDetail> Details { get; set; } public List<BatchDetail> Details { get; set; }
} }
...@@ -32,10 +53,5 @@ public class BatchDetail ...@@ -32,10 +53,5 @@ public class BatchDetail
/// 工号 /// 工号
/// </summary> /// </summary>
public string JobNumber { get; set; } public string JobNumber { get; set; }
/// <summary>
/// 批次
/// </summary>
public string Batch { get; set; }
} }
} }
...@@ -62,6 +62,7 @@ public class ComputerAliasUpdate ...@@ -62,6 +62,7 @@ public class ComputerAliasUpdate
} }
public class ComputerAliasHead public class ComputerAliasHead
{ {
public string Name { get; set; }
public string Head { get; set; } public string Head { get; set; }
public int HeadId { get; set; } public int HeadId { get; set; }
public int Sort { get; set; } public int Sort { get; set; }
......
...@@ -22,7 +22,6 @@ public SecondAuditRequestValidator() ...@@ -22,7 +22,6 @@ public SecondAuditRequestValidator()
{ {
RuleFor(x => x.SecondId).NotNull().NotEmpty().GreaterThan(0); RuleFor(x => x.SecondId).NotNull().NotEmpty().GreaterThan(0);
RuleFor(x => x.IsPass).NotNull().NotEmpty().InclusiveBetween(1, 2); RuleFor(x => x.IsPass).NotNull().NotEmpty().InclusiveBetween(1, 2);
RuleFor(x => x.Remark).NotNull().NotEmpty();
} }
} }
} }
namespace Performance.DtoModels
{
public class SecondMarkRequest
{
/// <summary> 二次绩效Id </summary>
public int[] SecondIds { get; set; }
}
}
using System;
using System.Collections.Generic;
namespace Performance.DtoModels
{
public class AttendanceStatistics
{
public int AllotID { get; set; }
/// <summary>
/// 核算组别
/// </summary>
public string UnitType { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
/// <summary>
/// 科室名称
/// </summary>
public string Department { get; set; }
/// <summary>
/// 工号
/// </summary>
public string PersonnelNumber { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string PersonnelName { get; set; }
/// <summary>
/// 在科开始时间
/// </summary>
public DateTime BeginDate { get; set; }
/// <summary>
/// 在科结束时间
/// </summary>
public DateTime EndDate { get; set; }
public List<AttendanceStatisticsDetial> Detial { get; set; }
public int AttendanceDays { get; set; }
}
public class AttendanceStatisticsDetial
{
/// <summary>
/// 请假天数
/// </summary>
public int Value { get; set; }
/// <summary>
/// 考勤类型
/// </summary>
public string Title { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}
using System; using System;
using System.Collections.Generic;
using System.Text; using System.Text;
namespace Performance.DtoModels namespace Performance.DtoModels
......
...@@ -9,14 +9,14 @@ public class DeptdicResponse ...@@ -9,14 +9,14 @@ public class DeptdicResponse
public int HospitalId { get; set; } public int HospitalId { get; set; }
public string HISDeptName { get; set; } public string HISDeptName { get; set; }
public string Department { get; set; } public string Department { get; set; }
public Deptdic OutDoctorAccounting { get; set; } public string OutDoctorAccounting { get; set; }
public Deptdic OutNurseAccounting { get; set; } public string OutNurseAccounting { get; set; }
public Deptdic OutTechnicAccounting { get; set; } public string OutTechnicAccounting { get; set; }
public Deptdic InpatDoctorAccounting { get; set; } public string InpatDoctorAccounting { get; set; }
public Deptdic InpatNurseAccounting { get; set; } public string InpatNurseAccounting { get; set; }
public Deptdic InpatTechnicAccounting { get; set; } public string InpatTechnicAccounting { get; set; }
public Deptdic LogisticsAccounting { get; set; } public string LogisticsAccounting { get; set; }
public Deptdic SpecialAccounting { get; set; } public string SpecialAccounting { get; set; }
public DateTime? CreateTime { get; set; } public DateTime? CreateTime { get; set; }
public int IsVerify { get; set; } public int IsVerify { get; set; }
} }
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Performance.DtoModels.Response
{
public class OhterAmountAuditResponse
{
public string TypeInDepartment { get; set; }
public decimal Amount { get; set; }
public int? Status { get; set; }
public string AuditTime { get; set; }
public string Remark { get; set; }
}
}
...@@ -15,5 +15,52 @@ public class OwnerPerformanceDto : view_allot_result ...@@ -15,5 +15,52 @@ public class OwnerPerformanceDto : view_allot_result
/// 实发绩效 /// 实发绩效
/// </summary> /// </summary>
public decimal RealGiveFee { get; set; } public decimal RealGiveFee { get; set; }
/// <summary>
/// 发放时间
/// </summary>
public string IssueDate { get; set; }
}
public class OwnerMobilePerformanceDto
{
/// <summary>
/// 绩效发放总额
/// </summary>
public decimal Total { get; set; }
/// <summary>
/// 绩效明细
/// </summary>
public List<OwnerMobileItemDto> Items { get; set; }
}
public class OwnerMobileItemDto
{
/// <summary>
/// 类型名称
/// </summary>
public string Title { get; set; }
/// <summary>
/// 金额
/// </summary>
public decimal Amount { get; set; }
/// <summary>
/// 明细项
/// </summary>
public List<OwnerMobileItemDetailDto> Details { get; set; }
}
public class OwnerMobileItemDetailDto
{
/// <summary>
/// 类型名称
/// </summary>
public string Title { get; set; }
/// <summary>
/// 金额
/// </summary>
public decimal Amount { get; set; }
/// <summary>
/// 发放时间,空则不显示
/// </summary>
public string Date { get; set; }
} }
} }
...@@ -18,9 +18,4 @@ public class PerEmployeeResponse : per_employee ...@@ -18,9 +18,4 @@ public class PerEmployeeResponse : per_employee
/// </summary> /// </summary>
public new string BirthDate { get; set; } public new string BirthDate { get; set; }
} }
public class PersonePassword : per_employee
{
public string Password { get; set; }
}
} }
...@@ -38,12 +38,16 @@ public class SecondColumnDictionary ...@@ -38,12 +38,16 @@ public class SecondColumnDictionary
/// 格式 /// 格式
/// </summary> /// </summary>
public bool IsNumber { get; set; } public bool IsNumber { get; set; }
/// <summary>
/// true 扩展字段,通过配置额外展示
/// </summary>
public bool Expand { get; set; }
public SecondColumnDictionary() public SecondColumnDictionary()
{ {
} }
public SecondColumnDictionary(string label, string key, bool isTrue, int sort, string site = "Table", string type = "", string color = "", int? width = null, bool isNumber = true) public SecondColumnDictionary(string label, string key, bool isTrue, int sort, string site = "Table", string type = "", string color = "", int? width = null, bool isNumber = true, bool expand = false)
{ {
Label = label; Label = label;
Key = key; Key = key;
...@@ -54,6 +58,7 @@ public SecondColumnDictionary(string label, string key, bool isTrue, int sort, s ...@@ -54,6 +58,7 @@ public SecondColumnDictionary(string label, string key, bool isTrue, int sort, s
Color = color; Color = color;
Width = width.HasValue ? width.ToString() : ((label ?? "").Length * 20 + 10).ToString(); Width = width.HasValue ? width.ToString() : ((label ?? "").Length * 20 + 10).ToString();
IsNumber = isNumber; IsNumber = isNumber;
Expand = expand;
} }
} }
} }
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Performance.EntityModels.Entity;
using System; using System;
namespace Performance.EntityModels namespace Performance.EntityModels
...@@ -245,5 +246,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options) ...@@ -245,5 +246,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
/// <summary> 用户角色关联表 </summary> /// <summary> 用户角色关联表 </summary>
public virtual DbSet<sys_user_role> sys_user_role { get; set; } public virtual DbSet<sys_user_role> sys_user_role { get; set; }
public virtual DbSet<sys_version> sys_version { get; set; } public virtual DbSet<sys_version> sys_version { get; set; }
public virtual DbSet<per_attendance> per_attendance { get; set; }
public virtual DbSet<per_attendance_type> per_attendance_type { get; set; }
public virtual DbSet<per_attendance_vacation> per_attendance_vacation { get; set; }
} }
} }
...@@ -15,9 +15,6 @@ namespace Performance.EntityModels ...@@ -15,9 +15,6 @@ namespace Performance.EntityModels
[Table("ag_secondallot")] [Table("ag_secondallot")]
public class ag_secondallot public class ag_secondallot
{ {
/// <summary>
///
/// </summary>
[Key] [Key]
public int Id { get; set; } public int Id { get; set; }
...@@ -60,25 +57,25 @@ public class ag_secondallot ...@@ -60,25 +57,25 @@ public class ag_secondallot
/// 预发金额 /// 预发金额
/// </summary> /// </summary>
public Nullable<decimal> PreRealGiveFee { get; set; } public Nullable<decimal> PreRealGiveFee { get; set; }
/// <summary> ///// <summary>
/// 效率绩效 ///// 效率绩效
/// </summary> ///// </summary>
public Nullable<decimal> Efficiency { get; set; } //public Nullable<decimal> Efficiency { get; set; }
/// <summary> ///// <summary>
/// 规模绩效 ///// 规模绩效
/// </summary> ///// </summary>
public Nullable<decimal> Scale { get; set; } //public Nullable<decimal> Scale { get; set; }
/// <summary> ///// <summary>
/// 发放系数 ///// 发放系数
/// </summary> ///// </summary>
public Nullable<decimal> Grant { get; set; } //public Nullable<decimal> Grant { get; set; }
/// <summary> ///// <summary>
/// 应发管理绩效 ///// 应发管理绩效
/// </summary> ///// </summary>
public Nullable<decimal> ShouldGiveFee { get; set; } //public Nullable<decimal> ShouldGiveFee { get; set; }
/// <summary> /// <summary>
/// 状态 1 未提交 2 等待审核 3 审核通过 4 驳回 /// 状态 1 未提交 2 等待审核 3 审核通过 4 驳回
...@@ -134,5 +131,12 @@ public class ag_secondallot ...@@ -134,5 +131,12 @@ public class ag_secondallot
/// 夜班绩效 /// 夜班绩效
/// </summary> /// </summary>
public Nullable<decimal> NightShiftWorkPerforFee { get; set; } public Nullable<decimal> NightShiftWorkPerforFee { get; set; }
/// <summary>
/// 审计状态 1 已审计
/// </summary>
public Nullable<int> MarkStatus { get; set; }
public Nullable<int> MarkUser { get; set; }
public Nullable<DateTime> MarkTime { get; set; }
} }
} }
...@@ -105,5 +105,9 @@ public class per_allot ...@@ -105,5 +105,9 @@ public class per_allot
/// 是否修改过配置 1修改过 0未修改 /// 是否修改过配置 1修改过 0未修改
/// </summary> /// </summary>
public int IsModifyConfig { get; set; } public int IsModifyConfig { get; set; }
/// <summary>
/// 归档日期
/// </summary>
public Nullable<DateTime> PigeonholeDate { get; set; }
} }
} }
...@@ -95,5 +95,11 @@ public class per_apr_amount ...@@ -95,5 +95,11 @@ public class per_apr_amount
/// 验证失败描述 /// 验证失败描述
/// </summary> /// </summary>
public string VerifyMessage { get; set; } public string VerifyMessage { get; set; }
/// <summary>
/// 审计状态 1 已审计
/// </summary>
public Nullable<int> MarkStatus { get; set; }
public Nullable<int> MarkUser { get; set; }
public Nullable<DateTime> MarkTime { get; set; }
} }
} }
...@@ -90,5 +90,11 @@ public class per_apr_amount_hide ...@@ -90,5 +90,11 @@ public class per_apr_amount_hide
/// 验证失败描述 /// 验证失败描述
/// </summary> /// </summary>
public string VerifyMessage { get; set; } public string VerifyMessage { get; set; }
/// <summary>
/// 审计状态 1 已审计
/// </summary>
public Nullable<int> MarkStatus { get; set; }
public Nullable<int> MarkUser { get; set; }
public Nullable<DateTime> MarkTime { get; set; }
} }
} }
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Performance.EntityModels.Entity
{
[Table("per_attendance")]
public class per_attendance
{
[Key]
public int Id { get; set; }
public int HospitalId { get; set; } //医院Id
public int AllotId { get; set; } //绩效Id
public string PersonnelNumber { get; set; } //工号
public string PersonnelName { get; set; } //姓名
public string CallInUnitType { get; set; } //人员类别
public string CallInAccountingUnit { get; set; } //核算单元
public DateTime? CallInDate { get; set; } //调入时间
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Performance.EntityModels.Entity
{
[Table("per_attendance_type")]
public class per_attendance_type
{
[Key]
public int Id { get; set; }
public int HospitalId { get; set; } //医院Id
public int AllotId { get; set; } //绩效Id
public string AttendanceName { get; set; } //考勤类型名称
/// <summary>
/// 是否核减出勤 1 核减 2 不核减
/// </summary>
public int IsDeduction { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Performance.EntityModels.Entity
{
[Table("per_attendance_vacation")]
public class per_attendance_vacation
{
[Key]
public int Id { get; set; }
public int HospitalId { get; set; } //医院Id
public int AllotId { get; set; } //绩效Id
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; } //结束时间
}
}
...@@ -39,7 +39,8 @@ public class per_batch ...@@ -39,7 +39,8 @@ public class per_batch
/// <summary> /// <summary>
/// 批次日期 /// 批次日期
/// </summary> /// </summary>
public DateTime BatchDate { get; set; } public Nullable<DateTime> BatchDate { get; set; }
public string BankName { get; set; }
/// <summary> /// <summary>
/// 核算单元分类 /// 核算单元分类
......
...@@ -150,5 +150,15 @@ public class per_employee ...@@ -150,5 +150,15 @@ public class per_employee
/// ///
/// </summary> /// </summary>
public Nullable<int> CreateUser { get; set; } public Nullable<int> CreateUser { get; set; }
public string Reserve01 { get; set; }
public string Reserve02 { get; set; }
public string Reserve03 { get; set; }
public string Reserve04 { get; set; }
public string Reserve05 { get; set; }
public string Reserve06 { get; set; }
public string Reserve07 { get; set; }
public string Reserve08 { get; set; }
public string Reserve09 { get; set; }
public string Reserve10 { get; set; }
} }
} }
using Performance.EntityModels.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Performance.EntityModels.Other
{
public class view_attendance
{
public int ALLOTID { get; set; }
public int YEAR { get; set; }
public int MONTH { get; set; }
/// <summary>
/// 人员类别
/// </summary>
public string UnitType { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
/// <summary>
/// 工号
/// </summary>
public string PersonnelNumber { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string PersonnelName { get; set; }
/// <summary>
/// 考勤时间
/// </summary>
public DateTime AttendanceDate { get; set; }
/// <summary>
/// 来源
/// </summary>
public string Source { get; set; }
/// <summary>
/// 科室名称
/// </summary>
public string Department { get; set; }
}
public class InitialAttendance
{
public string UnitType { get; set; } //人员类别
public string AccountingUnit { get; set; } //核算单元
public string PersonnelNumber { get; set; } //工号
public string PersonnelName { get; set; } //姓名
public Nullable<DateTime> StartDate { get; set; } //入科开始时间
public Nullable<DateTime> EndDate { get; set; } //入科结束时间
public string Department { get; set; } //科室名称
}
public class RecordAttendcance : per_attendance_vacation
{
public int Days { get; set; }
public string AttendanceName { get; set; }
}
public class AttendaceHeads
{
public string Column { get; set; }
public string Name { get; set; }
}
public class AttendanceType
{
/// <summary>
/// Id
/// </summary>
public int Id { get; set; } //考勤类型名称
/// <summary>
/// 考勤类型名称
/// </summary>
public string AttendanceName { get; set; }
/// <summary>
/// 是否核减出勤 1 核减 2 不核减
/// </summary>
public string IsDeduction { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Text;
namespace Performance.Infrastructure
{
public static partial class UtilExtensions
{
public static DateTime ToTryDateTime(this string value, params string[] formats)
{
return string.IsNullOrEmpty(value) ? DateTime.MinValue : ToDateTime(value, formats);
}
public static DateTime ToDateTime(this string value, params string[] formats)
{
if (formats.Length == 0)
{
formats = new string[]
{
"yyyyMMddHHmmss",
"yyyyMMddHHmmss",
"yyyy-MM-dd HH:mm:ss",
"yyyy年MM月dd日 HH时mm分ss秒" ,
"yyyyMdHHmmss",
"yyyy年M月d日 H时mm分ss秒",
"yyyy.M.d H:mm:ss",
"yyyy.MM.dd HH:mm:ss",
"yyyy-MM-dd",
"yyyyMMdd",
"yyyy/MM/dd",
"yyyy/M/d",
"yyyy-MM",
"yyyy/MM",
"yyyy/M",
};
}
if (DateTime.TryParseExact(value, formats, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime now))
return now;
return DateTime.MinValue;
}
}
}
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
using Dapper; using Dapper;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Performance.EntityModels; using Performance.EntityModels;
using Performance.EntityModels.Other;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
...@@ -253,9 +254,7 @@ public IEnumerable<view_second_workload_result> GetSecondWorkload(int allotid, s ...@@ -253,9 +254,7 @@ public IEnumerable<view_second_workload_result> GetSecondWorkload(int allotid, s
/// <summary> /// <summary>
/// 查询HIS提取数据,工作量字典 /// 查询HIS提取数据,工作量字典
/// </summary> /// </summary>
/// <param name="allotid"></param> /// <param name="hospitalId"></param>
/// <param name="unittype"></param>
/// <param name="accountingunit"></param>
/// <returns></returns> /// <returns></returns>
public IEnumerable<string> GetSecondWorkloadMaps(int hospitalId) public IEnumerable<string> GetSecondWorkloadMaps(int hospitalId)
{ {
...@@ -278,5 +277,46 @@ public IEnumerable<string> GetSecondWorkloadMaps(int hospitalId) ...@@ -278,5 +277,46 @@ public IEnumerable<string> GetSecondWorkloadMaps(int hospitalId)
} }
} }
} }
public IEnumerable<view_attendance> GetAttendance(int allotId)
{
var connection = context.Database.GetDbConnection();
if (connection.State != ConnectionState.Open) connection.Open();
try
{
string query = $@"SELECT * FROM view_attendance where allotId = @allotId";
return connection.Query<view_attendance>(query, new { allotId }, commandTimeout: 60 * 60);
}
catch (Exception)
{
throw;
}
}
/// <summary>
/// 查询人员字典
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public IEnumerable<dynamic> QueryEmployee(int allotId)
{
using (var connection = context.Database.GetDbConnection())
{
if (connection.State != ConnectionState.Open) connection.Open();
try
{
string query = $@"SELECT * FROM view_employee WHERE AllotID = @allotId";
return connection.Query(query, new { allotId }, commandTimeout: 60 * 60);
}
catch (Exception)
{
throw;
}
}
}
} }
} }
\ No newline at end of file
...@@ -393,7 +393,7 @@ public List<EmployeeReservedDto> GetEmployeeReserved(int hospitalId, int year) ...@@ -393,7 +393,7 @@ public List<EmployeeReservedDto> GetEmployeeReserved(int hospitalId, int year)
public List<view_allot_result> GetOwnerPerformance(List<int> hospitalId, string jobNumber) public List<view_allot_result> GetOwnerPerformance(List<int> hospitalId, string jobNumber)
{ {
string sql = "SELECT * FROM view_allot_result WHERE States = 8 AND HospitalID IN @HospitalID AND JobNumber=@JobNumber"; string sql = "SELECT * FROM view_allot_result WHERE States IN (6,8) AND HospitalID IN @HospitalID AND JobNumber=@JobNumber";
return DapperQuery<view_allot_result>(sql, new { HospitalID = hospitalId, JobNumber = jobNumber })?.ToList(); return DapperQuery<view_allot_result>(sql, new { HospitalID = hospitalId, JobNumber = jobNumber })?.ToList();
} }
......
using Performance.EntityModels;
using Performance.EntityModels.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Performance.Repository.Repository
{
public partial class PerfoPperAttendanceTypeRepository : PerforRepository<per_attendance_type>
{
/// <summary>
/// per_attendance_type Repository
/// </summary>
public PerfoPperAttendanceTypeRepository(PerformanceDbContext context) : base(context)
{
}
}
}
using Performance.EntityModels;
using Performance.EntityModels.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Performance.Repository.Repository
{
public partial class PerfoPperAttendanceVacationeRepository : PerforRepository<per_attendance_vacation>
{
/// <summary>
/// per_attendance_vacation Repository
/// </summary>
public PerfoPperAttendanceVacationeRepository(PerformanceDbContext context) : base(context)
{
}
}
}
using Performance.EntityModels;
using Performance.EntityModels.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Performance.Repository.Repository
{
public partial class PerforPerAttendanceRepository : PerforRepository<per_attendance>
{
/// <summary>
/// per_attendance Repository
/// </summary>
public PerforPerAttendanceRepository(PerformanceDbContext context) : base(context)
{
}
}
}
using AutoMapper; using AutoMapper;
using Dapper;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
...@@ -17,17 +16,12 @@ ...@@ -17,17 +16,12 @@
using System.Data; using System.Data;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dapper;
using Microsoft.Extensions.Caching.Memory;
namespace Performance.Services namespace Performance.Services
{ {
public class AllotService : IAutoInjection public class AllotService : IAutoInjection
{ {
private BaiscNormService baiscNormService; private BaiscNormService baiscNormService;
private CheckDataService checkDataService;
private ImportDataService importDataService; private ImportDataService importDataService;
private ProcessComputService processComputService; private ProcessComputService processComputService;
private ResultComputeService resultComputeService; private ResultComputeService resultComputeService;
...@@ -53,8 +47,7 @@ public class AllotService : IAutoInjection ...@@ -53,8 +47,7 @@ public class AllotService : IAutoInjection
private PerforCofdirectorRepository perforCofdirectorRepository; private PerforCofdirectorRepository perforCofdirectorRepository;
private readonly PerforReportRepository _reportRepository; private readonly PerforReportRepository _reportRepository;
private readonly PerforPeremployeeRepository _perforPeremployeeRepository; private readonly PerforPeremployeeRepository _perforPeremployeeRepository;
private readonly PerforPerbatchRepository _batchRepository;
//private readonly IHubContext<AllotLogHub> hubContext;
private readonly LogManageService logManageService; private readonly LogManageService logManageService;
private readonly ReportService reportService; private readonly ReportService reportService;
...@@ -64,7 +57,6 @@ public class AllotService : IAutoInjection ...@@ -64,7 +57,6 @@ public class AllotService : IAutoInjection
IMapper mapper, IMapper mapper,
PerforPerallotRepository allotRepository, PerforPerallotRepository allotRepository,
BaiscNormService baiscNormService, BaiscNormService baiscNormService,
CheckDataService checkDataService,
ImportDataService importDataService, ImportDataService importDataService,
ProcessComputService processComputService, ProcessComputService processComputService,
ResultComputeService resultComputeService, ResultComputeService resultComputeService,
...@@ -82,7 +74,6 @@ public class AllotService : IAutoInjection ...@@ -82,7 +74,6 @@ public class AllotService : IAutoInjection
PerforHospitalRepository perforHospitalRepository, PerforHospitalRepository perforHospitalRepository,
PerforResbaiscnormRepository perforResbaiscnormRepository, PerforResbaiscnormRepository perforResbaiscnormRepository,
PerforHospitalconfigRepository perforHospitalconfigRepository, PerforHospitalconfigRepository perforHospitalconfigRepository,
//IHubContext<AllotLogHub> hubContext
RoleService roleService, RoleService roleService,
UserService userService, UserService userService,
LogManageService logManageService, LogManageService logManageService,
...@@ -90,6 +81,7 @@ public class AllotService : IAutoInjection ...@@ -90,6 +81,7 @@ public class AllotService : IAutoInjection
PerforCofdirectorRepository perforCofdirectorRepository, PerforCofdirectorRepository perforCofdirectorRepository,
PerforReportRepository reportRepository, PerforReportRepository reportRepository,
PerforPeremployeeRepository perforPeremployeeRepository, PerforPeremployeeRepository perforPeremployeeRepository,
PerforPerbatchRepository batchRepository,
QueryDataService queryDataService) QueryDataService queryDataService)
{ {
_mapper = mapper; _mapper = mapper;
...@@ -98,7 +90,6 @@ public class AllotService : IAutoInjection ...@@ -98,7 +90,6 @@ public class AllotService : IAutoInjection
_logger = logger; _logger = logger;
_evn = evn; _evn = evn;
this.baiscNormService = baiscNormService; this.baiscNormService = baiscNormService;
this.checkDataService = checkDataService;
this.importDataService = importDataService; this.importDataService = importDataService;
this.processComputService = processComputService; this.processComputService = processComputService;
this.resultComputeService = resultComputeService; this.resultComputeService = resultComputeService;
...@@ -122,6 +113,7 @@ public class AllotService : IAutoInjection ...@@ -122,6 +113,7 @@ public class AllotService : IAutoInjection
this.perforCofdirectorRepository = perforCofdirectorRepository; this.perforCofdirectorRepository = perforCofdirectorRepository;
_reportRepository = reportRepository; _reportRepository = reportRepository;
_perforPeremployeeRepository = perforPeremployeeRepository; _perforPeremployeeRepository = perforPeremployeeRepository;
_batchRepository = batchRepository;
this.queryDataService = queryDataService; this.queryDataService = queryDataService;
} }
...@@ -590,6 +582,7 @@ private void SendEmail(per_allot allot, string mail, int type, DateTime time) ...@@ -590,6 +582,7 @@ private void SendEmail(per_allot allot, string mail, int type, DateTime time)
public void Pigeonhole(per_allot allot) public void Pigeonhole(per_allot allot)
{ {
allot.States = 8; allot.States = 8;
allot.PigeonholeDate = DateTime.Now;
allot.Remark = "归档"; allot.Remark = "归档";
_allotRepository.Update(allot); _allotRepository.Update(allot);
//if (_allotRepository.Update(allot)) //if (_allotRepository.Update(allot))
...@@ -707,6 +700,27 @@ public List<OwnerPerformanceDto> GetOwnerPerformance(int userid) ...@@ -707,6 +700,27 @@ public List<OwnerPerformanceDto> GetOwnerPerformance(int userid)
return new List<OwnerPerformanceDto>(); return new List<OwnerPerformanceDto>();
var employees = _perforPeremployeeRepository.GetEntities(w => w.PersonnelNumber == jobNumber); var employees = _perforPeremployeeRepository.GetEntities(w => w.PersonnelNumber == jobNumber);
var allotIds = owner.Select(w => w.AllotId).Distinct().ToList();
var batchs = _batchRepository.GetEntities(w => allotIds.Contains(w.AllotId));
var allots = _allotRepository.GetEntities(w => allotIds.Contains(w.ID));
// 发放时间 归档状态永远显示,如果没有发放时间则使用归档时间,绩效下发状态下显示标记发放时间
Func<OwnerPerformanceDto, string> getIssueDate = (owner) =>
{
var batch = batchs.FirstOrDefault(p => p.AllotId == owner.AllotId
&& p.UnitType == owner.UnitType && p.AccountingUnit == owner.AccountingUnit
&& p.PersonnelNumber == owner.JobNumber);
var allot = allots.FirstOrDefault(w => w.ID == owner.AllotId);
if (batch?.BatchDate != null && batch.BatchDate.HasValue)
return batch.BatchDate.Value.ToString("yyyy年MM月dd日 HH:mm");
else if (allot?.States == (int)AllotStates.Archive)
{
if (allot?.PigeonholeDate != null && allot.PigeonholeDate.HasValue)
return allot.PigeonholeDate.Value.ToString("yyyy年MM月dd日 HH:mm");
return $"{allot.Year}{allot}月";
}
return "";
};
var res = owner var res = owner
.Where(w => w.States == (int)AllotStates.Archive) .Where(w => w.States == (int)AllotStates.Archive)
...@@ -732,13 +746,15 @@ public List<OwnerPerformanceDto> GetOwnerPerformance(int userid) ...@@ -732,13 +746,15 @@ public List<OwnerPerformanceDto> GetOwnerPerformance(int userid)
{ {
var dto = _mapper.Map<OwnerPerformanceDto>(detial); var dto = _mapper.Map<OwnerPerformanceDto>(detial);
dto.Source = string.IsNullOrEmpty(detial.SourceItem) ? detial.Source : $"{detial.Source}-{detial.SourceItem}"; dto.Source = string.IsNullOrEmpty(detial.SourceItem) ? detial.Source : $"{detial.Source}-{detial.SourceItem}";
dto.IssueDate = getIssueDate(dto);
// 应发绩效 // 应发绩效
dto.ShouldGiveFee = Math.Round((dto.RealPerformance ?? 0) + (dto.OtherPerfor ?? 0) + (dto.HideOtherPerfor ?? 0) + (dto.NightWorkPerfor ?? 0), 2, MidpointRounding.AwayFromZero); dto.ShouldGiveFee = Math.Round((dto.RealPerformance ?? 0) + (dto.OtherPerfor ?? 0) + (dto.HideOtherPerfor ?? 0) + (dto.NightWorkPerfor ?? 0), 2, MidpointRounding.AwayFromZero);
dto.ReservedRatio = employees?.FirstOrDefault(emp => emp.AllotId == dto.AllotId && emp.PersonnelNumber == jobNumber)?.ReservedRatio ?? 0; // 预留比例 dto.ReservedRatio = employees?.FirstOrDefault(emp => emp.AllotId == dto.AllotId && emp.PersonnelNumber == jobNumber)?.ReservedRatio ?? 0; // 预留比例
dto.ReservedRatioFee = Math.Round((dto.RealPerformance ?? 0) * (dto.ReservedRatio ?? 0), 2, MidpointRounding.AwayFromZero); // 预留绩效 dto.ReservedRatioFee = Math.Round((dto.RealPerformance ?? 0) * (dto.ReservedRatio ?? 0), 2, MidpointRounding.AwayFromZero); // 预留绩效
dto.RealGiveFee = Math.Round(dto.ShouldGiveFee - (dto.ReservedRatioFee ?? 0) ?? 0, 2, MidpointRounding.AwayFromZero); // 实发绩效 dto.RealGiveFee = Math.Round(dto.ShouldGiveFee - (dto.ReservedRatioFee ?? 0) ?? 0, 2, MidpointRounding.AwayFromZero); // 实发绩效
return dto; return dto;
}), })
.Where(w => !string.IsNullOrEmpty(w.IssueDate)),
}) })
.ToList(); .ToList();
...@@ -758,5 +774,112 @@ public List<OwnerPerformanceDto> GetOwnerPerformance(int userid) ...@@ -758,5 +774,112 @@ public List<OwnerPerformanceDto> GetOwnerPerformance(int userid)
return res?.OrderByDescending(w => w.Year).ThenByDescending(w => w.Month).ToList(); return res?.OrderByDescending(w => w.Year).ThenByDescending(w => w.Month).ToList();
} }
/// <summary>
/// 格式转换
/// </summary>
/// <param name="userid"></param>
/// <param name="beginDate"></param>
/// <param name="endDate"></param>
/// <returns></returns>
public List<OwnerMobilePerformanceDto> GetOwnerMobilePerformance(int userid, DateTime beginDate, DateTime endDate)
{
List<OwnerMobilePerformanceDto> dtos = new List<OwnerMobilePerformanceDto>();
var datas = GetOwnerPerformance(userid);
if (datas == null || datas.Count == 0)
return dtos;
var filterDatas = datas
.Where(w => (new DateTime(w.Year, w.Month, 1)) >= beginDate && (new DateTime(w.Year, w.Month, 1)) < endDate);
var groupDatas = filterDatas.GroupBy(w => w.JobNumber);
foreach (var item in groupDatas)
{
var perforSumFee = new OwnerMobileItemDto
{
Title = "业绩绩效",
Amount = item.Sum(w => w.PerforSumFee) ?? 0,
Details = item.SelectMany(w => w.Detail)
.Where(w => (w.PerforSumFee ?? 0) != 0 && !string.IsNullOrEmpty(w.IssueDate))
.Select(w => new OwnerMobileItemDetailDto
{
Title = w.AccountingUnit,
Amount = w.PerforSumFee ?? 0,
Date = w.IssueDate,
}).ToList()
};
var perforManagementFee = new OwnerMobileItemDto
{
Title = "管理绩效",
Amount = item.Sum(w => w.PerforManagementFee) ?? 0,
Details = item.SelectMany(w => w.Detail)
.Where(w => (w.PerforManagementFee ?? 0) != 0 && !string.IsNullOrEmpty(w.IssueDate))
.Select(w => new OwnerMobileItemDetailDto
{
Title = w.AccountingUnit,
Amount = w.PerforManagementFee ?? 0,
Date = w.IssueDate,
}).ToList()
};
var nightWorkPerfor = new OwnerMobileItemDto
{
Title = "夜班绩效",
Amount = item.Sum(w => w.NightWorkPerfor) ?? 0,
Details = item.SelectMany(w => w.Detail)
.Where(w => (w.NightWorkPerfor ?? 0) != 0 && !string.IsNullOrEmpty(w.IssueDate))
.Select(w => new OwnerMobileItemDetailDto
{
Title = w.AccountingUnit,
Amount = w.NightWorkPerfor ?? 0,
Date = w.IssueDate,
}).ToList()
};
var otherPerfor = new OwnerMobileItemDto
{
Title = "医院其他绩效",
Amount = item.Sum(w => w.OtherPerfor) ?? 0,
Details = item.SelectMany(w => w.Detail)
.Where(w => (w.OtherPerfor ?? 0) != 0 && !string.IsNullOrEmpty(w.IssueDate))
.Select(w => new OwnerMobileItemDetailDto
{
Title = w.SourceItem,
Amount = w.OtherPerfor ?? 0,
Date = w.IssueDate,
}).ToList()
};
var hideOtherPerfor = new OwnerMobileItemDto
{
Title = "不公示其他绩效",
Amount = item.Sum(w => w.HideOtherPerfor) ?? 0,
Details = item.SelectMany(w => w.Detail)
.Where(w => (w.HideOtherPerfor ?? 0) != 0 && !string.IsNullOrEmpty(w.IssueDate))
.Select(w => new OwnerMobileItemDetailDto
{
Title = w.SourceItem,
Amount = w.HideOtherPerfor ?? 0,
Date = w.IssueDate,
}).ToList()
};
var reservedRatioFee = new OwnerMobileItemDto
{
Title = "预留绩效",
Amount = item.Sum(w => w.ReservedRatioFee) ?? 0,
Details = new List<OwnerMobileItemDetailDto>()
};
var dto = new OwnerMobilePerformanceDto { Total = item.Sum(w => w.RealGiveFee), Items = new List<OwnerMobileItemDto>() };
if (perforSumFee.Amount != 0) dto.Items.Add(perforSumFee);
if (perforManagementFee.Amount != 0) dto.Items.Add(perforManagementFee);
if (nightWorkPerfor.Amount != 0) dto.Items.Add(nightWorkPerfor);
if (otherPerfor.Amount != 0) dto.Items.Add(otherPerfor);
if (hideOtherPerfor.Amount != 0) dto.Items.Add(hideOtherPerfor);
if (reservedRatioFee.Amount != 0) dto.Items.Add(reservedRatioFee);
dtos.Add(dto);
}
return dtos;
}
} }
} }
using AutoMapper;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using OfficeOpenXml;
using OfficeOpenXml.Style;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.EntityModels.Entity;
using Performance.EntityModels.Other;
using Performance.Infrastructure;
using Performance.Repository;
using Performance.Repository.Repository;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Performance.Services
{
public class AttendanceService : IAutoInjection
{
private readonly IMapper mapper;
private readonly ILogger<AttendanceService> logger;
private readonly PerforPerallotRepository perforPerallotRepository;
private readonly PerforPerAttendanceRepository perforPerAttendanceRepository;
private readonly PerfoPperAttendanceTypeRepository perfoPperAttendanceTypeRepository;
private readonly PerfoPperAttendanceVacationeRepository perfoPperAttendanceVacationeRepository;
private readonly PerforPerdeptdicRepository perdeptdicRepository;
private readonly PerforPeremployeeRepository perforPeremployeeRepository;
private readonly PerforCofaccountingRepository cofaccountingRepository;
public AttendanceService(
IMapper mapper,
ILogger<AttendanceService> logger,
PerforPerallotRepository perforPerallotRepository,
PerforPerAttendanceRepository perforPerAttendanceRepository,
PerfoPperAttendanceTypeRepository perfoPperAttendanceTypeRepository,
PerfoPperAttendanceVacationeRepository perfoPperAttendanceVacationeRepository,
PerforPerdeptdicRepository perdeptdicRepository,
PerforPeremployeeRepository perforPeremployeeRepository,
PerforCofaccountingRepository cofaccountingRepository)
{
this.mapper = mapper;
this.logger = logger;
this.perforPerallotRepository = perforPerallotRepository;
this.perforPerAttendanceRepository = perforPerAttendanceRepository;
this.perfoPperAttendanceTypeRepository = perfoPperAttendanceTypeRepository;
this.perfoPperAttendanceVacationeRepository = perfoPperAttendanceVacationeRepository;
this.perdeptdicRepository = perdeptdicRepository;
this.perforPeremployeeRepository = perforPeremployeeRepository;
this.cofaccountingRepository = cofaccountingRepository;
}
#region 初始考勤页面
public ApiResponse<List<AttendanceStatistics>> GetAttendance(int allotId)
{
var allot = perforPerallotRepository.GetEntity(w => w.ID == allotId);
if (allot == null)
throw new PerformanceException("当前绩效记录不存在");
var attendanceData = perforPerallotRepository.GetAttendance(allotId);
List<AttendanceStatistics> statistics = new List<AttendanceStatistics>();
// 交叉补全科室结束时间
foreach (var personnelNumber in attendanceData.Select(w => w.PersonnelNumber).Distinct())
{
var attendances = attendanceData.Where(w => w.PersonnelNumber == personnelNumber).OrderBy(w => w.AttendanceDate);
for (int i = 0; i < attendances.Count() - 1; i++)
{
var begDate = attendances.ElementAt(i).AttendanceDate.Date;
var endDate = attendances.ElementAt(i + 1).AttendanceDate.Date;
// 调入科室需要额外减去1天作为上一个科室结束时间
var days = attendances.ElementAt(i + 1).Source == Attendance.Type.调入.ToString() ? -1 : 0;
if (endDate > begDate)
{
var stat = new AttendanceStatistics
{
AllotID = attendances.ElementAt(i).ALLOTID,
UnitType = attendances.ElementAt(i).UnitType,
AccountingUnit = attendances.ElementAt(i).AccountingUnit,
Department = attendances.ElementAt(i).Department,
PersonnelNumber = attendances.ElementAt(i).PersonnelNumber,
PersonnelName = attendances.ElementAt(i).PersonnelName,
BeginDate = begDate,
EndDate = endDate.AddDays(days),
Detial = new List<AttendanceStatisticsDetial>()
};
statistics.Add(stat);
}
}
}
if (statistics != null)
return new ApiResponse<List<AttendanceStatistics>>(ResponseType.OK, statistics);
else
{
return new ApiResponse<List<AttendanceStatistics>>(ResponseType.Fail);
}
}
#endregion
#region 调入记录
public ApiResponse<List<view_attendance>> GetCallIn(int allotId)
{
var view_attendance = perforPerallotRepository.GetAttendance(allotId).Where(t => t.Source.Contains("调入")).ToList();
if (view_attendance != null)
return new ApiResponse<List<view_attendance>>(ResponseType.OK, view_attendance);
else
{
return new ApiResponse<List<view_attendance>>(ResponseType.Fail);
}
}
public HandsonTable GetBatchCallInHandsonTable(int allotId)
{
HandsonTable handson = new HandsonTable((int)SheetType.Unidentifiable, Person.Select(c => c.Item2).ToArray(), Person.Select(t => new collect_permission
{
HeadName = t.Item2,
Visible = 1,
Readnoly = 0
}).ToList());
if (handson.Columns != null && handson.Columns.Any())
{
var cofaccounting = cofaccountingRepository.GetEntities(w => w.UnitType != "" && w.AllotId == allotId);
foreach (var column in handson.Columns)
{
column.Type = "text";
if (column.Data == "调入组别")
{
column.Type = "autocomplete";
//column.Source = EnumHelper.GetItems<UnitType>().Select(w => w.Description.Replace("行政后勤", "行政工勤")).ToArray();
column.Source = cofaccounting.Select(w => w.UnitType).Distinct().ToArray();
column.Strict = true;
}
if (column.Data == "调入核算单元")
{
column.Type = "autocomplete";
//column.Source = EnumHelper.GetItems<AccountUnitType>().Where(w => w.Description != "").Select(w => w.Description).ToArray();
column.Source = cofaccounting.Select(w => w.AccountingUnit).Distinct().ToArray();
column.Strict = true;
}
//if (column.Data == "调入时间")
//{
// column.Type = "date";
// column.DateFormat = "YYYY/MM/DD";
//}
}
}
List<view_attendance> data = new List<view_attendance>();
data = GetCallIn(allotId).Data;
var convertDate = data.Select(t =>
new
{
t.PersonnelName,
t.PersonnelNumber,
t.AccountingUnit,
t.UnitType,
AttendanceDate = t.AttendanceDate.ToString("d")
});
if (convertDate == null)
return handson;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 1;
var dict = new Dictionary<string, string>();
Person2.ForEach(t => dict.Add(t.Item1, t.Item2));
foreach (var item in convertDate)
{
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in dict 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++;
}
handson.SetRowData(rowDatas, rowDatas != null);
foreach (var item in handson.Data)
{
item.Remove("编号");
}
return handson;
}
public ApiResponse BatchCallIn(int allotId, int hospitalId, SaveCollectData request)
{
var dict = new Dictionary<string, string>();
Person.ForEach(t => dict.Add(t.Item1, t.Item2));
var dicData = CreateDataRow(request, dict);
if (dicData == null || dicData.Count == 0)
return new ApiResponse(ResponseType.Error, "空数据,无效操作");
var convertDicData = dicData.Select(w => new per_attendance
{
PersonnelNumber = w["PersonnelNumber"],
PersonnelName = w["PersonnelName"],
CallInAccountingUnit = w["CallInAccountingUnit"],
CallInUnitType = w["CallInUnitType"],
CallInDate = ConvertHelper.To<DateTime>(w["CallInDate"]),
});
var jsons = JsonHelper.Serialize(convertDicData);
var newAttendanceVacatione = JsonHelper.Deserialize<List<per_attendance>>(jsons);
var oldCallinAttendance = perforPerAttendanceRepository.GetEntities(t => t.AllotId == allotId && t.HospitalId == hospitalId);
var per_allot = perforPerallotRepository.GetEntities(t => t.ID == allotId && t.HospitalId == hospitalId).FirstOrDefault();
if (per_allot == null) return new ApiResponse(ResponseType.Error, "无绩效数据");
var cofaccounting = cofaccountingRepository.GetEntities(ca => ca.AllotId == allotId);
var per_employee = perforPeremployeeRepository.GetEntities(t => t.AllotId == allotId && t.HospitalId == hospitalId);
List<Dictionary<string, string>> error = new List<Dictionary<string, string>>();
for (int i = 0; i < newAttendanceVacatione.Count; i++)
{
if (string.IsNullOrEmpty(newAttendanceVacatione[i].PersonnelName?.Trim())
|| string.IsNullOrEmpty(newAttendanceVacatione[i].PersonnelNumber?.Trim())
|| string.IsNullOrEmpty(newAttendanceVacatione[i].CallInAccountingUnit?.Trim())
|| string.IsNullOrEmpty(newAttendanceVacatione[i].CallInUnitType?.Trim())
|| newAttendanceVacatione[i].CallInDate == null)
{
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "调入核算单元", newAttendanceVacatione[i].CallInAccountingUnit??"" },
{ "调入组别", newAttendanceVacatione[i].CallInUnitType??"" },
{ "调入时间", newAttendanceVacatione[i].CallInDate.ToString()??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "“关键信息缺失”请补全或删除" },
});
}
DateTime dt = new DateTime(per_allot.Year, per_allot.Month, 1).AddMonths(1);
if (newAttendanceVacatione[i].CallInDate > dt)
{
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "调入核算单元", newAttendanceVacatione[i].CallInAccountingUnit??"" },
{ "调入组别", newAttendanceVacatione[i].CallInUnitType??"" },
{ "调入时间", newAttendanceVacatione[i].CallInDate.ToString()??"" },
{ "来源", "粘贴数据" },
{ "错误原因", $"调入时间不在当前绩效月份范围内,已超出{SplitEveryDay(dt.AddDays(-1),newAttendanceVacatione[i].CallInDate.Value).Count-1}天" },
});
}
if (newAttendanceVacatione[i].CallInUnitType != cofaccounting.FirstOrDefault(t => t.AccountingUnit == newAttendanceVacatione[i].CallInAccountingUnit)?.UnitType)
{
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "调入核算单元", newAttendanceVacatione[i].CallInAccountingUnit??"" },
{ "调入组别", newAttendanceVacatione[i].CallInUnitType??"" },
{ "调入时间", newAttendanceVacatione[i].CallInDate.ToString()??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "该核算单元的调入组别不一致或不存在" },
});
}
if (newAttendanceVacatione[i].PersonnelName != per_employee.FirstOrDefault(t => t.PersonnelNumber == newAttendanceVacatione[i].PersonnelNumber && t.AllotId == allotId && t.HospitalId == hospitalId)?.DoctorName)
{
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "调入核算单元", newAttendanceVacatione[i].CallInAccountingUnit??"" },
{ "调入组别", newAttendanceVacatione[i].CallInUnitType??"" },
{ "调入时间", newAttendanceVacatione[i].CallInDate.ToString()??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "该人员与人员字典不一致或不存在" },
});
}
var oldEmp = oldCallinAttendance.FirstOrDefault(w => w.PersonnelNumber == newAttendanceVacatione[i].PersonnelNumber);
if (!string.IsNullOrEmpty(newAttendanceVacatione[i].PersonnelName) && oldEmp != null && oldEmp.PersonnelName != newAttendanceVacatione[i].PersonnelName)
{
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "调入核算单元", newAttendanceVacatione[i].CallInAccountingUnit??"" },
{ "调入组别", newAttendanceVacatione[i].CallInUnitType??"" },
{ "调入时间", newAttendanceVacatione[i].CallInDate.ToString()??"" },
{ "来源", "“粘贴数据”与“历史数据”比对" },
{ "错误原因", $"原名“{oldEmp.PersonnelName}”,工号相同但姓名不同,请删除“历史数据”中该员工" },
});
}
}
if (error.Count > 0)
return new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", error);
List<per_attendance> addPer_Attendances = new List<per_attendance>();
foreach (var data in newAttendanceVacatione)
{
data.AllotId = allotId;
data.HospitalId = hospitalId;
addPer_Attendances.Add(data);
var any = oldCallinAttendance.FirstOrDefault(w => w.AllotId == allotId && w.HospitalId == hospitalId && w.CallInDate == data.CallInDate && w.CallInAccountingUnit?.Trim() == data.CallInAccountingUnit?.Trim() && w.CallInUnitType?.Trim() == data.CallInUnitType?.Trim() && w.PersonnelName?.Trim() == data.PersonnelName?.Trim() && w.PersonnelNumber?.Trim() == data.PersonnelNumber?.Trim());
}
perforPerAttendanceRepository.RemoveRange(oldCallinAttendance.ToArray());
if (addPer_Attendances != null && addPer_Attendances.Any())
perforPerAttendanceRepository.AddRange(addPer_Attendances.ToArray());
return new ApiResponse(ResponseType.OK, "");
}
#endregion
#region 考勤类型
public ApiResponse<List<per_attendance_type>> GetAttendanceType(int allotId)
{
var result = perfoPperAttendanceTypeRepository.GetEntities(t => t.AllotId == allotId).ToList();
if (result != null)
return new ApiResponse<List<per_attendance_type>>(ResponseType.OK, result);
else
{
return new ApiResponse<List<per_attendance_type>>(ResponseType.Fail);
}
}
public ApiResponse<AttendanceType> InsertAttendanceType(int allotId, int hospitalId, AttendanceType attendanceType)
{
var any = perfoPperAttendanceTypeRepository.GetEntities().FirstOrDefault(t => t.Id == attendanceType.Id);
if (any != null)
{
any.AttendanceName = attendanceType.AttendanceName;
any.IsDeduction = Convert.ToInt32(attendanceType.IsDeduction);
if (perfoPperAttendanceTypeRepository.Update(any)) return new ApiResponse<AttendanceType>(ResponseType.OK, "修改成功");
else return new ApiResponse<AttendanceType>(ResponseType.Fail, "修改失败");
}
else
{
per_attendance_type per_Attendance_Type = new per_attendance_type()
{
AllotId = allotId,
HospitalId = hospitalId,
AttendanceName = attendanceType.AttendanceName,
IsDeduction = Convert.ToInt32(attendanceType.IsDeduction)
};
if (perfoPperAttendanceTypeRepository.Add(per_Attendance_Type)) return new ApiResponse<AttendanceType>(ResponseType.OK, "添加成功");
else return new ApiResponse<AttendanceType>(ResponseType.Fail, "添加失败");
}
}
public ApiResponse DeleteAttendanceType(int id)
{
var any = perfoPperAttendanceTypeRepository.GetEntity(t => t.Id == id);
if (any == null) return new ApiResponse(ResponseType.Fail, "没有该数据");
var use = perfoPperAttendanceVacationeRepository.GetEntity(t => t.TypeId == any.Id);
if (use != null) return new ApiResponse(ResponseType.Fail, "该类型正在使用!");
if (any != null && use == null)
{
if (perfoPperAttendanceTypeRepository.DeleteFromQuery(t => t.Id == id) > 0) return new ApiResponse(ResponseType.OK, "删除成功");
else return new ApiResponse(ResponseType.Fail, "删除失败");
}
else return new ApiResponse(ResponseType.Fail, "删除失败");
}
#endregion
#region 考勤记录
public HandsonTable GetAttendanceVacationHandsonTable(int allotId)
{
HandsonTable handson = new HandsonTable((int)SheetType.Unidentifiable, Vacation.Select(c => c.Item2).ToArray(), Vacation.Select(t => new collect_permission
{
HeadName = t.Item2,
Visible = 1,
Readnoly = 0
}).ToList());
if (handson.Columns != null && handson.Columns.Any())
{
var type = perfoPperAttendanceTypeRepository.GetEntities(t => t.AllotId == allotId);
foreach (var column in handson.Columns)
{
column.Type = "text";
//if (column.Data.Contains("时间"))
//{
// column.Type = "date";
// column.DateFormat = "YYYY/MM/DD";
//}
if (column.Data == "考勤类型")
{
column.Type = "autocomplete";
column.Source = type.Select(t => t.AttendanceName).ToArray();
}
}
}
List<RecordAttendcance> data = new List<RecordAttendcance>();
data = GetAttendanceVacation(allotId).Data;
var convertDate = data.Select(t =>
new
{
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()
});
if (convertDate == null)
return handson;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 1;
var dict = new Dictionary<string, string>();
Vacation.ForEach(t => dict.Add(t.Item1, t.Item2));
foreach (var item in convertDate)
{
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in dict 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++;
}
handson.SetRowData(rowDatas, rowDatas != null);
foreach (var item in handson.Data)
{
item.Remove("编号");
}
return handson;
}
public ApiResponse<List<RecordAttendcance>> GetAttendanceVacation(int allotId)
{
var vacatione = perfoPperAttendanceVacationeRepository.GetEntities(t => t.AllotId == allotId);
var type = perfoPperAttendanceTypeRepository.GetEntities(t => t.AllotId == allotId);
if (type.Count == 0)
return new ApiResponse<List<RecordAttendcance>>(ResponseType.Fail, new List<RecordAttendcance>());
var data = from a in vacatione
join b in type on a.TypeId equals b.Id into temp
from tt in temp.DefaultIfEmpty()
select new RecordAttendcance
{
Id = a.Id,
AllotId = a.AllotId,
HospitalId = a.HospitalId,
PersonnelName = a.PersonnelName,
PersonnelNumber = a.PersonnelNumber,
AttendanceName = tt.AttendanceName,
TypeId = a.TypeId,
BegDate = a.BegDate,
EndDate = a.EndDate,
Days = SplitEveryDay(ConvertHelper.To<DateTime>(a.BegDate), ConvertHelper.To<DateTime>(a.EndDate)).Count()
};
if (data != null)
return new ApiResponse<List<RecordAttendcance>>(ResponseType.OK, data.ToList());
else
{
return new ApiResponse<List<RecordAttendcance>>(ResponseType.Fail);
}
}
public ApiResponse AttendanceBatch(int allotId, int hospitalId, SaveCollectData request)
{
var dict = new Dictionary<string, string>();
Vacation.ForEach(t => dict.Add(t.Item1, t.Item2));
var dicData = CreateDataRow(request, dict);
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"]),
});
var jsons = JsonHelper.Serialize(convertDicData);
var newAttendanceVacatione = JsonHelper.Deserialize<List<RecordAttendcance>>(jsons);
var oldAttendanceVacatione = perfoPperAttendanceVacationeRepository.GetEntities(t => t.AllotId == allotId && t.HospitalId == hospitalId);
var attendanceType = perfoPperAttendanceTypeRepository.GetEntities();
var per_employee = perforPeremployeeRepository.GetEntities(t => t.AllotId == allotId && t.HospitalId == hospitalId);
List<Dictionary<string, string>> error = new List<Dictionary<string, string>>();
var per_allot = perforPerallotRepository.GetEntities(t => t.ID == allotId && t.HospitalId == hospitalId).FirstOrDefault();
for (int i = 0; i < newAttendanceVacatione.Count; i++)
{
if (string.IsNullOrEmpty(newAttendanceVacatione[i].PersonnelName?.Trim())
|| string.IsNullOrEmpty(newAttendanceVacatione[i].PersonnelNumber?.Trim())
|| string.IsNullOrEmpty(newAttendanceVacatione[i].AttendanceName?.Trim())
|| newAttendanceVacatione[i].BegDate == DateTime.MinValue
|| newAttendanceVacatione[i].EndDate == DateTime.MinValue)
{
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "考勤类型", newAttendanceVacatione[i].AttendanceName??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate.ToString()??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate.ToString()??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "“关键信息缺失”请补全或删除" },
});
}
var typeAny = attendanceType.FirstOrDefault(t => t.AllotId == allotId && t.HospitalId == hospitalId && t.AttendanceName == newAttendanceVacatione[i].AttendanceName);
if (typeAny == null)
{
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "考勤类型", newAttendanceVacatione[i].AttendanceName??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate.ToString()??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate.ToString()??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "没有该考勤类型" },
});
}
if (newAttendanceVacatione[i].PersonnelName != per_employee.FirstOrDefault(t => t.PersonnelNumber == newAttendanceVacatione[i].PersonnelNumber && t.AllotId == allotId && t.HospitalId == hospitalId)?.DoctorName)
{
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "考勤类型", newAttendanceVacatione[i].AttendanceName??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate.ToString()??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate.ToString()??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "该人员与人员字典不一致或不存在" },
});
}
var oldEmp = oldAttendanceVacatione.FirstOrDefault(w => w.PersonnelNumber == newAttendanceVacatione[i].PersonnelNumber);
if (!string.IsNullOrEmpty(newAttendanceVacatione[i].PersonnelName) && oldEmp != null && oldEmp.PersonnelName != newAttendanceVacatione[i].PersonnelName)
{
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "考勤类型", newAttendanceVacatione[i].AttendanceName??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate.ToString()??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate.ToString()??"" },
{ "来源", "“粘贴数据”与“历史数据”比对" },
{ "错误原因", $"原名“{oldEmp.PersonnelName}”,工号相同但姓名不同,请删除“历史数据”中该员工" },
});
}
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>
{
{ "行号", $"第{i+1}行" },
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "考勤类型", newAttendanceVacatione[i].AttendanceName??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate.ToString()??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate.ToString()??"" },
{ "来源", "粘贴数据" },
{ "错误原因", $"考勤时间不在该绩效月份内,已超出{SplitEveryDay(dt.AddDays(-1),newAttendanceVacatione[i].EndDate.Value).Count-1}天" },
});
}
if (newAttendanceVacatione[i].BegDate > newAttendanceVacatione[i].EndDate)
{
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
{ "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
{ "考勤类型", newAttendanceVacatione[i].AttendanceName??"" },
{ "开始日期", newAttendanceVacatione[i].BegDate.ToString()??"" },
{ "结束日期", newAttendanceVacatione[i].EndDate.ToString()??"" },
{ "来源", "粘贴数据" },
{ "错误原因", "开始时间不能大于结束时间" },
});
}
var newDate = SplitEveryDay(Convert.ToDateTime(newAttendanceVacatione[i].BegDate), Convert.ToDateTime(newAttendanceVacatione[i].EndDate));
//foreach (var item in oldAttendanceVacatione.Where(w => w.PersonnelNumber == newAttendanceVacatione[i].PersonnelNumber))
//{
// var oldDate = SplitEveryDay(Convert.ToDateTime(item.BegDate), Convert.ToDateTime(item.EndDate));
// bool any = false;
// foreach (var old in oldDate)
// {
// if (newDate.Contains(old))
// any = true;
// }
// if (any)
// error.Add(new Dictionary<string, string>
// {
// { "行号", $"第{i+1}行" },
// { "人员工号", newAttendanceVacatione[i].PersonnelNumber??"" },
// { "人员姓名", newAttendanceVacatione[i].PersonnelName??"" },
// { "考勤类型", newAttendanceVacatione[i].AttendanceName??"" },
// { "开始日期", newAttendanceVacatione[i].BegDate.ToString()??"" },
// { "结束日期", newAttendanceVacatione[i].EndDate.ToString()??"" },
// { "来源", "粘贴数据" },
// { "错误原因", "该考勤时间范围与历史考勤时间冲突" },
// });
//}
}
if (error.Count > 0)
return new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", error);
List<per_attendance_vacation> addAttendanceVacatione = new List<per_attendance_vacation>();
var type = GetAttendanceType(allotId);
foreach (var data in newAttendanceVacatione)
{
data.AllotId = allotId;
data.HospitalId = hospitalId;
data.TypeId = type.Data.FirstOrDefault(t => t.AttendanceName == data.AttendanceName).Id;
addAttendanceVacatione.Add(data);
var any = oldAttendanceVacatione.FirstOrDefault(w => w.AllotId == allotId && w.HospitalId == hospitalId && w.BegDate == data.BegDate && w.EndDate == data.EndDate && w.PersonnelName?.Trim() == data.PersonnelName?.Trim() && w.PersonnelNumber?.Trim() == data.PersonnelNumber?.Trim() && w.TypeId == data.TypeId);
}
perfoPperAttendanceVacationeRepository.RemoveRange(oldAttendanceVacatione.ToArray());
if (addAttendanceVacatione != null && addAttendanceVacatione.Any())
perfoPperAttendanceVacationeRepository.AddRange(addAttendanceVacatione.ToArray());
return new ApiResponse(ResponseType.OK, "");
}
#endregion
public ApiResponse<List<AttendanceStatistics>> GetAttendanceStatistics(int allotId)
{
var allot = perforPerallotRepository.GetEntity(w => w.ID == allotId);
if (allot == null)
throw new PerformanceException("当前绩效记录不存在");
var types = perfoPperAttendanceTypeRepository.GetEntities(t => t.AllotId == allotId) ?? new List<per_attendance_type>();
var vacationeData = perfoPperAttendanceVacationeRepository.GetEntities(t => t.AllotId == allotId) ?? new List<per_attendance_vacation>();
//// 只关注请假的人
//var numbers = vacationeData.Select(w => w.PersonnelNumber).ToList();
//var attendanceData = perforPerallotRepository.GetAttendance(allotId)
// .Where(w => numbers.Contains(w.PersonnelNumber))
// .ToList();
var attendanceData = perforPerallotRepository.GetAttendance(allotId);
List<AttendanceStatistics> statistics = new List<AttendanceStatistics>();
// 交叉补全科室结束时间
foreach (var personnelNumber in attendanceData.Select(w => w.PersonnelNumber).Distinct())
{
var attendances = attendanceData.Where(w => w.PersonnelNumber == personnelNumber).OrderBy(w => w.AttendanceDate);
for (int i = 0; i < attendances.Count() - 1; i++)
{
var begDate = attendances.ElementAt(i).AttendanceDate.Date;
var endDate = attendances.ElementAt(i + 1).AttendanceDate.Date;
// 调入科室需要额外减去1天作为上一个科室结束时间
var days = attendances.ElementAt(i + 1).Source == Attendance.Type.调入.ToString() ? -1 : 0;
if (endDate > begDate)
{
var stat = new AttendanceStatistics
{
AllotID = attendances.ElementAt(i).ALLOTID,
UnitType = attendances.ElementAt(i).UnitType,
AccountingUnit = attendances.ElementAt(i).AccountingUnit,
Department = attendances.ElementAt(i).Department,
PersonnelNumber = attendances.ElementAt(i).PersonnelNumber,
PersonnelName = attendances.ElementAt(i).PersonnelName,
BeginDate = begDate,
EndDate = endDate.AddDays(days),
Detial = new List<AttendanceStatisticsDetial>()
};
statistics.Add(stat);
}
}
}
var vacationes = vacationeData
.Where(w => w.BegDate > DateTime.MinValue && w.EndDate > DateTime.MinValue)
.Select(w => new
{
w.PersonnelNumber,
Type = types.FirstOrDefault(p => p.Id == w.TypeId)?.AttendanceName ?? "考勤类型缺失",
Dates = SplitEveryDay(w.BegDate.Value.Date, w.EndDate.Value.Date),
Remark = types.FirstOrDefault(p => p.Id == w.TypeId)?.IsDeduction == (int)Attendance.Deduction.核减 ? "核减" : "不核减",
});
foreach (var stat in statistics)
{
stat.Detial = vacationes
.Where(w => w.PersonnelNumber == stat.PersonnelNumber)
.Select(w => new AttendanceStatisticsDetial
{
Title = w.Type,
Value = w.Dates.Where(date => date >= stat.BeginDate && date <= stat.EndDate).Count(),
Remark = w.Remark,
})
.ToList();
foreach (var item in types)
{
if (!stat.Detial.Any(w => w.Title == item.AttendanceName))
{
stat.Detial.Add(new AttendanceStatisticsDetial
{
Title = item.AttendanceName,
Value = 0,
Remark = item.IsDeduction == (int)Attendance.Deduction.核减 ? "核减" : "不核减",
});
}
}
int vacationesDays = stat.Detial.Where(w => !w.Remark.Contains("不核减")).Sum(w => w.Value);
stat.AttendanceDays = SplitEveryDay(stat.BeginDate, stat.EndDate).Where(date => date >= stat.BeginDate && date <= stat.EndDate).Count() - vacationesDays;
}
return new ApiResponse<List<AttendanceStatistics>>(ResponseType.OK, "", statistics);
}
// 拆分请假时间段为每个日期
private List<DateTime> SplitEveryDay(DateTime begin, DateTime end)
{
List<DateTime> dates = new List<DateTime>();
for (int i = 0; i <= (end - begin).TotalDays; i++)
{
dates.Add(begin.AddDays(i));
}
return dates;
}
private List<Dictionary<string, string>> CreateDataRow(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);
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 string ExcelDownload(List<Dictionary<string, object>> rows, string name, int allotId, List<ExcelDownloadHeads> headList)
{
var perAllot = perforPerallotRepository.GetEntity(t => t.ID == allotId);
string title = $"{ perAllot.Year}{perAllot.Month}{name}";
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)
{
var lower = item.Key.ToLower();
if (lower.Contains("date"))
nobj[lower] = Convert.ToDateTime(item.Value).ToString("d");
else if (lower.Contains("detial"))
{
var detRows = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(item.Value.ToString());
foreach (var detlist in detRows)
{
string value = "";
foreach (var detitem in detlist)
{
if (detitem.Key == "Value") value = detitem.Value.ToString();
if (detitem.Key == "Title") nobj[detitem.Value.ToString()] = value;
}
}
}
else
nobj[lower] = item.Value;
}
data.Add(nobj);
}
var dpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Files");
if (!Directory.Exists(dpath)) Directory.CreateDirectory(dpath);
string filepath = Path.Combine(dpath, $"{name}{DateTime.Now:yyyyMMdd}");
if (File.Exists(filepath)) File.Delete(filepath);
using (FileStream fs = new FileStream(filepath, FileMode.OpenOrCreate))
using (ExcelPackage package = new ExcelPackage(fs))
{
var worksheet = package.Workbook.Worksheets.Add(name);
if (rows != null && rows.Count() > 0)
{
worksheet.SetValue(1, 1, title);
for (int col = 0; col < headList.Count; col++)
{
worksheet.SetValue(2, col + 1, headList[col].Alias);
}
for (int col = 0; col < headList.Count; col++)
{
for (int row = 0; row < data.Count(); row++)
{
var temp = data.ElementAt(row);
var low = temp.Keys.ToString().ToLower();
var value = temp[headList[col].Name.ToLower()];
worksheet.Cells[row + 3, col + 1].Value = value;
}
}
#region 样式设置
for (int row = worksheet.Dimension.Start.Row; row <= worksheet.Dimension.End.Row; row++)
{
worksheet.Row(row).Height = 20;
for (int col = worksheet.Dimension.Start.Column; col <= worksheet.Dimension.End.Column; col++)
{
worksheet.Cells[row, col].Style.Border.BorderAround(ExcelBorderStyle.Thin);
worksheet.Cells[row, col].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
worksheet.Cells[row, col].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
}
}
worksheet.Cells[1, 1, 1, headList.Count].Merge = true;
worksheet.Cells[1, 1, 1, headList.Count].Style.Font.Bold = true;
worksheet.Cells[1, 1, 1, headList.Count].Style.Font.Size = 16;
worksheet.Row(1).Height = 24;
worksheet.Cells[2, 1, 2, headList.Count].Style.Font.Bold = true;
worksheet.View.FreezePanes(3, 1);
worksheet.Cells.AutoFitColumns();
for (int col = worksheet.Dimension.Start.Column; col <= worksheet.Dimension.End.Column; col++)
{
worksheet.Column(col).Width = worksheet.Column(col).Width > 20 ? 20 : worksheet.Column(col).Width;
}
#endregion
}
package.Save();
}
return filepath;
}
public static List<(string, string, Func<per_attendance, object>)> Person { get; } = new List<(string, string, Func<per_attendance, object>)>
{
(nameof(per_attendance.PersonnelName), "人员姓名", t => t.PersonnelName),
(nameof(per_attendance.PersonnelNumber), "员工工号", t => t.PersonnelNumber),
(nameof(per_attendance.CallInAccountingUnit), "调入核算单元" ,t => t.CallInAccountingUnit),
(nameof(per_attendance.CallInUnitType), "调入组别", t => t.CallInUnitType),
(nameof(per_attendance.CallInDate), "调入时间", t => t.CallInDate),
};
public static List<(string, string, Func<view_attendance, object>)> Person2 { get; } = new List<(string, string, Func<view_attendance, object>)>
{
(nameof(view_attendance.PersonnelName), "人员姓名", t => t.PersonnelName),
(nameof(view_attendance.PersonnelNumber), "员工工号", t => t.PersonnelNumber),
(nameof(view_attendance.AccountingUnit), "调入核算单元" ,t => t.AccountingUnit),
(nameof(view_attendance.UnitType), "调入组别", t => t.UnitType),
(nameof(view_attendance.AttendanceDate), "调入时间", t => t.AttendanceDate),
};
public static List<(string, string, Func<RecordAttendcance, object>)> Vacation { get; } = new List<(string, string, Func<RecordAttendcance, object>)>
{
(nameof(RecordAttendcance.PersonnelName), "人员姓名", t => t.PersonnelName),
(nameof(RecordAttendcance.PersonnelNumber), "员工工号", t => t.PersonnelNumber),
(nameof(RecordAttendcance.AttendanceName), "考勤类型" ,t => t.AttendanceName),
(nameof(RecordAttendcance.BegDate), "开始时间", t => t.BegDate),
(nameof(RecordAttendcance.EndDate), "结束时间", t => t.EndDate),
};
}
}
using Performance.DtoModels;
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Performance.Services
{
public class ComputeConfig
{
public static List<cof_alias> PerformanceTotal(string route, string[] heads)
{
if (heads == null || heads.Length == 0 || (heads.Length > 0 && heads[0] == ""))
{
if (route == "/report/wholehospital_grant_summary")
return AllComputeView.ToList();
if (route == "/report/wholehospital_accounting_grant_summary")
return AllComputeDepartmentView.ToList();
if (route == "/report/wholehospital_finance_grant_summary")
return AllComputePersonView.ToList();
}
if (route == "/report/wholehospital_grant_summary")
return AllComputeView.Where(t => heads.Contains(t.Name.ToLower())).ToList();
if (route == "/report/wholehospital_accounting_grant_summary")
return AllComputeDepartmentView.Where(t => heads.Contains(t.Name.ToLower())).ToList();
if (route == "/report/wholehospital_finance_grant_summary")
return AllComputePersonView.Where(t => heads.Contains(t.Name.ToLower())).ToList();
return null;
}
public static List<cof_alias> AllComputeView { get; } = new List<cof_alias>
{
new cof_alias{ Alias = "来源", Name = nameof(view_allot_sign_emp.Source), States = 1, SumStatus = 0, Sort = 1 },
new cof_alias{ Alias = "核算组别", Name = nameof(view_allot_sign_emp.UnitType), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "核算单元编码", Name = nameof(view_allot_sign_emp.Code), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_emp.AccountingUnit), States = 1, SumStatus = 0, Sort = 3 },
new cof_alias{ Alias = "员工号", Name = nameof(view_allot_sign_emp.JobNumber), States = 1, SumStatus = 0, Sort = 4 },
new cof_alias{ Alias = "人员姓名", Name = nameof(view_allot_sign_emp.EmployeeName), States = 1, SumStatus = 0, Sort = 5 },
new cof_alias{ Alias = "职称", Name = nameof(view_allot_sign_emp.TitlePosition), States = 1, SumStatus = 0, Sort = 6 },
new cof_alias{ Alias = "批次", Name = nameof(view_allot_sign_emp.Batch), States = 1, SumStatus = 0, Sort = 7 },
new cof_alias{ Alias = "银行卡号", Name = nameof(view_allot_sign_emp.BankCard), States = 1, SumStatus = 0, Sort = 8 },
new cof_alias{ Alias = "正式/临聘", Name = nameof(view_allot_sign_emp.JobCategory), States = 1, SumStatus = 0, Sort = 9 },
new cof_alias{ Alias = "职务", Name = nameof(view_allot_sign_emp.Duty), States = 1, SumStatus = 0, Sort = 10 },
new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1, SumStatus = 1, Sort = 11 },
new cof_alias{ Alias = "调节后实发管理绩效", Name = nameof(view_allot_sign_emp.PerforManagementFee), States = 1, SumStatus = 1, Sort = 12 },
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_emp.AdjustLaterOtherFee), States = 1, SumStatus = 1, Sort = 13 },
new cof_alias{ Alias = "夜班费", Name = nameof(view_allot_sign_emp.NightWorkPerfor), States = 1, SumStatus = 1, Sort = 14 },
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_emp.OtherPerfor), States = 1, SumStatus = 1, Sort = 15 },
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_emp.HideOtherPerfor), States = 1, SumStatus = 1, Sort = 16 },
new cof_alias{ Alias = "应发小计", Name = nameof(view_allot_sign_emp.ShouldGiveFee), States = 1, SumStatus = 1, Sort = 17 },
new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1, SumStatus = 1, Sort = 18 },
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1, SumStatus = 1, Sort = 19 },
};
private static List<cof_alias> _allComputeViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputeViewByDate
{
get
{
if (_allComputeViewByDate == null || _allComputeViewByDate.Count == 0)
{
_allComputeViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1, SumStatus = 0 });
_allComputeViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1, SumStatus = 0 });
_allComputeViewByDate.AddRange(AllComputeView);
}
return _allComputeViewByDate;
}
}
public static List<cof_alias> AllComputePersonView { get; } = new List<cof_alias>
{
new cof_alias{ Alias = "核算组别", Name = nameof(view_allot_sign_emp.UnitType), States = 1, SumStatus = 0, Sort = 1 },
new cof_alias{ Alias = "核算单元编码", Name = nameof(view_allot_sign_emp.Code), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_emp.AccountingUnit), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "员工号", Name = nameof(view_allot_sign_emp.JobNumber), States = 1, SumStatus = 0, Sort = 3 },
new cof_alias{ Alias = "人员姓名", Name = nameof(view_allot_sign_emp.EmployeeName), States = 1, SumStatus = 0, Sort = 4 },
new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1, SumStatus = 1, Sort = 5 },
new cof_alias{ Alias = "调节后实发管理绩效", Name = nameof(view_allot_sign_emp.PerforManagementFee), States = 1, SumStatus = 1, Sort = 6 },
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_emp.AdjustLaterOtherFee), States = 1, SumStatus = 1, Sort = 7 },
new cof_alias{ Alias = "夜班费", Name = nameof(view_allot_sign_emp.NightWorkPerfor), States = 1, SumStatus = 1, Sort = 8 },
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_emp.OtherPerfor), States = 1, SumStatus = 1, Sort = 9 },
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_emp.HideOtherPerfor), States = 1, SumStatus = 1, Sort = 10 },
new cof_alias{ Alias = "应发小计", Name = nameof(view_allot_sign_emp.ShouldGiveFee), States = 1, SumStatus = 1, Sort = 11 },
new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1, SumStatus = 1, Sort = 12 },
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1, SumStatus = 1, Sort = 13 },
};
private static List<cof_alias> _allComputePersonViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputePersonViewByDate
{
get
{
if (_allComputePersonViewByDate == null || _allComputePersonViewByDate.Count == 0)
{
_allComputePersonViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1, SumStatus = 0 });
_allComputePersonViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1, SumStatus = 0 });
_allComputePersonViewByDate.AddRange(AllComputePersonView);
}
return _allComputePersonViewByDate;
}
}
public static List<cof_alias> AllComputeDepartmentView { get; } = new List<cof_alias>
{
new cof_alias{ Alias = "核算组别", Name = nameof(view_allot_sign_dept.UnitType), States = 1, SumStatus = 0, Sort = 1 },
new cof_alias{ Alias = "核算单元编码", Name = nameof(view_allot_sign_emp.Code), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_dept.AccountingUnit), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "业绩绩效", Name = nameof(view_allot_sign_dept.PerforFee), States = 1, SumStatus = 1, Sort = 3 },
new cof_alias{ Alias = "工作量绩效", Name = nameof(view_allot_sign_dept.WorkloadFee), States = 1, SumStatus = 1, Sort = 4 },
new cof_alias{ Alias = "考核前其他绩效", Name = nameof(view_allot_sign_dept.AssessBeforeOtherFee), States = 1, SumStatus = 1, Sort = 5 },
new cof_alias{ Alias = "考核前绩效合计", Name = nameof(view_allot_sign_dept.PerforTotal), States = 1, SumStatus = 1, Sort = 6 },
new cof_alias{ Alias = "科室考核得分", Name = nameof(view_allot_sign_dept.ScoringAverage), States = 1, SumStatus = 1, Sort = 7 },
new cof_alias{ Alias = "药占比奖罚", Name = nameof(view_allot_sign_dept.MedicineExtra), States = 1, SumStatus = 1, Sort = 8 },
new cof_alias{ Alias = "材料占比奖罚", Name = nameof(view_allot_sign_dept.MaterialsExtra), States = 1, SumStatus = 1, Sort = 9 },
new cof_alias{ Alias = "医院奖罚", Name = nameof(view_allot_sign_dept.Extra), States = 1, SumStatus = 1, Sort = 10 },
new cof_alias{ Alias = "考核后其他绩效", Name = nameof(view_allot_sign_dept.AssessLaterOtherFee), States = 1, SumStatus = 1, Sort = 11 },
new cof_alias{ Alias = "考核后绩效", Name = nameof(view_allot_sign_dept.AssessLaterPerforTotal), States = 1, SumStatus = 1, Sort = 12 },
new cof_alias{ Alias = "调节系数", Name = nameof(view_allot_sign_dept.AdjustFactor), States = 1, SumStatus = 1, Sort = 13 },
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_dept.AdjustLaterOtherFee), States = 1, SumStatus = 1, Sort = 14 },
new cof_alias{ Alias = "科主任实发管理绩效", Name = nameof(view_allot_sign_dept.AssessLaterManagementFee), States = 1, SumStatus = 1, Sort = 15 },
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_dept.AprPerforAmount), States = 1, SumStatus = 1, Sort = 16 },
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_dept.HideAprOtherPerforAmount), States = 1, SumStatus = 1, Sort = 17 },
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_dept.RealGiveFee), States = 1, SumStatus = 1, Sort = 18 },
};
private static List<cof_alias> _allComputeDepartmentViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputeDepartmentViewByDate
{
get
{
if (_allComputeDepartmentViewByDate == null || _allComputeDepartmentViewByDate.Count == 0)
{
_allComputeDepartmentViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1, SumStatus = 0 });
_allComputeDepartmentViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1, SumStatus = 0 });
_allComputeDepartmentViewByDate.AddRange(AllComputeDepartmentView);
}
return _allComputeDepartmentViewByDate;
}
}
public static List<cof_alias> GetAllPersonnelTags(bool ownerQuery)
{
var alias = new List<cof_alias>
{
new cof_alias{ Alias = "员工工号", Name = nameof(per_employee.PersonnelNumber), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "姓名", Name = nameof(per_employee.DoctorName), States = 1, SumStatus = 0, Sort = 4 },
new cof_alias{ Alias = "核算单元", Name = nameof(per_employee.AccountingUnit), States = 1, SumStatus = 0, Sort = 6 },
new cof_alias{ Alias = "正式/临聘", Name = nameof(per_employee.JobCategory), States = 1, SumStatus = 0, Sort = 8 },
new cof_alias{ Alias = "职务", Name = nameof(per_employee.Duty), States = 1, SumStatus = 0, Sort = 10 },
new cof_alias{ Alias = "职称", Name = nameof(per_employee.JobTitle), States = 1, SumStatus = 0, Sort = 12 },
new cof_alias{ Alias = "出勤天数", Name = nameof(per_employee.AttendanceDay), States = 1, SumStatus = 0, Sort = 14 },
new cof_alias{ Alias = "预留比例", Name = nameof(per_employee.ReservedRatio), States = 1, SumStatus = 0, Sort = 16 },
new cof_alias{ Alias = "银行卡号", Name = nameof(per_employee.BankCard), States = 1, SumStatus = 0, Sort = 18 },
new cof_alias{ Alias = "备用01", Name = nameof(per_employee.Reserve01), States = 0, SumStatus = 0, Sort = 20 },
new cof_alias{ Alias = "备用02", Name = nameof(per_employee.Reserve02), States = 0, SumStatus = 0, Sort = 20 },
new cof_alias{ Alias = "备用03", Name = nameof(per_employee.Reserve03), States = 0, SumStatus = 0, Sort = 20 },
new cof_alias{ Alias = "备用04", Name = nameof(per_employee.Reserve04), States = 0, SumStatus = 0, Sort = 20 },
new cof_alias{ Alias = "备用05", Name = nameof(per_employee.Reserve05), States = 0, SumStatus = 0, Sort = 20 },
new cof_alias{ Alias = "备用06", Name = nameof(per_employee.Reserve06), States = 0, SumStatus = 0, Sort = 20 },
new cof_alias{ Alias = "备用07", Name = nameof(per_employee.Reserve07), States = 0, SumStatus = 0, Sort = 20 },
new cof_alias{ Alias = "备用08", Name = nameof(per_employee.Reserve08), States = 0, SumStatus = 0, Sort = 20 },
new cof_alias{ Alias = "备用09", Name = nameof(per_employee.Reserve09), States = 0, SumStatus = 0, Sort = 20 },
new cof_alias{ Alias = "备用10", Name = nameof(per_employee.Reserve10), States = 0, SumStatus = 0, Sort = 20 },
new cof_alias{ Alias = "核算组别", Name = nameof(report_performance_person_tags.UnitType), States = 1, SumStatus = 0, Sort = 99 },
new cof_alias{ Alias = "绩效发放情况", Name = nameof(report_performance_person_tags.Tag1), States = 1, SumStatus = 0, Sort = 100 },
new cof_alias{ Alias = "当月绩效权重", Name = nameof(report_performance_person_tags.Tag2), States = 1, SumStatus = 0, Sort = 101 },
new cof_alias{ Alias = "重点群体对比1", Name = nameof(report_performance_person_tags.Tag3), States = 1, SumStatus = 0, Sort = 102 },
new cof_alias{ Alias = "重点群体对比2", Name = nameof(report_performance_person_tags.Tag4), States = 1, SumStatus = 0, Sort = 103 },
new cof_alias{ Alias = "重点群体对比5", Name = nameof(report_performance_person_tags.Tag5), States = 1, SumStatus = 0, Sort = 104 },
};
if (ownerQuery)
alias.Add(new cof_alias { Alias = "密码", Name = "Password", States = 1, SumStatus = 0, Sort = 7 });
return alias.OrderBy(w => w.Sort).ToList();
}
}
}
...@@ -2024,13 +2024,15 @@ public bool UpdateHeadersStatus(ComputerAliasUpdate request) ...@@ -2024,13 +2024,15 @@ public bool UpdateHeadersStatus(ComputerAliasUpdate request)
var data = heads.Select(t => new cof_alias var data = heads.Select(t => new cof_alias
{ {
Route = request.Route, Route = request.Route,
Alias = t.Alias, Alias = request.computerAliasHead.FirstOrDefault(w => w.Name == t.Name)?.Head ?? t.Alias,
OriginalName = t.Alias, OriginalName = t.Alias,
HospitalId = request.HospitalId, HospitalId = request.HospitalId,
Name = t.Name, Name = t.Name,
States = items.Contains(t.Alias ?? "") ? 1 : 0, States = items.Contains(t.Alias ?? "") ? 1 : 0,
SumStatus = t.SumStatus, SumStatus = t.SumStatus,
Sort = request.computerAliasHead.FirstOrDefault(w => w.Head == t.Alias).Sort Sort = request.computerAliasHead.Any(w => w.Name == t.Name)
? request.computerAliasHead.FirstOrDefault(w => w.Name == t.Name).Sort
: t.Sort
}); });
cofaliasRepository.AddRange(data.ToArray()); cofaliasRepository.AddRange(data.ToArray());
} }
...@@ -2094,6 +2096,11 @@ public bool UpdateHeadersStatus(ComputerAliasUpdate request) ...@@ -2094,6 +2096,11 @@ public bool UpdateHeadersStatus(ComputerAliasUpdate request)
/// <returns></returns> /// <returns></returns>
public List<cof_alias> CustomColumnHeaders(int hospitalId, string route, params string[] heads) public List<cof_alias> CustomColumnHeaders(int hospitalId, string route, params string[] heads)
{ {
var hos = hospitalRepository.GetEntity(w => w.ID == hospitalId);
return CustomColumnHeaders(hos, route, heads);
}
public List<cof_alias> CustomColumnHeaders(sys_hospital hos, string route, params string[] heads)
{
var pairs = new Dictionary<string, List<cof_alias>> var pairs = new Dictionary<string, List<cof_alias>>
{ {
{ "/result/compute" , ComputeConfig.AllComputeView }, { "/result/compute" , ComputeConfig.AllComputeView },
...@@ -2108,10 +2115,14 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route, params ...@@ -2108,10 +2115,14 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route, params
{ "/report/wholehospital_accounting_grant_summary" , ComputeConfig.PerformanceTotal(route,heads) }, { "/report/wholehospital_accounting_grant_summary" , ComputeConfig.PerformanceTotal(route,heads) },
{ "/report/wholehospital_finance_grant_summary" , ComputeConfig.PerformanceTotal(route,heads) }, { "/report/wholehospital_finance_grant_summary" , ComputeConfig.PerformanceTotal(route,heads) },
{ "/result/all_employee" , ComputeConfig.GetAllPersonnelTags(hos?.IsOwnerQuery == 1) },
}; };
var init = pairs.ContainsKey(route.ToLower()) ? pairs[route.ToLower()] : new List<cof_alias>(); var init = pairs.ContainsKey(route.ToLower()) ? pairs[route.ToLower()] : new List<cof_alias>();
var alias = cofaliasRepository.GetEntities(t => t.HospitalId == hospitalId && t.Route.Equals(route, StringComparison.OrdinalIgnoreCase))?.OrderBy(w => w.Sort).ToList() if (hos == null)
return init;
var alias = cofaliasRepository.GetEntities(t => t.HospitalId == hos.ID && t.Route.Equals(route, StringComparison.OrdinalIgnoreCase))?.OrderBy(w => w.Sort).ToList()
?? new List<cof_alias>(); ?? new List<cof_alias>();
if (alias == null || !alias.Any()) return init; if (alias == null || !alias.Any()) return init;
...@@ -2126,7 +2137,7 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route, params ...@@ -2126,7 +2137,7 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route, params
else else
{ {
x.Id = item.Id; x.Id = item.Id;
x.HospitalId = hospitalId; x.HospitalId = hos.ID;
x.Route = route; x.Route = route;
x.OriginalName = item.OriginalName; x.OriginalName = item.OriginalName;
x.Alias = item.Alias; x.Alias = item.Alias;
...@@ -2139,30 +2150,116 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route, params ...@@ -2139,30 +2150,116 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route, params
return init?.OrderBy(t => t.Sort).ToList(); return init?.OrderBy(t => t.Sort).ToList();
} }
public bool Batch(BatchRequest request) #region 标记批次号
/// <summary>
/// 标记批次号
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
/// <exception cref="PerformanceException"></exception>
public ApiResponse Batch(BatchRequest request)
{ {
if (request == null || request.Details == null || !request.Details.Any()) if (request == null || request.Details == null || !request.Details.Any())
throw new PerformanceException("参数错误"); throw new PerformanceException("提交了空白的人员信息,当前操作已拒绝");
if (string.IsNullOrEmpty(request.Batch))
throw new PerformanceException("“批次信息”空白,当前操作已拒绝");
if (request.Details.Any(t => !string.IsNullOrEmpty(t.Batch))) var batchs = perforPerbatchRepository.GetEntities(w => w.AllotId == request.AllotId) ?? new List<per_batch>();
throw new PerformanceException("包含已标记数据"); List<Dictionary<string, string>> error = new List<Dictionary<string, string>>();
foreach (var item in request.Details)
{
var bt = batchs.FirstOrDefault(w => !string.IsNullOrEmpty(w.Batch) && w.UnitType == item.UnitType && w.AccountingUnit == item.AccountingUnit && w.PersonnelNumber == item.JobNumber);
if (bt != null)
{
error.Add(new Dictionary<string, string>
{
{ "核算组别", item.UnitType??"" },
{ "核算单元", item.AccountingUnit??"" },
{ "人员工号", item.JobNumber??"" },
{ "姓名", item.EmployeeName??"" },
{ "错误原因",$"已经标记;请取消标记后重试;批次“{bt.Batch}”" },
});
}
if (string.IsNullOrEmpty(item.UnitType) || string.IsNullOrEmpty(item.AccountingUnit) || string.IsNullOrEmpty(item.JobNumber))
{
error.Add(new Dictionary<string, string>
{
{ "核算组别", item.UnitType??"" },
{ "核算单元", item.AccountingUnit??"" },
{ "人员工号", item.JobNumber??"" },
{ "姓名", item.EmployeeName??"" },
{ "错误原因",$"关键信息缺失" },
});
}
}
if (error.Count > 0)
return new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", error);
DateTime dateTime = DateTime.Now;
string batch = DateTime.Now.ToString("yyyyMMddfff");
var data = request.Details.Select(t => new per_batch var data = request.Details.Select(t => new per_batch
{ {
HospitalId = request.HospitalId, HospitalId = request.HospitalId,
AllotId = request.AllotId, AllotId = request.AllotId,
Batch = batch, Batch = request.Batch,
BatchDate = dateTime, BatchDate = request.BatchDate ?? DateTime.Now,
BankName = request.BankName,
UnitType = t.UnitType, UnitType = t.UnitType,
AccountingUnit = t.AccountingUnit, AccountingUnit = t.AccountingUnit,
PersonnelNumber = t.JobNumber, PersonnelNumber = t.JobNumber,
PersonnelName = t.EmployeeName PersonnelName = t.EmployeeName
}); });
return perforPerbatchRepository.AddRange(data.ToArray()); perforPerbatchRepository.AddRange(data.ToArray());
return new ApiResponse(ResponseType.OK, "标记成功");
} }
/// <summary>
/// 取消标记
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
/// <exception cref="PerformanceException"></exception>
public ApiResponse BatchCancel(BatchCancelRequest request)
{
if (request == null || request.Details == null || !request.Details.Any())
throw new PerformanceException("提交了空白的人员信息,当前操作已拒绝");
List<Dictionary<string, string>> error = new List<Dictionary<string, string>>();
var batchs = perforPerbatchRepository.GetEntities(w => w.AllotId == request.AllotId) ?? new List<per_batch>();
var deletes = new List<per_batch>();
foreach (var item in request.Details)
{
if (string.IsNullOrEmpty(item.UnitType) || string.IsNullOrEmpty(item.AccountingUnit) || string.IsNullOrEmpty(item.JobNumber))
{
error.Add(new Dictionary<string, string>
{
{ "核算组别", item.UnitType??"" },
{ "核算单元", item.AccountingUnit??"" },
{ "人员工号", item.JobNumber??"" },
{ "姓名", item.EmployeeName??"" },
{ "错误原因",$"关键信息缺失" },
});
}
var bt = batchs.FirstOrDefault(w => w.UnitType == item.UnitType && w.AccountingUnit == item.AccountingUnit && w.PersonnelNumber == item.JobNumber);
if (bt != null)
{
deletes.Add(bt);
}
}
if (error.Count > 0)
return new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", error);
if (deletes.Count > 0)
perforPerbatchRepository.RemoveRange(deletes.ToArray());
return new ApiResponse(ResponseType.OK, "取消标记操作成功");
}
#endregion
public List<dynamic> GetAllComputeView(int hospitalId, int AllotId, string viewName) public List<dynamic> GetAllComputeView(int hospitalId, int AllotId, string viewName)
{ {
return reportRepository.QueryCompute(AllotId, viewName); return reportRepository.QueryCompute(AllotId, viewName);
...@@ -2244,143 +2341,4 @@ public QueryComputeByDateGetPage GetPerformanceSummary(HospitalGrantSummary requ ...@@ -2244,143 +2341,4 @@ public QueryComputeByDateGetPage GetPerformanceSummary(HospitalGrantSummary requ
return pairs; return pairs;
} }
} }
public class ComputeConfig
{
public static List<cof_alias> PerformanceTotal(string route, string[] heads)
{
if (heads == null || heads.Length == 0 || (heads.Length > 0 && heads[0] == ""))
{
if (route == "/report/wholehospital_grant_summary")
return AllComputeView.ToList();
if (route == "/report/wholehospital_accounting_grant_summary")
return AllComputeDepartmentView.ToList();
if (route == "/report/wholehospital_finance_grant_summary")
return AllComputePersonView.ToList();
}
if (route == "/report/wholehospital_grant_summary")
return AllComputeView.Where(t => heads.Contains(t.Name.ToLower())).ToList();
if (route == "/report/wholehospital_accounting_grant_summary")
return AllComputeDepartmentView.Where(t => heads.Contains(t.Name.ToLower())).ToList();
if (route == "/report/wholehospital_finance_grant_summary")
return AllComputePersonView.Where(t => heads.Contains(t.Name.ToLower())).ToList();
return null;
}
public static List<cof_alias> AllComputeView { get; } = new List<cof_alias>
{
new cof_alias{ Alias = "来源", Name = nameof(view_allot_sign_emp.Source), States = 1, SumStatus = 0, Sort = 1 },
new cof_alias{ Alias = "核算组别", Name = nameof(view_allot_sign_emp.UnitType), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "核算单元编码", Name = nameof(view_allot_sign_emp.Code), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_emp.AccountingUnit), States = 1, SumStatus = 0, Sort = 3 },
new cof_alias{ Alias = "员工号", Name = nameof(view_allot_sign_emp.JobNumber), States = 1, SumStatus = 0, Sort = 4 },
new cof_alias{ Alias = "人员姓名", Name = nameof(view_allot_sign_emp.EmployeeName), States = 1, SumStatus = 0, Sort = 5 },
new cof_alias{ Alias = "职称", Name = nameof(view_allot_sign_emp.TitlePosition), States = 1, SumStatus = 0, Sort = 6 },
new cof_alias{ Alias = "批次", Name = nameof(view_allot_sign_emp.Batch), States = 1, SumStatus = 0, Sort = 7 },
new cof_alias{ Alias = "银行卡号", Name = nameof(view_allot_sign_emp.BankCard), States = 1, SumStatus = 0, Sort = 8 },
new cof_alias{ Alias = "正式/临聘", Name = nameof(view_allot_sign_emp.JobCategory), States = 1, SumStatus = 0, Sort = 9 },
new cof_alias{ Alias = "职务", Name = nameof(view_allot_sign_emp.Duty), States = 1, SumStatus = 0, Sort = 10 },
new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1, SumStatus = 1, Sort = 11 },
new cof_alias{ Alias = "调节后实发管理绩效", Name = nameof(view_allot_sign_emp.PerforManagementFee), States = 1, SumStatus = 1, Sort = 12 },
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_emp.AdjustLaterOtherFee), States = 1, SumStatus = 1, Sort = 13 },
new cof_alias{ Alias = "夜班费", Name = nameof(view_allot_sign_emp.NightWorkPerfor), States = 1, SumStatus = 1, Sort = 14 },
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_emp.OtherPerfor), States = 1, SumStatus = 1, Sort = 15 },
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_emp.HideOtherPerfor), States = 1, SumStatus = 1, Sort = 16 },
new cof_alias{ Alias = "应发小计", Name = nameof(view_allot_sign_emp.ShouldGiveFee), States = 1, SumStatus = 1, Sort = 17 },
new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1, SumStatus = 1, Sort = 18 },
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1, SumStatus = 1, Sort = 19 },
};
private static List<cof_alias> _allComputeViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputeViewByDate
{
get
{
if (_allComputeViewByDate == null || _allComputeViewByDate.Count == 0)
{
_allComputeViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1, SumStatus = 0 });
_allComputeViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1, SumStatus = 0 });
_allComputeViewByDate.AddRange(AllComputeView);
}
return _allComputeViewByDate;
}
}
public static List<cof_alias> AllComputePersonView { get; } = new List<cof_alias>
{
new cof_alias{ Alias = "核算组别", Name = nameof(view_allot_sign_emp.UnitType), States = 1, SumStatus = 0, Sort = 1 },
new cof_alias{ Alias = "核算单元编码", Name = nameof(view_allot_sign_emp.Code), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_emp.AccountingUnit), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "员工号", Name = nameof(view_allot_sign_emp.JobNumber), States = 1, SumStatus = 0, Sort = 3 },
new cof_alias{ Alias = "人员姓名", Name = nameof(view_allot_sign_emp.EmployeeName), States = 1, SumStatus = 0, Sort = 4 },
new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1, SumStatus = 1, Sort = 5 },
new cof_alias{ Alias = "调节后实发管理绩效", Name = nameof(view_allot_sign_emp.PerforManagementFee), States = 1, SumStatus = 1, Sort = 6 },
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_emp.AdjustLaterOtherFee), States = 1, SumStatus = 1, Sort = 7 },
new cof_alias{ Alias = "夜班费", Name = nameof(view_allot_sign_emp.NightWorkPerfor), States = 1, SumStatus = 1, Sort = 8 },
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_emp.OtherPerfor), States = 1, SumStatus = 1, Sort = 9 },
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_emp.HideOtherPerfor), States = 1, SumStatus = 1, Sort = 10 },
new cof_alias{ Alias = "应发小计", Name = nameof(view_allot_sign_emp.ShouldGiveFee), States = 1, SumStatus = 1, Sort = 11 },
new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1, SumStatus = 1, Sort = 12 },
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1, SumStatus = 1, Sort = 13 },
};
private static List<cof_alias> _allComputePersonViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputePersonViewByDate
{
get
{
if (_allComputePersonViewByDate == null || _allComputePersonViewByDate.Count == 0)
{
_allComputePersonViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1, SumStatus = 0 });
_allComputePersonViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1, SumStatus = 0 });
_allComputePersonViewByDate.AddRange(AllComputePersonView);
}
return _allComputePersonViewByDate;
}
}
public static List<cof_alias> AllComputeDepartmentView { get; } = new List<cof_alias>
{
new cof_alias{ Alias = "核算组别", Name = nameof(view_allot_sign_dept.UnitType), States = 1, SumStatus = 0, Sort = 1 },
new cof_alias{ Alias = "核算单元编码", Name = nameof(view_allot_sign_emp.Code), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_dept.AccountingUnit), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "业绩绩效", Name = nameof(view_allot_sign_dept.PerforFee), States = 1, SumStatus = 1, Sort = 3 },
new cof_alias{ Alias = "工作量绩效", Name = nameof(view_allot_sign_dept.WorkloadFee), States = 1, SumStatus = 1, Sort = 4 },
new cof_alias{ Alias = "考核前其他绩效", Name = nameof(view_allot_sign_dept.AssessBeforeOtherFee), States = 1, SumStatus = 1, Sort = 5 },
new cof_alias{ Alias = "考核前绩效合计", Name = nameof(view_allot_sign_dept.PerforTotal), States = 1, SumStatus = 1, Sort = 6 },
new cof_alias{ Alias = "科室考核得分", Name = nameof(view_allot_sign_dept.ScoringAverage), States = 1, SumStatus = 1, Sort = 7 },
new cof_alias{ Alias = "药占比奖罚", Name = nameof(view_allot_sign_dept.MedicineExtra), States = 1, SumStatus = 1, Sort = 8 },
new cof_alias{ Alias = "材料占比奖罚", Name = nameof(view_allot_sign_dept.MaterialsExtra), States = 1, SumStatus = 1, Sort = 9 },
new cof_alias{ Alias = "医院奖罚", Name = nameof(view_allot_sign_dept.Extra), States = 1, SumStatus = 1, Sort = 10 },
new cof_alias{ Alias = "考核后其他绩效", Name = nameof(view_allot_sign_dept.AssessLaterOtherFee), States = 1, SumStatus = 1, Sort = 11 },
new cof_alias{ Alias = "考核后绩效", Name = nameof(view_allot_sign_dept.AssessLaterPerforTotal), States = 1, SumStatus = 1, Sort = 12 },
new cof_alias{ Alias = "调节系数", Name = nameof(view_allot_sign_dept.AdjustFactor), States = 1, SumStatus = 1, Sort = 13 },
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_dept.AdjustLaterOtherFee), States = 1, SumStatus = 1, Sort = 14 },
new cof_alias{ Alias = "科主任实发管理绩效", Name = nameof(view_allot_sign_dept.AssessLaterManagementFee), States = 1, SumStatus = 1, Sort = 15 },
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_dept.AprPerforAmount), States = 1, SumStatus = 1, Sort = 16 },
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_dept.HideAprOtherPerforAmount), States = 1, SumStatus = 1, Sort = 17 },
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_dept.RealGiveFee), States = 1, SumStatus = 1, Sort = 18 },
};
private static List<cof_alias> _allComputeDepartmentViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputeDepartmentViewByDate
{
get
{
if (_allComputeDepartmentViewByDate == null || _allComputeDepartmentViewByDate.Count == 0)
{
_allComputeDepartmentViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1, SumStatus = 0 });
_allComputeDepartmentViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1, SumStatus = 0 });
_allComputeDepartmentViewByDate.AddRange(AllComputeDepartmentView);
}
return _allComputeDepartmentViewByDate;
}
}
}
} }
...@@ -434,7 +434,8 @@ public List<per_apr_amount> GetAprList(int allotId, int userId) ...@@ -434,7 +434,8 @@ public List<per_apr_amount> GetAprList(int allotId, int userId)
if (userrole == null) throw new PerformanceException("用户未绑定角色"); if (userrole == null) throw new PerformanceException("用户未绑定角色");
var list = new List<per_apr_amount>(); var list = new List<per_apr_amount>();
if (new int[] { 1, 2, 5, 6 }.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办、院领导查看所有科室的数据 var roles = new int[] { (int)Role.绩效管理员, (int)Role.医院管理员, (int)Role.绩效核算办, (int)Role.院领导, (int)Role.审计 };
if (roles.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办、院领导查看所有科室的数据
list = perapramountRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0); list = perapramountRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0);
else else
list = perapramountRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0 && t.CreateUser == userId); list = perapramountRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0 && t.CreateUser == userId);
...@@ -582,6 +583,28 @@ public ApiResponse ConfirmAudit(int userid, AprAmountAuditRequest request) ...@@ -582,6 +583,28 @@ public ApiResponse ConfirmAudit(int userid, AprAmountAuditRequest request)
} }
return new ApiResponse(ResponseType.OK, ""); return new ApiResponse(ResponseType.OK, "");
} }
/// <summary>
/// 医院其他绩效审计
/// </summary>
/// <param name="userid"></param>
/// <param name="request"></param>
/// <returns></returns>
public ApiResponse AprMark(int userid, AprAmountMarkRequest request)
{
List<Dictionary<string, string>> error = new List<Dictionary<string, string>>();
if (request?.TypeInDepartments == null || !request.TypeInDepartments.Any())
throw new PerformanceException("审计信息无效,请确认");
var allApramounts = perapramountRepository.GetEntities(t => t.AllotId == request.AllotId);
foreach (var department in request.TypeInDepartments)
{
string update = "update per_apr_amount set MarkStatus=@MarkStatus,MarkUser=@MarkUser,MarkTime=@MarkTime where TypeInDepartment=@TypeInDepartment and AllotId=@AllotId; ";
perapramountRepository.Execute(update, new { MarkStatus = 1, MarkUser = userid, MarkTime = DateTime.Now, TypeInDepartment = department, request.AllotId });
}
return new ApiResponse(ResponseType.OK, "");
}
/// <summary> /// <summary>
/// 上传导入医院其他绩效 /// 上传导入医院其他绩效
/// </summary> /// </summary>
...@@ -594,7 +617,8 @@ public string ImpoerAprEmployees(int allotid, string path, int userid) ...@@ -594,7 +617,8 @@ public string ImpoerAprEmployees(int allotid, string path, int userid)
if (userrole == null) throw new PerformanceException("用户未绑定角色"); if (userrole == null) throw new PerformanceException("用户未绑定角色");
var data = new List<per_apr_amount>(); var data = new List<per_apr_amount>();
if (new int[] { 1, 2, 5 }.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办查看所有科室的数据 var roles = new int[] { (int)Role.绩效管理员, (int)Role.医院管理员, (int)Role.绩效核算办, (int)Role.院领导, (int)Role.审计 };
if (roles.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办查看所有科室的数据
data = perapramountRepository.GetEntities(t => t.AllotId == allotid && (t.Amount ?? 0) != 0); data = perapramountRepository.GetEntities(t => t.AllotId == allotid && (t.Amount ?? 0) != 0);
else else
data = perapramountRepository.GetEntities(t => t.AllotId == allotid && (t.Amount ?? 0) != 0 && t.CreateUser == userid); data = perapramountRepository.GetEntities(t => t.AllotId == allotid && (t.Amount ?? 0) != 0 && t.CreateUser == userid);
...@@ -862,7 +886,9 @@ public List<per_apr_amount_hide> GetAprHideList(int allotId, int userId) ...@@ -862,7 +886,9 @@ public List<per_apr_amount_hide> GetAprHideList(int allotId, int userId)
if (userrole == null) throw new PerformanceException("用户未绑定角色"); if (userrole == null) throw new PerformanceException("用户未绑定角色");
var list = new List<per_apr_amount_hide>(); var list = new List<per_apr_amount_hide>();
if (new int[] { 1, 2, 5, 6 }.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办、院领导查看所有科室的数据
var roles = new int[] { (int)Role.绩效管理员, (int)Role.医院管理员, (int)Role.绩效核算办, (int)Role.院领导, (int)Role.审计 };
if (roles.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办查看所有科室的数据
list = _hideRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0); list = _hideRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0);
else else
list = _hideRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0 && t.CreateUser == userId); list = _hideRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0 && t.CreateUser == userId);
...@@ -1007,6 +1033,26 @@ public ApiResponse ConfirmAuditHide(int userid, AprAmountAuditRequest request) ...@@ -1007,6 +1033,26 @@ public ApiResponse ConfirmAuditHide(int userid, AprAmountAuditRequest request)
} }
return new ApiResponse(ResponseType.OK, ""); return new ApiResponse(ResponseType.OK, "");
} }
/// <summary>
/// 不公示其他绩效审计
/// </summary>
/// <param name="userid"></param>
/// <param name="request"></param>
/// <returns></returns>
public ApiResponse AprMarkHide(int userid, AprAmountMarkRequest request)
{
List<Dictionary<string, string>> error = new List<Dictionary<string, string>>();
if (request?.TypeInDepartments == null || !request.TypeInDepartments.Any())
throw new PerformanceException("审计信息无效,请确认");
foreach (var department in request.TypeInDepartments)
{
string update = "update per_apr_amount_hide set MarkStatus=@MarkStatus,MarkUser=@MarkUser,MarkTime=@MarkTime where TypeInDepartment=@TypeInDepartment and AllotId=@AllotId; ";
_hideRepository.Execute(update, new { MarkStatus = 1, MarkUser = userid, MarkTime = DateTime.Now, TypeInDepartment = department, request.AllotId });
}
return new ApiResponse(ResponseType.OK, "");
}
/// <summary> /// <summary>
/// 上传导入医院其他绩效 /// 上传导入医院其他绩效
...@@ -1020,7 +1066,8 @@ public void ImpoerAprHideEmployees(int allotid, string path, int userid) ...@@ -1020,7 +1066,8 @@ public void ImpoerAprHideEmployees(int allotid, string path, int userid)
if (userrole == null) throw new PerformanceException("用户未绑定角色"); if (userrole == null) throw new PerformanceException("用户未绑定角色");
var data = new List<per_apr_amount_hide>(); var data = new List<per_apr_amount_hide>();
if (new int[] { 1, 2, 5 }.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办查看所有科室的数据 var roles = new int[] { (int)Role.绩效管理员, (int)Role.医院管理员, (int)Role.绩效核算办, (int)Role.院领导, (int)Role.审计 };
if (roles.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办查看所有科室的数据
data = _hideRepository.GetEntities(t => t.AllotId == allotid && (t.Amount ?? 0) != 0); data = _hideRepository.GetEntities(t => t.AllotId == allotid && (t.Amount ?? 0) != 0);
else else
data = _hideRepository.GetEntities(t => t.AllotId == allotid && (t.Amount ?? 0) != 0 && t.CreateUser == userid); data = _hideRepository.GetEntities(t => t.AllotId == allotid && (t.Amount ?? 0) != 0 && t.CreateUser == userid);
......
...@@ -322,13 +322,13 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List< ...@@ -322,13 +322,13 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List<
DoctorName = item.DoctorName, DoctorName = item.DoctorName,
PersonnelNumber = item.PersonnelNumber, PersonnelNumber = item.PersonnelNumber,
Value = item.Fee ?? 0, Value = item.Fee ?? 0,
OutDoctorAccounting = firstDic?.OutDoctorAccounting?.AccountingUnit, OutDoctorAccounting = firstDic?.OutDoctorAccounting,
OutNurseAccounting = firstDic?.OutNurseAccounting?.AccountingUnit, OutNurseAccounting = firstDic?.OutNurseAccounting,
OutTechnicAccounting = firstDic?.OutTechnicAccounting?.AccountingUnit, OutTechnicAccounting = firstDic?.OutTechnicAccounting,
InpatDoctorAccounting = firstDic?.InpatDoctorAccounting?.AccountingUnit, InpatDoctorAccounting = firstDic?.InpatDoctorAccounting,
InpatNurseAccounting = firstDic?.InpatNurseAccounting?.AccountingUnit, InpatNurseAccounting = firstDic?.InpatNurseAccounting,
InpatTechnicAccounting = firstDic?.InpatTechnicAccounting?.AccountingUnit, InpatTechnicAccounting = firstDic?.InpatTechnicAccounting,
SpecialAccounting = firstDic?.SpecialAccounting?.AccountingUnit ?? dept, SpecialAccounting = firstDic?.SpecialAccounting ?? dept,
EName = types.FirstOrDefault(w => w.Id == item.TypeId)?.EName, EName = types.FirstOrDefault(w => w.Id == item.TypeId)?.EName,
}; };
data.Add(d); data.Add(d);
......
...@@ -37,7 +37,7 @@ public class RecognitionDataFormat ...@@ -37,7 +37,7 @@ public class RecognitionDataFormat
{ DataFormat.百分比, new[] { 9,10 } }, { DataFormat.百分比, new[] { 9,10 } },
{ DataFormat.科学计数, new[] { 11 } }, { DataFormat.科学计数, new[] { 11 } },
{ DataFormat.分数, new[] { 12,13 } }, { DataFormat.分数, new[] { 12,13 } },
{ DataFormat.日期, new[] { 14,15,16,17 } }, { DataFormat.日期YYYYMMDD, new[] { 14,15,16,17 } },
}; };
public static DataFormat GetDataFormat(short type) public static DataFormat GetDataFormat(short type)
......
...@@ -322,7 +322,7 @@ public ApiResponse UpdatePerson(PerEmployeeResponse request) ...@@ -322,7 +322,7 @@ public ApiResponse UpdatePerson(PerEmployeeResponse request)
throw new PerformanceException($"“关键信息缺失”请补全!"); throw new PerformanceException($"“关键信息缺失”请补全!");
} }
var employees = peremployeeRepository.GetEntities(t => t.AllotId == request.AllotId && t.PersonnelNumber == request.PersonnelNumber); var employees = peremployeeRepository.GetEntities(t => t.AllotId == request.AllotId && t.Id == request.Id);
if (employees == null) if (employees == null)
throw new PerformanceException($"员工工号为“{request.PersonnelNumber}”不存在,请重新添加!"); throw new PerformanceException($"员工工号为“{request.PersonnelNumber}”不存在,请重新添加!");
...@@ -426,22 +426,38 @@ public IEnumerable<DeptdicResponse> GetDepartments(int hospitalId) ...@@ -426,22 +426,38 @@ public IEnumerable<DeptdicResponse> GetDepartments(int hospitalId)
var depts = perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId); var depts = perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId);
if (depts == null || !depts.Any()) return null; if (depts == null || !depts.Any()) return null;
var result = depts.GroupBy(t => new { t.HISDeptName, t.Department }).Select(t => new DeptdicResponse string GetDeptdic(List<per_dept_dic> dics, string department, string hISDeptName, UnitType unitType, string source = "")
{ {
HospitalId = hospitalId, if (hISDeptName == "介入室")
HISDeptName = t.Key.HISDeptName, {
Department = t.Key.Department,
OutDoctorAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.医生组.ToString() && group.Source == "门诊")), }
OutNurseAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.护理组.ToString() && group.Source == "门诊")), var dic = dics.FirstOrDefault(group => group.Department == department && group.HISDeptName == hISDeptName && group.UnitType == unitType.ToString() && group.Source == source);
OutTechnicAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.医技组.ToString() && group.Source == "门诊")),
InpatDoctorAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.医生组.ToString() && group.Source == "住院")), if (dic == null)
InpatNurseAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.护理组.ToString() && group.Source == "住院")), dic = dics.FirstOrDefault(group => group.Department == department && group.HISDeptName == hISDeptName && group.UnitType == unitType.ToString());
InpatTechnicAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.医技组.ToString() && group.Source == "住院")),
LogisticsAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.行政后勤.ToString())), return dic?.AccountingUnit;
SpecialAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.特殊核算组.ToString())), }
CreateTime = t.Max(group => group.CreateTime),
IsVerify = t.Min(w => w.IsVerify) ?? 1, var result = depts
}); .GroupBy(t => new { t.HISDeptName, t.Department })
.Select(t => new DeptdicResponse
{
HospitalId = hospitalId,
HISDeptName = t.Key.HISDeptName,
Department = t.Key.Department,
OutDoctorAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医生组, "门诊"),
OutNurseAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.护理组, "门诊"),
OutTechnicAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医技组, "门诊"),
InpatDoctorAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医生组, "住院"),
InpatNurseAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.护理组, "住院"),
InpatTechnicAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医技组, "住院"),
LogisticsAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.行政后勤),
SpecialAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.特殊核算组),
CreateTime = t.Max(group => group.CreateTime),
IsVerify = t.Min(w => w.IsVerify) ?? 1,
});
return result.OrderBy(w => w.IsVerify).ThenByDescending(t => t.CreateTime).ThenBy(t => t.Department); return result.OrderBy(w => w.IsVerify).ThenByDescending(t => t.CreateTime).ThenBy(t => t.Department);
} }
...@@ -472,19 +488,6 @@ public IEnumerable<DeptdicResponse> GetDepartments(int hospitalId) ...@@ -472,19 +488,6 @@ public IEnumerable<DeptdicResponse> GetDepartments(int hospitalId)
return ("", new string[] { }); return ("", new string[] { });
} }
private Deptdic GetDeptdic(per_dept_dic dic)
{
if (dic == null) return new Deptdic() { IsVerify = 1 };
return new Deptdic
{
Id = dic.Id,
AccountingUnit = dic.AccountingUnit,
IsVerify = dic.IsVerify ?? 1,
VerifyMessage = dic.VerifyMessage,
};
}
/// <summary> /// <summary>
/// 创建科室核算信息 /// 创建科室核算信息
/// </summary> /// </summary>
...@@ -718,17 +721,8 @@ private string[] GetUnitType(int userId) ...@@ -718,17 +721,8 @@ private string[] GetUnitType(int userId)
public HandsonTable GetBatchPersonStructrue(int hospitalId) public HandsonTable GetBatchPersonStructrue(int hospitalId)
{ {
var hos = perforHospitalRepository.GetEntity(t => t.ID == hospitalId); var cols = Person.Select(t => t.Item2).ToArray();
var cols = hos.IsOwnerQuery == 1 ? PersonPassword.Select(t => t.Item2).ToArray() : Person.Select(t => t.Item2).ToArray(); var permissions = Person.Select(t => new collect_permission { HeadName = t.Item2, Visible = 1 }).ToList();
var permissions = hos.IsOwnerQuery == 1 ? PersonPassword.Select(t => new collect_permission
{
HeadName = t.Item2,
Visible = 1
}).ToList() : Person.Select(t => new collect_permission
{
HeadName = t.Item2,
Visible = 1
}).ToList();
var result = new HandsonTable((int)SheetType.Unidentifiable, cols, permissions); var result = new HandsonTable((int)SheetType.Unidentifiable, cols, permissions);
var deptdics = perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId); var deptdics = perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId);
...@@ -1073,23 +1067,6 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan ...@@ -1073,23 +1067,6 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan
return result; return result;
} }
public static List<(string, string, Func<PersonePassword, object>)> PersonPassword { get; } = new List<(string, string, Func<PersonePassword, object>)>
{
(nameof(PersonePassword.UnitType), "核算组别", t => t.UnitType),
(nameof(PersonePassword.AccountingUnit), "核算单元", t => t.AccountingUnit),
(nameof(PersonePassword.Department), "科室名称", t => t.Department),
(nameof(PersonePassword.DoctorName), "姓名" ,t => t.DoctorName),
(nameof(PersonePassword.PersonnelNumber), "员工工号", t => t.PersonnelNumber),
//(nameof(PersonePassword.JobCategory), "正式/临聘", t => t.JobCategory),
//(nameof(PersonePassword.Duty), "职务", t => t.Duty),
//(nameof(PersonePassword.JobTitle), "职称", t => t.JobTitle),
//(nameof(PersonePassword.AttendanceDay), "出勤天数", t => t.AttendanceDay),
//(nameof(PersonePassword.ReservedRatio), "预留比例", t => t.ReservedRatio),
//(nameof(PersonePassword.BankCard), "银行卡号", t => t.BankCard),
//(nameof(PersonePassword.Password), "密码", t => t.Password),
//(nameof(PersonePassword.Remark), "备注", t => t.Remark),
};
public static List<(string, string, Func<per_employee, object>)> Person { get; } = new List<(string, string, Func<per_employee, object>)> public static List<(string, string, Func<per_employee, object>)> Person { get; } = new List<(string, string, Func<per_employee, object>)>
{ {
(nameof(per_employee.UnitType), "核算组别", t => t.UnitType), (nameof(per_employee.UnitType), "核算组别", t => t.UnitType),
......
...@@ -181,7 +181,7 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute ...@@ -181,7 +181,7 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute
/* /*
此处数据需要额外注意,前端显示规则:通过isTrue=true显示,显示名称为label 此处数据需要额外注意,前端显示规则:通过isTrue=true显示,显示名称为label
*/ */
var alias = _cofaliasRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.Route == "/second_entering") ?? new List<cof_alias>(); var alias = _cofaliasRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.Route == "/second_entering" && t.States == 1) ?? new List<cof_alias>();
Func<string, string, string> getAlias = (name, def) => Func<string, string, string> getAlias = (name, def) =>
{ {
try try
...@@ -229,6 +229,27 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute ...@@ -229,6 +229,27 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute
maps.Add(new SecondColumnDictionary(getAlias(nameof(ag_bodysource.TitleCoefficient), "职称系数"), nameof(ag_bodysource.TitleCoefficient), false, 203, color: "title_color", isNumber: true)); maps.Add(new SecondColumnDictionary(getAlias(nameof(ag_bodysource.TitleCoefficient), "职称系数"), nameof(ag_bodysource.TitleCoefficient), false, 203, color: "title_color", isNumber: true));
maps.Add(new SecondColumnDictionary(getAlias(nameof(ag_bodysource.TitlePerformanceScore), "职称绩效得分"), nameof(ag_bodysource.TitlePerformanceScore), false, 204, color: "title_color", isNumber: true)); maps.Add(new SecondColumnDictionary(getAlias(nameof(ag_bodysource.TitlePerformanceScore), "职称绩效得分"), nameof(ag_bodysource.TitlePerformanceScore), false, 204, color: "title_color", isNumber: true));
} }
// 扩展字典
if (alias != null && alias.Any())
{
List<string> notCalculate = new List<string>
{
nameof(ag_bodysource.Post),
nameof(ag_bodysource.StaffCoefficient),
nameof(ag_bodysource.ActualAttendance),
nameof(ag_bodysource.JobTitle),
nameof(ag_bodysource.TitleCoefficient),
nameof(ag_bodysource.TitlePerformanceScore),
};
foreach (var item in alias)
{
if (!maps.Any(w => w.Key.Equals(item.Name, StringComparison.OrdinalIgnoreCase))
&& !notCalculate.Contains(item.Name))
{
maps.Add(new SecondColumnDictionary(item.Alias, item.Name, false, item.Sort, color: "title_color", isNumber: false, expand: true));
}
}
}
// 工作量 // 工作量
if (computeMode != ComputeMode.NotCalculate) if (computeMode != ComputeMode.NotCalculate)
...@@ -260,8 +281,8 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute ...@@ -260,8 +281,8 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute
{ {
var headDynamic = _agworktypesourceRepository.GetEntities(t => t.SecondId == second.Id) ?? new List<ag_worktype_source>(); var headDynamic = _agworktypesourceRepository.GetEntities(t => t.SecondId == second.Id) ?? new List<ag_worktype_source>();
var groupDatas = headDynamic var groupDatas = headDynamic
.GroupBy(w => new { w.WorkTypeId, w.SecondId, w.FieldId, w.FieldName }) .GroupBy(w => new { w.WorkTypeId, w.SecondId, w.FieldId, w.FieldName })
.Select(w => w.OrderByDescending(w => w.Id).FirstOrDefault()); .Select(w => w.OrderByDescending(w => w.Id).FirstOrDefault());
foreach (var item in groupDatas.OrderBy(t => t.Id)) foreach (var item in groupDatas.OrderBy(t => t.Id))
{ {
maps.Add(new SecondColumnDictionary(item.FieldName, item.FieldId, true, 1, "Top", isNumber: true)); maps.Add(new SecondColumnDictionary(item.FieldName, item.FieldId, true, 1, "Top", isNumber: true));
...@@ -294,6 +315,35 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute ...@@ -294,6 +315,35 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute
} }
/// <summary> /// <summary>
/// 补充内容 扩展字段,通过配置额外展示
/// </summary>
/// <param name="allot"></param>
/// <param name="dic"></param>
/// <param name="rows"></param>
public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<Dictionary<string, object>> rows)
{
if (dic != null && dic.Any(w => w.Expand))
{
var employees = _perallotRepository.QueryEmployee(allot.ID);
foreach (var row in rows)
{
var number = row.GetString(nameof(ag_bodysource.WorkNumber));
Dictionary<string, object> pairs = new Dictionary<string, object>();
var emp = employees.FirstOrDefault(w => w.PersonnelNumber == number);
if (emp != null)
pairs = JsonHelper.Deserialize<Dictionary<string, object>>(JsonHelper.Serialize(emp));
foreach (var item in dic.Where(w => w.Expand))
{
var value = pairs.GetString(item.Key);
row.AddOrUpdate(item.Key, value);
}
}
}
}
/// <summary>
/// 加载已保存工作量数据,加载时区分:已提交和未提交 /// 加载已保存工作量数据,加载时区分:已提交和未提交
/// </summary> /// </summary>
/// <param name="allot"></param> /// <param name="allot"></param>
...@@ -423,9 +473,14 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute ...@@ -423,9 +473,14 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute
// 已提交 // 已提交
if (second.Status.HasValue && status.Contains(second.Status.Value)) if (second.Status.HasValue && status.Contains(second.Status.Value))
{ {
foreach (var item in headDynamic.Where(w => w.FieldId.StartsWithIgnoreCase("Workload_Ratio_")).OrderBy(t => t.Id)) var groupDatas = headDynamic
.Where(w => w.FieldId.StartsWithIgnoreCase("Workload_Ratio_"))
.GroupBy(w => new { w.WorkTypeId, w.SecondId, w.FieldId, w.FieldName })
.Select(w => new { w.Key.FieldId, Value = w.OrderByDescending(w => w.Id).FirstOrDefault()?.Value ?? 0 });
foreach (var item in groupDatas)
{ {
head.AddOrUpdate(item.FieldId, item.Value ?? 0); head.AddOrUpdate(item.FieldId, item.Value);
} }
} }
// 未提交 // 未提交
......
...@@ -16,6 +16,8 @@ namespace Performance.Services ...@@ -16,6 +16,8 @@ namespace Performance.Services
public class ReportGlobalService : IAutoInjection public class ReportGlobalService : IAutoInjection
{ {
private readonly ILogger logger; private readonly ILogger logger;
private readonly ComputeService _computeService;
private readonly PerforHospitalRepository _hospitalRepository;
private readonly PerforPerallotRepository perallotRepository; private readonly PerforPerallotRepository perallotRepository;
private readonly PerforReportglobalRepository reportglobalRepository; private readonly PerforReportglobalRepository reportglobalRepository;
private readonly PerforHisimportdataRepository hisimportdataRepository; private readonly PerforHisimportdataRepository hisimportdataRepository;
...@@ -31,6 +33,8 @@ public class ReportGlobalService : IAutoInjection ...@@ -31,6 +33,8 @@ public class ReportGlobalService : IAutoInjection
public ReportGlobalService( public ReportGlobalService(
ILogger<ReportGlobalService> logger, ILogger<ReportGlobalService> logger,
ComputeService computeService,
PerforHospitalRepository hospitalRepository,
PerforPerallotRepository perallotRepository, PerforPerallotRepository perallotRepository,
PerforReportglobalRepository reportglobalRepository, PerforReportglobalRepository reportglobalRepository,
PerforHisimportdataRepository hisimportdataRepository, PerforHisimportdataRepository hisimportdataRepository,
...@@ -46,6 +50,8 @@ PersonService personService ...@@ -46,6 +50,8 @@ PersonService personService
) )
{ {
this.logger = logger; this.logger = logger;
_computeService = computeService;
_hospitalRepository = hospitalRepository;
this.perallotRepository = perallotRepository; this.perallotRepository = perallotRepository;
this.reportglobalRepository = reportglobalRepository; this.reportglobalRepository = reportglobalRepository;
this.hisimportdataRepository = hisimportdataRepository; this.hisimportdataRepository = hisimportdataRepository;
...@@ -537,11 +543,12 @@ private T GetCellValue<T>(IRow row, List<string> columns, string key) ...@@ -537,11 +543,12 @@ private T GetCellValue<T>(IRow row, List<string> columns, string key)
public HandsonTable GetReportPersonTag(int hospitalId, int allotId) public HandsonTable GetReportPersonTag(int hospitalId, int allotId)
{ {
var result = new HandsonTable((int)SheetType.Unidentifiable, PersonTag.Select(t => t.Value).ToArray(), PersonTag.Select(t => new collect_permission var hos = _hospitalRepository.GetEntity(t => t.ID == hospitalId);
{ var columnHeaders = _computeService.CustomColumnHeaders(hos, "/result/all_employee");
HeadName = t.Value, var type = (int)SheetType.Unidentifiable;
Visible = 1 var cols = columnHeaders.Where(w => w.States == 1).Select(t => t.Alias).ToArray();
}).ToList()); var permissions = columnHeaders.Where(w => w.States == 1).Select(t => new collect_permission { HeadName = t.Alias, Visible = 1 }).ToList();
var result = new HandsonTable(type, cols, permissions);
var pdata = perforPeremployeeRepository.GetEntities(t => t.HospitalId == hospitalId && t.AllotId == allotId); var pdata = perforPeremployeeRepository.GetEntities(t => t.HospitalId == hospitalId && t.AllotId == allotId);
var tdata = reportperformancepersontagsRepository.GetEntities(t => t.HospitalId == hospitalId)?.OrderBy(t => ConvertHelper.To<long>(t.PersonnelNumber)); var tdata = reportperformancepersontagsRepository.GetEntities(t => t.HospitalId == hospitalId)?.OrderBy(t => ConvertHelper.To<long>(t.PersonnelNumber));
...@@ -562,6 +569,16 @@ select new ...@@ -562,6 +569,16 @@ select new
ReservedRatio = t1.ReservedRatio, ReservedRatio = t1.ReservedRatio,
BankCard = t1.BankCard, BankCard = t1.BankCard,
Remark = t1.Remark, Remark = t1.Remark,
Reserve01 = t1.Reserve01,
Reserve02 = t1.Reserve02,
Reserve03 = t1.Reserve03,
Reserve04 = t1.Reserve04,
Reserve05 = t1.Reserve05,
Reserve06 = t1.Reserve06,
Reserve07 = t1.Reserve07,
Reserve08 = t1.Reserve08,
Reserve09 = t1.Reserve09,
Reserve10 = t1.Reserve10,
Tag1 = t?.Tag1, Tag1 = t?.Tag1,
Tag2 = t?.Tag2, Tag2 = t?.Tag2,
Tag3 = t?.Tag3, Tag3 = t?.Tag3,
...@@ -571,11 +588,14 @@ select new ...@@ -571,11 +588,14 @@ select new
if (data == null || !data.Any()) return result; if (data == null || !data.Any()) return result;
var userhospitals = perforUserhospitalRepository.GetEntities(w => w.HospitalID == hospitalId);
var users = new List<sys_user>(); var users = new List<sys_user>();
if (userhospitals != null && userhospitals.Any()) if (hos?.IsOwnerQuery == 1)
{ {
users = perforUserRepository.GetEntities(w => userhospitals.Select(w => w.UserID).Contains(w.ID) && w.IsDelete == 1) ?? new List<sys_user>(); var userhospitals = perforUserhospitalRepository.GetEntities(w => w.HospitalID == hospitalId);
if (userhospitals != null && userhospitals.Any())
{
users = perforUserRepository.GetEntities(w => userhospitals.Select(w => w.UserID).Contains(w.ID) && w.IsDelete == 1) ?? new List<sys_user>();
}
} }
List<HandsonRowData> rowDatas = new List<HandsonRowData>(); List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0; int i = 0;
...@@ -584,34 +604,19 @@ select new ...@@ -584,34 +604,19 @@ select new
var json = JsonHelper.Serialize(item); var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json); var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in PersonTag join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper() select new HandsonCellData(conf.Value, fst.Value)).ToList(); var cells = (from conf in columnHeaders
var user = users.FirstOrDefault(w => w.Login == item.PersonnelNumber && w.Department == item.AccountingUnit); join fst in firstDic on conf.Name.ToUpper() equals fst.Key.ToUpper()
if (user != null) select new HandsonCellData(conf.Alias, fst.Value)).ToList();
if (hos?.IsOwnerQuery == 1)
{ {
cells.Add(new HandsonCellData(PersonTag[nameof(PersonePassword.Password)], user.Password)); var password = users.FirstOrDefault(w => w.Login == item.PersonnelNumber && w.Department == item.AccountingUnit)?.Password ?? "";
cells.Add(new HandsonCellData("密码", password));
} }
rowDatas.Add(new HandsonRowData(i, cells)); rowDatas.Add(new HandsonRowData(i, cells));
i++; i++;
} }
//List<HandsonRowData> rowDatas2 = new List<HandsonRowData>();
//foreach (var item in rowDatas)
//{
// if (rowDatas2.Count == 0)
// rowDatas2.Add(item);
// var flag = true;
// foreach (var item2 in rowDatas2)
// {
// if (item.CellData.ToList()[1].Value.Equals(item2.CellData.ToList()[1].Value))
// flag = false;
// }
// if (flag)
// rowDatas2.Add(item);
//}
result.SetRowData(rowDatas, rowDatas != null); result.SetRowData(rowDatas, rowDatas != null);
var columns = new string[] { "员工工号", "姓名", "核算单元" }; var columns = new string[] { "员工工号", "姓名", "核算单元" };
...@@ -626,10 +631,12 @@ select new ...@@ -626,10 +631,12 @@ select new
public ApiResponse SaveReportPersonTag(int hospitalId, int allotId, int userId, SaveCollectData request) public ApiResponse SaveReportPersonTag(int hospitalId, int allotId, int userId, SaveCollectData request)
{ {
var hos = _hospitalRepository.GetEntity(t => t.ID == hospitalId);
var employees = perforPeremployeeRepository.GetEntities(t => t.AllotId == allotId); var employees = perforPeremployeeRepository.GetEntities(t => t.AllotId == allotId);
if (employees == null || !employees.Any()) throw new PerformanceException("人员字典中未保存数据"); if (employees == null || !employees.Any()) throw new PerformanceException("人员字典中未保存数据");
var dicData = CreateDataRow(hospitalId, request, PersonTag); var alias = _computeService.CustomColumnHeaders(hos, "/result/all_employee");
var dicData = CreateDataRow(hospitalId, request, alias);
var tags = reportperformancepersontagsRepository.GetEntities(t => t.HospitalId == hospitalId); var tags = reportperformancepersontagsRepository.GetEntities(t => t.HospitalId == hospitalId);
var upEmployees = new List<per_employee>(); var upEmployees = new List<per_employee>();
...@@ -698,6 +705,16 @@ public ApiResponse SaveReportPersonTag(int hospitalId, int allotId, int userId, ...@@ -698,6 +705,16 @@ public ApiResponse SaveReportPersonTag(int hospitalId, int allotId, int userId,
employee.ReservedRatio = pdata.ReservedRatio; employee.ReservedRatio = pdata.ReservedRatio;
employee.BankCard = pdata.BankCard; employee.BankCard = pdata.BankCard;
employee.Remark = pdata.Remark; employee.Remark = pdata.Remark;
employee.Reserve01 = pdata.Reserve01;
employee.Reserve02 = pdata.Reserve02;
employee.Reserve03 = pdata.Reserve03;
employee.Reserve04 = pdata.Reserve04;
employee.Reserve05 = pdata.Reserve05;
employee.Reserve06 = pdata.Reserve06;
employee.Reserve07 = pdata.Reserve07;
employee.Reserve08 = pdata.Reserve08;
employee.Reserve09 = pdata.Reserve09;
employee.Reserve10 = pdata.Reserve10;
upEmployees.Add(employee); upEmployees.Add(employee);
#endregion #endregion
...@@ -769,14 +786,16 @@ public HandsonTable GetReportTag(int hospitalId) ...@@ -769,14 +786,16 @@ public HandsonTable GetReportTag(int hospitalId)
public void SaveReportTag(int hospitalId, SaveCollectData request) public void SaveReportTag(int hospitalId, SaveCollectData request)
{ {
var dicData = CreateDataRow(hospitalId, request, PersonTag); var hos = _hospitalRepository.GetEntity(t => t.ID == hospitalId);
var alias = ComputeConfig.GetAllPersonnelTags(hos?.IsOwnerQuery == 1);
var dicData = CreateDataRow(hospitalId, request, alias);
List<report_performance_tags> report = new List<report_performance_tags>(); List<report_performance_tags> report = new List<report_performance_tags>();
foreach (var item in dicData) foreach (var item in dicData)
{ {
var json = JsonHelper.Serialize(item); var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<report_performance_tags>(json); var data = JsonHelper.Deserialize<report_performance_tags>(json);
if (!string.IsNullOrEmpty(data.UnitType) && !string.IsNullOrEmpty(data.AccountingUnit) && !string.IsNullOrEmpty(data.Tag1) && !string.IsNullOrEmpty(data.Tag2)) if (!string.IsNullOrEmpty(data.UnitType) && !string.IsNullOrEmpty(data.AccountingUnit) && !string.IsNullOrEmpty(data.Tag1))
{ {
data.CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); data.CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
report.Add(data); report.Add(data);
...@@ -787,34 +806,11 @@ public void SaveReportTag(int hospitalId, SaveCollectData request) ...@@ -787,34 +806,11 @@ public void SaveReportTag(int hospitalId, SaveCollectData request)
reportperformancetagsRepository.AddRange(report.ToArray()); reportperformancetagsRepository.AddRange(report.ToArray());
} }
private static Dictionary<string, string> PersonTag { get; } = new Dictionary<string, string>
{
//{nameof(report_performance_person_tags.UnitType), "核算单元类型"},
//{nameof(report_performance_person_tags.AccountingUnit), "科室"},
//{nameof(per_employee.Id), "Id"},
{nameof(per_employee.PersonnelNumber), "员工工号"},
{nameof(per_employee.DoctorName), "姓名"},
{nameof(per_employee.AccountingUnit), "核算单元"},
{nameof(PersonePassword.Password), "密码"},
{nameof(per_employee.JobCategory), "正式/临聘" },
{nameof(per_employee.Duty), "职务" },
{nameof(per_employee.JobTitle), "职称" },
{nameof(per_employee.AttendanceDay), "出勤天数" },
{nameof(per_employee.ReservedRatio), "预留比例" },
{nameof(per_employee.BankCard), "银行卡号" },
{nameof(per_employee.Remark), "备注" },
{ nameof(report_performance_person_tags.Tag1), "绩效发放情况"},
{nameof(report_performance_person_tags.Tag2), "当月绩效权重"},
{nameof(report_performance_person_tags.Tag3), "重点群体对比1"},
{nameof(report_performance_person_tags.Tag4), "重点群体对比2"},
{nameof(report_performance_person_tags.Tag5), "重点群体对比5"},
};
public static Dictionary<string, string> ReportTag { get; } = new Dictionary<string, string> public static Dictionary<string, string> ReportTag { get; } = new Dictionary<string, string>
{ {
{nameof(report_performance_tags.UnitType), "核算单元类型"}, {nameof(report_performance_tags.UnitType), "核算组别"},
{nameof(report_performance_tags.AccountingUnit), "科室"}, {nameof(report_performance_tags.AccountingUnit), "核算单元"},
{nameof(report_performance_tags.Tag1), "绩效发放情况"}, {nameof(report_performance_tags.Tag1), "绩效发放情况"},
{nameof(report_performance_tags.Tag2), "当月绩效权重"}, {nameof(report_performance_tags.Tag2), "当月绩效权重"},
{nameof(report_performance_tags.Tag3), "重点群体对比1"}, {nameof(report_performance_tags.Tag3), "重点群体对比1"},
...@@ -822,14 +818,14 @@ public void SaveReportTag(int hospitalId, SaveCollectData request) ...@@ -822,14 +818,14 @@ public void SaveReportTag(int hospitalId, SaveCollectData request)
{nameof(report_performance_tags.Tag5), "重点群体对比5"}, {nameof(report_performance_tags.Tag5), "重点群体对比5"},
}; };
private List<Dictionary<string, string>> CreateDataRow(int hospitalId, SaveCollectData request, Dictionary<string, string> config) private List<Dictionary<string, string>> CreateDataRow(int hospitalId, SaveCollectData request, List<cof_alias> alias)
{ {
List<Dictionary<string, string>> allData = new List<Dictionary<string, string>>(); List<Dictionary<string, string>> allData = new List<Dictionary<string, string>>();
for (int r = 0; r < request.Data.Length; r++) for (int r = 0; r < request.Data.Length; r++)
{ {
// 创建固定数据列 // 创建固定数据列
Dictionary<string, string> baseData = CreateBaseData(request, config, r); Dictionary<string, string> baseData = CreateBaseData(request, alias, r);
baseData.Add(nameof(cof_hrp_department.HospitalId), hospitalId.ToString()); baseData.Add(nameof(cof_hrp_department.HospitalId), hospitalId.ToString());
allData.Add(baseData); allData.Add(baseData);
...@@ -837,18 +833,18 @@ public void SaveReportTag(int hospitalId, SaveCollectData request) ...@@ -837,18 +833,18 @@ public void SaveReportTag(int hospitalId, SaveCollectData request)
return allData; return allData;
} }
private Dictionary<string, string> CreateBaseData(SaveCollectData request, Dictionary<string, string> config, int rownumber) private Dictionary<string, string> CreateBaseData(SaveCollectData request, List<cof_alias> alias, int rownumber)
{ {
Dictionary<string, string> result = new Dictionary<string, string>(); Dictionary<string, string> result = new Dictionary<string, string>();
for (int c = 0; c < request.ColHeaders.Length; c++) for (int c = 0; c < request.ColHeaders.Length; c++)
{ {
var header = request.ColHeaders[c]; var header = request.ColHeaders[c];
var first = config.FirstOrDefault(w => w.Value == header); var first = alias.FirstOrDefault(w => w.Alias == header);
if (!default(KeyValuePair<string, string>).Equals(first) if (!default(KeyValuePair<string, string>).Equals(first)
&& !result.ContainsKey(header) && !result.ContainsKey(header)
&& request.Data[rownumber].Length > c) && request.Data[rownumber].Length > c)
{ {
result.Add(first.Key, request.Data[rownumber][c]); result.Add(first.Name, request.Data[rownumber][c]);
} }
} }
......
...@@ -525,7 +525,7 @@ public void SaveSecondAllotHeadData(int secondId, string json) ...@@ -525,7 +525,7 @@ public void SaveSecondAllotHeadData(int secondId, string json)
if (workValue == null || !workValue.Any()) if (workValue == null || !workValue.Any())
return; return;
foreach (var value in workValue) foreach (var value in workValue.Distinct())
{ {
for (int i = 0; i < prefix.Length; i++) for (int i = 0; i < prefix.Length; i++)
{ {
......
...@@ -1741,6 +1741,26 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request) ...@@ -1741,6 +1741,26 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request)
return result; return result;
} }
/// <summary>
/// 审计
/// </summary>
/// <param name="userId"></param>
/// <param name="secondIds"></param>
/// <returns></returns>
public bool SecondMark(int userId, int[] secondIds)
{
var seconds = agsecondallotRepository.GetEntities(t => secondIds.Contains(t.Id));
if (seconds == null || !seconds.Any())
throw new PerformanceException("未能找到二次分配核算记录!");
foreach (var item in seconds)
{
item.MarkStatus = 1;
item.MarkUser = userId;
item.MarkTime = DateTime.Now;
}
return agsecondallotRepository.UpdateRange(seconds.ToArray());
}
///// <summary> ///// <summary>
///// 审核结束 添加至二次绩效汇总 ///// 审核结束 添加至二次绩效汇总
///// </summary> ///// </summary>
......
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