Commit 4f22abef by lcx

原始数据修改,4.1核算数据增加修改数据源,新增绩效新增数据异常

parent 1c3bd83d
using AutoMapper; using AutoMapper;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.EntityModels; using Performance.EntityModels;
...@@ -26,6 +27,7 @@ public class ConfigService : IAutoInjection ...@@ -26,6 +27,7 @@ public class ConfigService : IAutoInjection
private PerforCofdepttypeRepository perforCofdepttypeRepository; private PerforCofdepttypeRepository perforCofdepttypeRepository;
private PerforPerapramountRepository perapramountRepository; private PerforPerapramountRepository perapramountRepository;
private readonly LogManageService logManageService; private readonly LogManageService logManageService;
private ILogger<ConfigService> logger;
public ConfigService(PerforCofdirectorRepository cofdirectorRepository, public ConfigService(PerforCofdirectorRepository cofdirectorRepository,
PerforCofdrugpropRepository cofdrugpropRepository, PerforCofdrugpropRepository cofdrugpropRepository,
...@@ -38,7 +40,8 @@ public class ConfigService : IAutoInjection ...@@ -38,7 +40,8 @@ public class ConfigService : IAutoInjection
PerforImheaderRepository perforImheaderRepository, PerforImheaderRepository perforImheaderRepository,
PerforCofdepttypeRepository perforCofdepttypeRepository, PerforCofdepttypeRepository perforCofdepttypeRepository,
PerforPerapramountRepository perapramountRepository, PerforPerapramountRepository perapramountRepository,
LogManageService logManageService) LogManageService logManageService,
ILogger<ConfigService> logger)
{ {
this._directorRepository = cofdirectorRepository; this._directorRepository = cofdirectorRepository;
this._drugpropRepository = cofdrugpropRepository; this._drugpropRepository = cofdrugpropRepository;
...@@ -52,6 +55,7 @@ public class ConfigService : IAutoInjection ...@@ -52,6 +55,7 @@ public class ConfigService : IAutoInjection
this.perforCofdepttypeRepository = perforCofdepttypeRepository; this.perforCofdepttypeRepository = perforCofdepttypeRepository;
this.perapramountRepository = perapramountRepository; this.perapramountRepository = perapramountRepository;
this.logManageService = logManageService; this.logManageService = logManageService;
this.logger = logger;
} }
#endregion #endregion
...@@ -555,6 +559,7 @@ public void Copy(per_allot allot) ...@@ -555,6 +559,7 @@ public void Copy(per_allot allot)
} }
var hospital = perforHospitalRepository.GetEntity(t => t.ID == allot.HospitalId); var hospital = perforHospitalRepository.GetEntity(t => t.ID == allot.HospitalId);
logger.LogInformation($"apramount{allotId} {allot.ID}");
CopyAprData(allotId, allot.ID); CopyAprData(allotId, allot.ID);
#region 弃用 #region 弃用
...@@ -591,6 +596,8 @@ public void Copy(per_allot allot) ...@@ -591,6 +596,8 @@ public void Copy(per_allot allot)
#endregion #endregion
logger.LogInformation($"orgDurgprop");
var orgDurgprop = _drugpropRepository.GetEntities(t => t.AllotID == allot.ID); var orgDurgprop = _drugpropRepository.GetEntities(t => t.AllotID == allot.ID);
if (orgDurgprop == null || orgDurgprop.Count == 0) if (orgDurgprop == null || orgDurgprop.Count == 0)
{ {
...@@ -601,6 +608,7 @@ public void Copy(per_allot allot) ...@@ -601,6 +608,7 @@ public void Copy(per_allot allot)
_drugpropRepository.AddRange(newDurgprops.ToArray()); _drugpropRepository.AddRange(newDurgprops.ToArray());
} }
logger.LogInformation($"workItem");
var workItem = _workitemRepository.GetEntities(t => t.AllotID == allot.ID); var workItem = _workitemRepository.GetEntities(t => t.AllotID == allot.ID);
if (hospital != null && hospital?.IsOpenDrugprop == 1 && (workItem == null || workItem.Count == 0)) if (hospital != null && hospital?.IsOpenDrugprop == 1 && (workItem == null || workItem.Count == 0))
{ {
...@@ -612,6 +620,7 @@ public void Copy(per_allot allot) ...@@ -612,6 +620,7 @@ public void Copy(per_allot allot)
} }
} }
logger.LogInformation($"cofDrugtype");
var cofDrugtype = _drugtypeRepository.GetEntities(t => t.AllotID == allot.ID); var cofDrugtype = _drugtypeRepository.GetEntities(t => t.AllotID == allot.ID);
if (cofDrugtype == null || cofDrugtype.Count == 0) if (cofDrugtype == null || cofDrugtype.Count == 0)
{ {
...@@ -620,6 +629,7 @@ public void Copy(per_allot allot) ...@@ -620,6 +629,7 @@ public void Copy(per_allot allot)
_drugtypeRepository.AddRange(newAgains.ToArray()); _drugtypeRepository.AddRange(newAgains.ToArray());
} }
logger.LogInformation($"cofDepttype");
var cofDepttype = perforCofdepttypeRepository.GetEntities(t => t.AllotID == allot.ID); var cofDepttype = perforCofdepttypeRepository.GetEntities(t => t.AllotID == allot.ID);
if (cofDepttype == null || cofDepttype.Count == 0) if (cofDepttype == null || cofDepttype.Count == 0)
{ {
...@@ -630,6 +640,7 @@ public void Copy(per_allot allot) ...@@ -630,6 +640,7 @@ public void Copy(per_allot allot)
perforCofdepttypeRepository.AddRange(newAgains.ToArray()); perforCofdepttypeRepository.AddRange(newAgains.ToArray());
} }
logger.LogInformation($"again");
var data = _againRepository.GetEntities(t => t.AllotID == allot.ID); var data = _againRepository.GetEntities(t => t.AllotID == allot.ID);
if (data == null || data.Count == 0) if (data == null || data.Count == 0)
{ {
...@@ -705,12 +716,21 @@ private void CopyAprData(int prevAllotId, int allotId) ...@@ -705,12 +716,21 @@ private void CopyAprData(int prevAllotId, int allotId)
{ {
var prevData = list.Where(t => t.AllotId == prevAllotId); var prevData = list.Where(t => t.AllotId == prevAllotId);
var existData = list.Where(t => t.AllotId == allotId); var existData = list.Where(t => t.AllotId == allotId);
list = prevData.Where(t => !existData.Select(w => w.PersonnelNumber).Contains(t.PersonnelNumber)).ToList(); if (existData != null && existData.Any())
list = prevData.Where(t => !existData.Select(w => w.PersonnelNumber).Contains(t.PersonnelNumber)).ToList();
} }
if (list.Any()) if (list.Any())
{ {
list.ForEach(t => t.AllotId = allotId); var data = list.Select(t => new per_apr_amount
perapramountRepository.AddRange(list.ToArray()); {
AllotId = allotId,
PersonnelNumber = t.PersonnelNumber,
DoctorName = t.DoctorName,
PerforType = t.PerforType,
Amount = t.Amount,
CreateDate = DateTime.Now
});
perapramountRepository.AddRange(data.ToArray());
} }
} }
} }
......
...@@ -23,6 +23,7 @@ public class OriginalService : IAutoInjection ...@@ -23,6 +23,7 @@ public class OriginalService : IAutoInjection
private readonly PerforImemployeeclinicRepository imemployeeclinicRepository; private readonly PerforImemployeeclinicRepository imemployeeclinicRepository;
private readonly PerforImdataRepository imdataRepository; private readonly PerforImdataRepository imdataRepository;
private readonly PerforImspecialunitRepository imspecialunitRepository; private readonly PerforImspecialunitRepository imspecialunitRepository;
private readonly PerforImaccountbasicRepository imaccountbasicRepository;
public OriginalService(PerforPersheetRepository persheetRepository, public OriginalService(PerforPersheetRepository persheetRepository,
PerforPerallotRepository perallotRepository, PerforPerallotRepository perallotRepository,
...@@ -30,7 +31,8 @@ public class OriginalService : IAutoInjection ...@@ -30,7 +31,8 @@ public class OriginalService : IAutoInjection
PerforImemployeeRepository imemployeeRepository, PerforImemployeeRepository imemployeeRepository,
PerforImemployeeclinicRepository imemployeeclinicRepository, PerforImemployeeclinicRepository imemployeeclinicRepository,
PerforImdataRepository imdataRepository, PerforImdataRepository imdataRepository,
PerforImspecialunitRepository imspecialunitRepository) PerforImspecialunitRepository imspecialunitRepository,
PerforImaccountbasicRepository imaccountbasicRepository)
{ {
this.persheetRepository = persheetRepository; this.persheetRepository = persheetRepository;
this.perallotRepository = perallotRepository; this.perallotRepository = perallotRepository;
...@@ -39,6 +41,7 @@ public class OriginalService : IAutoInjection ...@@ -39,6 +41,7 @@ public class OriginalService : IAutoInjection
this.imemployeeclinicRepository = imemployeeclinicRepository; this.imemployeeclinicRepository = imemployeeclinicRepository;
this.imdataRepository = imdataRepository; this.imdataRepository = imdataRepository;
this.imspecialunitRepository = imspecialunitRepository; this.imspecialunitRepository = imspecialunitRepository;
this.imaccountbasicRepository = imaccountbasicRepository;
} }
public bool EditFactorData(int userId, OriginalRequest request) public bool EditFactorData(int userId, OriginalRequest request)
...@@ -105,7 +108,7 @@ public bool EditSheetData(int userId, OriginalRequest request) ...@@ -105,7 +108,7 @@ public bool EditSheetData(int userId, OriginalRequest request)
case (int)SheetType.Expend: case (int)SheetType.Expend:
case (int)SheetType.Workload: case (int)SheetType.Workload:
case (int)SheetType.AccountBasic: case (int)SheetType.AccountBasic:
result = EditFeeData(userId, request); result = EditFeeData(userId, request, sheet.SheetType == (int)SheetType.AccountBasic);
break; break;
} }
} }
...@@ -168,6 +171,55 @@ private bool EditSpecialUnit(int userId, OriginalRequest request) ...@@ -168,6 +171,55 @@ private bool EditSpecialUnit(int userId, OriginalRequest request)
return imspecialunitRepository.Update(specialUnit); return imspecialunitRepository.Update(specialUnit);
} }
private bool EditAccountBasic(int userId, OriginalRequest request)
{
Dictionary<string, string> accdict = new Dictionary<string, string>
{
{ "核算单元类型", nameof(im_accountbasic.UnitType) },
{ "核算单元", nameof(im_accountbasic.DoctorAccountingUnit) },
{ "科室名称", nameof(im_accountbasic.Department) },
{ "效率绩效人数", nameof(im_accountbasic.PermanentStaff) },
{ "科主任/护士长人数", nameof(im_accountbasic.DoctorDirectorNumber) },
{ "核算单元人员数量", nameof(im_accountbasic.DoctorNumber) },
{ "预算比例", nameof(im_accountbasic.DoctorBasicFactor) },
{ "倾斜系数", nameof(im_accountbasic.DoctorSlopeFactor) },
{ "工作量倾斜系数", nameof(im_accountbasic.WorkSlopeFactor) },
{ "保底绩效参考标准", nameof(im_accountbasic.MinimumReference) },
{ "保底绩效系数", nameof(im_accountbasic.MinimumFactor) },
{ "其他绩效1", nameof(im_accountbasic.DoctorOtherPerfor1) },
{ "其他绩效2", nameof(im_accountbasic.DoctorOtherPerfor2) },
{ "药占比奖罚", nameof(im_accountbasic.MedicineExtra) },
{ "材料占比奖罚", nameof(im_accountbasic.MaterialsExtra) },
{ "考核得分率", nameof(im_accountbasic.DoctorScoringAverage) },
{ "调节系数", nameof(im_accountbasic.DoctorAdjustFactor) },
};
var imdata = imdataRepository.GetEntity(t => t.SheetID == request.SheetId && t.RowNumber == request.RowNumber);
if (imdata == null || request.Cell == null || !accdict.ContainsKey(request.Cell.FieldName))
return false;
var basic = imaccountbasicRepository.GetEntity(t => t.SheetID == request.SheetId && t.Department == imdata.Department
&& t.DoctorAccountingUnit == imdata.AccountingUnit && t.UnitType == imdata.UnitType);
if (basic == null) return false;
if (request.Cell.FieldName == "核算单元类型")
{
var cellvalue = EnumHelper.GetItems<UnitType>().FirstOrDefault(t => t.Name == request.Cell.CellValue.ToString());
if (cellvalue == null) return false;
if (cellvalue.Value == basic.UnitType) return true;
request.Cell.CellValue = cellvalue.Value;
}
string fieldname = request.Cell.FieldName;
request.Cell.FieldName = accdict[request.Cell.FieldName];
SetValue(basic, request.Cell);
basic.UpdateDate = DateTime.Now;
basic.UpdateUser = userId;
request.Cell.FieldName = fieldname;
return imaccountbasicRepository.Update(basic);
}
private void SetValue<TEntity>(TEntity entity, CellRequest cell) private void SetValue<TEntity>(TEntity entity, CellRequest cell)
{ {
var value = cell.CellValue; var value = cell.CellValue;
...@@ -202,8 +254,6 @@ private void SetValue<TEntity>(TEntity entity, CellRequest cell) ...@@ -202,8 +254,6 @@ private void SetValue<TEntity>(TEntity entity, CellRequest cell)
value = Convert.ToDecimal(value); value = Convert.ToDecimal(value);
else if (type.IndexOf("datetime") > -1) else if (type.IndexOf("datetime") > -1)
value = Convert.ToDateTime(value); value = Convert.ToDateTime(value);
else if (type.IndexOf("datetime") > -1)
value = Convert.ToDateTime(value);
else if (type.IndexOf("string") > -1) else if (type.IndexOf("string") > -1)
value = cell.CellValue.ToString(); value = cell.CellValue.ToString();
} }
...@@ -222,7 +272,7 @@ private void SetValue<TEntity>(TEntity entity, CellRequest cell) ...@@ -222,7 +272,7 @@ private void SetValue<TEntity>(TEntity entity, CellRequest cell)
#region imdata #region imdata
private bool EditFeeData(int userId, OriginalRequest request) private bool EditFeeData(int userId, OriginalRequest request, bool basic)
{ {
var result = false; var result = false;
var header = imheaderRepository.GetEntity(t => t.SheetID == request.SheetId && t.PointCell == request.Cell.PointCell); var header = imheaderRepository.GetEntity(t => t.SheetID == request.SheetId && t.PointCell == request.Cell.PointCell);
...@@ -233,7 +283,12 @@ private bool EditFeeData(int userId, OriginalRequest request) ...@@ -233,7 +283,12 @@ private bool EditFeeData(int userId, OriginalRequest request)
else else
request.Cell.FieldName = header.CellValue; request.Cell.FieldName = header.CellValue;
} }
var publicTypes = new string[] { "核算单元(医技组)", "核算单元(医生组)", "核算单元(护理组)", "科室名称" };
if (basic)
result = EditAccountBasic(userId, request); //用于计算不显示
// 用于显示不计算
var publicTypes = new string[] { "核算单元(医技组)", "核算单元(医生组)", "核算单元(护理组)", "科室名称", "核算单元类型", "核算单元" };
if (publicTypes.Contains(request.Cell.FieldName)) if (publicTypes.Contains(request.Cell.FieldName))
result = ImDataPublic(request); result = ImDataPublic(request);
else else
...@@ -242,8 +297,11 @@ private bool EditFeeData(int userId, OriginalRequest request) ...@@ -242,8 +297,11 @@ private bool EditFeeData(int userId, OriginalRequest request)
{ {
try try
{ {
var value = request.Cell.CellValue;
if (value.ToString().IndexOf("%") > -1)
value = ConvertHelper.To<decimal>(value.ToString().Replace("%", "")) / 100;
var entity = imdataRepository.GetEntity(w => w.ID == request.Cell.Id); var entity = imdataRepository.GetEntity(w => w.ID == request.Cell.Id);
entity.CellValue = Convert.ToDecimal(request.Cell.CellValue); entity.CellValue = Convert.ToDecimal(value);
entity.UpdateDate = DateTime.Now; entity.UpdateDate = DateTime.Now;
entity.UpdateUser = userId; entity.UpdateUser = userId;
result = imdataRepository.Update(entity); result = imdataRepository.Update(entity);
...@@ -256,6 +314,7 @@ private bool EditFeeData(int userId, OriginalRequest request) ...@@ -256,6 +314,7 @@ private bool EditFeeData(int userId, OriginalRequest request)
else else
result = ImDataInsert(userId, request, header); result = ImDataInsert(userId, request, header);
} }
return result; return result;
} }
...@@ -265,7 +324,18 @@ private bool ImDataPublic(OriginalRequest request) ...@@ -265,7 +324,18 @@ private bool ImDataPublic(OriginalRequest request)
if (request.Cell == null || allData == null || !allData.Any()) if (request.Cell == null || allData == null || !allData.Any())
throw new PerformanceException("提交数据无效"); throw new PerformanceException("提交数据无效");
if (request.Cell.FieldName == "科室名称") if (request.Cell.FieldName == "核算单元类型")
{
var unittype = allData.FirstOrDefault().UnitType;
if (unittype != (int)request.Cell.CellValue)
{
allData.ForEach(t =>
{
t.UnitType = (int)request.Cell.CellValue;
});
}
}
else if (request.Cell.FieldName == "科室名称")
{ {
var department = allData.FirstOrDefault().Department; var department = allData.FirstOrDefault().Department;
if (request.Cell.CellValue.ToString() != department) if (request.Cell.CellValue.ToString() != department)
...@@ -276,6 +346,17 @@ private bool ImDataPublic(OriginalRequest request) ...@@ -276,6 +346,17 @@ private bool ImDataPublic(OriginalRequest request)
}); });
} }
} }
else if (request.Cell.FieldName == "核算单元")
{
var accounting = allData.FirstOrDefault().AccountingUnit;
if (request.Cell.CellValue.ToString() != accounting)
{
allData.ForEach(t =>
{
t.AccountingUnit = request.Cell.CellValue.ToString();
});
}
}
else else
{ {
Dictionary<string, int> publicTypes = new Dictionary<string, int> Dictionary<string, int> publicTypes = new Dictionary<string, int>
......
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