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.
		
		
		
		
		
			
		
			
				
					
					
						
							95 lines
						
					
					
						
							4.4 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							95 lines
						
					
					
						
							4.4 KiB
						
					
					
				
								using Shentun.Peis.CustomerOrgs;
							 | 
						|
								using Shentun.Peis.Models;
							 | 
						|
								using Shentun.Peis.PatientRegisters;
							 | 
						|
								using Shentun.Peis.PrintReports;
							 | 
						|
								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 PrintReportAppServiceTest : PeisApplicationTestBase
							 | 
						|
								    {
							 | 
						|
								        private readonly IRepository<CustomerOrg, Guid> _repository;
							 | 
						|
								        private readonly PrintReportAppService _appService;
							 | 
						|
								        private readonly ITestOutputHelper _output;
							 | 
						|
								        private readonly IUnitOfWorkManager _unitOfWorkManager;
							 | 
						|
								        public PrintReportAppServiceTest(ITestOutputHelper testOutputHelper)
							 | 
						|
								        {
							 | 
						|
								            _output = testOutputHelper;
							 | 
						|
								            _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
							 | 
						|
								            _repository = GetRequiredService<IRepository<CustomerOrg, Guid>>();
							 | 
						|
								            _appService = GetRequiredService<PrintReportAppService>();
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task GetLisRequestReportAsync()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								                var items = await _appService.GetLisRequestReportAsync(new PatientRegisterIdInputDto()
							 | 
						|
								                { PatientRegisterId = new Guid("3a0d942e-f65d-3528-a9c0-e9ecd56db692") });
							 | 
						|
								                _output.WriteLine(items.Count().ToString());
							 | 
						|
								                foreach (var item in items)
							 | 
						|
								                {
							 | 
						|
								                    _output.WriteLine(item.PatientName + "," + item.CustomerOrgName + "," +
							 | 
						|
								                        item.DepartmentName + item.AsbitemNames);
							 | 
						|
								                }
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task GetMedicalReportAsync()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								                var medicalReportDto = await _appService.GetMedicalReportAsync(new PatientRegisterIdInputDto()
							 | 
						|
								                {
							 | 
						|
								                    PatientRegisterId = new Guid("3a11ee70-02cb-c5e6-a087-79ecdd0356b6")
							 | 
						|
								                });
							 | 
						|
								                _output.WriteLine(medicalReportDto.PatientName);
							 | 
						|
								                foreach (var medicalReportType in medicalReportDto.MedicalReportTypes)
							 | 
						|
								                {
							 | 
						|
								                    _output.WriteLine("体检报告类别:" + medicalReportType.MedicalReportTypeName);
							 | 
						|
								                    var topItemTypes = medicalReportDto.ItemTypes.Where(o => o.MedicalReportTypeId == medicalReportType.MedicalReportTypeId
							 | 
						|
								                    && o.ItemTypePathCode.Length == 5)
							 | 
						|
								                        .OrderBy(o => o.DisplayOrder).ToList();
							 | 
						|
								                    foreach (var topItemType in topItemTypes)
							 | 
						|
								                    {
							 | 
						|
								                        var itemTypes = medicalReportDto.ItemTypes.Where(o => o.ItemTypePathCode.StartsWith(topItemType.ItemTypePathCode)).ToList();
							 | 
						|
								                        foreach (var itemType in itemTypes)
							 | 
						|
								                        {
							 | 
						|
								                            var registerChecks = medicalReportDto.RegisterChecks
							 | 
						|
								                                .Where(o => o.ItemTypeId == itemType.ItemTypeId)
							 | 
						|
								                                .OrderBy(o => o.DisplayOrder).ToList();
							 | 
						|
								                            if (registerChecks.Any())
							 | 
						|
								                            {
							 | 
						|
								                                _output.WriteLine("项目类别:" + itemType.ItemTypeName);
							 | 
						|
								                                foreach (var registerCheck in registerChecks)
							 | 
						|
								                                {
							 | 
						|
								                                    _output.WriteLine("检查医生:" + registerCheck.CheckDoctorName + "组合项目:" + registerCheck.AsbitemNames);
							 | 
						|
								                                    foreach (var registerCheckItem in registerCheck.Items)
							 | 
						|
								                                    {
							 | 
						|
								                                        _output.WriteLine("项目:" + registerCheckItem.ItemName + "结果:" + registerCheckItem.Result);
							 | 
						|
								                                    }
							 | 
						|
								                                    foreach (var registerCheckPicture in registerCheck.Pictures)
							 | 
						|
								                                    {
							 | 
						|
								                                        _output.WriteLine("图片:" + registerCheckPicture.PictureFileName);
							 | 
						|
								                                    }
							 | 
						|
								                                }
							 | 
						|
								                            }
							 | 
						|
								                        }
							 | 
						|
								                    }
							 | 
						|
								                }
							 | 
						|
								                await unitOfWork.CompleteAsync();
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								    }
							 | 
						|
								}
							 |