You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							132 lines
						
					
					
						
							3.8 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							132 lines
						
					
					
						
							3.8 KiB
						
					
					
				
								using Shentun.Peis.CustomerOrgs;
							 | 
						|
								using Shentun.Peis.Models;
							 | 
						|
								using System;
							 | 
						|
								using System.Collections.Generic;
							 | 
						|
								using System.Linq;
							 | 
						|
								using System.Text;
							 | 
						|
								using System.Threading.Tasks;
							 | 
						|
								using Volo.Abp.Domain.Repositories;
							 | 
						|
								using Volo.Abp.Uow;
							 | 
						|
								using Xunit.Abstractions;
							 | 
						|
								using Xunit;
							 | 
						|
								using Shentun.Peis.DataMigrations;
							 | 
						|
								using Microsoft.International.Converters.PinYinConverter;
							 | 
						|
								using Shentun.Utilities;
							 | 
						|
								
							 | 
						|
								namespace Shentun.Peis
							 | 
						|
								{
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								    public class BaseDataHandleTest : PeisApplicationTestBase
							 | 
						|
								    {
							 | 
						|
								
							 | 
						|
								        private readonly ITestOutputHelper _output;
							 | 
						|
								        private readonly IUnitOfWorkManager _unitOfWorkManager;
							 | 
						|
								        private readonly BaseDataHandleAppService _appService;
							 | 
						|
								        private readonly IRepository<Asbitem, Guid> _asbitemRepository;
							 | 
						|
								        private readonly IRepository<Item, Guid> _itemRepository;
							 | 
						|
								        private readonly IRepository<Diagnosis, Guid> _diagnosisRepository;
							 | 
						|
								        public BaseDataHandleTest(ITestOutputHelper testOutputHelper)
							 | 
						|
								        {
							 | 
						|
								            _output = testOutputHelper;
							 | 
						|
								            _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
							 | 
						|
								            _appService = GetRequiredService<BaseDataHandleAppService>();
							 | 
						|
								            _asbitemRepository = GetRequiredService<IRepository<Asbitem, Guid>>();
							 | 
						|
								            _itemRepository = GetRequiredService<IRepository<Item, Guid>>();
							 | 
						|
								            _diagnosisRepository = GetRequiredService<IRepository<Diagnosis, Guid>>();
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        //[Fact]
							 | 
						|
								        //public async Task TransferPatientData()
							 | 
						|
								        //{
							 | 
						|
								
							 | 
						|
								        //    for (int i = 0; i < 500; i++)
							 | 
						|
								        //    {
							 | 
						|
								        //        using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								        //        {
							 | 
						|
								        //            var IsHand = await _appService.TransferPatientData();
							 | 
						|
								
							 | 
						|
								        //            await unitOfWork.CompleteAsync();
							 | 
						|
								
							 | 
						|
								        //            _output.WriteLine($"处理{(i + 1) * 1000}");
							 | 
						|
								
							 | 
						|
								        //            if (!IsHand)
							 | 
						|
								        //            {
							 | 
						|
								        //                break;
							 | 
						|
								        //            }
							 | 
						|
								        //        }
							 | 
						|
								        //    }
							 | 
						|
								        [Fact]
							 | 
						|
								        public async void GetPYSimpleCode()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								                var diagnosisList = await _diagnosisRepository.GetListAsync();
							 | 
						|
								                foreach (var diagnosis in diagnosisList)
							 | 
						|
								                {
							 | 
						|
								                    diagnosis.SimpleCode = LanguageConverter.GetPYSimpleCode(diagnosis.DisplayName);
							 | 
						|
								                }
							 | 
						|
								
							 | 
						|
								                await _diagnosisRepository.UpdateManyAsync(diagnosisList);
							 | 
						|
								
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								        //}
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								        //[Fact]
							 | 
						|
								        //public async Task TransferPatientRegisterData()
							 | 
						|
								        //{
							 | 
						|
								
							 | 
						|
								        //    for (int i = 0; i < 3000; i++)
							 | 
						|
								        //    {
							 | 
						|
								        //        using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								        //        {
							 | 
						|
								        //            var IsHand = await _appService.TransferPatientRegisterData();
							 | 
						|
								
							 | 
						|
								        //            await unitOfWork.CompleteAsync();
							 | 
						|
								
							 | 
						|
								        //            _output.WriteLine($"处理{(i + 1) * 1000}");
							 | 
						|
								
							 | 
						|
								        //            if (!IsHand)
							 | 
						|
								        //            {
							 | 
						|
								        //                break;
							 | 
						|
								        //            }
							 | 
						|
								        //        }
							 | 
						|
								        //    }
							 | 
						|
								
							 | 
						|
								        //}
							 | 
						|
								
							 | 
						|
								        //[Fact]
							 | 
						|
								        //public async Task HandPatientRegisterDoctor()
							 | 
						|
								        //{
							 | 
						|
								
							 | 
						|
								        //    for (int i = 0; i < 3000; i++)
							 | 
						|
								        //    {
							 | 
						|
								        //        using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								        //        {
							 | 
						|
								        //            var IsHand = await _appService.HandPatientRegisterDoctor();
							 | 
						|
								
							 | 
						|
								        //            await unitOfWork.CompleteAsync();
							 | 
						|
								
							 | 
						|
								        //            _output.WriteLine($"处理{(i + 1) * 1000}");
							 | 
						|
								
							 | 
						|
								        //            if (!IsHand)
							 | 
						|
								        //            {
							 | 
						|
								        //                break;
							 | 
						|
								        //            }
							 | 
						|
								        //        }
							 | 
						|
								        //    }
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								        //}
							 | 
						|
								
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								}
							 |