using MadRunFabric.Common;
using MadRunFabric.Common.Options;
using MadRunFabric.Model.TestUserTypeApi;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using MongoDB.Driver;
using System.Collections.Generic;
using TestUserTypeApi.IRepositories;
using System.Linq;
using NPOI.SS.Formula.Functions;

namespace TestUserTypeApi.Repositories
{
   public  class HzsfMassagesRepository : BaseRepository<HzsfMassages, string>, IHzsfMassagesRepository
    {
        //protected readonly ILogger<BaseRepository<HzsfMassages, string>> _logger;
        protected readonly IMongoCollection<HzsfMassages> _collection_MassageInfo;
        public HzsfMassagesRepository(IOptions<MongodbOptions> settings, ILogger<BaseRepository<HzsfMassages, string>> logger) : base(settings, logger)
        {
            _collection_MassageInfo = _context.GetCollection<HzsfMassages>();
            //_logger = logger;
        }
        /// <summary>
        /// 获取不重复的所有科室信息
        /// </summary>
        /// <returns></returns>
        public IEnumerable<object> GetLists()
        {
            FieldDefinition<HzsfMassages, string> field = "CY_DEPT_NAME";
            var bx = _collection.Distinct<string>(field, Builders<HzsfMassages>.Filter.Empty).ToList();

            var aaa = _collection.Distinct<string>("CY_DEPT_NAME", FilterDefinition<HzsfMassages>.Empty).ToListAsync(); 
          
            return bx;

        }
    }
}
