Exemplo n.º 1
0
        public IHttpActionResult SaveScoring([FromBody] QualityScoreDto scoreInfo)
        {
            var user = base.CurrentUser();

            scoreInfo.Domain    = user.Domain;
            scoreInfo.Appraiser = user.UniqueID;
            return(Ok(_QCService.SaveScoring(scoreInfo)));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 保存评分
        /// </summary>
        /// <param name="scroe"></param>
        /// <returns></returns>
        public bool SaveScoring(QualityScoreDto score)
        {
            if (score == null)
            {
                return(false);
            }
            string sql   = "";
            var    param = new List <Object>();

            //报告质量评分
            if (score.ScoringType == 2)
            {
                //更新tbReport表,ReportQuality, ReportQualityComments,ScoringVersion,ReportQuality2
                var reprotIds = string.Join("','", score.ReportIDs);
                sql = string.Format("Update tbReport set ReportQuality = @ReqportQuality,ReportQuality2 = @ReqportQuality2,ReportQualityComments=@ReportQualityComments,ScoringVersion=@ScoringVersion,AccordRate=@AccordRate where ReportGuid in ('{0}') \r\n", reprotIds.ToString());
                param.Add(new SqlParameter("@ReqportQuality", score.ReportQuality));
                param.Add(new SqlParameter("@ReqportQuality2", score.ReportQuality2));
                param.Add(new SqlParameter("@ReportQualityComments", score.ReportQualityComments));
                param.Add(new SqlParameter("@ScoringVersion", score.ScoringVersion));
                param.Add(new SqlParameter("@AccordRate", score.AccordRate));
                //更新tbScoringResult
                sql += string.Format(" Update tbScoringResult set IsFinalVersion =0 where IsFinalVersion = 1 and ObjectGuid in ('{0}') and Type={1} \r\n ", reprotIds, score.ScoringType);

                foreach (string guid in score.ReportIDs)
                {
                    if (!string.IsNullOrWhiteSpace(guid))
                    {
                        sql += string.Format("Insert into tbScoringResult(Guid,ObjectGuid,Type,Result,Domain,Result2,Appraiser,Comment,AccordRate) values(NEWID(),'{0}',{1},'{2}','{3}','{4}','{5}','{6}','{7}')",
                                             guid, score.ScoringType, score.ResultItem, score.Domain, score.ReportQuality, score.Appraiser, score.ReportQualityComments, score.AccordRate) + "\r\n";
                    }
                }
            }
            else//图像质量评分
            {
                //获取tbProcedureCode的信息
                var procedIds = string.Join("','", score.ProcedIDs);

                string sqlGeneral = string.Format("Select ProcedureGuid as UniqueID,ExamineDt as ExamineTime,Technician from tbProcedureCode where OrderGuid ='{0}' and IsExistImage = 1 and ProcedureGuid in ('{1}')  \r\n ", score.OrderID, procedIds);
                var    pros       = _dbContext.Set <Procedure>().Where(p => p.OrderID == score.OrderID && score.ProcedIDs.Contains(p.UniqueID)).ToList();

                //tbQualityScoring
                if (pros != null && pros.Count > 0)
                {
                    //删除tbQualityScoring的评价
                    sql = string.Format(" Delete from tbQualityScoring where AppraiseObject in ('{0}') \r\n ", procedIds);
                    //在新增
                    foreach (var pr in pros)
                    {
                        sql += string.Format(" Insert into tbQualityScoring(Guid,AppraiseObject,OrderGuid,ExaminateDt,Type,Result,Appraisee,Appraiser,AppraiseDate,Comment,Domain,Result2,Result3) values('{0}','{1}','{2}','{3}',{4},'{5}','{6}','{7}','{8}',@Comment,'{9}','{10}','{11}')",
                                             Guid.NewGuid().ToString(),
                                             pr.UniqueID.ToString(),
                                             score.OrderID,
                                             pr.ExamineTime.ToString(),
                                             score.ScoringType,
                                             score.Result,
                                             pr.Technician,
                                             score.Appraiser,
                                             DateTime.Now,
                                             score.Domain,
                                             score.Result2,
                                             score.Result3
                                             ) + "\r\n";
                    }
                    param.Add(new SqlParameter("@Comment", score.Comment));
                    //tbScoringResult
                    sql += string.Format(" Update tbScoringResult set IsFinalVersion = 0 where IsFinalVersion = 1 and ObjectGuid in ('{0}') and Type={1} \r\n ", procedIds, score.ScoringType);

                    foreach (string guid in score.ProcedIDs)
                    {
                        if (!string.IsNullOrWhiteSpace(guid))
                        {
                            sql += string.Format("Insert into tbScoringResult(Guid,ObjectGuid,Type,Result,Domain,Result2,Appraiser,Comment) values(NEWID(),'{0}',{1},'{2}','{3}','{4}','{5}','{6}')",
                                                 guid, score.ScoringType, score.ResultItem, score.Domain, score.Result, score.Appraiser, score.Comment) + "\r\n";
                        }
                    }
                }
            }
            if (sql.Trim().Length > 0)
            {
                var result = _dbContext.ExecuteSqlCommand(sql, param.ToArray());

                if (result > 0)
                {
                    return(true);
                }
            }

            return(false);
        }