7 changed files with 311 additions and 40 deletions
-
27src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs
-
2src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs
-
17src/Shentun.Peis.Domain/RegisterCheckAsbitems/CreateRegisterCheckAsbitemEntity.cs
-
57src/Shentun.Peis.Domain/RegisterCheckAsbitems/RegisterCheckAsbitemManager.cs
-
39src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs
-
113test/Shentun.Peis.Application.Tests/PatientRegisterAppServiceTest.cs
-
96test/Shentun.Peis.Domain.Tests/RegisterCheckAsbitemManagerTest.cs
@ -0,0 +1,17 @@ |
|||||
|
using Shentun.Peis.Models; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Shentun.Peis.RegisterCheckAsbitems |
||||
|
{ |
||||
|
public class CreateRegisterCheckAsbitemEntity |
||||
|
{ |
||||
|
public List<RegisterCheckItem> RegisterCheckItems { get; set; } |
||||
|
public List<RegisterCheckAsbitem> RegisterCheckAsbitems { get; set; } |
||||
|
public List<RegisterCheck> RegisterChecks { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,113 @@ |
|||||
|
using Shentun.Peis.Enums; |
||||
|
using Shentun.Peis.Models; |
||||
|
using Shentun.Peis.PatientRegisters; |
||||
|
using Shentun.Peis.RegisterAsbitems; |
||||
|
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; |
||||
|
using Xunit.Abstractions; |
||||
|
|
||||
|
namespace Shentun.Peis |
||||
|
{ |
||||
|
public class PatientRegisterAppServiceTest : PeisApplicationTestBase |
||||
|
{ |
||||
|
private readonly IRepository<PatientRegister> _repository; |
||||
|
private readonly PatientRegisterAppService _appService; |
||||
|
private readonly ITestOutputHelper _output; |
||||
|
private readonly IUnitOfWorkManager _unitOfWorkManager; |
||||
|
public PatientRegisterAppServiceTest(ITestOutputHelper testOutputHelper) |
||||
|
{ |
||||
|
_output = testOutputHelper; |
||||
|
_unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>(); |
||||
|
_repository = GetRequiredService<IRepository<PatientRegister>>(); |
||||
|
_appService = GetRequiredService<PatientRegisterAppService>(); |
||||
|
} |
||||
|
[Fact] |
||||
|
public async Task CreatePatientRegisterAsync() |
||||
|
{ |
||||
|
using (var unitOfWork = _unitOfWorkManager.Begin()) |
||||
|
{ |
||||
|
var entity = new CreatePatientRegisterDto() |
||||
|
{ |
||||
|
MedicalCenterId = new Guid("68f2d834-2bf0-4978-ad54-d2133c12a333"), |
||||
|
PatientId = new Guid("3a119be6-d9aa-2e13-a764-0b363c60169d"), |
||||
|
CustomerOrgId = new Guid("00000000-0000-0000-0000-000000000001"), |
||||
|
CustomerOrgRegisterId = new Guid("00000000-0000-0000-0000-000000000002"), |
||||
|
PatientName = "test", |
||||
|
SexId = SexFlag.UnKnown, |
||||
|
BirthDate = null, |
||||
|
Age = 38, |
||||
|
JobCardNo = "jobCardNo", |
||||
|
MedicalCardNo = "MedicalCardNo", |
||||
|
MaritalStatusId = MaritalStatusFlag.Married, |
||||
|
MedicalTypeId = new Guid("3a0c5093-6dbf-d29b-cfbc-b1f742ee59d3"), |
||||
|
PersonnelTypeId = new Guid("3a0c5099-a5f3-e41a-dfab-caeae79e0dfe"), |
||||
|
JobPost = "JobPost", |
||||
|
JobTitle = "JobTitle", |
||||
|
Salesman = "Salesman", |
||||
|
SexHormoneTermId = new Guid("3a0d38cf-8b3c-95db-1a69-5119f28dc468"), |
||||
|
MedicalConclusionId = new Guid("3a0c50fe-cacf-d3c8-8c3c-9d3495d8bd76"), |
||||
|
IsUpload = 'N', |
||||
|
CompleteFlag = PatientRegisterCompleteFlag.PreRegistration, |
||||
|
IsMedicalStart = 'N', |
||||
|
MedicalStartDate = null, |
||||
|
IsRecoverGuide = 'N', |
||||
|
SummaryDate = null, |
||||
|
IsAudit = 'N', |
||||
|
IsLock = 'N', |
||||
|
IsNameHide = 'N', |
||||
|
IsPhoneFollow = 'N', |
||||
|
IsVip = 'N', |
||||
|
Remark = "Remark" |
||||
|
}; |
||||
|
|
||||
|
entity.RegisterAsbitems.Add(new CreateRegisterCheckAsbitemDto() |
||||
|
{ |
||||
|
AsbitemId = new Guid("3a0c55fa-63b9-1510-3e81-20750c496d44"), |
||||
|
StandardPrice = 10, |
||||
|
ChargePrice = 10, |
||||
|
Amount = 1, |
||||
|
PayTypeFlag = PayTypeFlag.PersonPay, |
||||
|
IsCharge = 'N' |
||||
|
}); |
||||
|
entity.RegisterAsbitems.Add(new CreateRegisterCheckAsbitemDto() |
||||
|
{ |
||||
|
AsbitemId = new Guid("3a0c5600-ae78-9ed4-e3c1-993ef41d3c51"), |
||||
|
StandardPrice = 10, |
||||
|
ChargePrice = 10, |
||||
|
Amount = 1, |
||||
|
PayTypeFlag = PayTypeFlag.PersonPay, |
||||
|
IsCharge = 'N' |
||||
|
}); |
||||
|
|
||||
|
entity.RegisterAsbitems.Add(new CreateRegisterCheckAsbitemDto() |
||||
|
{ |
||||
|
AsbitemId = new Guid("3a0c5635-b904-dc9b-593e-93d0dd228576"), |
||||
|
StandardPrice = 10, |
||||
|
ChargePrice = 10, |
||||
|
Amount = 1, |
||||
|
PayTypeFlag = PayTypeFlag.PersonPay, |
||||
|
IsCharge = 'N' |
||||
|
}); |
||||
|
|
||||
|
entity.RegisterAsbitems.Add(new CreateRegisterCheckAsbitemDto() |
||||
|
{ |
||||
|
AsbitemId = new Guid("3a11abbc-b19e-3549-e639-acc0e9aa6fbc"), |
||||
|
StandardPrice = 10, |
||||
|
ChargePrice = 10, |
||||
|
Amount = 1, |
||||
|
PayTypeFlag = PayTypeFlag.PersonPay, |
||||
|
IsCharge = 'N' |
||||
|
}); |
||||
|
|
||||
|
var newEntity = await _appService.CreatePatientRegisterAsync(entity); |
||||
|
await unitOfWork.CompleteAsync(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,96 @@ |
|||||
|
using Shentun.Peis.Enums; |
||||
|
using Shentun.Peis.GuidTypes; |
||||
|
using Shentun.Peis.Models; |
||||
|
using Shentun.Peis.RegisterAsbitems; |
||||
|
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; |
||||
|
using Xunit.Abstractions; |
||||
|
|
||||
|
namespace Shentun.Peis |
||||
|
{ |
||||
|
public class RegisterCheckAsbitemManagerTest : PeisDomainTestBase |
||||
|
{ |
||||
|
private readonly IRepository<RegisterCheckAsbitem, Guid> _repository; |
||||
|
private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository; |
||||
|
private readonly IRepository<RegisterCheck, Guid> _registerCheckRepository; |
||||
|
private readonly IRepository<RegisterCheckItem> _registerCheckItemRepository; |
||||
|
|
||||
|
private readonly RegisterCheckAsbitemManager _manager; |
||||
|
private readonly ITestOutputHelper _output; |
||||
|
private readonly IUnitOfWorkManager _unitOfWorkManager; |
||||
|
public RegisterCheckAsbitemManagerTest(ITestOutputHelper output) |
||||
|
{ |
||||
|
_output = output; |
||||
|
_repository = GetRequiredService<IRepository<RegisterCheckAsbitem, Guid>>(); |
||||
|
_patientRegisterRepository = GetRequiredService<IRepository<PatientRegister, Guid>>(); |
||||
|
_registerCheckRepository = GetRequiredService<IRepository<RegisterCheck, Guid>>(); |
||||
|
_registerCheckItemRepository = GetRequiredService<IRepository<RegisterCheckItem>>(); |
||||
|
|
||||
|
|
||||
|
_manager = GetRequiredService<RegisterCheckAsbitemManager>(); |
||||
|
|
||||
|
_unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>(); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public async Task CreateManyAsync() |
||||
|
{ |
||||
|
using (var unitOfWork = _unitOfWorkManager.Begin()) |
||||
|
{ |
||||
|
var patientRegister = await _patientRegisterRepository.GetAsync(new Guid("3a11a1ad-4def-555b-0f6f-dbbadd652d9f")); |
||||
|
List<RegisterCheckAsbitem> registerAsbitems = new List<RegisterCheckAsbitem>(); |
||||
|
registerAsbitems.Add(new RegisterCheckAsbitem() |
||||
|
{ |
||||
|
AsbitemId = new Guid("3a0c55fa-63b9-1510-3e81-20750c496d44"), |
||||
|
StandardPrice = 10, |
||||
|
ChargePrice = 10, |
||||
|
Amount = 1, |
||||
|
PayTypeFlag = PayTypeFlag.PersonPay, |
||||
|
IsCharge = 'N' |
||||
|
}); |
||||
|
registerAsbitems.Add(new RegisterCheckAsbitem() |
||||
|
{ |
||||
|
AsbitemId = new Guid("3a0c5600-ae78-9ed4-e3c1-993ef41d3c51"), |
||||
|
StandardPrice = 10, |
||||
|
ChargePrice = 10, |
||||
|
Amount = 1, |
||||
|
PayTypeFlag = PayTypeFlag.PersonPay, |
||||
|
IsCharge = 'N' |
||||
|
}); |
||||
|
|
||||
|
registerAsbitems.Add(new RegisterCheckAsbitem() |
||||
|
{ |
||||
|
AsbitemId = new Guid("3a0c5635-b904-dc9b-593e-93d0dd228576"), |
||||
|
StandardPrice = 10, |
||||
|
ChargePrice = 10, |
||||
|
Amount = 1, |
||||
|
PayTypeFlag = PayTypeFlag.PersonPay, |
||||
|
IsCharge = 'N' |
||||
|
}); |
||||
|
|
||||
|
registerAsbitems.Add(new RegisterCheckAsbitem() |
||||
|
{ |
||||
|
AsbitemId = new Guid("3a11abbc-b19e-3549-e639-acc0e9aa6fbc"), |
||||
|
StandardPrice = 10, |
||||
|
ChargePrice = 10, |
||||
|
Amount = 1, |
||||
|
PayTypeFlag = PayTypeFlag.PersonPay, |
||||
|
IsCharge = 'N' |
||||
|
}); |
||||
|
|
||||
|
var newEntity = await _manager.CreateManyAsync(patientRegister, registerAsbitems); |
||||
|
await _registerCheckRepository.InsertManyAsync(newEntity.RegisterChecks); |
||||
|
await _repository.InsertManyAsync(newEntity.RegisterCheckAsbitems); |
||||
|
await _registerCheckItemRepository.InsertManyAsync(newEntity.RegisterCheckItems); |
||||
|
await unitOfWork.CompleteAsync(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue