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.

132 lines
3.8 KiB

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
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
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
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 System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using Volo.Abp.Domain.Repositories;
  9. using Volo.Abp.Uow;
  10. using Xunit.Abstractions;
  11. using Xunit;
  12. using Shentun.Peis.DataMigrations;
  13. using Microsoft.International.Converters.PinYinConverter;
  14. using Shentun.Utilities;
  15. namespace Shentun.Peis
  16. {
  17. public class BaseDataHandleTest : PeisApplicationTestBase
  18. {
  19. private readonly ITestOutputHelper _output;
  20. private readonly IUnitOfWorkManager _unitOfWorkManager;
  21. private readonly BaseDataHandleAppService _appService;
  22. private readonly IRepository<Asbitem, Guid> _asbitemRepository;
  23. private readonly IRepository<Item, Guid> _itemRepository;
  24. private readonly IRepository<Diagnosis, Guid> _diagnosisRepository;
  25. public BaseDataHandleTest(ITestOutputHelper testOutputHelper)
  26. {
  27. _output = testOutputHelper;
  28. _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
  29. _appService = GetRequiredService<BaseDataHandleAppService>();
  30. _asbitemRepository = GetRequiredService<IRepository<Asbitem, Guid>>();
  31. _itemRepository = GetRequiredService<IRepository<Item, Guid>>();
  32. _diagnosisRepository = GetRequiredService<IRepository<Diagnosis, Guid>>();
  33. }
  34. //[Fact]
  35. //public async Task TransferPatientData()
  36. //{
  37. // for (int i = 0; i < 500; i++)
  38. // {
  39. // using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  40. // {
  41. // var IsHand = await _appService.TransferPatientData();
  42. // await unitOfWork.CompleteAsync();
  43. // _output.WriteLine($"处理{(i + 1) * 1000}");
  44. // if (!IsHand)
  45. // {
  46. // break;
  47. // }
  48. // }
  49. // }
  50. [Fact]
  51. public async void GetPYSimpleCode()
  52. {
  53. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  54. {
  55. var diagnosisList = await _diagnosisRepository.GetListAsync();
  56. foreach (var diagnosis in diagnosisList)
  57. {
  58. diagnosis.SimpleCode = LanguageConverter.GetPYSimpleCode(diagnosis.DisplayName);
  59. }
  60. await _diagnosisRepository.UpdateManyAsync(diagnosisList);
  61. await unitOfWork.CompleteAsync();
  62. }
  63. }
  64. //}
  65. //[Fact]
  66. //public async Task TransferPatientRegisterData()
  67. //{
  68. // for (int i = 0; i < 3000; i++)
  69. // {
  70. // using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  71. // {
  72. // var IsHand = await _appService.TransferPatientRegisterData();
  73. // await unitOfWork.CompleteAsync();
  74. // _output.WriteLine($"处理{(i + 1) * 1000}");
  75. // if (!IsHand)
  76. // {
  77. // break;
  78. // }
  79. // }
  80. // }
  81. //}
  82. //[Fact]
  83. //public async Task HandPatientRegisterDoctor()
  84. //{
  85. // for (int i = 0; i < 3000; i++)
  86. // {
  87. // using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  88. // {
  89. // var IsHand = await _appService.HandPatientRegisterDoctor();
  90. // await unitOfWork.CompleteAsync();
  91. // _output.WriteLine($"处理{(i + 1) * 1000}");
  92. // if (!IsHand)
  93. // {
  94. // break;
  95. // }
  96. // }
  97. // }
  98. //}
  99. }
  100. }