Commit 34972b5a by Licx

Merge branch 'develop' into 医院其他绩效

# Conflicts:
#	performance/Performance.Services/EmployeeService.cs
parents 91a49d67 152ebb34
...@@ -164,8 +164,8 @@ public ApiResponse GetReportPersonTag(int hospitalId, int allotId) ...@@ -164,8 +164,8 @@ public ApiResponse GetReportPersonTag(int hospitalId, int allotId)
var relust = reportGlobalService.GetReportPersonTag(hospitalId, allotId); var relust = reportGlobalService.GetReportPersonTag(hospitalId, allotId);
return new ApiResponse(ResponseType.OK, new return new ApiResponse(ResponseType.OK, new
{ {
relust.ColHeaders, relust.handsonTable.ColHeaders,
relust.Data relust.handsonTable.Data
}); });
} }
/// <summary> /// <summary>
...@@ -179,13 +179,13 @@ public ApiResponse GetReportPersonTag(int hospitalId, int allotId) ...@@ -179,13 +179,13 @@ public ApiResponse GetReportPersonTag(int hospitalId, int allotId)
public ActionResult DownloadReportPersonTag(int hospitalId, int allotId) public ActionResult DownloadReportPersonTag(int hospitalId, int allotId)
{ {
var result = reportGlobalService.GetReportPersonTag(hospitalId, allotId).Data; var (result, colHeaders) = reportGlobalService.GetReportPersonTag(hospitalId, allotId);
var ser = JsonHelper.Serialize(result); var ser = JsonHelper.Serialize(result);
var rows = JsonHelper.Deserialize<List<Dictionary<string, object>>>(ser); var rows = JsonHelper.Deserialize<List<Dictionary<string, object>>>(ser);
var filepath = reportGlobalService.ReportPersonTagDownload(rows, "人员标签"); var filepath = reportGlobalService.ReportPersonTagDownload(rows, colHeaders, "人员标签");
var memoryStream = new MemoryStream(); var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open)) using (var stream = new FileStream(filepath, FileMode.Open))
......
...@@ -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,76 @@ namespace Performance.Repository ...@@ -16,50 +17,76 @@ 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) //public List<view_per_apr_amount> GetFullAmount(Expression<Func<per_apr_amount, bool>> predicate)
//{
// 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>();
//}
public List<view_per_apr_amount> GetFullAmount(int? allotId, int? status, string typeInDepartment = "")
{ {
var amounts = GetEntities(predicate); string sql = "select AllotId, PersonnelNumber, Trim(AccountingUnit) AccountingUnit, UnitType, DoctorName, PerforType, Amount, TypeInDepartment, Status, Remark from view_other_amount where ifnull(amount,0)<>0 ";
if (amounts == null || !amounts.Any())
return new List<view_per_apr_amount>();
var ids = amounts.Select(w => w.AllotId).Distinct().ToList(); DynamicParameters parameters = new DynamicParameters();
var employees = this.context.Set<per_employee>() if (allotId.HasValue && allotId > 0)
.Where(w => w.AllotId.HasValue && ids.Contains(w.AllotId.Value)) {
.Select(w => new sql += " and allotId = @allotId";
{ parameters.Add("allotId", allotId);
UnitType = w.UnitType, }
AccountingUnit = w.AccountingUnit, if (status.HasValue && status > 0)
AllotId = w.AllotId, {
PersonnelNumber = w.PersonnelNumber, sql += " and status = @status";
DoctorName = w.DoctorName, parameters.Add(name: "status", status);
}); }
if (!string.IsNullOrEmpty(typeInDepartment))
{
sql += " and typeInDepartment = @typeInDepartment";
parameters.Add(name: "typeInDepartment", typeInDepartment);
}
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>();
} }
} }
} }
...@@ -701,6 +701,7 @@ public bool IssuedChangeSecond(per_allot allot, List<ag_secondallot> secondList) ...@@ -701,6 +701,7 @@ public bool IssuedChangeSecond(per_allot allot, List<ag_secondallot> secondList)
} }
_service.FreezeAllotSync(allot.ID); _service.FreezeAllotSync(allot.ID);
_service.SecondUseTempRestoreSync(); _service.SecondUseTempRestoreSync();
_service.RestoreSecondAllotAsync();
} }
} }
perforAgsecondallotRepository.UpdateRange(updSeconds.ToArray()); perforAgsecondallotRepository.UpdateRange(updSeconds.ToArray());
......
...@@ -454,6 +454,7 @@ public void Generate(per_allot allot) ...@@ -454,6 +454,7 @@ public void Generate(per_allot allot)
resultComputeService.GenerateSecondAllot(allot); resultComputeService.GenerateSecondAllot(allot);
_service.FreezeAllotSync(allot.ID); _service.FreezeAllotSync(allot.ID);
_service.SecondUseTempRestoreSync(); _service.SecondUseTempRestoreSync();
_service.RestoreSecondAllotAsync();
_service.ClearAllotSync(); _service.ClearAllotSync();
UpdateAllotStates(allot.ID, (int)AllotStates.绩效结果解析成功, EnumHelper.GetDescription(AllotStates.绩效结果解析成功), generate); UpdateAllotStates(allot.ID, (int)AllotStates.绩效结果解析成功, EnumHelper.GetDescription(AllotStates.绩效结果解析成功), generate);
......
...@@ -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();
...@@ -2019,7 +2019,7 @@ public bool UpdateHeadersStatus(ComputerAliasUpdate request) ...@@ -2019,7 +2019,7 @@ public bool UpdateHeadersStatus(ComputerAliasUpdate request)
// 数据库中无数据 // 数据库中无数据
if (hasreq && !hasdata) if (hasreq && !hasdata)
{ {
var items = request.computerAliasHead.Select(t => t.Head.ToLower()); var items = request.computerAliasHead;
var data = heads.Select(t => new cof_alias var data = heads.Select(t => new cof_alias
{ {
Route = request.Route, Route = request.Route,
...@@ -2027,11 +2027,15 @@ public bool UpdateHeadersStatus(ComputerAliasUpdate request) ...@@ -2027,11 +2027,15 @@ public bool UpdateHeadersStatus(ComputerAliasUpdate request)
OriginalName = t.Alias, OriginalName = t.Alias,
HospitalId = request.HospitalId, HospitalId = request.HospitalId,
Name = t.Name, Name = t.Name,
States = items.Contains(t.Alias ?? "") ? 1 : 0,
SumStatus = t.SumStatus, SumStatus = t.SumStatus,
Sort = request.computerAliasHead.Any(w => w.Name == t.Name) Sort = request.computerAliasHead.Any(w => w.Name == t.Name)
? request.computerAliasHead.FirstOrDefault(w => w.Name == t.Name).Sort ? request.computerAliasHead.FirstOrDefault(w => w.Name == t.Name).Sort
: t.Sort : t.Sort
}).ToList();
data.ForEach(t =>
{
var state = items.FirstOrDefault(i => i.Head.ToLower().Contains(t.Alias));
t.States = state != null ? state.States : 1;
}); });
cofaliasRepository.AddRange(data.ToArray()); cofaliasRepository.AddRange(data.ToArray());
} }
......
...@@ -180,7 +180,7 @@ public IEnumerable<DeptdicResponse> GetDepartments(int allotId) ...@@ -180,7 +180,7 @@ public IEnumerable<DeptdicResponse> GetDepartments(int allotId)
if (connection.State != ConnectionState.Open) connection.Open(); if (connection.State != ConnectionState.Open) connection.Open();
try try
{ {
var depts = connection.Query<per_dept_dic>("select * from per_dept_dic where allotid = @allotid", new { allotId }, commandTimeout: 60 * 60); var depts = connection.Query<per_dept_dic>("select * from per_dept_dic where allotid = @allotid", new { allotId }, commandTimeout: 60 * 60);
if (depts == null || !depts.Any()) return null; if (depts == null || !depts.Any()) return null;
var allot = connection.QueryFirstOrDefault<per_allot>("select * from per_allot where id = @allotid", new { allotId }, commandTimeout: 60 * 60); var allot = connection.QueryFirstOrDefault<per_allot>("select * from per_allot where id = @allotid", new { allotId }, commandTimeout: 60 * 60);
...@@ -224,5 +224,29 @@ Deptdic GetDeptdic(List<per_dept_dic> dics, string department, string hISDeptNam ...@@ -224,5 +224,29 @@ Deptdic GetDeptdic(List<per_dept_dic> dics, string department, string hISDeptNam
} }
#endregion #endregion
/// <summary>
/// 科室改名历史数据处理
/// </summary>
/// <param name="allotId"></param>
public Task RestoreSecondAllotAsync()
{
return Task.Factory.StartNew(() =>
{
using (var connection = new MySqlConnection(_options.Value.PerformanceConnectionString))
{
if (connection.State != ConnectionState.Open) connection.Open();
try
{
string sql = $@"call proc_restore_secondallot()";
connection.Execute(sql, commandTimeout: 60 * 60);
}
catch (Exception)
{
throw;
}
}
});
}
} }
} }
...@@ -457,17 +457,7 @@ public List<per_apr_amount> GetAprList(int allotId, int userId) ...@@ -457,17 +457,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, DateTime? date = null) public List<view_per_apr_amount> GetAprList(int allotId, string department, int? status = null, DateTime? date = 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);
if (date != null)
predicate = predicate.And((w) => w.CreateDate == date);
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();
...@@ -784,7 +774,7 @@ public List<TitleValue> GetPerforTypeDict(int allotId) ...@@ -784,7 +774,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();
......
...@@ -131,20 +131,15 @@ public void CreateAllotPersons(int hospitalId, int allotId, int prevAllotId = -1 ...@@ -131,20 +131,15 @@ public void CreateAllotPersons(int hospitalId, int allotId, int prevAllotId = -1
BankCard = t.BankCard, BankCard = t.BankCard,
Remark = t.Remark, Remark = t.Remark,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
PersonnelNumber = t.PersonnelNumber,
JobNumber = t.JobNumber
}; };
if (!string.IsNullOrEmpty(t.PersonnelNumber) && !string.IsNullOrEmpty(t.JobNumber)) string number = !string.IsNullOrEmpty(t.PersonnelNumber) ? t.PersonnelNumber : t.JobNumber;
{ entity.PersonnelNumber = number;
entity.PersonnelNumber = t.PersonnelNumber;
entity.JobNumber = t.JobNumber;
}
else
{
string number = !string.IsNullOrEmpty(t.PersonnelNumber) ? t.PersonnelNumber : t.JobNumber;
entity.PersonnelNumber = number;
entity.JobNumber = number;
}
return entity; return entity;
}).ToList(); }).ToList();
SaveAllotPersons(data); SaveAllotPersons(data);
} }
...@@ -383,7 +378,7 @@ public bool DeletePerson(int employeeId) ...@@ -383,7 +378,7 @@ public bool DeletePerson(int employeeId)
if (employee == null) if (employee == null)
throw new PerformanceException($"员工信息错误!"); throw new PerformanceException($"员工信息错误!");
var oldbackup = perforPeremployeeBackupRepository.GetEntity(t=>t.Id == employee.Id); var oldbackup = perforPeremployeeBackupRepository.GetEntity(t => t.Id == employee.Id);
if (oldbackup != null) if (oldbackup != null)
perforPeremployeeBackupRepository.Remove(oldbackup); perforPeremployeeBackupRepository.Remove(oldbackup);
...@@ -402,7 +397,7 @@ public bool DeleteAllPerson(int allotId) ...@@ -402,7 +397,7 @@ public bool DeleteAllPerson(int allotId)
{ {
var employees = peremployeeRepository.GetEntities(t => t.AllotId == allotId) var employees = peremployeeRepository.GetEntities(t => t.AllotId == allotId)
?? new List<per_employee>(); ?? new List<per_employee>();
dapperService.PerEmployeeBackup(allotId); dapperService.PerEmployeeBackup(allotId);
return peremployeeRepository.RemoveRange(employees.ToArray()); return peremployeeRepository.RemoveRange(employees.ToArray());
...@@ -852,7 +847,7 @@ public ApiResponse BathSavePerson(int allotId, int HospitalId, SaveCollectData r ...@@ -852,7 +847,7 @@ public ApiResponse BathSavePerson(int allotId, int HospitalId, SaveCollectData r
var jsons = JsonHelper.Serialize(dicData); var jsons = JsonHelper.Serialize(dicData);
var newEmployees = JsonHelper.Deserialize<List<per_employee>>(jsons); var newEmployees = JsonHelper.Deserialize<List<per_employee>>(jsons);
var oldEmployees = peremployeeRepository.GetEntities(t => t.HospitalId == HospitalId && t.AllotId == allotId); var oldEmployees = peremployeeRepository.GetEntities(t => t.HospitalId == HospitalId && t.AllotId == allotId);
var accountinglist = perforCofaccountingRepository.GetEntities(t => t.AllotId == allotId);
List<Dictionary<string, string>> error = new List<Dictionary<string, string>>(); List<Dictionary<string, string>> error = new List<Dictionary<string, string>>();
for (int i = 0; i < newEmployees.Count; i++) for (int i = 0; i < newEmployees.Count; i++)
...@@ -909,8 +904,8 @@ public ApiResponse BathSavePerson(int allotId, int HospitalId, SaveCollectData r ...@@ -909,8 +904,8 @@ public ApiResponse BathSavePerson(int allotId, int HospitalId, SaveCollectData r
}); });
} }
var accountinglist = perforCofaccountingRepository.GetEntity(w => w.UnitType == newEmployees[i].UnitType && w.AccountingUnit == newEmployees[i].AccountingUnit); var accountingUnit = accountinglist.FirstOrDefault(w => w.UnitType == newEmployees[i].UnitType && w.AccountingUnit == newEmployees[i].AccountingUnit);
if (accountinglist == null) if (accountingUnit == null)
{ {
error.Add(new Dictionary<string, string> error.Add(new Dictionary<string, string>
{ {
...@@ -980,7 +975,7 @@ public ApiResponse BathSavePerson(int allotId, int HospitalId, SaveCollectData r ...@@ -980,7 +975,7 @@ public ApiResponse BathSavePerson(int allotId, int HospitalId, SaveCollectData r
employees.ForEach(e => employees.ForEach(e =>
{ {
var result = backupTab.FirstOrDefault(d => d.PersonnelNumber.Contains(e.PersonnelNumber) && d.AllotId == e.AllotId && d.HospitalId == e.HospitalId); var result = backupTab.FirstOrDefault(d => d.PersonnelNumber.Contains(e.PersonnelNumber) && d.AllotId == e.AllotId && d.HospitalId == e.HospitalId);
if(result!=null) if (result != null)
{ {
e.JobNumber = result.JobNumber; e.JobNumber = result.JobNumber;
e.JobCategory = result.JobCategory; e.JobCategory = result.JobCategory;
......
...@@ -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;
......
...@@ -544,7 +544,7 @@ private T GetCellValue<T>(IRow row, List<string> columns, string key) ...@@ -544,7 +544,7 @@ private T GetCellValue<T>(IRow row, List<string> columns, string key)
#region 人员、科室标签配置 #region 人员、科室标签配置
public HandsonTable GetReportPersonTag(int hospitalId, int allotId) public (HandsonTable handsonTable, List<string> colHeaders) GetReportPersonTag(int hospitalId, int allotId)
{ {
var hos = _hospitalRepository.GetEntity(t => t.ID == hospitalId); var hos = _hospitalRepository.GetEntity(t => t.ID == hospitalId);
var columnHeaders = _computeService.CustomColumnHeaders(hos, "/result/all_employee"); var columnHeaders = _computeService.CustomColumnHeaders(hos, "/result/all_employee");
...@@ -590,7 +590,7 @@ select new ...@@ -590,7 +590,7 @@ select new
Tag5 = t?.Tag5, Tag5 = t?.Tag5,
}).Distinct()?.ToList(); }).Distinct()?.ToList();
if (data == null || !data.Any()) return result; if (data == null || !data.Any()) return (result,null);
var users = new List<sys_user>(); var users = new List<sys_user>();
if (hos?.IsOwnerQuery == 1) if (hos?.IsOwnerQuery == 1)
...@@ -630,10 +630,10 @@ select new ...@@ -630,10 +630,10 @@ select new
if (columns.Contains(t.Data)) if (columns.Contains(t.Data))
t.ReadOnly = true; t.ReadOnly = true;
}); });
return result; return (result, result.ColHeaders.ToList());
} }
public string ReportPersonTagDownload(List<Dictionary<string, object>> rows, string title) public string ReportPersonTagDownload(List<Dictionary<string, object>> rows, List<string> colHeaders, string title)
{ {
var data = new List<Dictionary<string, object>>(); var data = new List<Dictionary<string, object>>();
foreach (var obj in rows) foreach (var obj in rows)
...@@ -662,17 +662,16 @@ public string ReportPersonTagDownload(List<Dictionary<string, object>> rows, str ...@@ -662,17 +662,16 @@ public string ReportPersonTagDownload(List<Dictionary<string, object>> rows, str
{ {
worksheet.SetValue(1, 1, title); worksheet.SetValue(1, 1, title);
var headList = data.FirstOrDefault().ToList(); for (int col = 0; col < colHeaders.Count; col++)
for (int col = 0; col < headList.Count; col++)
{ {
worksheet.SetValue(2, col + 1, headList[col].Key); worksheet.SetValue(2, col + 1, colHeaders[col]);
} }
for (int col = 0; col < headList.Count; col++) for (int col = 0; col < colHeaders.Count; col++)
{ {
for (int row = 0; row < data.Count(); row++) for (int row = 0; row < data.Count(); row++)
{ {
var temp = data.ElementAt(row); var temp = data.ElementAt(row);
var value = temp[headList[col].Key] != null ? temp[headList[col].Key].ToString() : temp[headList[col].Key]; var value = temp[colHeaders[col]] != null ? temp[colHeaders[col]].ToString() : temp[colHeaders[col]];
worksheet.Cells[row + 3, col + 1].Value = value; worksheet.Cells[row + 3, col + 1].Value = value;
} }
...@@ -689,10 +688,10 @@ public string ReportPersonTagDownload(List<Dictionary<string, object>> rows, str ...@@ -689,10 +688,10 @@ public string ReportPersonTagDownload(List<Dictionary<string, object>> rows, str
worksheet.Cells[row, col].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; worksheet.Cells[row, col].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
} }
} }
worksheet.Cells[1, 1, 1, headList.Count].Merge = true; worksheet.Cells[1, 1, 1, colHeaders.Count].Merge = true;
worksheet.Cells[1, 1, 1, headList.Count].Style.Font.Bold = true; worksheet.Cells[1, 1, 1, colHeaders.Count].Style.Font.Bold = true;
worksheet.Cells[1, 1, 1, headList.Count].Style.Font.Size = 16; worksheet.Cells[1, 1, 1, colHeaders.Count].Style.Font.Size = 16;
worksheet.Cells[2, 1, 2, headList.Count].Style.Font.Bold = true; worksheet.Cells[2, 1, 2, colHeaders.Count].Style.Font.Bold = true;
worksheet.Row(1).Height = 24; worksheet.Row(1).Height = 24;
worksheet.View.FreezePanes(3, 1); worksheet.View.FreezePanes(3, 1);
worksheet.Cells.AutoFitColumns(); worksheet.Cells.AutoFitColumns();
......
...@@ -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)
......
...@@ -179,7 +179,10 @@ public List<SecondListResponse> GetSecondList(int userId) ...@@ -179,7 +179,10 @@ public List<SecondListResponse> GetSecondList(int userId)
// 查询过往科室的绩效 // 查询过往科室的绩效
var histroys = agsecondallotRepository.GetEntities(t => allotListId.Contains(t.AllotId.Value) && unitType.Contains(t.NewUnitType) && t.NewAccountingUnit == userInfo.User.Department); var histroys = agsecondallotRepository.GetEntities(t => allotListId.Contains(t.AllotId.Value) && unitType.Contains(t.NewUnitType) && t.NewAccountingUnit == userInfo.User.Department);
if (histroys != null && histroys.Any()) if (histroys != null && histroys.Any())
secondList.AddRange(histroys.ToArray()); {
var sids = secondList.Select(w => w.Id).ToArray();
secondList.AddRange(histroys.Where(w => !sids.Contains(w.Id)));
}
var list = _mapper.Map<List<SecondListResponse>>(secondList); var list = _mapper.Map<List<SecondListResponse>>(secondList);
...@@ -917,8 +920,8 @@ public List<SecondTempResponse> GetTemp(int hospitalid, string department, int u ...@@ -917,8 +920,8 @@ public List<SecondTempResponse> GetTemp(int hospitalid, string department, int u
public bool UseTemp(UseTempRequest request) public bool UseTemp(UseTempRequest request)
{ {
var result = false; var result = false;
var entity = agusetempRepository.GetEntity(t => t.HospitalId == request.HospitalId var entities = agusetempRepository.GetEntities(t => t.HospitalId == request.HospitalId && t.Department == request.Department);
&& t.Department == request.Department && t.UnitType == request.UnitType); var entity = entities.FirstOrDefault(w => UnitTypeUtil.IsEqualsUnitType(w.UnitType, request.UnitType));
if (entity == null) if (entity == null)
{ {
entity = _mapper.Map<ag_usetemp>(request); entity = _mapper.Map<ag_usetemp>(request);
...@@ -1737,6 +1740,7 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request) ...@@ -1737,6 +1740,7 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request)
if (request.IsPass == 1) if (request.IsPass == 1)
_service.FreezeAllotSync(second.AllotId.Value); _service.FreezeAllotSync(second.AllotId.Value);
_service.SecondUseTempRestoreSync(); _service.SecondUseTempRestoreSync();
_service.RestoreSecondAllotAsync();
return result; return result;
} }
...@@ -2319,7 +2323,7 @@ public dynamic Print(int secondId) ...@@ -2319,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