Esempio n. 1
0
        /// <summary>
        /// 透析详情
        /// </summary>
        /// <param name="id">透析id</param>
        /// <returns>透析详情</returns>
        public async Task <WebApiOutput <DialysisDetailOutput> > GetDialysisDetail(long id)
        {
            var dialysis = await _repository.Get(id);

            if (dialysis == null)
            {
                return(WebApiOutput <DialysisDetailOutput> .Fail("不存在此透析记录"));
            }

            return(WebApiOutput <DialysisDetailOutput> .Success(Mapper.Map <Domain.Models.Dialysis, DialysisDetailOutput>(dialysis)));
        }
        /// <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));
        }
Esempio n. 3
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), "登陆成功"));
        }
        /// <summary>
        /// 根据外部Id获取患教课程列表(课程类别+该课程类别下课程)
        /// </summary>
        /// <param name="outerId">外部Id</param>
        /// <returns>课程类别对应的课程列表</returns>
        public async Task <WebApiOutput <List <CourseListOutput> > > GetCourseListByOuterId(string outerId)
        {
            if (string.IsNullOrEmpty(outerId) || outerId.Length != CommConstant.PatientEduOutIdLength)
            {
                return(WebApiOutput <List <CourseListOutput> > .Fail("外部Id不正确"));
            }
            var courseEntityList = await _repository.GetPatientEduListByOuterId(outerId);

            List <CourseListOutput> courseList = new List <CourseListOutput>();

            foreach (var item in courseEntityList)
            {
                CourseListOutput course = new CourseListOutput {
                    CourseType = item.CourseTypeId, CourseTypeName = item.CourseTypeName
                };
                var entityList = await _courseRepository.GetCourseListByPatientEduId(item.Id);

                course.CourseList = Mapper.Map <List <Course>, List <CourseDto> >(entityList);
                courseList.Add(course);
            }

            return(WebApiOutput <List <CourseListOutput> > .Success(courseList));
        }
Esempio n. 5
0
        ///// <summary>
        ///// 更新密码
        ///// </summary>
        ///// <param name="input">更新密码输入</param>
        ///// <returns>是否更新成功</returns>
        //public async Task<OutputBase> UpdatePassword(UpdatePasswordInput input)
        //{
        //    await _repository.UpdatePassword(input);

        //    return _unitWork.Commit() ? OutputBase.Success("更新成功") : OutputBase.Fail("更新失败");
        //}

        /// <summary>
        /// 更新头像
        /// </summary>
        /// <param name="input">更新头像输入</param>
        /// <returns>是否更新成功</returns>
        public async Task <WebApiOutput <string> > UpdateFace(UpdateFaceInput input)
        {
            await _repository.UpdateFace(input);

            return(_unitWork.Commit() ? WebApiOutput <string> .Success(CommConstant.OssUrl + input.Face, "上传头像成功") : WebApiOutput <string> .Fail("上传头像失败"));
        }