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.
		
		
		
		
		
			
		
			
				
					
					
						
							116 lines
						
					
					
						
							4.3 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							116 lines
						
					
					
						
							4.3 KiB
						
					
					
				
								using Shentun.WebPeis.AppointPatientRegisters;
							 | 
						|
								using Shentun.WebPeis.AppointRegisterAsbitems;
							 | 
						|
								using Shentun.WebPeis.Enums;
							 | 
						|
								using Shentun.WebPeis.Models;
							 | 
						|
								using Shentun.WebPeis.Persons;
							 | 
						|
								using System;
							 | 
						|
								using System.Collections.Generic;
							 | 
						|
								using System.Linq;
							 | 
						|
								using System.Text;
							 | 
						|
								using System.Threading.Tasks;
							 | 
						|
								using Volo.Abp.Domain.Repositories;
							 | 
						|
								using Volo.Abp.Modularity;
							 | 
						|
								using Volo.Abp.Uow;
							 | 
						|
								using Xunit;
							 | 
						|
								using Xunit.Abstractions;
							 | 
						|
								
							 | 
						|
								namespace Shentun.WebPeis
							 | 
						|
								{
							 | 
						|
								    public class AppointPatientRegisterAppServiceTest<TStartupModule> : WebPeisApplicationTestBase<TStartupModule>
							 | 
						|
								    where TStartupModule : IAbpModule
							 | 
						|
								    {
							 | 
						|
								        private readonly IRepository<AppointPatientRegister> _repository;
							 | 
						|
								        private readonly AppointPatientRegisterAppService _appService;
							 | 
						|
								        private readonly ITestOutputHelper _output;
							 | 
						|
								        private readonly IUnitOfWorkManager _unitOfWorkManager;
							 | 
						|
								        public AppointPatientRegisterAppServiceTest(ITestOutputHelper output)
							 | 
						|
								        {
							 | 
						|
								            _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
							 | 
						|
								            _repository = GetRequiredService<IRepository<AppointPatientRegister>>();
							 | 
						|
								            _appService = GetRequiredService<AppointPatientRegisterAppService>();
							 | 
						|
								            _output = output;
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task CreateAsync()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								
							 | 
						|
								                var entity = new CreateAppointPatientRegisterDto()
							 | 
						|
								                {
							 | 
						|
								                    PersonId = new Guid("3a12d7fa-63f1-d549-c2f8-01123e5b7a8a"),
							 | 
						|
								                    CustomerOrgGroupId = null,
							 | 
						|
								                    CustomerOrgId = GuidFlag.PersonCustomerOrgId,
							 | 
						|
								                    MedicalCenterId = new Guid("150da355-dfbf-466b-9697-355836a862c4"),
							 | 
						|
								                    MedicalPackageId = null,
							 | 
						|
								                    AppointDate = DateTime.Now,
							 | 
						|
								                    CustomerOrgRegisterId = GuidFlag.PersonCustomerOrgRegisterId,
							 | 
						|
								                    PregnantFlag = PregnantFlag.None,
							 | 
						|
								                    Height = 170,
							 | 
						|
								                    Weight = 60
							 | 
						|
								                };
							 | 
						|
								                entity.Asbitems.Add(
							 | 
						|
								                    new CreateAppointRegisterAsbitemDto()
							 | 
						|
								                    {
							 | 
						|
								                        AsbitemId = new Guid("3a126b34-f6f0-56a1-e899-a092874acde7"),
							 | 
						|
								                        Amount = 1,
							 | 
						|
								                        ChargePrice = (decimal)30.5
							 | 
						|
								                    }
							 | 
						|
								                );
							 | 
						|
								                entity.Asbitems.Add(
							 | 
						|
								                   new CreateAppointRegisterAsbitemDto()
							 | 
						|
								                   {
							 | 
						|
								                       AsbitemId = new Guid("3a126b35-1163-6b80-6b57-7b5a7bc9e935"),
							 | 
						|
								                       Amount = 2,
							 | 
						|
								                       ChargePrice = (decimal)50.45
							 | 
						|
								                   }
							 | 
						|
								               );
							 | 
						|
								                var newEntity = await _appService.CreateAsync(entity);
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task GetByIdNoOrMobilePhoneAsync()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								
							 | 
						|
								                var entity = new IdNoOrMobilePhoneInputDto()
							 | 
						|
								                {
							 | 
						|
								                   MobilePhone = "18911254911"
							 | 
						|
								                };
							 | 
						|
								                var list = await _appService.GetByIdNoOrMobilePhoneAsync(entity);
							 | 
						|
								                foreach (var item in list)
							 | 
						|
								                {
							 | 
						|
								                    _output.WriteLine(item.PersonName);
							 | 
						|
								                    foreach(var asbitem in item.AppointRegisterAsbitems)
							 | 
						|
								                    {
							 | 
						|
								                        _output.WriteLine(asbitem.AsbitemName);
							 | 
						|
								                    }
							 | 
						|
								                }
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task GetAppointRegisterAsbitemListById()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								
							 | 
						|
								                var entity = new AppointPatientRegisterIdInputDto()
							 | 
						|
								                {
							 | 
						|
								                    AppointPatientRegisterId = new Guid("3a12ec60-278d-1814-753b-87ff8782aa26")
							 | 
						|
								                };
							 | 
						|
								                var list = await _appService.GetAppointRegisterAsbitemListByIdAsync(entity);
							 | 
						|
								                foreach (var item in list)
							 | 
						|
								                {
							 | 
						|
								                    _output.WriteLine(item.AsbitemName);
							 | 
						|
								                }
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								    }
							 | 
						|
								}
							 |