using ASHermed.SinoInterface.Api.ContractModel;
using ASHermed.SinoInterface.Api.ContractModel.App;
using ASHermed.SinoInterface.Api.ContractModel.Coupon.Entity;
using ASHermed.SinoInterface.Api.ContractModel.Coupon.Model;
using ASHermed.SinoInterface.Api.IRepository;
using ASHermed.SinoInterface.Api.IRepository.App;
using ASHermed.SinoInterface.Api.IService;
using ASHermed.SinoInterface.Enum.App;
using ASHermed.SinoInterface.IFramework;
using ASHermed.SinoInterface.Tools;
using Microsoft.Extensions.Logging;
using PoJun.Util.Maps;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ASHermed.SinoInterface.Api.Service
{
    public class OutMapDocPatService : BaseService, IOutMapDocPatService
    {
        ILogger<OutMapDocPatService> _logger;
        IOutService _outService;
        IDicDoctorRepository _dicDoctorRepository;
        IPubMapPatuserDocuserRepository _pubMapPatuserDocuserRepository;
        public OutMapDocPatService(ILogger<OutMapDocPatService> logger, IOutService outService, IDicDoctorRepository dicDoctorRepository, IPubMapPatuserDocuserRepository pubMapPatuserDocuserRepository)
        {
            _logger = logger;
            _outService = outService;
            _dicDoctorRepository = dicDoctorRepository;
            _pubMapPatuserDocuserRepository = pubMapPatuserDocuserRepository;
        }


        public DoctorUserInfoResp GetDoctorUserByImId(string docImId)
        {
            var userId = GetBaseUserInfo().ID;
            DoctorUserInfoResp result = _dicDoctorRepository.SelectDoctorWithStatusByImId(docImId);
            if (result != null && result.UserType == 2)
            {
                Pub_Map_Patuser_Docuser mapPatUserDocUser = _pubMapPatuserDocuserRepository.SelectByPatAndDoc(userId, result.Id);
                result.IsBiding = (mapPatUserDocUser != null);
            }
            return result;
        }



    }
}
