Commit 90fb7684 by 钟博

修改成本支出详情显示

parent 712e3cc5
...@@ -323,5 +323,60 @@ public ApiResponse Config([FromBody] ModModuleRequest request) ...@@ -323,5 +323,60 @@ 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完成请求")}");
}
}
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 参数错误!");
}
} }
} }
...@@ -17,4 +17,13 @@ public class SaveConfigData ...@@ -17,4 +17,13 @@ public class SaveConfigData
public string[] ColHeaders { get; set; } public string[] ColHeaders { get; set; }
public string[][] Data { 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; }
}
} }
...@@ -290,6 +290,133 @@ public void DelItem(int itemId) ...@@ -290,6 +290,133 @@ public void DelItem(int itemId)
exitemRepository.Remove(item); exitemRepository.Remove(item);
} }
public HandsonTable GetQueryItemHands(ModModuleRequest request)
{
HandsonTable handson = new HandsonTable((int)SheetType.Unidentifiable, CostDic.Select(c => c.Value).ToArray(), CostDic.Select(t => new collect_permission
{
HeadName = t.Value,
Visible = 1,
Readnoly = 0
}).ToList());
var scheme=ExtractScheme(Convert.ToInt32(request.HospitalId), request.ExecuteType, request.SheetType);
if (handson.Columns != null && handson.Columns.Any())
{
foreach (var column in handson.Columns)
{
if (column.Data == "自动提取规则(无法提取的考核项请勿填写)")
{
column.Type = "autocomplete";
column.Source = scheme.Select(c => c.Title).ToArray();
column.Strict = true;
}
}
}
var list = exitemRepository.GetEntities(t => t.ModuleId == request.ModuleId);
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 CostDic
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;
else
item["TypeId"] = null;
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<ex_item>(json);
if (!string.IsNullOrEmpty(data.ItemName) || !string.IsNullOrEmpty(data.TypeId.ToString()))
{
data.ModuleId = ModuleId;
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), "自动提取规则(无法提取的考核项请勿填写)" },
{ nameof(ex_item.ReadOnly), "是否只读" }
};
#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