Commit 0214a744 by 1391696987

合并

parents b2d6d463 1f9abe11
...@@ -122,7 +122,7 @@ public ApiResponse SelfInfo() ...@@ -122,7 +122,7 @@ public ApiResponse SelfInfo()
user.Role = _roleService.GetUserRole(user.UserID); user.Role = _roleService.GetUserRole(user.UserID);
user.Hospital = _hospitalService.GetUserHopital(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; user.IsAgainAdmin = user.Role != null ? roleArray.Contains(user.Role.First().Type ?? 0) : false;
return new ApiResponse(ResponseType.OK, user); return new ApiResponse(ResponseType.OK, user);
} }
...@@ -149,56 +149,56 @@ public ApiResponse<UserResponse> UpdateSelf([CustomizeValidator(RuleSet = "Self" ...@@ -149,56 +149,56 @@ public ApiResponse<UserResponse> UpdateSelf([CustomizeValidator(RuleSet = "Self"
[HttpPost] [HttpPost]
public ApiResponse<List<UserResponse>> List([FromBody] UserRequest request) 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); return new ApiResponse<List<UserResponse>>(ResponseType.OK, "ok", userList);
} }
/// <summary> ///// <summary>
/// 新增用户 ///// 新增用户
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
[Route("insert")] //[Route("insert")]
[HttpPost] //[HttpPost]
public ApiResponse<UserResponse> Insert([CustomizeValidator(RuleSet = "Insert"), FromBody] UserRequest request) //public ApiResponse<UserResponse> Insert([CustomizeValidator(RuleSet = "Insert"), FromBody] UserRequest request)
{ //{
var userId = _claim.GetUserId(); // var userId = _claim.GetUserId();
var user = _userService.Insert(request, userId); // var user = _userService.Insert(request, userId);
user.Role = request.Role; // user.Role = request.Role;
return new ApiResponse<UserResponse>(ResponseType.OK, user); // return new ApiResponse<UserResponse>(ResponseType.OK, user);
} //}
/// <summary> ///// <summary>
/// 新增用户 ///// 新增用户
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
[Route("delete")] //[Route("delete")]
[HttpPost] //[HttpPost]
public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody] UserRequest request) //public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody] UserRequest request)
{ //{
return _userService.Delete(request.ID); // return _userService.Delete(request.ID);
} //}
/// <summary> ///// <summary>
/// 删除用户 ///// 删除用户
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
[Route("update")] //[Route("update")]
[HttpPost] //[HttpPost]
public ApiResponse<UserResponse> Update([CustomizeValidator(RuleSet = "Update"), FromBody] UserRequest request) //public ApiResponse<UserResponse> Update([CustomizeValidator(RuleSet = "Update"), FromBody] UserRequest request)
{ //{
var userId = _claim.GetUserId(); // var userId = _claim.GetUserId();
int[] roleArray = new int[] { _options.NurseRole, _options.DirectorRole, _options.SpecialRole, _options.OfficeRole }; // int[] roleArray = new int[] { _options.NurseRole, _options.DirectorRole, _options.SpecialRole, _options.OfficeRole };
var roles = _roleService.GetUserRole(userId); // var roles = _roleService.GetUserRole(userId);
var isAgainAdmin = roles != null ? roleArray.Contains(roles.First().Type ?? 0) : false; // var isAgainAdmin = roles != null ? roleArray.Contains(roles.First().Type ?? 0) : false;
var user = _userService.Update(request, isAgainAdmin); // var user = _userService.Update(request, isAgainAdmin);
user.Role = request.Role; // user.Role = request.Role;
return new ApiResponse<UserResponse>(ResponseType.OK, user); // return new ApiResponse<UserResponse>(ResponseType.OK, user);
} //}
/// <summary> /// <summary>
/// 修改用户密码 /// 修改用户密码
...@@ -230,13 +230,13 @@ public ApiResponse<List<sys_role>> RoleList() ...@@ -230,13 +230,13 @@ public ApiResponse<List<sys_role>> RoleList()
/// <summary> /// <summary>
/// 科室列表 /// 科室列表
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="allotId"></param>
/// <returns></returns> /// <returns></returns>
[Route("department")] [Route("department/{allotId}")]
[HttpPost] [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); return new ApiResponse<List<TitleValue>>(ResponseType.OK, "ok", department);
} }
...@@ -311,7 +311,7 @@ public ApiResponse SelfInfos([FromBody] UserRequest request) ...@@ -311,7 +311,7 @@ public ApiResponse SelfInfos([FromBody] UserRequest request)
user.Role = _roleService.GetUsersRole(user.UserID); user.Role = _roleService.GetUsersRole(user.UserID);
user.Hospital = _hospitalService.GetUserHopital(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) if (request.Role <= 0)
user.IsAgainAdmin = user.Role != null ? roleArray.Contains(user.Role.First().Type ?? 0) : false; user.IsAgainAdmin = user.Role != null ? roleArray.Contains(user.Role.First().Type ?? 0) : false;
else else
...@@ -345,13 +345,7 @@ public ApiResponse<UserResponse> UpdateUser([CustomizeValidator(RuleSet = "Updat ...@@ -345,13 +345,7 @@ public ApiResponse<UserResponse> UpdateUser([CustomizeValidator(RuleSet = "Updat
{ {
var userId = _claim.GetUserId(); var userId = _claim.GetUserId();
int[] roleArray = new int[] { _options.NurseRole, _options.DirectorRole, _options.SpecialRole, _options.OfficeRole }; var user = _userService.UpdateUser(request, userId);
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);
user.RoleArr = request.RoleArr; user.RoleArr = request.RoleArr;
return new ApiResponse<UserResponse>(ResponseType.OK, user); return new ApiResponse<UserResponse>(ResponseType.OK, user);
} }
...@@ -391,12 +385,7 @@ public ApiResponse GetBatchUserStructrue() ...@@ -391,12 +385,7 @@ public ApiResponse GetBatchUserStructrue()
[HttpPost] [HttpPost]
public ApiResponse BatchSaveUser([CustomizeValidator(RuleSet = "Insert"), FromBody] UserCollectData data) public ApiResponse BatchSaveUser([CustomizeValidator(RuleSet = "Insert"), FromBody] UserCollectData data)
{ {
var result = _userService.SaveUserHandsFlat(data); return _userService.SaveUserHandsFlat(data);
if (result == "")
return new ApiResponse(ResponseType.OK);
else
return new ApiResponse(ResponseType.Error, result);
} }
} }
} }
\ No newline at end of file
...@@ -194,7 +194,7 @@ public ApiResponse DeptDetail([FromBody] DeptDetailRequest request) ...@@ -194,7 +194,7 @@ public ApiResponse DeptDetail([FromBody] DeptDetailRequest request)
{ {
second = _computeService.GetSecondByAccountId(request.AccountID); 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); var response = _computeService.DeptOfficeDetail(request.AccountID);
return new ApiResponse(ResponseType.OK, response); return new ApiResponse(ResponseType.OK, response);
...@@ -205,7 +205,7 @@ public ApiResponse DeptDetail([FromBody] DeptDetailRequest request) ...@@ -205,7 +205,7 @@ public ApiResponse DeptDetail([FromBody] DeptDetailRequest request)
var response = _computeService.SpecialDeptDetail(second); var response = _computeService.SpecialDeptDetail(second);
return new ApiResponse(ResponseType.OK, response); 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); var response = _computeService.DeptOfficeDetail(request.AccountID);
return new ApiResponse(ResponseType.OK, response); return new ApiResponse(ResponseType.OK, response);
......
...@@ -626,8 +626,14 @@ public ApiResponse GetAccountingList([FromBody] AccoungingRequest request) ...@@ -626,8 +626,14 @@ public ApiResponse GetAccountingList([FromBody] AccoungingRequest request)
[HttpPost] [HttpPost]
public ApiResponse AccountingInsert([FromBody] cof_accounting request) public ApiResponse AccountingInsert([FromBody] cof_accounting request)
{ {
if (request.AllotId == 0 || string.IsNullOrEmpty(request.Code) || string.IsNullOrEmpty(request.UnitType) || string.IsNullOrEmpty(request.AccountingUnit)) if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数不允许为空"); 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); var drugprop = _configService.AccountingInsert(request);
return new ApiResponse(ResponseType.OK, drugprop); return new ApiResponse(ResponseType.OK, drugprop);
...@@ -642,9 +648,16 @@ public ApiResponse AccountingInsert([FromBody] cof_accounting request) ...@@ -642,9 +648,16 @@ public ApiResponse AccountingInsert([FromBody] cof_accounting request)
[HttpPost] [HttpPost]
public ApiResponse AccountingUpdate([FromBody] cof_accounting request) 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); 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); var drugprop = _configService.AccountingUpdate(request);
return new ApiResponse(ResponseType.OK, drugprop); return new ApiResponse(ResponseType.OK, drugprop);
} }
...@@ -686,8 +699,8 @@ public ApiResponse BatchAccountingStructrue([FromRoute] int allotId) ...@@ -686,8 +699,8 @@ public ApiResponse BatchAccountingStructrue([FromRoute] int allotId)
[HttpPost] [HttpPost]
public ApiResponse BatchCheckAccounting(int allotId) public ApiResponse BatchCheckAccounting(int allotId)
{ {
_configService.BatchCheckAccounting(allotId); _allotService.AccoungtingVerify(allotId);
return new ApiResponse(ResponseType.OK, "校验通过"); return new ApiResponse(ResponseType.OK, "校验完成");
} }
/// <summary> /// <summary>
...@@ -700,11 +713,7 @@ public ApiResponse BatchCheckAccounting(int allotId) ...@@ -700,11 +713,7 @@ public ApiResponse BatchCheckAccounting(int allotId)
[HttpPost] [HttpPost]
public ApiResponse BatchSaveAccounting(int allotId, [FromBody] SaveCollectData request) public ApiResponse BatchSaveAccounting(int allotId, [FromBody] SaveCollectData request)
{ {
var result = _configService.BatchSaveAccounting(allotId, request); return _configService.BatchSaveAccounting(allotId, request);
if (result)
return new ApiResponse(ResponseType.OK);
else
return new ApiResponse(ResponseType.Error, "请选择正确的核算组别");
} }
...@@ -859,14 +868,15 @@ public ApiResponse CopyDropDown() ...@@ -859,14 +868,15 @@ public ApiResponse CopyDropDown()
{ {
var result = new List<CopyDrop> var result = new List<CopyDrop>
{ {
new CopyDrop{Label="核算单元及组别",Value="accountings"},
new CopyDrop{Label="科室字典",Value="department"},
new CopyDrop{Label="人员字典",Value="personnels"}, new CopyDrop{Label="人员字典",Value="personnels"},
new CopyDrop{Label="工作量配置",Value="workItems"}, new CopyDrop{Label="工作量配置",Value="workItems"},
new CopyDrop{Label="收入费用类别",Value="drugTypes"}, //new CopyDrop{Label="收入费用类别",Value="drugTypes"},
new CopyDrop{Label="支出费用类别",Value="drugTypeDisburses"}, new CopyDrop{Label="支出费用类别",Value="drugTypeDisburses"},
new CopyDrop{Label="费用类别系数",Value="drugTypeFactors"}, new CopyDrop{Label="费用类别系数",Value="drugTypeFactors"},
/* new CopyDrop{Label="科室类型",Value="deptTypes"},*/ //new CopyDrop{Label="科室类型",Value="deptTypes"},
new CopyDrop{Label="二次绩效配置",Value="agains"}, new CopyDrop{Label="二次绩效配置",Value="agains"},
new CopyDrop{Label="核算单元及组别",Value="accountings"},
}; ; }; ;
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
} }
......
...@@ -129,13 +129,13 @@ public IActionResult DownloadCurrentCalculationTable([FromRoute] int allotId) ...@@ -129,13 +129,13 @@ public IActionResult DownloadCurrentCalculationTable([FromRoute] int allotId)
/// <summary> /// <summary>
/// 获取所有科室记录 /// 获取所有科室记录
/// </summary> /// </summary>
/// <param name="hospitalId"></param> /// <param name="allotId"></param>
/// <returns></returns> /// <returns></returns>
[Route("deptdic/list/{hospitalId}")] [Route("deptdic/list/{allotId}")]
[HttpPost] [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); return new ApiResponse(ResponseType.OK, list);
} }
...@@ -191,17 +191,17 @@ public ApiResponse DeleteDeptDic([FromBody] DeptdicResponse request) ...@@ -191,17 +191,17 @@ public ApiResponse DeleteDeptDic([FromBody] DeptdicResponse request)
/// <summary> /// <summary>
/// 系统/标准科室字典 /// 系统/标准科室字典
/// </summary> /// </summary>
/// <param name="hospitalId">医院Id</param> /// <param name="allotId">allotId</param>
/// <param name="type">1系统科室 2标准科室 3核算单元 4行政后勤 5特殊核算组</param> /// <param name="type">1系统科室 2标准科室 3核算单元 4行政后勤 5特殊核算组</param>
/// <returns></returns> /// <returns></returns>
[Route("deptdic/{hospitalId}/dict/{type}")] [Route("deptdic/{allotId}/dict/{type}")]
[HttpPost] [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)) if (!new int[] { 1, 2, 3, 4, 5 }.Contains(type))
return new ApiResponse(ResponseType.ParameterError, "参数错误!"); return new ApiResponse(ResponseType.ParameterError, "参数错误!");
var result = personService.DeptDics(hospitalId, type); var result = personService.DeptDics(allotId, type);
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
} }
...@@ -234,10 +234,10 @@ public ApiResponse DeptIncomeDetail([CustomizeValidator(RuleSet = "Select"), Fro ...@@ -234,10 +234,10 @@ public ApiResponse DeptIncomeDetail([CustomizeValidator(RuleSet = "Select"), Fro
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[Route("person/GetBatchPersonStructrue/{hospitalId}")] [Route("person/GetBatchPersonStructrue/{allotId}")]
public ApiResponse GetBatchPersonStructrue(int hospitalId) public ApiResponse GetBatchPersonStructrue(int allotId)
{ {
var result = personService.GetBatchPersonStructrue(hospitalId); var result = personService.GetBatchPersonStructrue(allotId);
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
} }
...@@ -257,10 +257,10 @@ public ApiResponse BathSavePerson(int allotId, int hospitalId, SaveCollectData r ...@@ -257,10 +257,10 @@ public ApiResponse BathSavePerson(int allotId, int hospitalId, SaveCollectData r
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[Route("dept/GetDeptStructrue/{hospitalId}")] [Route("dept/GetDeptStructrue/{allotId}")]
public ApiResponse GetDeptStructrue(int hospitalId) public ApiResponse GetDeptStructrue(int allotId)
{ {
var result = personService.GetDepartmentHands(hospitalId); var result = personService.GetDepartmentHands(allotId);
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
} }
...@@ -269,10 +269,10 @@ public ApiResponse GetDeptStructrue(int hospitalId) ...@@ -269,10 +269,10 @@ public ApiResponse GetDeptStructrue(int hospitalId)
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[Route("dept/SaveDeptHands/{hospitalId}")] [Route("dept/SaveDeptHands/{allotId}")]
public ApiResponse SaveDeptHands(int hospitalId, SaveCollectData request) public ApiResponse SaveDeptHands(int allotId, SaveCollectData request)
{ {
personService.SaveDeptDicHands(hospitalId, request); personService.SaveDeptDicHands(allotId, request);
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
......
...@@ -767,6 +767,9 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request) ...@@ -767,6 +767,9 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request)
var second = secondAllotService.GetSecondAllot(request.SecondId); var second = secondAllotService.GetSecondAllot(request.SecondId);
if (second == null) throw new PerformanceException("参数SecondId无效!"); if (second == null) throw new PerformanceException("参数SecondId无效!");
if (second.Status == (int)SecondAllot.Status.等待审核 || second.Status == (int)SecondAllot.Status.审核通过)
throw new PerformanceException("保存失败,当前二次分配已提交!");
var allot = _allotService.GetAllot(second.AllotId.Value); var allot = _allotService.GetAllot(second.AllotId.Value);
if (allot == null) if (allot == null)
throw new PerformanceException("绩效记录不存在!"); throw new PerformanceException("绩效记录不存在!");
......
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
"ExpirationMinutes": "1200", "ExpirationMinutes": "1200",
//验证码过期 //验证码过期
"SmsCodeMinutes": "5", "SmsCodeMinutes": "5",
//护士长二次绩效管理员 ////护士长二次绩效管理员
"NurseRole": "3", //"NurseRole": "3",
//科主任二次绩效管理员 ////科主任二次绩效管理员
"DirectorRole": "4", //"DirectorRole": "4",
//特殊科室二次绩效管理员 ////特殊科室二次绩效管理员
"SpecialRole": "9", //"SpecialRole": "9",
//数据收集角色(可查看所有) ////数据收集角色(可查看所有)
"CollectRoles": [ 1, 2, 5, 6, 7, 8 ], //"CollectRoles": [ 1, 2, 5, 6, 7, 8 ],
// 抽取结果Excel文件保存地址 // 抽取结果Excel文件保存地址
"AbsolutePath": "E:\\wwwroot\\testjx.suvalue.com", "AbsolutePath": "E:\\wwwroot\\testjx.suvalue.com",
// 抽取结果Excel文件保存地址 更替的 网络地址 // 抽取结果Excel文件保存地址 更替的 网络地址
......
...@@ -49,27 +49,6 @@ ...@@ -49,27 +49,6 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </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)"> <member name="M:Performance.Api.Controllers.AccountController.Password(Performance.DtoModels.PasswordRequest)">
<summary> <summary>
修改用户密码 修改用户密码
...@@ -83,11 +62,11 @@ ...@@ -83,11 +62,11 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.AccountController.Department(Performance.DtoModels.SetDepartmentRequest)"> <member name="M:Performance.Api.Controllers.AccountController.Department(System.Int32)">
<summary> <summary>
科室列表 科室列表
</summary> </summary>
<param name="request"></param> <param name="allotId"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.AccountController.DemoUsers"> <member name="M:Performance.Api.Controllers.AccountController.DemoUsers">
...@@ -149,31 +128,6 @@ ...@@ -149,31 +128,6 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:Performance.Api.Controllers.AgainAllotController">
<summary>
科室二次分配
</summary>
</member>
<member name="M:Performance.Api.Controllers.AgainAllotController.AllotList">
<summary>
返回当前用户医院下绩效列表
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AgainAllotController.Import(Microsoft.AspNetCore.Http.IFormCollection)">
<summary>
上传文件
</summary>
<param name="form"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AgainAllotController.Detail(Performance.DtoModels.AgainAllotRequest)">
<summary>
查看绩效详情
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AllotController.List(Performance.DtoModels.AllotRequest)"> <member name="M:Performance.Api.Controllers.AllotController.List(Performance.DtoModels.AllotRequest)">
<summary> <summary>
绩效列表 绩效列表
...@@ -1765,7 +1719,7 @@ ...@@ -1765,7 +1719,7 @@
<summary> <summary>
获取所有科室记录 获取所有科室记录
</summary> </summary>
<param name="hospitalId"></param> <param name="allotId"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.PersonController.CreateDeptDic(Performance.EntityModels.per_dept_dic)"> <member name="M:Performance.Api.Controllers.PersonController.CreateDeptDic(Performance.EntityModels.per_dept_dic)">
...@@ -1793,7 +1747,7 @@ ...@@ -1793,7 +1747,7 @@
<summary> <summary>
系统/标准科室字典 系统/标准科室字典
</summary> </summary>
<param name="hospitalId">医院Id</param> <param name="allotId">allotId</param>
<param name="type">1系统科室 2标准科室 3核算单元 4行政后勤 5特殊核算组</param> <param name="type">1系统科室 2标准科室 3核算单元 4行政后勤 5特殊核算组</param>
<returns></returns> <returns></returns>
</member> </member>
......
...@@ -34,31 +34,6 @@ ...@@ -34,31 +34,6 @@
短信模板 短信模板
</summary> </summary>
</member> </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"> <member name="P:Performance.DtoModels.AppSettings.Application.Receiver">
<summary> <summary>
邮件指定接收人 邮件指定接收人
...@@ -130,39 +105,6 @@ ...@@ -130,39 +105,6 @@
<member name="F:Performance.DtoModels.DbSrouceType.Performance"> <member name="F:Performance.DtoModels.DbSrouceType.Performance">
<summary> 绩效库 </summary> <summary> 绩效库 </summary>
</member> </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"> <member name="F:Performance.DtoModels.AgWorkloadType.PreAccountingReward">
<summary> <summary>
核算前奖励 核算前奖励
...@@ -735,9 +677,6 @@ ...@@ -735,9 +677,6 @@
是否需要二次分配 是否需要二次分配
</summary> </summary>
</member> </member>
<member name="T:Performance.DtoModels.UnitType">
<summary> 核算单元类型 </summary>
</member>
<member name="F:Performance.DtoModels.SheetType.Unidentifiable"> <member name="F:Performance.DtoModels.SheetType.Unidentifiable">
<summary> 无法识别 </summary> <summary> 无法识别 </summary>
</member> </member>
...@@ -3414,6 +3353,16 @@ ...@@ -3414,6 +3353,16 @@
核算单元 核算单元
</summary> </summary>
</member> </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"> <member name="P:Performance.DtoModels.EmployeeReservedDto.EmployeeName">
<summary> <summary>
人员姓名 人员姓名
......
...@@ -1085,6 +1085,21 @@ ...@@ -1085,6 +1085,21 @@
科室类型 科室类型
</summary> </summary>
</member> </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"> <member name="P:Performance.EntityModels.ag_secondallot.Year">
<summary> <summary>
...@@ -1095,11 +1110,6 @@ ...@@ -1095,11 +1110,6 @@
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ag_secondallot.Department">
<summary>
科室
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.RealGiveFee"> <member name="P:Performance.EntityModels.ag_secondallot.RealGiveFee">
<summary> <summary>
科室实发金额 科室实发金额
...@@ -6605,11 +6615,6 @@ ...@@ -6605,11 +6615,6 @@
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.per_dept_dic.AllotId">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.per_dept_dic.HISDeptName"> <member name="P:Performance.EntityModels.per_dept_dic.HISDeptName">
<summary> <summary>
his系统科室名称 his系统科室名称
...@@ -6640,6 +6645,11 @@ ...@@ -6640,6 +6645,11 @@
医院Id 医院Id
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.per_dept_dic.AllotId">
<summary>
AllotId
</summary>
</member>
<member name="P:Performance.EntityModels.per_dept_dic.IsVerify"> <member name="P:Performance.EntityModels.per_dept_dic.IsVerify">
<summary> <summary>
0 未通过验证 1 通过验证 0 未通过验证 1 通过验证
...@@ -8670,6 +8680,16 @@ ...@@ -8670,6 +8680,16 @@
父级ID 父级ID
</summary> </summary>
</member> </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"> <member name="T:Performance.EntityModels.sys_user_hospital">
<summary> <summary>
...@@ -8865,6 +8885,21 @@ ...@@ -8865,6 +8885,21 @@
</summary> </summary>
</member> </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"> <member name="P:Performance.EntityModels.Other.view_attendance.UnitType">
<summary> <summary>
人员类别 人员类别
...@@ -9065,5 +9100,41 @@ ...@@ -9065,5 +9100,41 @@
预留金额 预留金额
</summary> </summary>
</member> </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> </members>
</doc> </doc>
...@@ -18,26 +18,26 @@ public class Application ...@@ -18,26 +18,26 @@ public class Application
/// 短信模板 /// 短信模板
/// </summary> /// </summary>
public string SmsTemplate { get; set; } public string SmsTemplate { get; set; }
/// <summary> ///// <summary>
/// 护士长二次绩效管理员 ///// 护士长二次绩效管理员
/// </summary> ///// </summary>
public int NurseRole { get; set; } //public int NurseRole { get; set; }
/// <summary> ///// <summary>
/// 科主任二次绩效管理员 ///// 科主任二次绩效管理员
/// </summary> ///// </summary>
public int DirectorRole { get; set; } //public int DirectorRole { get; set; }
/// <summary> ///// <summary>
/// 特殊科室二次绩效管理员 ///// 特殊科室二次绩效管理员
/// </summary> ///// </summary>
public int SpecialRole { get; set; } //public int SpecialRole { get; set; }
/// <summary> ///// <summary>
/// 数据收集角色(可查看所有) ///// 数据收集角色(可查看所有)
/// </summary> ///// </summary>
public int[] CollectRoles { get; set; } //public int[] CollectRoles { get; set; }
/// <summary> ///// <summary>
/// 行政科室二次绩效管理员 ///// 行政科室二次绩效管理员
/// </summary> ///// </summary>
public int OfficeRole { get; set; } //public int OfficeRole { get; set; }
/// <summary> /// <summary>
/// 邮件指定接收人 /// 邮件指定接收人
/// </summary> /// </summary>
......
...@@ -67,7 +67,7 @@ public AutoMapperConfigs() ...@@ -67,7 +67,7 @@ public AutoMapperConfigs()
CreateMap<PerData, im_data>() CreateMap<PerData, im_data>()
.ForMember(dest => dest.IsFactor, opt => opt.MapFrom(src => src.IsFactor ? 1 : 2)) .ForMember(dest => dest.IsFactor, opt => opt.MapFrom(src => src.IsFactor ? 1 : 2))
.ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => EnumHelper.GetItems<UnitType>().FirstOrDefault(t => t.Name == src.UnitType.Replace("行政工勤", "行政后勤")).Value)); .ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => EnumHelper.GetItems<UnitType>().FirstOrDefault(t => t.Name == src.UnitType).Value));
CreateMap<im_header, PerHeader>() CreateMap<im_header, PerHeader>()
.ForMember(dest => dest.IsMerge, opt => opt.MapFrom(src => src.IsMerge == 1 ? true : false)); .ForMember(dest => dest.IsMerge, opt => opt.MapFrom(src => src.IsMerge == 1 ? true : false));
...@@ -107,7 +107,7 @@ public AutoMapperConfigs() ...@@ -107,7 +107,7 @@ public AutoMapperConfigs()
//CreateMap<PerDataAccountBaisc, im_accountbasic>(); //CreateMap<PerDataAccountBaisc, im_accountbasic>();
//CreateMap<im_accountbasic, PerDataAccountBaisc>(); //CreateMap<im_accountbasic, PerDataAccountBaisc>();
CreateMap<PerDataAccountBaisc, im_accountbasic>() CreateMap<PerDataAccountBaisc, im_accountbasic>()
.ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => EnumHelper.GetItems<UnitType>().First(t => t.Name == src.UnitType.Replace("行政工勤", "行政后勤")).Value)) .ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => EnumHelper.GetItems<UnitType>().First(t => t.Name == src.UnitType).Value))
.ForMember(dest => dest.DoctorAccountingUnit, opt => opt.MapFrom(src => src.AccountingUnit)) .ForMember(dest => dest.DoctorAccountingUnit, opt => opt.MapFrom(src => src.AccountingUnit))
//.ForMember(dest => dest.Department, opt => opt.MapFrom(src => src.Department)) //.ForMember(dest => dest.Department, opt => opt.MapFrom(src => src.Department))
//.ForMember(dest => dest.DoctorDirectorNumber, opt => opt.MapFrom(src => src.ManagerNumber)) //.ForMember(dest => dest.DoctorDirectorNumber, opt => opt.MapFrom(src => src.ManagerNumber))
...@@ -148,7 +148,7 @@ public AutoMapperConfigs() ...@@ -148,7 +148,7 @@ public AutoMapperConfigs()
CreateMap<res_account, PerDataAccountBaisc>() CreateMap<res_account, PerDataAccountBaisc>()
.ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => src.UnitType.HasValue ? ((UnitType)src.UnitType).ToString() : "")); .ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => src.UnitType.HasValue ? ((UnitType)src.UnitType).ToString() : ""));
CreateMap<PerDataAccountBaisc, res_account>() CreateMap<PerDataAccountBaisc, res_account>()
.ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => string.IsNullOrEmpty(src.UnitType) ? -1 : EnumHelper.GetItems<UnitType>().First(t => t.Name == src.UnitType.Replace("行政工勤", "行政后勤")).Value)); .ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => string.IsNullOrEmpty(src.UnitType) ? -1 : EnumHelper.GetItems<UnitType>().First(t => t.Name == src.UnitType).Value));
//CreateMap<PerDataAccountBaisc, res_accountnurse>(); //CreateMap<PerDataAccountBaisc, res_accountnurse>();
//CreateMap<res_accountdoctor, ComputeSource>(); //CreateMap<res_accountdoctor, ComputeSource>();
......
...@@ -45,42 +45,6 @@ public enum DbSrouceType ...@@ -45,42 +45,6 @@ public enum DbSrouceType
Performance = 2, 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 public enum AgWorkloadType
{ {
...@@ -119,24 +83,6 @@ public enum DataFormat ...@@ -119,24 +83,6 @@ public enum DataFormat
日期YYYYMMDD 日期YYYYMMDD
} }
public enum Role
{
绩效管理员 = 1,
医院管理员 = 2,
护士长 = 3,
科主任 = 4,
绩效核算办 = 5,
院领导 = 6,
财务科 = 7,
人事科 = 8,
特殊科室 = 9,
行政科室 = 10,
数据收集 = 11,
护理部审核 = 12,
绩效查询 = 13,
审计 = 14,
}
public class Background public class Background
{ {
public enum JobType public enum JobType
...@@ -156,6 +102,7 @@ public enum Status ...@@ -156,6 +102,7 @@ public enum Status
超时 = 99, 超时 = 99,
} }
} }
public class Attendance public class Attendance
{ {
public enum Type public enum Type
...@@ -169,7 +116,17 @@ public enum Deduction ...@@ -169,7 +116,17 @@ public enum Deduction
核减 = 1, 核减 = 1,
不核减 = 2, 不核减 = 2,
} }
}
public class SecondAllot
{
public enum Status
{
未提交 = 1,
等待审核 = 2,
审核通过 = 3,
驳回 = 4,
}
} }
public enum AuditGatherEnum public enum AuditGatherEnum
......
...@@ -20,6 +20,28 @@ public HandsonTableBase() ...@@ -20,6 +20,28 @@ public HandsonTableBase()
public List<Dictionary<string, object>> Data { get; set; } public List<Dictionary<string, object>> Data { get; set; }
public List<HandsonColumn> Columns { get; set; } public List<HandsonColumn> Columns { get; set; }
public object[] NestedHeadersArray { 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 public class HandsonTable : HandsonTableBase
...@@ -95,17 +117,6 @@ private void InitColumns(List<collect_permission> permissions) ...@@ -95,17 +117,6 @@ private void InitColumns(List<collect_permission> permissions)
} }
Columns = columns; 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 public class HandsonColumn
......
...@@ -11,44 +11,6 @@ public enum ExcelVersion ...@@ -11,44 +11,6 @@ public enum ExcelVersion
xls 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 public enum SheetType
{ {
......
...@@ -6,6 +6,7 @@ namespace Performance.DtoModels ...@@ -6,6 +6,7 @@ namespace Performance.DtoModels
{ {
public class DeptdicResponse public class DeptdicResponse
{ {
public int AllotId { get; set; }
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; }
......
...@@ -27,6 +27,16 @@ public class EmployeeReservedDto ...@@ -27,6 +27,16 @@ public class EmployeeReservedDto
public string AccountingUnit { get; set; } public string AccountingUnit { get; set; }
/// <summary> /// <summary>
///
/// </summary>
public string NewUnitType { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string NewAccountingUnit { get; set; }
/// <summary>
/// 人员姓名 /// 人员姓名
/// </summary> /// </summary>
public string EmployeeName { get; set; } public string EmployeeName { get; set; }
......
...@@ -75,5 +75,13 @@ public class sys_user ...@@ -75,5 +75,13 @@ public class sys_user
/// 父级ID /// 父级ID
/// </summary> /// </summary>
public Nullable<int> ParentID { get; set; } 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 ...@@ -34,6 +34,21 @@ public class ag_secondallot
public string UnitType { get; set; } public string UnitType { get; set; }
/// <summary> /// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 变更核算组别
/// </summary>
public string NewUnitType { get; set; }
/// <summary>
/// 变更核算单元
/// </summary>
public string NewAccountingUnit { get; set; }
/// <summary>
/// 年 /// 年
/// </summary> /// </summary>
public Nullable<int> Year { get; set; } public Nullable<int> Year { get; set; }
...@@ -44,11 +59,6 @@ public class ag_secondallot ...@@ -44,11 +59,6 @@ public class ag_secondallot
public Nullable<int> Month { get; set; } public Nullable<int> Month { get; set; }
/// <summary> /// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 科室实发金额 /// 科室实发金额
/// </summary> /// </summary>
public Nullable<decimal> RealGiveFee { get; set; } public Nullable<decimal> RealGiveFee { get; set; }
......
...@@ -20,10 +20,6 @@ public class per_dept_dic ...@@ -20,10 +20,6 @@ public class per_dept_dic
/// </summary> /// </summary>
[Key] [Key]
public int Id { get; set; } public int Id { get; set; }
/// <summary>
///
/// </summary>
public int AllotId { get; set; }
/// <summary> /// <summary>
/// his系统科室名称 /// his系统科室名称
...@@ -54,6 +50,10 @@ public class per_dept_dic ...@@ -54,6 +50,10 @@ public class per_dept_dic
/// 医院Id /// 医院Id
/// </summary> /// </summary>
public Nullable<int> HospitalId { get; set; } public Nullable<int> HospitalId { get; set; }
/// <summary>
/// AllotId
/// </summary>
public Nullable<int> AllotId { get; set; }
/// <summary> /// <summary>
/// 0 未通过验证 1 通过验证 /// 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();
}
}
}
using Performance.EntityModels; using Performance.EntityModels;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -6,6 +7,32 @@ namespace Performance.Repository ...@@ -6,6 +7,32 @@ namespace Performance.Repository
{ {
public partial class PerforAgsecondallotRepository : PerforRepository<ag_secondallot> 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> /// <summary>
/// 删除已提交的历史记录(ag_compute) /// 删除已提交的历史记录(ag_compute)
/// </summary> /// </summary>
...@@ -42,5 +69,11 @@ public List<view_second_compute_collect> GetComputeBySecond(int secondId) ...@@ -42,5 +69,11 @@ public List<view_second_compute_collect> GetComputeBySecond(int secondId)
return new List<view_second_compute_collect>(); return new List<view_second_compute_collect>();
} }
public int Submit(int secondId, int tempId, decimal realGiveFee, int submitType, string remark = "")
{
string sql = "UPDATE ag_secondallot SET UseTempId = @tempId,NursingDeptStatus = @status, Status = @status, SubmitType = @submitType,SubmitTime = @date, Remark = @remark WHERE Id = @secondId AND RealGiveFee = @fee";
return Execute(sql, new { secondId, tempId, status = 2, date = DateTime.Now, fee = realGiveFee, submitType, remark });
}
} }
} }
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 ...@@ -28,6 +28,41 @@ public bool UpdateAllotStates(int allotId, int states, string remark, int genera
allot.Generate = generate; allot.Generate = generate;
return Update(allot); 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> /// <summary>
/// 执行存储过程 /// 执行存储过程
...@@ -318,5 +353,25 @@ public IEnumerable<dynamic> QueryEmployee(int allotId) ...@@ -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) ...@@ -391,6 +391,21 @@ public List<EmployeeReservedDto> GetEmployeeReserved(int hospitalId, int year)
return DapperQuery<EmployeeReservedDto>(sql, new { HospitalID = hospitalId, Year = year })?.ToList(); 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) 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"; 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 ...@@ -11,7 +11,7 @@ namespace Performance.Repository
/// <summary> /// <summary>
/// cof_accounting Repository /// cof_accounting Repository
/// </summary> /// </summary>
public class PerforCofaccountingRepository : PerforRepository<cof_accounting> public partial class PerforCofaccountingRepository : PerforRepository<cof_accounting>
{ {
public PerforCofaccountingRepository(PerformanceDbContext context) : base(context) public PerforCofaccountingRepository(PerformanceDbContext context) : base(context)
{ {
......
...@@ -276,7 +276,7 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot ...@@ -276,7 +276,7 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot
var pairs = new[] var pairs = new[]
{ {
new { Name = "医生组临床科室单元核算表", Data = doctorWorkloadData, SheetType = SheetType.ComputeDoctorAccount, 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, new { Name = "护理组临床科室单元核算表", Data = nurseWorkloadData, SheetType = SheetType.ComputeNurseAccount,
UnitTypes = new List<UnitType> { UnitType.护理组, UnitType.其他护理组 } }, UnitTypes = new List<UnitType> { UnitType.护理组, UnitType.其他护理组 } },
}; };
...@@ -298,7 +298,7 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot ...@@ -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 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); 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); econDoctor = economicData?.FirstOrDefault(t => t.AccountingUnit == dept.AccountingUnit);
workDoctor = info.Data.FirstOrDefault(t => t.AccountingUnit == dept.AccountingUnit); workDoctor = info.Data.FirstOrDefault(t => t.AccountingUnit == dept.AccountingUnit);
...@@ -306,7 +306,9 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot ...@@ -306,7 +306,9 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot
if (UnitType.医技组 == unitType && workDoctor == null) if (UnitType.医技组 == unitType && workDoctor == null)
workDoctor = info.Data.FirstOrDefault(t => t.UnitType == UnitType.医生组.ToString() && t.AccountingUnit == dept.AccountingUnit); workDoctor = info.Data.FirstOrDefault(t => t.UnitType == UnitType.医生组.ToString() && t.AccountingUnit == dept.AccountingUnit);
// 夜班绩效 从医院奖罚的明细项中获取 // 夜班绩效 从医院奖罚的明细项中获取
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0; // 2022-03-16 wufeifei
string[] nightShiftTexts = new string[] { "夜班绩效", "夜班工作量", "夜班工作量奖励" };
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && nightShiftTexts.Contains(w.TypeName?.Trim()))?.CellValue ?? 0;
dept.NightShiftWorkPerforFee = nightShift; dept.NightShiftWorkPerforFee = nightShift;
//dept.MedicineFactor = workDoctor?.MedicineFactor; //dept.MedicineFactor = workDoctor?.MedicineFactor;
...@@ -388,7 +390,9 @@ public void ComputeOffice(per_allot allot, PerExcel excel) ...@@ -388,7 +390,9 @@ public void ComputeOffice(per_allot allot, PerExcel excel)
if (UnitTypeUtil.IsOffice(resAccount?.UnitType) && dept.NeedSecondAllot == "是") if (UnitTypeUtil.IsOffice(resAccount?.UnitType) && dept.NeedSecondAllot == "是")
{ {
// 夜班绩效 从医院奖罚的明细项中获取 // 夜班绩效 从医院奖罚的明细项中获取
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == resAccount?.UnitType && w.AccountingUnit == dept.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0; // 2022-03-16 wufeifei
string[] nightShiftTexts = new string[] { "夜班绩效", "夜班工作量", "夜班工作量奖励" };
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && nightShiftTexts.Contains(w.TypeName?.Trim()))?.CellValue ?? 0;
dept.NightShiftWorkPerforFee = nightShift; dept.NightShiftWorkPerforFee = nightShift;
dept.ScoringAverage = resAccount?.ScoringAverage == null ? 0 : resAccount.ScoringAverage; dept.ScoringAverage = resAccount?.ScoringAverage == null ? 0 : resAccount.ScoringAverage;
......
...@@ -167,7 +167,9 @@ public void SpecialUnitCompute(PerExcel excel, per_allot allot, List<res_baiscno ...@@ -167,7 +167,9 @@ public void SpecialUnitCompute(PerExcel excel, per_allot allot, List<res_baiscno
//var scoreAverage = accountScoreAverages?.FirstOrDefault(w => w.UnitType == UnitType.特殊核算组.ToString() && w.AccountingUnit == dept?.AccountingUnit)?.TotelValue; //var scoreAverage = accountScoreAverages?.FirstOrDefault(w => w.UnitType == UnitType.特殊核算组.ToString() && w.AccountingUnit == dept?.AccountingUnit)?.TotelValue;
// 夜班绩效 从医院奖罚的明细项中获取 // 夜班绩效 从医院奖罚的明细项中获取
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept?.UnitType && w.AccountingUnit == dept?.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0; // 2022-03-16 wufeifei
string[] nightShiftTexts = new string[] { "夜班绩效", "夜班工作量", "夜班工作量奖励" };
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && nightShiftTexts.Contains(w.TypeName?.Trim()))?.CellValue ?? 0;
decimal? headcount = null; decimal? headcount = null;
if (typeList.Any(o => o.Description == item.QuantitativeIndicators)) if (typeList.Any(o => o.Description == item.QuantitativeIndicators))
...@@ -519,7 +521,7 @@ public void GenerateSecondAllot(per_allot allot) ...@@ -519,7 +521,7 @@ public void GenerateSecondAllot(per_allot allot)
List<ag_secondallot> updSecond = new List<ag_secondallot>(); List<ag_secondallot> updSecond = new List<ag_secondallot>();
List<ag_secondallot> delSecond = 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); //var hospital = hospitalRepository.GetEntity(w => w.ID == allot.HospitalId);
//if (hospital?.IsOpenLogisticsSecondAllot != 1) //if (hospital?.IsOpenLogisticsSecondAllot != 1)
...@@ -527,7 +529,7 @@ public void GenerateSecondAllot(per_allot allot) ...@@ -527,7 +529,7 @@ public void GenerateSecondAllot(per_allot allot)
var accountUnit = perforResaccountRepository.GetEntities(t => t.AllotID == allot.ID && !types.Contains(t.UnitType.Value)); 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) if (xzAccountUnit != null && xzAccountUnit.Count > 0)
(accountUnit ?? new List<res_account>()).AddRange(xzAccountUnit); (accountUnit ?? new List<res_account>()).AddRange(xzAccountUnit);
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
using System.Data; using System.Data;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Linq.Expressions;
namespace Performance.Services namespace Performance.Services
{ {
...@@ -30,6 +31,7 @@ public class AllotService : IAutoInjection ...@@ -30,6 +31,7 @@ public class AllotService : IAutoInjection
private IWebHostEnvironment _evn; private IWebHostEnvironment _evn;
private ILogger<AllotService> _logger; private ILogger<AllotService> _logger;
private readonly IMapper _mapper; private readonly IMapper _mapper;
private readonly PerforUserRepository _userRepository;
private PerforPerallotRepository _allotRepository; private PerforPerallotRepository _allotRepository;
private IEmailService emailService; private IEmailService emailService;
private readonly IOptions<Application> options; private readonly IOptions<Application> options;
...@@ -55,6 +57,7 @@ public class AllotService : IAutoInjection ...@@ -55,6 +57,7 @@ public class AllotService : IAutoInjection
public AllotService( public AllotService(
IMapper mapper, IMapper mapper,
PerforUserRepository userRepository,
PerforPerallotRepository allotRepository, PerforPerallotRepository allotRepository,
BaiscNormService baiscNormService, BaiscNormService baiscNormService,
ImportDataService importDataService, ImportDataService importDataService,
...@@ -85,6 +88,7 @@ public class AllotService : IAutoInjection ...@@ -85,6 +88,7 @@ public class AllotService : IAutoInjection
QueryDataService queryDataService) QueryDataService queryDataService)
{ {
_mapper = mapper; _mapper = mapper;
_userRepository = userRepository;
_allotRepository = allotRepository; _allotRepository = allotRepository;
_againallotRepository = againallotRepository; _againallotRepository = againallotRepository;
_logger = logger; _logger = logger;
...@@ -448,7 +452,7 @@ public void Generate(per_allot allot) ...@@ -448,7 +452,7 @@ public void Generate(per_allot allot)
UpdateAllotStates(allot.ID, (int)AllotStates.绩效结果解析成功, EnumHelper.GetDescription(AllotStates.绩效结果解析成功), generate); UpdateAllotStates(allot.ID, (int)AllotStates.绩效结果解析成功, EnumHelper.GetDescription(AllotStates.绩效结果解析成功), generate);
perforCofdirectorRepository.SupplementaryData(allot.ID); perforCofdirectorRepository.SupplementaryData(allot.ID);
// 验证科室核算单元、工号 // 验证科室核算单元、工号
AccoungtingVerify(allot.ID); _allotRepository.AccoungtingVerify(allot.ID);
//补全支出费用类别 //补全支出费用类别
configService.SaveDrugtypeDisburse(allot.ID); configService.SaveDrugtypeDisburse(allot.ID);
//logManageService.WriteMsg("正在生成报表数据", "正在生成报表数据", 1, allot.ID, "ReceiveMessage", true); //logManageService.WriteMsg("正在生成报表数据", "正在生成报表数据", 1, allot.ID, "ReceiveMessage", true);
...@@ -494,10 +498,7 @@ public void GenerateReport(per_allot allot) ...@@ -494,10 +498,7 @@ public void GenerateReport(per_allot allot)
/// <param name="allot"></param> /// <param name="allot"></param>
public void AccoungtingVerify(int allotId) public void AccoungtingVerify(int allotId)
{ {
using (IDbConnection connection = new MySqlConnection(_appConnection.Value.PerformanceConnectionString)) _allotRepository.AccoungtingVerify(allotId);
{
connection.Execute("call proc_verify_accoungingunit_unittype(@allotId);", new { allotId });
}
} }
/// <summary> /// <summary>
...@@ -650,29 +651,19 @@ public List<log_dbug> AllotLog(per_allot allot, int type) ...@@ -650,29 +651,19 @@ public List<log_dbug> AllotLog(per_allot allot, int type)
/// <returns></returns> /// <returns></returns>
public List<EmployeeReservedDto> GetReserved(int hospitalId, int year, int userid) public List<EmployeeReservedDto> GetReserved(int hospitalId, int year, int userid)
{ {
var user = userService.GetUser(userid); var userInfo = _userRepository.GetUser(userid);
if (user == null) if (userInfo?.User == null) throw new NotImplementedException("当前用户不存在");
throw new PerformanceException("用户信息错误"); if (userInfo?.URole == null) throw new NotImplementedException("当前用户暂未分配角色");
var role = roleService.GetUserRole(userid)?.FirstOrDefault()?.Type; if (userInfo.IsSecondAdmin)
if (!role.HasValue)
throw new PerformanceException("用户信息错误");
var reserveds = _reportRepository.GetEmployeeReserved(hospitalId, year);
if (reserveds != null && reserveds.Any())
{ {
if (role.Value == options.Value.NurseRole) var unitTpes = UnitTypeUtil.GetMaps(userInfo?.URole.Type);
reserveds = reserveds.Where(w => UnitTypeUtil.Is(w.UnitType, UnitType.护理组, UnitType.其他护理组) && w.AccountingUnit == user.Department)?.ToList(); return _reportRepository.GetEmployeeReserved(hospitalId, year, unitTpes, userInfo.User.Department);
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
else if (role.Value == options.Value.SpecialRole) {
reserveds = reserveds.Where(w => UnitTypeUtil.Is(w.UnitType, UnitType.特殊核算组) && w.AccountingUnit == user.Department)?.ToList(); return _reportRepository.GetEmployeeReserved(hospitalId, year);
else if (role.Value == options.Value.OfficeRole)
reserveds = reserveds.Where(w => UnitTypeUtil.Is(w.UnitType, UnitType.行政中层, UnitType.行政后勤) && w.AccountingUnit == user.Department)?.ToList();
} }
return reserveds;
} }
/// <summary> /// <summary>
/// 查询个人绩效 /// 查询个人绩效
......
...@@ -116,14 +116,13 @@ public ApiResponse<List<view_attendance>> GetCallIn(int allotId) ...@@ -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, Columns = Person.Select(t => new HandsonColumn(t.Item2)).ToList(),
Visible = 1, ColHeaders = Person.Select(c => c.Item2).ToList(),
Readnoly = 0 };
}).ToList());
if (handson.Columns != null && handson.Columns.Any()) if (handson.Columns != null && handson.Columns.Any())
{ {
var cofaccounting = cofaccountingRepository.GetEntities(w => w.UnitType != "" && w.AllotId == allotId); var cofaccounting = cofaccountingRepository.GetEntities(w => w.UnitType != "" && w.AllotId == allotId);
...@@ -133,7 +132,6 @@ public HandsonTable GetBatchCallInHandsonTable(int allotId) ...@@ -133,7 +132,6 @@ public HandsonTable GetBatchCallInHandsonTable(int allotId)
if (column.Data == "调入组别") if (column.Data == "调入组别")
{ {
column.Type = "autocomplete"; column.Type = "autocomplete";
//column.Source = EnumHelper.GetItems<UnitType>().Select(w => w.Description.Replace("行政后勤", "行政工勤")).ToArray();
column.Source = cofaccounting.Select(w => w.UnitType).Distinct().ToArray(); column.Source = cofaccounting.Select(w => w.UnitType).Distinct().ToArray();
column.Strict = true; column.Strict = true;
} }
...@@ -141,16 +139,9 @@ public HandsonTable GetBatchCallInHandsonTable(int allotId) ...@@ -141,16 +139,9 @@ public HandsonTable GetBatchCallInHandsonTable(int allotId)
if (column.Data == "调入核算单元") if (column.Data == "调入核算单元")
{ {
column.Type = "autocomplete"; 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.Source = cofaccounting.Select(w => w.AccountingUnit).Distinct().ToArray();
column.Strict = true; column.Strict = true;
} }
//if (column.Data == "调入时间")
//{
// column.Type = "date";
// column.DateFormat = "YYYY/MM/DD";
//}
} }
} }
List<view_attendance> data = new List<view_attendance>(); List<view_attendance> data = new List<view_attendance>();
...@@ -184,7 +175,7 @@ public HandsonTable GetBatchCallInHandsonTable(int allotId) ...@@ -184,7 +175,7 @@ public HandsonTable GetBatchCallInHandsonTable(int allotId)
rowDatas.Add(new HandsonRowData(i, cells)); rowDatas.Add(new HandsonRowData(i, cells));
i++; i++;
} }
handson.SetRowData(rowDatas, rowDatas != null); handson.SetRowData(rowDatas);
foreach (var item in handson.Data) foreach (var item in handson.Data)
{ {
item.Remove("编号"); item.Remove("编号");
...@@ -386,25 +377,19 @@ public ApiResponse DeleteAttendanceType(int id) ...@@ -386,25 +377,19 @@ public ApiResponse DeleteAttendanceType(int id)
#endregion #endregion
#region 考勤记录 #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, Columns = Vacation.Select(t => new HandsonColumn(t.Item2)).ToList(),
Visible = 1, ColHeaders = Vacation.Select(c => c.Item2).ToList(),
Readnoly = 0 };
}).ToList());
if (handson.Columns != null && handson.Columns.Any()) if (handson.Columns != null && handson.Columns.Any())
{ {
var type = perfoPperAttendanceTypeRepository.GetEntities(t => t.AllotId == allotId); var type = perfoPperAttendanceTypeRepository.GetEntities(t => t.AllotId == allotId);
foreach (var column in handson.Columns) foreach (var column in handson.Columns)
{ {
column.Type = "text"; column.Type = "text";
//if (column.Data.Contains("时间"))
//{
// column.Type = "date";
// column.DateFormat = "YYYY/MM/DD";
//}
if (column.Data == "考勤类型") if (column.Data == "考勤类型")
{ {
column.Type = "autocomplete"; column.Type = "autocomplete";
...@@ -444,7 +429,7 @@ public HandsonTable GetAttendanceVacationHandsonTable(int allotId) ...@@ -444,7 +429,7 @@ public HandsonTable GetAttendanceVacationHandsonTable(int allotId)
rowDatas.Add(new HandsonRowData(i, cells)); rowDatas.Add(new HandsonRowData(i, cells));
i++; i++;
} }
handson.SetRowData(rowDatas, rowDatas != null); handson.SetRowData(rowDatas);
foreach (var item in handson.Data) foreach (var item in handson.Data)
{ {
item.Remove("编号"); item.Remove("编号");
......
...@@ -250,7 +250,7 @@ public IEnumerable<collect_permission> GetCollectSheet(int hospitalId, int userI ...@@ -250,7 +250,7 @@ public IEnumerable<collect_permission> GetCollectSheet(int hospitalId, int userI
var userrole = userroleRepository.GetEntity(t => t.UserID == userId); var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
if (userrole == null) return new List<collect_permission>(); 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 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>(); 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 ...@@ -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 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; if (departments == null || !departments.Any()) return handsonRows;
var data = departments.GroupBy(t => t.Department).Select(t => new var data = departments.GroupBy(t => t.Department).Select(t => new
......
...@@ -309,7 +309,7 @@ public List<DeptResponse> GetNursePerformance(int allotId) ...@@ -309,7 +309,7 @@ public List<DeptResponse> GetNursePerformance(int allotId)
/// <returns></returns> /// <returns></returns>
public List<DeptResponse> GetOtherPerformance(int allotId) 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) public List<DeptResponse> GetGroupPerformance(int allotId, List<int> group)
{ {
...@@ -326,7 +326,7 @@ public List<DeptResponse> GetGroupPerformance(int allotId, List<int> group) ...@@ -326,7 +326,7 @@ public List<DeptResponse> GetGroupPerformance(int allotId, List<int> group)
/// <returns></returns> /// <returns></returns>
public List<DeptResponse> GetOfficePerformance(int allotId) 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 == "是") var list = perforResaccountRepository.GetEntities(t => unitType.Contains(t.UnitType.Value) && t.AllotID == allotId && t.NeedSecondAllot == "是")
?.OrderBy(t => t.UnitType) ?.OrderBy(t => t.UnitType)
...@@ -565,7 +565,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId) ...@@ -565,7 +565,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
#region 需要二次分配的行政科室 #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 var needSecondResult = needSecond.Select(t => new DeptResponse
{ {
UnitName = ((UnitType)t.UnitType).ToString() == "行政后勤" ? "行政工勤" : ((UnitType)t.UnitType).ToString(), UnitName = ((UnitType)t.UnitType).ToString() == "行政后勤" ? "行政工勤" : ((UnitType)t.UnitType).ToString(),
...@@ -712,8 +712,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId) ...@@ -712,8 +712,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
enumItems.ForEach(t => enumItems.ForEach(t =>
{ {
t.Value = UnitTypeUtil.Is(t.Name, UnitType.护理组) ? t.Value + 2 : t.Value; t.Value = UnitTypeUtil.Is(t.Name, UnitType.护理组) ? t.Value + 2 : t.Value;
if (t.Name == UnitType.行政后勤.ToString()) t.Name = t.Name == "行政后勤" ? UnitType.行政工勤.ToString() : t.Name;
t.Name = "行政工勤";
}); });
result = result.OrderBy(t => enumItems.FirstOrDefault(e => e.Name == t.UnitName)?.Value).ThenBy(t => t.AccountingUnit).ToList(); 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 ...@@ -886,7 +885,7 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
// 预留比例 // 预留比例
if (response != null) 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) foreach (var item in response)
{ {
// 二次分配默认 调节系数100% // 二次分配默认 调节系数100%
...@@ -1512,7 +1511,7 @@ private UnitType TypeConversion(int? unitType) ...@@ -1512,7 +1511,7 @@ private UnitType TypeConversion(int? unitType)
{ {
UnitType type = (UnitType)unitType.Value; UnitType type = (UnitType)unitType.Value;
var docUnitTypes = new List<UnitType> { UnitType.专家组, UnitType.其他医生组, UnitType.其他医技组 }; var docUnitTypes = new List<UnitType> { UnitType.其他医生组, UnitType.其他医技组 };
if (docUnitTypes.Contains(type)) if (docUnitTypes.Contains(type))
type = UnitType.医生组; type = UnitType.医生组;
else if (type == UnitType.其他护理组) else if (type == UnitType.其他护理组)
...@@ -1576,8 +1575,8 @@ public DeptDataDetails DeptOfficeDetail(int accountId) ...@@ -1576,8 +1575,8 @@ public DeptDataDetails DeptOfficeDetail(int accountId)
foreach (var sheet in persheet.Where(t => t.SheetType == stype)) foreach (var sheet in persheet.Where(t => t.SheetType == stype))
{ {
groupBasis++; groupBasis++;
var (sheettype, amount) = CommonDepartmentDetail(basicData, sheet, UnitType.行政); var (sheettype, amount) = CommonDepartmentDetail(basicData, sheet, UnitType.行政);
var items = CommonDetailItems(basicData, headers, sheet, UnitType.行政); var items = CommonDetailItems(basicData, headers, sheet, UnitType.行政);
var sheetName = new Regex("[0-9]*").Replace(sheet.SheetName, "", 5).Replace(".", "").Replace(" ", ""); 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 ...@@ -77,12 +77,12 @@ public List<CostTransferResponse> GetAuditList(int allotId, int menuType, int ro
var account = GetAccounting(allotId, roleType, Department); var account = GetAccounting(allotId, roleType, Department);
Expression<Func<cost_transfer, bool>> exp = t => t.AllotId == allotId; Expression<Func<cost_transfer, bool>> exp = t => t.AllotId == allotId;
if (roleType == application.DirectorRole) if (roleType == (int)Role.科主任)
if (menuType == 1) if (menuType == 1)
exp = exp.And(t => new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString() }.Contains(t.ApplicantUnitType)); exp = exp.And(t => new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString() }.Contains(t.ApplicantUnitType));
else else
exp = exp.And(t => new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString() }.Contains(t.AdoptedUnitType)); 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) if (menuType == 1)
exp = exp.And(t => t.ApplicantUnitType == UnitType.护理组.ToString()); exp = exp.And(t => t.ApplicantUnitType == UnitType.护理组.ToString());
else else
...@@ -148,15 +148,11 @@ public List<CostTransferResponse> GetAuditList(int allotId, int menuType, int ro ...@@ -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) 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; 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)); if (UnitTypeUtil.Maps.ContainsKey(roleType))
else if (roleType == application.NurseRole) exp = exp.And(t => unitTpes.Contains(t.UnitType));
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());
var account = cofaccountingRepository.GetEntity(exp); var account = cofaccountingRepository.GetEntity(exp);
......
...@@ -23,6 +23,7 @@ public class CustomExtractService : IAutoInjection ...@@ -23,6 +23,7 @@ public class CustomExtractService : IAutoInjection
private readonly IOptions<Application> _options; private readonly IOptions<Application> _options;
private readonly UserService _userService; private readonly UserService _userService;
private readonly RoleService _roleService; private readonly RoleService _roleService;
private readonly PerforUserRepository _userRepository;
private readonly PerforPerallotRepository _perallotRepository; private readonly PerforPerallotRepository _perallotRepository;
private readonly PerforPerdeptdicRepository _perforPerdeptdicRepository; private readonly PerforPerdeptdicRepository _perforPerdeptdicRepository;
private readonly PerforHospitalconfigRepository _perforHospitalconfigRepository; private readonly PerforHospitalconfigRepository _perforHospitalconfigRepository;
...@@ -34,6 +35,7 @@ public class CustomExtractService : IAutoInjection ...@@ -34,6 +35,7 @@ public class CustomExtractService : IAutoInjection
IOptions<Application> options, IOptions<Application> options,
UserService userService, UserService userService,
RoleService roleService, RoleService roleService,
PerforUserRepository userRepository,
PerforPerallotRepository perallotRepository, PerforPerallotRepository perallotRepository,
PerforPerdeptdicRepository perforPerdeptdicRepository, PerforPerdeptdicRepository perforPerdeptdicRepository,
PerforHospitalconfigRepository perforHospitalconfigRepository, PerforHospitalconfigRepository perforHospitalconfigRepository,
...@@ -44,6 +46,7 @@ public class CustomExtractService : IAutoInjection ...@@ -44,6 +46,7 @@ public class CustomExtractService : IAutoInjection
_options = options; _options = options;
_userService = userService; _userService = userService;
_roleService = roleService; _roleService = roleService;
_userRepository = userRepository;
_perallotRepository = perallotRepository; _perallotRepository = perallotRepository;
_perforPerdeptdicRepository = perforPerdeptdicRepository; _perforPerdeptdicRepository = perforPerdeptdicRepository;
_perforHospitalconfigRepository = perforHospitalconfigRepository; _perforHospitalconfigRepository = perforHospitalconfigRepository;
...@@ -57,8 +60,8 @@ public bool CheckConfigScript(int userId, int allotId) ...@@ -57,8 +60,8 @@ public bool CheckConfigScript(int userId, int allotId)
?? throw new PerformanceException("绩效ID无效"); ?? throw new PerformanceException("绩效ID无效");
var scripts = _perforcustscriptRepository.GetEntities(w => w.HospitalId == allot.HospitalId && w.IsEnable == 1); var scripts = _perforcustscriptRepository.GetEntities(w => w.HospitalId == allot.HospitalId && w.IsEnable == 1);
var center = _userRepository.GetUser(userId);
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.IsSecondAllot == 1).ToList()
: scripts?.Where(w => w.IsOnceAllot == 1).ToList(); : scripts?.Where(w => w.IsOnceAllot == 1).ToList();
...@@ -74,9 +77,11 @@ public bool ExtractData(int userId, int allotId, out string resultFilePath) ...@@ -74,9 +77,11 @@ public bool ExtractData(int userId, int allotId, out string resultFilePath)
var filePath = ExtractHelper.GetExtractFile(allot.HospitalId); var filePath = ExtractHelper.GetExtractFile(allot.HospitalId);
resultFilePath = filePath; resultFilePath = filePath;
var center = _userRepository.GetUser(userId);
var scripts = _perforcustscriptRepository.GetEntities(w => w.HospitalId == allot.HospitalId && w.IsEnable == 1); 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.IsSecondAllot == 1).ToList()
: scripts?.Where(w => w.IsOnceAllot == 1).ToList(); : scripts?.Where(w => w.IsOnceAllot == 1).ToList();
...@@ -85,7 +90,7 @@ public bool ExtractData(int userId, int allotId, out string resultFilePath) ...@@ -85,7 +90,7 @@ public bool ExtractData(int userId, int allotId, out string resultFilePath)
result = false; result = false;
return result; return result;
} }
var depts = _perforPerdeptdicRepository.GetEntities(w => w.HospitalId == allot.HospitalId); var depts = _perforPerdeptdicRepository.GetEntities(w => w.AllotId == allot.ID);
IWorkbook workbook = null; IWorkbook workbook = null;
try try
...@@ -132,7 +137,12 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri ...@@ -132,7 +137,12 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri
?? throw new PerformanceException("当前医院没有数据库地址配置"); ?? throw new PerformanceException("当前医院没有数据库地址配置");
var parameters = GetParameters(allot); 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}'"); parameters.Add("@department", $"'{department}'");
if (unitType != null && unitType.Any()) if (unitType != null && unitType.Any())
parameters.Add("@unittype", $"{string.Join(", ", unitType.Select(t => $"'{t}'"))}"); 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 ...@@ -196,7 +206,7 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri
if (atUnitTypeList.Any() && !string.IsNullOrEmpty(atDepartment)) if (atUnitTypeList.Any() && !string.IsNullOrEmpty(atDepartment))
{ {
var tempDepts = depts.Where(w => atUnitTypeList.Contains(w.UnitType) && w.HISDeptName == 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 ?? ""; accountUnit = tempDepts.FirstOrDefault()?.AccountingUnit ?? "";
} }
...@@ -292,44 +302,5 @@ public IEnumerable<dynamic> QueryData(sys_hospitalconfig config, string execsql, ...@@ -292,44 +302,5 @@ public IEnumerable<dynamic> QueryData(sys_hospitalconfig config, string execsql,
}; };
return pairs; 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);
}
} }
} }
...@@ -1313,14 +1313,13 @@ public List<GatherDropResponse> GetGatherDrop(Gather gather) ...@@ -1313,14 +1313,13 @@ public List<GatherDropResponse> GetGatherDrop(Gather gather)
} }
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, Columns = Gather.Select(t => new HandsonColumn(t.Value)).ToList(),
Visible = 1 ColHeaders = Gather.Select(t => t.Value).ToList(),
}).ToList()); };
if (result.Columns != null && result.Columns.Any()) if (result.Columns != null && result.Columns.Any())
{ {
...@@ -1356,7 +1355,7 @@ public HandsonTable GetGatherHands(int AllotId, GatherRequest request) ...@@ -1356,7 +1355,7 @@ public HandsonTable GetGatherHands(int AllotId, GatherRequest request)
rowDatas.Add(new HandsonRowData(i, cells)); rowDatas.Add(new HandsonRowData(i, cells));
i++; i++;
} }
result.SetRowData(rowDatas, rowDatas != null); result.SetRowData(rowDatas);
return result; return result;
} }
......
...@@ -741,7 +741,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin ...@@ -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 allot = perallotRepository.GetEntity(t => t.ID == allotId);
var drugTypes = cofdrugtypeRepository.GetEntities(t => t.AllotID == allot.ID && t.HospitalId == allot.HospitalId); 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); var moduleSheet = exmoduleRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.SheetType == (int)SheetType.Income);
if (moduleSheet == null || !moduleSheet.Any()) return null; if (moduleSheet == null || !moduleSheet.Any()) return null;
...@@ -786,6 +786,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin ...@@ -786,6 +786,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin
UnitType = defauleUnittype, UnitType = defauleUnittype,
Source = source, Source = source,
HospitalId = allot.HospitalId, HospitalId = allot.HospitalId,
AllotId = allot.ID,
IsVerify = 0, IsVerify = 0,
VerifyMessage = "抽取前科室校验后补增科室", VerifyMessage = "抽取前科室校验后补增科室",
CreateUser = 1 CreateUser = 1
......
...@@ -91,13 +91,16 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi ...@@ -91,13 +91,16 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
} }
} }
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"开始提取HIS数据", isSingle: isSingle);
var hisScrips = hisscriptRepository.GetEntities(t => t.HospitalId == hospitalId); var hisScrips = hisscriptRepository.GetEntities(t => t.HospitalId == hospitalId);
if (hisScrips == null || !hisScrips.Any()) return; if (hisScrips == null || !hisScrips.Any()) return;
foreach (var item in hisScrips) foreach (var item in hisScrips)
{ {
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取{item.SourceType} - {item.Category}数据", isSingle: isSingle); HisData(allot, configs.FirstOrDefault(t => t.Id == item.ConfigId), item, groupName, isSingle);
HisData(allot, configs.FirstOrDefault(t => t.Id == item.ConfigId), item, isSingle);
} }
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取HIS数据完成", isSingle: isSingle);
} }
catch (Exception) catch (Exception)
{ {
...@@ -227,10 +230,12 @@ private void JudgeDataEqual(List<string> columns, List<per_employee> emps, List< ...@@ -227,10 +230,12 @@ private void JudgeDataEqual(List<string> columns, List<per_employee> emps, List<
} }
} }
private void HisData(per_allot allot, sys_hospitalconfig config, his_script script, bool isSingle) private void HisData(per_allot allot, sys_hospitalconfig config, his_script script, string groupName, bool isSingle)
{ {
try try
{ {
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取“{script.SourceType} - {script.Category}”数据", isSingle: isSingle);
if (config == null || string.IsNullOrEmpty(script.ExecScript)) return; if (config == null || string.IsNullOrEmpty(script.ExecScript)) return;
var data = queryService.QueryData<HisData>(config, script.ExecScript, allot, isSingle); var data = queryService.QueryData<HisData>(config, script.ExecScript, allot, isSingle);
...@@ -259,10 +264,12 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri ...@@ -259,10 +264,12 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
}); });
hisdataRepository.AddRange(insertData.ToArray()); hisdataRepository.AddRange(insertData.ToArray());
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取“{script.SourceType} - {script.Category}”完成", isSingle: isSingle);
} }
catch (Exception ex) catch (Exception ex)
{ {
logger.LogError("获取his_data时发生异常:" + ex.ToString()); logger.LogError("获取his_data时发生异常:" + ex.ToString());
logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "SQL错误", $"获取HIS数据“{script.SourceType} - {script.Category}”时发生异常", 3, isSingle);
} }
} }
......
...@@ -225,6 +225,12 @@ public static string NoBlank(this string @string) ...@@ -225,6 +225,12 @@ public static string NoBlank(this string @string)
return @string.Replace("\n", "").Replace("\r", "").Replace(" ", "").Trim(); return @string.Replace("\n", "").Replace("\r", "").Replace(" ", "").Trim();
} }
public static string GetNo(this string @string)
{
var match = Regex.Match(@string, "^(1.[1-9].[1-9])|(^[1-9]+.[1-9]+)");
return match.Value;
}
public static IWorkbook GetWorkbook(string filePath) public static IWorkbook GetWorkbook(string filePath)
{ {
IWorkbook workbook = null; IWorkbook workbook = null;
......
...@@ -54,38 +54,38 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo ...@@ -54,38 +54,38 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
try try
{ {
var sheetNames = workbook.GetAllNames().Select(w => w.SheetName);
foreach (var module in modulesList.Where(t => t.SheetType == (int)SheetType.Income)?.OrderBy(t => t.ModuleName)) foreach (var module in modulesList.Where(t => t.SheetType == (int)SheetType.Income)?.OrderBy(t => t.ModuleName))
{ {
var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank()); var no = module.ModuleName.GetNo();
var name = sheetNames.FirstOrDefault(name => name.StartsWith(no)) ?? module.ModuleName;
var sheet = workbook.GetSheet(name) ?? workbook.GetSheet(module.ModuleName);
if (sheet == null) if (sheet == null)
{ {
string[] keyArray = new string[] { "开单", "就诊", "执行" }; string[] keyArray = new string[] { "开单", "就诊", "执行" };
if (keyArray.Any(key => module.ModuleName.Contains(key))) if (keyArray.Any(key => name.Contains(key)))
{ {
var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("1.")).OrderByDescending(t => t.Key).First(); var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("1.")).OrderByDescending(t => t.Key).First();
var copysheet = workbook.GetSheet(item.Key); var copysheet = workbook.GetSheet(item.Key);
if (copysheet == null) continue; if (copysheet == null) continue;
try var newSheet = copysheet.CopySheet(name, true);
{ workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
var newSheet = copysheet.CopySheet(module.ModuleName, true);
workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
}
catch (Exception)
{
}
} }
} }
} }
foreach (var module in modulesList.Where(t => new int[] { (int)SheetType.OtherWorkload, (int)SheetType.Assess }.Contains(t.SheetType.Value))?.OrderBy(t => t.ModuleName)) foreach (var module in modulesList.Where(t => new int[] { (int)SheetType.OtherWorkload, (int)SheetType.Assess }.Contains(t.SheetType.Value))?.OrderBy(t => t.ModuleName))
{ {
var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank()); var no = module.ModuleName.GetNo();
var name = sheetNames.FirstOrDefault(name => name.StartsWith(no)) ?? module.ModuleName;
var sheet = workbook.GetSheet(name) ?? workbook.GetSheet(module.ModuleName);
if (sheet == null) if (sheet == null)
{ {
var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("3.")).OrderByDescending(t => t.Key).First(); var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("3.")).OrderByDescending(t => t.Key).First();
var copysheet = workbook.GetSheet(item.Key); var copysheet = workbook.GetSheet(item.Key);
if (copysheet == null) continue; if (copysheet == null) continue;
var newSheet = copysheet.CopySheet(module.ModuleName, true); var newSheet = copysheet.CopySheet(name, true);
workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1); workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
var point = PerSheetDataFactory.GetDataRead(SheetType.Workload)?.Point; var point = PerSheetDataFactory.GetDataRead(SheetType.Workload)?.Point;
......
...@@ -157,12 +157,15 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -157,12 +157,15 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
if (row == null) continue; if (row == null) continue;
string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes(); string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes();
if (string.IsNullOrEmpty(department)) continue;
if (rowIndex >= dataFirstRowNum) dataFirstRowNum = rowIndex + 1;
if (rowIndex > dataFirstRowNum) dataFirstRowNum = rowIndex + 1; var deptData = data.Where(t => t.Department.NoBlank() == department);
if (deptData == null || !deptData.Any(t => t.Value.HasValue && t.Value != 0)) continue;
#region 写入数据 #region 写入数据
if (sheetType == SheetType.Income && !string.IsNullOrEmpty(department)) if (sheetType == SheetType.Income)
{ {
if (!incomes.Any(t => t.Department == department)) if (!incomes.Any(t => t.Department == department))
incomes.Add(GetIncomeRowMessage(row, dataFirstCellNum, department, rowIndex)); incomes.Add(GetIncomeRowMessage(row, dataFirstCellNum, department, rowIndex));
...@@ -175,24 +178,13 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -175,24 +178,13 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var cell = row.GetOrCreate(cellIndex); var cell = row.GetOrCreate(cellIndex);
if (string.IsNullOrEmpty(column)) continue; if (string.IsNullOrEmpty(column)) continue;
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
decimal? value = 0m;
if (!string.IsNullOrEmpty(department))
{
var deptData = data.Where(t => t.Department.NoBlank() == department);
if (deptData != null && deptData.Any(t => t.Value.HasValue && t.Value != 0))
value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
}
//数据为空,且单元格值不为空,不写入数据(保留原始值) //数据为空,且单元格值不为空,不写入数据(保留原始值)
// 22.3.29 ry 只要是提取的列头全部覆盖数据 if (value.HasValue && value != 0)
//if (value.HasValue && value != 0) cell.SetCellValue<decimal>(value);
if (headers != null && headers.Contains(column)) if (headers != null && headers.Contains(column))
{
cell.SetCellValue<decimal>(value ?? 0);
cell.CellStyle = cellStyle; cell.CellStyle = cellStyle;
}
} }
#endregion #endregion
...@@ -235,7 +227,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -235,7 +227,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var row = sheet.GetOrCreate(dataFirstRowNum); var row = sheet.GetOrCreate(dataFirstRowNum);
for (int cellIndex = point.HeaderFirstCellNum.Value; cellIndex < columnHeader.LastCellNum; cellIndex++) for (int cellIndex = point.HeaderFirstCellNum.Value; cellIndex < columnHeader.LastCellNum; cellIndex++)
{ {
var column = columnHeader.GetCell(cellIndex).GetDecodeEscapes()?.Replace("(", "(").Replace(")", ")"); ; var column = columnHeader.GetCell(cellIndex).GetDecodeEscapes()?.Replace("(", "(").Replace(")", ")");
var cell = row.CreateCell(cellIndex); var cell = row.CreateCell(cellIndex);
if (filed.ContainsKey(column)) if (filed.ContainsKey(column))
...@@ -278,14 +270,14 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -278,14 +270,14 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
{ {
{ 1, item.Department }, { 1, item.Department },
{ 2, (sheet.SheetName.Contains("门诊") { 2, (sheet.SheetName.Contains("门诊")
? deptData.FirstOrDefault(t => !string.IsNullOrEmpty(t.OutNurseAccounting))?.OutNurseAccounting ? deptData.FirstOrDefault(t => !string.IsNullOrEmpty(t.OutNurseAccounting))?.OutNurseAccounting
: deptData.FirstOrDefault(t => !string.IsNullOrEmpty(t.InpatNurseAccounting))?.InpatNurseAccounting) ?? item.NurseAccount }, : deptData.FirstOrDefault(t => !string.IsNullOrEmpty(t.InpatNurseAccounting))?.InpatNurseAccounting) ?? item.NurseAccount },
{ 3, (sheet.SheetName.Contains("门诊") { 3, (sheet.SheetName.Contains("门诊")
? deptData.FirstOrDefault(t => !string.IsNullOrEmpty(t.OutDoctorAccounting))?.OutDoctorAccounting ? deptData.FirstOrDefault(t => !string.IsNullOrEmpty(t.OutDoctorAccounting))?.OutDoctorAccounting
: deptData.FirstOrDefault(t => !string.IsNullOrEmpty(t.InpatDoctorAccounting))?.InpatDoctorAccounting) ?? item.DoctorAccount }, : deptData.FirstOrDefault(t => !string.IsNullOrEmpty(t.InpatDoctorAccounting))?.InpatDoctorAccounting) ?? item.DoctorAccount },
{ 4, (sheet.SheetName.Contains("门诊") { 4, (sheet.SheetName.Contains("门诊")
? deptData.FirstOrDefault(t => !string.IsNullOrEmpty(t.OutTechnicAccounting))?.OutTechnicAccounting ? deptData.FirstOrDefault(t => !string.IsNullOrEmpty(t.OutTechnicAccounting))?.OutTechnicAccounting
: deptData.FirstOrDefault(t => !string.IsNullOrEmpty(t.InpatTechnicAccounting))?.InpatTechnicAccounting) ?? item.TechnicAccounting }, : deptData.FirstOrDefault(t => !string.IsNullOrEmpty(t.InpatTechnicAccounting))?.InpatTechnicAccounting) ?? item.TechnicAccounting },
}; };
foreach (var content in deptContents) foreach (var content in deptContents)
...@@ -301,16 +293,9 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -301,16 +293,9 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
{ {
var column = columnHeader.GetOrCreate(cellIndex).GetDecodeEscapes(); var column = columnHeader.GetOrCreate(cellIndex).GetDecodeEscapes();
var cell = row.GetOrCreate(cellIndex); var cell = row.GetOrCreate(cellIndex);
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
var value = (deptData != null && deptData.Any()) if (value.HasValue && value != 0)
? deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value cell.SetCellValue<decimal>(value);
: 0;
//if (cell.CellType != CellType.Formula)
//{
// cell.SetCellValue<decimal>(value);
// cell.CellStyle = cellStyle;
//}
cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle; cell.CellStyle = cellStyle;
} }
......
...@@ -99,7 +99,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -99,7 +99,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
var dict = new Dictionary<ExDataDict, object>(); var dict = new Dictionary<ExDataDict, object>();
logService.ReturnTheLog(allotId, groupName, 3, "", 5, 1, isSingle); logService.ReturnTheLog(allotId, groupName, 3, "", 5, 1, isSingle);
queryService.ClearConnectionPools(); queryService.ClearConnectionPools();
queryService.ClearHistoryData(allot.ID, groupName, isSingle); queryService.ClearHistoryData(allot.ID, groupName, isSingle);
...@@ -107,7 +107,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -107,7 +107,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
var data = exresultRepository.GetEntities(t => t.AllotId == allotId); var data = exresultRepository.GetEntities(t => t.AllotId == allotId);
data.AddRange(queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict)); data.AddRange(queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict));
var standData = StandDataFormat(hospitalId, data); var standData = StandDataFormat(hospitalId, allotId, data);
dictionaryService.Handler(hospitalId, allot, groupName, isSingle); dictionaryService.Handler(hospitalId, allot, groupName, isSingle);
...@@ -233,10 +233,10 @@ private void WriteDataToFile(IWorkbook workbook, per_allot allot, Dictionary<ExD ...@@ -233,10 +233,10 @@ private void WriteDataToFile(IWorkbook workbook, per_allot allot, Dictionary<ExD
var customer = factory.GetWriteData(sheetType, logger); var customer = factory.GetWriteData(sheetType, logger);
if (customer != null) if (customer != null)
{ {
var collects = collectData?.Where(t => t.SheetName.NoBlank() == sheetName).ToList(); var collects = collectData?.Where(t => t.SheetName.StartsWith(sheetName.GetNo())).ToList();
customer.WriteCollectData(sheet, point, sheetType, style, collects, exdict); customer.WriteCollectData(sheet, point, sheetType, style, collects, exdict);
var exdata = extractDto.Where(t => t.SheetName.NoBlank() == sheetName)?.ToList(); var exdata = extractDto.Where(t => t.SheetName.StartsWith(sheetName.GetNo()))?.ToList();
if (exdata != null) if (exdata != null)
{ {
logger.LogInformation($"{sheetName}: 总金额 - {exdata.Sum(s => s.Value ?? 0)}; 科室 - {string.Join(",", exdata.Select(s => s.Department).Distinct())}"); logger.LogInformation($"{sheetName}: 总金额 - {exdata.Sum(s => s.Value ?? 0)}; 科室 - {string.Join(",", exdata.Select(s => s.Department).Distinct())}");
...@@ -275,10 +275,11 @@ private object GetDataBySheetType(int hospitalId, SheetType sheetType, List<Extr ...@@ -275,10 +275,11 @@ private object GetDataBySheetType(int hospitalId, SheetType sheetType, List<Extr
/// <summary> /// <summary>
/// 标准数据格式, 匹配科室字典 /// 标准数据格式, 匹配科室字典
/// </summary> /// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param> /// <param name="hospitalId"></param>
/// <param name="results"></param> /// <param name="results"></param>
/// <returns></returns> /// <returns></returns>
private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> results) private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List<ex_result> results)
{ {
if (results == null || !results.Any()) return new List<ExtractTransDto>(); if (results == null || !results.Any()) return new List<ExtractTransDto>();
...@@ -290,7 +291,7 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re ...@@ -290,7 +291,7 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
var types = extypeRepository.GetEntities(w => w.HospitalId == hospitalId) ?? new List<ex_type>(); 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()) if (dict == null || !dict.Any())
{ {
return results.GroupBy(t => new { t.Department, t.Category, t.Source }).Select(t => new ExtractTransDto return results.GroupBy(t => new { t.Department, t.Category, t.Source }).Select(t => new ExtractTransDto
...@@ -305,47 +306,50 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re ...@@ -305,47 +306,50 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
dict.ForEach(t => dict.ForEach(t =>
{ {
t.Department = WriteDataHelper.HasValue(t.HISDeptName, t.Department); t.HISDeptName = WriteDataHelper.HasValue(t.HISDeptName, t.Department);
}); });
var data = results.GroupJoin(dict, outer => new { Department = outer.Department }, inner => new { Department = inner.HISDeptName }, (outer, inner) => new { outer, inner }) var data = new List<ExtractTransDto>();
.Select(t => foreach (var item in results)
{
var firstDic = dict.FirstOrDefault(w => w.HISDeptName == item.Department) ?? dict.FirstOrDefault(w => w.Department == item.Department);
var dept = !string.IsNullOrEmpty(firstDic?.Department) ? firstDic?.Department : item.Department;
var d = new ExtractTransDto
{ {
var dept = !string.IsNullOrEmpty(t.inner.FirstOrDefault()?.Department) ? t.inner.FirstOrDefault()?.Department : t.outer.Department; SheetName = item.Source,
return new ExtractTransDto Department = dept,
{ Category = item.Category,
SheetName = t.outer.Source, DoctorName = item.DoctorName,
Department = dept, PersonnelNumber = item.PersonnelNumber,
Category = t.outer.Category, Value = item.Fee ?? 0,
DoctorName = t.outer.DoctorName, OutDoctorAccounting = firstDic?.OutDoctorAccounting?.AccountingUnit,
PersonnelNumber = t.outer.PersonnelNumber, OutNurseAccounting = firstDic?.OutNurseAccounting?.AccountingUnit,
Value = t.outer.Fee ?? 0, OutTechnicAccounting = firstDic?.OutTechnicAccounting?.AccountingUnit,
OutDoctorAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutDoctorAccounting?.AccountingUnit, InpatDoctorAccounting = firstDic?.InpatDoctorAccounting?.AccountingUnit,
OutNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutNurseAccounting?.AccountingUnit, InpatNurseAccounting = firstDic?.InpatNurseAccounting?.AccountingUnit,
OutTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutTechnicAccounting?.AccountingUnit, InpatTechnicAccounting = firstDic?.InpatTechnicAccounting?.AccountingUnit,
InpatDoctorAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatDoctorAccounting?.AccountingUnit, SpecialAccounting = firstDic?.SpecialAccounting?.AccountingUnit ?? dept,
InpatNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatNurseAccounting?.AccountingUnit, EName = types.FirstOrDefault(w => w.Id == item.TypeId)?.EName,
InpatTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatTechnicAccounting?.AccountingUnit, };
SpecialAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.SpecialAccounting?.AccountingUnit ?? dept, data.Add(d);
EName = types.FirstOrDefault(w => w.Id == t.outer.TypeId)?.EName, }
};
});
var groupdata = data.GroupBy(t => new { t.Department, t.Category, t.SheetName }).Select(t => new ExtractTransDto var groupdata = data.GroupBy(t => new { t.Department, t.Category, t.SheetName })
{ .Select(t => new ExtractTransDto
SheetName = t.Key.SheetName, {
Department = t.Key.Department, SheetName = t.Key.SheetName,
Category = t.Key.Category, Department = t.Key.Department,
Value = t.Sum(group => group.Value) == 0 ? null : t.Sum(group => group.Value), Category = t.Key.Category,
OutDoctorAccounting = t.FirstOrDefault()?.OutDoctorAccounting, Value = t.Sum(group => group.Value) == 0 ? null : t.Sum(group => group.Value),
OutNurseAccounting = t.FirstOrDefault()?.OutNurseAccounting, OutDoctorAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.OutDoctorAccounting))?.OutDoctorAccounting,
OutTechnicAccounting = t.FirstOrDefault()?.OutTechnicAccounting, OutNurseAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.OutNurseAccounting))?.OutNurseAccounting,
InpatDoctorAccounting = t.FirstOrDefault()?.InpatDoctorAccounting, OutTechnicAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.OutTechnicAccounting))?.OutTechnicAccounting,
InpatNurseAccounting = t.FirstOrDefault()?.InpatNurseAccounting, InpatDoctorAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.InpatDoctorAccounting))?.InpatDoctorAccounting,
InpatTechnicAccounting = t.FirstOrDefault()?.InpatTechnicAccounting, InpatNurseAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.InpatNurseAccounting))?.InpatNurseAccounting,
SpecialAccounting = t.FirstOrDefault()?.SpecialAccounting, InpatTechnicAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.InpatTechnicAccounting))?.InpatTechnicAccounting,
EName = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.EName))?.EName SpecialAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.SpecialAccounting))?.SpecialAccounting,
}); EName = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.EName))?.EName
});
return groupdata.ToList(); return groupdata.ToList();
} }
......
...@@ -438,7 +438,7 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe ...@@ -438,7 +438,7 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe
if (connection == null) return Enumerable.Empty<T>(); if (connection == null) return Enumerable.Empty<T>();
if (connection.State == ConnectionState.Closed) if (connection.State != ConnectionState.Open)
connection.Open(); connection.Open();
} }
catch catch
...@@ -446,11 +446,19 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe ...@@ -446,11 +446,19 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe
logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "数据库连接", $"数据库“{config.DbName}”连接失败", 3, isSingle); logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "数据库连接", $"数据库“{config.DbName}”连接失败", 3, isSingle);
} }
logger.LogInformation($"提取绩效数据SQL脚本{execsql}"); try
var result = connection.Query<T>(execsql, commandTimeout: 20000); {
logger.LogInformation($"提取绩效数据执行脚本获取数据{result?.Count() ?? 0}条记录"); logger.LogInformation($"提取绩效数据SQL脚本{execsql}");
var result = connection.Query<T>(execsql, commandTimeout: 60 * 60 * 5);
logger.LogInformation($"提取绩效数据执行脚本获取数据{result?.Count() ?? 0}条记录");
return result;
}
catch (Exception ex)
{
logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "SQL执行错误", ex.Message, 3, isSingle);
throw;
}
return result;
} }
/// <summary> /// <summary>
......
...@@ -52,7 +52,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style, ...@@ -52,7 +52,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style,
if (departments == null || !departments.Any()) return; 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); WriteSheetDataNonexistent(sheet, cellStyle, point, columns, departments, standardDict, costTransfers, costTransferItems);
} }
......
...@@ -39,7 +39,8 @@ public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetT ...@@ -39,7 +39,8 @@ public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetT
public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, object data, Dictionary<ExDataDict, object> exdict = null) public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, object data, Dictionary<ExDataDict, object> exdict = null)
{ {
var modules = exdict[ExDataDict.ExModule] as List<ex_module>; var modules = exdict[ExDataDict.ExModule] as List<ex_module>;
var module = modules?.FirstOrDefault(t => t.SheetType == (int)sheetType && t.ModuleName.NoBlank() == sheet.SheetName.NoBlank()); var no = sheet.SheetName.GetNo();
var module = modules?.FirstOrDefault(t => t.SheetType == (int)sheetType && t.ModuleName.StartsWith(no));
if (module == null) return; if (module == null) return;
if (data is List<ExtractTransDto> extractDto && extractDto.Any()) if (data is List<ExtractTransDto> extractDto && extractDto.Any())
......
...@@ -145,7 +145,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null) ...@@ -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) IEnumerable<cof_workitem> workitems, IEnumerable<CofDrugProp> medicineProps, IEnumerable<CofDrugProp> cmis, IEnumerable<CofDrugProp> inclines, bool isDoctor = false)
{ {
var unittype = isDoctor 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() }; : new List<string> { UnitType.护理组.ToString(), UnitType.其他护理组.ToString() };
if ((medicineProps == null && cmis == null && inclines == null) || workitems == null) if ((medicineProps == null && cmis == null && inclines == null) || workitems == null)
......
...@@ -39,6 +39,7 @@ public class RedistributionService : IAutoInjection ...@@ -39,6 +39,7 @@ public class RedistributionService : IAutoInjection
private readonly PerforAgworkloadRepository _agworkloadRepository; private readonly PerforAgworkloadRepository _agworkloadRepository;
private readonly PerforAgworkloadsourceRepository _agworkloadsourceRepository; private readonly PerforAgworkloadsourceRepository _agworkloadsourceRepository;
private readonly PerforAgworkloadtypeRepository _agworkloadtypeRepository; private readonly PerforAgworkloadtypeRepository _agworkloadtypeRepository;
private readonly PerforImemployeeclinicRepository _imemployeeclinicRepository;
private readonly PerforImemployeelogisticsRepository _imemployeelogisticsRepository; private readonly PerforImemployeelogisticsRepository _imemployeelogisticsRepository;
public RedistributionService( public RedistributionService(
...@@ -59,6 +60,7 @@ public class RedistributionService : IAutoInjection ...@@ -59,6 +60,7 @@ public class RedistributionService : IAutoInjection
PerforAgworkloadRepository agworkloadRepository, PerforAgworkloadRepository agworkloadRepository,
PerforAgworkloadsourceRepository agworkloadsourceRepository, PerforAgworkloadsourceRepository agworkloadsourceRepository,
PerforAgworkloadtypeRepository agworkloadtypeRepository, PerforAgworkloadtypeRepository agworkloadtypeRepository,
PerforImemployeeclinicRepository imemployeeclinicRepository,
PerforImemployeelogisticsRepository imemployeelogisticsRepository) PerforImemployeelogisticsRepository imemployeelogisticsRepository)
{ {
_logger = logger; _logger = logger;
...@@ -78,6 +80,7 @@ public class RedistributionService : IAutoInjection ...@@ -78,6 +80,7 @@ public class RedistributionService : IAutoInjection
_agworkloadRepository = agworkloadRepository; _agworkloadRepository = agworkloadRepository;
_agworkloadsourceRepository = agworkloadsourceRepository; _agworkloadsourceRepository = agworkloadsourceRepository;
_agworkloadtypeRepository = agworkloadtypeRepository; _agworkloadtypeRepository = agworkloadtypeRepository;
_imemployeeclinicRepository = imemployeeclinicRepository;
_imemployeelogisticsRepository = imemployeelogisticsRepository; _imemployeelogisticsRepository = imemployeelogisticsRepository;
} }
#endregion #endregion
...@@ -433,6 +436,7 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D ...@@ -433,6 +436,7 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D
head.AddOrUpdate(nameof(second.UnitType), second.UnitType); head.AddOrUpdate(nameof(second.UnitType), second.UnitType);
head.AddOrUpdate(nameof(ComputeMode), computeMode); head.AddOrUpdate(nameof(ComputeMode), computeMode);
head.AddOrUpdate("ComputeModeDescription", EnumHelper.GetDescription(computeMode)); head.AddOrUpdate("ComputeModeDescription", EnumHelper.GetDescription(computeMode));
var allotStates = new int[] { (int)AllotStates.绩效下发, (int)AllotStates.归档 }; var allotStates = new int[] { (int)AllotStates.绩效下发, (int)AllotStates.归档 };
head.AddOrUpdate(nameof(ag_headsource.SecondId), second.Id); head.AddOrUpdate(nameof(ag_headsource.SecondId), second.Id);
head.AddOrUpdate(nameof(ag_headsource.PaymentOfTheMonth), $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}月"); head.AddOrUpdate(nameof(ag_headsource.PaymentOfTheMonth), $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}月");
...@@ -446,7 +450,10 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D ...@@ -446,7 +450,10 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D
var refAvg = 0m; var refAvg = 0m;
if (Enum.TryParse(typeof(UnitType), second.UnitType, true, out object unittype)) if (Enum.TryParse(typeof(UnitType), second.UnitType, true, out object unittype))
{ {
var rescompute = _resaccountRepository.GetEntity(w => w.AccountingUnit == second.Department && w.UnitType == (int)((UnitType)unittype)); // 优先取 业务中层实际人均绩效 否则 取 科室人均
var empolyee = _imemployeeclinicRepository.GetEntity(w => w.AllotID == allot.ID && w.AccountingUnit == second.Department && w.UnitType == second.UnitType);
var rescompute = _resaccountRepository.GetEntity(w => w.AllotID == allot.ID && w.AccountingUnit == second.Department && w.UnitType == (int)((UnitType)unittype));
var avg = (empolyee != null && empolyee.FitPeopleValue.HasValue) ? empolyee.FitPeopleValue : rescompute?.Avg ?? 0;
refAvg = rescompute?.Avg ?? 0; refAvg = rescompute?.Avg ?? 0;
} }
head.AddOrUpdate("RefAvg", Math.Round(refAvg, 0, MidpointRounding.AwayFromZero)); head.AddOrUpdate("RefAvg", Math.Round(refAvg, 0, MidpointRounding.AwayFromZero));
......
...@@ -65,7 +65,8 @@ public List<SelectionOptions> GetReportSelection(int groupId, int userId, int ho ...@@ -65,7 +65,8 @@ public List<SelectionOptions> GetReportSelection(int groupId, int userId, int ho
if (selections == null) if (selections == null)
return options; 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 }; 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))) 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, ...@@ -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)) var selections = selectionRepository.GetEntities(w => arr2.Contains(w.ID) && w.State.HasValue && dispaly.Contains(w.State.Value))
?? new List<rep_selection>(); ?? new List<rep_selection>();
var isMedical = IsMedical(userId); var userInfo = userRepository.GetUser(userId);
var department = GetUserDepartment(userId); var isMedical = userInfo.IsSecondAdmin;
var department = userInfo?.User.Department ?? "";
List<ReportData> result = new List<ReportData>(); List<ReportData> result = new List<ReportData>();
foreach (var report in reports) foreach (var report in reports)
...@@ -357,23 +359,6 @@ private string ReplacePlaceholder(List<rep_selection> selections, List<Selection ...@@ -357,23 +359,6 @@ private string ReplacePlaceholder(List<rep_selection> selections, List<Selection
} }
return content; 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 ...@@ -331,7 +331,7 @@ private void ImporAccountData(ISheet sheet, List<string> columns, int hospitalId
logger.LogInformation($"人均绩效计算"); logger.LogInformation($"人均绩效计算");
Dictionary<string, string> basicDict = new Dictionary<string, string> Dictionary<string, string> basicDict = new Dictionary<string, string>
{ {
{ "行政工勤人均绩效", UnitType.行政.ToString() }, { "行政工勤人均绩效", UnitType.行政.ToString() },
{ "临床医生人均绩效", UnitType.医生组.ToString() }, { "临床医生人均绩效", UnitType.医生组.ToString() },
{ "医技医生人均绩效", UnitType.医技组.ToString() }, { "医技医生人均绩效", UnitType.医技组.ToString() },
{ "护士人均绩效", UnitType.护理组.ToString() }, { "护士人均绩效", UnitType.护理组.ToString() },
...@@ -634,7 +634,7 @@ public ApiResponse SaveReportPersonTag(int hospitalId, int allotId, int userId, ...@@ -634,7 +634,7 @@ public ApiResponse SaveReportPersonTag(int hospitalId, int allotId, int userId,
var hos = _hospitalRepository.GetEntity(t => t.ID == hospitalId); 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 alias = _computeService.CustomColumnHeaders(hos, "/result/all_employee"); var alias = _computeService.CustomColumnHeaders(hos, "/result/all_employee");
var dicData = CreateDataRow(hospitalId, request, alias); var dicData = CreateDataRow(hospitalId, request, alias);
var tags = reportperformancepersontagsRepository.GetEntities(t => t.HospitalId == hospitalId); var tags = reportperformancepersontagsRepository.GetEntities(t => t.HospitalId == hospitalId);
...@@ -757,13 +757,13 @@ public ApiResponse SaveReportPersonTag(int hospitalId, int allotId, int userId, ...@@ -757,13 +757,13 @@ public ApiResponse SaveReportPersonTag(int hospitalId, int allotId, int userId,
return new ApiResponse(ResponseType.OK); 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, Columns = ReportTag.Select(t => new HandsonColumn(t.Value)).ToList(),
Visible = 1 ColHeaders = ReportTag.Select(t => t.Value).ToList(),
}).ToList()); };
var data = reportperformancetagsRepository.GetEntities(t => t.HospitalId == hospitalId)?.OrderBy(t => t.UnitType); var data = reportperformancetagsRepository.GetEntities(t => t.HospitalId == hospitalId)?.OrderBy(t => t.UnitType);
if (data == null) return result; if (data == null) return result;
...@@ -780,7 +780,7 @@ public HandsonTable GetReportTag(int hospitalId) ...@@ -780,7 +780,7 @@ public HandsonTable GetReportTag(int hospitalId)
rowDatas.Add(new HandsonRowData(i, cells)); rowDatas.Add(new HandsonRowData(i, cells));
i++; i++;
} }
result.SetRowData(rowDatas, rowDatas != null); result.SetRowData(rowDatas);
return result; return result;
} }
......
...@@ -654,7 +654,7 @@ private void SupplyHeaderByWorkItem(int hospitalId, SecondResponse result, ag_se ...@@ -654,7 +654,7 @@ private void SupplyHeaderByWorkItem(int hospitalId, SecondResponse result, ag_se
#region 其他模板详情 #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[] { }; string[] workNumbers = new string[] { };
var details = GetOtherTempDetails(userId, secondId, isArchive, employeeSource); var details = GetOtherTempDetails(userId, secondId, isArchive, employeeSource);
...@@ -666,12 +666,11 @@ public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, in ...@@ -666,12 +666,11 @@ public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, in
OtherTemp.Select(t => t.Value).ToArray() : OtherTemp.Select(t => t.Value).ToArray() :
new string[] { "可分配绩效", "科室单项奖励", "医院其他绩效", "预留年度考核比例", "年度考核发放金额", "预发绩效工资金额" }; 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, Columns = OtherTemp.Select(t => new HandsonColumn(t.Value)).ToList(),
Visible = 1, ColHeaders = OtherTemp.Select(t => t.Value).ToList(),
Readnoly = readColumns.Contains(t.Value) ? 1 : 0 };
}).ToList());
if (result.Columns != null && result.Columns.Any()) if (result.Columns != null && result.Columns.Any())
{ {
...@@ -707,7 +706,7 @@ public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, in ...@@ -707,7 +706,7 @@ public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, in
rowDatas.Add(new HandsonRowData(i, cells)); rowDatas.Add(new HandsonRowData(i, cells));
i++; i++;
} }
result.SetRowData(rowDatas, rowDatas != null); result.SetRowData(rowDatas);
return result; return result;
} }
...@@ -739,7 +738,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is ...@@ -739,7 +738,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
var role = _userService.GetUserFirstRole(userId); var role = _userService.GetUserFirstRole(userId);
//行政科室 只有两种逻辑,或从保存中加载,或加载EXCEL表 //行政科室 只有两种逻辑,或从保存中加载,或加载EXCEL表
if (role?.Type == _application.OfficeRole) if (role?.Type == (int)Role.行政科室)
{ {
// 如果已经保存>>走保存加载逻辑 // 如果已经保存>>走保存加载逻辑
if (employeeSource == (int)EmployeeSource.Initial) if (employeeSource == (int)EmployeeSource.Initial)
...@@ -825,7 +824,7 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em ...@@ -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()); var empl = employees?.FirstOrDefault(w => w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim());
item.ReservedRatio = empl?.ReservedRatio ?? 0; 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); item.WorkPerformance = distPerformance?.Where(w => w.AccountingUnit == item.Department && w.JobNumber?.Trim() == item.WorkNumber?.Trim())?.Sum(w => w.GiveFee);
if (string.IsNullOrEmpty(item.WorkNumber)) if (string.IsNullOrEmpty(item.WorkNumber))
...@@ -835,7 +834,7 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em ...@@ -835,7 +834,7 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em
if (second.UnitType.Replace("其他", "").Replace("医技", "医生") if (second.UnitType.Replace("其他", "").Replace("医技", "医生")
== (empl?.UnitType ?? "").Replace("其他", "").Replace("医技", "医生")) == (empl?.UnitType ?? "").Replace("其他", "").Replace("医技", "医生"))
{ {
if (second.UnitType == UnitType.行政后勤.ToString()) if (UnitTypeUtil.IsOffice(second.UnitType))
{ {
if (string.IsNullOrEmpty(item.WorkNumber)) if (string.IsNullOrEmpty(item.WorkNumber))
{ {
......
...@@ -9,6 +9,23 @@ namespace Performance.Services ...@@ -9,6 +9,23 @@ namespace Performance.Services
public class UnitTypeUtil public class UnitTypeUtil
{ {
public static string[] Office = new string[] { "行政后勤", "行政工勤" }; 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> /// <summary>
/// 是否是行政后勤/工勤 /// 是否是行政后勤/工勤
...@@ -17,7 +34,7 @@ public class UnitTypeUtil ...@@ -17,7 +34,7 @@ public class UnitTypeUtil
/// <returns></returns> /// <returns></returns>
public static bool IsOffice(int? unit) public static bool IsOffice(int? unit)
{ {
return unit == (int)UnitType.行政; return unit == (int)UnitType.行政;
} }
/// <summary> /// <summary>
...@@ -74,5 +91,6 @@ public static string Recognition(string name, AccountUnitType defaultValue) ...@@ -74,5 +91,6 @@ public static string Recognition(string name, AccountUnitType defaultValue)
return defaultValue.ToString(); 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