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.
		
		
		
		
		
			
		
			
				
					
					
						
							647 lines
						
					
					
						
							27 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							647 lines
						
					
					
						
							27 KiB
						
					
					
				
								using Microsoft.EntityFrameworkCore;
							 | 
						|
								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 System.Xml.Linq;
							 | 
						|
								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 IRepository<MedicalPackageDetail> _medicalPackageDetailRepository;
							 | 
						|
								        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>>();
							 | 
						|
								            _medicalPackageDetailRepository = GetRequiredService<IRepository<MedicalPackageDetail>>();
							 | 
						|
								            _appService = GetRequiredService<PatientRegisterAppService>();
							 | 
						|
								        }
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task CreatePatientRegisterAsync()
							 | 
						|
								        {
							 | 
						|
								            for (var i = 0; i < 3; i++)
							 | 
						|
								            {
							 | 
						|
								                using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								                {
							 | 
						|
								
							 | 
						|
								                    var entity = new CreatePatientRegisterDto()
							 | 
						|
								                    {
							 | 
						|
								                        MedicalCenterId = new Guid("0de5b78a-731d-4f80-b262-655ebbf04581"),
							 | 
						|
								                        //PatientId = new Guid("3a119be6-d9aa-2e13-a764-0b363c60169d"),
							 | 
						|
								                        CustomerOrgId = new Guid("00000000-0000-0000-0000-000000000001"),
							 | 
						|
								                        CustomerOrgRegisterId = new Guid("00000000-0000-0000-0000-000000000001"),
							 | 
						|
								                        PatientName = "test",
							 | 
						|
								                        SexId = SexFlag.UnKnown,
							 | 
						|
								                        BirthDate = null,
							 | 
						|
								                        Age = 38,
							 | 
						|
								                        Telephone = "010-0000001",
							 | 
						|
								                        MobileTelephone = "18911254911",
							 | 
						|
								                        JobCardNo = "jobCardNo",
							 | 
						|
								                        MedicalCardNo = "MedicalCardNo",
							 | 
						|
								                        MaritalStatusId = MaritalStatusFlag.Married,
							 | 
						|
								                        //MedicalTypeId = new Guid("3a0c5093-6dbf-d29b-cfbc-b1f742ee59d3"),
							 | 
						|
								                        //PersonnelTypeId = new Guid("3a0c5099-a5f3-e41a-dfab-caeae79e0dfe"),
							 | 
						|
								                        NationId = "001",
							 | 
						|
								                        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",
							 | 
						|
								                        Address = "Address1",
							 | 
						|
								                        Email = "83986010@qq.com"
							 | 
						|
								                    };
							 | 
						|
								
							 | 
						|
								                    //entity.RegisterCheckAsbitems.Add(new CreatePatientRegisterRegisterCheckAsbitem()
							 | 
						|
								                    //{
							 | 
						|
								
							 | 
						|
								                    //    AsbitemId = new Guid("3a0c657d-4e73-9bab-68da-56ab2f088bb1"),
							 | 
						|
								                    //    StandardPrice = 10,
							 | 
						|
								                    //    ChargePrice = 10,
							 | 
						|
								                    //    Amount = 1,
							 | 
						|
								                    //    PayTypeFlag = PayTypeFlag.PersonPay,
							 | 
						|
								                    //    IsCharge = 'N'
							 | 
						|
								                    //});
							 | 
						|
								
							 | 
						|
								                    //entity.RegisterCheckAsbitems.Add(new CreatePatientRegisterRegisterCheckAsbitem()
							 | 
						|
								                    //{
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								                    //    AsbitemId = new Guid("3a0c5616-dab2-c209-f099-a6231ef57ac3"),
							 | 
						|
								                    //    StandardPrice = 10,
							 | 
						|
								                    //    ChargePrice = 10,
							 | 
						|
								                    //    Amount = 1,
							 | 
						|
								                    //    PayTypeFlag = PayTypeFlag.PersonPay,
							 | 
						|
								                    //    IsCharge = 'N'
							 | 
						|
								                    //});
							 | 
						|
								
							 | 
						|
								                    //entity.RegisterCheckAsbitems.Add(new CreatePatientRegisterRegisterCheckAsbitem()
							 | 
						|
								                    //{
							 | 
						|
								
							 | 
						|
								                    //    AsbitemId = new Guid("3a0c55f0-92b7-caa6-3fc3-f9f04ca45ad3"),
							 | 
						|
								                    //    StandardPrice = 10,
							 | 
						|
								                    //    ChargePrice = 10,
							 | 
						|
								                    //    Amount = 1,
							 | 
						|
								                    //    PayTypeFlag = PayTypeFlag.PersonPay,
							 | 
						|
								                    //    IsCharge = 'N'
							 | 
						|
								                    //});
							 | 
						|
								
							 | 
						|
								                    //entity.RegisterCheckAsbitems.Add(new CreatePatientRegisterRegisterCheckAsbitem()
							 | 
						|
								                    //{
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								                    //    AsbitemId = new Guid("3a0c55fa-63b9-1510-3e81-20750c496d44"),
							 | 
						|
								                    //    StandardPrice = 10,
							 | 
						|
								                    //    ChargePrice = 10,
							 | 
						|
								                    //    Amount = 1,
							 | 
						|
								                    //    PayTypeFlag = PayTypeFlag.PersonPay,
							 | 
						|
								                    //    IsCharge = 'N'
							 | 
						|
								                    //});
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								                    //entity.RegisterCheckAsbitems.Add(new CreatePatientRegisterRegisterCheckAsbitem()
							 | 
						|
								                    //{
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								                    //    AsbitemId = new Guid("3a0c55fe-559e-d6e7-7f74-221edeeaf817"),
							 | 
						|
								                    //    StandardPrice = 10,
							 | 
						|
								                    //    ChargePrice = 10,
							 | 
						|
								                    //    Amount = 1,
							 | 
						|
								                    //    PayTypeFlag = PayTypeFlag.PersonPay,
							 | 
						|
								                    //    IsCharge = 'N'
							 | 
						|
								                    //});
							 | 
						|
								
							 | 
						|
								                    var newEntity = await _appService.CreatePatientRegisterAsync(entity);
							 | 
						|
								                    await unitOfWork.CompleteAsync();
							 | 
						|
								                }
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task CreatePatientRegisterByMedicalPackageAsync()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								                var entity = new CreatePatientRegisterDto()
							 | 
						|
								                {
							 | 
						|
								                    //PatientRegisterId = new Guid("3a11abec-a6aa-e656-16db-cb0bccf8de46"),
							 | 
						|
								                    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-000000000001"),
							 | 
						|
								                    PatientName = "test",
							 | 
						|
								                    SexId = SexFlag.UnKnown,
							 | 
						|
								                    BirthDate = null,
							 | 
						|
								                    Age = 38,
							 | 
						|
								                    Telephone = "010-0000001",
							 | 
						|
								                    MobileTelephone = "18911254911",
							 | 
						|
								                    JobCardNo = "jobCardNo",
							 | 
						|
								                    MedicalCardNo = "MedicalCardNo",
							 | 
						|
								                    MaritalStatusId = MaritalStatusFlag.Married,
							 | 
						|
								                    MedicalTypeId = new Guid("3a0c5093-6dbf-d29b-cfbc-b1f742ee59d3"),
							 | 
						|
								                    PersonnelTypeId = new Guid("3a0c5099-a5f3-e41a-dfab-caeae79e0dfe"),
							 | 
						|
								                    NationId = "001",
							 | 
						|
								                    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",
							 | 
						|
								                    Address = "Address1",
							 | 
						|
								                    Email = "83986010@qq.com"
							 | 
						|
								                };
							 | 
						|
								                var medicalPackageId = new Guid("3a0c51d4-2c5a-2a05-e4c4-e335012617be");
							 | 
						|
								                entity.MedicalPackageId = medicalPackageId;
							 | 
						|
								                var medicalPackageDetails = (await _medicalPackageDetailRepository.GetQueryableAsync()).Include(o => o.Asbitem).Where(o => o.MedicalPackageId == medicalPackageId).ToList();
							 | 
						|
								                foreach (var medicalPackageDetail in medicalPackageDetails)
							 | 
						|
								                {
							 | 
						|
								                    var registerCheckAsbitem = new CreatePatientRegisterRegisterCheckAsbitem()
							 | 
						|
								                    {
							 | 
						|
								                        AsbitemId = medicalPackageDetail.AsbitemId,
							 | 
						|
								                        StandardPrice = medicalPackageDetail.Asbitem.Price,
							 | 
						|
								                        ChargePrice = medicalPackageDetail.Asbitem.Price,
							 | 
						|
								                        Amount = 1,
							 | 
						|
								                        PayTypeFlag = PayTypeFlag.PersonPay,
							 | 
						|
								                        IsCharge = 'N'
							 | 
						|
								                    };
							 | 
						|
								                    entity.RegisterCheckAsbitems.Add(registerCheckAsbitem);
							 | 
						|
								                }
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								                var newEntity = await _appService.CreatePatientRegisterAsync(entity);
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task UpdatePatientRegisterAsync()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								                var entity = new CreatePatientRegisterDto()
							 | 
						|
								                {
							 | 
						|
								                    PatientRegisterId = new Guid("3a11abec-a6aa-e656-16db-cb0bccf8de46"),
							 | 
						|
								                    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-000000000001"),
							 | 
						|
								                    PatientName = "test",
							 | 
						|
								                    SexId = SexFlag.UnKnown,
							 | 
						|
								                    BirthDate = null,
							 | 
						|
								                    Age = 38,
							 | 
						|
								                    Telephone = "010-0000001",
							 | 
						|
								                    MobileTelephone = "18911254911",
							 | 
						|
								                    JobCardNo = "jobCardNo",
							 | 
						|
								                    MedicalCardNo = "MedicalCardNo",
							 | 
						|
								                    MaritalStatusId = MaritalStatusFlag.Married,
							 | 
						|
								                    MedicalTypeId = new Guid("3a0c5093-6dbf-d29b-cfbc-b1f742ee59d3"),
							 | 
						|
								                    PersonnelTypeId = new Guid("3a0c5099-a5f3-e41a-dfab-caeae79e0dfe"),
							 | 
						|
								                    NationId = "001",
							 | 
						|
								                    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",
							 | 
						|
								                    Address = "Address1",
							 | 
						|
								                    Email = "83986010@qq.com"
							 | 
						|
								                };
							 | 
						|
								
							 | 
						|
								                entity.RegisterCheckAsbitems.Add(new CreatePatientRegisterRegisterCheckAsbitem()
							 | 
						|
								                {
							 | 
						|
								                    Id = new Guid("3a11caa1-9fb2-27f8-22f9-ec1e272567e0"),
							 | 
						|
								                    AsbitemId = new Guid("3a0c54c8-7a9b-3603-ce81-40f3b97b7637"),
							 | 
						|
								                    StandardPrice = (decimal)10.85,
							 | 
						|
								                    ChargePrice = (decimal)10.51,
							 | 
						|
								                    Amount = 2,
							 | 
						|
								                    PayTypeFlag = PayTypeFlag.PersonPay,
							 | 
						|
								                    IsCharge = 'N'
							 | 
						|
								                });
							 | 
						|
								                entity.RegisterCheckAsbitems.Add(new CreatePatientRegisterRegisterCheckAsbitem()
							 | 
						|
								                {
							 | 
						|
								                    Id = new Guid("3a11caa1-9fb2-38dd-03f1-bb9cd995961c"),
							 | 
						|
								                    AsbitemId = new Guid("3a0c55fa-63b9-1510-3e81-20750c496d44"),
							 | 
						|
								                    StandardPrice = 20,
							 | 
						|
								                    ChargePrice = 20,
							 | 
						|
								                    Amount = 1,
							 | 
						|
								                    PayTypeFlag = PayTypeFlag.PersonPay,
							 | 
						|
								                    IsCharge = 'N'
							 | 
						|
								                });
							 | 
						|
								
							 | 
						|
								                entity.RegisterCheckAsbitems.Add(new CreatePatientRegisterRegisterCheckAsbitem()
							 | 
						|
								                {
							 | 
						|
								                    Id = new Guid("3a11caa1-9fb2-5a05-ec0c-ed3c6c0f37c0"),
							 | 
						|
								                    AsbitemId = new Guid("3a0c55fe-559e-d6e7-7f74-221edeeaf817"),
							 | 
						|
								                    StandardPrice = 30,
							 | 
						|
								                    ChargePrice = 30,
							 | 
						|
								                    Amount = 1,
							 | 
						|
								                    PayTypeFlag = PayTypeFlag.PersonPay,
							 | 
						|
								                    IsCharge = 'N'
							 | 
						|
								                });
							 | 
						|
								
							 | 
						|
								                entity.RegisterCheckAsbitems.Add(new CreatePatientRegisterRegisterCheckAsbitem()
							 | 
						|
								                {
							 | 
						|
								                    //Id = new Guid("3a11c048-242a-028d-fa94-8103a3648a46"),
							 | 
						|
								                    AsbitemId = new Guid("3a11abbc-b19e-3549-e639-acc0e9aa6fbc"),
							 | 
						|
								                    StandardPrice = 40,
							 | 
						|
								                    ChargePrice = 40,
							 | 
						|
								                    Amount = 1,
							 | 
						|
								                    PayTypeFlag = PayTypeFlag.PersonPay,
							 | 
						|
								                    IsCharge = 'N'
							 | 
						|
								                });
							 | 
						|
								
							 | 
						|
								                var newEntity = await _appService.CreatePatientRegisterAsync(entity);
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task BatchAddAsbitems()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								                var entity = new PatientRegisterBatchAddAsbitemsDto()
							 | 
						|
								                {
							 | 
						|
								                    PatientRegisterId = new Guid("3a11abec-a6aa-e656-16db-cb0bccf8de46")
							 | 
						|
								                };
							 | 
						|
								
							 | 
						|
								                entity.RegisterCheckAsbitems.Add(new BatchCreateRegisterCheckAsbitem()
							 | 
						|
								                {
							 | 
						|
								                    AsbitemId = new Guid("3a0c55fe-559e-d6e7-7f74-221edeeaf817"),
							 | 
						|
								
							 | 
						|
								                    ChargePrice = (decimal)10.51,
							 | 
						|
								                    Amount = 2,
							 | 
						|
								                    PayTypeFlag = PayTypeFlag.OrgPay,
							 | 
						|
								                });
							 | 
						|
								                entity.RegisterCheckAsbitems.Add(new BatchCreateRegisterCheckAsbitem()
							 | 
						|
								                {
							 | 
						|
								                    AsbitemId = new Guid("3a0c55ff-e111-0551-1381-6bd2a894c158"),
							 | 
						|
								                    ChargePrice = 20,
							 | 
						|
								                    Amount = 1,
							 | 
						|
								                    PayTypeFlag = PayTypeFlag.PersonPay,
							 | 
						|
								                });
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								                await _appService.BatchAddAsbitems(entity);
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task BatchDeleteAsbitems()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								                var entity = new PatientRegisterBatchDeleteAsbitemsDto()
							 | 
						|
								                {
							 | 
						|
								                    PatientRegisterId = new Guid("3a11abec-a6aa-e656-16db-cb0bccf8de46"),
							 | 
						|
								                    IsDeleteGroup = 'Y'
							 | 
						|
								                };
							 | 
						|
								
							 | 
						|
								                entity.RegisterCheckAsbitems.Add(new BatchDeleteRegisterCheckAsbitem()
							 | 
						|
								                {
							 | 
						|
								                    AsbitemId = new Guid("3a0c55fe-559e-d6e7-7f74-221edeeaf817"),
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								                });
							 | 
						|
								                entity.RegisterCheckAsbitems.Add(new BatchDeleteRegisterCheckAsbitem()
							 | 
						|
								                {
							 | 
						|
								                    AsbitemId = new Guid("3a0c55ff-e111-0551-1381-6bd2a894c158"),
							 | 
						|
								
							 | 
						|
								                });
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								                await _appService.BatchDeleteAsbitems(entity);
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task BatchUpdateCustomerOrgGroupAsync()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								                var entity = new UpdatePatientRegisterCustomerOrgGroupDto()
							 | 
						|
								                {
							 | 
						|
								                    PatientRegisterId = new Guid("3a0ea160-5051-9c6a-d863-28a2ee9e0ad2"),
							 | 
						|
								                    CustomerOrgGroupId = new Guid("3a11cb78-7d85-6a7d-d0f1-b522b491bd75"),
							 | 
						|
								                    PayTypeFlag = PayTypeFlag.OrgPay,
							 | 
						|
								                    IsReserveAddAsbitem = 'N'
							 | 
						|
								                };
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								                await _appService.BatchUpdateCustomerOrgGroupAsync(entity);
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task CreatePatientRegisterFromExcelAsync()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								                var entity = new CreatePatientRegisterExcelRequestDto()
							 | 
						|
								                {
							 | 
						|
								                    MedicalCenterId = new Guid("68f2d834-2bf0-4978-ad54-d2133c12a333"),
							 | 
						|
								                    CustomerOrgId = new Guid("3a0c5101-a6a6-e48a-36ec-33e7567a99e6"),
							 | 
						|
								                    CustomerOrgRegisterId = new Guid("3a114e09-3bd2-82f3-f73e-f2de4bead094"),
							 | 
						|
								                    PatientNo = "T4629",
							 | 
						|
								                    PatientName = "彭军",
							 | 
						|
								                    SexName = "未知",
							 | 
						|
								                    BirthDate = "2000-01-01",
							 | 
						|
								                    JobCardNo = "JobCardNo",
							 | 
						|
								                    MedicalCardNo = "MedicalCardNo",
							 | 
						|
								                    MaritalStatusName = "",
							 | 
						|
								                    MedicalTypeName = "调干",
							 | 
						|
								                    PersonnelTypeName = "普通员工",
							 | 
						|
								                    JobPost = "JobPost",
							 | 
						|
								                    JobTitle = "JobTitle",
							 | 
						|
								                    Salesman = "Salesman",
							 | 
						|
								                    IsAutoCreateDepartment = 'N',
							 | 
						|
								                    DepartmentName = "长沙神豚F",
							 | 
						|
								                    CustomerOrgGroupName = "男子组",
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								                };
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								                await _appService.CreatePatientRegisterFromExcelAsync(entity);
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task CreatePatientRegisterFromHistoryAsync()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								                var entity = new CreatePatientRegisterHistoryRequestDto()
							 | 
						|
								                {
							 | 
						|
								                    MedicalCenterId = new Guid("68f2d834-2bf0-4978-ad54-d2133c12a333"),
							 | 
						|
								                    CustomerOrgId = new Guid("3a0c5101-a6a6-e48a-36ec-33e7567a99e6"),
							 | 
						|
								                    CustomerOrgRegisterId = new Guid("3a114e09-3bd2-82f3-f73e-f2de4bead094"),
							 | 
						|
								                    PatientRegisterId = new Guid("3a11d557-12ec-dc6b-b99f-0c135796fe6a"),
							 | 
						|
								                    CustomerOrgGroupId = new Guid("3a11b42f-8c01-c46d-4378-0b5c20414e42"),
							 | 
						|
								                    CompleteFlag = PatientRegisterCompleteFlag.PreRegistration,
							 | 
						|
								                    PayTypeFlag = PayTypeFlag.OrgPay
							 | 
						|
								
							 | 
						|
								                };
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								                await _appService.CreatePatientRegisterFromHistoryAsync(entity);
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task GetSameNamePatientAsync()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								                var items = await _appService.GetSameNamePatientAsync(new GetSameNamePatientInputDto() { Name = "李九" });
							 | 
						|
								                _output.WriteLine(items.Count().ToString());
							 | 
						|
								                foreach (var item in items)
							 | 
						|
								                {
							 | 
						|
								                    _output.WriteLine(item.PatientName + "," + item.CustomerOrgName + "," + item.DepartmentName);
							 | 
						|
								                }
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task GetCustomerOrgSameNamePatientAsync()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								
							 | 
						|
								                var items = await _appService.GetCustomerOrgSameNamePatientAsync(
							 | 
						|
								                    new GetCustomerOrgSameNamePatientInputDto()
							 | 
						|
								                    {
							 | 
						|
								                        CustomerOrgId = new Guid("3a0c5101-a6a6-e48a-36ec-33e7567a99e6"),
							 | 
						|
								                        Name = "李九"
							 | 
						|
								                    });
							 | 
						|
								                _output.WriteLine(items.Count().ToString());
							 | 
						|
								                foreach (var item in items)
							 | 
						|
								                {
							 | 
						|
								                    _output.WriteLine(item.PatientName + "," + item.CustomerOrgName + "," + item.DepartmentName);
							 | 
						|
								                }
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task GetAlreadyRegisterPatientRegisterByNoAsync()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								                var item = await _appService.GetAlreadyRegisterPatientRegisterByNoAsync(new PatientRegisterNoInputDto()
							 | 
						|
								                {
							 | 
						|
								                    PatientRegisterNo = "T4830",
							 | 
						|
								                    PatientNo = ""
							 | 
						|
								                });
							 | 
						|
								                _output.WriteLine(item.PatientName + "," + item.CustomerOrgName + "," + item.CustomerOrgParentName);
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task UpdatePatientRegisterSummarySuggestionAsync()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								                var entity = new UpdatePatientRegisterSummarySuggestionDto()
							 | 
						|
								                {
							 | 
						|
								                    PatientRegisterId = new Guid("3a11ee70-02cb-c5e6-a087-79ecdd0356b6"),
							 | 
						|
								
							 | 
						|
								                    SumSummarys = new List<UpdateSumSummaryDto>()
							 | 
						|
								                    {
							 | 
						|
								                        new UpdateSumSummaryDto()
							 | 
						|
								                        {
							 | 
						|
								                            SummaryTitle ="111",
							 | 
						|
								                            Details = new List<UpdateSumSummaryContentDto>()
							 | 
						|
								                            {
							 | 
						|
								                                new UpdateSumSummaryContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SummaryContent = "aaa"
							 | 
						|
								                                },
							 | 
						|
								                                 new UpdateSumSummaryContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SummaryContent = "bbb"
							 | 
						|
								                                }
							 | 
						|
								                            }
							 | 
						|
								                        },
							 | 
						|
								                        new UpdateSumSummaryDto()
							 | 
						|
								                        {
							 | 
						|
								                            SummaryTitle ="222",
							 | 
						|
								                            Details = new List<UpdateSumSummaryContentDto>()
							 | 
						|
								                            {
							 | 
						|
								                                new UpdateSumSummaryContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SummaryContent = "ccc"
							 | 
						|
								                                },
							 | 
						|
								                                 new UpdateSumSummaryContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SummaryContent = "ddd"
							 | 
						|
								                                }
							 | 
						|
								                            }
							 | 
						|
								                        }
							 | 
						|
								                    },
							 | 
						|
								                    SumSuggestions = new List<UpdateSumSuggestionDto>()
							 | 
						|
								                    {
							 | 
						|
								                        new UpdateSumSuggestionDto()
							 | 
						|
								                        {
							 | 
						|
								                            DiagnosisIds = new List<Guid>()
							 | 
						|
								                            {
							 | 
						|
								                                new Guid("3a0ec93f-bc7c-bc6b-d8b2-9a1eaeef398d"),
							 | 
						|
								                                new Guid("3a0ecab2-ee3a-4b32-997b-5979a672cf62")
							 | 
						|
								                            },
							 | 
						|
								                            SuggestionTitle = "ssss",
							 | 
						|
								                            MedicalInterpretations= new List<UpdateSumSuggestionContentDto>()
							 | 
						|
								                            {
							 | 
						|
								                                new UpdateSumSuggestionContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SuggestionContent = "mmm"
							 | 
						|
								                                },
							 | 
						|
								                                 new UpdateSumSuggestionContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SuggestionContent = "mmm"
							 | 
						|
								                                }
							 | 
						|
								                            },
							 | 
						|
								                            CommonReasons = new List<UpdateSumSuggestionContentDto>()
							 | 
						|
								                            {
							 | 
						|
								                                new UpdateSumSuggestionContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SuggestionContent = "ccc"
							 | 
						|
								                                },
							 | 
						|
								                                 new UpdateSumSuggestionContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SuggestionContent = "ccc"
							 | 
						|
								                                }
							 | 
						|
								                            },
							 | 
						|
								                            HealthGuidances =  new List<UpdateSumSuggestionContentDto>()
							 | 
						|
								                            {
							 | 
						|
								                                new UpdateSumSuggestionContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SuggestionContent = "hhh"
							 | 
						|
								                                },
							 | 
						|
								                                 new UpdateSumSuggestionContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SuggestionContent = "hhh"
							 | 
						|
								                                }
							 | 
						|
								                            },
							 | 
						|
								
							 | 
						|
								                        },
							 | 
						|
								                        new UpdateSumSuggestionDto()
							 | 
						|
								                        {
							 | 
						|
								                            DiagnosisIds = new List<Guid>()
							 | 
						|
								                            {
							 | 
						|
								                                new Guid("3a0ed8a2-8e4b-c66f-292f-afffc76d3fd6"),
							 | 
						|
								                                new Guid("3a0ed8e0-6e1a-4b6a-55ec-a2e87ccdf6a9")
							 | 
						|
								                            },
							 | 
						|
								                            SuggestionTitle = "ttt",
							 | 
						|
								                            MedicalInterpretations= new List<UpdateSumSuggestionContentDto>()
							 | 
						|
								                            {
							 | 
						|
								                                new UpdateSumSuggestionContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SuggestionContent = "mmm"
							 | 
						|
								                                },
							 | 
						|
								                                 new UpdateSumSuggestionContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SuggestionContent = "mmm"
							 | 
						|
								                                }
							 | 
						|
								                            },
							 | 
						|
								                            CommonReasons = new List<UpdateSumSuggestionContentDto>()
							 | 
						|
								                            {
							 | 
						|
								                                new UpdateSumSuggestionContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SuggestionContent = "ccc"
							 | 
						|
								                                },
							 | 
						|
								                                 new UpdateSumSuggestionContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SuggestionContent = "ccc"
							 | 
						|
								                                }
							 | 
						|
								                            },
							 | 
						|
								                            HealthGuidances =  new List<UpdateSumSuggestionContentDto>()
							 | 
						|
								                            {
							 | 
						|
								                                new UpdateSumSuggestionContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SuggestionContent = "hhh"
							 | 
						|
								                                },
							 | 
						|
								                                 new UpdateSumSuggestionContentDto()
							 | 
						|
								                                {
							 | 
						|
								                                    SuggestionContent = "hhh"
							 | 
						|
								                                }
							 | 
						|
								                            },
							 | 
						|
								
							 | 
						|
								                        }
							 | 
						|
								                    }
							 | 
						|
								                };
							 | 
						|
								               
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								                var newEntity = await _appService.UpdatePatientRegisterSummarySuggestionAsync(entity);
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								    }
							 | 
						|
								}
							 |