Commit a7bc1fc7 by 钟博

Merge branch '优化录入' into 大屏优化录入

# Conflicts:
#	performance/Performance.Services/ConfigService.cs
#	performance/Performance.Services/EmployeeService.cs
parents 4030fe47 08dabd96
...@@ -301,6 +301,36 @@ public ApiResponse DrugtypeDelete([CustomizeValidator(RuleSet = "Delete"), FromB ...@@ -301,6 +301,36 @@ public ApiResponse DrugtypeDelete([CustomizeValidator(RuleSet = "Delete"), FromB
return new ApiResponse(ResponseType.Fail); return new ApiResponse(ResponseType.Fail);
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
/// <summary>
/// 获取收入费用类别
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("GetDrugtypeHands")]
[HttpPost]
public ApiResponse GetDrugtypeHands([CustomizeValidator(RuleSet = "Select"), FromBody] DrugpropRequest request)
{
var list = _configService.GetDrugtypeHands(request.AllotID);
return new ApiResponse(ResponseType.OK, "ok", list);
}
/// <summary>
/// 保存收入费用类别
/// </summary>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("SaveDrugtypeHands/{allotId}")]
[HttpPost]
public ApiResponse SaveDrugtypeHands(int allotId, [FromBody] SaveConfigData request)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
_configService.SaveDrugtypeHands(allotId, request);
return new ApiResponse(ResponseType.OK);
}
#endregion #endregion
#region cofagain #region cofagain
...@@ -411,6 +441,36 @@ public ApiResponse WorkItemDelete([CustomizeValidator(RuleSet = "Delete"), FromB ...@@ -411,6 +441,36 @@ public ApiResponse WorkItemDelete([CustomizeValidator(RuleSet = "Delete"), FromB
return new ApiResponse(ResponseType.Fail); return new ApiResponse(ResponseType.Fail);
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
/// <summary>
///获取工作量绩效配置(hands)
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("GetWorkItemHands")]
[HttpPost]
public ApiResponse GetWorkItemHands([CustomizeValidator(RuleSet = "Select"), FromBody] WorkItemRequest request)
{
var list = _configService.GetWorkItemHands(request.AllotID,request.Type);
return new ApiResponse(ResponseType.OK, "ok", list);
}
/// <summary>
/// 保存工作量绩效配置(hands)
/// </summary>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("SaveWorkItemHands/{allotId}")]
[HttpPost]
public ApiResponse SaveWorkItemHands(int allotId, [FromBody] SaveConfigData request)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
_configService.SaveWorkItemHands(allotId, request);
return new ApiResponse(ResponseType.OK);
}
#endregion #endregion
#region depttype #region depttype
...@@ -466,6 +526,36 @@ public ApiResponse DepttypeDelete([CustomizeValidator(RuleSet = "Delete"), FromB ...@@ -466,6 +526,36 @@ public ApiResponse DepttypeDelete([CustomizeValidator(RuleSet = "Delete"), FromB
return new ApiResponse(ResponseType.Fail); return new ApiResponse(ResponseType.Fail);
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
/// <summary>
/// 获取科室类别配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("GetDepttypeHands")]
[HttpPost]
public ApiResponse GetDepttypeHands([CustomizeValidator(RuleSet = "Select"), FromBody] DrugpropRequest request)
{
var list = _configService.GetDepttypeHands(request.AllotID);
return new ApiResponse(ResponseType.OK, "ok", list);
}
/// <summary>
/// 保存科室类别配置
/// </summary>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("SaveDepttypeHands/{allotId}")]
[HttpPost]
public ApiResponse SaveDepttypeHands(int allotId, [FromBody] SaveConfigData request)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
_configService.SaveDepttypeHands(allotId, request);
return new ApiResponse(ResponseType.OK);
}
#endregion #endregion
#region cmi #region cmi
...@@ -564,7 +654,7 @@ public ApiResponse GetHrpDeptHands([FromRoute] int hospitalId, int allotId) ...@@ -564,7 +654,7 @@ public ApiResponse GetHrpDeptHands([FromRoute] int hospitalId, int allotId)
/// <returns></returns> /// <returns></returns>
[Route("savehrpdept/{hospitalId}/allot/{allotId}")] [Route("savehrpdept/{hospitalId}/allot/{allotId}")]
[HttpPost] [HttpPost]
public ApiResponse SaveHrpDept(int hospitalId, int allotId, [FromBody] SaveCollectData request) public ApiResponse SaveHrpDept(int hospitalId, int allotId, [FromBody] SaveConfigData request)
{ {
if (hospitalId <= 0) if (hospitalId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "HospitalId无效"); return new ApiResponse(ResponseType.Fail, "参数错误", "HospitalId无效");
......
...@@ -456,6 +456,38 @@ public ApiResponse<per_apr_amount> GetEmployeeMessage([FromBody] per_apr_amount ...@@ -456,6 +456,38 @@ public ApiResponse<per_apr_amount> GetEmployeeMessage([FromBody] per_apr_amount
} }
/// <summary> /// <summary>
/// 获取其他绩效信息
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[HttpPost("GetAprHands/{allotId}")]
public ApiResponse GetAprHands(int allotId)
{
if (allotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employee = employeeService.GetAprHands(allotId,claim.GetUserId());
return new ApiResponse(ResponseType.OK, "ok", employee);
}
/// <summary>
/// 保存其他绩效信息
/// </summary>
/// <param name="HospitalId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("SaveAprHands/{allotId}")]
[HttpPost]
public ApiResponse SaveAprHands(int allotId, [FromBody] SaveConfigData request)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
employeeService.SaveAprHands(allotId, request);
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 绩效类型字典 /// 绩效类型字典
/// </summary> /// </summary>
/// <param name="allotId"></param> /// <param name="allotId"></param>
......
...@@ -323,5 +323,62 @@ public ApiResponse Config([FromBody] ModModuleRequest request) ...@@ -323,5 +323,62 @@ public ApiResponse Config([FromBody] ModModuleRequest request)
var configs = configService.GetHospitalconfigs(request.HospitalId.Value); var configs = configService.GetHospitalconfigs(request.HospitalId.Value);
return new ApiResponse(ResponseType.OK, "绩效抽取数据地址!", configs); return new ApiResponse(ResponseType.OK, "绩效抽取数据地址!", configs);
} }
/// <summary>
/// 绩效收入模板配置项列表
/// </summary>
/// <returns></returns>
[Route("GetItemHands")]
[HttpPost]
public ApiResponse GetItemHands([FromBody] ModModuleRequest request)
{
bool isSingle = false;
if (!configService.QueryHosConfigs(request.ModuleId.Value, ref isSingle, out int sheetType))
return new ApiResponse(ResponseType.Fail, "当前医院未配置地址");
if (sheetType == (int)SheetType.Income)
{
if (isSingle)
{
configService.AddItems(request.ModuleId.Value);
}
else
{
logger.LogInformation($"绩效收入模板配置项列表 : 请求地址 {options.HttpPost}modextract/items");
var http = new RestSharpHelper();
var url = http.SetUrl(options.HttpPost, "modextract/items");
var req = http.CreatePostRequest(JsonHelper.Serialize(request));
var res = http.GetResponse(url, req);
var ret = http.GetContent<ApiResponse>(res);
logger.LogInformation($"绩效收入模板配置项列表在{DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss完成请求")}");
}
}
request.SheetType = sheetType;
var list = configService.GetQueryItemHands(request);
return new ApiResponse(ResponseType.OK, list);
}
/// <summary>
/// 绩效收入模板配置项新增
/// </summary>
/// <returns></returns>
[Route("SaveItemHands/{ModuleId}")]
[HttpPost]
public ApiResponse SaveItemHands(int ModuleId, [FromBody] SaveItemData request)
{
if (ModuleId != 0)
{
configService.SaveItemHands(ModuleId, request);
return new ApiResponse(ResponseType.OK);
}
return new ApiResponse(ResponseType.ParameterError, "ModuleId 参数错误!");
}
} }
} }
...@@ -37,6 +37,36 @@ public ApiResponse GetPersons(int allotId) ...@@ -37,6 +37,36 @@ public ApiResponse GetPersons(int allotId)
} }
/// <summary> /// <summary>
/// 获取员工记录
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("GetPersonsHands/{allotId}/hosp/{hospitalId}")]
[HttpPost]
public ApiResponse GetPersonsHands(int allotId,int hospitalId)
{
var list = personService.GetPersonHands(allotId,hospitalId, claimService.GetUserId());
return new ApiResponse(ResponseType.OK, list);
}
/// <summary>
/// 保存员工信息
/// </summary>
/// <param name="HospitalId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("SavePersonHands/{allotId}/hosp/{HospitalId}")]
[HttpPost]
public ApiResponse SavePersonHands(int allotId,int HospitalId, [FromBody] SaveConfigData request)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
personService.SavePersonHands(allotId,HospitalId,request);
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 新增员工信息 /// 新增员工信息
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
...@@ -93,6 +123,19 @@ public ApiResponse GetDepartments(int hospitalId) ...@@ -93,6 +123,19 @@ public ApiResponse GetDepartments(int hospitalId)
} }
/// <summary> /// <summary>
/// 获取科室记录
/// </summary>
/// <param name="hospitalId"></param>
/// <returns></returns>
[Route("GetDepartmentHands/{hospitalId}")]
[HttpPost]
public ApiResponse GetDepartmentHands(int hospitalId)
{
var list = personService.GetDepartmentHands(hospitalId);
return new ApiResponse(ResponseType.OK, list);
}
/// <summary>
/// 新增科室信息 /// 新增科室信息
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
...@@ -181,5 +224,22 @@ public ApiResponse DeptIncomeDetail([CustomizeValidator(RuleSet = "Select"), Fro ...@@ -181,5 +224,22 @@ public ApiResponse DeptIncomeDetail([CustomizeValidator(RuleSet = "Select"), Fro
var data = personService.DeptIncomeDetail(request, claimService.GetUserId()); var data = personService.DeptIncomeDetail(request, claimService.GetUserId());
return new ApiResponse(ResponseType.OK, data); return new ApiResponse(ResponseType.OK, data);
} }
/// <summary>
/// 保存科室字典(hands)
/// </summary>
/// <param name="HospitalId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("SaveDepartmentHands/{HospitalId}")]
[HttpPost]
public ApiResponse SaveDeptDicHands(int HospitalId, [FromBody] SaveConfigData request)
{
if (HospitalId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
personService.SaveDeptDicHands(HospitalId, request);
return new ApiResponse(ResponseType.OK);
}
} }
} }
...@@ -52,5 +52,18 @@ public ApiResponse SheetExport([FromBody]SheetExportRequest request) ...@@ -52,5 +52,18 @@ public ApiResponse SheetExport([FromBody]SheetExportRequest request)
return new ApiResponse(ResponseType.OK, exportData); return new ApiResponse(ResponseType.OK, exportData);
} }
/// <summary>
/// sheet 数据详情
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("SheetExportHands")]
[HttpPost]
public ApiResponse SheetExportHands([FromBody] SheetExportRequest request)
{
var exportData = _sheetSevice.SheetExportHands(request.SheetID);
return new ApiResponse(ResponseType.OK, exportData);
}
} }
} }
...@@ -23,7 +23,9 @@ public HandsonTable(int sheetType, string[] cols, List<collect_permission> permi ...@@ -23,7 +23,9 @@ public HandsonTable(int sheetType, string[] cols, List<collect_permission> permi
public string[] ColHeaders { get; private set; } public string[] ColHeaders { get; private set; }
public List<Dictionary<string, string>> Data => _data; public List<Dictionary<string, string>> Data => _data;
public HandsonColumn[] Columns { get; private set; } public HandsonColumn[] Columns { get; private set; }
public List<NestedHeaders>[] NestHeaders { get;set; }
public string SheetName { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
...@@ -134,6 +136,17 @@ public class NumericFormat ...@@ -134,6 +136,17 @@ public class NumericFormat
public string Pattern { get; set; } public string Pattern { get; set; }
} }
public class NestedHeaders
{
public NestedHeaders(string label, int colspan)
{
Label = label;
Colspan = colspan;
}
public string Label { get; set; }
public int Colspan { get; set; } = 1;
}
public class DefalutHandsonHeader public class DefalutHandsonHeader
{ {
public SheetType SheetType { get; set; } public SheetType SheetType { get; set; }
......
...@@ -25,4 +25,20 @@ public class Deptdic ...@@ -25,4 +25,20 @@ public class Deptdic
public int Id { get; set; } public int Id { get; set; }
public string AccountingUnit { get; set; } public string AccountingUnit { get; set; }
} }
public class DeptdicHands
{
public int HospitalId { get; set; }
public string HISDeptName { get; set; }
public string Department { get; set; }
public string OutDoctorAccounting { get; set; }
public string OutNurseAccounting { get; set; }
public string OutTechnicAccounting { get; set; }
public string InpatDoctorAccounting { get; set; }
public string InpatNurseAccounting { get; set; }
public string InpatTechnicAccounting { get; set; }
public string LogisticsAccounting { get; set; }
public string SpecialAccounting { get; set; }
public DateTime? CreateTime { get; set; }
}
} }
...@@ -11,4 +11,19 @@ public class SaveCollectData ...@@ -11,4 +11,19 @@ public class SaveCollectData
public string[] ColHeaders { get; set; } public string[] ColHeaders { get; set; }
public string[][] Data { get; set; } public string[][] Data { get; set; }
} }
public class SaveConfigData
{
public string[] ColHeaders { get; set; }
public string[][] Data { get; set; }
}
public class SaveItemData
{
public Nullable<int> HospitalId { get; set; }
public List<int> ExecuteType { get; set; }
public Nullable<int> SheetType { get; set; }
public string[] ColHeaders { get; set; }
public string[][] Data { get; set; }
}
} }
...@@ -690,5 +690,153 @@ public List<TitleValue> GetPerforTypeDict(int allotId) ...@@ -690,5 +690,153 @@ public List<TitleValue> GetPerforTypeDict(int allotId)
} }
#endregion #endregion
public HandsonTable GetAprHands(int allotId, int userId)
{
HandsonTable handson = new HandsonTable((int)SheetType.Unidentifiable, OrtherPerfDic.Select(c => c.Value).ToArray(), OrtherPerfDic.Select(t => new collect_permission
{
HeadName = t.Value,
Visible = 1,
Readnoly = 0
}).ToList());
if (handson.Columns != null && handson.Columns.Any())
{
foreach (var column in handson.Columns)
{
if (column.Data == "绩效类型")
{
column.Type = "autocomplete";
column.Source = new[] { "基础绩效", "管理绩效" };
column.Strict = false;
}
if (new[] { "状态", "备注" }.Contains(column.Data))
{
column.ReadOnly = true;
}
}
}
var list = GetAprList(allotId, userId);
if (list == null) return handson;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0;
foreach (var item in list)
{
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in OrtherPerfDic
join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList();
var status = cells.First(c => c.Name == "状态");
switch (status.Value)
{
case "1":
status.Value = "未提交";
break;
case "2":
status.Value = "等待审核";
break;
case "3":
status.Value = "审核通过";
break;
case "4":
status.Value = "驳回";
break;
}
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
handson.SetRowData(rowDatas, rowDatas != null);
return handson;
}
public void SaveAprHands(int AllotId, SaveConfigData request)
{
var dicData = CreateDataRow(request, OrtherPerfDic);
List<per_apr_amount> empDics = new List<per_apr_amount>();
foreach (var dic in dicData)
{
if (dic.ContainsKey("Status"))
{
if (dic.ContainsValue("未提交"))
{
dic["Status"] = "1";
}
else if (dic.ContainsValue("等待审核"))
{
dic["Status"] = "2";
}
else if (dic.ContainsValue("审核通过"))
{
dic["Status"] = "3";
}
else
{
dic["Status"] = "4";
}
}
var json = JsonHelper.Serialize(dic);
var data = JsonHelper.Deserialize<per_apr_amount>(json);
if (!string.IsNullOrEmpty(data.DoctorName) || !string.IsNullOrEmpty(data.PersonnelNumber))
{
data.AllotId = AllotId;
data.CreateDate=Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
empDics.Add(data);
}
}
perapramountRepository.Execute("delete from per_apr_amount where AllotId = @AllotId", new { AllotId });
perapramountRepository.AddRange(empDics.ToArray());
}
private List<Dictionary<string, string>> CreateDataRow(SaveConfigData request, Dictionary<string, string> config)
{
List<Dictionary<string, string>> allData = new List<Dictionary<string, string>>();
for (int r = 0; r < request.Data.Length; r++)
{
// 创建固定数据列
Dictionary<string, string> baseData = CreateBaseData(request, config, r);
//baseData.Add(nameof(collect_data), HospitalId.ToString());
allData.Add(baseData);
}
return allData;
}
private Dictionary<string, string> CreateBaseData(SaveConfigData request, Dictionary<string, string> config, int rownumber)
{
Dictionary<string, string> result = new Dictionary<string, string>();
for (int c = 0; c < request.ColHeaders.Length; c++)
{
var header = request.ColHeaders[c];
var first = config.FirstOrDefault(w => w.Value == header);
if (!default(KeyValuePair<string, string>).Equals(first)
&& !result.ContainsKey(header)
&& request.Data[rownumber].Length > c)
{
result.Add(first.Key, request.Data[rownumber][c]);
}
}
return result;
}
public static Dictionary<string, string> OrtherPerfDic { get; } = new Dictionary<string, string>
{
{ nameof(per_apr_amount.TypeInDepartment), "录入科室" },
{ nameof(per_apr_amount.AccountingUnit), "核算单元" },
{ nameof(per_apr_amount.PersonnelNumber), "人员工号" },
{ nameof(per_apr_amount.DoctorName), "姓名" },
{ nameof(per_apr_amount.PerforType), "绩效类型" },
{ nameof(per_apr_amount.Amount), "金额" },
{ nameof(per_apr_amount.Status), "状态" },
{ nameof(per_apr_amount.Remark), "备注" }
};
} }
} }
...@@ -66,18 +66,8 @@ ILogger<ExConfigService> logger ...@@ -66,18 +66,8 @@ ILogger<ExConfigService> logger
#region Modules #region Modules
public List<ex_module> QueryModule(int hospitalId)
{
//首次添加费用字典默认值
DefaultModules(hospitalId);
var list = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId).OrderBy(t => t.ModuleName).ToList(); private readonly ex_module[] moduleList = new ex_module[]
return list;
}
private void DefaultModules(int hospitalId)
{
var moduleList = new ex_module[]
{ {
new ex_module{ ModuleName = "1.0.1 额外收入", SheetType = (int)SheetType.OtherIncome }, new ex_module{ ModuleName = "1.0.1 额外收入", SheetType = (int)SheetType.OtherIncome },
new ex_module{ ModuleName = "1.1.1 门诊开单收入", SheetType = (int)SheetType.Income }, new ex_module{ ModuleName = "1.1.1 门诊开单收入", SheetType = (int)SheetType.Income },
...@@ -89,6 +79,18 @@ private void DefaultModules(int hospitalId) ...@@ -89,6 +79,18 @@ private void DefaultModules(int hospitalId)
new ex_module{ ModuleName = "3.2 护理组工作量绩效测算表", SheetType = (int)SheetType.Workload }, new ex_module{ ModuleName = "3.2 护理组工作量绩效测算表", SheetType = (int)SheetType.Workload },
}; };
public List<ex_module> QueryModule(int hospitalId)
{
//首次添加费用字典默认值
DefaultModules(hospitalId);
var list = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId).OrderBy(t => t.ModuleName).ToList();
return list;
}
private void DefaultModules(int hospitalId)
{
var data = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId); var data = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId);
var inexistence = data == null ? moduleList : moduleList.Where(t => !data.Select(p => p.ModuleName).ToArray().Contains(t.ModuleName)); var inexistence = data == null ? moduleList : moduleList.Where(t => !data.Select(p => p.ModuleName).ToArray().Contains(t.ModuleName));
...@@ -290,6 +292,183 @@ public void DelItem(int itemId) ...@@ -290,6 +292,183 @@ public void DelItem(int itemId)
exitemRepository.Remove(item); exitemRepository.Remove(item);
} }
public HandsonTable GetQueryItemHands(ModModuleRequest request)
{
var DicType = new Dictionary<string, string>();
var module = exmoduleRepository.GetEntity(t => t.Id == request.ModuleId);
if (request.SheetType == (int)SheetType.Workload)
DicType = WorkLoadDic;
else if (request.SheetType==(int)SheetType.Income)
//else if (moduleList.Where(t=>t.SheetType == (int)SheetType.Income).Select(t=>t.ModuleName).Contains(module.ModuleName) )
DicType =OutDic;
else
DicType = CostDic;
HandsonTable handson = new HandsonTable((int)SheetType.Unidentifiable, DicType.Select(c => c.Value).ToArray(), DicType.Select(t => new collect_permission
{
HeadName = t.Value,
Visible = 1,
Readnoly = 0
}).ToList());
var scheme = ExtractScheme(Convert.ToInt32(request.HospitalId), request.ExecuteType, 0);
if (handson.Columns != null && handson.Columns.Any())
{
foreach (var column in handson.Columns)
{
if (new[]{"医生系数","护理系数","医技系数"}.Contains(column.Data))
{
column.Type = "numeric";
column.NumericFormat=new NumericFormat(){Pattern = "%"};
column.Strict = false;
}
if (column.Data=="单元工作量绩效标准")
{
column.Type = "numeric";
column.Strict = false;
}
if (column.Data == "自动提取规则(无法提取的考核项请勿填写)")
{
column.Type = "autocomplete";
column.Source = scheme?.Select(c => c.Title).ToArray();
column.Strict = false;
}
}
}
var list = exitemRepository.GetEntities(t => t.ModuleId == request.ModuleId)?.OrderBy(c=>c.ItemName);
if (list == null) return handson;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0;
foreach (var item in list)
{
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var typeId = scheme.Where(c => c.Value == item.TypeId.ToString());
if (typeId.Any())
firstDic["typeid"] = typeId.First().Title;
else
firstDic["typeid"] = "";
var cells = (from conf in DicType
join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList();
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
handson.SetRowData(rowDatas, rowDatas != null);
return handson;
}
public void SaveItemHands(int ModuleId, SaveItemData request)
{
var entity = exmoduleRepository.GetEntity(t => t.Id == ModuleId);
if (entity == null)
throw new PerformanceException("选择的绩效抽取方案不存在!");
var dicData = CreateDataRow(ModuleId, request, CostDic);
List<ex_item> exItems = new List<ex_item>();
foreach (var item in dicData)
{
var dicValue =
ExtractScheme(Convert.ToInt32(request.HospitalId), request.ExecuteType, request.SheetType)
.Where(t => t.Title == item["TypeId"]);
if (dicValue.Any())
item["TypeId"] = dicValue.First().Value;
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<ex_item>(json);
if (!string.IsNullOrEmpty(data.ItemName))
{
data.ModuleId = ModuleId;
if (string.IsNullOrEmpty(data.FactorValue1.ToString()))
{
data.FactorValue1 = 0;
}
if (string.IsNullOrEmpty(data.FactorValue2.ToString()))
{
data.FactorValue2 = 0;
}
if (string.IsNullOrEmpty(data.FactorValue3.ToString()))
{
data.FactorValue3 = 0;
}
exItems.Add(data);
}
}
exitemRepository.Execute("delete from ex_item where ModuleId = @ModuleId", new { ModuleId });
exitemRepository.AddRange(exItems.ToArray());
}
private List<Dictionary<string, string>> CreateDataRow(int allotId, SaveItemData request, Dictionary<string, string> config)
{
List<Dictionary<string, string>> allData = new List<Dictionary<string, string>>();
for (int r = 0; r < request.Data.Length; r++)
{
// 创建固定数据列
Dictionary<string, string> baseData = CreateBaseData(request, config, r);
baseData.Add(nameof(collect_data.AllotID), allotId.ToString());
allData.Add(baseData);
}
return allData;
}
private Dictionary<string, string> CreateBaseData(SaveItemData request, Dictionary<string, string> config, int rownumber)
{
Dictionary<string, string> result = new Dictionary<string, string>();
for (int c = 0; c < request.ColHeaders.Length; c++)
{
var header = request.ColHeaders[c];
var first = config.FirstOrDefault(w => w.Value == header);
if (!default(KeyValuePair<string, string>).Equals(first)
&& !result.ContainsKey(header)
&& request.Data[rownumber].Length > c)
{
result.Add(first.Key, request.Data[rownumber][c]);
}
}
return result;
}
public static Dictionary<string, string> CostDic { get; } = new Dictionary<string, string>
{
{ nameof(ex_item.ItemName), "绩效考核项" },
{ nameof(ex_item.FactorValue1), "医生系数" },
{ nameof(ex_item.FactorValue2), "护理系数" },
{ nameof(ex_item.FactorValue3), "医技系数" },
{ nameof(ex_item.TypeId), "自动提取规则(无法提取的考核项请勿填写)" }
};
public static Dictionary<string, string> OutDic { get; } = new Dictionary<string, string>
{
{ nameof(ex_item.ItemName), "绩效考核项" },
{ nameof(ex_item.FactorValue1), "医生系数" },
{ nameof(ex_item.FactorValue2), "护理系数" },
{ nameof(ex_item.FactorValue3), "医技系数" }
};
public static Dictionary<string, string> WorkLoadDic { get; } = new Dictionary<string, string>
{
{ nameof(ex_item.ItemName), "绩效考核项" },
{ nameof(ex_item.FactorValue1), "单元工作量绩效标准" },
{ nameof(ex_item.TypeId), "自动提取规则(无法提取的考核项请勿填写)" }
};
#endregion Items #endregion Items
#region 特殊科室 #region 特殊科室
......
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