Commit aa195381 by 钟博

Merge branch 'feature/重新加载人员字典' into develop

parents adeefe39 55a85fed
......@@ -269,5 +269,22 @@ public ApiResponse SaveDeptHands(int hospitalId, SaveCollectData request)
personService.SaveDeptDicHands(hospitalId, request);
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 重新加载人员字典
/// </summary>
/// <param name="hospitalId"></param>
/// <param name="allotId"></param>
/// <returns></returns>
[HttpPost]
[Route("peson/{hospitalId}/reloadPersonnel/{allotId}")]
public ApiResponse ReloadPersonnel(int hospitalId, int allotId)
{
var result = personService.ReloadPersonnel(hospitalId, allotId);
if (result)
return new ApiResponse(ResponseType.OK, result);
else
return new ApiResponse(ResponseType.Error, result);
}
}
}
......@@ -126,8 +126,5 @@ public ComputeResponse(string source, string accountingUnit, string employeeName
/// </summary>
public string TitlePosition { get; set; }
}
}
namespace Performance.EntityModels
using System;
namespace Performance.EntityModels
{
public class view_per_apr_amount : per_apr_amount
{
......@@ -44,5 +46,7 @@ public view_per_total_amount(string unitType, string accountingUnit, string pers
/// 是否被使用 默认false
/// </summary>
public bool Use { get; set; }
public DateTime AuditTime { get; set; }
}
}
......@@ -902,6 +902,7 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
item.JobCategory = emps?.JobCategory ?? "";
item.Duty = emps?.Duty ?? "";
item.TitlePosition = emps?.JobTitle ?? "";
// 人员信息使用人员字典中数据
if (isEmpDic)
{
......
......@@ -1357,11 +1357,13 @@ public SheetExportResponse GetDrugtypeFactor(AllotDeptRequest request)
{
new Cell{ CellType = "header", CellValue = "", PointCell = 0, MergeRow = 1, MergeCell = 1 },
new Cell{ CellType = "header", CellValue = "", PointCell = 1, MergeRow = 1, MergeCell = 1 },
new Cell{ CellType = "header", CellValue = "", PointCell = 2, MergeRow = 1, MergeCell = 1 },
};
var cells = new List<Cell>
{
new Cell{ CellType = "header", CellValue = "项目小类(测算表)", PointCell = 0, MergeRow = 1, MergeCell = 1 },
new Cell{ CellType = "header", CellValue = "费用大类(大屏展示)", PointCell = 1, MergeRow = 1, MergeCell = 1 }
new Cell{ CellType = "header", CellValue = "序号", PointCell = 0, MergeRow = 1, MergeCell = 1 },
new Cell{ CellType = "header", CellValue = "项目小类(测算表)", PointCell = 1, MergeRow = 1, MergeCell = 1 },
new Cell{ CellType = "header", CellValue = "费用大类(大屏展示)", PointCell = 2, MergeRow = 1, MergeCell = 1 }
};
var defaultColumns = new Dictionary<string, string>
......@@ -1374,7 +1376,7 @@ public SheetExportResponse GetDrugtypeFactor(AllotDeptRequest request)
int index = 0;
foreach (var model in models)
{
mergeCells.Add(new Cell { CellType = "header", CellValue = model.ModuleName, PointCell = 2 + index * 3, MergeRow = 1, MergeCell = defaultColumns.Count });
mergeCells.Add(new Cell { CellType = "header", CellValue = model.ModuleName, PointCell = 3 + index * 3, MergeRow = 1, MergeCell = defaultColumns.Count });
int i = 0;
cells.AddRange(defaultColumns.Select(t =>
......@@ -1419,6 +1421,7 @@ public SheetExportResponse GetDrugtypeFactor(AllotDeptRequest request)
{
var rowcells = new List<Cell>
{
new Cell { CellType = "body", CellValue = index+1, PointCell = 0, MergeRow = 1, MergeCell = 1 },
new Cell { CellType = "body", CellValue = charge.Charge, PointCell = 0, MergeRow = 1, MergeCell = 1 },
new Cell { CellType = "body", CellValue = charge.ChargeType, PointCell = 1, MergeRow = 1, MergeCell = 1 },
};
......
......@@ -1000,5 +1000,75 @@ public string GetPersonDictFile(int allotId, int userId)
}
return filepath;
}
public bool ReloadPersonnel(int hospitalId, int allotId)
{
var allotList = perallotRepository.GetEntities(w => w.HospitalId == hospitalId)?.OrderBy(s => s.Year).ThenBy(s => s.Month).ToList();
if (allotList == null || !allotList.Any())
throw new PerformanceException("加载失败,绩效记录不存在!");
var allot = allotList.FirstOrDefault(w => w.ID == allotId);
if (allot == null)
throw new PerformanceException("加载失败,绩效记录不存在!");
var index = allotList.IndexOf(allot);
if (index == 0)
throw new PerformanceException("加载失败,绩效记录不存在!");
var prevAllot = allotList[index - 1];
if (prevAllot == null) prevAllot.ID = -1;
var persons = peremployeeRepository.GetEntities(t => t.HospitalId == hospitalId && t.AllotId == prevAllot.ID);
if (persons == null || !persons.Any())
throw new PerformanceException("加载失败,未查询到上月人员信息!");
var i = peremployeeRepository.Execute($@"DELETE FROM per_employee WHERE HospitalId=@HospitalId and AllotId=@AllotId;", new { hospitalId, allotId });
if (i <= 0)
throw new PerformanceException("加载失败,人员信息重置失败!");
int day = DateTime.DaysInMonth(allot.Year, allot.Month);
var data = persons.Select(t =>
{
var entity = new per_employee
{
HospitalId = t.HospitalId,
AllotId = allotId,
AccountingUnit = t.AccountingUnit,
Department = t.Department,
DoctorName = t.DoctorName,
JobCategory = t.JobCategory,
Duty = t.Duty,
JobTitle = t.JobTitle,
UnitType = t.UnitType,
AttendanceDay = day,
Attendance = 1,
PermanentStaff = t.PermanentStaff,
EfficiencyNumber = t.EfficiencyNumber,
WorkTime = t.WorkTime,
BirthDate = t.BirthDate,
Age = t.Age,
ReservedRatio = t.ReservedRatio,
BankCard = t.BankCard,
Remark = t.Remark,
CreateTime = DateTime.Now,
};
if (!string.IsNullOrEmpty(t.PersonnelNumber) && !string.IsNullOrEmpty(t.JobNumber))
{
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;
}).ToList();
SaveAllotPersons(data);
return true;
}
}
}
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