Commit e8c37b1d by 纪旭 韦

Merge branch 'develop' of http://192.168.18.110:8880/zry/performance into develop

parents 35c40108 757d567d
...@@ -95,6 +95,13 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi ...@@ -95,6 +95,13 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
var hisScrips = hisscriptRepository.GetEntities(t => t.HospitalId == hospitalId); var hisScrips = hisscriptRepository.GetEntities(t => t.HospitalId == hospitalId);
if (hisScrips == null || !hisScrips.Any()) return; if (hisScrips == null || !hisScrips.Any()) return;
var hisdata = hisdataRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.Year == allot.Year && t.Month == allot.Month);
if (hisdata != null && hisdata.Any())
{
hisdataRepository.RemoveRange(hisdata.ToArray());
}
foreach (var item in hisScrips) foreach (var item in hisScrips)
{ {
HisData(allot, configs.FirstOrDefault(t => t.Id == item.ConfigId), item, groupName, isSingle); HisData(allot, configs.FirstOrDefault(t => t.Id == item.ConfigId), item, groupName, isSingle);
...@@ -241,13 +248,6 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri ...@@ -241,13 +248,6 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri
var data = queryService.QueryData<HisData>(config, script.ExecScript, allot, isSingle); var data = queryService.QueryData<HisData>(config, script.ExecScript, allot, isSingle);
if (data == null || !data.Any()) return; if (data == null || !data.Any()) return;
var hisdata = hisdataRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.Year == allot.Year && t.Month == allot.Month
&& t.SourceType == script.SourceType && t.Category == script.Category);
if (hisdata != null && hisdata.Any())
{
hisdataRepository.RemoveRange(hisdata.ToArray());
}
var insertData = data.Select(t => new his_data var insertData = data.Select(t => new his_data
{ {
HospitalId = allot.HospitalId, HospitalId = allot.HospitalId,
......
...@@ -355,12 +355,33 @@ private StatisticsQueryResultDto StatisticsTreeQuery(StatisticsQuery query, List ...@@ -355,12 +355,33 @@ private StatisticsQueryResultDto StatisticsTreeQuery(StatisticsQuery query, List
{ {
// 通过层级查询固定SQL // 通过层级查询固定SQL
var (sql, param) = GetSqlQuery(item.TotalScript, pairs); var (sql, param) = GetSqlQuery(item.TotalScript, pairs);
var data = connection.QueryFirstOrDefault<decimal?>(sql, param); var data = connection.Query(sql, param);
if (data == null || !data.Any()) continue;
var val = "";
if (data.Count() < 2)
{
val = data.FirstOrDefault().数值?.ToString() ?? "";
}
else
{
val = data.Sum(t => (decimal?)t.数值 ?? 0).ToString() ?? "";
DateTime dateStart = new DateTime(1970, 1, 1, 8, 0, 0);
var children = data.Select(t => new Dictionary<string, object>
{
{ "ID", Convert.ToInt32((DateTime.Now - dateStart).TotalSeconds) },
{ "ParentID", item.ID },
{ "项目", t.项目 },
{ "数值", t.数值 },
});
table.AddRange(children);
}
if (row.ContainsKey("数值")) if (row.ContainsKey("数值"))
row["数值"] = data?.ToString() ?? ""; row["数值"] = val;
else else
row.Add("数值", data?.ToString() ?? ""); row.Add("数值", val);
} }
} }
table.Add(row); table.Add(row);
......
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