Commit ab88fdff by lcx

申请页面下拉选项修改,划拨数据写入修改

parent c9acd34c
...@@ -50,7 +50,7 @@ public ApiResponse SubmitApplications([FromBody] CostTransferRequest request) ...@@ -50,7 +50,7 @@ public ApiResponse SubmitApplications([FromBody] CostTransferRequest request)
/// <returns></returns> /// <returns></returns>
[Route("common/{hospitalId}/allot/{allotId}")] [Route("common/{hospitalId}/allot/{allotId}")]
[HttpPost] [HttpPost]
public ApiResponse Common(int hospitalId, int allotId) public ApiResponse Common(int hospitalId, int allotId, [FromBody] DepartmentDetail detail)
{ {
if (hospitalId <= 0) if (hospitalId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数HospitalId无效!"); return new ApiResponse(ResponseType.ParameterError, "参数HospitalId无效!");
...@@ -61,7 +61,7 @@ public ApiResponse Common(int hospitalId, int allotId) ...@@ -61,7 +61,7 @@ public ApiResponse Common(int hospitalId, int allotId)
var user = userService.GetUser(userid); var user = userService.GetUser(userid);
var role = roleService.GetARole(user.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 ?? ""; result.deparment = user.Department ?? "";
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
...@@ -75,7 +75,7 @@ public ApiResponse Common(int hospitalId, int allotId) ...@@ -75,7 +75,7 @@ public ApiResponse Common(int hospitalId, int allotId)
/// <returns></returns> /// <returns></returns>
[Route("auditlist/{allotId}/menuType/{menuType}")] [Route("auditlist/{allotId}/menuType/{menuType}")]
[HttpPost] [HttpPost]
public ApiResponse AuditList(int allotId,int menuType) public ApiResponse AuditList(int allotId, int menuType)
{ {
if (allotId <= 0) if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!"); return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
...@@ -83,7 +83,7 @@ public ApiResponse AuditList(int allotId,int menuType) ...@@ -83,7 +83,7 @@ public ApiResponse AuditList(int allotId,int menuType)
var userid = claim.GetUserId(); var userid = claim.GetUserId();
var user = userService.GetUser(userid); var user = userService.GetUser(userid);
var role = roleService.GetARole(user.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); return new ApiResponse(ResponseType.OK, result);
......
...@@ -69,13 +69,20 @@ public List<CostTransferResponse> GetAuditList(int allotId, int menuType, int ro ...@@ -69,13 +69,20 @@ public List<CostTransferResponse> GetAuditList(int allotId, int menuType, int ro
Expression<Func<cost_transfer, bool>> exp = t => t.AllotId == allotId; Expression<Func<cost_transfer, bool>> exp = t => t.AllotId == allotId;
if (roleType == application.DirectorRole) if (roleType == application.DirectorRole)
if (menuType == 1)
exp = exp.And(t => new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString() }.Contains(t.ApplicantUnitType));
else
exp = exp.And(t => new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString() }.Contains(t.AdoptedUnitType)); exp = exp.And(t => new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString() }.Contains(t.AdoptedUnitType));
else if (roleType == application.NurseRole) else if (roleType == application.NurseRole)
if (menuType == 1)
exp = exp.And(t => t.ApplicantUnitType == UnitType.护理组.ToString());
else
exp = exp.And(t => t.AdoptedUnitType == UnitType.护理组.ToString()); exp = exp.And(t => t.AdoptedUnitType == UnitType.护理组.ToString());
/*
else if (roleType == application.SpecialRole) else if (roleType == application.SpecialRole)
exp = exp.And(t => t.AdoptedUnitType == UnitType.特殊核算组.ToString()); exp = exp.And(t => t.AdoptedUnitType == UnitType.特殊核算组.ToString());
else if (roleType == application.OfficeRole) else if (roleType == application.OfficeRole)
exp = exp.And(t => t.AdoptedUnitType == UnitType.行政后勤.ToString()); exp = exp.And(t => t.AdoptedUnitType == UnitType.行政后勤.ToString()); */
var costTransfers = costtransferRepository.GetEntities(exp); var costTransfers = costtransferRepository.GetEntities(exp);
...@@ -147,60 +154,57 @@ public cof_accounting GetAccounting(int allotId, int roleType, string Department ...@@ -147,60 +154,57 @@ public cof_accounting GetAccounting(int allotId, int roleType, string Department
/// </summary> /// </summary>
/// <param name="allotId"></param> /// <param name="allotId"></param>
/// <param name="hospitalId"></param> /// <param name="hospitalId"></param>
/// <param name="roleType"></param>
/// <param name="deparment"></param>
/// <param name="detail"></param>
/// <returns></returns> /// <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(); var common = new CommonResponse();
common.account = cofaccountingRepository.GetEntities(t => t.AllotId == allotId) common.account = cofaccountingRepository.GetEntities(t => t.AllotId == allotId)
?.Select(t => new TitleValue { Title = t.AccountingUnit, Value = t.AccountingUnit }).ToDistinct().ToList(); ?.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); var prevAllotList = PrevAllotList(hospitalId, allotId);
common.unitType = GetAccounting(allotId, roleType, deparment)?.UnitType; if (prevAllotList != null && prevAllotList.Any())
if (common.unitType == null)
{ {
var prevAllot = PrevAllot(hospitalId, allotId); foreach (var prevAllot in prevAllotList)
if (prevAllot == null) return common;
common.unitType = GetAccounting(prevAllot.ID, roleType, deparment)?.UnitType;
to:
if (common.unitType == null)
{ {
var prevAllotId = prevAllot.ID--; string unittype = GetAccounting(prevAllot.ID, roleType, deparment)?.UnitType;
if (prevAllotId <= 0) return common; if (!string.IsNullOrEmpty(unittype))
common.unitType = GetAccounting(prevAllot.ID, roleType, deparment)?.UnitType; {
goto to; 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 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 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 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 imData = imdataRepository.GetEntities(t => t.AllotID == imDataAllotId && sheetId.Contains(t.SheetID.Value));
if (imData == null || !imData.Any()) return common;
var commons = datas.Select(t => new Common 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.", ""), Source = Regex.Replace(sheets.Find(w => w.ID == t.Key.SheetID).SheetName, @"\d.", ""),
Category = t.Key.TypeName, Category = t.Key.TypeName,
Ratio = t.Key.FactorValue.Value Ratio = t.Key.FactorValue.Value
}).ToList(); }).ToList();
}
common.Data = commons; common.Data = commons;
}
#region #region
/* /*
var drugType = cofdrugtypeRepository.GetEntities(t => t.HospitalId == hospitalId && t.AllotID == allotId) var drugType = cofdrugtypeRepository.GetEntities(t => t.HospitalId == hospitalId && t.AllotID == allotId)
...@@ -221,7 +225,6 @@ public CommonResponse Common(int allotId, int hospitalId, int roleType, string d ...@@ -221,7 +225,6 @@ public CommonResponse Common(int allotId, int hospitalId, int roleType, string d
*/ */
#endregion #endregion
return common; return common;
} }
...@@ -456,7 +459,7 @@ public bool RejectedApplicat(int allotId) ...@@ -456,7 +459,7 @@ public bool RejectedApplicat(int allotId)
if (costTransfers == null || !costTransfers.Any()) return true; if (costTransfers == null || !costTransfers.Any()) return true;
var costId = costTransfers?.Select(t => t.Id); var costId = costTransfers?.Select(t => t.Id);
var costItems = costtransferitemRepository.GetEntities(t => costId.Contains(t.TransferId) && t.AdminStatus==0 ); var costItems = costtransferitemRepository.GetEntities(t => costId.Contains(t.TransferId) && t.AdminStatus == 0);
costItems.ForEach(t => costItems.ForEach(t =>
{ {
...@@ -500,7 +503,8 @@ public void IntoLastTiemData(int hospitalId, int allotId) ...@@ -500,7 +503,8 @@ public void IntoLastTiemData(int hospitalId, int allotId)
var newTransfers = new cost_transfer(); var newTransfers = new cost_transfer();
newTransfers = Mapper.Map<cost_transfer>(item); newTransfers = Mapper.Map<cost_transfer>(item);
newTransfers.AllotId = allotId; newTransfers.AllotId = allotId;
newTransfers.Status = 0;
newTransfers.AdminStatus = 0;
costtransferRepository.Add(newTransfers); costtransferRepository.Add(newTransfers);
var newCostItem = costItems.Where(t => t.TransferId == item.Id).Select(t => new cost_transfer_item var newCostItem = costItems.Where(t => t.TransferId == item.Id).Select(t => new cost_transfer_item
...@@ -515,7 +519,7 @@ public void IntoLastTiemData(int hospitalId, int allotId) ...@@ -515,7 +519,7 @@ public void IntoLastTiemData(int hospitalId, int allotId)
Remark = t.Remark, Remark = t.Remark,
Status = 0, Status = 0,
AdminStatus = 0, AdminStatus = 0,
IsWrited =0 IsWrited = 0
}).ToArray(); }).ToArray();
costtransferitemRepository.AddRange(newCostItem); costtransferitemRepository.AddRange(newCostItem);
} }
...@@ -539,6 +543,17 @@ private per_allot PrevAllot(int hospitalId, int allotId) ...@@ -539,6 +543,17 @@ private per_allot PrevAllot(int hospitalId, int allotId)
return prevAllot; return prevAllot;
} }
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()) return new List<per_allot>();
var allot = allotList.FirstOrDefault(w => w.ID == allotId);
if (allot == null) return new List<per_allot>();
return allotList.Where(t => t.Year <= allot.Year && t.Month <= allot.Month)?.ToList();
}
/// <summary> /// <summary>
/// 修改申请记录的状态 /// 修改申请记录的状态
/// </summary> /// </summary>
...@@ -557,11 +572,6 @@ public void UpdateCostTransferStatus(int transferId) ...@@ -557,11 +572,6 @@ public void UpdateCostTransferStatus(int transferId)
transfer.Status = 3; transfer.Status = 3;
transfer.AdminStatus = 0; transfer.AdminStatus = 0;
break; break;
//科室部分通过,绩效办待审核
case var data when data.Any(t => t.Status == 1) && data.Any(t => t.Status != 1) && data.Any(t => t.AdminStatus == 0):
transfer.Status = 2;
transfer.AdminStatus = 0;
break;
//科室部分通过,绩效办部分通过 //科室部分通过,绩效办部分通过
case var data when data.Any(t => t.Status == 1) && data.Any(t => t.Status != 1) && data.Any(t => t.AdminStatus == 1) && data.Any(t => t.AdminStatus != 1): case var data when data.Any(t => t.Status == 1) && data.Any(t => t.Status != 1) && data.Any(t => t.AdminStatus == 1) && data.Any(t => t.AdminStatus != 1):
transfer.Status = 2; transfer.Status = 2;
...@@ -570,7 +580,12 @@ public void UpdateCostTransferStatus(int transferId) ...@@ -570,7 +580,12 @@ public void UpdateCostTransferStatus(int transferId)
//科室部分通过,绩效办全部驳回 //科室部分通过,绩效办全部驳回
case var data when data.Any(t => t.Status == 1) && data.Any(t => t.Status != 1) && data.Any(t => t.AdminStatus == 2): case var data when data.Any(t => t.Status == 1) && data.Any(t => t.Status != 1) && data.Any(t => t.AdminStatus == 2):
transfer.Status = 2; transfer.Status = 2;
transfer.AdminStatus = 2; transfer.AdminStatus = 3;
break;
//科室部分通过,绩效办待审核
case var data when data.Any(t => t.Status == 1) && data.Any(t => t.Status != 1) && data.Any(t => t.AdminStatus == 0):
transfer.Status = 2;
transfer.AdminStatus = 0;
break; break;
//科室全部通过,绩效办待审核 //科室全部通过,绩效办待审核
case var data when data.Any(t => t.Status == 1) && data.Any(t => t.AdminStatus == 0): case var data when data.Any(t => t.Status == 1) && data.Any(t => t.AdminStatus == 0):
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
namespace Performance.Services.ExtractExcelService.SheetDataWrite namespace Performance.Services.ExtractExcelService.SheetDataWrite
{ {
public class CostTransferDataWrite:IAutoInjection public class CostTransferDataWrite : IAutoInjection
{ {
private readonly ILogger logger; private readonly ILogger logger;
private readonly PerforCosttransferRepository costtransferRepository; private readonly PerforCosttransferRepository costtransferRepository;
...@@ -38,7 +38,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style, ...@@ -38,7 +38,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style,
var costTransfers = costtransferRepository.GetEntities(t => t.AllotId == allotId); var costTransfers = costtransferRepository.GetEntities(t => t.AllotId == allotId);
if (costTransfers == null || !costTransfers.Any()) return; 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; if (costTransferItems == null || !costTransferItems.Any()) return;
var columns = SupplySheetHeader(sheet, point); var columns = SupplySheetHeader(sheet, point);
......
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