Commit 53a73c08 by ruyun.zhang@suvalue.com

Merge branch 'release/v22.1.7-Stable'

parents 83c6192e 2177d123
...@@ -233,39 +233,40 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest ...@@ -233,39 +233,40 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
// string email = claim.GetUserClaim(JwtClaimTypes.Mail); // string email = claim.GetUserClaim(JwtClaimTypes.Mail);
string email = ""; string email = "";
if (isSingle) //if (isSingle)
{ //{
logger.LogInformation("同一项目中进行提取"); logger.LogInformation("同一项目中进行提取");
Task.Run(() => Task.Run(() =>
{
Thread.Sleep(1000);
using (var scope = serviceScopeFactory.CreateScope())
{
var scopedServices = scope.ServiceProvider.GetRequiredService<ExtractService>();
logger.LogInformation("提取绩效数据参数:" + JsonHelper.Serialize(new { allotId = allot.ID, hospitalId = allot.HospitalId }));
string extractFilePath = scopedServices.Main(allot.ID, allot.HospitalId, email, allot.ID.ToString(), filePath, isSingle);
}
});
}
else
{ {
var http = new RestSharpHelper(); Thread.Sleep(1000);
var extractUrl = http.SetUrl(url.HttpPost, "extract/extract"); using (var scope = serviceScopeFactory.CreateScope())
var obj = new ExtractRequest
{ {
AllotId = request.AllotId, var scopedServices = scope.ServiceProvider.GetRequiredService<ExtractService>();
HospitalId = request.HospitalId, logger.LogInformation("提取绩效数据参数:" + JsonHelper.Serialize(new { allotId = allot.ID, hospitalId = allot.HospitalId }));
Email = email string extractFilePath = scopedServices.Main(allot.ID, allot.HospitalId, email, allot.ID.ToString(), filePath, isSingle);
}; }
});
string json = JsonHelper.Serialize(obj); //}
logger.LogInformation("提取绩效数据参数:" + json); //else
var parameter = JsonHelper.Deserialize<Dictionary<string, object>>(json); //{
var restRequest = string.IsNullOrEmpty(filePath) ? http.CreatePostRequest(json) : http.CreateFileRequest(new string[] { filePath }, parameter); // logger.LogInformation("多项目进行提取");
Task.Run(() => http.GetResponse(extractUrl, restRequest)); // var http = new RestSharpHelper();
} // var extractUrl = http.SetUrl(url.HttpPost, "extract/extract");
// var obj = new ExtractRequest
// {
// AllotId = request.AllotId,
// HospitalId = request.HospitalId,
// Email = email
// };
// string json = JsonHelper.Serialize(obj);
// logger.LogInformation("提取绩效数据参数:" + json);
// var parameter = JsonHelper.Deserialize<Dictionary<string, object>>(json);
// var restRequest = string.IsNullOrEmpty(filePath) ? http.CreatePostRequest(json) : http.CreateFileRequest(new string[] { filePath }, parameter);
// Task.Run(() => http.GetResponse(extractUrl, restRequest));
//}
return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!", new { IsExtracting = false }); return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!", new { IsExtracting = false });
} }
...@@ -441,7 +442,11 @@ public ApiResponse Schedule([FromBody] log_dbug request) ...@@ -441,7 +442,11 @@ public ApiResponse Schedule([FromBody] log_dbug request)
var allot = allotService.GetAllot(request.AllotID.Value); var allot = allotService.GetAllot(request.AllotID.Value);
if (null == allot) if (null == allot)
throw new PerformanceException("当前绩效记录不存在"); throw new PerformanceException("当前绩效记录不存在");
var ratio = allotService.AllotLog(allot, 3)?.Max(t => ConvertHelper.TryDecimal(t.Message)) ?? 0; var logs = allotService.AllotLog(allot, 3);
var ratio = 0m;
if (logs != null && logs.Any())
ratio = logs.Max(t => ConvertHelper.TryDecimal(t.Message));
return new ApiResponse(ResponseType.OK, new { ratio }); return new ApiResponse(ResponseType.OK, new { ratio });
} }
......
...@@ -306,7 +306,9 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot ...@@ -306,7 +306,9 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot
if (UnitType.医技组 == unitType && workDoctor == null) if (UnitType.医技组 == unitType && workDoctor == null)
workDoctor = info.Data.FirstOrDefault(t => t.UnitType == UnitType.医生组.ToString() && t.AccountingUnit == dept.AccountingUnit); workDoctor = info.Data.FirstOrDefault(t => t.UnitType == UnitType.医生组.ToString() && t.AccountingUnit == dept.AccountingUnit);
// 夜班绩效 从医院奖罚的明细项中获取 // 夜班绩效 从医院奖罚的明细项中获取
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0; // 2022-03-16 wufeifei
string[] nightShiftTexts = new string[] { "夜班绩效", "夜班工作量", "夜班工作量奖励" };
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && nightShiftTexts.Contains(w.TypeName?.Trim()))?.CellValue ?? 0;
dept.NightShiftWorkPerforFee = nightShift; dept.NightShiftWorkPerforFee = nightShift;
//dept.MedicineFactor = workDoctor?.MedicineFactor; //dept.MedicineFactor = workDoctor?.MedicineFactor;
...@@ -388,7 +390,9 @@ public void ComputeOffice(per_allot allot, PerExcel excel) ...@@ -388,7 +390,9 @@ public void ComputeOffice(per_allot allot, PerExcel excel)
if (UnitTypeUtil.IsOffice(resAccount?.UnitType) && dept.NeedSecondAllot == "是") if (UnitTypeUtil.IsOffice(resAccount?.UnitType) && dept.NeedSecondAllot == "是")
{ {
// 夜班绩效 从医院奖罚的明细项中获取 // 夜班绩效 从医院奖罚的明细项中获取
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == resAccount?.UnitType && w.AccountingUnit == dept.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0; // 2022-03-16 wufeifei
string[] nightShiftTexts = new string[] { "夜班绩效", "夜班工作量", "夜班工作量奖励" };
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && nightShiftTexts.Contains(w.TypeName?.Trim()))?.CellValue ?? 0;
dept.NightShiftWorkPerforFee = nightShift; dept.NightShiftWorkPerforFee = nightShift;
dept.ScoringAverage = resAccount?.ScoringAverage == null ? 0 : resAccount.ScoringAverage; dept.ScoringAverage = resAccount?.ScoringAverage == null ? 0 : resAccount.ScoringAverage;
......
...@@ -179,7 +179,9 @@ public void SpecialUnitCompute(PerExcel excel, per_allot allot, List<res_baiscno ...@@ -179,7 +179,9 @@ public void SpecialUnitCompute(PerExcel excel, per_allot allot, List<res_baiscno
//var scoreAverage = accountScoreAverages?.FirstOrDefault(w => w.UnitType == UnitType.特殊核算组.ToString() && w.AccountingUnit == dept?.AccountingUnit)?.TotelValue; //var scoreAverage = accountScoreAverages?.FirstOrDefault(w => w.UnitType == UnitType.特殊核算组.ToString() && w.AccountingUnit == dept?.AccountingUnit)?.TotelValue;
// 夜班绩效 从医院奖罚的明细项中获取 // 夜班绩效 从医院奖罚的明细项中获取
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept?.UnitType && w.AccountingUnit == dept?.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0; // 2022-03-16 wufeifei
string[] nightShiftTexts = new string[] { "夜班绩效", "夜班工作量", "夜班工作量奖励" };
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && nightShiftTexts.Contains(w.TypeName?.Trim()))?.CellValue ?? 0;
decimal? headcount = null; decimal? headcount = null;
if (typeList.Any(o => o.Description == item.QuantitativeIndicators)) if (typeList.Any(o => o.Description == item.QuantitativeIndicators))
......
...@@ -57,7 +57,11 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi ...@@ -57,7 +57,11 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
try try
{ {
var configs = hospitalconfigRepository.GetEntities(t => t.HospitalId == hospitalId); var configs = hospitalconfigRepository.GetEntities(t => t.HospitalId == hospitalId);
if (configs == null || !configs.Any()) throw new Exception("医院未配置绩效抽取信息"); if (configs == null || !configs.Any())
{
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", "医院未配置绩效抽取信息", isSingle: isSingle);
throw new Exception("医院未配置绩效抽取信息");
}
var types = extypeRepository.GetEntities(t => t.HospitalId == hospitalId && new int[] { (int)SheetType.Employee, (int)SheetType.OnlyExtract }.Contains(t.Source)); var types = extypeRepository.GetEntities(t => t.HospitalId == hospitalId && new int[] { (int)SheetType.Employee, (int)SheetType.OnlyExtract }.Contains(t.Source));
if (types != null && types.Any()) if (types != null && types.Any())
......
...@@ -72,7 +72,10 @@ public List<ex_result> Handler(int hospitalId, per_allot allot, string groupName ...@@ -72,7 +72,10 @@ public List<ex_result> Handler(int hospitalId, per_allot allot, string groupName
try try
{ {
var configs = hosconfigRepository.GetEntities(t => t.HospitalId == hospitalId); var configs = hosconfigRepository.GetEntities(t => t.HospitalId == hospitalId);
if (configs == null || !configs.Any()) throw new Exception("医院未配置绩效抽取信息"); if (configs == null || !configs.Any())
{
throw new Exception("医院未配置绩效抽取信息");
}
dict = new Dictionary<ExDataDict, object> dict = new Dictionary<ExDataDict, object>
{ {
...@@ -413,7 +416,7 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe ...@@ -413,7 +416,7 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe
if (connection == null) return Enumerable.Empty<T>(); if (connection == null) return Enumerable.Empty<T>();
if (connection.State == ConnectionState.Closed) if (connection.State != ConnectionState.Open)
connection.Open(); connection.Open();
} }
catch catch
...@@ -421,11 +424,18 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe ...@@ -421,11 +424,18 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe
logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "数据库连接", $"数据库“{config.DbName}”连接失败", 3, isSingle); logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "数据库连接", $"数据库“{config.DbName}”连接失败", 3, isSingle);
} }
logger.LogInformation($"提取绩效数据SQL脚本{execsql}"); try
var result = connection.Query<T>(execsql, commandTimeout: 20000); {
logger.LogInformation($"提取绩效数据执行脚本获取数据{result?.Count() ?? 0}条记录"); logger.LogInformation($"提取绩效数据SQL脚本{execsql}");
var result = connection.Query<T>(execsql, commandTimeout: 20000);
return result; logger.LogInformation($"提取绩效数据执行脚本获取数据{result?.Count() ?? 0}条记录");
return result;
}
catch (Exception ex)
{
logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "SQL执行失败", ex.Message, 3, isSingle);
throw;
}
} }
/// <summary> /// <summary>
......
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