Commit 9d36c3ff by 799284587@qq.com

no message

parent fb1d4b62
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
namespace Performance.Services namespace Performance.Services
{ {
...@@ -72,10 +73,23 @@ public List<TitleValue> FeeType() ...@@ -72,10 +73,23 @@ public List<TitleValue> FeeType()
/// <returns></returns> /// <returns></returns>
public mod_module AddModule(ModModuleRequest request) public mod_module AddModule(ModModuleRequest request)
{ {
var data = perforModmoduleRepository.GetEntity(t => t.ModuleName == request.ModuleName && t.HospitalId == request.HospitalId); if (request.SheetType != (int)SheetType.Income)
if (data != null) throw new PerformanceException("模块类型错误,只支持收入模板配置");
string[] array = new string[] { "就诊收入", "执行收入" };
if (array.Any(t => !request.ModuleName.Contains(t)))
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("绩效模板已存在!"); throw new PerformanceException("绩效模板已存在!");
mod_module entity = new mod_module mod_module entity = new mod_module
{ {
ModuleName = request.ModuleName, ModuleName = request.ModuleName,
...@@ -100,7 +114,7 @@ public List<mod_module> Module(int hospitalId) ...@@ -100,7 +114,7 @@ public List<mod_module> Module(int hospitalId)
//首次添加费用字典默认值 //首次添加费用字典默认值
AddModule(hospitalId); AddModule(hospitalId);
var list = perforModmoduleRepository.GetEntities(t => t.HospitalId == hospitalId); var list = perforModmoduleRepository.GetEntities(t => t.HospitalId == hospitalId).OrderBy(t => t.ModuleName).ToList();
return list; return list;
} }
...@@ -110,36 +124,41 @@ public List<mod_module> Module(int hospitalId) ...@@ -110,36 +124,41 @@ public List<mod_module> Module(int hospitalId)
/// <param name="hospitalId"></param> /// <param name="hospitalId"></param>
private void AddModule(int hospitalId) private void AddModule(int hospitalId)
{ {
var moduleList = new[] var extractList = perforModextractRepository.GetEntities(t => t.IsEnable == 1 && t.ExecuteType == 1);
var moduleList = new mod_module[]
{ {
new { ModuleName = "额外收入", SheetType = SheetType.OtherIncome }, new mod_module{ ModuleName = "1.0.1 额外收入", SheetType = (int)SheetType.OtherIncome, ExtractId = null },
new { ModuleName = "门诊就诊收入", SheetType = SheetType.Income }, new mod_module{ ModuleName = "1.1.1 门诊就诊收入", SheetType = (int)SheetType.Income, ExtractId = extractList.FirstOrDefault(t => t.EName == "门诊就诊收入")?.Id },
new { ModuleName = "门诊执行收入", SheetType = SheetType.Income }, new mod_module{ ModuleName = "1.1.2 门诊执行收入", SheetType = (int)SheetType.Income, ExtractId = extractList.FirstOrDefault(t => t.EName == "门诊执行收入")?.Id },
new { ModuleName = "住院就诊收入", SheetType = SheetType.Income }, new mod_module{ ModuleName = "1.2.1 住院就诊收入", SheetType = (int)SheetType.Income, ExtractId = extractList.FirstOrDefault(t => t.EName == "住院就诊收入")?.Id },
new { ModuleName = "住院执行收入", SheetType = SheetType.Income }, new mod_module{ ModuleName = "1.2.2 住院执行收入", SheetType = (int)SheetType.Income, ExtractId = extractList.FirstOrDefault(t => t.EName == "住院执行收入")?.Id },
new { ModuleName = "成本支出统计表", SheetType = SheetType.Expend }, new mod_module{ ModuleName = "2.1 成本支出统计表", SheetType = (int)SheetType.Expend, ExtractId = null },
new { ModuleName = "医生组工作量绩效测算表", SheetType = SheetType.Workload }, new mod_module{ ModuleName = "3.1 医生组工作量绩效测算表", SheetType = (int)SheetType.Workload, ExtractId = null },
new { ModuleName = "护理组工作量绩效测算表", SheetType = SheetType.Workload }, new mod_module{ ModuleName = "3.2 护理组工作量绩效测算表", SheetType = (int)SheetType.Workload, ExtractId = null },
}; };
var data = perforModmoduleRepository.GetEntities(t => moduleList.Select(p => p.ModuleName).Contains(t.ModuleName) && t.HospitalId == hospitalId); var data = perforModmoduleRepository.GetEntities(t => t.HospitalId == hospitalId);
if (data != null && data.Any()) var inexistence = moduleList.Where(t => !data.Select(p => p.ModuleName).ToArray().Contains(t.ModuleName));
return;
List<mod_module> modules = new List<mod_module>(); if (inexistence != null && inexistence.Any())
foreach (var item in moduleList)
{ {
var module = new mod_module List<mod_module> modules = new List<mod_module>();
foreach (var item in inexistence)
{ {
HospitalId = hospitalId, var module = new mod_module
ModuleName = item.ModuleName, {
SheetType = (int)item.SheetType, HospitalId = hospitalId,
ReadOnly = 1, ModuleName = item.ModuleName,
IsGenerated = 0 SheetType = (int)item.SheetType,
}; ReadOnly = 1,
modules.Add(module); ExtractId = item.ExtractId,
IsGenerated = 0
};
modules.Add(module);
}
if (modules.Any())
perforModmoduleRepository.AddRange(modules.ToArray());
} }
perforModmoduleRepository.AddRange(modules.ToArray());
} }
/// <summary> /// <summary>
......
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