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 _repository; private readonly PrintReportAppService _appService; private readonly ITestOutputHelper _output; private readonly IUnitOfWorkManager _unitOfWorkManager; public PrintReportAppServiceTest(ITestOutputHelper testOutputHelper) { _output = testOutputHelper; _unitOfWorkManager = GetRequiredService(); _repository = GetRequiredService>(); _appService = GetRequiredService(); } [Fact] public async Task GetLisRequestReportAsync() { using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true)) { var items = await _appService.GetLisRequestReportByPatientRegisterIdAsync(new PatientRegisterIdInputDto() { PatientRegisterId = new Guid("3a12707e-bc54-129e-64d0-8cf5556a023c") }); _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(); } } } }