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); }
/// <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); }
/// <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); }
/// <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>()); }
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); } }
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>()); }
public Boolean UpdateDoctorInfo(TDoctor doctor) { return(DataBaseHelper.Update <TDoctor>(doctor) > 0 ? true : false); }