Exemplo n.º 1
0
        public IActionResult GetAskedDoctorClassicQa([FromBody] GetAskedDoctorClassicQaRequestDto requestDto)
        {
            QaBiz qaBiz    = new QaBiz();
            var   qaModels = qaBiz.GetQaModels(requestDto.PageIndex, requestDto.PageSize, "where enable=true", "last_updated_date desc");

            if (qaModels == null)
            {
                return(Failed(ErrorCode.Empty));
            }

            DoctorBiz    doctorBiz    = new DoctorBiz();
            UserBiz      userBiz      = new UserBiz();
            AccessoryBiz accessoryBiz = new AccessoryBiz();
            LikeBiz      likeBiz      = new LikeBiz();
            List <GetAskedDoctorClassicQaResponseDto> dtos = new List <GetAskedDoctorClassicQaResponseDto>();

            foreach (var model in qaModels)
            {
                var dto = model.ToDto <GetAskedDoctorClassicQaResponseDto>();
                dto.DoctorName = userBiz.GetUser(model.AuthorGuid)?.UserName;
                dto.LikeNumber = likeBiz.GetLikeNumByTargetGuid(model.QaGuid);
                var doctorModel = doctorBiz.GetDoctor(model.AuthorGuid);
                if (doctorModel != null)
                {
                    var accessoryModel = accessoryBiz.GetAccessoryModelByGuid(doctorModel.PortraitGuid);
                    dto.DoctorPortrait = accessoryModel?.BasePath + accessoryModel?.RelativePath;
                }
                dtos.Add(dto);
            }
            return(Success(dtos));
        }
Exemplo n.º 2
0
        public IActionResult GetAskedDoctorClassicQaDetails(string qaGuid)
        {
            var qaBiz         = new QaBiz();
            var doctorBiz     = new DoctorBiz();
            var accessoryBiz  = new AccessoryBiz();
            var userBiz       = new UserBiz();
            var likeBiz       = new LikeBiz();
            var dictionaryBiz = new DictionaryBiz();
            var model         = qaBiz.GetModel(qaGuid);

            if (model == null)
            {
                return(Failed(ErrorCode.Empty));
            }
            var dto = model.ToDto <GetAskedDoctorClassicQaDetailsResponseDto>();

            dto.DoctorName = userBiz.GetUser(model.AuthorGuid)?.UserName;
            var doctorModel = doctorBiz.GetDoctor(model.AuthorGuid);

            if (doctorModel != null)
            {
                var accessoryModel = accessoryBiz.GetAccessoryModelByGuid(doctorModel.PortraitGuid);
                dto.DoctorPortrait = $"{accessoryModel?.BasePath}{accessoryModel?.RelativePath}";
                dto.HospitalGuid   = doctorModel.HospitalGuid;
                dto.HospitalName   = doctorModel.HospitalName;
                dto.JobTitle       = dictionaryBiz.GetModelById(doctorModel.TitleGuid)?.ConfigName;
            }
            dto.LikeNumber = likeBiz.GetLikeNumByTargetGuid(qaGuid);
            dto.Liked      = likeBiz.GetLikeState(UserID, qaGuid);
            return(Success(dto));
        }
Exemplo n.º 3
0
        public IActionResult GetDoctorArticleDetails(string articleGuid)
        {
            ArticleBiz articleBiz = new ArticleBiz();
            var        model      = articleBiz.GetModel(articleGuid);

            if (model == null)
            {
                return(Failed(ErrorCode.Empty));
            }
            var doctorBiz    = new DoctorBiz();
            var accessoryBiz = new AccessoryBiz();
            var userBiz      = new UserBiz();
            var likeBiz      = new LikeBiz();
            var richtextBiz  = new RichtextBiz();
            var dto          = model.ToDto <GetDoctorArticleDetailsResponseDto>();

            dto.Content    = richtextBiz.GetModel(model.ContentGuid)?.Content;
            dto.DoctorName = userBiz.GetUser(model.AuthorGuid)?.UserName;
            var doctorModel = doctorBiz.GetDoctor(model.AuthorGuid);

            if (doctorModel != null)
            {
                var accessoryModel = accessoryBiz.GetAccessoryModelByGuid(doctorModel.PortraitGuid);
                dto.DoctorPortrait = accessoryModel?.BasePath + accessoryModel?.RelativePath;
                dto.HospitalGuid   = doctorModel.HospitalGuid;
                dto.HospitalName   = doctorModel.HospitalName;
                dto.OfficeGuid     = doctorModel.OfficeGuid;
                dto.OfficeName     = doctorModel.OfficeName;
            }
            dto.LikeNumber = likeBiz.GetLikeNumByTargetGuid(articleGuid);
            dto.Liked      = likeBiz.GetLikeState(UserID, articleGuid);
            return(Success(dto));
        }
