上次绩效更改调整

parent e0b7db57
......@@ -1238,6 +1238,11 @@
使用方案
</summary>
</member>
<member name="P:Performance.DtoModels.ExtractRequest.Email">
<summary>
邮箱
</summary>
</member>
<member name="T:Performance.DtoModels.HospitalRequest">
<summary>
登录请求
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.EntityModels
{
public class AccountUnitEntity
{
public string SheetName { get; set; }
public string AccountingUnit { get; set; }
public string Department { get; set; }
public int UnitType { get; set; }
}
}
......@@ -31,6 +31,15 @@ public IEnumerable<TEntity> DapperQuery(string sql, object param, int? commandTi
{
return context.Database.GetDbConnection().Query<TEntity>(sql, param, commandTimeout: commandTimeout);
}
public IEnumerable<T> DapperQuery<T>(string sql, object param) where T : class, new()
{
return context.Database.GetDbConnection().Query<T>(sql, param);
}
public IEnumerable<T> DapperQuery<T>(string sql, object param, int? commandTimeout = null)
{
return context.Database.GetDbConnection().Query<T>(sql, param, commandTimeout: commandTimeout);
}
public int Execute(string sql, object param)
{
......
......@@ -29,5 +29,15 @@ public IEnumerable<im_data> GetAccountingUnit(int hospitalid, int sheettype, Lis
"where allot.hospitalid = @hospitalid and sheet.sheettype = @sheettype and im.department in @deptList";
return DapperQuery(sql, new { hospitalid, sheettype, deptList }, 1000 * 60 * 5);
}
/// <summary>
/// 삿혤뵙炬데禱
/// </summary>
/// <returns></returns>
public IEnumerable<AccountUnitEntity> GetAccountUnit(int allotId)
{
string sql = "select distinct SheetName,AccountingUnit,Department,UnitType from per_sheet st join im_data dt on st.ID = dt.SheetID where st.AllotID = @allotId";
return DapperQuery<AccountUnitEntity>(sql, new { allotId }, 1000 * 60 * 5);
}
}
}
......@@ -134,6 +134,10 @@ public string ExtractData(int allotId, string email, int hospitalId)
style.VerticalAlignment = VerticalAlignment.Center;//垂直居中
#endregion
List<AccountUnitEntity> unitList = new List<AccountUnitEntity>();
if (allotLast != null)
unitList = perforImdataRepository.GetAccountUnit(allotLast.ID).ToList();
for (int i = 0; i < workbook.NumberOfSheets; i++)
{
var sheet = workbook.GetSheetAt(i);
......@@ -144,16 +148,18 @@ public string ExtractData(int allotId, string email, int hospitalId)
switch (sheetType)
{
case SheetType.Employee:
if (allotLast != null)
WriteEmployee(sheet, allotLast.ID, sheetRead);
break;
case SheetType.AccountBasic:
if (allotLast != null)
WriteAccountBasic(sheet, allotLast.ID, sheetRead);
break;
case SheetType.SpecialUnit:
WriteSpecialUnit(sheet, hospital.ID, allotLast.ID, sheetRead);
WriteSpecialUnit(sheet, hospital.ID, allotLast, sheetRead);
break;
case SheetType.Income:
WriteIncome(sheet, allotLast.ID, sheetRead, allot, modulesList, hospitalConfigList);
WriteIncome(sheet, hospital.ID, unitList, sheetRead, allot, modulesList, hospitalConfigList);
break;
case SheetType.OtherIncome:
WriteOtherIncome(sheet, hospital.ID, sheetRead);
......@@ -162,7 +168,7 @@ public string ExtractData(int allotId, string email, int hospitalId)
WriteExpend(sheet, hospital.ID, sheetRead);
break;
case SheetType.Workload:
WriteWorkload(sheet, allotLast.ID, sheetRead, allot, modulesList, hospitalConfigList);
WriteWorkload(sheet, hospital.ID, unitList, sheetRead, allot, modulesList, hospitalConfigList);
break;
}
}
......@@ -240,9 +246,9 @@ private void WriteOtherIncome(ISheet sheet, int hospitalId, IPerSheetDataRead sh
}
}
private void WriteIncome(ISheet sheet, int allotLastId, IPerSheetDataRead sheetRead, per_allot allot, List<mod_module> moduleList, List<sys_hospitalconfig> hospitalConfigList)
private void WriteIncome(ISheet sheet, int hospitalId, List<AccountUnitEntity> unitList, IPerSheetDataRead sheetRead, per_allot allot, List<mod_module> moduleList, List<sys_hospitalconfig> hospitalConfigList)
{
var module = moduleList.FirstOrDefault(t => t.ModuleName == sheet.SheetName);
var module = moduleList.FirstOrDefault(t => t.ModuleName == sheet.SheetName && t.HospitalId == hospitalId);
if (module == null) return;
var itemList = perforModitemRepository.GetEntities(t => t.ModuleId == module.Id);
......@@ -275,9 +281,6 @@ private void WriteIncome(ISheet sheet, int allotLastId, IPerSheetDataRead sheetR
allExtract.AddRange(result);
}
//写入数据
var importSheet = perforPersheetRepository.GetEntities(t => t.AllotID == allotLastId && t.SheetType == (int)SheetType.Income);
var importSheetId = importSheet.Select(t => t.ID).ToList();
var importData = perforImdataRepository.GetEntities(t => importSheetId.Contains(t.SheetID.Value));
var rowIndex = sheetRead.Point.HeaderFirstRowNum.Value + 1;
foreach (var department in allExtract.Select(t => t.Department).Distinct())
{
......@@ -288,23 +291,22 @@ private void WriteIncome(ISheet sheet, int allotLastId, IPerSheetDataRead sheetR
var newCell = row.CreateCell(i);
if (headName.Replace("\n", "") == "核算单元(医生组)")
{
var dept = importData.FirstOrDefault(t => t.Department == department && t.UnitType == 1)?.AccountingUnit;
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department && t.UnitType == 1)?.AccountingUnit;
newCell.SetCellValue(dept ?? "");
}
else if (headName.Replace("\n", "") == "核算单元(护理组)")
{
var dept = importData.FirstOrDefault(t => t.Department == department && t.UnitType == 2)?.AccountingUnit;
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department && t.UnitType == 2)?.AccountingUnit;
newCell.SetCellValue(dept ?? "");
}
else if (headName.Replace("\n", "") == "核算单元(医技组)")
{
var dept = importData.FirstOrDefault(t => t.Department == department && t.UnitType == 3)?.AccountingUnit;
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department && t.UnitType == 3)?.AccountingUnit;
newCell.SetCellValue(dept ?? "");
}
else if (headName == "科室名称")
{
var dept = importData.FirstOrDefault(t => t.Department == department)?.Department;
newCell.SetCellValue(dept ?? "");
newCell.SetCellValue(department ?? "");
}
else
{
......@@ -348,9 +350,9 @@ private IRow GetOrCreate(ISheet sheet, int index)
return pairs;
}
private void WriteWorkload(ISheet sheet, int allotLastId, IPerSheetDataRead sheetRead, per_allot allot, List<mod_module> moduleList, List<sys_hospitalconfig> hospitalConfigList)
private void WriteWorkload(ISheet sheet, int hospitalId, List<AccountUnitEntity> unitList, IPerSheetDataRead sheetRead, per_allot allot, List<mod_module> moduleList, List<sys_hospitalconfig> hospitalConfigList)
{
var module = moduleList.FirstOrDefault(t => t.ModuleName == sheet.SheetName);
var module = moduleList.FirstOrDefault(t => t.ModuleName == sheet.SheetName && t.HospitalId == hospitalId);
if (module == null) return;
var itemList = perforModitemRepository.GetEntities(t => t.ModuleId == module.Id);
......@@ -385,8 +387,6 @@ private void WriteWorkload(ISheet sheet, int allotLastId, IPerSheetDataRead shee
}
}
//写入数据
var importSheet = perforPersheetRepository.GetEntity(t => t.AllotID == allotLastId && t.SheetName == module.ModuleName);
var importData = perforImdataRepository.GetEntities(t => t.SheetID == importSheet.ID);
var rowIndex = sheetRead.Point.HeaderFirstRowNum.Value + 2;
foreach (var department in allExtract.Select(t => t.Department).Distinct())
{
......@@ -397,13 +397,12 @@ private void WriteWorkload(ISheet sheet, int allotLastId, IPerSheetDataRead shee
var newCell = row.CreateCell(i);
if (headName == "核算单元")
{
var dept = importData.FirstOrDefault(t => t.Department == department)?.AccountingUnit;
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department)?.AccountingUnit;
newCell.SetCellValue(dept ?? "");
}
else if (headName == "科室名称")
{
var dept = importData.FirstOrDefault(t => t.Department == department)?.Department;
newCell.SetCellValue(dept ?? "");
newCell.SetCellValue(department ?? "");
}
else
{
......@@ -517,7 +516,7 @@ private void WriteEmployee(ISheet sheet, int allotLastId, IPerSheetDataRead shee
}
}
private void WriteSpecialUnit(ISheet sheet, int hospitalId, int allotLastId, IPerSheetDataRead sheetRead)
private void WriteSpecialUnit(ISheet sheet, int hospitalId, per_allot allotLast, IPerSheetDataRead sheetRead)
{
var dictionary = new Dictionary<string, Func<mod_special, List<im_specialunit>, object>>
{
......@@ -529,9 +528,12 @@ private void WriteSpecialUnit(ISheet sheet, int hospitalId, int allotLastId, IPe
};
var modDataList = perforModspecialRepository.GetEntities(t => t.HospitalId == hospitalId)?.OrderBy(t => t.Department).ToList();
var allotDataList = perforImspecialunitRepository.GetEntities(t => t.AllotID == allotLastId);
if (modDataList == null || modDataList.Count == 0) return;
List<im_specialunit> allotDataList = new List<im_specialunit>();
if (allotLast != null)
allotDataList = perforImspecialunitRepository.GetEntities(t => t.AllotID == allotLast.ID);
//取消合并单元格
int mergedCount = sheet.NumMergedRegions;
for (int i = mergedCount - 1; i >= 0; i--)
......
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