Commit 7198cd26 by lcx

提取数据不写入excel

parent 2d14e9c6
......@@ -187,6 +187,10 @@ public enum SheetType
/// <summary> 考核 </summary>
[Description("考核")]
Assess = 38, //该参数作用类似于 其他工作量
/// <summary> 抽取数据,不写入 </summary>
[Description("抽取数据,不写入")]
OnlyExtract = 102,
}
/// <summary>
......
......@@ -20,6 +20,7 @@ public class DictionaryService : IAutoInjection
private readonly PerforHospitalconfigRepository hospitalconfigRepository;
private readonly PerforExtypeRepository extypeRepository;
private readonly PerforExscriptRepository exscriptRepository;
private readonly PerforExresultRepository exresultRepository;
private readonly PerforHisdataRepository hisdataRepository;
private readonly PerforHisscriptRepository hisscriptRepository;
......@@ -31,6 +32,7 @@ public class DictionaryService : IAutoInjection
PerforHospitalconfigRepository hospitalconfigRepository,
PerforExtypeRepository extypeRepository,
PerforExscriptRepository exscriptRepository,
PerforExresultRepository exresultRepository,
PerforHisdataRepository hisdataRepository,
PerforHisscriptRepository hisscriptRepository
)
......@@ -42,6 +44,7 @@ PerforHisscriptRepository hisscriptRepository
this.hospitalconfigRepository = hospitalconfigRepository;
this.extypeRepository = extypeRepository;
this.exscriptRepository = exscriptRepository;
this.exresultRepository = exresultRepository;
this.hisdataRepository = hisdataRepository;
this.hisscriptRepository = hisscriptRepository;
}
......@@ -53,7 +56,7 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
var configs = hospitalconfigRepository.GetEntities(t => t.HospitalId == hospitalId);
if (configs == null || !configs.Any()) throw new Exception("医院未配置绩效抽取信息");
var types = extypeRepository.GetEntities(t => t.HospitalId == hospitalId && new int[] { 2 }.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())
{
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取人员信息数据", isSingle: isSingle);
......@@ -67,6 +70,19 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
if (script != null)
Employee(allot, configs.FirstOrDefault(t => t.Id == script.ConfigId), script.ExecScript);
}
if (types.Any(t => t.Source == (int)SheetType.OnlyExtract)) //不写入Excel的提取数据
{
foreach (var type in types.Where(t => t.Source == (int)SheetType.OnlyExtract))
{
var thisTypeScripts = scripts.Where(t => t.TypeId == type.Id);
if (thisTypeScripts == null || !thisTypeScripts.Any()) continue;
foreach (var script in thisTypeScripts)
{
ExResult(allot, configs.FirstOrDefault(t => t.Id == script.ConfigId), script.ExecScript, type.EName);
}
}
}
}
}
......@@ -154,6 +170,37 @@ private void Department()
{
}
private void ExResult(per_allot allot, sys_hospitalconfig config, string sql, string enmae)
{
try
{
if (config == null || string.IsNullOrEmpty(sql)) return;
var data = queryService.QueryData(config, allot, sql);
if (data == null || !data.Any()) return;
var createTime = DateTime.Now;
var result = data.Select(t => new ex_result
{
Department = t.Department,
Category = t.Category?.Trim(),
Fee = t.Value,
DoctorName = t.DoctorName,
PersonnelNumber = t.PersonnelNumber,
Source = enmae,
DatabaseType = config.DataBaseType,
ConfigId = config.Id,
AllotId = allot.ID,
CreateTime = createTime,
}).ToList();
exresultRepository.AddRange(result.ToArray());
}
catch (Exception ex)
{
logger.LogError("获取不写入Excel数据时发生异常:" + ex.ToString());
}
}
private string GetSaveValue(params string[] arr)
{
string value = string.Empty;
......
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