Commit 43b2f77e by ruyun.zhang@suvalue.com

Merge branch 'feature/医院其他绩效备注' into develop

parents 34ffa4da 95ae2e44
......@@ -319,20 +319,21 @@ public ApiResponse GetAprDetail([FromBody] per_apr_amount request)
if (employee == null || !employee.Any())
return new ApiResponse(ResponseType.OK, "ok", employee);
var result = employee.GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName }).Select(t => new
{
PersonnelNumber = t.Key.PersonnelNumber,
DoctorName = t.Key.DoctorName,
AccountingUnit = t.Key.AccountingUnit,
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
Detail = t.GroupBy(group => group.PerforType).Select(s => new TitleValue<decimal>
var result = employee
.GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName })
.Select(t => new
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Value = s.Sum(sum => sum.Amount ?? 0)
})
});
PersonnelNumber = t.Key.PersonnelNumber,
DoctorName = t.Key.DoctorName,
AccountingUnit = t.Key.AccountingUnit,
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
Detail = t.GroupBy(group => group.PerforType).Select(s => new
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Value = s.Sum(sum => sum.Amount ?? 0),
Remark = s.FirstOrDefault()?.Remark ?? "",
})
});
return new ApiResponse(ResponseType.OK, "ok", result);
}
......@@ -463,20 +464,51 @@ public ApiResponse<List<TitleValue>> GetPerforTypeDict([FromRoute] int allotId)
[HttpPost]
public ApiResponse AprOverview(int allotId)
{
var roleType = new[] { 3, 4, 9, 10 };
//var roleType = new[] { 3, 4, 9, 10 };
//var userid = claim.GetUserId();
//var user = userService.GetUser(userid);
//var role = roleService.GetUserRole(user.UserID);
//var result = new List<Dictionary<string, string>>();
//if (role.Any(t => roleType.Contains(t.Type.Value)))
//result = employeeService.GetOtherPerStats(allotId, user.Department ?? "");
//else
// result = employeeService.GetOtherPerStats(allotId);
//return new ApiResponse(ResponseType.OK, result);
if (allotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employees = employeeService.GetAprList(allotId, "", 3);
if (employees == null || !employees.Any())
return new ApiResponse(ResponseType.OK, "ok", employees);
var roleType = new[] { (int)Role.护士长, (int)Role.科主任, (int)Role.特殊科室, (int)Role.行政科室, };
var userid = claim.GetUserId();
var user = userService.GetUser(userid);
var role = roleService.GetUserRole(user.UserID);
var result = new List<Dictionary<string, string>>();
if (role.Any(t => roleType.Contains(t.Type.Value)))
result = employeeService.GetOtherPerStats(allotId, user.Department ?? "");
else
result = employeeService.GetOtherPerStats(allotId);
return new ApiResponse(ResponseType.OK, result);
employees = employees.Where(w => w.AccountingUnit == user.Department).ToList();
var result = employees
.GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName })
.Select(t => new
{
PersonnelNumber = t.Key.PersonnelNumber,
DoctorName = t.Key.DoctorName,
AccountingUnit = t.Key.AccountingUnit,
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
Detail = t.GroupBy(group => group.PerforType).Select(s => new
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Remark = s.FirstOrDefault()?.Remark ?? "",
Value = s.Sum(sum => sum.Amount ?? 0)
})
});
return new ApiResponse(ResponseType.OK, "ok", result);
}
#endregion
......@@ -576,18 +608,21 @@ public ApiResponse GetAprHideDetail([FromBody] per_apr_amount request)
if (employee == null || !employee.Any())
return new ApiResponse(ResponseType.OK, "ok", employee);
var result = employee.GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName }).Select(t => new
{
PersonnelNumber = t.Key.PersonnelNumber,
DoctorName = t.Key.DoctorName,
AccountingUnit = t.Key.AccountingUnit,
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
Detail = t.GroupBy(group => group.PerforType).Select(s => new TitleValue<decimal>
var result = employee
.GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName })
.Select(t => new
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Value = s.Sum(sum => sum.Amount ?? 0)
})
});
PersonnelNumber = t.Key.PersonnelNumber,
DoctorName = t.Key.DoctorName,
AccountingUnit = t.Key.AccountingUnit,
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
Detail = t.GroupBy(group => group.PerforType).Select(s => new
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Value = s.Sum(sum => sum.Amount ?? 0),
Remark = s.FirstOrDefault()?.Remark ?? "",
})
});
return new ApiResponse(ResponseType.OK, "ok", result);
}
/// <summary>
......@@ -717,8 +752,40 @@ public ApiResponse<List<TitleValue>> GetPerforTypeDictHide([FromRoute] int allot
[HttpPost]
public ApiResponse AprHideOverview(int allotId)
{
var relust = employeeService.GetOtherPerStatsHide(allotId);
return new ApiResponse(ResponseType.OK, relust);
//var relust = employeeService.GetOtherPerStatsHide(allotId);
//return new ApiResponse(ResponseType.OK, relust);
if (allotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employees = employeeService.GetAprHideList(allotId, "", 3);
if (employees == null || !employees.Any())
return new ApiResponse(ResponseType.OK, "ok", employees);
var roleType = new[] { (int)Role.护士长, (int)Role.科主任, (int)Role.特殊科室, (int)Role.行政科室, };
var userid = claim.GetUserId();
var user = userService.GetUser(userid);
var role = roleService.GetUserRole(user.UserID);
if (role.Any(t => roleType.Contains(t.Type.Value)))
employees = employees.Where(w => w.AccountingUnit == user.Department).ToList();
var result = employees
.GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName })
.Select(t => new
{
PersonnelNumber = t.Key.PersonnelNumber,
DoctorName = t.Key.DoctorName,
AccountingUnit = t.Key.AccountingUnit,
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
Detail = t.GroupBy(group => group.PerforType).Select(s => new
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Remark = s.FirstOrDefault()?.Remark ?? "",
Value = s.Sum(sum => sum.Amount ?? 0)
})
});
return new ApiResponse(ResponseType.OK, "ok", result);
}
#endregion
......
......@@ -132,7 +132,7 @@ public enum Role
特殊科室 = 9,
行政科室 = 10,
数据收集 = 11,
护理部审核 = 13,
护理部审核 = 12,
绩效查询 = 13,
}
......
......@@ -449,9 +449,16 @@ public List<per_apr_amount> GetAprList(int allotId, int userId)
/// <param name="allotId"></param>
/// <param name="department"></param>
/// <returns></returns>
public List<view_per_apr_amount> GetAprList(int allotId, string department)
public List<view_per_apr_amount> GetAprList(int allotId, string department, int? status = null)
{
var list = perapramountRepository.GetFullAmount(t => t.AllotId == allotId && t.Amount.HasValue && t.Amount != 0 && (t.TypeInDepartment ?? "") == department);
Expression<Func<per_apr_amount, bool>> predicate = w => w.AllotId == allotId && w.Amount.HasValue && w.Amount != 0;
if (!string.IsNullOrEmpty(department))
predicate = predicate.And(w => !string.IsNullOrEmpty(w.TypeInDepartment) && w.TypeInDepartment == department);
if (status.HasValue)
predicate = predicate.And(w => w.Status == status);
var list = perapramountRepository.GetFullAmount(predicate);
if (list != null && list.Any())
list = list.OrderBy(t => t.DoctorName).ToList();
......@@ -612,7 +619,7 @@ public string ImpoerAprEmployees(int allotid, string path, int userid)
Dictionary<string, int> dict = new Dictionary<string, int>
{
{ "人员工号", -1 }, { "姓名", -1 }, { "绩效类型", -1 }, { "金额", -1 },
{ "人员工号", -1 }, { "姓名", -1 }, { "绩效类型", -1 }, { "金额", -1 }, { "备注", -1 },
};
foreach (var key in dict.Keys.ToList())
......@@ -638,8 +645,8 @@ public string ImpoerAprEmployees(int allotid, string path, int userid)
DoctorName = dict["姓名"] < 0 ? "" : row.GetCell(dict["姓名"]).GetValue(),
PerforType = dict["绩效类型"] < 0 ? "" : row.GetCell(dict["绩效类型"]).GetValue(),
Amount = dict["金额"] < 0 ? 0 : ConvertHelper.To<decimal>(row.GetCell(dict["金额"]).GetValue(), 0),
Remark = dict["备注"] < 0 ? "" : row.GetCell(dict["金额"]).GetValue(),
TypeInDepartment = typeIn,
//AccountingUnit = dict["核算单元"] < 0 ? "" : row.GetCell(dict["核算单元"]).GetValue(),
AllotId = allotid,
CreateDate = createtime,
CreateUser = userid,
......@@ -859,9 +866,16 @@ public List<per_apr_amount_hide> GetAprHideList(int allotId, int userId)
/// <param name="allotId"></param>
/// <param name="department"></param>
/// <returns></returns>
public List<view_per_apr_amount> GetAprHideList(int allotId, string department)
public List<view_per_apr_amount> GetAprHideList(int allotId, string department, int? status = null)
{
var list = _hideRepository.GetFullAmount(t => t.AllotId == allotId && t.Amount.HasValue && t.Amount != 0 && (t.TypeInDepartment ?? "") == department);
Expression<Func<per_apr_amount_hide, bool>> predicate = w => w.AllotId == allotId && w.Amount.HasValue && w.Amount != 0;
if (!string.IsNullOrEmpty(department))
predicate = predicate.And(w => !string.IsNullOrEmpty(w.TypeInDepartment) && w.TypeInDepartment == department);
if (status.HasValue)
predicate = predicate.And(w => w.Status == status);
var list = _hideRepository.GetFullAmount(predicate);
if (list != null && list.Any())
list = list.OrderBy(t => t.DoctorName).ToList();
......@@ -1016,7 +1030,7 @@ public void ImpoerAprHideEmployees(int allotid, string path, int userid)
Dictionary<string, int> dict = new Dictionary<string, int>
{
{ "人员工号", -1 }, { "姓名", -1 }, { "绩效类型", -1 }, { "金额", -1 },
{ "人员工号", -1 }, { "姓名", -1 }, { "绩效类型", -1 }, { "金额", -1 }, { "备注", -1 },
};
foreach (var key in dict.Keys.ToList())
......@@ -1040,6 +1054,7 @@ public void ImpoerAprHideEmployees(int allotid, string path, int userid)
DoctorName = dict["姓名"] < 0 ? "" : row.GetCell(dict["姓名"]).GetValue(),
PerforType = dict["绩效类型"] < 0 ? "" : row.GetCell(dict["绩效类型"]).GetValue(),
Amount = dict["金额"] < 0 ? 0 : ConvertHelper.To<decimal>(row.GetCell(dict["金额"]).GetValue(), 0),
Remark = dict["备注"] < 0 ? "" : row.GetCell(dict["备注"]).GetValue(),
TypeInDepartment = typeIn,
AllotId = allotid,
CreateDate = createtime,
......
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