Commit 0bcf471a by lcx

抽取相关修改

parent 04817020
......@@ -17,11 +17,11 @@ namespace Performance.Api.Controllers
[ApiController]
public class ExConfigController : Controller
{
private readonly ILogger<ModExtractController> logger;
private readonly ILogger<ExConfigController> logger;
private ExConfigService configService;
private WebapiUrl url;
public ExConfigController(
ILogger<ModExtractController> logger,
ILogger<ExConfigController> logger,
ExConfigService configService,
IOptions<WebapiUrl> url)
{
......
......@@ -24,8 +24,7 @@ namespace Performance.Api.Controllers
public class TemplateController : Controller
{
private readonly TemplateService templateService;
private readonly ExtractService extractService;
private readonly NewExtractService newExtractService;
private readonly DFExtractService extractService;
private HospitalService hospitalService;
private IHostingEnvironment env;
private ClaimService claim;
......@@ -36,8 +35,7 @@ public class TemplateController : Controller
public TemplateController(TemplateService templateService,
HospitalService hospitalService,
ExtractService extractService,
NewExtractService newExtractService,
DFExtractService extractService,
IHostingEnvironment env,
ClaimService claim,
IOptions<Application> options,
......@@ -47,7 +45,6 @@ public class TemplateController : Controller
{
this.templateService = templateService;
this.extractService = extractService;
this.newExtractService = newExtractService;
this.hospitalService = hospitalService;
this.env = env;
this.claim = claim;
......@@ -145,66 +142,66 @@ public ApiResponse Import([FromForm] IFormCollection form)
}
#region 老版提取
/// <summary>
/// 提取绩效数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("extractdata")]
[HttpPost]
public ApiResponse ExtractData([CustomizeValidator(RuleSet = "Template"), FromBody]AllotRequest request)
{
try
{
var allot = allotService.GetAllot(request.ID);
if (allot == null)
return new ApiResponse(ResponseType.Fail, "该绩效无效");
allot.IsExtracting = allot.IsExtracting ?? 0;
if (allot.IsExtracting == 1)
return new ApiResponse(ResponseType.Fail, "正在提取数据,请稍等。");
///// <summary>
///// 提取绩效数据
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("extractdata")]
//[HttpPost]
//public ApiResponse ExtractData([CustomizeValidator(RuleSet = "Template"), FromBody]AllotRequest request)
//{
// try
// {
// var allot = allotService.GetAllot(request.ID);
// if (allot == null)
// return new ApiResponse(ResponseType.Fail, "该绩效无效");
// allot.IsExtracting = allot.IsExtracting ?? 0;
// if (allot.IsExtracting == 1)
// return new ApiResponse(ResponseType.Fail, "正在提取数据,请稍等。");
var hospital = hospitalService.GetHopital(request.HospitalId.Value);
if (hospital == null)
return new ApiResponse(ResponseType.Fail, "医院无效");
// var hospital = hospitalService.GetHopital(request.HospitalId.Value);
// if (hospital == null)
// return new ApiResponse(ResponseType.Fail, "医院无效");
var email = claim.GetUserClaim(JwtClaimTypes.Mail);
allot.IsExtracting = 1;
allotService.Update(allot);
string path = extractService.GetFilepath(hospital.ID, out int type);
if (!string.IsNullOrEmpty(path) && type != 0)
{
//发送请求,返回路径
string retJson = HttpHelper.HttpClient(url.ImportFirst + $"?type={type}&hospitalId={hospital.ID}&year={allot.Year}&month={allot.Month}", path);
var ret = JsonHelper.Deserialize<ApiResponse>(retJson);
if ((int)ret.State != 1)
return new ApiResponse(ResponseType.Fail, "首次模板地址无效!");
path = ret.Message;
}
// var email = claim.GetUserClaim(JwtClaimTypes.Mail);
// allot.IsExtracting = 1;
// allotService.Update(allot);
// string path = extractService.GetFilepath(hospital.ID, out int type);
// if (!string.IsNullOrEmpty(path) && type != 0)
// {
// //发送请求,返回路径
// string retJson = HttpHelper.HttpClient(url.ImportFirst + $"?type={type}&hospitalId={hospital.ID}&year={allot.Year}&month={allot.Month}", path);
// var ret = JsonHelper.Deserialize<ApiResponse>(retJson);
// if ((int)ret.State != 1)
// return new ApiResponse(ResponseType.Fail, "首次模板地址无效!");
// path = ret.Message;
// }
string param = JsonHelper.Serialize(new
{
id = request.ID,
hospitalId = hospital.ID,
mail = email,
path = path
});
// string param = JsonHelper.Serialize(new
// {
// id = request.ID,
// hospitalId = hospital.ID,
// mail = email,
// path = path
// });
HttpHelper.HttpPostNoRequest(url.ExtractData, param, true);
//extractService.ExtractData(request.ID, user.Mail, hospital);
//BackgroundJob.Enqueue(() => extractService.ExtractData(request.ID, user.Mail, hospital));
return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!");
}
catch (Exception ex)
{
var allot = allotService.GetAllot(request.ID);
if (allot != null)
{
allot.IsExtracting = 3;
allotService.Update(allot);
}
throw ex;
}
}
// HttpHelper.HttpPostNoRequest(url.ExtractData, param, true);
// //extractService.ExtractData(request.ID, user.Mail, hospital);
// //BackgroundJob.Enqueue(() => extractService.ExtractData(request.ID, user.Mail, hospital));
// return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!");
// }
// catch (Exception ex)
// {
// var allot = allotService.GetAllot(request.ID);
// if (allot != null)
// {
// allot.IsExtracting = 3;
// allotService.Update(allot);
// }
// throw ex;
// }
//}
#endregion
#region 新版提取
......@@ -223,7 +220,7 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody]ExtractRequest r
// 判断是那种抽取
try
{
string message = newExtractService.Judge(request.AllotId, request.HospitalId, request.UseScheme, out string filePath);
string message = extractService.Judge(request.AllotId, request.HospitalId, request.UseScheme, out string filePath);
if (!string.IsNullOrEmpty(message))
return new ApiResponse(ResponseType.Fail, message);
......
......@@ -21,6 +21,6 @@ public class SpecialListRequest
public int HospitalId { get; set; }
/// <summary> 特殊考核项 </summary>
public List<mod_special> Items { get; set; }
public List<ex_special> Items { get; set; }
}
}
......@@ -54,6 +54,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public virtual DbSet<cof_again> cof_again { get; set; }
/// <summary> 上传excel文件校验配置 </summary>
public virtual DbSet<cof_check> cof_check { get; set; }
/// <summary> 科室类型 </summary>
public virtual DbSet<cof_depttype> cof_depttype { get; set; }
/// <summary> 规模绩效、效率绩效计算系数配置 </summary>
public virtual DbSet<cof_director> cof_director { get; set; }
/// <summary> 工作量门诊药占比系数 </summary>
......@@ -79,6 +81,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
/// <summary> </summary>
public virtual DbSet<ex_script> ex_script { get; set; }
/// <summary> </summary>
public virtual DbSet<ex_special> ex_special { get; set; }
/// <summary> </summary>
public virtual DbSet<ex_type> ex_type { get; set; }
/// <summary> </summary>
public virtual DbSet<hos_personfee> hos_personfee { get; set; }
......@@ -100,14 +104,14 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public virtual DbSet<log_dbug> log_dbug { get; set; }
/// <summary> 部分公共数据抽取SQL </summary>
public virtual DbSet<mod_dic> mod_dic { get; set; }
/// <summary> 医院数据提取脚本 </summary>
public virtual DbSet<mod_extract> mod_extract { get; set; }
/// <summary> </summary>
public virtual DbSet<mod_item> mod_item { get; set; }
/// <summary> </summary>
public virtual DbSet<mod_module> mod_module { get; set; }
/// <summary> </summary>
public virtual DbSet<mod_special> mod_special { get; set; }
///// <summary> 医院数据提取脚本 </summary>
// public virtual DbSet<mod_extract> mod_extract { get; set; }
///// <summary> </summary>
// public virtual DbSet<mod_item> mod_item { get; set; }
///// <summary> </summary>
// public virtual DbSet<mod_module> mod_module { get; set; }
///// <summary> </summary>
// public virtual DbSet<mod_special> mod_special { get; set; }
/// <summary> </summary>
public virtual DbSet<per_againallot> per_againallot { get; set; }
/// <summary> 医院绩效分配 </summary>
......
......@@ -30,5 +30,15 @@ public class ag_workload_type
///
/// </summary>
public string TypeName { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 科室类型
/// </summary>
public string UnitType { get; set; }
}
}
//-----------------------------------------------------------------------
// <copyright file=" cof_depttype.cs">
// * FileName: 科室类型.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
/// 科室类型
/// </summary>
[Table("cof_depttype")]
public class cof_depttype
{
/// <summary>
///
/// </summary>
[Key]
public int ID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> AllotID { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Charge { get; set; }
/// <summary>
/// 可是分类
/// </summary>
public string ChargeType { get; set; }
}
}
......@@ -22,6 +22,11 @@ public class ex_result
public int Id { get; set; }
/// <summary>
///
/// </summary>
public int AllotId { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
......@@ -39,11 +44,16 @@ public class ex_result
/// <summary>
/// 来源
/// </summary>
public int Source { get; set; }
public string Source { get; set; }
/// <summary>
/// 数据库类型1、Sql Server 2、Orcale
/// </summary>
public int DatabaseType { get; set; }
/// <summary>
/// 数据库配置Id
/// </summary>
public int ConfigId { get; set; }
}
}
//-----------------------------------------------------------------------
// <copyright file=" ex_special.cs">
// * FileName: .cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
///
/// </summary>
[Table("ex_special")]
public class ex_special
{
/// <summary>
///
/// </summary>
[Key]
public int Id { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> HospitalId { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 量化指标
/// </summary>
public string Target { get; set; }
/// <summary>
/// 量化指标绩效分值
/// </summary>
public Nullable<decimal> TargetFactor { get; set; }
/// <summary>
/// 调节系数
/// </summary>
public Nullable<decimal> AdjustFactor { get; set; }
/// <summary>
/// 抽取绩效值SQL
/// </summary>
public Nullable<int> TypeId { get; set; }
/// <summary>
/// 数据库地址
/// </summary>
public Nullable<int> ConfigId { get; set; }
}
}
......@@ -205,5 +205,15 @@ public class im_accountbasic
/// 工作量倾斜系数
/// </summary>
public Nullable<decimal> WorkSlopeFactor { get; set; }
/// <summary>
///
/// </summary>
public Nullable<DateTime> UpdateDate { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> UpdateUser { get; set; }
}
}
......@@ -95,5 +95,15 @@ public class im_data
///
/// </summary>
public string SignID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<DateTime> UpdateDate { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> UpdateUser { get; set; }
}
}
......@@ -125,5 +125,15 @@ public class im_employee
/// 发放系数
/// </summary>
public Nullable<decimal> Grant { get; set; }
/// <summary>
///
/// </summary>
public Nullable<DateTime> UpdateDate { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> UpdateUser { get; set; }
}
}
......@@ -130,5 +130,15 @@ public class im_employee_clinic
/// 发放系数
/// </summary>
public Nullable<decimal> Grant { get; set; }
/// <summary>
///
/// </summary>
public Nullable<DateTime> UpdateDate { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> UpdateUser { get; set; }
}
}
......@@ -75,5 +75,15 @@ public class im_header
/// 1 汇总 2原始数据
/// </summary>
public Nullable<int> IsTotal { get; set; }
/// <summary>
///
/// </summary>
public Nullable<DateTime> UpdateDate { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> UpdateUser { get; set; }
}
}
......@@ -80,5 +80,15 @@ public class im_specialunit
/// 调节系数
/// </summary>
public Nullable<decimal> Adjust { get; set; }
/// <summary>
///
/// </summary>
public Nullable<DateTime> UpdateDate { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> UpdateUser { get; set; }
}
}
//-----------------------------------------------------------------------
// <copyright file=" mod_extract.cs">
// * FileName: 医院数据提取脚本.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
/// 医院数据提取脚本
/// </summary>
[Table("mod_extract")]
public class mod_extract
{
/// <summary>
///
/// </summary>
[Key]
public int Id { get; set; }
/// <summary>
/// 医院ID
/// </summary>
public Nullable<int> HospitalId { get; set; }
/// <summary>
/// 当前脚本提取内容名称
/// </summary>
public string EName { get; set; }
/// <summary>
/// 执行脚本
/// </summary>
public string ExecuteScript { get; set; }
/// <summary>
/// 当前脚本类型 1 收入整表 2 单项数据提取
/// </summary>
public Nullable<int> ExecuteType { get; set; }
/// <summary>
/// 数据库来源类型 1 标准库 2 绩效库
/// </summary>
public Nullable<int> SourceType { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 是否可用 1 可用 2 不可用
/// </summary>
public Nullable<int> IsEnable { get; set; }
}
}
////-----------------------------------------------------------------------
//// <copyright file=" mod_extract.cs">
//// * FileName: 医院数据提取脚本.cs
//// </copyright>
////-----------------------------------------------------------------------
//using System;
//using System.ComponentModel.DataAnnotations;
//using System.ComponentModel.DataAnnotations.Schema;
//namespace Performance.EntityModels
//{
// /// <summary>
// /// 医院数据提取脚本
// /// </summary>
// [Table("mod_extract")]
// public class mod_extract
// {
// /// <summary>
// ///
// /// </summary>
// [Key]
// public int Id { get; set; }
// /// <summary>
// /// 医院ID
// /// </summary>
// public Nullable<int> HospitalId { get; set; }
// /// <summary>
// /// 当前脚本提取内容名称
// /// </summary>
// public string EName { get; set; }
// /// <summary>
// /// 执行脚本
// /// </summary>
// public string ExecuteScript { get; set; }
// /// <summary>
// /// 当前脚本类型 1 收入整表 2 单项数据提取
// /// </summary>
// public Nullable<int> ExecuteType { get; set; }
// /// <summary>
// /// 数据库来源类型 1 标准库 2 绩效库
// /// </summary>
// public Nullable<int> SourceType { get; set; }
// /// <summary>
// /// 描述
// /// </summary>
// public string Description { get; set; }
// /// <summary>
// /// 是否可用 1 可用 2 不可用
// /// </summary>
// public Nullable<int> IsEnable { get; set; }
// }
//}
//-----------------------------------------------------------------------
// <copyright file=" mod_item.cs">
// * FileName: .cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
////-----------------------------------------------------------------------
//// <copyright file=" mod_item.cs">
//// * FileName: .cs
//// </copyright>
////-----------------------------------------------------------------------
//using System;
//using System.ComponentModel.DataAnnotations;
//using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
///
/// </summary>
[Table("mod_item")]
public class mod_item
{
/// <summary>
///
/// </summary>
[Key]
public int Id { get; set; }
//namespace Performance.EntityModels
//{
// /// <summary>
// ///
// /// </summary>
// [Table("mod_item")]
// public class mod_item
// {
// /// <summary>
// ///
// /// </summary>
// [Key]
// public int Id { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> ModuleId { get; set; }
// /// <summary>
// ///
// /// </summary>
// public Nullable<int> ModuleId { get; set; }
/// <summary>
/// 绩效考核项
/// </summary>
public string ItemName { get; set; }
// /// <summary>
// /// 绩效考核项
// /// </summary>
// public string ItemName { get; set; }
/// <summary>
/// 默认系数或医生系数
/// </summary>
public Nullable<decimal> FactorValue1 { get; set; }
// /// <summary>
// /// 默认系数或医生系数
// /// </summary>
// public Nullable<decimal> FactorValue1 { get; set; }
/// <summary>
/// 护理系数
/// </summary>
public Nullable<decimal> FactorValue2 { get; set; }
// /// <summary>
// /// 护理系数
// /// </summary>
// public Nullable<decimal> FactorValue2 { get; set; }
/// <summary>
/// 医技系数
/// </summary>
public Nullable<decimal> FactorValue3 { get; set; }
// /// <summary>
// /// 医技系数
// /// </summary>
// public Nullable<decimal> FactorValue3 { get; set; }
/// <summary>
/// 抽取绩效值SQL
/// </summary>
public Nullable<int> ExtractId { get; set; }
// /// <summary>
// /// 抽取绩效值SQL
// /// </summary>
// public Nullable<int> ExtractId { get; set; }
/// <summary>
/// 数据库地址
/// </summary>
public Nullable<int> ConfigId { get; set; }
// /// <summary>
// /// 数据库地址
// /// </summary>
// public Nullable<int> ConfigId { get; set; }
/// <summary>
/// 用户选定抽取范围
/// </summary>
public string SelectionRange { get; set; }
// /// <summary>
// /// 用户选定抽取范围
// /// </summary>
// public string SelectionRange { get; set; }
/// <summary>
/// 只读 0、否 1、是
/// </summary>
public Nullable<int> ReadOnly { get; set; }
}
}
// /// <summary>
// /// 只读 0、否 1、是
// /// </summary>
// public Nullable<int> ReadOnly { get; set; }
// }
//}
//-----------------------------------------------------------------------
// <copyright file=" mod_module.cs">
// * FileName: .cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
////-----------------------------------------------------------------------
//// <copyright file=" mod_module.cs">
//// * FileName: .cs
//// </copyright>
////-----------------------------------------------------------------------
//using System;
//using System.ComponentModel.DataAnnotations;
//using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
///
/// </summary>
[Table("mod_module")]
public class mod_module
{
/// <summary>
///
/// </summary>
[Key]
public int Id { get; set; }
//namespace Performance.EntityModels
//{
// /// <summary>
// ///
// /// </summary>
// [Table("mod_module")]
// public class mod_module
// {
// /// <summary>
// ///
// /// </summary>
// [Key]
// public int Id { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> HospitalId { get; set; }
// /// <summary>
// ///
// /// </summary>
// public Nullable<int> HospitalId { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> SheetType { get; set; }
// /// <summary>
// ///
// /// </summary>
// public Nullable<int> SheetType { get; set; }
/// <summary>
///
/// </summary>
public string ModuleName { get; set; }
// /// <summary>
// ///
// /// </summary>
// public string ModuleName { get; set; }
/// <summary>
///
/// </summary>
public string Description { get; set; }
// /// <summary>
// ///
// /// </summary>
// public string Description { get; set; }
/// <summary>
/// 提取脚本ID
/// </summary>
public Nullable<int> ExtractId { get; set; }
// /// <summary>
// /// 提取脚本ID
// /// </summary>
// public Nullable<int> ExtractId { get; set; }
/// <summary>
/// 数据库地址
/// </summary>
public Nullable<int> ConfigId { get; set; }
// /// <summary>
// /// 数据库地址
// /// </summary>
// public Nullable<int> ConfigId { get; set; }
/// <summary>
/// 只读 0、否 1、是
/// </summary>
public Nullable<int> ReadOnly { get; set; }
// /// <summary>
// /// 只读 0、否 1、是
// /// </summary>
// public Nullable<int> ReadOnly { get; set; }
/// <summary>
/// 是否生成Item 0、否 1、是
/// </summary>
public Nullable<int> IsGenerated { get; set; }
}
}
// /// <summary>
// /// 是否生成Item 0、否 1、是
// /// </summary>
// public Nullable<int> IsGenerated { get; set; }
// }
//}
//-----------------------------------------------------------------------
// <copyright file=" mod_special.cs">
// * FileName: .cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
///
/// </summary>
[Table("mod_special")]
public class mod_special
{
/// <summary>
///
/// </summary>
[Key]
public int Id { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> HospitalId { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 量化指标
/// </summary>
public string Target { get; set; }
/// <summary>
/// 量化指标绩效分值
/// </summary>
public Nullable<decimal> TargetFactor { get; set; }
/// <summary>
/// 调节系数
/// </summary>
public Nullable<decimal> AdjustFactor { get; set; }
/// <summary>
/// 抽取绩效值SQL
/// </summary>
public Nullable<int> ExtractId { get; set; }
/// <summary>
/// 数据库地址
/// </summary>
public Nullable<int> ConfigId { get; set; }
}
}
////-----------------------------------------------------------------------
//// <copyright file=" mod_special.cs">
//// * FileName: .cs
//// </copyright>
////-----------------------------------------------------------------------
//using System;
//using System.ComponentModel.DataAnnotations;
//using System.ComponentModel.DataAnnotations.Schema;
//namespace Performance.EntityModels
//{
// /// <summary>
// ///
// /// </summary>
// [Table("mod_special")]
// public class mod_special
// {
// /// <summary>
// ///
// /// </summary>
// [Key]
// public int Id { get; set; }
// /// <summary>
// ///
// /// </summary>
// public Nullable<int> HospitalId { get; set; }
// /// <summary>
// /// 科室
// /// </summary>
// public string Department { get; set; }
// /// <summary>
// /// 量化指标
// /// </summary>
// public string Target { get; set; }
// /// <summary>
// /// 量化指标绩效分值
// /// </summary>
// public Nullable<decimal> TargetFactor { get; set; }
// /// <summary>
// /// 调节系数
// /// </summary>
// public Nullable<decimal> AdjustFactor { get; set; }
// /// <summary>
// /// 抽取绩效值SQL
// /// </summary>
// public Nullable<int> ExtractId { get; set; }
// /// <summary>
// /// 数据库地址
// /// </summary>
// public Nullable<int> ConfigId { get; set; }
// }
//}
......@@ -82,7 +82,7 @@ public class per_allot
public Nullable<int> IsExtracting { get; set; }
/// <summary>
/// 1、人事科提交重新生成
/// 1、人事科提交重新生成 2、生成成功 3、原始数据修改
/// </summary>
public int Generate { get; set; }
......
......@@ -21,24 +21,18 @@ namespace Performance.Extract.Api.Controllers
[Route("api/[controller]")]
public class ExtractController : Controller
{
private readonly ExtractService extractService;
private readonly NewExtractService newExtractService;
private readonly DFExtractService dfExtractService;
private readonly DFExtractService extractService;
private readonly HospitalService hospitalService;
private readonly WebapiUrl url;
private readonly ILogger<ExtractController> logger;
private readonly IHostingEnvironment evn;
public ExtractController(ExtractService extractService,
NewExtractService newExtractService,
DFExtractService dfExtractService,
public ExtractController(DFExtractService extractService,
HospitalService hospitalService,
IOptions<WebapiUrl> url,
ILogger<ExtractController> logger,
IHostingEnvironment evn)
{
this.extractService = extractService;
this.newExtractService = newExtractService;
this.dfExtractService = dfExtractService;
this.hospitalService = hospitalService;
this.url = url.Value;
this.logger = logger;
......@@ -80,34 +74,34 @@ public ApiResponse Import([FromForm] IFormCollection form, int type, int hospita
return new ApiResponse(ResponseType.Error, "获取首次文件失败!");
}
/// <summary>
/// 提取数据
/// </summary>
/// <param name="request"></param>
[HttpPost]
[Route("index")]
public void Index([FromBody]AllotRequest request)
{
var token = Guid.NewGuid().ToString("N");
logger.LogInformation(token + ",开始提取数据,请求参数:" + JsonHelper.Serialize(request));
var hospital = hospitalService.GetHopital(request.HospitalId.Value);
var filepath = extractService.ExtractData(request.ID, request.Mail, hospital, request.Path);
if (!string.IsNullOrEmpty(filepath) && FileHelper.IsExistFile(filepath))
{
int i = 1;
while (i <= 5)
{
string retJson = HttpHelper.HttpClient(url.ImportFile + $"?allotId={request.ID}&hospitalId={hospital.ID}", filepath);
logger.LogInformation(retJson);
var ret = JsonHelper.Deserialize<ApiResponse>(retJson);
if ((int)ret.State == 1)
break;
i++;
}
}
logger.LogInformation(token + ",提取结束,请求参数:" + JsonHelper.Serialize(request));
}
///// <summary>
///// 提取数据
///// </summary>
///// <param name="request"></param>
//[HttpPost]
//[Route("index")]
//public void Index([FromBody]AllotRequest request)
//{
// var token = Guid.NewGuid().ToString("N");
// logger.LogInformation(token + ",开始提取数据,请求参数:" + JsonHelper.Serialize(request));
// var hospital = hospitalService.GetHopital(request.HospitalId.Value);
// var filepath = extractService.ExtractData(request.ID, request.Mail, hospital, request.Path);
// if (!string.IsNullOrEmpty(filepath) && FileHelper.IsExistFile(filepath))
// {
// int i = 1;
// while (i <= 5)
// {
// string retJson = HttpHelper.HttpClient(url.ImportFile + $"?allotId={request.ID}&hospitalId={hospital.ID}", filepath);
// logger.LogInformation(retJson);
// var ret = JsonHelper.Deserialize<ApiResponse>(retJson);
// if ((int)ret.State == 1)
// break;
// i++;
// }
// }
// logger.LogInformation(token + ",提取结束,请求参数:" + JsonHelper.Serialize(request));
//}
#region 新版提取
......@@ -155,7 +149,7 @@ public void ExtractData([FromForm] IFormCollection form, int allotId, int hospit
#endregion
//string filePath = newExtractService.ExtractData(allotId, request.Email, hospitalId);
string filePath = dfExtractService.ExtractData(allotId, email, hospitalId, path); //抽取
string filePath = extractService.ExtractData(allotId, email, hospitalId, path); //抽取
#region 保存文件到网站下
......
......@@ -15,13 +15,13 @@ namespace Performance.Extract.Api.Controllers
public class ModExtractController : Controller
{
private readonly ILogger<ModExtractController> logger;
private ModExtractService modExtractService;
private ExConfigService service;
public ModExtractController(
ILogger<ModExtractController> logger,
ModExtractService modExtractService)
ExConfigService service)
{
this.logger = logger;
this.modExtractService = modExtractService;
this.service = service;
}
/// <summary>
......@@ -37,7 +37,7 @@ public ApiResponse Extract([CustomizeValidator(RuleSet = "Query"), FromBody]ModM
if (request.ExecuteType == null || !request.ExecuteType.Any())
return new ApiResponse(ResponseType.ParameterError, "ExecuteType 不存在,请重新选择!");
var list = modExtractService.ExtractScheme(request.HospitalId.Value, request.ExecuteType);
var list = service.ExtractScheme(request.HospitalId.Value, request.ExecuteType);
return new ApiResponse(ResponseType.OK, list);
}
......@@ -49,7 +49,7 @@ public ApiResponse Extract([CustomizeValidator(RuleSet = "Query"), FromBody]ModM
[HttpPost]
public ApiResponse FeeType()
{
var list = modExtractService.FeeType();
var list = service.FeeType();
return new ApiResponse(ResponseType.OK, list);
}
......@@ -65,7 +65,7 @@ public ApiResponse FeeSource([FromBody]ModModuleRequest request)
return new ApiResponse(ResponseType.ParameterError, "HospitalId 参数错误!");
logger.LogInformation($"请求参数绩效考核项费用来源:{JsonHelper.Serialize(request)}");
var list = modExtractService.FeeSource(request);
var list = service.FeeSource(request);
return new ApiResponse(ResponseType.OK, list);
}
......@@ -78,7 +78,7 @@ public ApiResponse FeeSource([FromBody]ModModuleRequest request)
public ApiResponse Items([FromBody]ModItemRequest request)
{
logger.LogInformation($"绩效收入模板配置项列表:{JsonHelper.Serialize(request)}");
modExtractService.AddItems(request.ModuleId.Value);
service.AddItems(request.ModuleId.Value);
return new ApiResponse(ResponseType.OK);
}
}
......
......@@ -6,6 +6,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
......
//-----------------------------------------------------------------------
// <copyright file=" cof_depttype.cs">
// * FileName: cof_depttype.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// cof_depttype Repository
/// </summary>
public partial class PerforCofdepttypeRepository : PerforRepository<cof_depttype>
{
public PerforCofdepttypeRepository(PerformanceDbContext context) : base(context)
{
}
}
}
//-----------------------------------------------------------------------
// <copyright file=" ex_special.cs">
// * FileName: ex_special.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// ex_special Repository
/// </summary>
public partial class PerforExspecialRepository : PerforRepository<ex_special>
{
public PerforExspecialRepository(PerformanceDbContext context) : base(context)
{
}
}
}
//-----------------------------------------------------------------------
// <copyright file=" mod_extract.cs">
// * FileName: mod_extract.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
////-----------------------------------------------------------------------
//// <copyright file=" mod_extract.cs">
//// * FileName: mod_extract.cs
//// </copyright>
////-----------------------------------------------------------------------
//using System;
//using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// mod_extract Repository
/// </summary>
public partial class PerforModextractRepository : PerforRepository<mod_extract>
{
public PerforModextractRepository(PerformanceDbContext context) : base(context)
{
}
}
}
//namespace Performance.Repository
//{
// /// <summary>
// /// mod_extract Repository
// /// </summary>
// public partial class PerforModextractRepository : PerforRepository<mod_extract>
// {
// public PerforModextractRepository(PerformanceDbContext context) : base(context)
// {
// }
// }
//}
//-----------------------------------------------------------------------
// <copyright file=" mod_item.cs">
// * FileName: mod_item.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
////-----------------------------------------------------------------------
//// <copyright file=" mod_item.cs">
//// * FileName: mod_item.cs
//// </copyright>
////-----------------------------------------------------------------------
//using System;
//using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// mod_item Repository
/// </summary>
public partial class PerforModitemRepository : PerforRepository<mod_item>
{
public PerforModitemRepository(PerformanceDbContext context) : base(context)
{
}
}
}
//namespace Performance.Repository
//{
// /// <summary>
// /// mod_item Repository
// /// </summary>
// public partial class PerforModitemRepository : PerforRepository<mod_item>
// {
// public PerforModitemRepository(PerformanceDbContext context) : base(context)
// {
// }
// }
//}
//-----------------------------------------------------------------------
// <copyright file=" mod_module.cs">
// * FileName: mod_module.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
////-----------------------------------------------------------------------
//// <copyright file=" mod_module.cs">
//// * FileName: mod_module.cs
//// </copyright>
////-----------------------------------------------------------------------
//using System;
//using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// mod_module Repository
/// </summary>
public partial class PerforModmoduleRepository : PerforRepository<mod_module>
{
public PerforModmoduleRepository(PerformanceDbContext context) : base(context)
{
}
}
}
//namespace Performance.Repository
//{
// /// <summary>
// /// mod_module Repository
// /// </summary>
// public partial class PerforModmoduleRepository : PerforRepository<mod_module>
// {
// public PerforModmoduleRepository(PerformanceDbContext context) : base(context)
// {
// }
// }
//}
//-----------------------------------------------------------------------
// <copyright file=" mod_special.cs">
// * FileName: mod_special.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
////-----------------------------------------------------------------------
//// <copyright file=" mod_special.cs">
//// * FileName: mod_special.cs
//// </copyright>
////-----------------------------------------------------------------------
//using System;
//using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// mod_special Repository
/// </summary>
public partial class PerforModspecialRepository : PerforRepository<mod_special>
{
public PerforModspecialRepository(PerformanceDbContext context) : base(context)
{
}
}
}
//namespace Performance.Repository
//{
// /// <summary>
// /// mod_special Repository
// /// </summary>
// public partial class PerforModspecialRepository : PerforRepository<mod_special>
// {
// public PerforModspecialRepository(PerformanceDbContext context) : base(context)
// {
// }
// }
//}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -19,7 +19,7 @@ public class ExConfigService : IAutoInjection
private readonly PerforExscriptRepository exscriptRepository;
private readonly PerforExmoduleRepository exmoduleRepository;
private readonly PerforExitemRepository exitemRepository;
private readonly PerforModspecialRepository modspecialRepository;
private readonly PerforExspecialRepository exspecialRepository;
private readonly PerforPerallotRepository perallotRepository;
private readonly PerforHospitalconfigRepository hospitalconfigRepository;
private readonly PerforExtractRepository extractRepository;
......@@ -30,7 +30,7 @@ public class ExConfigService : IAutoInjection
PerforExscriptRepository exscriptRepository,
PerforExmoduleRepository exmoduleRepository,
PerforExitemRepository exitemRepository,
PerforModspecialRepository modspecialRepository,
PerforExspecialRepository exspecialRepository,
PerforPerallotRepository perallotRepository,
PerforHospitalconfigRepository hospitalconfigRepository,
PerforExtractRepository extractRepository,
......@@ -41,7 +41,7 @@ public class ExConfigService : IAutoInjection
this.exscriptRepository = exscriptRepository;
this.exmoduleRepository = exmoduleRepository;
this.exitemRepository = exitemRepository;
this.modspecialRepository = modspecialRepository;
this.exspecialRepository = exspecialRepository;
this.perallotRepository = perallotRepository;
this.hospitalconfigRepository = hospitalconfigRepository;
this.extractRepository = extractRepository;
......@@ -185,9 +185,9 @@ public void DelModule(int moduleId)
}
else
{
var specialList = modspecialRepository.GetEntities(t => t.HospitalId == entity.HospitalId);
var specialList = exspecialRepository.GetEntities(t => t.HospitalId == entity.HospitalId);
if (specialList != null && specialList.Any())
modspecialRepository.RemoveRange(specialList.ToArray());
exspecialRepository.RemoveRange(specialList.ToArray());
}
}
......@@ -254,9 +254,9 @@ public void DelItem(int itemId)
/// 特殊科室模板配置项列表
/// </summary>
/// <returns></returns>
public List<mod_special> QuerySpecial(int hospitalId)
public List<ex_special> QuerySpecial(int hospitalId)
{
var list = modspecialRepository.GetEntities(t => t.HospitalId == hospitalId);
var list = exspecialRepository.GetEntities(t => t.HospitalId == hospitalId);
return list;
}
......@@ -264,11 +264,11 @@ public List<mod_special> QuerySpecial(int hospitalId)
/// 特殊科室模板配置项新增
/// </summary>
/// <returns></returns>
public List<mod_special> AddSpecial(SpecialListRequest request)
public List<ex_special> AddSpecial(SpecialListRequest request)
{
var list = request.Items;
list.ForEach(t => t.HospitalId = request.HospitalId);
if (!modspecialRepository.AddRange(list.ToArray()))
if (!exspecialRepository.AddRange(list.ToArray()))
throw new PerformanceException("添加失败!");
return list;
......@@ -278,9 +278,9 @@ public List<mod_special> AddSpecial(SpecialListRequest request)
/// 特殊科室模板配置项修改
/// </summary>
/// <returns></returns>
public mod_special EditSpecial(mod_special entity)
public ex_special EditSpecial(ex_special entity)
{
var special = modspecialRepository.GetEntity(t => t.Id == entity.Id);
var special = exspecialRepository.GetEntity(t => t.Id == entity.Id);
if (special == null)
throw new PerformanceException("选择修改的数据不存在!");
......@@ -288,9 +288,9 @@ public mod_special EditSpecial(mod_special entity)
special.Target = entity.Target;
special.TargetFactor = entity.TargetFactor;
special.AdjustFactor = entity.AdjustFactor;
special.ExtractId = entity.ExtractId;
special.TypeId = entity.TypeId;
special.ConfigId = entity.ConfigId;
if (!modspecialRepository.Update(special))
if (!exspecialRepository.Update(special))
throw new PerformanceException("修改失败!");
return special;
......@@ -302,11 +302,11 @@ public mod_special EditSpecial(mod_special entity)
/// <returns></returns>
public void DelSpecial(int specialId)
{
var special = modspecialRepository.GetEntity(t => t.Id == specialId);
var special = exspecialRepository.GetEntity(t => t.Id == specialId);
if (special == null)
throw new PerformanceException("需要删除的项不存在!");
modspecialRepository.Remove(special);
exspecialRepository.Remove(special);
}
#endregion
......@@ -472,26 +472,51 @@ public List<TitleValue> FeeType()
return titlevalue;
}
public enum ExtractResultClassify
{
[Description("门诊开单")]
OutIncome = 1,
[Description("门诊执行")]
OutExecIncome = 2,
[Description("住院开单")]
InpatIncome = 3,
[Description("住院执行")]
InpatExecIncome = 4,
[Description("额外收入")]
OtherIncome = 5,
[Description("支出")]
Expend = 6,
[Description("医生工作量")]
DoctorWorkload = 7,
[Description("护理工作量")]
NurseWorkload = 8,
[Description("特殊核算科室")]
SpecialUnit = 7,
/// <summary>
/// 绩效考核项费用来源
/// </summary>
/// <returns></returns>
public ModFeeResponse FeeSource(ModModuleRequest request)
{
var configList = hospitalconfigRepository.GetEntities(t => t.HospitalId == request.HospitalId);
if (configList != null && configList.Any())
{
var hospitalConfig = configList.First();
var connection = ConnectionBuilder.Create(DatabaseType.SqlServer, hospitalConfig.DbSource, hospitalConfig.DbName, hospitalConfig.DbUser, hospitalConfig.DbPassword);
int pagesize = 500, pagenum = 0;
if (request.PageNum != 0)
pagenum = request.PageNum - 1;
if (request.PageSize >= 500 && request.PageSize <= 10000)
pagesize = request.PageSize;
string sql = $"select top {pagesize} t1.* from (select row_number() over(order by charge_name) as rownumber,* from (select min(code) code,charge_name from dic_fee where charge_name is not null and charge_name != '' group by charge_name)t )t1 where rownumber> {pagenum} * {pagesize};";
var dataList = extractRepository.ExecuteScript(connection, sql, null);
if (dataList != null && dataList.Any())
{
var list = new List<TitleValue>();
foreach (var num in dataList.Select(t => t.RowNumber).Distinct())
{
var data = new TitleValue
{
Title = dataList.First(t => t.RowNumber == num && t.ColumnName.ToLower() == "charge_name").Value.ToString(),
Value = dataList.First(t => t.RowNumber == num && t.ColumnName.ToLower() == "code").Value.ToString(),
};
list.Add(data);
}
sql = $"select count(*) num from (select min(code) code,charge_name from dic_fee where charge_name is not null and charge_name != '' group by charge_name)t ;";
connection = ConnectionBuilder.Create(DatabaseType.SqlServer, hospitalConfig.DbSource, hospitalConfig.DbName, hospitalConfig.DbUser, hospitalConfig.DbPassword);
dataList = extractRepository.ExecuteScript(connection, sql, null);
return new ModFeeResponse
{
Total = (int)dataList.FirstOrDefault().Value,
PageNum = pagenum + 1,
PageSize = pagesize,
Data = list
};
}
}
return new ModFeeResponse();
}
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
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