医院其他绩效

parent 8557ff6a
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// * FileName: per_apr_amount.cs // * FileName: per_apr_amount.cs
// </copyright> // </copyright>
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
using Dapper;
using Performance.EntityModels; using Performance.EntityModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -16,50 +17,82 @@ namespace Performance.Repository ...@@ -16,50 +17,82 @@ namespace Performance.Repository
/// </summary> /// </summary>
public partial class PerforPerapramountRepository : PerforRepository<per_apr_amount> public partial class PerforPerapramountRepository : PerforRepository<per_apr_amount>
{ {
public List<view_per_apr_amount> GetFullAmount(Expression<Func<per_apr_amount, bool>> predicate)
/// <summary>
/// per_apr_amount Repository
/// </summary>
public partial class PerforPerapramountRepository : PerforRepository<per_apr_amount>
{ {
var amounts = GetEntities(predicate); //public List<view_per_apr_amount> GetFullAmount(Expression<Func<per_apr_amount, bool>> predicate)
if (amounts == null || !amounts.Any()) //{
return new List<view_per_apr_amount>(); // var amounts = GetEntities(predicate);
// if (amounts == null || !amounts.Any())
// return new List<view_per_apr_amount>();
// var ids = amounts.Select(w => w.AllotId).Distinct().ToList();
// var employees = this.context.Set<per_employee>()
// .Where(w => w.AllotId.HasValue && ids.Contains(w.AllotId.Value))
// .Select(w => new
// {
// UnitType = w.UnitType,
// AccountingUnit = w.AccountingUnit,
// AllotId = w.AllotId,
// PersonnelNumber = w.PersonnelNumber,
// DoctorName = w.DoctorName,
// });
// var res = from outer in amounts
// join inner in employees
// on new { outer.AllotId, outer.PersonnelNumber } equals new { AllotId = inner.AllotId ?? 0, inner.PersonnelNumber } into temp
// from tt in temp.DefaultIfEmpty()
// select new view_per_apr_amount
// {
// Id = outer.Id,
// AllotId = outer.AllotId,
// PersonnelNumber = outer.PersonnelNumber,
// PerforType = outer.PerforType,
// Amount = outer.Amount,
// DoctorName = tt?.DoctorName ?? "",
// AccountingUnit = tt?.AccountingUnit ?? "",
// UnitType = tt?.UnitType ?? "",
// TypeInDepartment = outer.TypeInDepartment,
// Status = outer.Status,
// AuditTime = outer.AuditTime,
// AuditUser = outer.AuditUser,
// CreateDate = outer.CreateDate,
// CreateUser = outer.CreateUser,
// Remark = outer.Remark,
// IsVerify = outer.IsVerify,
// VerifyMessage = outer.VerifyMessage,
// };
// return res.ToList() ?? new List<view_per_apr_amount>();
//}
var ids = amounts.Select(w => w.AllotId).Distinct().ToList();
var employees = this.context.Set<per_employee>() public List<view_per_apr_amount> GetFullAmount(int? allotId, int? status, string typeInDepartment = "")
.Where(w => w.AllotId.HasValue && ids.Contains(w.AllotId.Value)) {
.Select(w => new string sql = "select * from view_per_apr_amount where ifnull(amount,0)<>0 ";
DynamicParameters parameters = new DynamicParameters();
if (allotId.HasValue && allotId > 0)
{
sql += " and allotId = @allotId";
parameters.Add("allotId", allotId);
}
if (status.HasValue && status > 0)
{
sql += " and status = @status";
parameters.Add(name: "status", status);
}
if (!string.IsNullOrEmpty(typeInDepartment))
{ {
UnitType = w.UnitType, sql += " and typeInDepartment = @typeInDepartment";
AccountingUnit = w.AccountingUnit, parameters.Add(name: "typeInDepartment", typeInDepartment);
AllotId = w.AllotId, }
PersonnelNumber = w.PersonnelNumber,
DoctorName = w.DoctorName,
});
var res = from outer in amounts return DapperQuery<view_per_apr_amount>(sql, parameters).ToList();
join inner in employees }
on new { outer.AllotId, outer.PersonnelNumber } equals new { AllotId = inner.AllotId ?? 0, inner.PersonnelNumber } into temp
from tt in temp.DefaultIfEmpty()
select new view_per_apr_amount
{
Id = outer.Id,
AllotId = outer.AllotId,
PersonnelNumber = outer.PersonnelNumber,
PerforType = outer.PerforType,
Amount = outer.Amount,
DoctorName = tt?.DoctorName ?? "",
AccountingUnit = tt?.AccountingUnit ?? "",
UnitType = tt?.UnitType ?? "",
TypeInDepartment = outer.TypeInDepartment,
Status = outer.Status,
AuditTime = outer.AuditTime,
AuditUser = outer.AuditUser,
CreateDate = outer.CreateDate,
CreateUser = outer.CreateUser,
Remark = outer.Remark,
IsVerify = outer.IsVerify,
VerifyMessage = outer.VerifyMessage,
};
return res.ToList() ?? new List<view_per_apr_amount>();
} }
} }
}
...@@ -621,7 +621,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId) ...@@ -621,7 +621,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
#region 医院其他绩效 && 不公示其他绩效 #region 医院其他绩效 && 不公示其他绩效
var otherPerformances = perapramountRepository var otherPerformances = perapramountRepository
.GetFullAmount(t => t.AllotId == allotId && t.Status == 3) .GetFullAmount(allotId, 3)
?.GroupBy(t => new { t.AccountingUnit, t.UnitType }) ?.GroupBy(t => new { t.AccountingUnit, t.UnitType })
.Select(t => new view_per_total_amount(t.Key.UnitType.Replace("行政后勤", "行政工勤"), t.Key.AccountingUnit, "", t.Sum(s => s.Amount) ?? 0)) .Select(t => new view_per_total_amount(t.Key.UnitType.Replace("行政后勤", "行政工勤"), t.Key.AccountingUnit, "", t.Sum(s => s.Amount) ?? 0))
.ToList(); .ToList();
...@@ -838,7 +838,7 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM ...@@ -838,7 +838,7 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
// 医院其他绩效汇总 // 医院其他绩效汇总
var totalAmounts = perapramountRepository var totalAmounts = perapramountRepository
.GetFullAmount(t => t.AllotId == allotId && t.Status == 3) .GetFullAmount(allotId, 3)
?.GroupBy(w => new { w.AccountingUnit, w.UnitType, w.PersonnelNumber }) ?.GroupBy(w => new { w.AccountingUnit, w.UnitType, w.PersonnelNumber })
.Select(w => new view_per_total_amount(w.Key.UnitType, w.Key.AccountingUnit, w.Key.PersonnelNumber, w.Sum(t => t.Amount) ?? 0)) .Select(w => new view_per_total_amount(w.Key.UnitType, w.Key.AccountingUnit, w.Key.PersonnelNumber, w.Sum(t => t.Amount) ?? 0))
?.ToList(); ?.ToList();
......
...@@ -454,14 +454,7 @@ public List<per_apr_amount> GetAprList(int allotId, int userId) ...@@ -454,14 +454,7 @@ public List<per_apr_amount> GetAprList(int allotId, int userId)
/// <returns></returns> /// <returns></returns>
public List<view_per_apr_amount> GetAprList(int allotId, string department, int? status = null) public List<view_per_apr_amount> GetAprList(int allotId, string department, int? status = null)
{ {
Expression<Func<per_apr_amount, bool>> predicate = w => w.AllotId == allotId && w.Amount.HasValue && w.Amount != 0; var list = perapramountRepository.GetFullAmount(allotId, status, department);
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()) if (list != null && list.Any())
list = list.OrderBy(t => t.DoctorName).ToList(); list = list.OrderBy(t => t.DoctorName).ToList();
...@@ -758,7 +751,7 @@ public List<TitleValue> GetPerforTypeDict(int allotId) ...@@ -758,7 +751,7 @@ public List<TitleValue> GetPerforTypeDict(int allotId)
public List<Dictionary<string, string>> GetOtherPerStats(int allotId, string department = null) public List<Dictionary<string, string>> GetOtherPerStats(int allotId, string department = null)
{ {
var others = new List<Dictionary<string, string>>(); var others = new List<Dictionary<string, string>>();
var aprAmountList = perapramountRepository.GetFullAmount(w => w.AllotId == allotId && w.Status == 3); var aprAmountList = perapramountRepository.GetFullAmount(allotId, 3);
if (department != null) if (department != null)
aprAmountList = aprAmountList.Where(t => t.AccountingUnit == department).ToList(); aprAmountList = aprAmountList.Where(t => t.AccountingUnit == department).ToList();
var perForType = aprAmountList.Select(t => t.PerforType).Distinct(); var perForType = aprAmountList.Select(t => t.PerforType).Distinct();
......
...@@ -938,8 +938,7 @@ public void SupplementOtherPerfor(ag_secondallot second, List<Dictionary<string, ...@@ -938,8 +938,7 @@ public void SupplementOtherPerfor(ag_secondallot second, List<Dictionary<string,
if (rows == null || rows.Count == 0) if (rows == null || rows.Count == 0)
return; return;
var perapramounts = _perapramountRepository var perapramounts = _perapramountRepository.GetFullAmount(second.AllotId, 3);
.GetFullAmount(t => t.AllotId == second.AllotId && t.Status == 3);
if (perapramounts == null || !perapramounts.Any()) if (perapramounts == null || !perapramounts.Any())
return; return;
......
...@@ -487,7 +487,7 @@ private void SupplementOtherPerfor(ag_secondallot secondAllot, List<BodyItem> bo ...@@ -487,7 +487,7 @@ private void SupplementOtherPerfor(ag_secondallot secondAllot, List<BodyItem> bo
{ {
if (bodyItems == null || !bodyItems.Any(w => w.RowNumber > -1)) return; if (bodyItems == null || !bodyItems.Any(w => w.RowNumber > -1)) return;
var perapramounts = perapramountRepository.GetFullAmount(t => t.AllotId == secondAllot.AllotId && t.Status == 3); var perapramounts = perapramountRepository.GetFullAmount(secondAllot.AllotId, 3);
if (perapramounts == null || !perapramounts.Any()) return; if (perapramounts == null || !perapramounts.Any()) return;
var rowNumberList = bodyItems.Where(w => w.RowNumber > -1).Select(w => w.RowNumber).Distinct().OrderBy(t => t).ToList(); var rowNumberList = bodyItems.Where(w => w.RowNumber > -1).Select(w => w.RowNumber).Distinct().OrderBy(t => t).ToList();
...@@ -816,7 +816,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is ...@@ -816,7 +816,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
private void SupplementSecondDetail(ag_secondallot second, List<per_employee> employees, List<ag_othersource> result, bool isTitlePerformance = true) private void SupplementSecondDetail(ag_secondallot second, List<per_employee> employees, List<ag_othersource> result, bool isTitlePerformance = true)
{ {
// 补充医院其他绩效 及 预留比例 // 补充医院其他绩效 及 预留比例
var perapramounts = perapramountRepository.GetFullAmount(t => t.AllotId == second.AllotId && t.Status == 3); var perapramounts = perapramountRepository.GetFullAmount(second.AllotId, 3);
var distPerformance = rescomputeRepository.GetEntities(t => t.AllotID == second.AllotId); var distPerformance = rescomputeRepository.GetEntities(t => t.AllotID == second.AllotId);
foreach (var item in result) foreach (var item in result)
......
...@@ -195,7 +195,7 @@ private void SupplementOtherPerfor(ag_secondallot secondAllot, List<ag_bodysourc ...@@ -195,7 +195,7 @@ private void SupplementOtherPerfor(ag_secondallot secondAllot, List<ag_bodysourc
{ {
if (bodyItems == null || !bodyItems.Any(w => w.RowNumber > -1)) return; if (bodyItems == null || !bodyItems.Any(w => w.RowNumber > -1)) return;
var perapramounts = perapramountRepository.GetFullAmount(t => t.AllotId == secondAllot.AllotId && t.Status == 3); var perapramounts = perapramountRepository.GetFullAmount(secondAllot.AllotId, 3);
if (perapramounts == null || !perapramounts.Any()) return; if (perapramounts == null || !perapramounts.Any()) return;
foreach (var rowitem in bodyItems) foreach (var rowitem in bodyItems)
......
...@@ -2323,7 +2323,7 @@ public dynamic Print(int secondId) ...@@ -2323,7 +2323,7 @@ public dynamic Print(int secondId)
} }
// 补充医院其他绩效 及 预留比例 // 补充医院其他绩效 及 预留比例
var perapramounts = perapramountRepository.GetFullAmount(t => t.AllotId == second.AllotId && t.Status == 3); var perapramounts = perapramountRepository.GetFullAmount(second.AllotId, 3);
var employees = personService.GetPerEmployee(second.AllotId.Value); var employees = personService.GetPerEmployee(second.AllotId.Value);
// 补充字典中该科室不存在,但有其它绩效的人员信息 // 补充字典中该科室不存在,但有其它绩效的人员信息
......
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