Commit 33b39b4f by 钟博

Merge branch 'feature/划拨' into release/v20210625二次绩效划拨合并

parents 5551f6bc d4731f46
......@@ -50,7 +50,7 @@ public ApiResponse SubmitApplications([FromBody] CostTransferRequest request)
/// <returns></returns>
[Route("common/{hospitalId}/allot/{allotId}")]
[HttpPost]
public ApiResponse Common(int hospitalId, int allotId)
public ApiResponse Common(int hospitalId, int allotId, [FromBody] DepartmentDetail detail)
{
if (hospitalId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数HospitalId无效!");
......@@ -61,13 +61,29 @@ public ApiResponse Common(int hospitalId, int allotId)
var user = userService.GetUser(userid);
var role = roleService.GetARole(user.UserID);
var result = costTransferService.Common(allotId, hospitalId,role.Type.Value, user.Department);
var result = costTransferService.Common(allotId, hospitalId, role.Type.Value, user.Department, detail);
result.deparment = user.Department ?? "";
return new ApiResponse(ResponseType.OK, result);
}
/// <summary>
/// 撤回提交
/// </summary>
/// <param name="itemId"></param>
/// <returns></returns>
[Route("withdrawsubmit/{itemId}")]
[HttpPost]
public ApiResponse WithdrawSubmit(int itemId)
{
if (itemId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数itemId无效!");
costTransferService.WithdrawSubmit(itemId);
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 审核列表
/// </summary>
/// <param name="allotId"></param>
......@@ -75,7 +91,7 @@ public ApiResponse Common(int hospitalId, int allotId)
/// <returns></returns>
[Route("auditlist/{allotId}/menuType/{menuType}")]
[HttpPost]
public ApiResponse AuditList(int allotId,int menuType)
public ApiResponse AuditList(int allotId, int menuType)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
......@@ -83,7 +99,7 @@ public ApiResponse AuditList(int allotId,int menuType)
var userid = claim.GetUserId();
var user = userService.GetUser(userid);
var role = roleService.GetARole(user.UserID);
var result = costTransferService.GetAuditList(allotId,menuType, role.Type.Value, user.Department);
var result = costTransferService.GetAuditList(allotId, menuType, role.Type.Value, user.Department);
return new ApiResponse(ResponseType.OK, result);
......
......@@ -703,12 +703,19 @@
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.CostTransferController.Common(System.Int32,System.Int32)">
<member name="M:Performance.Api.Controllers.CostTransferController.Common(System.Int32,System.Int32,Performance.DtoModels.DepartmentDetail)">
<summary>
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.CostTransferController.WithdrawSubmit(System.Int32)">
<summary>
撤回提交
</summary>
<param name="itemId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.CostTransferController.AuditList(System.Int32,System.Int32)">
<summary>
审核列表
......
......@@ -2314,19 +2314,29 @@
是否使用分割比例
</summary>
</member>
<member name="P:Performance.EntityModels.cost_transfer_item.Remark">
<member name="P:Performance.EntityModels.cost_transfer_item.ApplicationRemark">
<summary>
备注
申请理由
</summary>
</member>
<member name="P:Performance.EntityModels.cost_transfer_item.DepartmentRemark">
<summary>
科室备注
</summary>
</member>
<member name="P:Performance.EntityModels.cost_transfer_item.AdminRemark">
<summary>
管理员备注
</summary>
</member>
<member name="P:Performance.EntityModels.cost_transfer_item.Status">
<summary>
0 默认 1 通过 2 驳回 3 下发驳回
0 默认 1 通过 2 驳回 3 下发驳回 4 撤回
</summary>
</member>
<member name="P:Performance.EntityModels.cost_transfer_item.AdminStatus">
<summary>
0 默认 1 通过 2 驳回 3 下发驳回
0 默认 1 通过 2 驳回 3 下发驳回 4 撤回
</summary>
</member>
<member name="P:Performance.EntityModels.cost_transfer_item.IsWrited">
......
......@@ -80,9 +80,6 @@ public enum AllotStates
/// <summary> 绩效结果解析成功 </summary>
[Description("数据验证通过")]
GenerateAccomplish = 10,
/// <summary> 下发 </summary>
[Description("下发")]
Issue = 11
}
public enum AgWorkloadType
......
......@@ -18,6 +18,6 @@ public class CostTransferItemRequest
public int IsUseRatio { get; set; }
public string Remark { get; set; }
public string ApplicationRemark { get; set; }
}
}
......@@ -41,6 +41,8 @@ public class CostTransferResponse
public int AdminStatus { get; set; }
public decimal AmountSum { get; set; }
public List<Option> Items { get; set; }
}
......
......@@ -55,19 +55,29 @@ public class cost_transfer_item
/// 是否使用分割比例
/// </summary>
public int IsUseRatio { get; set; }
/// <summary>
/// 申请理由
/// </summary>
public string ApplicationRemark { get; set; }
/// <summary>
/// 备注
/// 科室备注
/// </summary>
public string Remark { get; set; }
public string DepartmentRemark { get; set; }
/// <summary>
/// 0 默认 1 通过 2 驳回 3 下发驳回
/// 管理员备注
/// </summary>
public string AdminRemark { get; set; }
/// <summary>
/// 0 默认 1 通过 2 驳回 3 下发驳回 4 撤回
/// </summary>
public int Status { get; set; }
/// <summary>
/// 0 默认 1 通过 2 驳回 3 下发驳回
/// 0 默认 1 通过 2 驳回 3 下发驳回 4 撤回
/// </summary>
public int AdminStatus { get; set; }
......
......@@ -99,6 +99,8 @@ public List<CostTransferResponse> GetAuditList(int allotId, int menuType, int ro
var costsId = costTransfers?.Select(w => w.Id);
//var transfer = costTransfers.FirstOrDefault();
var costItem = costtransferitemRepository.GetEntities(t => costsId.Contains(t.TransferId));
if (menuType != 1)
costItem = costItem?.FindAll(t => t.Status != 4);
//如果是绩效办显示已经被科室同意的数据
//if (roleTypes)
......@@ -108,7 +110,7 @@ public List<CostTransferResponse> GetAuditList(int allotId, int menuType, int ro
{
var result = new CostTransferResponse();
result = Mapper.Map<CostTransferResponse>(item);
result.Items = costItem.Where(t => t.TransferId == item.Id)?.Select(t => new Option
result.Items = costItem?.Where(t => t.TransferId == item.Id)?.Select(t => new Option
{
Id = t.Id,
TransferId = t.TransferId,
......@@ -116,10 +118,13 @@ public List<CostTransferResponse> GetAuditList(int allotId, int menuType, int ro
Category = t.Category,
Amount = t.Amount,
Ratio = t.Ratio,
IsUseRatio = t.IsUseRatio,
CalculationAmount = t.CalculationAmount,
Status = t.Status,
AdminStatus = t.AdminStatus,
Remark = t.Remark,
ApplicationRemark = t.ApplicationRemark,
DepartmentRemark = t.DepartmentRemark,
AdminRemark = t.AdminRemark,
options = new string[] { },
ApplicantDepartment = result.ApplicantDepartment,
AdoptedDepartment = result.AdoptedDepartment
......@@ -154,60 +159,57 @@ public cof_accounting GetAccounting(int allotId, int roleType, string Department
/// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <param name="roleType"></param>
/// <param name="deparment"></param>
/// <param name="detail"></param>
/// <returns></returns>
public CommonResponse Common(int allotId, int hospitalId, int roleType, string deparment)
public CommonResponse Common(int allotId, int hospitalId, int roleType, string deparment, DepartmentDetail detail)
{
var common = new CommonResponse();
common.account = cofaccountingRepository.GetEntities(t => t.AllotId == allotId)
?.Select(t => new TitleValue { Title = t.AccountingUnit, Value = t.AccountingUnit }).ToDistinct().ToList();
var sheets = persheetRepository.GetEntities(t => t.AllotID == allotId && t.SheetType == (int)SheetType.Income);
common.unitType = GetAccounting(allotId, roleType, deparment)?.UnitType;
if (common.unitType == null)
var prevAllotList = PrevAllotList(hospitalId, allotId);
if (prevAllotList != null && prevAllotList.Any())
{
var prevAllot = PrevAllot(hospitalId, allotId);
if (prevAllot == null) return common;
common.unitType = GetAccounting(prevAllot.ID, roleType, deparment)?.UnitType;
to:
if (common.unitType == null)
foreach (var prevAllot in prevAllotList)
{
var prevAllotId = prevAllot.ID--;
if (prevAllotId <= 0) return common;
common.unitType = GetAccounting(prevAllot.ID, roleType, deparment)?.UnitType;
goto to;
string unittype = GetAccounting(prevAllot.ID, roleType, deparment)?.UnitType;
if (!string.IsNullOrEmpty(unittype))
{
common.unitType = unittype;
break;
}
}
}
if (sheets == null || !sheets.Any())
{
var data = new List<Common>()
{
new Common{ Source = "门诊开单收入"},
new Common{ Source = "门诊执行收入"},
new Common{ Source = "住院开单收入"},
new Common{ Source = "住院执行收入"},
};
common.Data = data;
return common;
}
var unitValue = EnumHelper.GetItems<UnitType>().Find(t => t.Name == common.unitType)?.Value;
var sheetId = sheets.Select(t => t.ID);
var imData = imdataRepository.GetEntities(t => t.AllotID == allotId && sheetId.Contains(t.SheetID.Value) && t.UnitType == unitValue);
if (imData == null || !imData.Any()) return common;
var sheets = persheetRepository.GetEntities(t => t.AllotID == allotId && t.SheetType == (int)SheetType.Income);
if (sheets != null && sheets.Any())
{
var sheetId = sheets.Select(t => t.ID);
var datas = from im in imData group im by new { im.SheetID, im.TypeName, im.FactorValue } into i select new { i.Key, i };
int imDataAllotId = prevAllotList.FirstOrDefault(t => new int[] { 6, 8, 10 }.Contains(t.States))?.ID ?? 0;
var commons = datas.Select(t => new Common
{
Source = Regex.Replace(sheets.Find(w => w.ID == t.Key.SheetID).SheetName, @"\d.", ""),
Category = t.Key.TypeName,
Ratio = t.Key.FactorValue.Value
}).ToList();
var imData = imdataRepository.GetEntities(t => t.AllotID == imDataAllotId && sheetId.Contains(t.SheetID.Value));
if (imData == null || !imData.Any()) return common;
common.Data = commons;
var commons = new List<Common>();
var unitValue = EnumHelper.GetItems<UnitType>().Find(t => t.Name == detail.UnitType)?.Value;
if (imData != null && imData.Any(t => t.UnitType == unitValue))
{
var datas = from im in imData.Where(t => t.UnitType == unitValue)
group im by new { im.SheetID, im.TypeName, im.FactorValue } into i
select new { i.Key, i };
commons = datas.Select(t => new Common
{
Source = Regex.Replace(sheets.Find(w => w.ID == t.Key.SheetID).SheetName, @"\d.", ""),
Category = t.Key.TypeName,
Ratio = t.Key.FactorValue.Value
}).ToList();
}
common.Data = commons;
}
#region
/*
var drugType = cofdrugtypeRepository.GetEntities(t => t.HospitalId == hospitalId && t.AllotID == allotId)
......@@ -228,7 +230,6 @@ public CommonResponse Common(int allotId, int hospitalId, int roleType, string d
*/
#endregion
return common;
}
......@@ -256,7 +257,7 @@ public bool Applicat(CostTransferRequest request)
throw new PerformanceException("参数错误,提交科室相同");
var allot = perallotRepository.GetEntity(t => t.ID == request.AllotId);
var allotStatus = new[] { (int)AllotStates.Issue, (int)AllotStates.Archive };
var allotStatus = new[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive };
if (allotStatus.Contains(allot.States))
throw new PerformanceException("绩效已下发");
......@@ -279,13 +280,13 @@ public bool Applicat(CostTransferRequest request)
var items = request.Items?.Select(t => new cost_transfer_item
{
TransferId = transfer.Id,
Source = t.Source,
Source = t.Source ?? "",
Category = t.Category,
Amount = t.Amount,
Ratio = t.Ratio,
CalculationAmount = t.CalculationAmount,
IsUseRatio = t.IsUseRatio,
Remark = t.Remark,
ApplicationRemark = t.ApplicationRemark,
Status = 0,
AdminStatus = 0
}).ToArray();
......@@ -296,6 +297,19 @@ public bool Applicat(CostTransferRequest request)
return result;
}
/// <summary>
/// 撤回提交
/// </summary>
/// <param name="itemId"></param>
public void WithdrawSubmit(int itemId)
{
var item = costtransferitemRepository.GetEntity(t => t.Id == itemId);
if (item == null) throw new PerformanceException("申请记录不存在");
item.Status = 4;
item.AdminStatus = 4;
costtransferitemRepository.Update(item);
}
/// <summary>
/// 申请划拨信息修改
......@@ -357,7 +371,7 @@ public void UpdateApplicat(CostTransferUpdateRequest request)
update.Ratio = item.Ratio;
update.CalculationAmount = item.CalculationAmount;
update.IsUseRatio = item.IsUseRatio;
update.Remark = item.Remark;
update.ApplicationRemark = item.ApplicationRemark;
update.Status = 0;
update.AdminStatus = 0;
hasPrimaryValueItmes.Remove(item);
......@@ -425,7 +439,7 @@ public bool CostTransferAudit(AuditRequest request, bool isAdmin)
costItems.ForEach(t =>
{
t.AdminStatus = request.Status;
t.Remark = request.Remake;
t.AdminRemark = request.Remake;
});
}
else
......@@ -435,7 +449,7 @@ public bool CostTransferAudit(AuditRequest request, bool isAdmin)
if (request.Status == 2 && t.AdminStatus != 0)
t.AdminStatus = 2;
t.Status = request.Status;
t.Remark = request.Remake;
t.DepartmentRemark = request.Remake;
});
}
......@@ -489,7 +503,16 @@ public bool RejectedApplicat(int allotId)
/// <param name="allotId"></param>
public void IntoLastTiemData(int hospitalId, int allotId)
{
var prevAllot = PrevAllot(hospitalId, allotId);
var allotList = perallotRepository.GetEntities(w => w.HospitalId == hospitalId)?.OrderBy(s => s.Year).ThenBy(s => s.Month).ToList();
if (allotList == null || !allotList.Any()) return;
var allot = allotList.FirstOrDefault(w => w.ID == allotId);
if (allot == null) return;
var index = allotList.IndexOf(allot);
if (index == 0) return;
var prevAllot = allotList[index - 1];
if (prevAllot == null) return;
var transfers = costtransferRepository.GetEntities(t => t.AllotId == prevAllot.ID);
......@@ -520,7 +543,7 @@ public void IntoLastTiemData(int hospitalId, int allotId)
Ratio = t.Ratio,
CalculationAmount = t.CalculationAmount,
IsUseRatio = t.IsUseRatio,
Remark = t.Remark,
ApplicationRemark = t.ApplicationRemark,
Status = 0,
AdminStatus = 0,
IsWrited = 0
......@@ -531,20 +554,15 @@ public void IntoLastTiemData(int hospitalId, int allotId)
}
private per_allot PrevAllot(int hospitalId, int allotId)
private List<per_allot> PrevAllotList(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 allotList = perallotRepository.GetEntities(w => w.HospitalId == hospitalId)?.OrderByDescending(s => s.Year).ThenByDescending(s => s.Month).ToList();
if (allotList == null || !allotList.Any()) return new List<per_allot>();
var allot = allotList.FirstOrDefault(w => w.ID == allotId);
if (allot == null) throw new PerformanceException("未查询到符合的绩效记录");
var index = allotList.IndexOf(allot);
if (index == 0) return null;
var prevAllot = allotList[index - 1];
if (allot == null) return new List<per_allot>();
return prevAllot;
return allotList.Where(t => t.Year <= allot.Year && t.Month <= allot.Month)?.ToList();
}
/// <summary>
......@@ -626,5 +644,24 @@ public void UpdateCostTransferStatus(int transferId)
logger.LogError($"修改申请记录的状态异常:{ex}");
}
}
#region 划拨报表
public void ApplicationContent(int allotId, int auditType)
{
var transfers = costtransferRepository.GetEntities(t => t.AllotId == allotId && t.Status != 3 && t.AdminStatus != 3);
if (transfers == null || !transfers.Any()) return;
var transferItems = costtransferitemRepository.GetEntities(t => transfers.Select(w => w.Id).Contains(t.TransferId)
&& t.Status == 1 && t.AdminStatus == 1);
if (transferItems == null || !transferItems.Any()) return;
}
#endregion
}
}
......@@ -41,7 +41,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style,
var costTransfers = costtransferRepository.GetEntities(t => t.AllotId == allotId);
if (costTransfers == null || !costTransfers.Any()) return;
var costTransferItems = costtransferitemRepository.GetEntities(t => costTransfers.Select(c => c.Id).Contains(t.TransferId) && t.Status == 1 && t.AdminStatus == 1 && t.IsWrited == 0);
var costTransferItems = costtransferitemRepository.GetEntities(t => costTransfers.Select(c => c.Id).Contains(t.TransferId) && t.Status == 1 && t.AdminStatus == 1);
if (costTransferItems == null || !costTransferItems.Any()) return;
var departments = costTransfers.Select(t => t.AdoptedDepartment ?? "").Union(costTransfers.Select(t => t.ApplicantDepartment ?? "")).Distinct().ToList();
......
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