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.

58 lines
1.9 KiB

2 years ago
2 years ago
2 years ago
2 years ago
  1. using Shentun.Peis.Enums;
  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.Domain.Services;
  10. namespace Shentun.Peis.AsbitemGuides
  11. {
  12. public class AsbitemGuideManager : DomainService
  13. {
  14. private readonly IRepository<AsbitemGuide> _asbitemGuideRepository;
  15. public AsbitemGuideManager(
  16. IRepository<AsbitemGuide> asbitemGuideRepository
  17. )
  18. {
  19. this._asbitemGuideRepository = asbitemGuideRepository;
  20. }
  21. /// <summary>
  22. /// 获取指引单内容(根据体检中心、组合项目ID、性别ID)
  23. /// </summary>
  24. /// <returns></returns>
  25. public string GetAsbitemGuideConvertSexId(Guid OrOrganizationUnitId, Guid AsbitemId, char SexId)
  26. {
  27. //以体检中心跟组合项目去查
  28. var entlist = _asbitemGuideRepository.GetListAsync(m => m.OrganizationUnitId == OrOrganizationUnitId && m.AsbitemId == AsbitemId).Result;
  29. if (SexFlag.UnKnown == SexId.ToString())
  30. {
  31. //判断是否为未知、未知去找适用性别为全部的
  32. entlist = entlist.Where(m => m.ForSexId.ToString() == ForSexFlag.All).ToList();
  33. }
  34. else
  35. {
  36. entlist = entlist.Where(m => m.ForSexId == SexId).ToList(); //直接匹配性别
  37. if (!entlist.Any())
  38. {
  39. //找不到直接匹配的 去找全部的匹配数据
  40. entlist = entlist.Where(m => m.ForSexId.ToString() == ForSexFlag.All).ToList();
  41. }
  42. }
  43. if (entlist.Any())
  44. {
  45. return entlist.FirstOrDefault().Guide;
  46. }
  47. else
  48. {
  49. return "";
  50. }
  51. }
  52. }
  53. }