Commit f13e0af9 by ruyun.zhang@suvalue.com

Merge branch 'feature/核算单元变更' into develop

parents 8e140206 1afa062c
......@@ -122,7 +122,7 @@ public ApiResponse SelfInfo()
user.Role = _roleService.GetUserRole(user.UserID);
user.Hospital = _hospitalService.GetUserHopital(user.UserID);
int[] roleArray = new int[] { _options.NurseRole, _options.DirectorRole, _options.SpecialRole, _options.OfficeRole };
int[] roleArray = UnitTypeUtil.Maps.Keys.ToArray();
user.IsAgainAdmin = user.Role != null ? roleArray.Contains(user.Role.First().Type ?? 0) : false;
return new ApiResponse(ResponseType.OK, user);
}
......@@ -149,56 +149,56 @@ public ApiResponse<UserResponse> UpdateSelf([CustomizeValidator(RuleSet = "Self"
[HttpPost]
public ApiResponse<List<UserResponse>> List([FromBody] UserRequest request)
{
var userList = _userService.GetUserList(_claim.GetUserId(),request.Role);
var userList = _userService.GetUserList(_claim.GetUserId(), request.Role);
return new ApiResponse<List<UserResponse>>(ResponseType.OK, "ok", userList);
}
/// <summary>
/// 新增用户
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("insert")]
[HttpPost]
public ApiResponse<UserResponse> Insert([CustomizeValidator(RuleSet = "Insert"), FromBody] UserRequest request)
{
var userId = _claim.GetUserId();
var user = _userService.Insert(request, userId);
user.Role = request.Role;
return new ApiResponse<UserResponse>(ResponseType.OK, user);
}
/// <summary>
/// 新增用户
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("delete")]
[HttpPost]
public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody] UserRequest request)
{
return _userService.Delete(request.ID);
}
/// <summary>
/// 删除用户
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("update")]
[HttpPost]
public ApiResponse<UserResponse> Update([CustomizeValidator(RuleSet = "Update"), FromBody] UserRequest request)
{
var userId = _claim.GetUserId();
int[] roleArray = new int[] { _options.NurseRole, _options.DirectorRole, _options.SpecialRole, _options.OfficeRole };
var roles = _roleService.GetUserRole(userId);
var isAgainAdmin = roles != null ? roleArray.Contains(roles.First().Type ?? 0) : false;
var user = _userService.Update(request, isAgainAdmin);
user.Role = request.Role;
return new ApiResponse<UserResponse>(ResponseType.OK, user);
}
///// <summary>
///// 新增用户
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("insert")]
//[HttpPost]
//public ApiResponse<UserResponse> Insert([CustomizeValidator(RuleSet = "Insert"), FromBody] UserRequest request)
//{
// var userId = _claim.GetUserId();
// var user = _userService.Insert(request, userId);
// user.Role = request.Role;
// return new ApiResponse<UserResponse>(ResponseType.OK, user);
//}
///// <summary>
///// 新增用户
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("delete")]
//[HttpPost]
//public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody] UserRequest request)
//{
// return _userService.Delete(request.ID);
//}
///// <summary>
///// 删除用户
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("update")]
//[HttpPost]
//public ApiResponse<UserResponse> Update([CustomizeValidator(RuleSet = "Update"), FromBody] UserRequest request)
//{
// var userId = _claim.GetUserId();
// int[] roleArray = new int[] { _options.NurseRole, _options.DirectorRole, _options.SpecialRole, _options.OfficeRole };
// var roles = _roleService.GetUserRole(userId);
// var isAgainAdmin = roles != null ? roleArray.Contains(roles.First().Type ?? 0) : false;
// var user = _userService.Update(request, isAgainAdmin);
// user.Role = request.Role;
// return new ApiResponse<UserResponse>(ResponseType.OK, user);
//}
/// <summary>
/// 修改用户密码
......@@ -230,13 +230,13 @@ public ApiResponse<List<sys_role>> RoleList()
/// <summary>
/// 科室列表
/// </summary>
/// <param name="request"></param>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("department")]
[Route("department/{allotId}")]
[HttpPost]
public ApiResponse<List<TitleValue>> Department([FromBody] SetDepartmentRequest request)
public ApiResponse<List<TitleValue>> Department(int allotId)
{
var department = _userService.Department(request.HospitalID);
var department = _userService.Department(allotId);
return new ApiResponse<List<TitleValue>>(ResponseType.OK, "ok", department);
}
......@@ -311,7 +311,7 @@ public ApiResponse SelfInfos([FromBody] UserRequest request)
user.Role = _roleService.GetUsersRole(user.UserID);
user.Hospital = _hospitalService.GetUserHopital(user.UserID);
int[] roleArray = new int[] { _options.NurseRole, _options.DirectorRole, _options.SpecialRole, _options.OfficeRole };
int[] roleArray = UnitTypeUtil.Maps.Keys.ToArray();
if (request.Role <= 0)
user.IsAgainAdmin = user.Role != null ? roleArray.Contains(user.Role.First().Type ?? 0) : false;
else
......@@ -345,13 +345,7 @@ public ApiResponse<UserResponse> UpdateUser([CustomizeValidator(RuleSet = "Updat
{
var userId = _claim.GetUserId();
int[] roleArray = new int[] { _options.NurseRole, _options.DirectorRole, _options.SpecialRole, _options.OfficeRole };
var roles = _roleService.GetUsersRole(userId);
//var roleType = roles.Select(c => c.Type).ToArray();
var intersect = roleArray.Intersect(roles.Select(c => (int)c.Type).ToArray());
var isAgainAdmin = roles != null ? intersect.Any() : false;
var user = _userService.UpdateUser(request, isAgainAdmin);
var user = _userService.UpdateUser(request, userId);
user.RoleArr = request.RoleArr;
return new ApiResponse<UserResponse>(ResponseType.OK, user);
}
......@@ -391,12 +385,7 @@ public ApiResponse GetBatchUserStructrue()
[HttpPost]
public ApiResponse BatchSaveUser([CustomizeValidator(RuleSet = "Insert"), FromBody] UserCollectData data)
{
var result = _userService.SaveUserHandsFlat(data);
if (result == "")
return new ApiResponse(ResponseType.OK);
else
return new ApiResponse(ResponseType.Error, result);
return _userService.SaveUserHandsFlat(data);
}
}
}
\ No newline at end of file
......@@ -103,7 +103,7 @@
// if (!FileHelper.CreateFile(path, bytes))
// return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传失败");
// allot.Path = path;
// allot.Remark = EnumHelper.GetDescription(AllotStates.FileUploaded);
// allot.Remark = EnumHelper.GetDescription(AllotStates.数据已上传);
// if (!againAllotService.Update(allot, againid))
// return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传成功,修改状态失败");
......
......@@ -194,7 +194,7 @@ public ApiResponse DeptDetail([FromBody] DeptDetailRequest request)
{
second = _computeService.GetSecondByAccountId(request.AccountID);
}
else if (request.AccountID != 0 && request.UnitType == (int)UnitType.行政)
else if (request.AccountID != 0 && request.UnitType == (int)UnitType.行政)
{
var response = _computeService.DeptOfficeDetail(request.AccountID);
return new ApiResponse(ResponseType.OK, response);
......@@ -205,7 +205,7 @@ public ApiResponse DeptDetail([FromBody] DeptDetailRequest request)
var response = _computeService.SpecialDeptDetail(second);
return new ApiResponse(ResponseType.OK, response);
}
else if (second != null && second.UnitType == UnitType.行政后勤.ToString())
else if (second != null && UnitTypeUtil.IsOffice(second.UnitType))
{
var response = _computeService.DeptOfficeDetail(request.AccountID);
return new ApiResponse(ResponseType.OK, response);
......
......@@ -626,8 +626,14 @@ public ApiResponse GetAccountingList([FromBody] AccoungingRequest request)
[HttpPost]
public ApiResponse AccountingInsert([FromBody] cof_accounting request)
{
if (request.AllotId == 0 || string.IsNullOrEmpty(request.Code) || string.IsNullOrEmpty(request.UnitType) || string.IsNullOrEmpty(request.AccountingUnit))
return new ApiResponse(ResponseType.ParameterError, "参数不允许为空");
if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError);
if (string.IsNullOrEmpty(request.UnitType) || string.IsNullOrEmpty(request.AccountingUnit))
return new ApiResponse(ResponseType.Fail, "核算单元或组别必须填写");
if (string.IsNullOrEmpty(request.Code))
return new ApiResponse(ResponseType.Fail, "核算单元编码必须填写");
var drugprop = _configService.AccountingInsert(request);
return new ApiResponse(ResponseType.OK, drugprop);
......@@ -642,9 +648,16 @@ public ApiResponse AccountingInsert([FromBody] cof_accounting request)
[HttpPost]
public ApiResponse AccountingUpdate([FromBody] cof_accounting request)
{
if (request.AllotId == 0 || string.IsNullOrEmpty(request.UnitType) || string.IsNullOrEmpty(request.AccountingUnit))
if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError);
if (string.IsNullOrEmpty(request.UnitType) || string.IsNullOrEmpty(request.AccountingUnit))
return new ApiResponse(ResponseType.Fail, "核算单元或组别必须填写");
if (string.IsNullOrEmpty(request.Code))
return new ApiResponse(ResponseType.Fail, "核算单元编码必须填写");
var drugprop = _configService.AccountingUpdate(request);
return new ApiResponse(ResponseType.OK, drugprop);
}
......@@ -686,8 +699,8 @@ public ApiResponse BatchAccountingStructrue([FromRoute] int allotId)
[HttpPost]
public ApiResponse BatchCheckAccounting(int allotId)
{
_configService.BatchCheckAccounting(allotId);
return new ApiResponse(ResponseType.OK, "校验通过");
_allotService.AccoungtingVerify(allotId);
return new ApiResponse(ResponseType.OK, "校验完成");
}
/// <summary>
......@@ -700,11 +713,7 @@ public ApiResponse BatchCheckAccounting(int allotId)
[HttpPost]
public ApiResponse BatchSaveAccounting(int allotId, [FromBody] SaveCollectData request)
{
var result = _configService.BatchSaveAccounting(allotId, request);
if (result)
return new ApiResponse(ResponseType.OK);
else
return new ApiResponse(ResponseType.Error, "请选择正确的核算组别");
return _configService.BatchSaveAccounting(allotId, request);
}
......@@ -859,14 +868,15 @@ public ApiResponse CopyDropDown()
{
var result = new List<CopyDrop>
{
new CopyDrop{Label="核算单元及组别",Value="accountings"},
new CopyDrop{Label="科室字典",Value="department"},
new CopyDrop{Label="人员字典",Value="personnels"},
new CopyDrop{Label="工作量配置",Value="workItems"},
new CopyDrop{Label="收入费用类别",Value="drugTypes"},
//new CopyDrop{Label="收入费用类别",Value="drugTypes"},
new CopyDrop{Label="支出费用类别",Value="drugTypeDisburses"},
new CopyDrop{Label="费用类别系数",Value="drugTypeFactors"},
/* new CopyDrop{Label="科室类型",Value="deptTypes"},*/
//new CopyDrop{Label="科室类型",Value="deptTypes"},
new CopyDrop{Label="二次绩效配置",Value="agains"},
new CopyDrop{Label="核算单元及组别",Value="accountings"},
}; ;
return new ApiResponse(ResponseType.OK, result);
}
......
......@@ -129,13 +129,13 @@ public IActionResult DownloadCurrentCalculationTable([FromRoute] int allotId)
/// <summary>
/// 获取所有科室记录
/// </summary>
/// <param name="hospitalId"></param>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("deptdic/list/{hospitalId}")]
[Route("deptdic/list/{allotId}")]
[HttpPost]
public ApiResponse GetDepartments(int hospitalId)
public ApiResponse GetDepartments(int allotId)
{
var list = personService.GetDepartments(hospitalId);
var list = personService.GetDepartments(allotId);
return new ApiResponse(ResponseType.OK, list);
}
......@@ -191,17 +191,17 @@ public ApiResponse DeleteDeptDic([FromBody] DeptdicResponse request)
/// <summary>
/// 系统/标准科室字典
/// </summary>
/// <param name="hospitalId">医院Id</param>
/// <param name="allotId">allotId</param>
/// <param name="type">1系统科室 2标准科室 3核算单元 4行政后勤 5特殊核算组</param>
/// <returns></returns>
[Route("deptdic/{hospitalId}/dict/{type}")]
[Route("deptdic/{allotId}/dict/{type}")]
[HttpPost]
public ApiResponse DeptDics(int hospitalId, int type)
public ApiResponse DeptDics(int allotId, int type)
{
if (!new int[] { 1, 2, 3, 4, 5 }.Contains(type))
return new ApiResponse(ResponseType.ParameterError, "参数错误!");
var result = personService.DeptDics(hospitalId, type);
var result = personService.DeptDics(allotId, type);
return new ApiResponse(ResponseType.OK, result);
}
......@@ -234,10 +234,10 @@ public ApiResponse DeptIncomeDetail([CustomizeValidator(RuleSet = "Select"), Fro
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("person/GetBatchPersonStructrue/{hospitalId}")]
public ApiResponse GetBatchPersonStructrue(int hospitalId)
[Route("person/GetBatchPersonStructrue/{allotId}")]
public ApiResponse GetBatchPersonStructrue(int allotId)
{
var result = personService.GetBatchPersonStructrue(hospitalId);
var result = personService.GetBatchPersonStructrue(allotId);
return new ApiResponse(ResponseType.OK, result);
}
......@@ -257,10 +257,10 @@ public ApiResponse BathSavePerson(int allotId, int hospitalId, SaveCollectData r
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("dept/GetDeptStructrue/{hospitalId}")]
public ApiResponse GetDeptStructrue(int hospitalId)
[Route("dept/GetDeptStructrue/{allotId}")]
public ApiResponse GetDeptStructrue(int allotId)
{
var result = personService.GetDepartmentHands(hospitalId);
var result = personService.GetDepartmentHands(allotId);
return new ApiResponse(ResponseType.OK, result);
}
......@@ -269,10 +269,10 @@ public ApiResponse GetDeptStructrue(int hospitalId)
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("dept/SaveDeptHands/{hospitalId}")]
public ApiResponse SaveDeptHands(int hospitalId, SaveCollectData request)
[Route("dept/SaveDeptHands/{allotId}")]
public ApiResponse SaveDeptHands(int allotId, SaveCollectData request)
{
personService.SaveDeptDicHands(hospitalId, request);
personService.SaveDeptDicHands(allotId, request);
return new ApiResponse(ResponseType.OK);
}
......
......@@ -14,14 +14,14 @@
"ExpirationMinutes": "1200",
//验证码过期
"SmsCodeMinutes": "5",
//护士长二次绩效管理员
"NurseRole": "3",
//科主任二次绩效管理员
"DirectorRole": "4",
//特殊科室二次绩效管理员
"SpecialRole": "9",
//数据收集角色(可查看所有)
"CollectRoles": [ 1, 2, 5, 6, 7, 8 ],
////护士长二次绩效管理员
//"NurseRole": "3",
////科主任二次绩效管理员
//"DirectorRole": "4",
////特殊科室二次绩效管理员
//"SpecialRole": "9",
////数据收集角色(可查看所有)
//"CollectRoles": [ 1, 2, 5, 6, 7, 8 ],
// 抽取结果Excel文件保存地址
"AbsolutePath": "E:\\wwwroot\\testjx.suvalue.com",
// 抽取结果Excel文件保存地址 更替的 网络地址
......
......@@ -49,27 +49,6 @@
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AccountController.Insert(Performance.DtoModels.UserRequest)">
<summary>
新增用户
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AccountController.Delete(Performance.DtoModels.UserRequest)">
<summary>
新增用户
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AccountController.Update(Performance.DtoModels.UserRequest)">
<summary>
删除用户
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AccountController.Password(Performance.DtoModels.PasswordRequest)">
<summary>
修改用户密码
......@@ -83,11 +62,11 @@
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AccountController.Department(Performance.DtoModels.SetDepartmentRequest)">
<member name="M:Performance.Api.Controllers.AccountController.Department(System.Int32)">
<summary>
科室列表
</summary>
<param name="request"></param>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AccountController.DemoUsers">
......@@ -1730,7 +1709,7 @@
<summary>
获取所有科室记录
</summary>
<param name="hospitalId"></param>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.PersonController.CreateDeptDic(Performance.EntityModels.per_dept_dic)">
......@@ -1758,7 +1737,7 @@
<summary>
系统/标准科室字典
</summary>
<param name="hospitalId">医院Id</param>
<param name="allotId">allotId</param>
<param name="type">1系统科室 2标准科室 3核算单元 4行政后勤 5特殊核算组</param>
<returns></returns>
</member>
......
......@@ -34,31 +34,6 @@
短信模板
</summary>
</member>
<member name="P:Performance.DtoModels.AppSettings.Application.NurseRole">
<summary>
护士长二次绩效管理员
</summary>
</member>
<member name="P:Performance.DtoModels.AppSettings.Application.DirectorRole">
<summary>
科主任二次绩效管理员
</summary>
</member>
<member name="P:Performance.DtoModels.AppSettings.Application.SpecialRole">
<summary>
特殊科室二次绩效管理员
</summary>
</member>
<member name="P:Performance.DtoModels.AppSettings.Application.CollectRoles">
<summary>
数据收集角色(可查看所有)
</summary>
</member>
<member name="P:Performance.DtoModels.AppSettings.Application.OfficeRole">
<summary>
行政科室二次绩效管理员
</summary>
</member>
<member name="P:Performance.DtoModels.AppSettings.Application.Receiver">
<summary>
邮件指定接收人
......@@ -130,39 +105,6 @@
<member name="F:Performance.DtoModels.DbSrouceType.Performance">
<summary> 绩效库 </summary>
</member>
<member name="F:Performance.DtoModels.AllotStates.数据未上传">
<summary> 数据未上传 </summary>
</member>
<member name="F:Performance.DtoModels.AllotStates.数据已上传">
<summary> 数据已上传 </summary>
</member>
<member name="F:Performance.DtoModels.AllotStates.正在校验数据">
<summary> 正在校验数据 </summary>
</member>
<member name="F:Performance.DtoModels.AllotStates.数据验证通过">
<summary> 数据验证通过 </summary>
</member>
<member name="F:Performance.DtoModels.AllotStates.数据错误">
<summary> 数据错误 </summary>
</member>
<member name="F:Performance.DtoModels.AllotStates.正在生成绩效">
<summary> 正在生成绩效 </summary>
</member>
<member name="F:Performance.DtoModels.AllotStates.绩效下发">
<summary> 绩效下发 </summary>
</member>
<member name="F:Performance.DtoModels.AllotStates.绩效解析失败">
<summary> 绩效解析失败 </summary>
</member>
<member name="F:Performance.DtoModels.AllotStates.归档">
<summary> 归档 </summary>
</member>
<member name="F:Performance.DtoModels.AllotStates.等待">
<summary> 等待 </summary>
</member>
<member name="F:Performance.DtoModels.AllotStates.绩效结果解析成功">
<summary> 绩效结果解析成功 </summary>
</member>
<member name="F:Performance.DtoModels.AgWorkloadType.PreAccountingReward">
<summary>
核算前奖励
......@@ -735,9 +677,6 @@
是否需要二次分配
</summary>
</member>
<member name="T:Performance.DtoModels.UnitType">
<summary> 核算单元类型 </summary>
</member>
<member name="F:Performance.DtoModels.SheetType.Unidentifiable">
<summary> 无法识别 </summary>
</member>
......@@ -3414,6 +3353,16 @@
核算单元
</summary>
</member>
<member name="P:Performance.DtoModels.EmployeeReservedDto.NewUnitType">
<summary>
</summary>
</member>
<member name="P:Performance.DtoModels.EmployeeReservedDto.NewAccountingUnit">
<summary>
核算单元
</summary>
</member>
<member name="P:Performance.DtoModels.EmployeeReservedDto.EmployeeName">
<summary>
人员姓名
......
......@@ -1085,6 +1085,21 @@
科室类型
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.Department">
<summary>
科室
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.NewUnitType">
<summary>
变更核算组别
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.NewAccountingUnit">
<summary>
变更核算单元
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.Year">
<summary>
......@@ -1095,11 +1110,6 @@
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.Department">
<summary>
科室
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.RealGiveFee">
<summary>
科室实发金额
......@@ -6620,6 +6630,11 @@
医院Id
</summary>
</member>
<member name="P:Performance.EntityModels.per_dept_dic.AllotId">
<summary>
AllotId
</summary>
</member>
<member name="P:Performance.EntityModels.per_dept_dic.IsVerify">
<summary>
0 未通过验证 1 通过验证
......@@ -8650,6 +8665,16 @@
父级ID
</summary>
</member>
<member name="P:Performance.EntityModels.sys_user.UnitType">
<summary>
核算组别
</summary>
</member>
<member name="P:Performance.EntityModels.sys_user.UnitCode">
<summary>
核算序号
</summary>
</member>
<member name="T:Performance.EntityModels.sys_user_hospital">
<summary>
......@@ -8845,6 +8870,21 @@
</summary>
</member>
<member name="P:Performance.EntityModels.CofAccountingEntity.UnitType">
<summary>
核算单元类型
</summary>
</member>
<member name="P:Performance.EntityModels.CofAccountingEntity.AccountingUnit">
<summary>
核算单元
</summary>
</member>
<member name="P:Performance.EntityModels.CofAccountingEntity.Code">
<summary>
核算单元编码
</summary>
</member>
<member name="P:Performance.EntityModels.Other.view_attendance.UnitType">
<summary>
人员类别
......@@ -9045,5 +9085,41 @@
预留金额
</summary>
</member>
<member name="F:AllotStates.数据未上传">
<summary> 数据未上传 </summary>
</member>
<member name="F:AllotStates.数据已上传">
<summary> 数据已上传 </summary>
</member>
<member name="F:AllotStates.正在校验数据">
<summary> 正在校验数据 </summary>
</member>
<member name="F:AllotStates.数据验证通过">
<summary> 数据验证通过 </summary>
</member>
<member name="F:AllotStates.数据错误">
<summary> 数据错误 </summary>
</member>
<member name="F:AllotStates.正在生成绩效">
<summary> 正在生成绩效 </summary>
</member>
<member name="F:AllotStates.绩效下发">
<summary> 绩效下发 </summary>
</member>
<member name="F:AllotStates.绩效解析失败">
<summary> 绩效解析失败 </summary>
</member>
<member name="F:AllotStates.归档">
<summary> 归档 </summary>
</member>
<member name="F:AllotStates.等待">
<summary> 等待 </summary>
</member>
<member name="F:AllotStates.绩效结果解析成功">
<summary> 绩效结果解析成功 </summary>
</member>
<member name="T:UnitType">
<summary> 核算单元类型 </summary>
</member>
</members>
</doc>
......@@ -18,26 +18,26 @@ public class Application
/// 短信模板
/// </summary>
public string SmsTemplate { get; set; }
/// <summary>
/// 护士长二次绩效管理员
/// </summary>
public int NurseRole { get; set; }
/// <summary>
/// 科主任二次绩效管理员
/// </summary>
public int DirectorRole { get; set; }
/// <summary>
/// 特殊科室二次绩效管理员
/// </summary>
public int SpecialRole { get; set; }
/// <summary>
/// 数据收集角色(可查看所有)
/// </summary>
public int[] CollectRoles { get; set; }
/// <summary>
/// 行政科室二次绩效管理员
/// </summary>
public int OfficeRole { get; set; }
///// <summary>
///// 护士长二次绩效管理员
///// </summary>
//public int NurseRole { get; set; }
///// <summary>
///// 科主任二次绩效管理员
///// </summary>
//public int DirectorRole { get; set; }
///// <summary>
///// 特殊科室二次绩效管理员
///// </summary>
//public int SpecialRole { get; set; }
///// <summary>
///// 数据收集角色(可查看所有)
///// </summary>
//public int[] CollectRoles { get; set; }
///// <summary>
///// 行政科室二次绩效管理员
///// </summary>
//public int OfficeRole { get; set; }
/// <summary>
/// 邮件指定接收人
/// </summary>
......
......@@ -45,42 +45,6 @@ public enum DbSrouceType
Performance = 2,
}
public enum AllotStates
{
/// <summary> 数据未上传 </summary>
[Description("数据未上传")]
数据未上传 = 0,
/// <summary> 数据已上传 </summary>
[Description("数据已上传")]
数据已上传 = 1,
/// <summary> 正在校验数据 </summary>
[Description("正在校验数据")]
正在校验数据 = 2,
/// <summary> 数据验证通过 </summary>
[Description("数据验证通过")]
数据验证通过 = 3,
/// <summary> 数据错误 </summary>
[Description("数据错误")]
数据错误 = 4,
/// <summary> 正在生成绩效 </summary>
[Description("正在生成绩效")]
正在生成绩效 = 5,
/// <summary> 绩效下发 </summary>
[Description("绩效下发")]
绩效下发 = 6,
/// <summary> 绩效解析失败 </summary>
[Description("绩效解析失败")]
绩效解析失败 = 7,
/// <summary> 归档 </summary>
[Description("归档")]
归档 = 8,
/// <summary> 等待 </summary>
[Description("等待")]
等待 = 9,
/// <summary> 绩效结果解析成功 </summary>
[Description("数据验证通过")]
绩效结果解析成功 = 10,
}
public enum AgWorkloadType
{
......@@ -119,24 +83,6 @@ public enum DataFormat
日期YYYYMMDD
}
public enum Role
{
绩效管理员 = 1,
医院管理员 = 2,
护士长 = 3,
科主任 = 4,
绩效核算办 = 5,
院领导 = 6,
财务科 = 7,
人事科 = 8,
特殊科室 = 9,
行政科室 = 10,
数据收集 = 11,
护理部审核 = 12,
绩效查询 = 13,
审计 = 14,
}
public class Background
{
public enum JobType
......
......@@ -20,6 +20,28 @@ public HandsonTableBase()
public List<Dictionary<string, object>> Data { get; set; }
public List<HandsonColumn> Columns { get; set; }
public object[] NestedHeadersArray { get; set; }
public void SetRowData(IEnumerable<HandsonRowData> datas)
{
foreach (var dt in datas)
{
var dic = CreateDataRow("编号", dt.Row.ToString());
foreach (var item in dt.CellData)
{
dic[item.Name.ToLower()] = item.Value?.ToString() ?? "";
}
Data.Add(dic);
}
}
protected Dictionary<string, object> CreateDataRow(string key, string value)
{
var temp = new Dictionary<string, object>() { { key, value } };
foreach (var item in ColHeaders)
{
if (!temp.ContainsKey(item))
temp.Add(item.ToLower(), "");
}
return temp;
}
}
public class HandsonTable : HandsonTableBase
......@@ -95,17 +117,6 @@ private void InitColumns(List<collect_permission> permissions)
}
Columns = columns;
}
private Dictionary<string, object> CreateDataRow(string key, string value)
{
var temp = new Dictionary<string, object>() { { key, value } };
foreach (var item in ColHeaders)
{
if (!temp.ContainsKey(item))
temp.Add(item.ToLower(), "");
}
return temp;
}
}
public class HandsonColumn
......
......@@ -11,44 +11,6 @@ public enum ExcelVersion
xls
}
/// <summary> 核算单元类型 </summary>
public enum UnitType
{
[Description("医生组")]
医生组 = 1,
[Description("护理组")]
护理组 = 2,
[Description("医技组")]
医技组 = 3,
[Description("专家组")]
专家组 = 4,
//[Description("其他")]
//其他 = 5,
[Description("特殊核算组")]
特殊核算组 = 6,
[Description("其他医生组")]
其他医生组 = 7,
[Description("其他护理组")]
其他护理组 = 8,
[Description("其他医技组")]
其他医技组 = 9,
[Description("行政高层")]
行政高层 = 10,
[Description("行政中层")]
行政中层 = 11,
[Description("行政后勤")]
行政后勤 = 12,
}
public enum SheetType
{
......
......@@ -6,6 +6,7 @@ namespace Performance.DtoModels
{
public class DeptdicResponse
{
public int AllotId { get; set; }
public int HospitalId { get; set; }
public string HISDeptName { get; set; }
public string Department { get; set; }
......
......@@ -27,6 +27,16 @@ public class EmployeeReservedDto
public string AccountingUnit { get; set; }
/// <summary>
///
/// </summary>
public string NewUnitType { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string NewAccountingUnit { get; set; }
/// <summary>
/// 人员姓名
/// </summary>
public string EmployeeName { get; set; }
......
......@@ -75,5 +75,13 @@ public class sys_user
/// 父级ID
/// </summary>
public Nullable<int> ParentID { get; set; }
/// <summary>
/// 核算组别
/// </summary>
public string UnitType { get; set; }
/// <summary>
/// 核算序号
/// </summary>
public string UnitCode { get; set; }
}
}
......@@ -34,6 +34,21 @@ public class ag_secondallot
public string UnitType { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 变更核算组别
/// </summary>
public string NewUnitType { get; set; }
/// <summary>
/// 变更核算单元
/// </summary>
public string NewAccountingUnit { get; set; }
/// <summary>
/// 年
/// </summary>
public Nullable<int> Year { get; set; }
......@@ -44,11 +59,6 @@ public class ag_secondallot
public Nullable<int> Month { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 科室实发金额
/// </summary>
public Nullable<decimal> RealGiveFee { get; set; }
......
......@@ -50,6 +50,10 @@ public class per_dept_dic
/// 医院Id
/// </summary>
public Nullable<int> HospitalId { get; set; }
/// <summary>
/// AllotId
/// </summary>
public Nullable<int> AllotId { get; set; }
/// <summary>
/// 0 未通过验证 1 通过验证
......
using System.ComponentModel;
public enum AllotStates
{
/// <summary> 数据未上传 </summary>
[Description("数据未上传")]
数据未上传 = 0,
/// <summary> 数据已上传 </summary>
[Description("数据已上传")]
数据已上传 = 1,
/// <summary> 正在校验数据 </summary>
[Description("正在校验数据")]
正在校验数据 = 2,
/// <summary> 数据验证通过 </summary>
[Description("数据验证通过")]
数据验证通过 = 3,
/// <summary> 数据错误 </summary>
[Description("数据错误")]
数据错误 = 4,
/// <summary> 正在生成绩效 </summary>
[Description("正在生成绩效")]
正在生成绩效 = 5,
/// <summary> 绩效下发 </summary>
[Description("绩效下发")]
绩效下发 = 6,
/// <summary> 绩效解析失败 </summary>
[Description("绩效解析失败")]
绩效解析失败 = 7,
/// <summary> 归档 </summary>
[Description("归档")]
归档 = 8,
/// <summary> 等待 </summary>
[Description("等待")]
等待 = 9,
/// <summary> 绩效结果解析成功 </summary>
[Description("数据验证通过")]
绩效结果解析成功 = 10,
}
public enum Role
{
绩效管理员 = 1,
医院管理员 = 2,
护士长 = 3,
科主任 = 4,
绩效核算办 = 5,
院领导 = 6,
财务科 = 7,
人事科 = 8,
特殊科室 = 9,
行政科室 = 10,
数据收集 = 11,
护理部审核 = 12,
绩效查询 = 13,
审计 = 14,
}
/// <summary> 核算单元类型 </summary>
public enum UnitType
{
[Description("医生组")]
医生组 = 1,
[Description("护理组")]
护理组 = 2,
[Description("医技组")]
医技组 = 3,
//[Description("专家组")]
//专家组 = 4,
//[Description("其他")]
//其他 = 5,
[Description("特殊核算组")]
特殊核算组 = 6,
[Description("其他医生组")]
其他医生组 = 7,
[Description("其他护理组")]
其他护理组 = 8,
[Description("其他医技组")]
其他医技组 = 9,
[Description("行政高层")]
行政高层 = 10,
[Description("行政中层")]
行政中层 = 11,
[Description("行政工勤")]
行政工勤 = 12,
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Performance.EntityModels
{
public class CofAccountingEntity
{
public int HospitalId { get; set; }
/// <summary>
/// 核算单元类型
/// </summary>
public string UnitType { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
/// <summary>
/// 核算单元编码
/// </summary>
public string Code { get; set; }
}
}
using Performance.EntityModels;
using System.Collections.Generic;
using System.Linq;
public class UserInfoCenter
{
public sys_user User { get; set; }
public sys_role URole { get; set; }
public List<sys_hospital> Hospitals { get; set; }
public List<int> HospitalIds => Hospitals?.Select(w => w.ID).ToList() ?? new List<int>();
public bool IsSecondAdmin { get; set; }
}
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
namespace Performance.Infrastructure
{
public static partial class UtilExtensions
{
public static bool NotNullOrEmpty<T>(this IEnumerable<T> enumerable)
{
return enumerable != null && enumerable.Any();
}
}
}
......@@ -7,6 +7,32 @@ namespace Performance.Repository
{
public partial class PerforAgsecondallotRepository : PerforRepository<ag_secondallot>
{
public IQueryable<ag_secondallot> GetSeconds(int[] hospitalIds, string[] unitType, string accountingUnit)
{
var secondallots = from ag in context.Set<ag_secondallot>()
join at in context.Set<per_allot>()
on ag.AllotId equals at.ID
where hospitalIds.Contains(at.HospitalId)
select ag;
return secondallots
.Where(w => (unitType.Contains(w.UnitType) && w.Department == accountingUnit) || unitType.Contains(w.NewUnitType) && w.NewAccountingUnit == accountingUnit);
}
public IQueryable<ag_secondallot> Get(int allotId, string[] unitType, string accountingUnit, params int[] status)
{
var secondallots = from ag in context.Set<ag_secondallot>()
where ag.AllotId == allotId
select ag;
secondallots = secondallots
.Where(w => (unitType.Contains(w.UnitType) && w.Department == accountingUnit) || unitType.Contains(w.NewUnitType) && w.NewAccountingUnit == accountingUnit);
if (status.Any())
return secondallots.Where(w => w.Status.HasValue && status.Contains(w.Status.Value));
return secondallots;
}
/// <summary>
/// 删除已提交的历史记录(ag_compute)
/// </summary>
......
using Performance.EntityModels;
using System.Collections.Generic;
using System.Linq;
namespace Performance.Repository
{
public partial class PerforCofaccountingRepository : PerforRepository<cof_accounting>
{
public List<CofAccountingEntity> GetAccounting(params int[] hospitalIds)
{
var cofAccountings = from p in context.Set<per_allot>().Where(w => hospitalIds.Contains(w.HospitalId))
join a in context.Set<cof_accounting>()
on p.ID equals a.AllotId
select new { Allot = p, Accounting = a };
return cofAccountings
.Select(w => new { w.Allot.HospitalId, w.Accounting.AccountingUnit, w.Accounting.UnitType, w.Accounting.Code })
.Distinct()
.Select(w => new CofAccountingEntity
{
HospitalId = w.HospitalId,
Code = w.Code,
UnitType = w.UnitType,
AccountingUnit = w.AccountingUnit,
})
.ToList();
}
}
}
......@@ -28,6 +28,41 @@ public bool UpdateAllotStates(int allotId, int states, string remark, int genera
allot.Generate = generate;
return Update(allot);
}
#region 先取上一个月的绩效Id
/// <summary>
/// 先取上一个月的绩效Id,若没有取最后一个月的绩效Id,若都不存在则获取allotId为-1的数据
/// </summary>
/// <param name="allot"></param>
public int GetPrevAllot(int allotId)
{
var allot = context.Set<per_allot>().FirstOrDefault(t => t.ID == allotId);
if (allot == null)
return -1;
return GetPrevAllot(allot);
}
/// <summary>
/// 先取上一个月的绩效Id,若没有取最后一个月的绩效Id,若都不存在则获取allotId为-1的数据
/// </summary>
/// <param name="allot"></param>
public int GetPrevAllot(per_allot allot)
{
var list = context.Set<per_allot>().Where(t => t.HospitalId == allot.HospitalId).ToList();
if (list == null || !list.Any(t => t.ID == allot.ID))
return -1;
list = list.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).ToList();
var index = list.IndexOf(list.First(t => t.ID == allot.ID));
// 先取上一个月的绩效Id,若没有取最后一个月的绩效Id,若都不存在则获取allotId为-1的数据
int allotId = index + 1 < list.Count ? list[index + 1].ID : list.First().ID;
if (allotId == allot.ID)
return -1;
return allotId;
}
#endregion
/// <summary>
/// 执行存储过程
......@@ -318,5 +353,25 @@ public IEnumerable<dynamic> QueryEmployee(int allotId)
}
}
}
/// <summary>
/// 验证科室核算单元、工号
/// </summary>
/// <param name="allot"></param>
public void AccoungtingVerify(int allotId)
{
using (var connection = context.Database.GetDbConnection())
{
if (connection.State != ConnectionState.Open) connection.Open();
try
{
connection.Execute("call proc_verify_accoungingunit_unittype(@allotId);", new { allotId }, commandTimeout: 60 * 60);
}
catch (Exception)
{
throw;
}
}
}
}
}
\ No newline at end of file
......@@ -391,6 +391,21 @@ public List<EmployeeReservedDto> GetEmployeeReserved(int hospitalId, int year)
return DapperQuery<EmployeeReservedDto>(sql, new { HospitalID = hospitalId, Year = year })?.ToList();
}
/// <summary>
/// 获取医院预留绩效
/// </summary>
/// <param name="hospitalId"></param>
/// <param name="year"></param>
/// <returns></returns>
public List<EmployeeReservedDto> GetEmployeeReserved(int hospitalId, int year, string[] unitTypes, string accountingUnit)
{
string sql = @"
SELECT * FROM view_allot_result_report WHERE HospitalID=@HospitalID AND Year=@Year
AND ((UnitType IN @unitTypes AND AccountingUnit = @accountingUnit) OR (NewUnitType IN @unitTypes AND NewAccountingUnit = @accountingUnit))
";
return DapperQuery<EmployeeReservedDto>(sql, new { HospitalID = hospitalId, Year = year, unitTypes, accountingUnit })?.ToList();
}
public List<view_allot_result> GetOwnerPerformance(List<int> hospitalId, string jobNumber)
{
string sql = "SELECT * FROM view_allot_result WHERE States IN (6,8) AND HospitalID IN @HospitalID AND JobNumber=@JobNumber";
......
using Microsoft.EntityFrameworkCore;
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Performance.Repository
{
public partial class PerforUserRepository : PerforRepository<sys_user>
{
/// <summary>
/// 获取用户 医院 角色 过往科室
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public UserInfoCenter GetUser(int userId)
{
var user = context.Set<sys_user>().FirstOrDefault(w => w.IsDelete == 1 && w.ID == userId);
if (user == null)
return null;
var roles = from ur in context.Set<sys_user_role>()
join r in context.Set<sys_role>() on ur.RoleID equals r.ID
where ur.UserID == user.ID
select r;
var hospitals = from uh in context.Set<sys_user_hospital>()
join h in context.Set<sys_hospital>() on uh.HospitalID equals h.ID
where uh.UserID == user.ID
select h;
var roleTypes = new int[] { (int)Role.科主任, (int)Role.护士长, (int)Role.特殊科室, (int)Role.行政科室, };
return new UserInfoCenter
{
User = user,
URole = roles.FirstOrDefault() ?? new sys_role(),
Hospitals = hospitals.ToList() ?? new List<sys_hospital>(),
IsSecondAdmin = roleTypes.Contains(roles.FirstOrDefault()?.Type ?? 0),
};
}
/// <summary>
/// 获取指定RoleType的用户
/// </summary>
/// <param name="roleType"></param>
/// <returns></returns>
public List<sys_user> GetUsersByRoleType(params int[] roleType)
{
var users = from u in context.Set<sys_user>()
join ur in context.Set<sys_user_role>() on u.ID equals ur.UserID
join r in context.Set<sys_role>() on ur.RoleID equals r.ID
select new { u, r };
return users.Where(w => roleType.Contains(w.r.Type ?? w.r.ID)).Select(w => w.u).ToList();
}
}
}
......@@ -11,7 +11,7 @@ namespace Performance.Repository
/// <summary>
/// cof_accounting Repository
/// </summary>
public class PerforCofaccountingRepository : PerforRepository<cof_accounting>
public partial class PerforCofaccountingRepository : PerforRepository<cof_accounting>
{
public PerforCofaccountingRepository(PerformanceDbContext context) : base(context)
{
......
......@@ -276,7 +276,7 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot
var pairs = new[]
{
new { Name = "医生组临床科室单元核算表", Data = doctorWorkloadData, SheetType = SheetType.ComputeDoctorAccount,
UnitTypes = new List<UnitType> { UnitType.医生组, UnitType.医技组, UnitType.专家组, UnitType.其他医技组,UnitType.其他医生组 } },
UnitTypes = new List<UnitType> { UnitType.医生组, UnitType.医技组, UnitType.其他医技组,UnitType.其他医生组 } },
new { Name = "护理组临床科室单元核算表", Data = nurseWorkloadData, SheetType = SheetType.ComputeNurseAccount,
UnitTypes = new List<UnitType> { UnitType.护理组, UnitType.其他护理组 } },
};
......@@ -298,7 +298,7 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot
var econDoctor = economicData?.FirstOrDefault(t => t.UnitType == unitType.ToString() && t.AccountingUnit == dept.AccountingUnit);
var workDoctor = info.Data.FirstOrDefault(t => t.UnitType == unitType.ToString() && t.AccountingUnit == dept.AccountingUnit);
if (UnitType.专家组 == unitType || UnitType.其他医技组 == unitType || UnitType.其他医生组 == unitType || UnitType.其他护理组 == unitType)
if (UnitType.其他医技组 == unitType || UnitType.其他医生组 == unitType || UnitType.其他护理组 == unitType)
{
econDoctor = economicData?.FirstOrDefault(t => t.AccountingUnit == dept.AccountingUnit);
workDoctor = info.Data.FirstOrDefault(t => t.AccountingUnit == dept.AccountingUnit);
......
......@@ -521,7 +521,7 @@ public void GenerateSecondAllot(per_allot allot)
List<ag_secondallot> updSecond = new List<ag_secondallot>();
List<ag_secondallot> delSecond = new List<ag_secondallot>();
var types = new List<int> { (int)UnitType.行政高层, (int)UnitType.行政中层, (int)UnitType.行政 };
var types = new List<int> { (int)UnitType.行政高层, (int)UnitType.行政中层, (int)UnitType.行政 };
//// 获取医院是否开启后勤二次分配
//var hospital = hospitalRepository.GetEntity(w => w.ID == allot.HospitalId);
//if (hospital?.IsOpenLogisticsSecondAllot != 1)
......@@ -529,7 +529,7 @@ public void GenerateSecondAllot(per_allot allot)
var accountUnit = perforResaccountRepository.GetEntities(t => t.AllotID == allot.ID && !types.Contains(t.UnitType.Value));
// 查询需要进行二次分配的行政后勤科室
var xzAccountUnit = perforResaccountRepository.GetEntities(t => t.AllotID == allot.ID && t.UnitType.Value == (int)UnitType.行政 && t.NeedSecondAllot == "是");
var xzAccountUnit = perforResaccountRepository.GetEntities(t => t.AllotID == allot.ID && t.UnitType.Value == (int)UnitType.行政 && t.NeedSecondAllot == "是");
if (xzAccountUnit != null && xzAccountUnit.Count > 0)
(accountUnit ?? new List<res_account>()).AddRange(xzAccountUnit);
......
......@@ -16,6 +16,7 @@
using System.Data;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
namespace Performance.Services
{
......@@ -30,6 +31,7 @@ public class AllotService : IAutoInjection
private IWebHostEnvironment _evn;
private ILogger<AllotService> _logger;
private readonly IMapper _mapper;
private readonly PerforUserRepository _userRepository;
private PerforPerallotRepository _allotRepository;
private IEmailService emailService;
private readonly IOptions<Application> options;
......@@ -55,6 +57,7 @@ public class AllotService : IAutoInjection
public AllotService(
IMapper mapper,
PerforUserRepository userRepository,
PerforPerallotRepository allotRepository,
BaiscNormService baiscNormService,
ImportDataService importDataService,
......@@ -85,6 +88,7 @@ public class AllotService : IAutoInjection
QueryDataService queryDataService)
{
_mapper = mapper;
_userRepository = userRepository;
_allotRepository = allotRepository;
_againallotRepository = againallotRepository;
_logger = logger;
......@@ -448,7 +452,7 @@ public void Generate(per_allot allot)
UpdateAllotStates(allot.ID, (int)AllotStates.绩效结果解析成功, EnumHelper.GetDescription(AllotStates.绩效结果解析成功), generate);
perforCofdirectorRepository.SupplementaryData(allot.ID);
// 验证科室核算单元、工号
AccoungtingVerify(allot.ID);
_allotRepository.AccoungtingVerify(allot.ID);
//补全支出费用类别
configService.SaveDrugtypeDisburse(allot.ID);
//logManageService.WriteMsg("正在生成报表数据", "正在生成报表数据", 1, allot.ID, "ReceiveMessage", true);
......@@ -494,10 +498,7 @@ public void GenerateReport(per_allot allot)
/// <param name="allot"></param>
public void AccoungtingVerify(int allotId)
{
using (IDbConnection connection = new MySqlConnection(_appConnection.Value.PerformanceConnectionString))
{
connection.Execute("call proc_verify_accoungingunit_unittype(@allotId);", new { allotId });
}
_allotRepository.AccoungtingVerify(allotId);
}
/// <summary>
......@@ -650,29 +651,19 @@ public List<log_dbug> AllotLog(per_allot allot, int type)
/// <returns></returns>
public List<EmployeeReservedDto> GetReserved(int hospitalId, int year, int userid)
{
var user = userService.GetUser(userid);
if (user == null)
throw new PerformanceException("用户信息错误");
var role = roleService.GetUserRole(userid)?.FirstOrDefault()?.Type;
if (!role.HasValue)
throw new PerformanceException("用户信息错误");
var reserveds = _reportRepository.GetEmployeeReserved(hospitalId, year);
var userInfo = _userRepository.GetUser(userid);
if (userInfo?.User == null) throw new NotImplementedException("当前用户不存在");
if (userInfo?.URole == null) throw new NotImplementedException("当前用户暂未分配角色");
if (reserveds != null && reserveds.Any())
if (userInfo.IsSecondAdmin)
{
if (role.Value == options.Value.NurseRole)
reserveds = reserveds.Where(w => UnitTypeUtil.Is(w.UnitType, UnitType.护理组, UnitType.其他护理组) && w.AccountingUnit == user.Department)?.ToList();
else if (role.Value == options.Value.DirectorRole)
reserveds = reserveds.Where(w => UnitTypeUtil.Is(w.UnitType, UnitType.医生组, UnitType.其他医生组, UnitType.医技组, UnitType.其他医技组) && w.AccountingUnit == user.Department)?.ToList();
else if (role.Value == options.Value.SpecialRole)
reserveds = reserveds.Where(w => UnitTypeUtil.Is(w.UnitType, UnitType.特殊核算组) && w.AccountingUnit == user.Department)?.ToList();
else if (role.Value == options.Value.OfficeRole)
reserveds = reserveds.Where(w => UnitTypeUtil.Is(w.UnitType, UnitType.行政中层, UnitType.行政后勤) && w.AccountingUnit == user.Department)?.ToList();
var unitTpes = UnitTypeUtil.GetMaps(userInfo?.URole.Type);
return _reportRepository.GetEmployeeReserved(hospitalId, year, unitTpes, userInfo.User.Department);
}
else
{
return _reportRepository.GetEmployeeReserved(hospitalId, year);
}
return reserveds;
}
/// <summary>
/// 查询个人绩效
......
......@@ -116,14 +116,13 @@ public ApiResponse<List<view_attendance>> GetCallIn(int allotId)
}
}
public HandsonTable GetBatchCallInHandsonTable(int allotId)
public HandsonTableBase GetBatchCallInHandsonTable(int allotId)
{
HandsonTable handson = new HandsonTable((int)SheetType.Unidentifiable, Person.Select(c => c.Item2).ToArray(), Person.Select(t => new collect_permission
HandsonTableBase handson = new HandsonTableBase()
{
HeadName = t.Item2,
Visible = 1,
Readnoly = 0
}).ToList());
Columns = Person.Select(t => new HandsonColumn(t.Item2)).ToList(),
ColHeaders = Person.Select(c => c.Item2).ToList(),
};
if (handson.Columns != null && handson.Columns.Any())
{
var cofaccounting = cofaccountingRepository.GetEntities(w => w.UnitType != "" && w.AllotId == allotId);
......@@ -133,7 +132,6 @@ public HandsonTable GetBatchCallInHandsonTable(int allotId)
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;
}
......@@ -141,16 +139,9 @@ public HandsonTable GetBatchCallInHandsonTable(int allotId)
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>();
......@@ -184,7 +175,7 @@ public HandsonTable GetBatchCallInHandsonTable(int allotId)
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
handson.SetRowData(rowDatas, rowDatas != null);
handson.SetRowData(rowDatas);
foreach (var item in handson.Data)
{
item.Remove("编号");
......@@ -386,25 +377,19 @@ public ApiResponse DeleteAttendanceType(int id)
#endregion
#region 考勤记录
public HandsonTable GetAttendanceVacationHandsonTable(int allotId)
public HandsonTableBase GetAttendanceVacationHandsonTable(int allotId)
{
HandsonTable handson = new HandsonTable((int)SheetType.Unidentifiable, Vacation.Select(c => c.Item2).ToArray(), Vacation.Select(t => new collect_permission
HandsonTableBase handson = new HandsonTableBase()
{
HeadName = t.Item2,
Visible = 1,
Readnoly = 0
}).ToList());
Columns = Vacation.Select(t => new HandsonColumn(t.Item2)).ToList(),
ColHeaders = Vacation.Select(c => c.Item2).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";
......@@ -444,7 +429,7 @@ public HandsonTable GetAttendanceVacationHandsonTable(int allotId)
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
handson.SetRowData(rowDatas, rowDatas != null);
handson.SetRowData(rowDatas);
foreach (var item in handson.Data)
{
item.Remove("编号");
......
......@@ -250,7 +250,7 @@ public IEnumerable<collect_permission> GetCollectSheet(int hospitalId, int userI
var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
if (userrole == null) return new List<collect_permission>();
if (!options.CollectRoles.Contains(userrole.RoleID))
if (!UnitTypeUtil.CollectRoles.Contains(userrole.RoleID))
{
var types = new[] { (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload, (int)SheetType.SpecialUnit };
var sheetNames = exmoduleRepository.GetEntities(w => w.HospitalId == hospitalId && types.Contains(w.SheetType ?? 0))?.Select(t => t.ModuleName).ToList() ?? new List<string>();
......@@ -560,7 +560,7 @@ private List<HandsonRowData> GetAccountExtra(per_allot allot, int sheetType, str
var unitTypes = new string[] { UnitType.医生组.ToString(), UnitType.医技组.ToString(), UnitType.护理组.ToString(), UnitType.特殊核算组.ToString() };
var departments = perforPerdeptdicRepository.GetEntities(t => t.HospitalId == allot.HospitalId && unitTypes.Contains(t.UnitType) && !string.IsNullOrEmpty(t.Department) && t.Department.Replace("无", "").Replace("/", "").Trim() != "");
var departments = perforPerdeptdicRepository.GetEntities(t => t.AllotId == allot.ID && unitTypes.Contains(t.UnitType) && !string.IsNullOrEmpty(t.Department) && t.Department.Replace("无", "").Replace("/", "").Trim() != "");
if (departments == null || !departments.Any()) return handsonRows;
var data = departments.GroupBy(t => t.Department).Select(t => new
......
......@@ -309,7 +309,7 @@ public List<DeptResponse> GetNursePerformance(int allotId)
/// <returns></returns>
public List<DeptResponse> GetOtherPerformance(int allotId)
{
return GetGroupPerformance(allotId, new List<int> { (int)UnitType.其他医技组, (int)UnitType.其他医生组, (int)UnitType.其他护理组, (int)UnitType.专家组 });
return GetGroupPerformance(allotId, new List<int> { (int)UnitType.其他医技组, (int)UnitType.其他医生组, (int)UnitType.其他护理组 });
}
public List<DeptResponse> GetGroupPerformance(int allotId, List<int> group)
{
......@@ -326,7 +326,7 @@ public List<DeptResponse> GetGroupPerformance(int allotId, List<int> group)
/// <returns></returns>
public List<DeptResponse> GetOfficePerformance(int allotId)
{
var unitType = new List<int> { (int)UnitType.行政 };
var unitType = new List<int> { (int)UnitType.行政 };
var list = perforResaccountRepository.GetEntities(t => unitType.Contains(t.UnitType.Value) && t.AllotID == allotId && t.NeedSecondAllot == "是")
?.OrderBy(t => t.UnitType)
......@@ -565,7 +565,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
#region 需要二次分配的行政科室
// 需要二次分配的行政科室
var needSecond = perforResaccountRepository.GetEntities(t => t.AllotID == allotId && t.UnitType.Value == (int)UnitType.行政 && t.NeedSecondAllot == "是") ?? new List<res_account>();
var needSecond = perforResaccountRepository.GetEntities(t => t.AllotID == allotId && t.UnitType.Value == (int)UnitType.行政 && t.NeedSecondAllot == "是") ?? new List<res_account>();
var needSecondResult = needSecond.Select(t => new DeptResponse
{
UnitName = ((UnitType)t.UnitType).ToString() == "行政后勤" ? "行政工勤" : ((UnitType)t.UnitType).ToString(),
......@@ -712,8 +712,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
enumItems.ForEach(t =>
{
t.Value = UnitTypeUtil.Is(t.Name, UnitType.护理组) ? t.Value + 2 : t.Value;
if (t.Name == UnitType.行政后勤.ToString())
t.Name = "行政工勤";
t.Name = t.Name == "行政后勤" ? UnitType.行政工勤.ToString() : t.Name;
});
result = result.OrderBy(t => enumItems.FirstOrDefault(e => e.Name == t.UnitName)?.Value).ThenBy(t => t.AccountingUnit).ToList();
......@@ -886,7 +885,7 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
// 预留比例
if (response != null)
{
var types = new string[] { UnitType.行政高层.ToString(), UnitType.行政中层.ToString(), UnitType.行政后勤.ToString(), "行政工勤" };
var types = new string[] { UnitType.行政高层.ToString(), UnitType.行政中层.ToString(), UnitType.行政工勤.ToString(), "行政后勤" };
foreach (var item in response)
{
// 二次分配默认 调节系数100%
......@@ -1512,7 +1511,7 @@ private UnitType TypeConversion(int? unitType)
{
UnitType type = (UnitType)unitType.Value;
var docUnitTypes = new List<UnitType> { UnitType.专家组, UnitType.其他医生组, UnitType.其他医技组 };
var docUnitTypes = new List<UnitType> { UnitType.其他医生组, UnitType.其他医技组 };
if (docUnitTypes.Contains(type))
type = UnitType.医生组;
else if (type == UnitType.其他护理组)
......@@ -1576,8 +1575,8 @@ public DeptDataDetails DeptOfficeDetail(int accountId)
foreach (var sheet in persheet.Where(t => t.SheetType == stype))
{
groupBasis++;
var (sheettype, amount) = CommonDepartmentDetail(basicData, sheet, UnitType.行政);
var items = CommonDetailItems(basicData, headers, sheet, UnitType.行政);
var (sheettype, amount) = CommonDepartmentDetail(basicData, sheet, UnitType.行政);
var items = CommonDetailItems(basicData, headers, sheet, UnitType.行政);
var sheetName = new Regex("[0-9]*").Replace(sheet.SheetName, "", 5).Replace(".", "").Replace(" ", "");
// 只是显示好看而已
......
......@@ -77,12 +77,12 @@ public List<CostTransferResponse> GetAuditList(int allotId, int menuType, int ro
var account = GetAccounting(allotId, roleType, Department);
Expression<Func<cost_transfer, bool>> exp = t => t.AllotId == allotId;
if (roleType == application.DirectorRole)
if (roleType == (int)Role.科主任)
if (menuType == 1)
exp = exp.And(t => new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString() }.Contains(t.ApplicantUnitType));
else
exp = exp.And(t => new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString() }.Contains(t.AdoptedUnitType));
else if (roleType == application.NurseRole)
else if (roleType == (int)Role.护士长)
if (menuType == 1)
exp = exp.And(t => t.ApplicantUnitType == UnitType.护理组.ToString());
else
......@@ -148,15 +148,11 @@ public List<CostTransferResponse> GetAuditList(int allotId, int menuType, int ro
public cof_accounting GetAccounting(int allotId, int roleType, string Department = null)
{
var unitTpes = UnitTypeUtil.GetMaps(roleType);
Expression<Func<cof_accounting, bool>> exp = t => t.AllotId == allotId && t.AccountingUnit == Department;
if (roleType == application.DirectorRole)
exp = exp.And(t => new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString() }.Contains(t.UnitType));
else if (roleType == application.NurseRole)
exp = exp.And(t => t.UnitType == UnitType.护理组.ToString());
else if (roleType == application.SpecialRole)
exp = exp.And(t => t.UnitType == UnitType.特殊核算组.ToString());
else if (roleType == application.OfficeRole)
exp = exp.And(t => t.UnitType == UnitType.行政后勤.ToString());
if (UnitTypeUtil.Maps.ContainsKey(roleType))
exp = exp.And(t => unitTpes.Contains(t.UnitType));
var account = cofaccountingRepository.GetEntity(exp);
......
......@@ -23,6 +23,7 @@ public class CustomExtractService : IAutoInjection
private readonly IOptions<Application> _options;
private readonly UserService _userService;
private readonly RoleService _roleService;
private readonly PerforUserRepository _userRepository;
private readonly PerforPerallotRepository _perallotRepository;
private readonly PerforPerdeptdicRepository _perforPerdeptdicRepository;
private readonly PerforHospitalconfigRepository _perforHospitalconfigRepository;
......@@ -34,6 +35,7 @@ public class CustomExtractService : IAutoInjection
IOptions<Application> options,
UserService userService,
RoleService roleService,
PerforUserRepository userRepository,
PerforPerallotRepository perallotRepository,
PerforPerdeptdicRepository perforPerdeptdicRepository,
PerforHospitalconfigRepository perforHospitalconfigRepository,
......@@ -44,6 +46,7 @@ public class CustomExtractService : IAutoInjection
_options = options;
_userService = userService;
_roleService = roleService;
_userRepository = userRepository;
_perallotRepository = perallotRepository;
_perforPerdeptdicRepository = perforPerdeptdicRepository;
_perforHospitalconfigRepository = perforHospitalconfigRepository;
......@@ -57,8 +60,8 @@ public bool CheckConfigScript(int userId, int allotId)
?? throw new PerformanceException("绩效ID无效");
var scripts = _perforcustscriptRepository.GetEntities(w => w.HospitalId == allot.HospitalId && w.IsEnable == 1);
scripts = (IsSecondAdmin(userId, out string[] unitType))
var center = _userRepository.GetUser(userId);
scripts = UnitTypeUtil.Maps.ContainsKey(center?.URole.Type ?? 0)
? scripts?.Where(w => w.IsSecondAllot == 1).ToList()
: scripts?.Where(w => w.IsOnceAllot == 1).ToList();
......@@ -74,9 +77,11 @@ public bool ExtractData(int userId, int allotId, out string resultFilePath)
var filePath = ExtractHelper.GetExtractFile(allot.HospitalId);
resultFilePath = filePath;
var center = _userRepository.GetUser(userId);
var scripts = _perforcustscriptRepository.GetEntities(w => w.HospitalId == allot.HospitalId && w.IsEnable == 1);
scripts = (IsSecondAdmin(userId, out string[] unitType))
scripts = UnitTypeUtil.Maps.ContainsKey(center?.URole.Type ?? 0)
? scripts?.Where(w => w.IsSecondAllot == 1).ToList()
: scripts?.Where(w => w.IsOnceAllot == 1).ToList();
......@@ -85,7 +90,7 @@ public bool ExtractData(int userId, int allotId, out string resultFilePath)
result = false;
return result;
}
var depts = _perforPerdeptdicRepository.GetEntities(w => w.HospitalId == allot.HospitalId);
var depts = _perforPerdeptdicRepository.GetEntities(w => w.AllotId == allot.ID);
IWorkbook workbook = null;
try
......@@ -132,7 +137,12 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri
?? throw new PerformanceException("当前医院没有数据库地址配置");
var parameters = GetParameters(allot);
var (isSecondAdmin, department, unitType) = GetUserDepartment(userId);
var center = _userRepository.GetUser(userId);
var isSecondAdmin = center.IsSecondAdmin;
var department = isSecondAdmin ? (center?.User.Department ?? "") : string.Empty;
var unitType = UnitTypeUtil.GetMaps(center?.URole.Type ?? 0);
parameters.Add("@department", $"'{department}'");
if (unitType != null && unitType.Any())
parameters.Add("@unittype", $"{string.Join(", ", unitType.Select(t => $"'{t}'"))}");
......@@ -196,7 +206,7 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri
if (atUnitTypeList.Any() && !string.IsNullOrEmpty(atDepartment))
{
var tempDepts = depts.Where(w => atUnitTypeList.Contains(w.UnitType) && w.HISDeptName == atDepartment);
if (isSecondAdmin && unitType.Any(w => w == UnitType.特殊核算组.ToString() || w == UnitType.行政后勤.ToString()))
if (isSecondAdmin && unitType.Any(w => w == UnitType.特殊核算组.ToString() || UnitTypeUtil.Office.Contains(w)))
{
accountUnit = tempDepts.FirstOrDefault()?.AccountingUnit ?? "";
}
......@@ -292,44 +302,5 @@ public IEnumerable<dynamic> QueryData(sys_hospitalconfig config, string execsql,
};
return pairs;
}
/// <summary>
/// 是否是二次分配管理员 是 true 否 false
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
private bool IsSecondAdmin(int userId, out string[] unitType)
{
Dictionary<int, string[]> pairs = new Dictionary<int, string[]>
{
{ _options.Value.NurseRole, new string[] { UnitType.护理组.ToString() } },
{ _options.Value.DirectorRole, new string[] { UnitType.医生组.ToString(), UnitType.医技组.ToString() } },
{ _options.Value.SpecialRole, new string[] { UnitType.特殊核算组.ToString() } },
{ _options.Value.OfficeRole, new string[] { UnitType.行政后勤.ToString() } },
};
var roleId = _roleService.GetRole(userId)?.FirstOrDefault().ID ?? 0;
if (pairs.ContainsKey(roleId))
{
unitType = pairs[roleId];
return true;
}
unitType = new string[] { };
return false;
}
/// <summary>
/// 返回二次分配管理科室 默认 返回 空值
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
private (bool isSecondAdmin, string department, string[] unitType) GetUserDepartment(int userId)
{
var user = _userService.GetUser(userId)
?? throw new PerformanceException("当前用户信息无效");
var isSecondAdmin = IsSecondAdmin(userId, out string[] unitType);
var department = isSecondAdmin ? (user.Department ?? "") : string.Empty;
return (isSecondAdmin, department, unitType);
}
}
}
......@@ -1303,14 +1303,13 @@ public List<GatherDropResponse> GetGatherDrop(int allotId)
}
public HandsonTable GetGatherHands(int AllotId, GatherRequest request)
public HandsonTableBase GetGatherHands(int AllotId, GatherRequest request)
{
var result = new HandsonTable((int)SheetType.Unidentifiable, Gather.Select(t => t.Value).ToArray(), Gather.Select(t => new collect_permission
HandsonTableBase result = new HandsonTableBase()
{
HeadName = t.Value,
Visible = 1
}).ToList());
Columns = Gather.Select(t => new HandsonColumn(t.Value)).ToList(),
ColHeaders = Gather.Select(t => t.Value).ToList(),
};
if (result.Columns != null && result.Columns.Any())
{
......@@ -1346,7 +1345,7 @@ public HandsonTable GetGatherHands(int AllotId, GatherRequest request)
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
result.SetRowData(rowDatas, rowDatas != null);
result.SetRowData(rowDatas);
return result;
}
......@@ -1546,7 +1545,7 @@ public void CheckGatherData(int allotId, SaveGatherData saveGather)
var data = saveGather.Data;
var departments = perdeptdicRepository.GetEntities(w => w.HospitalId == allot.HospitalId);
var departments = perdeptdicRepository.GetEntities(w => w.AllotId == allot.ID);
if (departments == null || !departments.Any()) throw new PerformanceException("未配置科室字典");
var notExistsDeptData = data.Where(w => !departments.Select(t => t.HISDeptName).Contains(w[0]));
......
......@@ -741,7 +741,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin
var allot = perallotRepository.GetEntity(t => t.ID == allotId);
var drugTypes = cofdrugtypeRepository.GetEntities(t => t.AllotID == allot.ID && t.HospitalId == allot.HospitalId);
var deptDic = perdeptdicRepository.GetEntities(t => t.HospitalId == allot.HospitalId);
var deptDic = perdeptdicRepository.GetEntities(t => t.AllotId == allot.ID);
var moduleSheet = exmoduleRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.SheetType == (int)SheetType.Income);
if (moduleSheet == null || !moduleSheet.Any()) return null;
......@@ -786,6 +786,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin
UnitType = defauleUnittype,
Source = source,
HospitalId = allot.HospitalId,
AllotId = allot.ID,
IsVerify = 0,
VerifyMessage = "抽取前科室校验后补增科室",
CreateUser = 1
......
......@@ -291,7 +291,7 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List<
var types = extypeRepository.GetEntities(w => w.HospitalId == hospitalId) ?? new List<ex_type>();
var dict = personService.GetDepartments(hospitalId)?.ToList();
var dict = personService.GetDepartments(allotId)?.ToList();
if (dict == null || !dict.Any())
{
return results.GroupBy(t => new { t.Department, t.Category, t.Source }).Select(t => new ExtractTransDto
......
......@@ -52,7 +52,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style,
if (departments == null || !departments.Any()) return;
var standardDict = perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId && departments.Contains(t.Department)) ?? new List<per_dept_dic>();
var standardDict = perdeptdicRepository.GetEntities(t => t.AllotId == allotId && departments.Contains(t.Department)) ?? new List<per_dept_dic>();
WriteSheetDataNonexistent(sheet, cellStyle, point, columns, departments, standardDict, costTransfers, costTransferItems);
}
......
......@@ -145,7 +145,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
IEnumerable<cof_workitem> workitems, IEnumerable<CofDrugProp> medicineProps, IEnumerable<CofDrugProp> cmis, IEnumerable<CofDrugProp> inclines, bool isDoctor = false)
{
var unittype = isDoctor
? new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString(), UnitType.专家组.ToString(), UnitType.其他医生组.ToString(), UnitType.其他医技组.ToString(), UnitType.特殊核算组.ToString() }
? new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString(), UnitType.其他医生组.ToString(), UnitType.其他医技组.ToString(), UnitType.特殊核算组.ToString() }
: new List<string> { UnitType.护理组.ToString(), UnitType.其他护理组.ToString() };
if ((medicineProps == null && cmis == null && inclines == null) || workitems == null)
......
......@@ -65,7 +65,8 @@ public List<SelectionOptions> GetReportSelection(int groupId, int userId, int ho
if (selections == null)
return options;
var isMedical = IsMedical(userId);
var userInfo = userRepository.GetUser(userId);
var isMedical = (userInfo != null && userInfo.URole.Type.HasValue && UnitTypeUtil.Maps.ContainsKey(userInfo.URole.Type.Value));
var dispaly = new int[] { (int)SelectionState.UsableAndNotDispaly, (int)SelectionState.NotUsableAndNotDispaly };
foreach (var item in selections.Where(t => t.State.HasValue && !dispaly.Contains(t.State.Value)))
......@@ -136,8 +137,9 @@ public List<ReportData> GetReportData(int hospitalId, int groupId, int reportId,
var selections = selectionRepository.GetEntities(w => arr2.Contains(w.ID) && w.State.HasValue && dispaly.Contains(w.State.Value))
?? new List<rep_selection>();
var isMedical = IsMedical(userId);
var department = GetUserDepartment(userId);
var userInfo = userRepository.GetUser(userId);
var isMedical = userInfo.IsSecondAdmin;
var department = userInfo?.User.Department ?? "";
List<ReportData> result = new List<ReportData>();
foreach (var report in reports)
......@@ -357,23 +359,6 @@ private string ReplacePlaceholder(List<rep_selection> selections, List<Selection
}
return content;
}
private bool IsMedical(int userId)
{
var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
var role = roleRepository.GetEntity(t => t.ID == userrole.RoleID);
var roleTypes = new[] { application.NurseRole, application.DirectorRole, application.SpecialRole, application.OfficeRole };
if (role.Type.HasValue && roleTypes.Contains(role.Type.Value))
return true;
else
return false;
}
private string GetUserDepartment(int userId)
{
var user = userRepository.GetEntity(t => t.ID == userId);
return user.Department;
}
}
......
......@@ -331,7 +331,7 @@ private void ImporAccountData(ISheet sheet, List<string> columns, int hospitalId
logger.LogInformation($"人均绩效计算");
Dictionary<string, string> basicDict = new Dictionary<string, string>
{
{ "行政工勤人均绩效", UnitType.行政.ToString() },
{ "行政工勤人均绩效", UnitType.行政.ToString() },
{ "临床医生人均绩效", UnitType.医生组.ToString() },
{ "医技医生人均绩效", UnitType.医技组.ToString() },
{ "护士人均绩效", UnitType.护理组.ToString() },
......@@ -757,13 +757,13 @@ public ApiResponse SaveReportPersonTag(int hospitalId, int allotId, int userId,
return new ApiResponse(ResponseType.OK);
}
public HandsonTable GetReportTag(int hospitalId)
public HandsonTableBase GetReportTag(int hospitalId)
{
var result = new HandsonTable((int)SheetType.Unidentifiable, ReportTag.Select(t => t.Value).ToArray(), ReportTag.Select(t => new collect_permission
HandsonTableBase result = new HandsonTableBase()
{
HeadName = t.Value,
Visible = 1
}).ToList());
Columns = ReportTag.Select(t => new HandsonColumn(t.Value)).ToList(),
ColHeaders = ReportTag.Select(t => t.Value).ToList(),
};
var data = reportperformancetagsRepository.GetEntities(t => t.HospitalId == hospitalId)?.OrderBy(t => t.UnitType);
if (data == null) return result;
......@@ -780,7 +780,7 @@ public HandsonTable GetReportTag(int hospitalId)
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
result.SetRowData(rowDatas, rowDatas != null);
result.SetRowData(rowDatas);
return result;
}
......
......@@ -654,7 +654,7 @@ private void SupplyHeaderByWorkItem(int hospitalId, SecondResponse result, ag_se
#region 其他模板详情
public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, int employeeSource, out decimal? realAmount)
public HandsonTableBase GetOtherTempData(int userId, int secondId, int isArchive, int employeeSource, out decimal? realAmount)
{
string[] workNumbers = new string[] { };
var details = GetOtherTempDetails(userId, secondId, isArchive, employeeSource);
......@@ -666,12 +666,11 @@ public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, in
OtherTemp.Select(t => t.Value).ToArray() :
new string[] { "可分配绩效", "科室单项奖励", "医院其他绩效", "预留年度考核比例", "年度考核发放金额", "预发绩效工资金额" };
var result = new HandsonTable((int)SheetType.Unidentifiable, OtherTemp.Select(t => t.Value).ToArray(), OtherTemp.Select(t => new collect_permission
HandsonTableBase result = new HandsonTableBase()
{
HeadName = t.Value,
Visible = 1,
Readnoly = readColumns.Contains(t.Value) ? 1 : 0
}).ToList());
Columns = OtherTemp.Select(t => new HandsonColumn(t.Value)).ToList(),
ColHeaders = OtherTemp.Select(t => t.Value).ToList(),
};
if (result.Columns != null && result.Columns.Any())
{
......@@ -707,7 +706,7 @@ public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, in
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
result.SetRowData(rowDatas, rowDatas != null);
result.SetRowData(rowDatas);
return result;
}
......@@ -739,7 +738,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
var role = _userService.GetUserFirstRole(userId);
//行政科室 只有两种逻辑,或从保存中加载,或加载EXCEL表
if (role?.Type == _application.OfficeRole)
if (role?.Type == (int)Role.行政科室)
{
// 如果已经保存>>走保存加载逻辑
if (employeeSource == (int)EmployeeSource.Initial)
......@@ -825,7 +824,7 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em
var empl = employees?.FirstOrDefault(w => w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim());
item.ReservedRatio = empl?.ReservedRatio ?? 0;
// 如果是行政后勤,则把绩效放在工作量上
if (isTitlePerformance && second.UnitType == UnitType.行政后勤.ToString())
if (isTitlePerformance && UnitTypeUtil.IsOffice(second.UnitType))
{
item.WorkPerformance = distPerformance?.Where(w => w.AccountingUnit == item.Department && w.JobNumber?.Trim() == item.WorkNumber?.Trim())?.Sum(w => w.GiveFee);
if (string.IsNullOrEmpty(item.WorkNumber))
......@@ -835,7 +834,7 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em
if (second.UnitType.Replace("其他", "").Replace("医技", "医生")
== (empl?.UnitType ?? "").Replace("其他", "").Replace("医技", "医生"))
{
if (second.UnitType == UnitType.行政后勤.ToString())
if (UnitTypeUtil.IsOffice(second.UnitType))
{
if (string.IsNullOrEmpty(item.WorkNumber))
{
......
......@@ -9,6 +9,23 @@ namespace Performance.Services
public class UnitTypeUtil
{
public static string[] Office = new string[] { "行政后勤", "行政工勤" };
/// <summary>
/// 数据收集角色(可查看所有)
/// </summary>
public static int[] CollectRoles { get; } = new int[] { (int)Role.绩效管理员, (int)Role.医院管理员, (int)Role.绩效核算办, (int)Role.院领导, (int)Role.财务科, (int)Role.人事科 };
/// <summary>
/// 二次分配角色映射表
/// </summary>
public static Dictionary<int, string[]> Maps { get; } = new Dictionary<int, string[]>
{
{ (int)Role.科主任, new string[]{ UnitType.医生组.ToString(), UnitType.其他医生组.ToString(), UnitType.医技组.ToString(), UnitType.其他医技组.ToString() } },
{ (int)Role.护士长, new string[]{ UnitType.护理组.ToString(), UnitType.其他护理组.ToString() } },
{ (int)Role.特殊科室, new string[]{ UnitType.特殊核算组.ToString(), } },
{ (int)Role.行政科室, new string[]{ UnitType.行政工勤.ToString(), "行政后勤" } },
};
public static Role[] SecondAdmin { get; } = new Role[] { Role.科主任, Role.护士长, Role.特殊科室, Role.行政科室 };
public static string[] GetMaps(int? key) => (key.HasValue && Maps.ContainsKey(key.Value)) ? Maps[key.Value] : Array.Empty<string>();
/// <summary>
/// 是否是行政后勤/工勤
......@@ -17,7 +34,7 @@ public class UnitTypeUtil
/// <returns></returns>
public static bool IsOffice(int? unit)
{
return unit == (int)UnitType.行政;
return unit == (int)UnitType.行政;
}
/// <summary>
......@@ -74,5 +91,6 @@ public static string Recognition(string name, AccountUnitType defaultValue)
return defaultValue.ToString();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment