Commit ab88fdff by lcx

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

parent c9acd34c
......@@ -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,7 +61,7 @@ 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);
......@@ -75,7 +75,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 +83,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);
......
......@@ -69,13 +69,20 @@ public List<CostTransferResponse> GetAuditList(int allotId, int menuType, int ro
Expression<Func<cost_transfer, bool>> exp = t => t.AllotId == allotId;
if (roleType == application.DirectorRole)
exp = exp.And(t => new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString() }.Contains(t.AdoptedUnitType));
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));
else if (roleType == application.NurseRole)
exp = exp.And(t => t.AdoptedUnitType == UnitType.护理组.ToString());
if (menuType == 1)
exp = exp.And(t => t.ApplicantUnitType == UnitType.护理组.ToString());
else
exp = exp.And(t => t.AdoptedUnitType == UnitType.护理组.ToString());
/*
else if (roleType == application.SpecialRole)
exp = exp.And(t => t.AdoptedUnitType == UnitType.特殊核算组.ToString());
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);
......@@ -147,60 +154,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 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;
int imDataAllotId = prevAllotList.FirstOrDefault(t => new int[] { 6, 8, 10 }.Contains(t.States))?.ID ?? 0;
var datas = from im in imData group im by new { im.SheetID, im.TypeName, im.FactorValue } into i select new { i.Key, i };
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
{
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;
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)
......@@ -221,7 +225,6 @@ public CommonResponse Common(int allotId, int hospitalId, int roleType, string d
*/
#endregion
return common;
}
......@@ -456,7 +459,7 @@ public bool RejectedApplicat(int allotId)
if (costTransfers == null || !costTransfers.Any()) return true;
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 =>
{
......@@ -500,7 +503,8 @@ public void IntoLastTiemData(int hospitalId, int allotId)
var newTransfers = new cost_transfer();
newTransfers = Mapper.Map<cost_transfer>(item);
newTransfers.AllotId = allotId;
newTransfers.Status = 0;
newTransfers.AdminStatus = 0;
costtransferRepository.Add(newTransfers);
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)
Remark = t.Remark,
Status = 0,
AdminStatus = 0,
IsWrited =0
IsWrited = 0
}).ToArray();
costtransferitemRepository.AddRange(newCostItem);
}
......@@ -539,6 +543,17 @@ private per_allot PrevAllot(int hospitalId, int allotId)
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>
......@@ -557,11 +572,6 @@ public void UpdateCostTransferStatus(int transferId)
transfer.Status = 3;
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 == 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):
transfer.Status = 2;
......@@ -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):
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;
//科室全部通过,绩效办待审核
case var data when data.Any(t => t.Status == 1) && data.Any(t => t.AdminStatus == 0):
......
......@@ -9,7 +9,7 @@
namespace Performance.Services.ExtractExcelService.SheetDataWrite
{
public class CostTransferDataWrite:IAutoInjection
public class CostTransferDataWrite : IAutoInjection
{
private readonly ILogger logger;
private readonly PerforCosttransferRepository costtransferRepository;
......@@ -38,7 +38,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 columns = SupplySheetHeader(sheet, point);
......@@ -90,7 +90,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style,
var cell = header.CreateCell(index);
cell.SetCellValue(column);
if (!pairs.ContainsKey(column))
if (!pairs.ContainsKey(column))
pairs.Add(column, index);
index++;
......
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