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 : WebPeisApplicationTestBase where TStartupModule : IAbpModule { private readonly IRepository _repository; private readonly AppointPatientRegisterAppService _appService; private readonly ITestOutputHelper _output; private readonly IUnitOfWorkManager _unitOfWorkManager; public AppointPatientRegisterAppServiceTest(ITestOutputHelper output) { _unitOfWorkManager = GetRequiredService(); _repository = GetRequiredService>(); _appService = GetRequiredService(); _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 GetListByFilterAsync() { using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true)) { var entity = new AppointPatientRegisterInputDto() { MobilePhone = "18911254911", AppointStartDate = DateTime.Now.AddDays(-10), }; var list = await _appService.GetListByFilterAsync(entity); foreach (var item in list) { _output.WriteLine(item.PersonName); } 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(); } } [Fact] public async Task GetRecommendMedicalPackageListByPersonIdAsync() { using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true)) { var entity = new PersonIdInputDto() { PersonId = new Guid("3a12d72c-19d9-e8b2-71f6-cf283103e191") }; var list = await _appService.GetRecommendMedicalPackageListByPersonIdAsync(entity); foreach (var item in list) { _output.WriteLine(item.MedicalPackageName); foreach(var item2 in item.Asbitems) { _output.WriteLine(item2.AsbitemName + "-" + item2.IsBelongMedicalPackage); } } await unitOfWork.CompleteAsync(); } } } }