Exemplo n.º 4
0
        public IActionResult GetDoctorDetails(string doctorGuid)
        {
            var doctorBiz = new DoctorBiz();
            var model     = doctorBiz.GetDoctor(doctorGuid);

            if (model == null)
            {
                return(Failed(ErrorCode.Empty));
            }
            var userBiz        = new UserBiz();
            var dictionaryBiz  = new DictionaryBiz();
            var accessoryBiz   = new AccessoryBiz();
            var topicBiz       = new TopicBiz();
            var dto            = model.ToDto <GetDoctorDetailsResponseDto>();
            var accessoryModel = accessoryBiz.GetAccessoryModelByGuid(model.PortraitGuid);

            dto.DoctorName = userBiz.GetUser(doctorGuid)?.UserName;
            dto.Title      = dictionaryBiz.GetModelById(model.TitleGuid)?.ConfigName;
            dto.Portrait   = $"{accessoryModel?.BasePath}{accessoryModel?.RelativePath}";
            var signature = accessoryBiz.GetAccessoryModelByGuid(model.SignatureGuid);

            dto.SignatureUrl = $"{signature?.BasePath}{signature?.RelativePath}";

            dto.CommentScore       = new CommentBiz().GetTargetAvgScoreAsync(model.DoctorGuid).Result;
            dto.FansVolume         = new CollectionBiz().GetListCountByTarget(model.DoctorGuid);
            dto.ConsultationVolume = doctorBiz.GetDocotrConsultationVolumeAsync(model.DoctorGuid).Result;

            return(Success(dto));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> GetDoctorRegisterState()
        {
            var doctorBiz = new DoctorBiz();
            var model     = doctorBiz.GetDoctor(UserID);
            var result    = await new ReviewRecordBiz().GetLatestReviewRecordByTargetGuidAsync(UserID, ReviewRecordModel.TypeEnum.Doctors.ToString());

            return(Success(new GetDoctorRegisterStateResponseDto
            {
                WhetherRegister = model != null,
                RegisterState = model?.Status,
                ApprovalMessage = result?.RejectReason
            }));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> GetClientArticleDetailAsync(string articleGuid, ArticleModel.ArticleSourceTypeEnum articleSource = ArticleModel.ArticleSourceTypeEnum.Doctor)
        {
            if (string.IsNullOrWhiteSpace(articleGuid))
            {
                return(Failed(ErrorCode.UserData, "文章Id articleGuid 不可为空"));
            }


            var        response   = new GetClientArticleDetailResponseDto();
            ArticleBiz articleBiz = new ArticleBiz();
            var        model      = articleBiz.GetModel(articleGuid);

            if (model == null)
            {
                return(Failed(ErrorCode.Empty));
            }
            var doctorBiz    = new DoctorBiz();
            var accessoryBiz = new AccessoryBiz();
            var userBiz      = new UserBiz();
            var likeBiz      = new LikeBiz();
            var richtextBiz  = new RichtextBiz();

            response.ArticleGuid     = model.ArticleGuid;
            response.Title           = model.Title;
            response.AuthorGuid      = model.AuthorGuid;
            response.LastUpdatedDate = model.LastUpdatedDate;
            response.Content         = richtextBiz.GetModel(model.ContentGuid)?.Content;
            response.LikeNumber      = likeBiz.GetLikeNumByTargetGuid(articleGuid);
            response.Liked           = likeBiz.GetLikeState(UserID, articleGuid);
            if (articleSource == ArticleModel.ArticleSourceTypeEnum.Doctor)
            {
                response.AuthorName = userBiz.GetUser(model.AuthorGuid)?.UserName;
                var doctorModel = doctorBiz.GetDoctor(model.AuthorGuid);
                if (doctorModel != null)
                {
                    var accessoryModel = accessoryBiz.GetAccessoryModelByGuid(doctorModel.PortraitGuid);
                    response.AuthorPortrait = accessoryModel?.BasePath + accessoryModel?.RelativePath;
                    response.HospitalName   = doctorModel.HospitalName;
                    response.OfficeName     = doctorModel.OfficeName;
                }
            }
            else if (articleSource == ArticleModel.ArticleSourceTypeEnum.Manager)
            {
                response.AuthorName = (await new ManagerAccountBiz().GetAsync(model.AuthorGuid))?.UserName;
            }
            else
            {
                return(Failed(ErrorCode.UserData, $"文章来源 articleSource:{articleSource.ToString()} 数据值非法"));
            }
            return(Success(response));
        }
Exemplo n.º 7
0
        public IActionResult AuditDoctorRegisterInfo([FromBody] AuditDoctorRegisterInfoRequestDto requestDto)
        {
            DoctorBiz doctorBiz = new DoctorBiz();
            var       model     = doctorBiz.GetDoctor(requestDto.DoctorGuid);

            if (model == null)
            {
                return(Failed(ErrorCode.Empty, "未查到该医生数据"));
            }
            model.Status          = requestDto.Status.ToString();
            model.LastUpdatedBy   = UserID;
            model.LastUpdatedDate = DateTime.Now;
            return(doctorBiz.UpdateModel(model) ? Success() : Failed(ErrorCode.DataBaseError, "审核医生数据出现错误"));
        }
Exemplo n.º 8
0
        public async Task <IActionResult> GetDoctorRecommendAsync(string doctorGuid)
        {
            if (string.IsNullOrWhiteSpace(doctorGuid))
            {
                return(Failed(ErrorCode.UserData, "医生Id不能为空"));
            }
            var doctorBiz = new DoctorBiz();
            var model     = doctorBiz.GetDoctor(doctorGuid);

            if (model == null)
            {
                return(Failed(ErrorCode.UserData, "医生不存在"));
            }
            DoctorAppointmentBiz doctorAppointmentBiz = new DoctorAppointmentBiz();
            var response = await doctorAppointmentBiz.GetDoctorRecommendAsync(UserID, model.OfficeGuid, model.HospitalGuid);

            return(Success(response));
        }