public async Task <ObjectResultModule> QualityControlManage([FromBody] QualityControlManageIn input)
        {
            if (!Commons.CheckSecret(input.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;

            var query = await _QualityControlManageService.QualityControlManageByID(input.Id);

            if (query != null)
            {
                if (input.ReplyState == "treated" && query.ReplyState == "untreated")
                {
                    query.QualityLevel            = input.QualityLevel;
                    query.RepayIllnessDescription = input.RepayIllnessDescription;
                    query.ModifyOn   = DateTime.Now;
                    query.ModifyBy   = userid;
                    query.ReplyState = "treated";
                }
                else if (input.ReplyState == "back" && query.ReplyState == "untreated")
                {
                    query.ModifyOn   = DateTime.Now;
                    query.ModifyBy   = userid;
                    query.ReplyState = "back";
                }
                var res = await _QualityControlManageService.UpdateQualityControlManage(query);

                this.ObjectResultModule.Object     = res;
                this.ObjectResultModule.Message    = "sucess";
                this.ObjectResultModule.StatusCode = 200;
            }
            else
            {
                this.ObjectResultModule.Message    = "NotFound";
                this.ObjectResultModule.StatusCode = 404;
                this.ObjectResultModule.Object     = "";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "QualityControlManage",
                OperContent = JsonHelper.ToJson(input),
                OperType    = "QualityControlManage",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion

            return(this.ObjectResultModule);
        }
        public async Task <ObjectResultModule> QualityControlManageList([FromBody] QualityControlManageIn QualityControlManageInList)
        {
            if (!Commons.CheckSecret(QualityControlManageInList.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;

            QualityControlManageInList.AndAlso(t => !t.IsDelete);
            if (!string.IsNullOrEmpty(QualityControlManageInList.KeyWord))
            {
                QualityControlManageInList.AndAlso(t => t.DoctorName.Contains(QualityControlManageInList.KeyWord) ||
                                                   t.ConsultantName.Contains(QualityControlManageInList.KeyWord));
            }
            var values = await _QualityControlManageService.QualityControlManageList(QualityControlManageInList);

            if (values.Count() == 0)
            {
                this.ObjectResultModule.StatusCode = 204;
                this.ObjectResultModule.Message    = "NoContent";
                this.ObjectResultModule.Object     = "";
            }
            else
            {
                this.ObjectResultModule.Object     = values;
                this.ObjectResultModule.Message    = "sucess";
                this.ObjectResultModule.StatusCode = 200;
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "QualityControlManageList",
                OperContent = JsonHelper.ToJson(QualityControlManageInList),
                OperType    = "QualityControlManageList",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion

            return(this.ObjectResultModule);
        }
Пример #3
0
        public async Task <PagedResultDto <QualityControlManagePage> > QualityControlManagePage(QualityControlManageIn QualityControlManageInfo)
        {
            //初步过滤
            var consquery = _consrepository.GetAll().Where(a => a.IsDelete == false);

            //初步过滤
            var query = _repository.GetAll().Where(QualityControlManageInfo.Expression).OrderByDescending(a => a.CreatedOn);

            var sysquery = _sysrepository.GetAll().Where(a => !a.IsDelete && a.SystemCode == "QualityControlManageState");

            var querylist = from a in query
                            join b in consquery on a.ConsultID equals b.Id
                            join c in sysquery on a.ReplyState equals c.Code
                            select new QualityControlManagePage
            {
                Id                            = a.Id,
                ConsultantJSON                = b.ConsultantJSON,
                PatientID                     = b.PatientID,
                PatientName                   = b.PatientName,
                PatientJSON                   = b.PatientJSON,
                IIInessType                   = b.IIInessType,
                PatientCity                   = b.PatientCity,
                IIInessDescription            = b.IIInessDescription,
                InquiryTimes                  = b.InquiryTimes,
                ConsultState                  = b.ConsultState,
                OvertimeRemindTimes           = b.OvertimeRemindTimes,
                Overtime                      = b.Overtime,
                RefundBy                      = b.RefundBy,
                RecommendDoctorID             = b.RecommendDoctorID,
                RecommendDoctorName           = b.RecommendDoctorName,
                HasReply                      = b.HasReply,
                Age                           = b.Age,
                ServiceMoneyListId            = b.ServiceMoneyListId,
                HasInquiryTimes               = b.HasInquiryTimes,
                IsReturnVisit                 = b.IsReturnVisit,
                IsEvaluate                    = b.IsEvaluate,
                ReturnVisit                   = b.ReturnVisit,
                ReturnVisitTime               = b.ReturnVisitTime,
                Completetime                  = b.Completetime,
                DoctorID                      = a.DoctorID,
                DoctorName                    = a.DoctorName,
                CreatedOn                     = a.CreatedOn,
                ConsultNumber                 = a.ConsultNumber,
                ConsultID                     = a.ConsultID,
                ConsultantID                  = a.ConsultantID,
                ConsultantName                = a.ConsultantName,
                ConsultType                   = a.ConsultType,
                QualityLevel                  = a.QualityLevel,
                RepayIllnessDescription       = a.RepayIllnessDescription,
                ReplyState                    = a.ReplyState,
                QualityControlManageState     = c.Name,
                QualityControlManageStateCode = c.Code,
                QualityDoctor                 = a.DoctorName,
            };
            //获取总数
            var tasksCount = querylist.Count();
            //获取总数
            var totalpage = tasksCount / QualityControlManageInfo.MaxResultCount;
            var QualityControlManageList = await querylist.PageBy(QualityControlManageInfo.SkipTotal, QualityControlManageInfo.MaxResultCount).ToListAsync();

            return(new PagedResultDto <QualityControlManagePage>(tasksCount, QualityControlManageList.MapTo <List <QualityControlManagePage> >()));
        }
Пример #4
0
        public async Task <IList <QualityControlManage> > QualityControlManageList(QualityControlManageIn QualityControlManageInfo)
        {
            var QualityControlManages = await _repository.GetAll().Where(QualityControlManageInfo.Expression).OrderByDescending(t => t.CreatedOn).ToListAsync();

            return(QualityControlManages);
        }
        public async Task <ObjectResultModule> QualityControlManageDetail([FromBody] QualityControlManageIn QualityControlManage)
        {
            if (!Commons.CheckSecret(QualityControlManage.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid         = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            var qualitycontrol = await _QualityControlManageService.QualityControlManageByID(QualityControlManage.Id);

            var values = await _consultationService.YaeherConsultationByID(qualitycontrol.ConsultID);

            if (values == null)
            {
                return(new ObjectResultModule("", 204, "NoContent"));
            }
            var EvaluationIn = new ConsultationEvaluationIn();

            EvaluationIn.AndAlso(t => !t.IsDelete && t.ConsultNumber == values.ConsultNumber);
            var eva = await _consultationEvaluationService.ConsultationEvaluationList(EvaluationIn);

            ConsultationReplyIn consultationReplyIn = new ConsultationReplyIn();

            consultationReplyIn.ConsultNumber = values.ConsultNumber;
            var replys = await _consultationReplyService.ReplyDetailList(consultationReplyIn);

            PhoneReplyRecordIn phoneReplyRecordIn = new PhoneReplyRecordIn();

            phoneReplyRecordIn.ConsultNumber = values.ConsultNumber;
            var phonereplys = await _phoneReplyRecordService.ReplyDetailList(phoneReplyRecordIn);

            var AttachmentInfo = new AttachmentIn()
            {
                ConsultNumber = values.ConsultNumber
            };
            var Attachmentreply = await _attachmentServices.ReplyDetailList(AttachmentInfo);

            var doctor = JsonHelper.FromJson <YaeherDoctor>(values.DoctorJSON);
            var order  = await _orderManageService.OrderManageByconsultNumber(values.ConsultNumber);

            var serverid   = order.ServiceID;
            var UserResult = await _yaeherUser.YaeherUserByID(doctor.UserID);

            //var UserResult = JsonHelper.FromJson<APIResult<ResultModule<YaeherUser>>>(user);
            //if (UserResult == null || UserResult.result.item == null) { return new ObjectResultModule("", 204, "NoContent"); }

            var collect = await _collectConsultationService.CollectConsultationByExpression(t => !t.IsDelete && t.ConsultID == values.Id && t.CreatedBy == userid);

            //var where = new CollectConsultationIn();where.AndAlso(t => !t.IsDelete && t.ConsultID == values.Id && t.CreatedBy == userid);
            //var collect = await _collectConsultationService.CollectConsultationListAsync(where);

            if (phonereplys.Count > 0)
            {
                replys = replys.Union(phonereplys).ToList();
            }
            var questionatt = new List <ReplyDetail>();

            if (Attachmentreply != null && Attachmentreply.Count > 0)
            {
                foreach (var item in replys)
                {
                    var query = from a in Attachmentreply
                                where a.ReplyNumber == item.ReplyNumber
                                select new ConsultationFile
                    {
                        FileUrl        = a.Message,
                        FileName       = a.FileName,
                        FileSize       = a.FileSize,
                        MediaType      = a.Mediatype,
                        FileContentUrl = a.FileContentAddress,
                        FileTotalTime  = a.FileTotalTime,
                        Id             = a.Id,
                    };
                    item.ConsultationFile = query.ToList();
                    //var rep = Attachmentreply.result.item.(t => t.ReplyId == item.ReplyId).ToList();
                    //if (rep != null) { item.Message = rep; }
                }
                //replys = replys.Union(Attachmentreply.result.item).ToList();
                // replys = replys.Select(t => new ReplyDetail(t, Attachmentreply.result.item)).ToList();
                questionatt = Attachmentreply.Where(t => t.ConsultNumber == values.ConsultNumber && t.ServiceType == "consultation").ToList();
            }
            // var questionatt = Attachmentreply.Where(t => t.ConsultID == values.Id && t.ServiceType == "consultation").ToList();
            var param = new SystemParameterIn()
            {
                Type = "ConfigPar"
            };

            param.AndAlso(t => !t.IsDelete && t.SystemCode == "ConsultState");
            var paramlist = await _systemParameterService.ParameterList(param);

            var IIInesslabel = JsonHelper.FromJson <LableManage>(values.IIInessJSON);

            this.ObjectResultModule.Object = new QualityControlManageOutDetail(qualitycontrol, values, collect == null ? false : true, questionatt, replys, UserResult, eva, serverid, IIInesslabel.Id, paramlist);
            if (values == null)
            {
                this.ObjectResultModule.StatusCode = 404;
                this.ObjectResultModule.Message    = "NotFound";
                this.ObjectResultModule.Object     = "";
            }
            else
            {
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "QualityControlManageDetail",
                OperContent = JsonHelper.ToJson(QualityControlManage),
                OperType    = "QualityControlManageDetail",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion

            return(ObjectResultModule);
        }
        public async Task <ObjectResultModule> QualityControlManagePage([FromBody] QualityControlManageIn QualityControlManageInPage)
        {
            if (!Commons.CheckSecret(QualityControlManageInPage.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid      = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            var usermanager = JsonHelper.FromJson <UserMemory>(_IabpSession.GetUserData());

            DateTime StartTime = new DateTime();
            DateTime EndTime   = new DateTime();

            if (!string.IsNullOrEmpty(QualityControlManageInPage.StartTime))
            {
                StartTime = DateTime.Parse(QualityControlManageInPage.StartTime);
                if (string.IsNullOrEmpty(QualityControlManageInPage.EndTime))
                {
                    QualityControlManageInPage.EndTime = DateTime.Now.ToString("yyyy-MM-dd");
                }
            }
            if (!string.IsNullOrEmpty(QualityControlManageInPage.EndTime))
            {
                EndTime = DateTime.Parse(QualityControlManageInPage.EndTime);
            }
            if (!string.IsNullOrEmpty(QualityControlManageInPage.StartTime))
            {
                QualityControlManageInPage.AndAlso(t => t.CreatedOn >= StartTime);
                QualityControlManageInPage.AndAlso(t => t.CreatedOn < EndTime.AddDays(+1));
            }
            if (QualityControlManageInPage.Platform == "PC")
            {
                if (!usermanager.IsAdmin && usermanager.IsDoctor)
                {
                    QualityControlManageInPage.AndAlso(t => t.DoctorID == usermanager.DoctorID);
                }
            }
            else if (QualityControlManageInPage.Platform == "Mobile")
            {
                if (usermanager.MobileRoleName == "doctor")
                {
                    var doctor = await _yaeherDoctorService.YaeherDoctorByUserID(userid);

                    QualityControlManageInPage.AndAlso(t => t.DoctorID == doctor.Id);
                }
            }
            if (!string.IsNullOrEmpty(QualityControlManageInPage.KeyWord))
            {
                QualityControlManageInPage.AndAlso(t => t.DoctorName.Contains(QualityControlManageInPage.KeyWord) ||
                                                   t.ConsultantName.Contains(QualityControlManageInPage.KeyWord));
            }
            QualityControlManageInPage.AndAlso(t => !t.IsDelete);
            var values = await _QualityControlManageService.QualityControlManagePage(QualityControlManageInPage);

            this.ObjectResultModule.Object     = new QualityControlManagePageOut(values, QualityControlManageInPage);
            this.ObjectResultModule.StatusCode = 200;
            this.ObjectResultModule.Message    = "success";
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "QualityControlManagePage",
                OperContent = JsonHelper.ToJson(QualityControlManageInPage),
                OperType    = "QualityControlManagePage",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion

            return(this.ObjectResultModule);
        }