Commit d1a3b266 by lcx

his_data抽取数据时,数据实体修改

parent 7e47f334
...@@ -89,7 +89,7 @@ public class his_data ...@@ -89,7 +89,7 @@ public class his_data
/// <summary> /// <summary>
/// 费用 /// 费用
/// </summary> /// </summary>
public string Value { get; set; } public Nullable<decimal> Value { get; set; }
/// <summary> /// <summary>
/// 创建时间 /// 创建时间
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.EntityModels
{
public class HisData
{
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 医生姓名
/// </summary>
public string DoctorName { get; set; }
/// <summary>
/// 医生姓名
/// </summary>
public string PersonnelName { get; set; }
/// <summary>
/// 人员工号
/// </summary>
public string PersonnelNumber { get; set; }
/// <summary>
/// 类别
/// </summary>
public string Category { get; set; }
/// <summary>
/// 类别
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// 原始分类
/// </summary>
public string Original { get; set; }
/// <summary>
/// 费用
/// </summary>
public Nullable<decimal> Value { get; set; }
}
}
...@@ -118,7 +118,7 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri ...@@ -118,7 +118,7 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri
{ {
if (config == null || string.IsNullOrEmpty(script.ExecScript)) return; if (config == null || string.IsNullOrEmpty(script.ExecScript)) return;
var data = queryService.QueryData<his_data>(config, allot, script.ExecScript); var data = queryService.QueryData<HisData>(config, allot, script.ExecScript);
if (data == null || !data.Any()) return; if (data == null || !data.Any()) return;
var hisdata = hisdataRepository.GetEntities(t => t.AllotId == allot.ID && t.SourceType == script.SourceType && t.Category == script.Category); var hisdata = hisdataRepository.GetEntities(t => t.AllotId == allot.ID && t.SourceType == script.SourceType && t.Category == script.Category);
...@@ -127,17 +127,22 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri ...@@ -127,17 +127,22 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri
hisdataRepository.RemoveRange(hisdata.ToArray()); hisdataRepository.RemoveRange(hisdata.ToArray());
} }
data.ToList().ForEach(t => var insertData = data.Select(t => new his_data
{ {
t.HospitalId = allot.HospitalId; HospitalId = allot.HospitalId,
t.AllotId = allot.ID; AllotId = allot.ID,
t.Year = allot.Year; Year = allot.Year,
t.Month = allot.Month; Month = allot.Month,
t.SourceType = script.SourceType; Department = t.Department,
t.Category = script.Category; PersonnelName = t.DoctorName,
t.CreateTime = DateTime.Now; PersonnelNumber = GetSaveValue(t.PersonnelNumber, t.DoctorName),
SourceType = script.SourceType,
Category = script.Category,
Original = GetSaveValue(t.Category, t.ItemName, t.Original),
Value = t.Value,
CreateTime = DateTime.Now,
}); });
hisdataRepository.AddRange(data.ToArray()); hisdataRepository.AddRange(insertData.ToArray());
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -148,5 +153,13 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri ...@@ -148,5 +153,13 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri
private void Department() private void Department()
{ {
} }
private string GetSaveValue(params string[] arr)
{
string value = string.Empty;
if (arr == null || !arr.Any())
return value;
return arr.FirstOrDefault(w => !string.IsNullOrEmpty(w));
}
} }
} }
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