Commit 2c56d8c7 by lcx

Merge branch 'v2020morge' into v2020morge-graphql

# Conflicts:
#	performance/Performance.EntityModels/Entity/report_performance_category.cs
#	performance/Performance.Services/AllotCompute/ProcessComputService.cs
#	performance/Performance.Services/RoleService.cs
parents 2ff1bc2a c561c247
//-----------------------------------------------------------------------
// <copyright file=" report_performance_category.cs">
// * FileName: .cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
///
/// </summary>
[Table("report_performance_category")]
public class report_performance_category
{
/// <summary>
///
/// </summary>
[Key]
public int Id { get; set; }
/// <summary>
///
/// </summary>
public int HospitalId { get; set; }
/// <summary>
///
/// </summary>
public int Year { get; set; }
/// <summary>
///
/// </summary>
public int Month { get; set; }
/// <summary>
///
/// </summary>
public string Category { get; set; }
/// <summary>
///
/// </summary>
public string Original { get; set; }
/// <summary>
///
/// </summary>
public string ItemName { get; set; }
}
}
...@@ -375,28 +375,46 @@ public void ComputeOffice(per_allot allot, PerExcel excel) ...@@ -375,28 +375,46 @@ public void ComputeOffice(per_allot allot, PerExcel excel)
//var materialsExtra = materialsExtras.FirstOrDefault(w => w.UnitType == account.AccountType.ToString() && w.AccountingUnit == resAccount.AccountingUnit)?.TotelValue; //var materialsExtra = materialsExtras.FirstOrDefault(w => w.UnitType == account.AccountType.ToString() && w.AccountingUnit == resAccount.AccountingUnit)?.TotelValue;
var dept = new PerDataAccountBaisc(); var dept = new PerDataAccountBaisc();
//dept.ManagerNumber = resAccount?.ManagerNumber ?? 0;
dept.Number = empolyees.Count(); dept.Number = empolyees.Count();
dept.AccountingUnit = account.AccountingUnit; dept.AccountingUnit = account.AccountingUnit;
dept.UnitType = account.AccountType; dept.UnitType = account.AccountType;
dept.ScoringAverage = resAccount?.ScoringAverage == null ? 1 : resAccount.ScoringAverage;
dept.AdjustFactor = (isBudget ? adjust : resAccount?.AdjustFactor) ?? 1;
dept.Income = empolyees.Sum(w => w.PerforTotal ?? 0); dept.Income = empolyees.Sum(w => w.PerforTotal ?? 0);
dept.NeedSecondAllot = empolyees.Any(w => w.NeedSecondAllot == "是") ? "是" : "否"; dept.NeedSecondAllot = empolyees.Any(w => w.NeedSecondAllot == "是") ? "是" : "否";
if (resAccount?.UnitType == UnitType.行政后勤.ToString() && resAccount?.NeedSecondAllot == "是")
{
dept.ScoringAverage = resAccount?.ScoringAverage == null ? 0 : resAccount.ScoringAverage;
dept.AdjustFactor = (isBudget ? adjust : resAccount?.AdjustFactor) ?? 1;
dept.Extra = resAccount?.Extra ?? 0;
dept.MedicineExtra = resAccount?.MedicineExtra ?? 0;// (drugExtra ?? 0);
dept.MaterialsExtra = resAccount?.MaterialsExtra ?? 0;//(materialsExtra ?? 0);
dept.AssessBeforeOtherFee = resAccount?.AssessBeforeOtherFee ?? 0;
dept.AssessLaterOtherFee = resAccount?.AssessLaterOtherFee ?? 0;
// 行政后勤 没有 调节后其他绩效
//dept.AdjustLaterOtherFee = resAccount?.AdjustLaterOtherFee ?? 0;
}
else
{
dept.ScoringAverage = 1;
dept.AdjustFactor = 1;
dept.Extra = empolyees?.Sum(w => w.Punishment) ?? 0;
dept.MedicineExtra = 0;// (drugExtra ?? 0);
dept.MaterialsExtra = 0;//(materialsExtra ?? 0);
dept.AssessBeforeOtherFee = empolyees?.Sum(w => w.AssessBeforeOtherFee) ?? 0;
dept.AssessLaterOtherFee = empolyees?.Sum(w => w.AssessLaterOtherFee) ?? 0;
dept.AdjustLaterOtherFee = empolyees?.Sum(w => w.AdjustLaterOtherFee) ?? 0;
}
//dept.Extra = (extra ?? 0); //dept.Extra = (extra ?? 0);
//dept.MedicineExtra = 0;// (drugExtra ?? 0); //dept.MedicineExtra = 0;// (drugExtra ?? 0);
//dept.MaterialsExtra = 0;//(materialsExtra ?? 0); //dept.MaterialsExtra = 0;//(materialsExtra ?? 0);
dept.Extra = resAccount?.Extra ?? 0;
dept.MedicineExtra = resAccount?.MedicineExtra ?? 0;// (drugExtra ?? 0);
dept.MaterialsExtra = resAccount?.MaterialsExtra ?? 0;//(materialsExtra ?? 0);
dept.AssessBeforeOtherFee = resAccount?.AssessBeforeOtherFee ?? 0;
dept.AssessLaterOtherFee = resAccount?.AssessLaterOtherFee ?? 0;
dept.AdjustLaterOtherFee = resAccount?.AdjustLaterOtherFee ?? 0;
dept.PerforFee = empolyees.Sum(w => w.PerforTotal ?? 0); dept.PerforFee = empolyees.Sum(w => w.PerforTotal ?? 0);
dept.PerforTotal = Math.Round(empolyees.Sum(w => w.GiveFee ?? 0)); dept.PerforTotal = Math.Round(empolyees.Sum(w => w.GiveFee ?? 0));
dept.RealGiveFee = Math.Round(((dept.PerforTotal * dept.ScoringAverage + dept.MedicineExtra + dept.MaterialsExtra + dept.Extra) * dept.AdjustFactor) ?? 0); dept.RealGiveFee = Math.Round(((dept.PerforTotal * dept.ScoringAverage + dept.MedicineExtra + dept.MaterialsExtra + dept.Extra) * dept.AdjustFactor + dept.AdjustLaterOtherFee) ?? 0);
//dept.Avg = dept.ManagerNumber + dept.Number == 0 ? 0 : dept.PerforTotal / (dept.ManagerNumber + dept.Number); //dept.Avg = dept.ManagerNumber + dept.Number == 0 ? 0 : dept.PerforTotal / (dept.ManagerNumber + dept.Number);
dept.Avg = dept.Number == 0 ? 0 : dept.PerforTotal / dept.Number; dept.Avg = dept.Number == 0 ? 0 : dept.PerforTotal / dept.Number;
......
...@@ -319,7 +319,8 @@ public List<DeptResponse> GetOfficePerformance(int allotId) ...@@ -319,7 +319,8 @@ public List<DeptResponse> GetOfficePerformance(int allotId)
public List<DeptResponse> GetAdminPerformance(int allotId) public List<DeptResponse> GetAdminPerformance(int allotId)
{ {
var result = new List<DeptResponse>(); var result = new List<DeptResponse>();
//var types = new[] { (int)UnitType.行政高层, (int)UnitType.行政中层 };
//var resData = perforResaccountRepository.GetEntities(t => t.AllotID == allotId && !types.Contains(t.UnitType ?? 0));
var resData = perforResaccountRepository.GetEntities(t => t.AllotID == allotId); var resData = perforResaccountRepository.GetEntities(t => t.AllotID == allotId);
if (resData != null && resData.Any()) if (resData != null && resData.Any())
{ {
...@@ -327,11 +328,10 @@ public List<DeptResponse> GetAdminPerformance(int allotId) ...@@ -327,11 +328,10 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
result.ForEach(t => result.ForEach(t =>
{ {
t.UnitName = ((UnitType)t.UnitType).ToString(); t.UnitName = ((UnitType)t.UnitType).ToString();
t.AssessLaterPerforTotal = Math.Round((t.PerforTotal * t.ScoringAverage + t.MedicineExtra + t.MaterialsExtra + t.Extra + t.AssessLaterOtherFee) ?? 0); t.AssessLaterPerforTotal = Math.Round((t.PerforTotal * t.ScoringAverage + (t.MedicineExtra ?? 0) + (t.MaterialsExtra ?? 0) + (t.Extra ?? 0) + (t.AssessLaterOtherFee ?? 0)) ?? 0);
}); });
result = result.OrderBy(t => t.UnitType).ThenBy(t => t.AccountingUnit).ToList(); result = result.OrderBy(t => t.UnitType).ThenBy(t => t.AccountingUnit).ToList();
} }
var list = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId); var list = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId);
if (list == null || !list.Any()) return result; if (list == null || !list.Any()) return result;
...@@ -1455,12 +1455,12 @@ public res_baiscnorm EditHospitalAvg(ComputerAvgRequest request) ...@@ -1455,12 +1455,12 @@ public res_baiscnorm EditHospitalAvg(ComputerAvgRequest request)
public List<Dictionary<string, string>> GetOtherPerStats(List<per_apr_amount> employees) public List<Dictionary<string, string>> GetOtherPerStats(List<per_apr_amount> employees)
{ {
var others = new List<Dictionary<string, string>>(); var others = new List<Dictionary<string, string>>();
if (employees==null) if (employees == null)
return others; return others;
var perForType = employees.Where(c=>c.Status==3).Select(t => t.PerforType).Distinct(); var perForType = employees.Where(c => c.Status == 3).Select(t => t.PerforType).Distinct();
var doctorNum = employees.Where(c=>c.Status==3).Select(t => t.PersonnelNumber).Distinct().ToList(); var doctorNum = employees.Where(c => c.Status == 3).Select(t => t.PersonnelNumber).Distinct().ToList();
if (!doctorNum.Any()) if (!doctorNum.Any())
return others; return others;
...@@ -1470,21 +1470,21 @@ public res_baiscnorm EditHospitalAvg(ComputerAvgRequest request) ...@@ -1470,21 +1470,21 @@ public res_baiscnorm EditHospitalAvg(ComputerAvgRequest request)
var amount = employees.Find(t => t.PersonnelNumber == num); var amount = employees.Find(t => t.PersonnelNumber == num);
if (amount == null) if (amount == null)
continue; continue;
dicData.Add("核算单元",amount?.AccountingUnit??""); dicData.Add("核算单元", amount?.AccountingUnit ?? "");
dicData.Add("工号",amount?.PersonnelNumber??""); dicData.Add("工号", amount?.PersonnelNumber ?? "");
dicData.Add("人员姓名",amount?.DoctorName??""); dicData.Add("人员姓名", amount?.DoctorName ?? "");
foreach (var type in perForType) foreach (var type in perForType)
{ {
var emp = employees.Where(t => t.PerforType == type && t.PersonnelNumber == num)?.ToList(); var emp = employees.Where(t => t.PerforType == type && t.PersonnelNumber == num)?.ToList();
if (!emp.Any()) if (!emp.Any())
dicData.Add(type,"0"); dicData.Add(type, "0");
else else
dicData.Add(type,Math.Round(Convert.ToDecimal(emp?.First()?.Amount),0).ToString()); dicData.Add(type, Math.Round(Convert.ToDecimal(emp?.First()?.Amount), 0).ToString());
} }
var sum = employees.Where(c=>c.PersonnelNumber==num)?.Sum(t => t.Amount); var sum = employees.Where(c => c.PersonnelNumber == num)?.Sum(t => t.Amount);
dicData.Add("合计",Math.Round(Convert.ToDecimal(sum),0).ToString()); dicData.Add("合计", Math.Round(Convert.ToDecimal(sum), 0).ToString());
others.Add(dicData); others.Add(dicData);
} }
......
...@@ -74,7 +74,7 @@ public static string GetValue(this ICell cell) ...@@ -74,7 +74,7 @@ public static string GetValue(this ICell cell)
return cell?.StringCellValue.ToString(); return cell?.StringCellValue.ToString();
case CellType.Formula: case CellType.Formula:
cell?.SetCellType(CellType.String); cell?.SetCellType(CellType.String);
return cell?.StringCellValue.ToString(); return cell?.StringCellValue?.ToString();
case CellType.Boolean: case CellType.Boolean:
return cell?.BooleanCellValue.ToString(); return cell?.BooleanCellValue.ToString();
case CellType.Unknown: case CellType.Unknown:
......
...@@ -30,7 +30,7 @@ public class RoleService : IAutoInjection ...@@ -30,7 +30,7 @@ public class RoleService : IAutoInjection
/// <param name="userid"></param> /// <param name="userid"></param>
/// <returns></returns> /// <returns></returns>
public List<RoleResponse> GetUserRole(int userid) public List<RoleResponse> GetUserRole(int userid)
{ {
var roles = GetRole(userid); var roles = GetRole(userid);
return Mapper.Map<List<RoleResponse>>(roles); return Mapper.Map<List<RoleResponse>>(roles);
} }
...@@ -58,34 +58,31 @@ public List<sys_role> GetRole(int userid) ...@@ -58,34 +58,31 @@ public List<sys_role> GetRole(int userid)
public List<RoleResponse> GetUsersRole(int userid) public List<RoleResponse> GetUsersRole(int userid)
{ {
List<RoleResponse> roleResponses = new List<RoleResponse>(); List<RoleResponse> roleResponses = new List<RoleResponse>();
var user = _userRepository.GetEntity(c => c.ID == userid); var user=_userRepository.GetEntity(c => c.ID == userid);
var ParentUser = _userRepository.GetEntities(c => c.ParentID == userid); var ParentUser = _userRepository.GetEntities(c => c.ParentID == userid);
if (user.ParentID != null || user.ParentID == 0) if (user.ParentID!=null || user.ParentID==0)
{ {
ParentUser = _userRepository.GetEntities(c => c.ParentID == user.ParentID); ParentUser=_userRepository.GetEntities(c => c.ParentID == user.ParentID);
} }
if (ParentUser != null) if (ParentUser != null)
{ {
foreach (var sysUser in ParentUser) foreach (var sysUser in ParentUser)
{ {
var useRoles = GetARole(sysUser.ID); var useRoles = GetARole(sysUser.ID);
var role = Mapper.Map<RoleResponse>(useRoles); var role = Mapper.Map<RoleResponse>(useRoles);
var userRole = _userroleRepository.GetEntity(t => t.RoleID == role.RoleID && t.UserID==sysUser.ID); role.Value = sysUser.ID;
if (userRole?.UserID != null) role.Value = (int) userRole?.UserID;
roleResponses.Add(role); roleResponses.Add(role);
} }
} }
var roles = GetARole(userid);
var isParent = user.ParentID == null || user.ParentID == 0; if (roles!=null)
var roles = GetARole(isParent ? userid : (int)user.ParentID);
if (roles != null)
{ {
var role = Mapper.Map<RoleResponse>(roles); var role = Mapper.Map<RoleResponse>(roles);
role.Value = isParent ? userid : (int) user.ParentID; role.Value = userid;
roleResponses.Add(role); roleResponses.Add(role);
} }
return roleResponses?.OrderBy(t => t.Type).ToList(); return roleResponses;
} }
/// <summary> /// <summary>
......
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