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.

198 lines
7.6 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. using Shentun.WebPeis.AppointPatientRegisters;
  2. using Shentun.WebPeis.AppointRegisterAsbitems;
  3. using Shentun.WebPeis.Enums;
  4. using Shentun.WebPeis.Models;
  5. using Shentun.WebPeis.PatientRegisters;
  6. using Shentun.WebPeis.Persons;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using Volo.Abp.Domain.Repositories;
  13. using Volo.Abp.Modularity;
  14. using Volo.Abp.Uow;
  15. using Xunit;
  16. using Xunit.Abstractions;
  17. namespace Shentun.WebPeis
  18. {
  19. public class AppointPatientRegisterAppServiceTest<TStartupModule> : WebPeisApplicationTestBase<TStartupModule>
  20. where TStartupModule : IAbpModule
  21. {
  22. private readonly IRepository<AppointPatientRegister> _repository;
  23. private readonly AppointPatientRegisterAppService _appService;
  24. private readonly ITestOutputHelper _output;
  25. private readonly IUnitOfWorkManager _unitOfWorkManager;
  26. public AppointPatientRegisterAppServiceTest(ITestOutputHelper output)
  27. {
  28. _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
  29. _repository = GetRequiredService<IRepository<AppointPatientRegister>>();
  30. _appService = GetRequiredService<AppointPatientRegisterAppService>();
  31. _output = output;
  32. }
  33. [Fact]
  34. public async Task CreateAsync()
  35. {
  36. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  37. {
  38. var entity = new CreateAppointPatientRegisterDto()
  39. {
  40. PersonId = new Guid("3a12d7fa-63f1-d549-c2f8-01123e5b7a8a"),
  41. CustomerOrgGroupId = null,
  42. CustomerOrgId = GuidFlag.PersonCustomerOrgId,
  43. MedicalCenterId = new Guid("150da355-dfbf-466b-9697-355836a862c4"),
  44. MedicalPackageId = null,
  45. AppointDate = DateTime.Now,
  46. CustomerOrgRegisterId = GuidFlag.PersonCustomerOrgRegisterId,
  47. PregnantFlag = PregnantFlag.None,
  48. Height = 170,
  49. Weight = 60
  50. };
  51. entity.Asbitems.Add(
  52. new CreateAppointRegisterAsbitemDto()
  53. {
  54. AsbitemId = new Guid("3a126b34-f6f0-56a1-e899-a092874acde7"),
  55. Amount = 1,
  56. ChargePrice = (decimal)30.5
  57. }
  58. );
  59. entity.Asbitems.Add(
  60. new CreateAppointRegisterAsbitemDto()
  61. {
  62. AsbitemId = new Guid("3a126b35-1163-6b80-6b57-7b5a7bc9e935"),
  63. Amount = 2,
  64. ChargePrice = (decimal)50.45
  65. }
  66. );
  67. var newEntity = await _appService.CreateAsync(entity);
  68. await unitOfWork.CompleteAsync();
  69. }
  70. }
  71. [Fact]
  72. public async Task GetListByFilterAsync()
  73. {
  74. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  75. {
  76. var entity = new AppointPatientRegisterInputDto()
  77. {
  78. MobilePhone = "18911254911",
  79. AppointStartDate = DateTime.Now.AddDays(-10),
  80. };
  81. var list = await _appService.GetListByFilterAsync(entity);
  82. foreach (var item in list)
  83. {
  84. _output.WriteLine(item.PersonName);
  85. }
  86. await unitOfWork.CompleteAsync();
  87. }
  88. }
  89. [Fact]
  90. public async Task GetAppointRegisterAsbitemListById()
  91. {
  92. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  93. {
  94. var entity = new AppointPatientRegisterIdInputDto()
  95. {
  96. AppointPatientRegisterId = new Guid("3a12ec60-278d-1814-753b-87ff8782aa26")
  97. };
  98. var list = await _appService.GetAppointRegisterAsbitemListByIdAsync(entity);
  99. foreach (var item in list)
  100. {
  101. _output.WriteLine(item.AsbitemName);
  102. }
  103. await unitOfWork.CompleteAsync();
  104. }
  105. }
  106. [Fact]
  107. public async Task GetRecommendMedicalPackageListByPersonIdAsync()
  108. {
  109. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  110. {
  111. var entity = new PersonIdInputDto()
  112. {
  113. PersonId = new Guid("3a12d72c-19d9-e8b2-71f6-cf283103e191")
  114. };
  115. var list = await _appService.GetRecommendMedicalPackageListByPersonIdAsync(entity);
  116. foreach (var item in list)
  117. {
  118. _output.WriteLine("---------------" + item.MedicalPackageName);
  119. foreach(var item2 in item.Asbitems)
  120. {
  121. _output.WriteLine(item2.AsbitemName + "-" + item2.IsBelongMedicalPackage);
  122. }
  123. foreach (var item2 in item.DiseaseRiskLevelAsbitems)
  124. {
  125. _output.WriteLine("---" + item2.DiseaseRiskName +"-" + item2.DiseaseRiskLevelName + "---");
  126. foreach(var item3 in item2.Asbitems)
  127. {
  128. _output.WriteLine(item3.AsbitemName );
  129. }
  130. }
  131. }
  132. await unitOfWork.CompleteAsync();
  133. }
  134. }
  135. [Fact]
  136. public async Task GetCustomerOrgRecommendMedicalPackageListByPatientRegisterIdAsync()
  137. {
  138. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  139. {
  140. var entity = new RecommendMedicalPackagePatientRegisterIdInputDto()
  141. {
  142. PatientRegisterId = new Guid("3a12fb5a-79c2-eea8-4c67-ef101b82287e"),
  143. PersonId = new Guid("3a12d72c-19d9-e8b2-71f6-cf283103e191")
  144. };
  145. var list = await _appService.GetCustomerOrgRecommendMedicalPackageListByPatientRegisterIdAsync(entity);
  146. foreach (var item in list)
  147. {
  148. _output.WriteLine("---------------" + item.MedicalPackageName);
  149. foreach (var item2 in item.Asbitems)
  150. {
  151. _output.WriteLine(item2.AsbitemName + "-" + item2.IsBelongMedicalPackage);
  152. }
  153. foreach (var item2 in item.DiseaseRiskLevelAsbitems)
  154. {
  155. _output.WriteLine("---" + item2.DiseaseRiskName + "-" + item2.DiseaseRiskLevelName + "---");
  156. foreach (var item3 in item2.Asbitems)
  157. {
  158. _output.WriteLine(item3.AsbitemName);
  159. }
  160. }
  161. }
  162. await unitOfWork.CompleteAsync();
  163. }
  164. }
  165. [Fact]
  166. public async Task GetCustomerOrgAppointPatientRegisterByPersonIdAsync()
  167. {
  168. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  169. {
  170. var entity = new PersonIdInputDto()
  171. {
  172. PersonId = new Guid("3a12d72c-19d9-e8b2-71f6-cf283103e191")
  173. };
  174. var item = await _appService.GetCustomerOrgAppointPatientRegisterByPersonIdAsync(entity);
  175. _output.WriteLine(item.PatientRegisterId.ToString());
  176. await unitOfWork.CompleteAsync();
  177. }
  178. }
  179. }
  180. }