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

using Shentun.Peis.Enums;
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
namespace Shentun.Peis.AsbitemGuides
{
public class AsbitemGuideManager : DomainService
{
private readonly IRepository<AsbitemGuide> _asbitemGuideRepository;
public AsbitemGuideManager(
IRepository<AsbitemGuide> asbitemGuideRepository
)
{
this._asbitemGuideRepository = asbitemGuideRepository;
}
/// <summary>
/// 获取指引单内容(根据体检中心、组合项目ID、性别ID)
/// </summary>
/// <returns></returns>
public string GetAsbitemGuideConvertSexId(Guid OrOrganizationUnitId, Guid AsbitemId, char SexId)
{
//以体检中心跟组合项目去查
var entlist = _asbitemGuideRepository.GetListAsync(m => m.OrganizationUnitId == OrOrganizationUnitId && m.AsbitemId == AsbitemId).Result;
if (SexFlag.UnKnown == SexId.ToString())
{
//判断是否为未知、未知去找适用性别为全部的
entlist = entlist.Where(m => m.ForSexId.ToString() == ForSexFlag.All).ToList();
}
else
{
entlist = entlist.Where(m => m.ForSexId == SexId).ToList(); //直接匹配性别
if (!entlist.Any())
{
//找不到直接匹配的 去找全部的匹配数据
entlist = entlist.Where(m => m.ForSexId.ToString() == ForSexFlag.All).ToList();
}
}
if (entlist.Any())
{
return entlist.FirstOrDefault().Guide;
}
else
{
return "";
}
}
}
}