Browse Source

预约报表、增加同步预登记人员任务

master
wxd 2 years ago
parent
commit
5467fae884
  1. 25
      src/Shentun.ColumnReferencePlugIns/WebAppoints/WebAppointPlugInsBase.cs
  2. 42
      src/Shentun.ColumnReferencePlugIns/WebAppoints/WebAppointWebPeisPlugIns.cs
  3. 34
      src/Shentun.Peis.Application.Contracts/AppointPatientRegisters/GetAppointStatisticsReportDto.cs
  4. 40
      src/Shentun.Peis.Application.Contracts/CustomerReports/CustomerOrgInputDto.cs
  5. 3
      src/Shentun.Peis.Application.Contracts/TransToWebPeiss/SyncPatientRegisterReportInputDto.cs
  6. 39
      src/Shentun.Peis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs
  7. 35
      src/Shentun.Peis.HttpApi.Host/Schedulers/SyncPatientRegisterReportInterfaceWorker.cs

25
src/Shentun.ColumnReferencePlugIns/WebAppoints/WebAppointPlugInsBase.cs

@ -2,6 +2,7 @@
using Npgsql;
using Shentun.Peis.AppointPatientRegisters;
using Shentun.Peis.AppointRegisterAsbitems;
using Shentun.Peis.CustomerReports;
using Shentun.Peis.TransToWebPeiss;
using System;
using System.Collections.Generic;
@ -58,5 +59,29 @@ namespace Shentun.Peis.PlugIns.WebAppoints
{
throw new NotImplementedException();
}
/// <summary>
/// 获取需要同步到web的预登记人员ID
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public virtual async Task<List<SyncPatientRegisterIdsDto>> GetSyncPreRegistrationPatientRegisterIds(SyncPatientRegisterReportInputDto input)
{
throw new NotImplementedException();
}
/// <summary>
/// 获取预约统计报表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public virtual async Task<List<GetAppointStatisticsReportDto>> GetAppointStatisticsReportAsync(List<CustomerOrgInputDto> input)
{
throw new NotImplementedException();
}
}
}

42
src/Shentun.ColumnReferencePlugIns/WebAppoints/WebAppointWebPeisPlugIns.cs

