提取添加日志

parent 9169e6e3
...@@ -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 });
} }
......
...@@ -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>
{ {
......
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