Ejemplo n.º 1
0
        public async Task <IActionResult> BindHealthManager([FromBody] UpdateConsumerBindMangerRequestDto request)
        {
            var managerBiz = new HealthManagerBiz();

            var response = await managerBiz.BindHealthManager(request);

            return(Success(response));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Get(string managerGuid)
        {
            var managerBiz = new HealthManagerBiz();

            var result = await managerBiz.GetManagerInfoAsync(managerGuid);

            return(Success(result));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetSimpleHealthManagers()
        {
            var managerBiz = new HealthManagerBiz();

            var response = await managerBiz.GetSimpleHealthManagers();

            return(Success(response));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> GetChangeHealthManagers([FromQuery]
                                                                  GetChangeHealthManagerListRequestDto request)
        {
            var managerBiz = new HealthManagerBiz();
            var response   = await managerBiz.GetChangeHealthManagers(request);

            return(Success(response));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> CancelBindHealthManager(string consumerGuid)
        {
            var managerBiz = new HealthManagerBiz();

            var response = await managerBiz.CancelBindHealthManager(consumerGuid);

            return(Success(response));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> GetHealthManagerFllowupRecords([FromQuery]
                                                                         GetHealthManagerFllowupRecordsRequestDto request)
        {
            var managerBiz = new HealthManagerBiz();

            var response = await managerBiz.GetHealthManagerFllowupRecords(request);

            return(Success(response));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Update([FromBody] UpdateHealthManagerRequestDto request)
        {
            if (request.QualificationCertificateGuids.Count <= 0)
            {
                return(Failed(ErrorCode.Empty, "职业资格证书未上传"));
            }

            var managerBiz   = new HealthManagerBiz();
            var checkManager = await managerBiz.GetAsync(request.ManagerGuid);

            if (checkManager is null)
            {
                return(Failed(ErrorCode.Empty, $"健康管理师【{request.UserName}】不存在"));
            }

            var checkPhone = await managerBiz.CheckPhone(request.Phone, request.ManagerGuid);

            if (checkPhone)
            {
                return(Failed(ErrorCode.Empty, $"手机号【{request.Phone}】已存在"));
            }

            var checkJobNumber = await managerBiz.CheckJobNumber(request.JobNumber, request.ManagerGuid);

            if (checkJobNumber)
            {
                return(Failed(ErrorCode.Empty, $"工号【{request.JobNumber}】已存在"));
            }

            var model = request.ToModel <HealthManagerModel>();

            model.CreatedBy    = checkManager.CreatedBy;
            model.Enable       = request.Enable;
            model.CreationDate = checkManager.CreationDate;
            model.QualificationCertificateGuid = JsonConvert.SerializeObject(request.QualificationCertificateGuids);
            model.LastUpdatedBy   = UserID;
            model.OrgGuid         = "";
            model.LastUpdatedDate = DateTime.Now;

            var result = await managerBiz.UpdateAsync(model);

            if (!result)
            {
                return(Failed(ErrorCode.Empty, "更新健康管理师失败,请稍后重试"));
            }

            return(Success());
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> UpdateStatus(string managerGuid)
        {
            if (string.IsNullOrEmpty(managerGuid))
            {
                return(Failed(ErrorCode.Empty, "请求参数错误"));
            }

            var managerBiz = new HealthManagerBiz();

            var result = await managerBiz.UpdateStatus(managerGuid);

            if (!result)
            {
                return(Failed(ErrorCode.Empty, "更新状态失败,请稍后重试"));
            }

            return(Success());
        }
Ejemplo n.º 9
0
        public async Task <IActionResult> BatchBindHealthManager([FromBody] BatchUpdateConsumerBindMangerRequestDto request)
        {
            if (request.ConsumerGuids.Count <= 0)
            {
                return(Failed(ErrorCode.Empty, "会员参数未提供,请检查"));
            }

            var managerBiz = new HealthManagerBiz();
            var manager    = await managerBiz.GetManagerInfoAsync(request.ManagerGuid);

            if (manager is null)
            {
                return(Failed(ErrorCode.Empty, "健康管理师不存在,请检查"));
            }

            var response = await managerBiz.BatchBindHealthManager(request);

            return(Success(response));
        }
Ejemplo n.º 10
0
        public async Task <IActionResult> GetHealthManagerConsumers([FromQuery]
                                                                    GetHealthManagerConsumerListRequestDto request)
        {
            request.UserId = UserID;
            var managerBiz = new HealthManagerBiz();
            var response   = await managerBiz.GetHealthManagerConsumers(request);

            if (response != null)
            {
                foreach (var item in response.CurrentPage)
                {
                    if (item.ReportMaxDate > item.MaxDate)
                    {
                        item.MaxDate = item.ReportMaxDate;
                    }
                }
                response.CurrentPage = response.CurrentPage?.OrderByDescending(s => s.MaxDate).ThenByDescending(s => s.ManagerBindDate).ToList();
            }
            return(Success(response));
        }
Ejemplo n.º 11
0
        public async Task <IActionResult> UpdatePortraitAsync(string portraitGuid)
        {
            var biz   = new HealthManagerBiz();
            var model = await biz.GetAsync(UserID);

            if (model == null)
            {
                return(Failed(ErrorCode.UserData, "此健康管理师不存在"));
            }
            model.PortraitGuid    = portraitGuid;
            model.LastUpdatedBy   = UserID;
            model.LastUpdatedDate = DateTime.Now;
            var result = await biz.UpdateAsync(model);

            if (!result)
            {
                return(Failed(ErrorCode.DataBaseError, "修改头像失败"));
            }
            return(Success());
        }
Ejemplo n.º 12
0
        public async Task <IActionResult> Create([FromBody] CreateHealthManagerRequestDto request)
        {
            if (request.QualificationCertificateGuids.Count <= 0)
            {
                return(Failed(ErrorCode.Empty, "职业资格证书未上传"));
            }

            var managerBiz = new HealthManagerBiz();

            var checkPhone = await managerBiz.CheckPhone(request.Phone);

            if (checkPhone)
            {
                return(Failed(ErrorCode.Empty, $"手机号【{request.Phone}】已存在"));
            }

            var checkJobNumber = await managerBiz.CheckJobNumber(request.JobNumber);

            if (checkJobNumber)
            {
                return(Failed(ErrorCode.Empty, $"工号【{request.JobNumber}】已存在"));
            }

            var model = request.ToModel <HealthManagerModel>();

            model.ManagerGuid = Guid.NewGuid().ToString("N");
            model.Enable      = request.Enable;
            model.QualificationCertificateGuid = JsonConvert.SerializeObject(request.QualificationCertificateGuids);
            model.CreatedBy     = UserID;
            model.LastUpdatedBy = UserID;
            model.OrgGuid       = "";

            var result = await managerBiz.InsertAsync(model);

            if (!result)
            {
                return(Failed(ErrorCode.Empty, "添加健康管理师失败,请稍后重试"));
            }

            return(Success());
        }