@ -7,6 +7,7 @@ using Newtonsoft.Json.Linq;
using Npgsql;
using Shentun.Peis.AppointPatientRegisters;
using Shentun.Peis.AppointRegisterAsbitems;
using Shentun.Peis.CustomerReports;
using Shentun.Peis.Enums;
using Shentun.Peis.PlugIns.ColumnReferences;
using Shentun.Peis.TransToWebPeiss;
@ -30,6 +31,7 @@ namespace Shentun.Peis.PlugIns.WebAppoints
private string _webPeisGetAppointPatientRegisterListByFilterUrl;
private string _webPeisGetAppointRegisterAsbitemListByIdUrl;
private string _webPeisGetByPatientRegisterIdUrl;
private string _webPeisGetAppointStatisticsReportUrl;
private Guid _medicalCenterId;
public WebAppointWebPeisPlugIns(Guid thirdInterfaceId) : base(thirdInterfaceId)
{
@ -48,6 +50,7 @@ namespace Shentun.Peis.PlugIns.WebAppoints
_webPeisGetAppointPatientRegisterListByFilterUrl = InterfaceConfig.GetSection("Interface").GetSection("GetAppointPatientRegisterListByFilterUrl").Value;
_webPeisGetAppointRegisterAsbitemListByIdUrl = InterfaceConfig.GetSection("Interface").GetSection("GetAppointRegisterAsbitemListByIdUrl").Value;
_webPeisGetByPatientRegisterIdUrl = InterfaceConfig.GetSection("Interface").GetSection("GetByPatientRegisterIdUrl").Value;
_webPeisGetAppointStatisticsReportUrl = InterfaceConfig.GetSection("Interface").GetSection("GetAppointStatisticsReportUrl").Value;
}
/// <summary>
/// 获取预约人员列表
@ -103,6 +106,7 @@ namespace Shentun.Peis.PlugIns.WebAppoints
(_webPeisGetByPatientRegisterIdUrl, webAppointPatientRegisterIdInput);
return appointPatientRegisterDto;
}
/// <summary>
/// 获取需要同步到web的人员ID
/// </summary>
@ -126,6 +130,44 @@ namespace Shentun.Peis.PlugIns.WebAppoints
}
}
/// <summary>
/// 获取需要同步到web的预登记人员ID
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public override async Task<List<SyncPatientRegisterIdsDto>> GetSyncPreRegistrationPatientRegisterIds(SyncPatientRegisterReportInputDto input)
{
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr))
{
string sql;
sql = @"
SELECT
id
from patient_register
where summary_date >= @HandDate and
complete_flag = @CompleteFlag
";
var patientRegisterIds = (await conn.QueryAsync<SyncPatientRegisterIdsDto>(sql,
new { HandDate = DateTime.Now.Date.AddDays(-input.QueryDays), CompleteFlag = PatientRegisterCompleteFlag.PreRegistration })).ToList();
return patientRegisterIds;
}
}
/// <summary>
/// 获取预约统计报表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public override async Task<List<GetAppointStatisticsReportDto>> GetAppointStatisticsReportAsync(List<CustomerOrgInputDto> input)
{
var appointStatisticsReportListDto = await CallWePeisAppServiceAsync<List<CustomerOrgInputDto>,
List<GetAppointStatisticsReportDto>>
(_webPeisGetAppointStatisticsReportUrl, input);
return appointStatisticsReportListDto;
}
public async virtual Task<WebApiOutDto<LoginOutDataDto>> LoginWebPeisAsync()
{
if (string.IsNullOrWhiteSpace(_webPeisUser))

34
src/Shentun.Peis.Application.Contracts/AppointPatientRegisters/GetAppointStatisticsReportDto.cs

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.AppointPatientRegisters
{
public class GetAppointStatisticsReportDto
{
/// <summary>
/// 单位名称
/// </summary>
public string CustomerOrgName { get; set; }
/// <summary>
/// 登记人数 备单人数
/// </summary>
public int RegisterCount { get; set; }
/// <summary>
/// 预约人数
/// </summary>
public int AppointCount { get; set; }
/// <summary>
/// 未预约人数
/// </summary>
public int UnAppointCount { get; set; }
/// <summary>
/// 已开始检查人数
/// </summary>
public int CheckCount { get; set; }
}
}

40
src/Shentun.Peis.Application.Contracts/CustomerReports/CustomerOrgInputDto.cs

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.CustomerReports
{
public class CustomerOrgInputDto
{
/// <summary>
/// 单位ID 需要包含查出子级ID
/// </summary>
public Guid CustomerOrgId { get; set; }
/// <summary>
/// 单位体检次数ID
/// </summary>
public Guid CustomerOrgRegisterId { get; set; }
/// <summary>
///
/// </summary>
public List<Guid> CustomerOrgGroupId { get; set; } = new List<Guid>();
/// <summary>
/// 日期类型(1、登记日期 2、体检日期 3、总检日期)
/// </summary>
public char DateType { get; set; }
/// <summary>
/// 开始日期
/// </summary>
public string StartDate { get; set; }
/// <summary>
/// 结束日期
/// </summary>
public string EndDate { get; set; }
}
}

3
src/Shentun.Peis.Application.Contracts/TransToWebPeiss/SyncPatientRegisterReportInputDto.cs

@ -8,7 +8,6 @@ namespace Shentun.Peis.TransToWebPeiss
{
//int QueryDays, string reportApiBaseAddress, string reportApiUrl
public int QueryDays { get; set; }
public string ReportApiBaseAddress { get; set; }
public string ReportApiUrl { get; set; }
}
}

