科主任/护士长管理绩效打印

parent bb5ddeef
...@@ -518,7 +518,7 @@ public ApiResponse SecondNewPrint(int secondid) ...@@ -518,7 +518,7 @@ public ApiResponse SecondNewPrint(int secondid)
} }
/// <summary> /// <summary>
/// 科主任/护士长绩效发布 /// 科主任/护士长管理绩效
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[Route("api/second/deptcompute/{allotId}")] [Route("api/second/deptcompute/{allotId}")]
...@@ -532,6 +532,19 @@ public ApiResponse DeptComputeDetail(int allotId) ...@@ -532,6 +532,19 @@ public ApiResponse DeptComputeDetail(int allotId)
} }
/// <summary> /// <summary>
/// 科主任/护士长管理绩效打印
/// </summary>
/// <returns></returns>
[Route("api/second/print/deptcompute/{allotId}")]
[HttpPost]
public ApiResponse DeptComputePrint(int allotId)
{
var userId = claimService.GetUserId();
var result = secondAllotService.DeptComputePrint(userId, allotId);
return new ApiResponse(ResponseType.OK, result);
}
/// <summary>
/// 获取二次绩效详情数据 /// 获取二次绩效详情数据
/// </summary> /// </summary>
/// <param name="secondId"></param> /// <param name="secondId"></param>
......
...@@ -2324,7 +2324,13 @@ ...@@ -2324,7 +2324,13 @@
</member> </member>
<member name="M:Performance.Api.Controllers.SecondAllotController.DeptComputeDetail(System.Int32)"> <member name="M:Performance.Api.Controllers.SecondAllotController.DeptComputeDetail(System.Int32)">
<summary> <summary>
科主任/护士长绩效发布 科主任/护士长管理绩效
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.SecondAllotController.DeptComputePrint(System.Int32)">
<summary>
科主任/护士长管理绩效打印
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
......
...@@ -326,6 +326,32 @@ public IEnumerable<dynamic> QuerySecondPrintRow(int allotId, string unitType, st ...@@ -326,6 +326,32 @@ public IEnumerable<dynamic> QuerySecondPrintRow(int allotId, string unitType, st
throw; throw;
} }
} }
/// <summary>
/// 管理绩效打印
/// </summary>
/// <param name="allotId"></param>
/// <param name="unitTypes"></param>
/// <param name="accountingUnit"></param>
/// <returns></returns>
public IEnumerable<dynamic> QuerySecondPrintManagement(int allotId, string[] unitTypes, string accountingUnit)
{
try
{
using (var connection = new MySqlConnection(_options.Value.PerformanceConnectionString))
{
if (connection.State != ConnectionState.Open) connection.Open();
string sql = $@"select * from view_second_print_management where AllotId = @allotId and UnitType in @unitTypes and AccountingUnit = @AccountingUnit";
return connection.Query(sql, new { allotId, unitTypes, accountingUnit }, commandTimeout: 60 * 60);
}
}
catch (Exception ex)
{
_logger.LogError($"SQL执行异常:{ex}");
throw;
}
}
public IEnumerable<dynamic> QueryTableStructure(string tableName) public IEnumerable<dynamic> QueryTableStructure(string tableName)
{ {
try try
...@@ -344,6 +370,7 @@ public IEnumerable<dynamic> QueryTableStructure(string tableName) ...@@ -344,6 +370,7 @@ public IEnumerable<dynamic> QueryTableStructure(string tableName)
throw; throw;
} }
} }
public IEnumerable<dynamic> QueryView(string viewName, int allotID) public IEnumerable<dynamic> QueryView(string viewName, int allotID)
{ {
try try
......
...@@ -2458,6 +2458,48 @@ public List<DeptDataDetails> DeptComputeDetailList(int userId, int allotId, out ...@@ -2458,6 +2458,48 @@ public List<DeptDataDetails> DeptComputeDetailList(int userId, int allotId, out
} }
/// <summary> /// <summary>
/// 科主任/护士长管理绩效打印
/// </summary>
/// <param name="userId"></param>
/// <param name="allotId"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public dynamic DeptComputePrint(int userId, int allotId)
{
var allot = perallotRepository.GetEntity(t => t.ID == allotId);
if (allot == null) throw new NotImplementedException("当前用户不存在");
var userInfo = userRepository.GetUser(userId);
if (userInfo?.User == null) throw new NotImplementedException("当前用户不存在");
if (userInfo.URole == null) throw new NotImplementedException("当前用户暂未分配角色");
if (!userInfo.Hospitals.NotNullOrEmpty()) throw new NotImplementedException("当前用户暂未分配医院");
// 未下发或未归档 则不可见
var status = new int[] { (int)AllotStates.绩效下发, (int)AllotStates.归档 };
if (!status.Contains(allot.States)) return new { title = "", body = Array.Empty<dynamic>(), column = Array.Empty<dynamic>() };
Dictionary<int, string[]> maps = 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(), } },
};
// 查询当前角色下科室的绩效
var accountingUnit = userInfo.User.Department;
int roleType = userInfo?.URole.Type ?? 0;
var unitTypes = maps.ContainsKey(roleType) ? maps[roleType] : Array.Empty<string>();
if (unitTypes?.Any() != true) return new { title = "", body = Array.Empty<dynamic>(), column = Array.Empty<dynamic>() };
var body = _service.QuerySecondPrintManagement(allotId, unitTypes, accountingUnit);
var column = _service.QueryTableStructure("view_second_print_management");
var title = $"{allot.Year}{(string.IsNullOrEmpty(allot.Name) ? $"{allot.Month}月" : allot.Name)}科主任/护士长管理绩效发放表";
return new { title, body, column };
}
/// <summary>
/// 获取一次次绩效结果 /// 获取一次次绩效结果
/// </summary> /// </summary>
/// <param name="allotId"></param> /// <param name="allotId"></param>
......
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