/// <summary>
        /// 医护人员登录
        /// </summary>
        /// <param name="input">医护人员登录输入</param>
        /// <returns>医护人员登录输出</returns>
        public async Task <WebApiOutput <DoctorLoginOutput> > Login(CommonLoginInput input)
        {
            var entity = await _repository.Login(input);

            if (entity == null)
            {
                return(WebApiOutput <DoctorLoginOutput> .Fail("登录失败"));
            }
            var doctor = Mapper.Map <Doctor, DoctorLoginOutput>(entity);

            doctor.PatientCount = await _repository.GetDoctorPatientCount(entity);

            return(WebApiOutput <DoctorLoginOutput> .Success(doctor));
        }
Beispiel #2
0
        /// <summary>
        /// 患者登录
        /// </summary>
        /// <param name="input">患者登录输入</param>
        /// <returns>患者登录输出</returns>
        public async Task <WebApiOutput <PatientLoginOutput> > Login(CommonLoginInput input)
        {
            var patientContact = await _repository.Login(input.Phone, input.Password);

            if (patientContact == null)
            {
                return(WebApiOutput <PatientLoginOutput> .Fail("登陆失败"));
            }
            if (patientContact.Patient.UserStatus == (int)UserStatusEnum.UnActive)
            {
                await _repository.UpdateUserStatus(patientContact.PatientId);

                return(_unitWork.Commit() ? WebApiOutput <PatientLoginOutput> .Success(Mapper.Map <PatientContact, PatientLoginOutput>(patientContact), "登陆成功") : WebApiOutput <PatientLoginOutput> .Fail("登陆失败"));
            }

            return(WebApiOutput <PatientLoginOutput> .Success(Mapper.Map <PatientContact, PatientLoginOutput>(patientContact), "登陆成功"));
        }
 public async Task <WebApiOutput <DoctorLoginOutput> > Login([FromBody] CommonLoginInput input)
 {
     return(await _service.Login(input));
 }
        /// <summary>
        /// 医护人员登陆
        /// </summary>
        /// <param name="input">医护人员登录输入</param>
        /// <returns>医护人员登录输出</returns>
        public async Task <Doctor> Login(CommonLoginInput input)
        {
            var doctor = await _context.Doctor.Where(i => i.Phone == input.Phone && i.Password == input.Password.ToUpper()).Include(i => i.Hospital).FirstOrDefaultAsync();

            return(doctor);
        }