Commit 74668ca7 by lcx

修改提取信息配置接口内容

parent 08701f2e
...@@ -2,12 +2,14 @@ ...@@ -2,12 +2,14 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles; using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Services; using Performance.Services;
using Performance.Services.ExtractExcelService;
using Performance.Services.Queues; using Performance.Services.Queues;
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -22,6 +24,7 @@ public class ModExtractController : Controller ...@@ -22,6 +24,7 @@ public class ModExtractController : Controller
private readonly IServiceScopeFactory _serviceScopeFactory; private readonly IServiceScopeFactory _serviceScopeFactory;
private readonly IBackgroundTaskQueue _backgroundTaskQueue; private readonly IBackgroundTaskQueue _backgroundTaskQueue;
private readonly IHubNotificationQueue _notificationQueue; private readonly IHubNotificationQueue _notificationQueue;
private readonly ExtractPreConfigService _preConfigService;
public ModExtractController( public ModExtractController(
ClaimService claim, ClaimService claim,
...@@ -29,7 +32,9 @@ public class ModExtractController : Controller ...@@ -29,7 +32,9 @@ public class ModExtractController : Controller
CustomExtractService extractService, CustomExtractService extractService,
IServiceScopeFactory serviceScopeFactory, IServiceScopeFactory serviceScopeFactory,
IBackgroundTaskQueue backgroundTaskQueue, IBackgroundTaskQueue backgroundTaskQueue,
IHubNotificationQueue notificationQueue) IHubNotificationQueue notificationQueue,
ExtractPreConfigService preConfigService
)
{ {
_claim = claim; _claim = claim;
_allotService = allotService; _allotService = allotService;
...@@ -37,6 +42,7 @@ public class ModExtractController : Controller ...@@ -37,6 +42,7 @@ public class ModExtractController : Controller
_serviceScopeFactory = serviceScopeFactory; _serviceScopeFactory = serviceScopeFactory;
_backgroundTaskQueue = backgroundTaskQueue; _backgroundTaskQueue = backgroundTaskQueue;
_notificationQueue = notificationQueue; _notificationQueue = notificationQueue;
_preConfigService = preConfigService;
} }
[HttpPost("custom/{allotId}")] [HttpPost("custom/{allotId}")]
...@@ -99,5 +105,195 @@ public IActionResult DownFile(int allotId) ...@@ -99,5 +105,195 @@ public IActionResult DownFile(int allotId)
var memi = provider.Mappings[fileExt]; var memi = provider.Mappings[fileExt];
return File(memoryStream, memi, Path.GetFileName(allot.CustomExtractPath)); return File(memoryStream, memi, Path.GetFileName(allot.CustomExtractPath));
} }
#region 医院数据库配置
/// <summary>
/// 医院数据库配置列表
/// </summary>
/// <param name="hospitalId"></param>
/// <returns></returns>
[HttpGet("hospital/config/{hospitalId}")]
public ApiResponse<List<sys_hospitalconfig>> GetHospitalConfig([FromRoute] int hospitalId)
{
if (hospitalId == 0) return new ApiResponse<List<sys_hospitalconfig>>(ResponseType.ParameterError, "参数错误");
var list = _preConfigService.GetHospitalConfig(hospitalId);
return new ApiResponse<List<sys_hospitalconfig>>(ResponseType.OK, list);
}
/// <summary>
/// 创建医院数据库配置
/// </summary>
/// <param name="hospitalconfig"></param>
/// <returns></returns>
[HttpPost("hospital/config/create")]
public ApiResponse CreateHospitalConfig([FromBody] sys_hospitalconfig hospitalconfig)
{
if (hospitalconfig == null) return new ApiResponse(ResponseType.ParameterError, "参数错误");
var flag = _preConfigService.CreateHospitalConfig(hospitalconfig);
return flag
? new ApiResponse(ResponseType.OK, "添加成功")
: new ApiResponse(ResponseType.Fail, "添加失败");
}
/// <summary>
/// 修改医院数据库配置
/// </summary>
/// <param name="hospitalconfig"></param>
/// <returns></returns>
[HttpPost("hospital/config/update")]
public ApiResponse UpdateHospitalConfig([FromBody] sys_hospitalconfig hospitalconfig)
{
if (hospitalconfig == null) return new ApiResponse(ResponseType.ParameterError, "参数错误");
var flag = _preConfigService.UpdateHospitalConfig(hospitalconfig);
return flag
? new ApiResponse(ResponseType.OK, "添加成功")
: new ApiResponse(ResponseType.Fail, "添加失败");
}
/// <summary>
/// 删除医院数据库配置
/// </summary>
/// <param name="hospitalconfigId"></param>
/// <returns></returns>
[HttpPost("hospital/config/{hospitalconfigId}")]
public ApiResponse DeleteHospitalConfig([FromRoute] int hospitalconfigId)
{
if (hospitalconfigId == 0) return new ApiResponse(ResponseType.ParameterError, "参数错误");
var flag = _preConfigService.DeleteHospitalConfig(hospitalconfigId);
return flag
? new ApiResponse(ResponseType.OK, "添加成功")
: new ApiResponse(ResponseType.Fail, "添加失败");
}
/// <summary>
/// 测试连接
/// </summary>
/// <param name="hospitalconfigId"></param>
/// <returns></returns>
[HttpPost("hospital/connection/{hospitalconfigId}")]
public ApiResponse TestConnectionCleared([FromRoute] int hospitalconfigId)
{
if (hospitalconfigId == 0) return new ApiResponse(ResponseType.ParameterError, "参数错误");
var flag = _preConfigService.TestConnectionCleared(hospitalconfigId);
return flag
? new ApiResponse(ResponseType.OK, "连接成功")
: new ApiResponse(ResponseType.Fail, "连接失败");
}
#endregion
#region 提取script配置
/// <summary>
/// 数据提取信息列表
/// </summary>
/// <param name="hospitalId"></param>
/// <returns></returns>
[HttpGet("type/{hospitalId}")]
public ApiResponse GetExtractTypeAndScript([FromRoute] int hospitalId)
{
if (hospitalId == 0) return new ApiResponse(ResponseType.ParameterError, "参数错误");
var list = _preConfigService.GetExtractTypeAndScript(hospitalId);
return new ApiResponse(ResponseType.OK, list);
}
/// <summary>
/// 数据提取详情
/// </summary>
/// <param name="typeId"></param>
/// <param name="scriptId"></param>
/// <returns></returns>
[HttpGet("type/{typeId}/{scriptId}")]
public ApiResponse GetExtractTypeAndScriptById([FromRoute] int typeId, int scriptId)
{
if (typeId == 0) return new ApiResponse(ResponseType.ParameterError, "参数错误");
var data = _preConfigService.GetExtractTypeAndScriptById(typeId, scriptId);
return new ApiResponse(ResponseType.OK, data);
}
/// <summary>
/// 删除提取Sql
/// </summary>
/// <param name="typeId"></param>
/// <param name="scriptId"></param>
/// <returns></returns>
[HttpPost("type/{typeId}/{scriptId}")]
public ApiResponse DeleteExtractTypeAndScript([FromRoute] int typeId, int scriptId)
{
if (typeId == 0) return new ApiResponse(ResponseType.ParameterError, "参数错误");
var flag = _preConfigService.DeleteExtractTypeAndScript(typeId, scriptId);
return flag
? new ApiResponse(ResponseType.OK, "删除成功")
: new ApiResponse(ResponseType.Fail, "删除失败");
}
/// <summary>
/// 保存数据
/// </summary>
/// <param name="hospitalId"></param>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost("type/{hospitalId}/save")]
public ApiResponse EditExtractTypeAndScript([FromRoute] int hospitalId, [FromBody] ExtractConfigResponse request)
{
var flag = _preConfigService.EditExtractTypeAndScript(hospitalId, request);
return flag
? new ApiResponse(ResponseType.OK, "操作成功")
: new ApiResponse(ResponseType.Fail, "操作失败");
}
/// <summary>
/// 执行Sql
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost("type/{typeId}/execute")]
public ApiResponse ExecsqlAndGetResult([FromBody] ConsumeTimeRequest request)
{
if (request == null) return new ApiResponse(ResponseType.ParameterError, "参数错误");
var flag = _preConfigService.ExecsqlAndGetResult(request);
return new ApiResponse(ResponseType.OK, flag);
}
#endregion
#region 字典
/// <summary>
/// 数据库类型
/// </summary>
/// <returns></returns>
[HttpGet("database")]
public ApiResponse<List<TitleValue<int>>> GetDatatypes()
{
var list = ExtractPreConfigService.GetDatatypes();
return new ApiResponse<List<TitleValue<int>>>(ResponseType.OK, list);
}
/// <summary>
/// 来源类型
/// </summary>
/// <returns></returns>
[HttpGet("sheettype")]
public ApiResponse<List<TitleValue<int>>> GetSheettypes()
{
var list = ExtractPreConfigService.GetSheettypes();
return new ApiResponse<List<TitleValue<int>>>(ResponseType.OK, list);
}
/// <summary>
/// 医院数据库连接配置
/// </summary>
/// <param name="hospitalId"></param>
/// <returns></returns>
[HttpGet("config/{hospitalId}")]
public ApiResponse<List<TitleValue<int>>> GetConfigs([FromRoute] int hospitalId)
{
var list = _preConfigService.GetConfigs(hospitalId);
return new ApiResponse<List<TitleValue<int>>>(ResponseType.OK, list);
}
#endregion
} }
} }
\ No newline at end of file
...@@ -3661,7 +3661,7 @@ ...@@ -3661,7 +3661,7 @@
</member> </member>
<member name="P:Performance.EntityModels.ex_script.IsExecSuccess"> <member name="P:Performance.EntityModels.ex_script.IsExecSuccess">
<summary> <summary>
是否执行通过 是否执行通过 0 未执行 1 通过 2 失败
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ex_script.Description"> <member name="P:Performance.EntityModels.ex_script.Description">
......
...@@ -256,14 +256,18 @@ public AutoMapperConfigs() ...@@ -256,14 +256,18 @@ public AutoMapperConfigs()
CreateMap<ex_type, ExtractConfigResponse>() CreateMap<ex_type, ExtractConfigResponse>()
.ForMember(dest => dest.TypeId, opt => opt.MapFrom(src => src.Id)) .ForMember(dest => dest.TypeId, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.Id)) .ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.Title, opt => opt.MapFrom(src => src.EName)) .ForMember(dest => dest.Title, opt => opt.MapFrom(src => src.EName));
.ReverseMap();
CreateMap<ExtractConfigResponse, ex_type>()
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.TypeId));
CreateMap<ex_script, ExtractConfigResponse>() CreateMap<ex_script, ExtractConfigResponse>()
.ForMember(dest => dest.ExScriptId, opt => opt.MapFrom(src => src.Id)) .ForMember(dest => dest.ExScriptId, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.Id)) .ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.Title, opt => opt.MapFrom(src => src.Name)) .ForMember(dest => dest.Title, opt => opt.MapFrom(src => src.Name));
.ReverseMap();
CreateMap<ExtractConfigResponse, ex_script>()
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.ExScriptId));
CreateMap<cof_workitem, WorkItemRequest>() CreateMap<cof_workitem, WorkItemRequest>()
.ReverseMap(); .ReverseMap();
......
...@@ -46,7 +46,7 @@ public class ex_script ...@@ -46,7 +46,7 @@ public class ex_script
public int IsEnable { get; set; } public int IsEnable { get; set; }
/// <summary> /// <summary>
/// 是否执行通过 /// 是否执行通过 0 未执行 1 通过 2 失败
/// </summary> /// </summary>
public int IsExecSuccess { get; set; } public int IsExecSuccess { get; set; }
......
...@@ -78,38 +78,35 @@ public List<ex_module> QueryModule(int hospitalId) ...@@ -78,38 +78,35 @@ public List<ex_module> QueryModule(int hospitalId)
DefaultModules(hospitalId); DefaultModules(hospitalId);
var list = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId).OrderBy(t => t.ModuleName).ToList(); var list = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId).OrderBy(t => t.ModuleName).ToList();
list?.ForEach(t => t.ReadOnly = t.SheetType == (int)SheetType.Income ? 0 : 1);
return list; return list;
} }
public void DefaultModules(int hospitalId) public void DefaultModules(int hospitalId)
{ {
var moduleList = new ex_module[] var moduleList = new List<ex_module>
{ {
new ex_module{ ModuleName = "1.0.1 额外收入", SheetType = (int)SheetType.OtherIncome }, new ex_module{ ModuleName = "1.0.1 额外收入", SheetType = (int)SheetType.OtherIncome, ReadOnly = 0 },
new ex_module{ ModuleName = "1.1.1 门诊开单收入", SheetType = (int)SheetType.Income }, new ex_module{ ModuleName = "1.1.1 门诊开单收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "1.1.2 门诊执行收入", SheetType = (int)SheetType.Income }, new ex_module{ ModuleName = "1.1.2 门诊执行收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "1.2.1 住院开单收入", SheetType = (int)SheetType.Income }, new ex_module{ ModuleName = "1.2.1 住院开单收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "1.2.2 住院执行收入", SheetType = (int)SheetType.Income }, new ex_module{ ModuleName = "1.2.2 住院执行收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "2.1 成本支出统计表", SheetType = (int)SheetType.Expend }, new ex_module{ ModuleName = "2.1 成本支出统计表", SheetType = (int)SheetType.Expend, ReadOnly = 0 },
new ex_module{ ModuleName = "3.1 医生组工作量绩效测算表", SheetType = (int)SheetType.Workload }, new ex_module{ ModuleName = "3.1 医生组工作量绩效测算表", SheetType = (int)SheetType.Workload, ReadOnly = 0 },
new ex_module{ ModuleName = "3.2 护理组工作量绩效测算表", SheetType = (int)SheetType.Workload }, new ex_module{ ModuleName = "3.2 护理组工作量绩效测算表", SheetType = (int)SheetType.Workload, ReadOnly = 0 },
}; };
var data = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId); var data = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId);
var inexistence = (data == null || !data.Any()) ? moduleList : moduleList.Where(t => !data.Any(w => w.ModuleName.StartsWith(t.ModuleName.Split(' ')[0]))); var inexistence = (data == null || !data.Any())
? moduleList
: moduleList.Where(t => !data.Any(w => w.ModuleName.StartsWith(t.ModuleName.Split(' ')[0])))?.ToList();
if (inexistence != null && inexistence.Any()) if (inexistence != null && inexistence.Any())
{ {
var modules = inexistence.Select(t => new ex_module inexistence.ForEach(t =>
{ {
HospitalId = hospitalId, t.HospitalId = hospitalId;
ModuleName = t.ModuleName,
SheetType = (int)t.SheetType,
ReadOnly = t.SheetType == (int)SheetType.Income ? 0 : 1,
TypeId = null,
}); });
exmoduleRepository.AddRange(modules.ToArray()); exmoduleRepository.AddRange(inexistence.ToArray());
} }
} }
......
...@@ -77,7 +77,7 @@ public bool CreateHospitalConfig(sys_hospitalconfig hospitalconfig) ...@@ -77,7 +77,7 @@ public bool CreateHospitalConfig(sys_hospitalconfig hospitalconfig)
var hospital = hospitalRepository.GetEntity(w => w.ID == hospitalconfig.HospitalId); var hospital = hospitalRepository.GetEntity(w => w.ID == hospitalconfig.HospitalId);
if (hospital == null) throw new PerformanceException("医院信息错误"); if (hospital == null) throw new PerformanceException("医院信息错误");
var config = hospitalconfigRepository.GetEntity(w => w.ConfigName == hospitalconfig.ConfigName); var config = hospitalconfigRepository.GetEntity(w => w.ConfigName == hospitalconfig.ConfigName && w.HospitalId == hospitalconfig.HospitalId);
if (config != null) throw new PerformanceException("连接名称重复"); if (config != null) throw new PerformanceException("连接名称重复");
var result = hospitalconfigRepository.Add(hospitalconfig); var result = hospitalconfigRepository.Add(hospitalconfig);
...@@ -97,7 +97,7 @@ public bool UpdateHospitalConfig(sys_hospitalconfig hospitalconfig) ...@@ -97,7 +97,7 @@ public bool UpdateHospitalConfig(sys_hospitalconfig hospitalconfig)
if (!databases.Select(t => t.Value).Contains(hospitalconfig.DataBaseType)) if (!databases.Select(t => t.Value).Contains(hospitalconfig.DataBaseType))
throw new PerformanceException("数据库类型错误"); throw new PerformanceException("数据库类型错误");
var config = hospitalconfigRepository.GetEntity(w => w.ConfigName == hospitalconfig.ConfigName && w.Id != hospitalconfig.Id); var config = hospitalconfigRepository.GetEntity(w => w.ConfigName == hospitalconfig.ConfigName && w.HospitalId == hospitalconfig.HospitalId && w.Id != hospitalconfig.Id);
if (config != null) throw new PerformanceException("连接名称重复"); if (config != null) throw new PerformanceException("连接名称重复");
var entity = hospitalconfigRepository.GetEntity(w => w.Id == hospitalconfig.Id); var entity = hospitalconfigRepository.GetEntity(w => w.Id == hospitalconfig.Id);
...@@ -247,10 +247,8 @@ public bool DeleteExtractTypeAndScript(int typeId, int scriptId) ...@@ -247,10 +247,8 @@ public bool DeleteExtractTypeAndScript(int typeId, int scriptId)
if (extype == null) throw new PerformanceException("参数typeId无效"); if (extype == null) throw new PerformanceException("参数typeId无效");
var scripts = exscriptRepository.GetEntities(w => w.TypeId == typeId); var scripts = exscriptRepository.GetEntities(w => w.TypeId == typeId);
if (scripts == null || !scripts.Any()) return true; if (scripts != null && scripts.Any() && !exscriptRepository.RemoveRange(scripts.ToArray()))
throw new PerformanceException("提取语句删除失败");
if (!exscriptRepository.RemoveRange(scripts.ToArray()))
if (extype == null) throw new PerformanceException("提取语句删除失败");
return extypeRepository.Remove(extype); return extypeRepository.Remove(extype);
} }
...@@ -265,7 +263,7 @@ public bool EditExtractTypeAndScript(int hospitalId, ExtractConfigResponse reque ...@@ -265,7 +263,7 @@ public bool EditExtractTypeAndScript(int hospitalId, ExtractConfigResponse reque
var sheettypes = GetSheettypes(); var sheettypes = GetSheettypes();
if (!sheettypes.Any(w => w.Value == request.Source)) throw new PerformanceException("暂不支持该类型"); if (!sheettypes.Any(w => w.Value == request.Source)) throw new PerformanceException("暂不支持该类型");
var type = extypeRepository.GetEntity(w => w.EName == request.EName && w.Id != request.TypeId); var type = extypeRepository.GetEntity(w => w.EName == request.EName && w.HospitalId == hospitalId && w.Id != request.TypeId);
if (type != null) throw new PerformanceException("费用名称重复"); if (type != null) throw new PerformanceException("费用名称重复");
if (request.TypeId == 0) if (request.TypeId == 0)
...@@ -324,7 +322,7 @@ public bool EditExtractTypeAndScript(int hospitalId, ExtractConfigResponse reque ...@@ -324,7 +322,7 @@ public bool EditExtractTypeAndScript(int hospitalId, ExtractConfigResponse reque
return true; return true;
} }
public decimal CheckExecsqlConsumeTime(ConsumeTimeRequest request) public dynamic ExecsqlAndGetResult(ConsumeTimeRequest request)
{ {
var config = hospitalconfigRepository.GetEntity(w => w.Id == request.ConfigId); var config = hospitalconfigRepository.GetEntity(w => w.Id == request.ConfigId);
if (config == null) throw new PerformanceException("数据库配置资源无效"); if (config == null) throw new PerformanceException("数据库配置资源无效");
...@@ -332,84 +330,56 @@ public decimal CheckExecsqlConsumeTime(ConsumeTimeRequest request) ...@@ -332,84 +330,56 @@ public decimal CheckExecsqlConsumeTime(ConsumeTimeRequest request)
var script = exscriptRepository.GetEntity(w => w.Id == request.ExScriptId); var script = exscriptRepository.GetEntity(w => w.Id == request.ExScriptId);
if (request.ExScriptId != 0 && script == null) throw new PerformanceException("参数无效"); if (request.ExScriptId != 0 && script == null) throw new PerformanceException("参数无效");
IEnumerable<dynamic> data = null;
try try
{ {
if (request.Month == 0 || request.Year == 0) var begindate = request.Month > 0 && request.Year > 0 ? new DateTime(request.Year, request.Month, 1) : DateTime.Now.AddMonths(-1);
{ var enddate = begindate.AddMonths(1);
request.Month = DateTime.Now.Month;
request.Year = DateTime.Now.Year;
}
var param = new var param = new
{ {
beginDate = $"{(request.Month == 1 ? request.Year - 1 : request.Year)}-{(request.Month == 1 ? 12 : request.Month - 1).ToString().PadLeft(2, '0')}", beginTime = $"{begindate.Year}-{begindate.Month.ToString().PadLeft(2, '0')}",
endDate = $"{request.Year}-{request.Month.ToString().PadLeft(2, '0')}" endTime = $"{enddate.Year}-{enddate.Month.ToString().PadLeft(2, '0')}"
}; };
Stopwatch stopwatch = new Stopwatch(); Stopwatch stopwatch = new Stopwatch();
stopwatch.Start(); stopwatch.Start();
var data = queryService.QueryData<dynamic>(config, request.ExecScript, param); data = queryService.QueryData<dynamic>(config, request.ExecScript, param);
stopwatch.Stop(); stopwatch.Stop();
var timing = Math.Ceiling(stopwatch.ElapsedMilliseconds / 1000m); var timing = Math.Ceiling(stopwatch.ElapsedMilliseconds / 1000m);
if (script == null) return timing; if (script != null)
{
script.TimeConsuming = timing; script.TimeConsuming = timing;
script.IsExecSuccess = 1; script.IsExecSuccess = 1;
} }
}
catch (Exception ex) catch (Exception ex)
{ {
if (script == null) throw new PerformanceException(""); if (script != null)
{
script.IsExecSuccess = 0; script.IsExecSuccess = 2;
script.Description = ex.Message; script.Description = ex.Message;
} }
exscriptRepository.Update(script); throw new PerformanceException("查询语句时发生异常");
return script.TimeConsuming;
} }
finally
#endregion
#region Model Item Special
public void CreateDefaultModeul(int hospitalId)
{
var moduleList = new List<ex_module>
{ {
new ex_module{ ModuleName = "1.0.1 额外收入", SheetType = (int)SheetType.OtherIncome, ReadOnly = 0 }, if (script != null) exscriptRepository.Update(script);
new ex_module{ ModuleName = "1.1.1 门诊开单收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "1.1.2 门诊执行收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "1.2.1 住院开单收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "1.2.2 住院执行收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "2.1 成本支出统计表", SheetType = (int)SheetType.Expend, ReadOnly = 0 },
new ex_module{ ModuleName = "3.1 医生组工作量绩效测算表", SheetType = (int)SheetType.Workload, ReadOnly = 0 },
new ex_module{ ModuleName = "3.2 护理组工作量绩效测算表", SheetType = (int)SheetType.Workload, ReadOnly = 0 },
};
var data = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId);
var inexistence = data == null ? moduleList : moduleList.Where(t => !data.Any(w => w.ModuleName.StartsWith(t.ModuleName.Split(' ')[0])))?.ToList();
if (inexistence != null && inexistence.Any())
{
inexistence.ForEach(t =>
{
t.HospitalId = hospitalId;
});
exmoduleRepository.AddRange(inexistence.ToArray());
}
} }
public List<ex_module> GetExModelList(int hospitalId) if (data == null || !data.Any()) throw new PerformanceException("查询结果为空");
{
return new List<ex_module>(); var header = ((IDictionary<string, object>)data.ElementAt(0)).Keys;
return new { header, data };
} }
#endregion #endregion
#region 字典 #region 字典
public List<TitleValue<int>> GetDatatypes() public static List<TitleValue<int>> GetDatatypes()
{ {
return EnumHelper.GetItems<DatabaseType>().Select(t => new TitleValue<int> return EnumHelper.GetItems<DatabaseType>().Select(t => new TitleValue<int>
{ {
...@@ -418,7 +388,7 @@ public List<TitleValue<int>> GetDatatypes() ...@@ -418,7 +388,7 @@ public List<TitleValue<int>> GetDatatypes()
}).ToList(); }).ToList();
} }
public List<TitleValue<int>> GetSheettypes() public static List<TitleValue<int>> GetSheettypes()
{ {
var showItems = new int[] var showItems = new int[]
{ {
......
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