| 
					
					
					
				 | 
				@ -1,8 +1,11 @@ | 
			
		
		
	
		
			
				 | 
				 | 
				using Microsoft.AspNetCore.Authorization; | 
				 | 
				 | 
				using Microsoft.AspNetCore.Authorization; | 
			
		
		
	
		
			
				 | 
				 | 
				using Microsoft.AspNetCore.Mvc; | 
				 | 
				 | 
				using Microsoft.AspNetCore.Mvc; | 
			
		
		
	
		
			
				 | 
				 | 
				using Microsoft.Extensions.Configuration; | 
				 | 
				 | 
				using Microsoft.Extensions.Configuration; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				using NPOI.Util; | 
			
		
		
	
		
			
				 | 
				 | 
				using NUglify.JavaScript.Syntax; | 
				 | 
				 | 
				using NUglify.JavaScript.Syntax; | 
			
		
		
	
		
			
				 | 
				 | 
				using Shentun.Peis.AppointRegisterAsbitems; | 
				 | 
				 | 
				using Shentun.Peis.AppointRegisterAsbitems; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				using Shentun.Peis.Asbitems; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				using Shentun.Peis.CustomerOrgs; | 
			
		
		
	
		
			
				 | 
				 | 
				using Shentun.Peis.CustomerReports; | 
				 | 
				 | 
				using Shentun.Peis.CustomerReports; | 
			
		
		
	
		
			
				 | 
				 | 
				using Shentun.Peis.Enums; | 
				 | 
				 | 
				using Shentun.Peis.Enums; | 
			
		
		
	
		
			
				 | 
				 | 
				using Shentun.Peis.Models; | 
				 | 
				 | 
				using Shentun.Peis.Models; | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -17,6 +20,7 @@ using System.Text; | 
			
		
		
	
		
			
				 | 
				 | 
				using System.Threading.Tasks; | 
				 | 
				 | 
				using System.Threading.Tasks; | 
			
		
		
	
		
			
				 | 
				 | 
				using Volo.Abp; | 
				 | 
				 | 
				using Volo.Abp; | 
			
		
		
	
		
			
				 | 
				 | 
				using Volo.Abp.Application.Services; | 
				 | 
				 | 
				using Volo.Abp.Application.Services; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				using Volo.Abp.Domain.Entities; | 
			
		
		
	
		
			
				 | 
				 | 
				using Volo.Abp.Domain.Repositories; | 
				 | 
				 | 
				using Volo.Abp.Domain.Repositories; | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				namespace Shentun.Peis.AppointPatientRegisters | 
				 | 
				 | 
				namespace Shentun.Peis.AppointPatientRegisters | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -27,14 +31,25 @@ namespace Shentun.Peis.AppointPatientRegisters | 
			
		
		
	
		
			
				 | 
				 | 
				    { | 
				 | 
				 | 
				    { | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IRepository<ThirdInterface, Guid> _thirdInterfaceRepository; | 
				 | 
				 | 
				        private readonly IRepository<ThirdInterface, Guid> _thirdInterfaceRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository; | 
				 | 
				 | 
				        private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        private readonly IRepository<Patient, Guid> _patientRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        private readonly IRepository<RegisterCheck, Guid> _registerCheckRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        private readonly IRepository<RegisterCheckAsbitem, Guid> _registerCheckAsbitemRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        private readonly CacheService _cacheService; | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				        public AppointPatientRegisterAppService( | 
				 | 
				 | 
				        public AppointPatientRegisterAppService( | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<ThirdInterface, Guid> thirdInterfaceRepository, | 
				 | 
				 | 
				            IRepository<ThirdInterface, Guid> thirdInterfaceRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<PatientRegister, Guid> patientRegisterRepository | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				            ) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            IRepository<PatientRegister, Guid> patientRegisterRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            IRepository<Patient, Guid> patientRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            IRepository<RegisterCheck, Guid> registerCheckRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            IRepository<RegisterCheckAsbitem, Guid> registerCheckAsbitemRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            CacheService cacheService) | 
			
		
		
	
		
			
				 | 
				 | 
				        { | 
				 | 
				 | 
				        { | 
			
		
		
	
		
			
				 | 
				 | 
				            _thirdInterfaceRepository = thirdInterfaceRepository; | 
				 | 
				 | 
				            _thirdInterfaceRepository = thirdInterfaceRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				            _patientRegisterRepository = patientRegisterRepository; | 
				 | 
				 | 
				            _patientRegisterRepository = patientRegisterRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            _patientRepository = patientRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            _registerCheckRepository = registerCheckRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            _registerCheckAsbitemRepository = registerCheckAsbitemRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            _cacheService = cacheService; | 
			
		
		
	
		
			
				 | 
				 | 
				        } | 
				 | 
				 | 
				        } | 
			
		
		
	
		
			
				 | 
				 | 
				        /// <summary>
 | 
				 | 
				 | 
				        /// <summary>
 | 
			
		
		
	
		
			
				 | 
				 | 
				        /// 获取网上预约数据
 | 
				 | 
				 | 
				        /// 获取网上预约数据
 | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -161,6 +176,154 @@ namespace Shentun.Peis.AppointPatientRegisters | 
			
		
		
	
		
			
				 | 
				 | 
				        } | 
				 | 
				 | 
				        } | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        /// <summary>
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        /// 获取预约记录,包含收费项目  体检退费时用
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        /// </summary>
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        /// <param name="input"></param>
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        /// <returns></returns>
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        [HttpPost("api/app/AppointPatientRegister/GerAppointPatientRegisterWithAsbitemList")] | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        public async Task<List<GerAppointPatientRegisterWithAsbitemListWithPatientReigsterDto>> GerAppointPatientRegisterWithAsbitemListAsync(GerAppointPatientRegisterWithAsbitemListInputDto input) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            List<GerAppointPatientRegisterWithAsbitemListWithPatientReigsterDto> entListDto = new List<GerAppointPatientRegisterWithAsbitemListWithPatientReigsterDto>(); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            var thirdInterface = await _thirdInterfaceRepository.FirstOrDefaultAsync(f => f.ThirdInterfaceType == ThirdInterfaceTypeFlag.WebAppoint); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            if (thirdInterface == null) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                throw new UserFriendlyException("该接口未找到"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            if (thirdInterface.IsActive != 'Y') | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                throw new UserFriendlyException("该接口已禁用"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            #region 从体检里面查询
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            var query = from patientRegister in await _patientRegisterRepository.GetQueryableAsync() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        join patient in await _patientRepository.GetQueryableAsync() on patientRegister.PatientId equals patient.Id | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        join registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckAsbitem.RegisterCheckId | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        where !string.IsNullOrWhiteSpace(patientRegister.AppointPatientRegisterId) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        && registerCheckAsbitem.IsCharge == 'Y' | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        && registerCheckAsbitem.ChargeSourceFlag == '1' | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        select new | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            patientRegister, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            patient | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        }; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            if (!string.IsNullOrEmpty(input.PatientNo)) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                query = query.Where(m => m.patientRegister.Patient.PatientNo == input.PatientNo); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            if (!string.IsNullOrEmpty(input.IdNo)) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                query = query.Where(m => m.patientRegister.Patient.IdNo == input.IdNo); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            if (!string.IsNullOrEmpty(input.PatientName)) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                query = query.Where(m => m.patientRegister.PatientName == input.PatientName); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            if (!string.IsNullOrEmpty(input.PatientRegisterNo)) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                query = query.Where(m => m.patientRegister.PatientRegisterNo == input.PatientRegisterNo); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate)) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                if (input.DateType == '1') | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    query = query.Where(m => m.patientRegister.CreationTime >= Convert.ToDateTime(input.StartDate) && | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    m.patientRegister.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1)); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                else if (input.DateType == '2') | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    query = query.Where(m => m.patientRegister.MedicalStartDate >= Convert.ToDateTime(input.StartDate) && | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                      m.patientRegister.MedicalStartDate < Convert.ToDateTime(input.EndDate).AddDays(1)); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            var patientRegisterList = query.ToList(); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            //获取符合条件的预约ID
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            var appointPatientRegisterIds = patientRegisterList.Select(s => s.patientRegister.AppointPatientRegisterId).Distinct().ToList(); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            #endregion
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            if (!appointPatientRegisterIds.Any()) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                return entListDto; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            object[] objects = [appointPatientRegisterIds]; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            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<GerAppointPatientRegisterWithAsbitemListDto>>(assemblyName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                className, [thirdInterface.Id], "GerAppointPatientRegisterWithAsbitemListAsync", objects); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            foreach (var plugin in pluginsOut) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                var entDto = ObjectMapper.Map<GerAppointPatientRegisterWithAsbitemListDto, GerAppointPatientRegisterWithAsbitemListWithPatientReigsterDto>(plugin); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                var patientRegisterEnt = patientRegisterList.FirstOrDefault(f => f.patientRegister.AppointPatientRegisterId == entDto.AppointPatientRegisterId.ToString()); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                if (patientRegisterEnt != null) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    entDto.PatientRegisterNo = patientRegisterEnt.patientRegister.PatientRegisterNo; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    entDto.PatientNo = patientRegisterEnt.patient.PatientNo; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    entDto.PatientName = patientRegisterEnt.patientRegister.PatientName; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    entDto.SexName = await _cacheService.GetSexNameAsync(patientRegisterEnt.patientRegister.SexId); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    entDto.Age = patientRegisterEnt.patientRegister.Age; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    entDto.IdNo = patientRegisterEnt.patient.IdNo; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    entDto.Telephone = patientRegisterEnt.patient.Telephone; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    entDto.MobileTelephone = patientRegisterEnt.patient.MobileTelephone; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                entListDto.Add(entDto); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            return entListDto; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        /// <summary>
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        /// 体检系统申请退款
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        /// </summary>
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        /// <param name="input"></param>
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        /// <returns></returns>
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        [HttpPost("api/app/AppointPatientRegister/CreateWeChatOrderRefund")] | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        public async Task CreateWeChatOrderRefundAsync(CreateWeChatOrderRefundInputDto input) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            var thirdInterface = await _thirdInterfaceRepository.FirstOrDefaultAsync(f => f.ThirdInterfaceType == ThirdInterfaceTypeFlag.WebAppoint); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            if (thirdInterface == null) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                throw new UserFriendlyException("该接口未找到"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            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; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            await Utilities.ReflectionHelper.InvokeAsync<Task>(assemblyName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				              className, [thirdInterface.Id], "CreateWeChatOrderRefundAsync", objects); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				        #region 提供给小程序的接口
 | 
				 | 
				 | 
				        #region 提供给小程序的接口
 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				        /// <summary>
 | 
				 | 
				 | 
				        /// <summary>
 | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -180,6 +343,36 @@ namespace Shentun.Peis.AppointPatientRegisters | 
			
		
		
	
		
			
				 | 
				 | 
				            return isRegister; | 
				 | 
				 | 
				            return isRegister; | 
			
		
		
	
		
			
				 | 
				 | 
				        } | 
				 | 
				 | 
				        } | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        /// <summary>
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        /// 小程序退款成功后,更新体检系统项目收费状态
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        /// </summary>
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        /// <returns></returns>
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        [HttpPost("api/app/AppointPatientRegister/UpdateAppointPatientAsbitemStatus")] | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        public async Task UpdateAppointPatientAsbitemStatusAsync(UpdateAppointPatientAsbitemStatusInputDto input) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            var registerCheckAsbitemList = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                            join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                            join registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckAsbitem.RegisterCheckId | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                            where patientRegister.AppointPatientRegisterId == input.AppointPatientRegisterId.ToString() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                            select registerCheckAsbitem) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                            .ToList(); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            if (registerCheckAsbitemList.Any()) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                foreach (var registerCheckAsbitem in registerCheckAsbitemList) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    var inputPara = input.ChargeAsbitemDetail.FirstOrDefault(f => f.AsbitemId == registerCheckAsbitem.AsbitemId); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    if (inputPara != null) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        registerCheckAsbitem.IsCharge=inputPara.IsCharge; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                await _registerCheckAsbitemRepository.UpdateManyAsync(registerCheckAsbitemList); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				        #endregion
 | 
				 | 
				 | 
				        #endregion
 | 
			
		
		
	
		
			
				 | 
				 | 
				    } | 
				 | 
				 | 
				    } | 
			
		
		
	
		
			
				 | 
				 | 
				} | 
				 | 
				 | 
				} |