39
src/Shentun.Peis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using NUglify.JavaScript.Syntax;
using Shentun.Peis.AppointRegisterAsbitems;
using Shentun.Peis.CustomerReports;
using Shentun.Peis.Enums;
using Shentun.Peis.Models;
using Shentun.Peis.PatientRegisters;
@ -24,9 +25,9 @@ namespace Shentun.Peis.AppointPatientRegisters
[Authorize]
public class AppointPatientRegisterAppService : ApplicationService
{
private readonly IRepository<ThirdInterface,Guid> _thirdInterfaceRepository;
private readonly IRepository<ThirdInterface, Guid> _thirdInterfaceRepository;
public AppointPatientRegisterAppService(IRepository<ThirdInterface,Guid> thirdInterfaceRepository)
public AppointPatientRegisterAppService(IRepository<ThirdInterface, Guid> thirdInterfaceRepository)
{
_thirdInterfaceRepository = thirdInterfaceRepository;
}
@ -40,11 +41,11 @@ namespace Shentun.Peis.AppointPatientRegisters
public async Task<List<AppointPatientRegisterDto>> GetListByFilterAsync(AppointPatientRegisterInputDto input)
{
var thirdInterface = await _thirdInterfaceRepository.GetAsync(input.ThirdInterFaceId);
if(thirdInterface.IsActive != 'Y')
if (thirdInterface.IsActive != 'Y')
{
throw new UserFriendlyException("该接口已禁用");
}
var appointPatientRegisterPlugInsInputDto = new AppointPatientRegisterInputDto()
{
ThirdInterFaceId = input.ThirdInterFaceId,
@ -123,5 +124,35 @@ namespace Shentun.Peis.AppointPatientRegisters
return pluginsOut;
}
/// <summary>
/// 获取预约统计报表
/// </summary>
/// <returns></returns>
[HttpPost("api/app/AppointPatientRegister/GetAppointStatisticsReport")]
public async Task<List<GetAppointStatisticsReportDto>> GetAppointStatisticsReportAsync(List<CustomerOrgInputDto> input)
{
var thirdInterface = await _thirdInterfaceRepository.FirstOrDefaultAsync(f => f.ThirdInterfaceType == ThirdInterfaceTypeFlag.WebAppoint);
if (thirdInterface.IsActive != 'Y')
{
throw new UserFriendlyException("该接口已禁用");
}
object[] objects = [input];
var parmValue = thirdInterface.ParmValue;
var configurationBuilder = new ConfigurationBuilder()
.AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(parmValue)));
var config = configurationBuilder.Build();
var assemblyName = config.GetSection("Interface").GetSection("AssemblyName").Value;
var className = config.GetSection("Interface").GetSection("ClassName").Value;
var pluginsOut = await Utilities.ReflectionHelper.InvokeAsync<List<GetAppointStatisticsReportDto>>(assemblyName,
className, [thirdInterface.Id], "GetAppointStatisticsReportAsync", objects);
return pluginsOut;
}
}
}

35
src/Shentun.Peis.HttpApi.Host/Schedulers/SyncPatientRegisterReportInterfaceWorker.cs

@ -112,6 +112,8 @@ namespace Shentun.Peis.Schedulers
var QueryDays = Convert.ToInt32(interfaceConfig.GetSection("Interface").GetSection("Scheduler")
.GetSection("QueryDays").Value);
//获取报告地址
var reportApiBaseAddress = interfaceConfig.GetSection("Interface").GetSection("ReportApiBaseAddress").Value;
var reportApiUrl = interfaceConfig.GetSection("Interface").GetSection("ReportApiUrl").Value;
@ -119,9 +121,7 @@ namespace Shentun.Peis.Schedulers
SyncPatientRegisterReportInputDto input = new SyncPatientRegisterReportInputDto
{
QueryDays = QueryDays,
ReportApiBaseAddress = reportApiBaseAddress,
ReportApiUrl = reportApiUrl
QueryDays = QueryDays
};
@ -132,6 +132,35 @@ namespace Shentun.Peis.Schedulers
object[] objects = [input];
var pluginsOut = ReflectionHelper.InvokeAsync<List<SyncPatientRegisterIdsDto>>(assemblyName, className, classConstructorArg, funName, objects).Result;
#region 同步备单数据
var preRegistrationFunName = "GetSyncPreRegistrationPatientRegisterIds";
var preRegistrationPluginsOut = ReflectionHelper.InvokeAsync<List<SyncPatientRegisterIdsDto>>(assemblyName, className, classConstructorArg, preRegistrationFunName, objects).Result;
if (preRegistrationPluginsOut.Any())
{
foreach (var item in pluginsOut)
{
PatientRegisterIdInputDto patientRegisterIdDto = new PatientRegisterIdInputDto
{
PatientRegisterId = item.Id
};
appServiceHelper.CallAppService<object, object>("api/app/TransToWebPeis/TransPatientRegisterByPatientRegisterId", patientRegisterIdDto);
}
Logger.LogError("同步预登记数据成功");
}
#endregion
//需要同步报告的数据
if (pluginsOut.Any())
{
// pluginsOut = pluginsOut.Take(10).ToList();

Loading…
Cancel
Save