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.
213 lines
8.3 KiB
213 lines
8.3 KiB
using Shentun.WebPeis.AppointPatientRegisters;
|
|
using Shentun.WebPeis.AppointRegisterAsbitems;
|
|
using Shentun.WebPeis.Enums;
|
|
using Shentun.WebPeis.Models;
|
|
using Shentun.WebPeis.PatientRegisters;
|
|
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 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);
|
|
_output.WriteLine("--套餐项目");
|
|
foreach (var item2 in item.Asbitems)
|
|
{
|
|
_output.WriteLine(item2.AsbitemName + "-" + item2.IsBelongMedicalPackage);
|
|
}
|
|
_output.WriteLine("--加做项目");
|
|
foreach (var item2 in item.DiseaseRiskLevelAsbitems)
|
|
{
|
|
_output.WriteLine("---" + item2.DiseaseRiskName + "-" + item2.DiseaseRiskLevelName + "---");
|
|
foreach (var item3 in item2.Asbitems)
|
|
{
|
|
_output.WriteLine(item3.AsbitemName);
|
|
}
|
|
}
|
|
_output.WriteLine("--禁止检查项目");
|
|
foreach (var item3 in item.ForbidlCheckAsbitems)
|
|
{
|
|
_output.WriteLine(item3.AsbitemName);
|
|
}
|
|
|
|
}
|
|
await unitOfWork.CompleteAsync();
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
public async Task GetCustomerOrgRecommendMedicalPackageListByPatientRegisterIdAsync()
|
|
{
|
|
using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
|
|
{
|
|
|
|
var entity = new RecommendMedicalPackagePatientRegisterIdInputDto()
|
|
{
|
|
PatientRegisterId = new Guid("3a12fb5a-79c2-eea8-4c67-ef101b82287e"),
|
|
PersonId = new Guid("3a12d72c-19d9-e8b2-71f6-cf283103e191")
|
|
};
|
|
var list = await _appService.GetCustomerOrgRecommendMedicalPackageListByPatientRegisterIdAsync(entity);
|
|
foreach (var item in list)
|
|
{
|
|
_output.WriteLine("---------------" + item.MedicalPackageName);
|
|
_output.WriteLine("--套餐项目");
|
|
foreach (var item2 in item.Asbitems)
|
|
{
|
|
_output.WriteLine(item2.AsbitemName + "-" + item2.IsBelongMedicalPackage);
|
|
}
|
|
_output.WriteLine("--加做项目");
|
|
foreach (var item2 in item.DiseaseRiskLevelAsbitems)
|
|
{
|
|
_output.WriteLine("---" + item2.DiseaseRiskName + "-" + item2.DiseaseRiskLevelName + "---");
|
|
foreach (var item3 in item2.Asbitems)
|
|
{
|
|
_output.WriteLine(item3.AsbitemName);
|
|
}
|
|
}
|
|
_output.WriteLine("--禁止检查项目" );
|
|
foreach (var item3 in item.ForbidlCheckAsbitems)
|
|
{
|
|
_output.WriteLine(item3.AsbitemName);
|
|
}
|
|
}
|
|
await unitOfWork.CompleteAsync();
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
public async Task GetCustomerOrgAppointPatientRegisterByPersonIdAsync()
|
|
{
|
|
using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
|
|
{
|
|
|
|
var entity = new PersonIdInputDto()
|
|
{
|
|
PersonId = new Guid("3a12d72c-19d9-e8b2-71f6-cf283103e191")
|
|
};
|
|
var item = await _appService.GetCustomerOrgAppointPatientRegisterByPersonIdAsync(entity);
|
|
_output.WriteLine(item.PatientRegisterId.ToString());
|
|
await unitOfWork.CompleteAsync();
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|