Commit c4c527db by ruyun.zhang@suvalue.com

Merge branch 'release/jixiao55'

parents 1757a005 4ce6a08f
...@@ -276,11 +276,11 @@ public ApiResponse SingleAwards([FromBody] WorkloadRequest request) ...@@ -276,11 +276,11 @@ public ApiResponse SingleAwards([FromBody] WorkloadRequest request)
/// 二次绩效工作量类型列表 /// 二次绩效工作量类型列表
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[Route("api/second/worktype/list")] [Route("api/second/worktype/list/{secondId}")]
[HttpPost] [HttpPost]
public ApiResponse WorkTypeList([FromBody] WorkloadRequest request) public ApiResponse WorkTypeList([FromBody] WorkloadRequest request, int secondId)
{ {
var result = secondAllotService.WorkTypeList(request, claimService.GetUserId()); var result = secondAllotService.WorkTypeList(request, secondId);
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
} }
...@@ -288,16 +288,16 @@ public ApiResponse WorkTypeList([FromBody] WorkloadRequest request) ...@@ -288,16 +288,16 @@ public ApiResponse WorkTypeList([FromBody] WorkloadRequest request)
/// 保存二次绩效工作量类型 /// 保存二次绩效工作量类型
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[Route("api/second/worktype/save")] [Route("api/second/worktype/save/{secondId}")]
[HttpPost] [HttpPost]
public ApiResponse SingleSave([FromBody] ag_workload_type request) public ApiResponse SingleSave([FromBody] ag_workload_type request, int secondId)
{ {
if (request.HospitalId == 0) if (request.HospitalId == 0)
return new ApiResponse(ResponseType.ParameterError, "医院信息无效"); return new ApiResponse(ResponseType.ParameterError, "医院信息无效");
if (string.IsNullOrEmpty(request.TypeName)) if (string.IsNullOrEmpty(request.TypeName))
return new ApiResponse(ResponseType.ParameterError, "填写参数无效"); return new ApiResponse(ResponseType.ParameterError, "填写参数无效");
var result = secondAllotService.SaveWorkType(request, claimService.GetUserId()); var result = secondAllotService.SaveWorkType(request, secondId);
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
} }
...@@ -522,11 +522,11 @@ public ApiResponse SaveValue([FromRoute] int secondId, [FromBody] dynamic reques ...@@ -522,11 +522,11 @@ public ApiResponse SaveValue([FromRoute] int secondId, [FromBody] dynamic reques
/// 二次绩效录入页面自动补全 /// 二次绩效录入页面自动补全
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[Route("api/second/autocomplete/{secondId}/{jobNumber}")] [Route("api/second/autocomplete/{secondId}")]
[HttpPost] [HttpPost]
public ApiResponse AutoCompleteBodyData([FromRoute] int secondId, string jobNumber) public ApiResponse AutoCompleteBodyData([FromRoute] int secondId, SecondEmployeeRequest request)
{ {
var result = secondAllotService.AutoComplete(secondId, jobNumber); var result = secondAllotService.AutoComplete(secondId, request);
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
} }
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
}, },
"AppConnection": { "AppConnection": {
//"PerformanceConnectionString": "server=112.124.13.17;database=db_performance;uid=suvalue;pwd=suvalue2016;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;", //"PerformanceConnectionString": "server=112.124.13.17;database=db_performance;uid=suvalue;pwd=suvalue2016;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"PerformanceConnectionString": "server=192.168.18.166;database=db_test_liutie;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;", "PerformanceConnectionString": "server=192.168.18.166;database=db_performance_screen;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"HangfireConnectionString": "server=192.168.18.166;database=db_hangfire;uid=root;pwd=1234qwer;port=3306;allow user variables=true;", "HangfireConnectionString": "server=192.168.18.166;database=db_hangfire;uid=root;pwd=1234qwer;port=3306;allow user variables=true;",
"RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2" "RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2"
}, },
......
...@@ -1436,7 +1436,7 @@ ...@@ -1436,7 +1436,7 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.SecondAllotController.AutoCompleteBodyData(System.Int32,System.String)"> <member name="M:Performance.Api.Controllers.SecondAllotController.AutoCompleteBodyData(System.Int32,Performance.DtoModels.SecondEmployeeRequest)">
<summary> <summary>
二次绩效录入页面自动补全 二次绩效录入页面自动补全
</summary> </summary>
......
...@@ -5,17 +5,20 @@ ...@@ -5,17 +5,20 @@
namespace Performance.DtoModels namespace Performance.DtoModels
{ {
public class SecondEmpRequest public class SecondEmployeeRequest
{ {
public int TempId { get; set; }
public int SecondId { get; set; }
public string EmployeeName { get; set; } public string EmployeeName { get; set; }
public string JobNumber { get; set; } public string JobNumber { get; set; }
} }
public class SecondEmpRequest : SecondEmployeeRequest
{
public int TempId { get; set; }
public int SecondId { get; set; }
}
public class SecondEmpRequestValidator : AbstractValidator<SecondEmpRequest> public class SecondEmpRequestValidator : AbstractValidator<SecondEmpRequest>
{ {
public SecondEmpRequestValidator() public SecondEmpRequestValidator()
......
namespace Performance.Services.ExtractExcelService
{
public class IncomeRow
{
public string Department { get; set; }
public string DoctorAccount { get; set; }
public string NurseAccount { get; set; }
public string TechnicAccounting { get; set; }
public int RowNumber { get; set; }
public IncomeRow(string department, string doctorAccount, string nurseAccount, string technicAccounting, int rowNumber)
{
Department = department;
DoctorAccount = doctorAccount;
NurseAccount = nurseAccount;
TechnicAccounting = technicAccounting;
RowNumber = rowNumber;
}
}
}
...@@ -93,7 +93,17 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -93,7 +93,17 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var columnHeader = sheet.GetOrCreate(point.HeaderFirstRowNum.Value); var columnHeader = sheet.GetOrCreate(point.HeaderFirstRowNum.Value);
int dataFirstRowNum = point.DataFirstRowNum.Value; int dataFirstRowNum = point.DataFirstRowNum.Value;
WriteSheetDataExistent(sheet, columnHeader, point, sheetType, style, headers, data, ref dataFirstRowNum); List<IncomeRow> rows = new List<IncomeRow>();
WriteSheetDataExistent(sheet, columnHeader, point, sheetType, style, headers, data, rows, ref dataFirstRowNum);
if (sheetType == SheetType.Income && rows != null)
{
dataFirstRowNum = point.DataFirstRowNum.Value;
RemoveIncomeRow(sheet, point);
WriteSheetIncomeData(sheet, columnHeader, point, style, headers, data, rows, dataFirstRowNum);
dataFirstRowNum = point.DataFirstRowNum.Value + rows.Count;
}
if (data == null || !data.Any(t => !string.IsNullOrEmpty(t.Department))) return; if (data == null || !data.Any(t => !string.IsNullOrEmpty(t.Department))) return;
...@@ -101,7 +111,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -101,7 +111,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
} }
private static void WriteSheetDataExistent(ISheet sheet, IRow columnHeader, PerSheetPoint point, SheetType sheetType, ExcelStyle style, private static void WriteSheetDataExistent(ISheet sheet, IRow columnHeader, PerSheetPoint point, SheetType sheetType, ExcelStyle style,
List<string> headers, List<ExtractTransDto> data, ref int dataFirstRowNum) List<string> headers, List<ExtractTransDto> data, List<IncomeRow> incomes, ref int dataFirstRowNum)
{ {
if (sheet.LastRowNum <= dataFirstRowNum) return; if (sheet.LastRowNum <= dataFirstRowNum) return;
...@@ -116,28 +126,31 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -116,28 +126,31 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var row = sheet.GetRow(rowIndex); var row = sheet.GetRow(rowIndex);
if (row == null) continue; if (row == null) continue;
if (rowIndex > dataFirstRowNum) dataFirstRowNum = rowIndex + 1;
string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes(); string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes();
if (string.IsNullOrEmpty(department)) continue; if (string.IsNullOrEmpty(department)) continue;
if (rowIndex > dataFirstRowNum) dataFirstRowNum = rowIndex;
var deptData = data.Where(t => t.Department == department); var deptData = data.Where(t => t.Department == department);
if (deptData == null || !deptData.Any()) continue; if (deptData == null || !deptData.Any()) continue;
#region 写入数据
if (sheetType == SheetType.Income)
{
incomes.Add(GetIncomeRowMessage(row, dataFirstCellNum, department, rowIndex));
continue;
}
for (int cellIndex = dataFirstCellNum; cellIndex < columnHeader.LastCellNum; cellIndex++) for (int cellIndex = dataFirstCellNum; cellIndex < columnHeader.LastCellNum; cellIndex++)
{ {
var column = columnHeader.GetOrCreate(cellIndex).GetDecodeEscapes(); var column = columnHeader.GetOrCreate(cellIndex).GetDecodeEscapes();
var cell = row.GetOrCreate(cellIndex); var cell = row.GetOrCreate(cellIndex);
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value; var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
//数据为空,且单元格值不为空,不写入数据(保留原始值)
var notWrite = !value.HasValue && !string.IsNullOrEmpty(cell.ToString()); var notWrite = !value.HasValue && !string.IsNullOrEmpty(cell.ToString());
if (cell.CellType != CellType.Formula && !notWrite)
if (sheetType == SheetType.Income)
{
cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle;
}
else if (cell.CellType != CellType.Formula && !notWrite)
{ {
cell.SetCellValue<decimal>(value); cell.SetCellValue<decimal>(value);
if (headers != null && headers.Contains(column)) if (headers != null && headers.Contains(column))
...@@ -147,9 +160,12 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -147,9 +160,12 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
} }
} }
#endregion
data.RemoveAll(t => t.Department == department); data.RemoveAll(t => t.Department == department);
} }
dataFirstRowNum += 1;
if (point.DataFirstRowNum.Value < dataFirstRowNum) dataFirstRowNum += 1;
} }
private static void WriteSheetDataNonexistent(ISheet sheet, IRow columnHeader, PerSheetPoint point, SheetType sheetType, ExcelStyle style, private static void WriteSheetDataNonexistent(ISheet sheet, IRow columnHeader, PerSheetPoint point, SheetType sheetType, ExcelStyle style,
...@@ -195,6 +211,56 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -195,6 +211,56 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
} }
} }
private static void WriteSheetIncomeData(ISheet sheet, IRow columnHeader, PerSheetPoint point, ExcelStyle style, List<string> headers,
List<ExtractTransDto> data, List<IncomeRow> incomes, int dataFirstRowNum)
{
var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.数据);
var deptStyle = style.GetCellStyle();
headers = headers.Select(t => t.NoBlank()).ToList();
int dataFirstCellNum = point.DataFirstCellNum.Value;
foreach (var item in incomes)
{
var row = sheet.GetOrCreate(dataFirstRowNum);
var deptData = data.Where(t => t.Department == item.Department);
if (deptData == null || !deptData.Any()) continue;
var deptContents = new Dictionary<int, string>
{
{ 1, item.Department },
{ 2, item.NurseAccount },
{ 3, item.DoctorAccount },
{ 4, item.TechnicAccounting },
};
foreach (var content in deptContents)
{
var cell = row.GetOrCreate(dataFirstCellNum - content.Key);
cell.SetCellValue(content.Value);
cell.CellStyle = deptStyle;
}
for (int cellIndex = dataFirstCellNum; cellIndex < columnHeader.LastCellNum; cellIndex++)
{
var column = columnHeader.GetOrCreate(cellIndex).GetDecodeEscapes();
var cell = row.GetOrCreate(cellIndex);
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
if (cell.CellType != CellType.Formula)
{
cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle;
}
}
dataFirstRowNum++;
data.RemoveAll(t => t.Department == item.Department);
}
}
public static string HasValue(params string[] list) public static string HasValue(params string[] list)
{ {
if (list == null || !list.Any()) return null; if (list == null || !list.Any()) return null;
...@@ -249,7 +315,17 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType ...@@ -249,7 +315,17 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
var columnHeader = sheet.GetOrCreate(point.HeaderFirstRowNum.Value); var columnHeader = sheet.GetOrCreate(point.HeaderFirstRowNum.Value);
int dataFirstRowNum = point.DataFirstRowNum.Value; int dataFirstRowNum = point.DataFirstRowNum.Value;
WriteCollectDataExistent(sheet, columnHeader, point, sheetType, style, headers, data, ref dataFirstRowNum); List<IncomeRow> rows = new List<IncomeRow>();
WriteCollectDataExistent(sheet, columnHeader, point, sheetType, style, headers, data, rows, ref dataFirstRowNum);
if (sheetType == SheetType.Income && rows != null)
{
dataFirstRowNum = point.DataFirstRowNum.Value;
RemoveIncomeRow(sheet, point);
WriteCollectIncomeData(sheet, columnHeader, point, style, headers, data, rows, dataFirstRowNum);
dataFirstRowNum = point.DataFirstRowNum.Value + rows.Count;
}
if (data == null || !data.Any(t => !string.IsNullOrEmpty(t.Department))) return; if (data == null || !data.Any(t => !string.IsNullOrEmpty(t.Department))) return;
...@@ -257,7 +333,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType ...@@ -257,7 +333,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
} }
private static void WriteCollectDataExistent(ISheet sheet, IRow columnHeader, PerSheetPoint point, SheetType sheetType, ExcelStyle style, private static void WriteCollectDataExistent(ISheet sheet, IRow columnHeader, PerSheetPoint point, SheetType sheetType, ExcelStyle style,
List<string> headers, List<collect_data> data, ref int dataFirstRowNum) List<string> headers, List<collect_data> data, List<IncomeRow> incomes, ref int dataFirstRowNum)
{ {
if (sheet.LastRowNum <= dataFirstRowNum) return; if (sheet.LastRowNum <= dataFirstRowNum) return;
...@@ -272,27 +348,31 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType ...@@ -272,27 +348,31 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
var row = sheet.GetRow(rowIndex); var row = sheet.GetRow(rowIndex);
if (row == null) continue; if (row == null) continue;
if (rowIndex > dataFirstRowNum) dataFirstRowNum = rowIndex + 1;
string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes(); string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes();
if (string.IsNullOrEmpty(department)) continue; if (string.IsNullOrEmpty(department)) continue;
if (rowIndex > dataFirstRowNum) dataFirstRowNum = rowIndex;
var deptData = data.Where(t => t.Department == department); var deptData = data.Where(t => t.Department == department);
if (deptData == null || !deptData.Any()) continue; if (deptData == null || !deptData.Any()) continue;
#region 写入数据
if (sheetType == SheetType.Income)
{
incomes.Add(GetIncomeRowMessage(row, dataFirstCellNum, department, rowIndex));
continue;
}
for (int cellIndex = dataFirstCellNum; cellIndex < columnHeader.LastCellNum; cellIndex++) for (int cellIndex = dataFirstCellNum; cellIndex < columnHeader.LastCellNum; cellIndex++)
{ {
var column = columnHeader.GetOrCreate(cellIndex).GetDecodeEscapes(); var column = columnHeader.GetOrCreate(cellIndex).GetDecodeEscapes();
var cell = row.GetOrCreate(cellIndex); var cell = row.GetOrCreate(cellIndex);
var value = deptData.FirstOrDefault(t => t.TypeName.NoBlank() == column)?.CellValue; var value = deptData.FirstOrDefault(t => t.TypeName.NoBlank() == column)?.CellValue;
//数据为空,且单元格值不为空,不写入数据(保留原始值)
if (sheetType == SheetType.Income) var notWrite = string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(cell.ToString());
{ if (cell.CellType != CellType.Formula && !notWrite)
cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle;
}
else if (cell.CellType != CellType.Formula)
{ {
cell.SetCellValue<decimal>(value); cell.SetCellValue<decimal>(value);
if (headers != null && headers.Contains(column)) if (headers != null && headers.Contains(column))
...@@ -302,9 +382,12 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType ...@@ -302,9 +382,12 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
} }
} }
#endregion
data.RemoveAll(t => t.Department == department); data.RemoveAll(t => t.Department == department);
} }
dataFirstRowNum += 1;
if (point.DataFirstRowNum.Value < dataFirstRowNum) dataFirstRowNum += 1;
} }
private static void WriteCollectDataNonexistent(ISheet sheet, IRow columnHeader, PerSheetPoint point, SheetType sheetType, ExcelStyle style, private static void WriteCollectDataNonexistent(ISheet sheet, IRow columnHeader, PerSheetPoint point, SheetType sheetType, ExcelStyle style,
...@@ -348,6 +431,56 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType ...@@ -348,6 +431,56 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
} }
} }
private static void WriteCollectIncomeData(ISheet sheet, IRow columnHeader, PerSheetPoint point, ExcelStyle style, List<string> headers,
List<collect_data> data, List<IncomeRow> incomes, int dataFirstRowNum)
{
var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.数据);
var deptStyle = style.GetCellStyle();
headers = headers.Select(t => t.NoBlank()).ToList();
int dataFirstCellNum = point.DataFirstCellNum.Value;
foreach (var item in incomes)
{
var row = sheet.GetOrCreate(dataFirstRowNum);
var deptData = data.Where(t => t.Department == item.Department);
if (deptData == null || !deptData.Any()) continue;
var deptContents = new Dictionary<int, string>
{
{ 1, item.Department },
{ 2, item.NurseAccount },
{ 3, item.DoctorAccount },
{ 4, item.TechnicAccounting },
};
foreach (var content in deptContents)
{
var cell = row.GetOrCreate(dataFirstCellNum - content.Key);
cell.SetCellValue(content.Value);
cell.CellStyle = deptStyle;
}
for (int cellIndex = dataFirstCellNum; cellIndex < columnHeader.LastCellNum; cellIndex++)
{
var column = columnHeader.GetOrCreate(cellIndex).GetDecodeEscapes();
var cell = row.GetOrCreate(cellIndex);
var value = deptData.FirstOrDefault(t => t.TypeName.NoBlank() == column)?.CellValue;
if (cell.CellType != CellType.Formula)
{
cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle;
}
}
dataFirstRowNum++;
data.RemoveAll(t => t.Department == item.Department);
}
}
/// <summary> 收入固定列 </summary> /// <summary> 收入固定列 </summary>
private static readonly Dictionary<string, Func<collect_data, string>> collectIncome = new Dictionary<string, Func<collect_data, string>> private static readonly Dictionary<string, Func<collect_data, string>> collectIncome = new Dictionary<string, Func<collect_data, string>>
{ {
...@@ -372,5 +505,65 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType ...@@ -372,5 +505,65 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
}; };
#endregion CollectData #endregion CollectData
/// <summary>
/// 抽取优化,获取有数据的科室信息
/// </summary>
/// <param name="row"></param>
/// <param name="dataFirstCellNum"></param>
/// <param name="department"></param>
/// <param name="rowIndex"></param>
/// <returns></returns>
private static IncomeRow GetIncomeRowMessage(IRow row, int dataFirstCellNum, string department, int rowIndex)
{
var nurse = row.GetOrCreate(dataFirstCellNum - 2).GetDecodeEscapes();
var doctor = row.GetOrCreate(dataFirstCellNum - 3).GetDecodeEscapes();
var technic = row.GetOrCreate(dataFirstCellNum - 4).GetDecodeEscapes();
for (int j = dataFirstCellNum - 4; j < dataFirstCellNum; j++)
{
var cell = row.GetCell(j);
if (cell != null)
{
cell.RemoveCellComment();
row.RemoveCell(cell);
}
}
return new IncomeRow(department, doctor, nurse, technic, rowIndex);
}
/// <summary>
/// 抽取优化,删除收入数据的核算科室信息
/// </summary>
/// <param name="row"></param>
/// <param name="dataFirstCellNum"></param>
/// <param name="department"></param>
/// <param name="rowIndex"></param>
/// <returns></returns>
private static void RemoveIncomeRow(ISheet sheet, PerSheetPoint point)
{
if (sheet == null)
return;
for (int i = point.DataFirstRowNum.Value; i < sheet.LastRowNum + 1; i++)
{
var row = sheet.GetRow(i);
if (row != null)
{
int dataFirstCellNum = point.DataFirstCellNum.Value;
//跳过核算单元和科室
for (int j = dataFirstCellNum - 4; j < dataFirstCellNum; j++)
{
var cell = row.GetCell(j);
if (cell != null)
{
cell.RemoveCellComment();
row.RemoveCell(cell);
}
}
}
}
}
} }
} }
...@@ -351,9 +351,9 @@ private ag_secondallot GetPreviousSecondAllot(int hospitalId, ag_secondallot sec ...@@ -351,9 +351,9 @@ private ag_secondallot GetPreviousSecondAllot(int hospitalId, ag_secondallot sec
/// 二次绩效分配录入人员自动补全信息 /// 二次绩效分配录入人员自动补全信息
/// </summary> /// </summary>
/// <param name="secodId"></param> /// <param name="secodId"></param>
/// <param name="workNumber">工号</param> /// <param name="request">工号、姓名</param>
/// <returns></returns> /// <returns></returns>
public JArray AutoComplete(int secodId, string workNumber) public JArray AutoComplete(int secodId, SecondEmployeeRequest request)
{ {
var second = agsecondallotRepository.GetEntity(t => t.Id == secodId); var second = agsecondallotRepository.GetEntity(t => t.Id == secodId);
if (second == null) if (second == null)
...@@ -367,8 +367,16 @@ public JArray AutoComplete(int secodId, string workNumber) ...@@ -367,8 +367,16 @@ public JArray AutoComplete(int secodId, string workNumber)
if (usetemp == null) if (usetemp == null)
throw new PerformanceException("当前科室暂未配置绩效模板"); throw new PerformanceException("当前科室暂未配置绩效模板");
var employees = peremployeeRepository.GetEntities(t => t.AllotId == allot.ID && !string.IsNullOrEmpty(t.PersonnelNumber) && t.PersonnelNumber.IndexOf(workNumber) > -1) #region 接口响应速度优化
?.OrderBy(t => t.PersonnelNumber).ThenByDescending(t => t.DoctorName).ToList(); var employees = new List<per_employee>();
if (!string.IsNullOrEmpty(request?.EmployeeName))
employees = peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId.Value && w.DoctorName == request.EmployeeName);
if (!string.IsNullOrEmpty(request?.JobNumber))
employees = peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId.Value && w.PersonnelNumber == request.JobNumber);
#endregion
employees = employees?.OrderBy(t => t.PersonnelNumber).ThenByDescending(t => t.DoctorName).ToList();
if (employees == null || !employees.Any()) return new JArray(); if (employees == null || !employees.Any()) return new JArray();
var bodysources = new List<ag_bodysource>(); var bodysources = new List<ag_bodysource>();
......
...@@ -307,8 +307,8 @@ public List<BodyItem> AutoComplete(SecondEmpRequest request, int userId) ...@@ -307,8 +307,8 @@ public List<BodyItem> AutoComplete(SecondEmpRequest request, int userId)
//获取固定模板列 + 工作量列 //获取固定模板列 + 工作量列
var headItems = GetHeadItems(request.TempId, usetemp.HospitalId.Value, usetemp.Department, usetemp.UnitType); var headItems = GetHeadItems(request.TempId, usetemp.HospitalId.Value, usetemp.Department, usetemp.UnitType);
var employees = personService.GetPerEmployee(second.AllotId.Value); //var employees = personService.GetPerEmployee(second.AllotId.Value);
var bodyItems = GetEmployees(employees, second, userId, headItems, second.UnitType, request.EmployeeName, request.JobNumber); var bodyItems = GetEmployees(second, userId, headItems, second.UnitType, request.EmployeeName, request.JobNumber);
return bodyItems; return bodyItems;
} }
...@@ -361,16 +361,16 @@ public SecondResponse GetSecondDetail(UseTempRequest request, int userId) ...@@ -361,16 +361,16 @@ public SecondResponse GetSecondDetail(UseTempRequest request, int userId)
if (fixatList.Where(t => t.RowNumber != -1) == null || !fixatList.Where(t => t.RowNumber != -1).Any()) if (fixatList.Where(t => t.RowNumber != -1) == null || !fixatList.Where(t => t.RowNumber != -1).Any())
{ {
//更换模板时,会自动保存顶部数据 //更换模板时,会自动保存顶部数据
var employees = personService.GetPersons(second.AllotId.Value, userId); //var employees = personService.GetPersons(second.AllotId.Value, userId);
result.BodyItems.AddRange(GetEmployees(employees, second, userId, headItems, second.UnitType)); result.BodyItems.AddRange(GetEmployees(second, userId, headItems, second.UnitType));
} }
} }
else else
{ {
//无数据 根据IsBring带出历史二次绩效中需要带出的数据 //无数据 根据IsBring带出历史二次绩效中需要带出的数据
//result.BodyItems = GetBringItems(request, headItems); //result.BodyItems = GetBringItems(request, headItems);
var employees = personService.GetPersons(second.AllotId.Value, userId); //var employees = personService.GetPersons(second.AllotId.Value, userId);
result.BodyItems = GetEmployees(employees, second, userId, headItems, second.UnitType); result.BodyItems = GetEmployees(second, userId, headItems, second.UnitType);
var bodys = Mapper.Map<List<BodyItem>>(headItems.Where(t => t.Type == 1)); var bodys = Mapper.Map<List<BodyItem>>(headItems.Where(t => t.Type == 1));
if (bodys != null && bodys.Any()) if (bodys != null && bodys.Any())
...@@ -418,23 +418,20 @@ private void SupplementOtherPerfor(SecondResponse result, int allotId) ...@@ -418,23 +418,20 @@ private void SupplementOtherPerfor(SecondResponse result, int allotId)
} }
} }
private List<BodyItem> GetEmployees(List<per_employee> employees, ag_secondallot second, int userId, List<HeadItem> heads, string unittype, string empName = "", string jobNumber = "") private List<BodyItem> GetEmployees(ag_secondallot second, int userId, List<HeadItem> heads, string unittype, string empName = "", string jobNumber = "")
{ {
var list = new List<BodyItem>(); #region 接口响应速度优化
var employees = new List<per_employee>();
//var employees = personService.GetPersons(allotId, userId);
if (employees == null || !employees.Any()) return list;
var hospital = hospitalRepository.GetEntity(t => t.ID == employees.First().HospitalId);
if (hospital == null) return list;
if (string.IsNullOrEmpty(empName) && string.IsNullOrEmpty(jobNumber)) if (string.IsNullOrEmpty(empName) && string.IsNullOrEmpty(jobNumber))
employees = employees.Where(t => t.UnitType == unittype).ToList(); employees = peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId.Value && w.UnitType == unittype);
if (!string.IsNullOrEmpty(empName)) if (!string.IsNullOrEmpty(empName))
employees = employees?.Where(w => w.DoctorName?.Trim() == empName?.Trim()).ToList(); employees = peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId.Value && w.DoctorName == empName);
if (!string.IsNullOrEmpty(jobNumber)) if (!string.IsNullOrEmpty(jobNumber))
employees = employees?.Where(w => !string.IsNullOrEmpty(w.PersonnelNumber) && w.PersonnelNumber.Trim() == jobNumber.Trim()).ToList(); employees = peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId.Value && w.PersonnelNumber == jobNumber);
#endregion
if (employees == null || !employees.Any()) return new List<BodyItem>();
var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == second.AllotId && t.Status == 3); var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == second.AllotId && t.Status == 3);
Func<per_employee, decimal?> getAprAmount = (t) => second.Department == t.AccountingUnit && second.UnitType == t.UnitType Func<per_employee, decimal?> getAprAmount = (t) => second.Department == t.AccountingUnit && second.UnitType == t.UnitType
...@@ -452,6 +449,7 @@ private List<BodyItem> GetEmployees(List<per_employee> employees, ag_secondallot ...@@ -452,6 +449,7 @@ private List<BodyItem> GetEmployees(List<per_employee> employees, ag_secondallot
{ ("医院其他绩效","OtherPerformance"), (t) => getAprAmount(t)}, { ("医院其他绩效","OtherPerformance"), (t) => getAprAmount(t)},
}; };
var list = new List<BodyItem>();
int rowNumber = 1; int rowNumber = 1;
foreach (var employee in employees) foreach (var employee in employees)
{ {
...@@ -469,6 +467,8 @@ private List<BodyItem> GetEmployees(List<per_employee> employees, ag_secondallot ...@@ -469,6 +467,8 @@ private List<BodyItem> GetEmployees(List<per_employee> employees, ag_secondallot
rowNumber++; rowNumber++;
} }
var hospital = hospitalRepository.GetEntity(t => t.ID == employees.First().HospitalId);
if (hospital == null) return list;
if (hospital.IsShowSecondDirector == 2) if (hospital.IsShowSecondDirector == 2)
list = list.Where(t => t.FiledName == "岗位" && t.FiledId == "Post" && t.Value == "其他")?.ToList(); list = list.Where(t => t.FiledName == "岗位" && t.FiledId == "Post" && t.Value == "其他")?.ToList();
...@@ -1034,10 +1034,12 @@ public void RefreshTemp(UseTempRequest request) ...@@ -1034,10 +1034,12 @@ public void RefreshTemp(UseTempRequest request)
/// </summary> /// </summary>
/// <param name="secondId"></param> /// <param name="secondId"></param>
/// <returns></returns> /// <returns></returns>
public List<TitleValue<int>> WorkTypeList(WorkloadRequest request, int userId) public List<TitleValue<int>> WorkTypeList(WorkloadRequest request, int secondId)
{ {
var (unit, dept) = GetDeptAndUnit(userId); var second = agsecondallotRepository.GetEntity(t => t.Id == secondId);
var worktypes = agworkloadtypeRepository.GetEntities(t => request.HospitalId.Value == t.HospitalId && t.Department == dept && t.UnitType == unit); if (second == null) throw new PerformanceException("参数错误");
var worktypes = agworkloadtypeRepository.GetEntities(t => request.HospitalId.Value == t.HospitalId && t.Department == second.Department && t.UnitType == second.UnitType);
if (worktypes != null && worktypes.Any()) if (worktypes != null && worktypes.Any())
{ {
return worktypes.Select(t => new TitleValue<int> return worktypes.Select(t => new TitleValue<int>
...@@ -1054,10 +1056,13 @@ public List<TitleValue<int>> WorkTypeList(WorkloadRequest request, int userId) ...@@ -1054,10 +1056,13 @@ public List<TitleValue<int>> WorkTypeList(WorkloadRequest request, int userId)
/// </summary> /// </summary>
/// <param name="secondId"></param> /// <param name="secondId"></param>
/// <returns></returns> /// <returns></returns>
public ag_workload_type SaveWorkType(ag_workload_type request, int userId) public ag_workload_type SaveWorkType(ag_workload_type request, int secondId)
{ {
var (unit, dept) = GetDeptAndUnit(userId); var second = agsecondallotRepository.GetEntity(t => t.Id == secondId);
var entity = agworkloadtypeRepository.GetEntity(t => request.HospitalId == t.HospitalId && t.Department == dept && t.UnitType == unit && t.TypeName == request.TypeName); if (second == null) throw new PerformanceException("参数错误");
var entity = agworkloadtypeRepository.GetEntity(t => request.HospitalId == t.HospitalId && t.Department == second.Department
&& t.UnitType == second.UnitType && t.TypeName == request.TypeName);
if (entity == null) if (entity == null)
{ {
if (request.Id > 0) if (request.Id > 0)
...@@ -1074,8 +1079,8 @@ public ag_workload_type SaveWorkType(ag_workload_type request, int userId) ...@@ -1074,8 +1079,8 @@ public ag_workload_type SaveWorkType(ag_workload_type request, int userId)
{ {
HospitalId = request.HospitalId, HospitalId = request.HospitalId,
TypeName = request.TypeName, TypeName = request.TypeName,
Department = dept, Department = second.Department,
UnitType = unit, UnitType = second.UnitType,
}; };
agworkloadtypeRepository.Add(entity); agworkloadtypeRepository.Add(entity);
} }
...@@ -1438,23 +1443,25 @@ public List<ag_workload> GetSingleList(WorkloadRequest request) ...@@ -1438,23 +1443,25 @@ public List<ag_workload> GetSingleList(WorkloadRequest request)
&& t.UnitType == request.UnitType && t.ItemId.StartsWith(AgWorkloadType.SingleAwards.ToString())); && t.UnitType == request.UnitType && t.ItemId.StartsWith(AgWorkloadType.SingleAwards.ToString()));
} }
public (string, string) GetDeptAndUnit(int userId) //public (string, string) GetDeptAndUnit(int userId)
{ //{
var user = userRepository.GetEntity(t => t.ID == userId); // var user = userRepository.GetEntity(t => t.ID == userId);
var userrole = userroleRepository.GetEntity(t => t.UserID == userId); // var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
var role = roleRepository.GetEntity(t => t.ID == userrole.RoleID); // var role = roleRepository.GetEntity(t => t.ID == userrole.RoleID);
if (role.Type == application.DirectorRole) // if (role.Type == application.DirectorRole)
return (UnitType.医生组.ToString(), user.Department); // {
else if (role.Type == application.NurseRole) // return (UnitType.医生组.ToString(), user.Department);
return (UnitType.护理组.ToString(), user.Department); // }
if (role.Type == application.SpecialRole) // else if (role.Type == application.NurseRole)
return (UnitType.特殊核算组.ToString(), user.Department); // return (UnitType.护理组.ToString(), user.Department);
if (role.Type == application.OfficeRole) // if (role.Type == application.SpecialRole)
return (UnitType.行政后勤.ToString(), user.Department); // return (UnitType.特殊核算组.ToString(), user.Department);
else // if (role.Type == application.OfficeRole)
return ("", user.Department); // return (UnitType.行政后勤.ToString(), user.Department);
} // else
// return ("", user.Department);
//}
#endregion 工作量绩效配置 #endregion 工作量绩效配置
...@@ -1921,14 +1928,17 @@ public List<ag_othersource> OtherAutoComplete(SecondEmpRequest request, int user ...@@ -1921,14 +1928,17 @@ public List<ag_othersource> OtherAutoComplete(SecondEmpRequest request, int user
//获取固定模板列 + 工作量列 //获取固定模板列 + 工作量列
var headItems = GetHeadItems(request.TempId, usetemp.HospitalId.Value, usetemp.Department, usetemp.UnitType); var headItems = GetHeadItems(request.TempId, usetemp.HospitalId.Value, usetemp.Department, usetemp.UnitType);
var employees = personService.GetPerEmployee(second.AllotId.Value); #region 接口响应速度优化
var employees = new List<per_employee>();
if (!string.IsNullOrEmpty(request?.EmployeeName))
employees = peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId.Value && w.DoctorName == request.EmployeeName);
if (!string.IsNullOrEmpty(request?.JobNumber))
employees = peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId.Value && w.PersonnelNumber == request.JobNumber);
#endregion
if (employees == null) return new List<ag_othersource>(); if (employees == null) return new List<ag_othersource>();
if (!string.IsNullOrEmpty(request.EmployeeName))
employees = employees?.Where(w => w.DoctorName?.Trim() == request.EmployeeName?.Trim()).ToList();
if (!string.IsNullOrEmpty(request.JobNumber))
employees = employees?.Where(w => !string.IsNullOrEmpty(w.PersonnelNumber) && w.PersonnelNumber.Trim() == request.JobNumber.Trim()).ToList();
List<ag_othersource> result = employees List<ag_othersource> result = employees
.Select(t => new ag_othersource .Select(t => new ag_othersource
...@@ -2194,7 +2204,7 @@ public List<DeptDataDetails> DeptComputeDetailList(int userId, int allotId, out ...@@ -2194,7 +2204,7 @@ public List<DeptDataDetails> DeptComputeDetailList(int userId, int allotId, out
if (computes == null || !computes.Any()) return new List<DeptDataDetails>(); if (computes == null || !computes.Any()) return new List<DeptDataDetails>();
foreach (var item in computes) foreach (var item in computes)
{ {
if (item.AccountType==AccountUnitType.行政中层.ToString()) if (item.AccountType == AccountUnitType.行政中层.ToString())
deptDatas.Add(computeService.GetAdministration(item.ID)); deptDatas.Add(computeService.GetAdministration(item.ID));
else else
deptDatas.Add(computeService.GetDoctorDetail(item.ID)); deptDatas.Add(computeService.GetDoctorDetail(item.ID));
......
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