Ejemplo n.º 1
0
        public async Task <ObjectResultModule> AttachmentDetailList([FromBody] AttachmentIn AttachmentInfo)
        {
            if (!Commons.CheckSecret(AttachmentInfo.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 values = await _attachmentService.ReplyDetailList(AttachmentInfo);

            if (values.Count == 0)
            {
                this.ObjectResultModule.StatusCode = 204;
                this.ObjectResultModule.Message    = "NoContent";
                this.ObjectResultModule.Object     = "";
            }
            else
            {
                this.ObjectResultModule.Object     = values;
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";
            }
            return(ObjectResultModule);
        }
Ejemplo n.º 2
0
        public async Task <ObjectResultModule> CreateAttachment([FromBody] AttachmentIn AttachmentInfo)
        {
            if (!Commons.CheckSecret(AttachmentInfo.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 param  = new SystemParameterIn()
            {
                SystemType = "TencentCosBaseUrl"
            };
            var paramlist = await _systemParameterService.ParameterList(param);

            var att = new AttachmentService();

            if (!string.IsNullOrEmpty(AttachmentInfo.Filename))
            {
                att.Filename    = AttachmentInfo.Filename;
                att.FileAddress = paramlist[0].ItemValue + "/" + AttachmentInfo.ServiceType + "/" + AttachmentInfo.MediaType + "/" + AttachmentInfo.Filename;
            }
            if (!string.IsNullOrEmpty(AttachmentInfo.TypeDetail))
            {
                att.TypeDetail  = AttachmentInfo.TypeDetail;
                att.FileAddress = paramlist[0].ItemValue + "/" + AttachmentInfo.ServiceType + "/" + AttachmentInfo.MediaType + "/" + AttachmentInfo.TypeDetail + "/" + AttachmentInfo.Filename;
            }

            if (AttachmentInfo.FileSize > 0)
            {
                att.FileSize = AttachmentInfo.FileSize;
            }
            if (AttachmentInfo.ConsultID > 0)
            {
                att.ConsultID = AttachmentInfo.ConsultID;
            }

            if (AttachmentInfo.ServiceID > 0)
            {
                att.ServiceID = AttachmentInfo.ServiceID;
            }
            att.FileFrom  = AttachmentInfo.ServiceType;
            att.CreatedBy = userid;
            att.FileType  = AttachmentInfo.MediaType;
            using (var unitOfWork = _unitOfWorkManager.Begin())
            {
                if (AttachmentInfo.Id > 0 && AttachmentInfo.IsDelete)
                {
                    var file = await _attachmentService.AttachmentServiceInfoByID(AttachmentInfo.Id);

                    if (file != null)
                    {
                        file.IsDelete   = true;
                        file.DeleteBy   = userid;
                        file.DeleteTime = DateTime.Now;
                        await _attachmentService.DeleteAttachment(file);
                    }
                }
                if (AttachmentInfo.Id < 0)
                {
                    var result = await _attachmentService.CreateAttachment(att);

                    this.ObjectResultModule.Object = result;
                }

                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";

                unitOfWork.Complete();
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "CreateAttachment",
                OperContent = JsonHelper.ToJson(AttachmentInfo),
                OperType    = "CreateAttachment",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion
            return(ObjectResultModule);
        }
Ejemplo n.º 3
0
        public async Task <ObjectResultModule> CreateMobileAttachment([FromBody] AttachmentIn AttachmentInfo)
        {
            if (!Commons.CheckSecret(AttachmentInfo.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 param  = new SystemParameterIn()
            {
                SystemType = "TencentCosBaseUrl"
            };
            var paramlist = await _systemParameterService.ParameterList(param);

            var att = new AttachmentService();

            if (!string.IsNullOrEmpty(AttachmentInfo.Filename))
            {
                att.Filename    = AttachmentInfo.Filename;
                att.FileAddress = paramlist[0].ItemValue + "/" + AttachmentInfo.ServiceType + "/" + AttachmentInfo.MediaType + "/" + AttachmentInfo.Filename;
            }
            if (!string.IsNullOrEmpty(AttachmentInfo.TypeDetail))
            {
                att.TypeDetail  = AttachmentInfo.TypeDetail;
                att.FileAddress = paramlist[0].ItemValue + "/" + AttachmentInfo.ServiceType + "/" + AttachmentInfo.MediaType + "/" + AttachmentInfo.TypeDetail + "/" + AttachmentInfo.Filename;
            }

            if (AttachmentInfo.FileSize > 0)
            {
                att.FileSize = AttachmentInfo.FileSize;
            }
            if (AttachmentInfo.ConsultID > 0)
            {
                att.ConsultID = AttachmentInfo.ConsultID;
            }

            if (AttachmentInfo.ServiceID > 0)
            {
                att.ServiceID = AttachmentInfo.ServiceID;
            }
            att.FileFrom      = AttachmentInfo.ServiceType;
            att.CreatedBy     = AttachmentInfo.CreatedBy;
            att.FileType      = AttachmentInfo.MediaType;
            att.ConsultNumber = AttachmentInfo.ConsultNumber;
            if (!string.IsNullOrEmpty(AttachmentInfo.ServiceNumber))
            {
                att.ServiceNumber = AttachmentInfo.ServiceNumber;
            }
            using (var unitOfWork = _unitOfWorkManager.Begin())
            {
                if (AttachmentInfo.Id > 0 && AttachmentInfo.IsDelete)
                {
                    var file = await _attachmentService.AttachmentServiceInfoByID(AttachmentInfo.Id);

                    if (file != null)
                    {
                        file.IsDelete   = true;
                        file.DeleteBy   = AttachmentInfo.CreatedBy;
                        file.DeleteTime = DateTime.Now;
                        await _attachmentService.DeleteAttachment(file);
                    }
                }
                if (AttachmentInfo.Id <= 0)
                {
                    var result = await _attachmentService.CreateAttachment(att);

                    if (result.Id < 0)
                    {
                        this.ObjectResultModule.StatusCode = 204;
                        this.ObjectResultModule.Message    = "NoContent";
                        this.ObjectResultModule.Object     = "";
                    }
                    else
                    {
                        #region  图片压缩工作
                        //            if (att.FileType == "image")
                        //            {
                        //                try
                        //{
                        //    var result = await _attachmentService.AttachmentServiceInfoByID(4);
                        //    string key = @"https://yaeher-1257714652.cos.ap-guangzhou.myqcloud.com/consultation/image/wx-20181022-1540172749000.jpg";
                        //    var fullfiletype = key.Substring(0, key.LastIndexOf(".", StringComparison.Ordinal));
                        //    var filetype = key.Substring(key.LastIndexOf(".", StringComparison.Ordinal));
                        //    string contentkey = $"{fullfiletype}-00001" + filetype;
                        //    var downloaded = await _cosHandler.GetObjectAsync(key.ToString(), stream =>
                        //    {
                        //    });
                        //    Image originalImagePath = Image.FromStream(downloaded);
                        //    MemoryStream thumNailPath = new MemoryStream();
                        //    var thum = new ThumNail();
                        //    var imagestream = thum.MakeThumNail(originalImagePath, thumNailPath, 16, 16, "HW");
                        //    imagestream.Position = 0;
                        //    var res = await _cosHandler.PutObjectAsync(contentkey, imagestream);

                        //    result.TypeDetail = contentkey;
                        //    await _attachmentService.UpdateAttachmentService(result);

                        //}
                        //catch (Exception ex)
                        //{
                        //    Logger.Info("图片缩略图失败," + ex.Message.ToString() + ex.StackTrace.ToString());
                        //}
                        //            }
                        #endregion

                        this.ObjectResultModule.Object     = result;
                        this.ObjectResultModule.StatusCode = 200;
                        this.ObjectResultModule.Message    = "success";
                    }
                }
                unitOfWork.Complete();
            }
            return(ObjectResultModule);
        }
Ejemplo n.º 4
0
        public async Task <ObjectResultModule> AttachmentList([FromBody] AttachmentIn AttachmentInfo)
        {
            if (!Commons.CheckSecret(AttachmentInfo.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;

            AttachmentInfo.AndAlso(t => !t.IsDelete && t.CreatedBy == userid);
            if (AttachmentInfo.ServiceID > 0)
            {
                AttachmentInfo.AndAlso(t => t.ServiceID == AttachmentInfo.ServiceID);
            }
            if (AttachmentInfo.ConsultID > 0)
            {
                AttachmentInfo.AndAlso(t => t.ConsultID == AttachmentInfo.ConsultID);
            }
            if (!string.IsNullOrEmpty(AttachmentInfo.TypeDetail))
            {
                AttachmentInfo.AndAlso(t => t.TypeDetail == AttachmentInfo.TypeDetail);
            }
            if (!string.IsNullOrEmpty(AttachmentInfo.FileFrom))
            {
                AttachmentInfo.AndAlso(t => t.FileFrom == AttachmentInfo.FileFrom);
            }
            if (!string.IsNullOrEmpty(AttachmentInfo.FileType))
            {
                AttachmentInfo.AndAlso(t => t.FileType == AttachmentInfo.FileType);
            }
            DateTime StartTime = new DateTime();
            DateTime EndTime   = new DateTime();

            if (!string.IsNullOrEmpty(AttachmentInfo.StartTime))
            {
                StartTime = DateTime.Parse(AttachmentInfo.StartTime);
                if (string.IsNullOrEmpty(AttachmentInfo.EndTime))
                {
                    AttachmentInfo.EndTime = DateTime.Now.ToString("yyyy-MM-dd");
                }
            }
            if (!string.IsNullOrEmpty(AttachmentInfo.EndTime))
            {
                EndTime = DateTime.Parse(AttachmentInfo.EndTime);
            }
            if (!string.IsNullOrEmpty(AttachmentInfo.StartTime))
            {
                AttachmentInfo.AndAlso(t => t.CreatedOn >= StartTime && t.CreatedOn < EndTime.AddDays(+1));
            }
            if (!string.IsNullOrEmpty(AttachmentInfo.KeyWord))
            {
                AttachmentInfo.AndAlso(t => t.FileAddress.Contains(AttachmentInfo.KeyWord));
            }
            var values = await _attachmentService.AttachmentList(AttachmentInfo);

            this.ObjectResultModule.Object     = values;
            this.ObjectResultModule.StatusCode = 200;
            this.ObjectResultModule.Message    = "success";
            return(ObjectResultModule);
        }
Ejemplo n.º 5
0
        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);
        }