Commit 1259ae48 by 李承祥

Merge branch 'develop' into feature/extract

parents 77060bf7 1cfac1b2
......@@ -43,7 +43,7 @@ public List<TitleValue> ExtractScheme(int hospitalId, List<int> executeType)
var titlevalue = new List<TitleValue>();
var list = perforModextractRepository.GetEntities(t => (t.HospitalId == hospitalId || t.HospitalId == null) && executeType.Contains(t.ExecuteType.Value));
if (list != null && list.Any())
titlevalue = list.Select(t => new TitleValue { Title = string.IsNullOrEmpty(t.Description) ? t.EName : $"{t.EName}({t.Description})", Value = t.Id.ToString() }).ToList();
titlevalue = list.Select(t => new TitleValue { Title = string.IsNullOrEmpty(t.Description) ? t.EName : $"{t.EName}({t.Description})", Value = t.Id.ToString() }).OrderBy(t => t.Title).ToList();
return titlevalue;
}
......@@ -77,27 +77,38 @@ public mod_module AddModule(ModModuleRequest request)
throw new PerformanceException("模块类型错误,只支持收入模板配置");
string[] array = new string[] { "就诊收入", "执行收入" };
if (array.Any(t => !request.ModuleName.Contains(t)))
if (request.ModuleName.IndexOf("就诊收入") == -1 && request.ModuleName.IndexOf("执行收入") == -1)
throw new PerformanceException("模块名称规则错误");
if (Regex.IsMatch(request.ModuleName, @"^[\u4e00-\u9fa5]+$"))
throw new PerformanceException("模块名称规则错误,请使用全中文命名");
//if (!Regex.IsMatch(request.ModuleName, @"^[\u4e00-\u9fa5]+$"))
// throw new PerformanceException("模块名称规则错误,请使用全中文命名");
var incomeList = perforModmoduleRepository.GetEntities(t => t.HospitalId == request.HospitalId && t.SheetType == (int)SheetType.Income);
if (incomeList.Any(t => Regex.Replace(t.ModuleName, @"\d", "").Replace(".", "").Replace(" ", "") == request.ModuleName))
throw new PerformanceException("绩效模板已存在!");
var moduleList = perforModmoduleRepository.GetEntities(t => t.HospitalId == request.HospitalId && t.ModuleName.IndexOf("1.") != -1);
string addname = "";
var moduleList = perforModmoduleRepository.GetEntities(t => t.HospitalId == request.HospitalId && t.ModuleName.IndexOf("1.") != -1);
string name = request.ModuleName.Replace("就诊收入", "").Replace("执行收入", "");
var exist = moduleList.Where(t => t.ModuleName.Contains(name));
if (exist != null && exist.Any())
{
string modulename = exist.OrderByDescending(t => t.ModuleName).First().ModuleName;
int[] sort = Array.ConvertAll(modulename.Split(' ')[0].Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries), t => ConvertHelper.TryInt(t));
sort[2] += 1;
addname = string.Join(".", sort) + " " + request.ModuleName;
}
else
{
string modulename = moduleList.OrderByDescending(t => t.ModuleName).First().ModuleName;
int[] sort = Array.ConvertAll(modulename.Split(' ')[0].Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries), t => ConvertHelper.TryInt(t));
sort[1] += 1;
addname = $"{sort[0]}.{sort[1]}.1 " + request.ModuleName;
}
mod_module entity = new mod_module
{
ModuleName = request.ModuleName,
ModuleName = addname,
HospitalId = request.HospitalId,
Description = request.Description,
SheetType = request.SheetType,
......@@ -132,18 +143,18 @@ private void AddModule(int hospitalId)
var extractList = perforModextractRepository.GetEntities(t => t.IsEnable == 1 && t.ExecuteType == 1);
var moduleList = new mod_module[]
{
new mod_module{ ModuleName = "1.0.1 额外收入", SheetType = (int)SheetType.OtherIncome, ExtractId = null },
new mod_module{ ModuleName = "1.1.1 门诊就诊收入", SheetType = (int)SheetType.Income, ExtractId = extractList.FirstOrDefault(t => t.EName == "门诊就诊收入")?.Id },
new mod_module{ ModuleName = "1.1.2 门诊执行收入", SheetType = (int)SheetType.Income, ExtractId = extractList.FirstOrDefault(t => t.EName == "门诊执行收入")?.Id },
new mod_module{ ModuleName = "1.2.1 住院就诊收入", SheetType = (int)SheetType.Income, ExtractId = extractList.FirstOrDefault(t => t.EName == "住院就诊收入")?.Id },
new mod_module{ ModuleName = "1.2.2 住院执行收入", SheetType = (int)SheetType.Income, ExtractId = extractList.FirstOrDefault(t => t.EName == "住院执行收入")?.Id },
new mod_module{ ModuleName = "2.1 成本支出统计表", SheetType = (int)SheetType.Expend, ExtractId = null },
new mod_module{ ModuleName = "3.1 医生组工作量绩效测算表", SheetType = (int)SheetType.Workload, ExtractId = null },
new mod_module{ ModuleName = "3.2 护理组工作量绩效测算表", SheetType = (int)SheetType.Workload, ExtractId = null },
new mod_module{ ModuleName = "1.0.1 额外收入", SheetType = (int)SheetType.OtherIncome },
new mod_module{ ModuleName = "1.1.1 门诊就诊收入", SheetType = (int)SheetType.Income },
new mod_module{ ModuleName = "1.1.2 门诊执行收入", SheetType = (int)SheetType.Income },
new mod_module{ ModuleName = "1.2.1 住院就诊收入", SheetType = (int)SheetType.Income },
new mod_module{ ModuleName = "1.2.2 住院执行收入", SheetType = (int)SheetType.Income },
new mod_module{ ModuleName = "2.1 成本支出统计表", SheetType = (int)SheetType.Expend },
new mod_module{ ModuleName = "3.1 医生组工作量绩效测算表", SheetType = (int)SheetType.Workload },
new mod_module{ ModuleName = "3.2 护理组工作量绩效测算表", SheetType = (int)SheetType.Workload },
};
var data = perforModmoduleRepository.GetEntities(t => t.HospitalId == hospitalId);
var inexistence = 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));
if (inexistence != null && inexistence.Any())
{
......@@ -156,7 +167,7 @@ private void AddModule(int hospitalId)
ModuleName = item.ModuleName,
SheetType = (int)item.SheetType,
ReadOnly = 1,
ExtractId = item.ExtractId,
ExtractId = null,
IsGenerated = 0
};
modules.Add(module);
......@@ -175,8 +186,8 @@ public mod_module EditModule(ModModuleRequest request)
var entity = perforModmoduleRepository.GetEntity(t => t.Id == request.ModuleId);
if (entity == null)
throw new PerformanceException("该绩效抽取方案不存在!");
if (entity.ReadOnly == 1)
throw new PerformanceException("该绩效抽取方案不可编辑!");
//if (entity.ReadOnly == 1)
// throw new PerformanceException("该绩效抽取方案不可编辑!");
var list = perforModmoduleRepository.GetEntities(t => t.Id != entity.Id && t.HospitalId == entity.HospitalId && t.ModuleName == request.ModuleName);
if (list != null && list.Any())
......@@ -225,7 +236,7 @@ public void DelModule(int moduleId)
public List<mod_item> Items(int moduleId)
{
var list = perforModitemRepository.GetEntities(t => t.ModuleId == moduleId);
return list;
return list?.OrderBy(t => t.ItemName).ToList();
}
/// <summary>
......@@ -242,7 +253,7 @@ public List<mod_item> AddItem(ItemListRequest request)
list.ForEach(t =>
{
t.ModuleId = entity.Id;
t.ExtractId = entity.ExtractId;
//t.ExtractId = entity.ExtractId;
t.ReadOnly = 0;
});
if (!perforModitemRepository.AddRange(list.ToArray()))
......@@ -264,6 +275,7 @@ public mod_item EditItem(mod_item entity)
item.FactorValue1 = entity.FactorValue1;
item.FactorValue2 = entity.FactorValue2;
item.FactorValue3 = entity.FactorValue3;
item.ExtractId = entity.ExtractId;
item.SelectionRange = entity.SelectionRange;
if (!perforModitemRepository.Update(item))
throw new PerformanceException("修改失败!");
......@@ -405,6 +417,12 @@ public void AddItems(int moduleId)
if ((int)SheetType.Income == module.SheetType && module.IsGenerated == 0)
{
var configList = perforHospitalconfigRepository.GetEntities(t => t.HospitalId == module.HospitalId);
if (configList == null || !configList.Any())
{
LogHelper.Information("医院配置信息未设置", "添加默认收费项");
throw new PerformanceException($"医院配置信息未设置");
}
if (configList != null && configList.Any())
{
var hospitalConfig = configList.First();
......
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