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.5 KiB

2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
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.GetLisRequestReportByPatientRegisterIdAsync(new PatientRegisterIdInputDto()
  35. { PatientRegisterId = new Guid("3a12815b-da56-ef02-4782-5760e0965cd8") });
  36. _output.WriteLine(items.Count().ToString());
  37. foreach (var item in items)
  38. {
  39. _output.WriteLine(item.PatientName + "," + item.CustomerOrgName + "," +
  40. item.DepartmentName + item.AsbitemNames);
  41. }
  42. //await unitOfWork.CompleteAsync();
  43. }
  44. }
  45. [Fact]
  46. public async Task GetMedicalReportAsync()
  47. {
  48. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  49. {
  50. var medicalReportDto = await _appService.GetMedicalReportAsync(new PatientRegisterIdInputDto()
  51. {
  52. PatientRegisterId = new Guid("3a126ce3-a20e-73ef-2671-815fa576b55f")
  53. });
  54. _output.WriteLine(medicalReportDto.PatientName);
  55. foreach (var medicalReportType in medicalReportDto.MedicalReportTypes)
  56. {
  57. _output.WriteLine("体检报告类别:" + medicalReportType.MedicalReportTypeName);
  58. var topItemTypes = medicalReportDto.ItemTypes.Where(o => o.MedicalReportTypeId == medicalReportType.MedicalReportTypeId
  59. && o.ItemTypePathCode.Length == 5)
  60. .OrderBy(o => o.DisplayOrder).ToList();
  61. foreach (var topItemType in topItemTypes)
  62. {
  63. var itemTypes = medicalReportDto.ItemTypes.Where(o => o.ItemTypePathCode.StartsWith(topItemType.ItemTypePathCode)).ToList();
  64. foreach (var itemType in itemTypes)
  65. {
  66. var registerChecks = medicalReportDto.RegisterChecks
  67. .Where(o => o.ItemTypeId == itemType.ItemTypeId)
  68. .OrderBy(o => o.DisplayOrder).ToList();
  69. if (registerChecks.Any())
  70. {
  71. _output.WriteLine("项目类别:" + itemType.ItemTypeName);
  72. foreach (var registerCheck in registerChecks)
  73. {
  74. _output.WriteLine("检查医生:" + registerCheck.CheckDoctorName + "组合项目:" + registerCheck.AsbitemNames);
  75. foreach (var registerCheckItem in registerCheck.Items)
  76. {
  77. _output.WriteLine("项目:" + registerCheckItem.ItemName + "结果:" + registerCheckItem.Result);
  78. }
  79. foreach (var registerCheckPicture in registerCheck.Pictures)
  80. {
  81. _output.WriteLine("图片:" + registerCheckPicture.PictureFileName);
  82. }
  83. }
  84. }
  85. }
  86. }
  87. }
  88. await unitOfWork.CompleteAsync();
  89. }
  90. }
  91. }
  92. }