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.

88 lines
4.0 KiB

2 years ago
2 years ago
2 years ago
  1. using Shentun.Peis.CustomerOrgs;
  2. using Shentun.Peis.Models;
  3. using Shentun.Peis.PatientRegisters;
  4. using Shentun.Peis.PrintReports;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using Volo.Abp.Domain.Repositories;
  11. using Volo.Abp.Uow;
  12. using Xunit;
  13. using Xunit.Abstractions;
  14. namespace Shentun.Peis
  15. {
  16. public class PrintReportAppServiceTest : PeisApplicationTestBase
  17. {
  18. private readonly IRepository<CustomerOrg, Guid> _repository;
  19. private readonly PrintReportAppService _appService;
  20. private readonly ITestOutputHelper _output;
  21. private readonly IUnitOfWorkManager _unitOfWorkManager;
  22. public PrintReportAppServiceTest(ITestOutputHelper testOutputHelper)
  23. {
  24. _output = testOutputHelper;
  25. _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
  26. _repository = GetRequiredService<IRepository<CustomerOrg, Guid>>();
  27. _appService = GetRequiredService<PrintReportAppService>();
  28. }
  29. [Fact]
  30. public async Task GetLisRequestReportAsync()
  31. {
  32. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  33. {
  34. var items = await _appService.GetLisRequestReportAsync(new Guid("3a11ee70-02cb-c5e6-a087-79ecdd0356b6"));
  35. _output.WriteLine(items.Count().ToString());
  36. foreach (var item in items)
  37. {
  38. _output.WriteLine(item.PatientName + "," + item.CustomerOrgName + "," +
  39. item.DepartmentName + item.AsbitemName);
  40. }
  41. await unitOfWork.CompleteAsync();
  42. }
  43. }
  44. [Fact]
  45. public async Task GetMedicalReportAsync()
  46. {
  47. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  48. {
  49. var medicalReportDto = await _appService.GetMedicalReportAsync(new PatientRegisterIdInputDto()
  50. {
  51. PatientRegisterId = new Guid("3a11ee70-02cb-c5e6-a087-79ecdd0356b6")
  52. });
  53. _output.WriteLine(medicalReportDto.PatientName);
  54. foreach (var medicalReportType in medicalReportDto.MedicalReportTypes)
  55. {
  56. _output.WriteLine("体检报告类别:" + medicalReportType.MedicalReportTypeName);
  57. var topItemTypes = medicalReportDto.ItemTypes.Where(o => o.MedicalReportTypeId == medicalReportType.MedicalReportTypeId
  58. && o.ItemTypePathCode.Length == 5)
  59. .OrderBy(o => o.DisplayOrder).ToList();
  60. foreach (var topItemType in topItemTypes)
  61. {
  62. var itemTypes = medicalReportDto.ItemTypes.Where(o => o.ItemTypePathCode.StartsWith(topItemType.ItemTypePathCode)).ToList();
  63. foreach (var itemType in itemTypes)
  64. {
  65. var registerChecks = medicalReportDto.RegisterChecks.Where(o => o.ItemTypeId == itemType.ItemTypeId).OrderBy(o => o.DisplayOrder).ToList();
  66. if (registerChecks.Any())
  67. {
  68. _output.WriteLine("项目类别:" + itemType.ItemTypeName);
  69. foreach (var registerCheck in registerChecks)
  70. {
  71. _output.WriteLine("检查医生:" + registerCheck.CheckDoctorName + "组合项目:" + registerCheck.AsbitemNames);
  72. foreach (var registerCheckItem in registerCheck.Items)
  73. {
  74. _output.WriteLine("项目:" + registerCheckItem.ItemName + "结果:" + registerCheckItem.Result);
  75. }
  76. }
  77. }
  78. }
  79. }
  80. }
  81. await unitOfWork.CompleteAsync();
  82. }
  83. }
  84. }
  85. }