public async Task <IList <ReplyDetail> > ReplyDetailList(ConsultationReplyIn ReplyDetailList)
        {
            var query     = _repository.GetAll();
            var querylist = from a in query
                            where a.ConsultNumber == ReplyDetailList.ConsultNumber && !a.IsDelete
                            select new ReplyDetail
            {
                ReplyId       = a.Id,
                ConsultNumber = a.ConsultNumber,
                ReplyNumber   = a.SequenceNo,
                CreatedOn     = a.CreatedOn,
                CreatedBy     = a.CreatedBy,
                ReplyType     = a.ReplyType,
                Message       = a.RepayIllnessDescription,
                ConsultType   = a.ConsultType,
                AnswerType    = "Message",
            };

            return(await querylist.OrderBy(t => t.CreatedOn).ToListAsync());
        }
Exemplo n.º 2
0
 /// <summary>
 /// 输出模型
 /// </summary>
 /// <param name="ConsultationReplyDto"></param>
 /// <param name="ConsultationReplyInfo"></param>
 public ConsultationReplyOut(PagedResultDto <ConsultationReply> ConsultationReplyDto, ConsultationReplyIn ConsultationReplyInfo)
 {
     Items          = ConsultationReplyDto.Items;
     TotalCount     = ConsultationReplyDto.TotalCount;
     TotalPage      = ConsultationReplyDto.TotalCount / ConsultationReplyInfo.MaxResultCount;
     SkipCount      = ConsultationReplyInfo.SkipCount;
     MaxResultCount = ConsultationReplyInfo.MaxResultCount;
 }
        public async Task <PagedResultDto <ConsultationReply> > ConsultationReplyPage(ConsultationReplyIn ConsultationReplyInfo)
        {
            //初步过滤
            var query = _repository.GetAll().OrderByDescending(a => a.CreatedOn).Where(ConsultationReplyInfo.Expression);
            //获取总数
            var tasksCount = query.Count();
            //获取总数
            var totalpage = tasksCount / ConsultationReplyInfo.MaxResultCount;
            var ClinicDoctorReltionList = await query.PageBy(ConsultationReplyInfo.SkipTotal *ConsultationReplyInfo.MaxResultCount, ConsultationReplyInfo.MaxResultCount).ToListAsync();

            return(new PagedResultDto <ConsultationReply>(tasksCount, ClinicDoctorReltionList.MapTo <List <ConsultationReply> >()));
        }
        public async Task <IList <ConsultationReply> > ConsultationReplyList(ConsultationReplyIn ConsultationReplyInfo)
        {
            var ConsultationReplys = _repository.GetAll().Where(ConsultationReplyInfo.Expression).OrderByDescending(t => t.CreatedOn);

            return(await ConsultationReplys.ToListAsync());
        }
        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);
        }