コード例 #1
0
        public List <LabTestResultDto> GetAllLabTestResult(LabTestResultSearchDto searchDto)
        {
            var unitOfWork = RepositoryHelper.GetUnitOfWork();
            var sql        = @"select a.LabTestResultId, 
                               b.FullName as PatientName,
                               b.PatientCode, 
                               a.Comment,
                               b.Age,
                               b.PhoneNumber, 
                               b.HomeAddress as Address , 
                               a.CreatedDate as CreateDateTmp, 
                               TotalCount = COUNT(*) OVER() 
                          from LabTestResult a
                          inner join Patient b 
                          on a.PatientId = b.PatientID ";

            if (!string.IsNullOrEmpty(searchDto.PatientId))
            {
                sql += "where b.FullName LIKE @p0 ";
            }

            sql += @"ORDER BY LabTestResultId desc
              OFFSET @p1 ROWS
              FETCH NEXT @p2 ROWS ONLY;";
            var data = unitOfWork.Context.Database.SqlQuery <LabTestResultDto>(sql, $"%{searchDto.PatientId}%", (searchDto.PageIndex - 1) * searchDto.PageSize, searchDto.PageSize).ToList();

            return(data);
        }
コード例 #2
0
        public JsonResult GetAllLabTest(LabTestResultSearchDto searchDto)
        {
            var result = _labTestResultService.GetAllLabTestResult(searchDto);

            return(Json(new
            {
                success = true,
                data = result != null ? result : new List <LabTestResultDto>(),
                total = (result != null && result.Any()) ? result[0].TotalCount : 0
            }, JsonRequestBehavior.AllowGet));
        }