Commit 8d06dfe0 by lcx

提交审核接口,科室详情数据展示 接口调整

parent 84c9441d
...@@ -110,7 +110,6 @@ public ApiResponse SaveCollectData(int allotId, [FromBody] SaveCollectData reque ...@@ -110,7 +110,6 @@ public ApiResponse SaveCollectData(int allotId, [FromBody] SaveCollectData reque
if (allotId <= 0) if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效"); return new ApiResponse(ResponseType.ParameterError, "参数无效");
collectService.SaveCollectData(allotId, request, claim.GetUserId()); collectService.SaveCollectData(allotId, request, claim.GetUserId());
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
...@@ -119,12 +118,11 @@ public ApiResponse SaveCollectData(int allotId, [FromBody] SaveCollectData reque ...@@ -119,12 +118,11 @@ public ApiResponse SaveCollectData(int allotId, [FromBody] SaveCollectData reque
/// </summary> /// </summary>
[HttpPost] [HttpPost]
[Route("submitcollectdata/{allotId}")] [Route("submitcollectdata/{allotId}")]
public ApiResponse SubmitCollectData(int allotId, [FromQuery] string sheetName) public ApiResponse SubmitCollectData(int allotId, [FromBody] SaveCollectData request)
{ {
if (allotId <= 0) if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效"); return new ApiResponse(ResponseType.ParameterError, "参数无效");
collectService.SaveCollectData(allotId, request, claim.GetUserId(), 2);
collectService.SubmitCollectData(allotId, sheetName, claim.GetUserId());
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
...@@ -177,10 +175,10 @@ public ApiResponse DepartmentList(int allotId, [FromQuery] int userId) ...@@ -177,10 +175,10 @@ public ApiResponse DepartmentList(int allotId, [FromQuery] int userId)
[Route("collectdataaudit")] [Route("collectdataaudit")]
public ApiResponse CollectDataAudit([FromBody] CollectAuditRequest request) public ApiResponse CollectDataAudit([FromBody] CollectAuditRequest request)
{ {
if (request == null || request.AllotId <= 0 || request.UserId <= 0 || new int[] { 3, 4 }.Contains(request.Status)) if (request == null || request.AllotId <= 0 || request.UserId <= 0 || !new int[] { 3, 4 }.Contains(request.Status))
return new ApiResponse(ResponseType.ParameterError, "参数无效"); return new ApiResponse(ResponseType.ParameterError, "参数无效");
var result = collectService.CollectDataAudit(request.AllotId, request.Status, request.Status); var result = collectService.CollectDataAudit(request.AllotId, request.UserId, request.Status);
string remark = request.Status == 3 ? "审核通过" : "驳回成功"; string remark = request.Status == 3 ? "审核通过" : "驳回成功";
return result ? new ApiResponse(ResponseType.OK, remark) : new ApiResponse(ResponseType.Fail, "操作失败"); return result ? new ApiResponse(ResponseType.OK, remark) : new ApiResponse(ResponseType.Fail, "操作失败");
} }
......
...@@ -417,6 +417,11 @@ ...@@ -417,6 +417,11 @@
科室显示列表 科室显示列表
</summary> </summary>
</member> </member>
<member name="M:Performance.Api.Controllers.CollectController.CollectDataAudit(Performance.DtoModels.CollectAuditRequest)">
<summary>
提交数据审核
</summary>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.GetCompute(Performance.DtoModels.ComputerRequest)"> <member name="M:Performance.Api.Controllers.ComputeController.GetCompute(Performance.DtoModels.ComputerRequest)">
<summary> <summary>
获取绩效发放列表 获取绩效发放列表
......
...@@ -1968,6 +1968,11 @@ ...@@ -1968,6 +1968,11 @@
参数值 参数值
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.CollectAuditRequest.Status">
<summary>
3 审核通过 4 驳回
</summary>
</member>
<member name="P:Performance.DtoModels.ComputerRequest.ComputeId"> <member name="P:Performance.DtoModels.ComputerRequest.ComputeId">
<summary> <summary>
绩效数据id 绩效数据id
......
...@@ -2278,7 +2278,7 @@ ...@@ -2278,7 +2278,7 @@
</member> </member>
<member name="P:Performance.EntityModels.collect_data.Status"> <member name="P:Performance.EntityModels.collect_data.Status">
<summary> <summary>
1 保存 2 提交 3 审核通过 4 驳回 5 部分审核 1 保存 2 提交(等待审核) 3 审核通过 4 驳回
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.collect_data.SavedUser"> <member name="P:Performance.EntityModels.collect_data.SavedUser">
......
...@@ -26,6 +26,8 @@ public class HandsonTable : HandsonTableBase ...@@ -26,6 +26,8 @@ public class HandsonTable : HandsonTableBase
{ {
private IEnumerable<collect_permission> _permissions; private IEnumerable<collect_permission> _permissions;
public bool ReadOnly { get; set; } = false;
public HandsonTable(int sheetType, string[] cols, List<collect_permission> permissions) public HandsonTable(int sheetType, string[] cols, List<collect_permission> permissions)
: base() : base()
{ {
......
...@@ -406,6 +406,11 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName) ...@@ -406,6 +406,11 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
HandsonTable handson = new HandsonTable(sheet.SheetType.Value, cols, permissions); HandsonTable handson = new HandsonTable(sheet.SheetType.Value, cols, permissions);
handson.SetRowData(rowDatas, (collectdata != null)); handson.SetRowData(rowDatas, (collectdata != null));
if (collectdata != null && collectdata.Any(t => t.Status == 2))
{
handson.Columns?.ForEach(t => t.ReadOnly = true);
handson.ReadOnly = true;
}
return handson; return handson;
} }
...@@ -613,12 +618,10 @@ private void GetUnitClassification(List<HandsonCellData> setdata, UnitType unitT ...@@ -613,12 +618,10 @@ private void GetUnitClassification(List<HandsonCellData> setdata, UnitType unitT
#endregion 加载采集内容 #endregion 加载采集内容
public void SaveCollectData(int allotId, SaveCollectData request, int userId) public void SaveCollectData(int allotId, SaveCollectData request, int userId, int status = 1)
{ {
var types = new List<int> { (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload, (int)SheetType.SpecialUnit }; var types = new List<int> { (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload, (int)SheetType.SpecialUnit };
types.AddRange(CollectDataConfig.AccountExrtaType);
if (!types.Contains(request.SheetType)) if (!types.Contains(request.SheetType))
throw new PerformanceException("当前SHEET页信息错误"); throw new PerformanceException("当前SHEET页信息错误");
...@@ -628,19 +631,7 @@ public void SaveCollectData(int allotId, SaveCollectData request, int userId) ...@@ -628,19 +631,7 @@ public void SaveCollectData(int allotId, SaveCollectData request, int userId)
if (request.Data == null || request.Data.Length == 0) if (request.Data == null || request.Data.Length == 0)
throw new PerformanceException("当前SHEET页列头信息错误"); throw new PerformanceException("当前SHEET页列头信息错误");
Dictionary<string, string> config = null; Dictionary<string, string> config = CollectDataConfig.Default;
if (request.SheetType == (int)SheetType.Employee)
config = CollectDataConfig.Employee;
else if (request.SheetType == (int)SheetType.ClinicEmployee)
config = CollectDataConfig.ClinicEmployee;
else if (request.SheetType == (int)SheetType.LogisticsEmployee)
config = CollectDataConfig.LogisticsEmployee;
else if (request.SheetType == (int)SheetType.PersonExtra)
config = CollectDataConfig.PersonExtra;
else if (CollectDataConfig.AccountExrtaType.Contains(request.SheetType))
config = CollectDataConfig.AccountExtra;
else
config = CollectDataConfig.Default;
DateTime date = DateTime.Now; DateTime date = DateTime.Now;
var dicData = CreateDataRow(allotId, request, config); var dicData = CreateDataRow(allotId, request, config);
...@@ -654,9 +645,11 @@ public void SaveCollectData(int allotId, SaveCollectData request, int userId) ...@@ -654,9 +645,11 @@ public void SaveCollectData(int allotId, SaveCollectData request, int userId)
|| !string.IsNullOrEmpty(data.AccountingUnitDoctor) || !string.IsNullOrEmpty(data.AccountingUnitDoctor)
|| !string.IsNullOrEmpty(data.Department)) || !string.IsNullOrEmpty(data.Department))
{ {
data.Status = 1; data.Status = status;
data.SavedUser = userId; data.SavedUser = userId;
data.SavedTime = date; data.SavedTime = date;
if (status == 2)
data.SubmitUser = userId;
datas.Add(data); datas.Add(data);
} }
} }
...@@ -702,6 +695,14 @@ public void SaveCollectData(int allotId, SaveCollectData request, int userId) ...@@ -702,6 +695,14 @@ public void SaveCollectData(int allotId, SaveCollectData request, int userId)
for (int c = 0; c < request.ColHeaders.Length; c++) for (int c = 0; c < request.ColHeaders.Length; c++)
{ {
var header = request.ColHeaders[c]; var header = request.ColHeaders[c];
if (request.SheetType == (int)SheetType.Workload && header.Contains("核算单元"))
{
if (request.SheetName.Contains("医生"))
header = CollectDataConfig.Default[nameof(collect_data.AccountingUnitDoctor)];
else if (request.SheetName.Contains("护理"))
header = CollectDataConfig.Default[nameof(collect_data.AccountingUnitNurse)];
}
var first = config.FirstOrDefault(w => w.Value == header); var first = config.FirstOrDefault(w => w.Value == header);
if (!default(KeyValuePair<string, string>).Equals(first) if (!default(KeyValuePair<string, string>).Equals(first)
&& !result.ContainsKey(header) && !result.ContainsKey(header)
...@@ -869,6 +870,115 @@ public dynamic PerformanceforList(int allotId) ...@@ -869,6 +870,115 @@ public dynamic PerformanceforList(int allotId)
/// <summary> /// <summary>
/// 科室显示列表 /// 科室显示列表
/// </summary> /// </summary>
/// <param name="allotId"></param>
/// <param name="userId"></param>
/// <returns></returns>
public SheetExportResponse DepartmentTable(int allotId, int userId)
{
SheetExportResponse sheet = new SheetExportResponse();
var data = perforcollectdataRepository.GetEntities(t => t.AllotID == allotId && t.SubmitUser == userId);
if (data == null || !data.Any())
return sheet;
data.ForEach(t =>
{
t.AccountingUnitDoctor = t.AccountingUnitDoctor ?? "";
t.AccountingUnitNurse = t.AccountingUnitNurse ?? "";
t.AccountingUnitTechnician = t.AccountingUnitTechnician ?? "";
});
#region header
var mergeCells = 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 = 2, MergeRow = 1, MergeCell = 1 },
new Cell{ CellType = "header", CellValue = "", PointCell = 3, 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 = 2, MergeRow = 1, MergeCell = 1 },
new Cell{ CellType = "header", CellValue = "科室名称", PointCell = 3, MergeRow = 1, MergeCell = 1 },
};
int index = 4;
var sheetnames = data.Select(t => t.SheetName).Distinct();
foreach (var sheetname in sheetnames)
{
var sheetColumns = data.Where(t => t.SheetName == sheetname).Select(t => t.TypeName).Distinct().OrderBy(t => t);
mergeCells.Add(new Cell { CellType = "header", CellValue = sheetname, PointCell = index, MergeRow = 1, MergeCell = sheetColumns.Count() });
int i = 0;
cells.AddRange(sheetColumns.Select(t =>
{
i++;
return new Cell
{
CellType = "header",
CellValue = t,
PointCell = index + i,
MergeRow = 1,
MergeCell = 1
};
}));
index += sheetColumns.Count();
}
sheet.Header = new List<Row>
{
new Row(0){ Data = mergeCells },
new Row(1){ Data = cells }
};
#endregion
#region data
List<Row> rows = new List<Row>();
int rownumber = 0;
var groupData = data.GroupBy(t => new { t.AccountingUnitTechnician, t.AccountingUnitDoctor, t.AccountingUnitNurse, t.Department });
foreach (var item in groupData.OrderBy(t => t.Key.Department))
{
var rowcells = new List<Cell>
{
new Cell { CellType = "body", CellValue = item.Key.AccountingUnitTechnician, PointCell = 0, MergeRow = 1, MergeCell = 1 },
new Cell { CellType = "body", CellValue = item.Key.AccountingUnitDoctor, PointCell = 1, MergeRow = 1, MergeCell = 1 },
new Cell { CellType = "body", CellValue = item.Key.AccountingUnitNurse, PointCell = 2, MergeRow = 1, MergeCell = 1 },
new Cell { CellType = "body", CellValue = item.Key.Department, PointCell = 1, MergeRow = 3, MergeCell = 1 },
};
index = 4;
foreach (var header in cells.Select(t => t.CellValue.ToString()))
{
var value = item.FirstOrDefault(t => t.CellValue == header)?.CellValue;
rowcells.Add(new Cell
{
CellType = "body",
CellValue = value,
PointCell = index,
MergeRow = 1,
MergeCell = 1
});
index++;
}
rows.Add(new Row(rownumber) { Data = rowcells });
rownumber++;
}
sheet.Row = rows;
#endregion
return sheet;
}
/// <summary>
/// 科室显示列表
/// </summary>
/// <returns></returns> /// <returns></returns>
public HandsonTableBase DepartmentList(int allotId, int userId) public HandsonTableBase DepartmentList(int allotId, int userId)
{ {
...@@ -902,25 +1012,28 @@ public HandsonTableBase DepartmentList(int allotId, int userId) ...@@ -902,25 +1012,28 @@ public HandsonTableBase DepartmentList(int allotId, int userId)
"核算单元(护理组)", "核算单元(护理组)",
"科室名称", "科室名称",
}; };
var headers = new List<string>(); var headers = new List<(string, string)>();
var columns = new List<HandsonColumn> var columns = new List<HandsonColumn>
{ {
new HandsonColumn("核算单元(医技组)", false), new HandsonColumn("核算单元(医技组)", true),
new HandsonColumn("核算单元(医生组)", false), new HandsonColumn("核算单元(医生组)", true),
new HandsonColumn("核算单元(护理组)", false), new HandsonColumn("核算单元(护理组)", true),
new HandsonColumn("科室名称", false), new HandsonColumn("科室名称", true),
}; };
foreach (var sheet in sheets) foreach (var sheet in sheets)
{ {
var sheetColumns = data.Where(t => t.SheetName == sheet).Select(t => t.TypeName).Distinct().OrderBy(t => t); var sheetColumns = data.Where(t => t.SheetName == sheet).Select(t => t.TypeName).Distinct().OrderBy(t => t).ToList();
headers.AddRange(sheetColumns); if (new string[] { "3.1", "3.2" }.Any(t => sheet.StartsWith(t)) && sheetColumns.Contains("核算单元"))
{
sheetColumns.Remove("核算单元");
}
cells.AddRange(sheetColumns);
headers.AddRange(sheetColumns.Select(t => (sheet, t)));
mergeCells.Add(new NestedHeader(sheet, sheetColumns.Count())); mergeCells.Add(new NestedHeader(sheet, sheetColumns.Count()));
columns.AddRange(sheetColumns.Select(t => new HandsonColumn(t, false, DataFormat.小数))); columns.AddRange(sheetColumns.Select(t => new HandsonColumn(sheet + "_" + t, true, DataFormat.小数)));
} }
cells.AddRange(headers);
#endregion #endregion
#region data #region data
...@@ -930,18 +1043,21 @@ public HandsonTableBase DepartmentList(int allotId, int userId) ...@@ -930,18 +1043,21 @@ public HandsonTableBase DepartmentList(int allotId, int userId)
var groupData = data.GroupBy(t => new { t.AccountingUnitTechnician, t.AccountingUnitDoctor, t.AccountingUnitNurse, t.Department }); var groupData = data.GroupBy(t => new { t.AccountingUnitTechnician, t.AccountingUnitDoctor, t.AccountingUnitNurse, t.Department });
foreach (var item in groupData.OrderBy(t => t.Key.Department)) foreach (var item in groupData.OrderBy(t => t.Key.Department))
{ {
var dic = new Dictionary<string, object>(); var dic = new Dictionary<string, object>
dic.Add("核算单元(医技组)", item.Key.AccountingUnitTechnician); {
dic.Add("核算单元(医生组)", item.Key.AccountingUnitDoctor); { "核算单元(医技组)", item.Key.AccountingUnitTechnician },
dic.Add("核算单元(护理组)", item.Key.AccountingUnitNurse); { "核算单元(医生组)", item.Key.AccountingUnitDoctor },
dic.Add("科室名称", item.Key.Department); { "核算单元(护理组)", item.Key.AccountingUnitNurse },
{ "科室名称", item.Key.Department }
};
foreach (var header in headers) foreach (var header in headers)
{ {
if (dic.ContainsKey(header)) continue; var key = header.Item1 + "_" + header.Item2;
if (dic.ContainsKey(key)) continue;
var value = item.FirstOrDefault(t => t.TypeName == header)?.CellValue; var value = item.FirstOrDefault(t => t.SheetName == header.Item1 && t.TypeName == header.Item2)?.CellValue;
dic.Add(header, value); dic.Add(key, value);
} }
tableData.Add(dic); tableData.Add(dic);
} }
......
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