Ejemplo n.º 1
0
        public User GetUserByPhone(string phone, string password)
        {
            TDoctor doctor = GetDoctorByPhone(phone, password);

            if (doctor != null)
            {
                User user = new User();
                user.UserGID = doctor.DoctorGID;

                return(user);
            }
            return(null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加医生
        /// </summary>
        /// <param name="phone"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public Boolean AddUserByPhone(String phone, String password)
        {
            //用户是否存在

            TDoctor doctor = new TDoctor();

            doctor.Phone      = phone;
            doctor.Password   = SecurityService.PasswordEncrypt(password);
            doctor.CreateTime = DateTime.Now;
            doctor.Status     = (int)Status.Enable;
            //赋值ID

            return(DataBaseHelper.Save <TDoctor>(doctor) > 0 ? true : false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 一身模型转化
        /// </summary>
        /// <param name="doctor"></param>
        /// <returns></returns>
        protected DoctorInfo ConvertDoctorInfo(TDoctor doctor)
        {
            DoctorInfo info = new DoctorInfo();

            info.avatar    = ObjectUtils.GetValueOrEmpty(doctor.Avatar);
            info.name      = ObjectUtils.GetValueOrEmpty(doctor.DoctorName);
            info.province  = ObjectUtils.GetValueOrEmpty(doctor.ProvinceName);
            info.sex       = ObjectUtils.GetValueOrDefault <int>(doctor.Sex);
            info.title     = ObjectUtils.GetValueOrEmpty(doctor.DoctorTitle);
            info.doctor_id = doctor.DocotorMID;
            info.city      = ObjectUtils.GetValueOrEmpty(doctor.CityName);
            info.hospital  = ObjectUtils.GetValueOrEmpty(doctor.HospitalName);
            info.introduce = ObjectUtils.GetValueOrEmpty(doctor.Introduce);
            info.user_id   = ObjectUtils.GetValueOrEmpty(doctor.DoctorGID);

            return((DoctorInfo)info);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 查询医生信息通过MID
        /// </summary>
        /// <param name="doctorMID"></param>
        /// <returns></returns>
        protected Result <DoctorInfo> QueryDoctorByMID(QueryDoctorInfoByMIDParams doctorMID)
        {
            if (IsAuthrized)
            {
                Result <DoctorInfo> result = Result <DoctorInfo> .CreateInstance(ResultCode.Fail);

                DoctorService service = (DoctorService)ServiceFactory.GetUserService(TokenType.Doctor);
                TDoctor       doctor  = service.GetDoctorByMID(doctorMID.doctor_id);
                if (doctor != null)
                {
                    result.SetSuccess();
                    result.message     = "查询成功";
                    result.result_data = ConvertDoctorInfo(doctor);
                }
                else
                {
                    result.message = "没有对应医生信息";
                }
                return(result);
            }
            return(GetAuthFilterResult <DoctorInfo>());
        }
Ejemplo n.º 5
0
        public Result <LoginDoctorInfo> LoginByPhone(UserPhoneLogin loginInfo)
        {
            TDoctor doctor = GetService <DoctorService>().GetDoctorByPhone(loginInfo.phone, loginInfo.password);
            Result <LoginDoctorInfo> returnResult = Result <LoginDoctorInfo> .CreateInstance(ResultCode.Fail);

            if (doctor == null)
            {
                returnResult.message = "账号名或密码错误";
                return(returnResult);
            }

            //获取token
            ServiceResult result = GetService <TokenService>().InsertOrUpdateToken(TokenType.Doctor, doctor.DoctorGID);

            if (result.IsSuccess)
            {
                LoginDoctorInfo info = new LoginDoctorInfo();

                info.age       = doctor.Age.GetValueOrDefault();
                info.token     = result.message;
                info.avatar    = doctor.Avatar;
                info.name      = doctor.DoctorName;
                info.user_id   = doctor.DoctorGID;
                info.doctor_id = doctor.DocotorMID;
                //TDoctorTeam sr = ServiceFactory.GetService<DoctorTeamService>().IsJoinTeamByGid(doctor.DoctorGID);
                //if (sr != null) { info.teamId = sr.TeamMID; }

                returnResult.SetSuccess();

                returnResult.result_data = info;

                return(returnResult);
            }
            else
            {
                returnResult.message = result.message;
                return(returnResult);
            }
        }
Ejemplo n.º 6
0
        public Result <DoctorInfo> DoctorInfo(BaseParams search)
        {
            if (IsAuthrized)
            {
                Result <DoctorInfo> result = Result <DoctorInfo> .CreateInstance(ResultCode.Fail);

                String  searchUserID = search.to_user_id == null ? search.user_id : search.to_user_id;
                TDoctor doctor       = GetService <DoctorService>().GetDoctorByGID(searchUserID);
                if (doctor != null)
                {
                    DoctorInfo info = ConvertDoctorInfo(doctor);
                    result.SetSuccess();
                    result.result_data = info;
                }
                else
                {
                    result.message = "没有查询到该医生信息";
                }

                return(result);
            }
            return(GetAuthFilterResult <DoctorInfo>());
        }
Ejemplo n.º 7
0
 public Boolean UpdateDoctorInfo(TDoctor doctor)
 {
     return(DataBaseHelper.Update <TDoctor>(doctor) > 0 ? true : false);
 }