|
|
|
@ -9,6 +9,7 @@ using NPOI.POIFS.Properties; |
|
|
|
using NPOI.Util; |
|
|
|
using NUglify.Helpers; |
|
|
|
using Org.BouncyCastle.Asn1.Ocsp; |
|
|
|
using Shentun.Peis.AppointPatientRegisters; |
|
|
|
using Shentun.Peis.CommonCharTypes; |
|
|
|
using Shentun.Peis.CustomerOrgRegisters; |
|
|
|
using Shentun.Peis.CustomerOrgs; |
|
|
|
@ -32,7 +33,9 @@ using Shentun.Utilities; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Diagnostics; |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using System.Linq.Dynamic.Core; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
using System.Security; |
|
|
|
using System.Text; |
|
|
|
@ -113,6 +116,8 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
private readonly ICurrentUser _currentUser; |
|
|
|
private readonly IRepository<UserItemType> _userItemTypeRepository; |
|
|
|
private readonly PatientOccupationalDiseaseManager _patientOccupationalDiseaseManager; |
|
|
|
private readonly IRepository<ThirdInterface, Guid> _thirdInterfaceRepository; |
|
|
|
private readonly IRepository<CustomerOrgRegister, Guid> _customerOrgRegisterRepository; |
|
|
|
public PatientRegisterAppService( |
|
|
|
IRepository<PatientRegister, Guid> repository, |
|
|
|
IRepository<Patient, Guid> patientRepository, |
|
|
|
@ -163,7 +168,9 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
IConfiguration configuration, |
|
|
|
ICurrentUser currentUser, |
|
|
|
IRepository<UserItemType> userItemTypeRepository, |
|
|
|
PatientOccupationalDiseaseManager patientOccupationalDiseaseManager) |
|
|
|
PatientOccupationalDiseaseManager patientOccupationalDiseaseManager, |
|
|
|
IRepository<ThirdInterface, Guid> thirdInterfaceRepository, |
|
|
|
IRepository<CustomerOrgRegister, Guid> customerOrgRegisterRepository) |
|
|
|
: base(repository) |
|
|
|
{ |
|
|
|
this._repository = repository; |
|
|
|
@ -216,6 +223,8 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
_currentUser = currentUser; |
|
|
|
_userItemTypeRepository = userItemTypeRepository; |
|
|
|
_patientOccupationalDiseaseManager = patientOccupationalDiseaseManager; |
|
|
|
_thirdInterfaceRepository = thirdInterfaceRepository; |
|
|
|
_customerOrgRegisterRepository = customerOrgRegisterRepository; |
|
|
|
} |
|
|
|
/// <summary>
|
|
|
|
/// 获取通过主键
|
|
|
|
@ -2517,13 +2526,53 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
await CurrentUnitOfWork.SaveChangesAsync(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 导入人员信息从第三方接口(青藏铁路接口)
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
[HttpPost("api/app/patientregister/CreatePatientRegisterFromCustomerOrgInterface")] |
|
|
|
public async Task CreatePatientRegisterFromCustomerOrgInterfaceAsync(CustomerOrgRegisterIdInputDto input) |
|
|
|
public async Task<ImportPatientRegisterByCustomerOrgRegisterIdDto> CreatePatientRegisterFromCustomerOrgInterfaceAsync(CustomerOrgRegisterIdInputDto input) |
|
|
|
{ |
|
|
|
if (input == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("input参数不能为空"); |
|
|
|
} |
|
|
|
var thirdInterfaces = await _thirdInterfaceRepository.GetListAsync(o => o.ThirdInterfaceType == ThirdInterfaceTypeFlag.ImportPatientRegister); |
|
|
|
foreach(var thirdInterface in thirdInterfaces) |
|
|
|
{ |
|
|
|
if (thirdInterface.IsActive != 'Y') |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
var parmValue = thirdInterface.ParmValue; |
|
|
|
var configurationBuilder = new ConfigurationBuilder() |
|
|
|
.AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(parmValue))); |
|
|
|
var config = configurationBuilder.Build(); |
|
|
|
var customerOrgIdStr = config.GetSection("Interface").GetSection("CustomerOrgId").Value; |
|
|
|
if(!Guid.TryParse(customerOrgIdStr,out var customerOrgId)) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("接口配置中的CustomerOrgId无法解析成GUID"); |
|
|
|
} |
|
|
|
var customerOrgRegister = (await _customerOrgRegisterRepository.GetQueryableAsync()) |
|
|
|
.Where(o => o.Id == input.CustomerOrgRegisterId).First(); |
|
|
|
if(customerOrgRegister.CustomerOrgId != customerOrgId) |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
object[] objects = [input.CustomerOrgRegisterId]; |
|
|
|
|
|
|
|
var assemblyName = config.GetSection("Interface").GetSection("AssemblyName").Value; |
|
|
|
var className = config.GetSection("Interface").GetSection("ClassName").Value; |
|
|
|
|
|
|
|
var pluginsOut = await Utilities.ReflectionHelper.InvokeAsync<ImportPatientRegisterByCustomerOrgRegisterIdDto>(assemblyName, |
|
|
|
className, [thirdInterface.Id], "ImportPatientRegisterByCustomerOrgRegisterIdAsync", objects); |
|
|
|
return pluginsOut; |
|
|
|
} |
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
[HttpPost("api/app/patientregister/GetSameNamePatient")] |
|
|
|
public async Task<List<GetSameNamePatientDto>> GetSameNamePatientAsync(GetSameNamePatientInputDto getSameNamePatientInputDto) |
|
|
|
@ -2715,7 +2764,7 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
if (!string.IsNullOrEmpty(input.StartPatientNo) && !string.IsNullOrEmpty(input.EndPatientNo)) |
|
|
|
{ |
|
|
|
|
|
|
|
query = query.AsEnumerable().Where(m => String.Compare(m.ab.PatientNo, input.StartPatientNo, StringComparison.OrdinalIgnoreCase) > 0 |
|
|
|
query = query.Where(m => String.Compare(m.ab.PatientNo, input.StartPatientNo, StringComparison.OrdinalIgnoreCase) > 0 |
|
|
|
&& String.Compare(m.ab.PatientNo, input.EndPatientNo, StringComparison.OrdinalIgnoreCase) <= 0).AsQueryable(); |
|
|
|
|
|
|
|
} |
|
|
|
|