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.

213 lines
8.2 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 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. _output.WriteLine("--套餐项目");
  120. foreach (var item2 in item.Asbitems)
  121. {
  122. _output.WriteLine(item2.AsbitemName + "-" + item2.IsBelongMedicalPackage);
  123. }
  124. _output.WriteLine("--加做项目");
  125. foreach (var item2 in item.DiseaseRiskLevelAsbitems)
  126. {
  127. _output.WriteLine("---" + item2.DiseaseRiskName + "---");
  128. foreach (var item3 in item2.Asbitems)
  129. {
  130. _output.WriteLine(item3.AsbitemName);
  131. }
  132. }
  133. _output.WriteLine("--禁止检查项目");
  134. foreach (var item3 in item.ForbidlCheckAsbitems)
  135. {
  136. _output.WriteLine(item3.AsbitemName);
  137. }
  138. }
  139. await unitOfWork.CompleteAsync();
  140. }
  141. }
  142. [Fact]
  143. public async Task GetCustomerOrgRecommendMedicalPackageListByPatientRegisterIdAsync()
  144. {
  145. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  146. {
  147. var entity = new RecommendMedicalPackagePatientRegisterIdInputDto()
  148. {
  149. PatientRegisterId = new Guid("3a12fb5a-79c2-eea8-4c67-ef101b82287e"),
  150. PersonId = new Guid("3a12d72c-19d9-e8b2-71f6-cf283103e191")
  151. };
  152. var list = await _appService.GetCustomerOrgRecommendMedicalPackageListByPatientRegisterIdAsync(entity);
  153. foreach (var item in list)
  154. {
  155. _output.WriteLine("---------------" + item.MedicalPackageName);
  156. _output.WriteLine("--套餐项目");
  157. foreach (var item2 in item.Asbitems)
  158. {
  159. _output.WriteLine(item2.AsbitemName + "-" + item2.IsBelongMedicalPackage);
  160. }
  161. _output.WriteLine("--加做项目");
  162. foreach (var item2 in item.DiseaseRiskLevelAsbitems)
  163. {
  164. _output.WriteLine("---" + item2.DiseaseRiskName + "-" + item2.DiseaseRiskLevelName + "---");
  165. foreach (var item3 in item2.Asbitems)
  166. {
  167. _output.WriteLine(item3.AsbitemName);
  168. }
  169. }
  170. _output.WriteLine("--禁止检查项目" );
  171. foreach (var item3 in item.ForbidlCheckAsbitems)
  172. {
  173. _output.WriteLine(item3.AsbitemName);
  174. }
  175. }
  176. await unitOfWork.CompleteAsync();
  177. }
  178. }
  179. [Fact]
  180. public async Task GetCustomerOrgAppointPatientRegisterByPersonIdAsync()
  181. {
  182. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  183. {
  184. var entity = new PersonIdInputDto()
  185. {
  186. PersonId = new Guid("3a136458-5835-d5ad-3800-8091615613b0")
  187. };
  188. var item = await _appService.GetCustomerOrgAppointPatientRegisterByPersonIdAsync(entity);
  189. _output.WriteLine(item.PatientRegisterId.ToString());
  190. await unitOfWork.CompleteAsync();
  191. }
  192. }
  193. }
  194. }