示例#1
0
 public static void AddHeaderCellDetailLab(PdfPTable tableLayout, LabReportVM labReport, int resultCount)
 {
     PDFGenerateUtilityHelper.AddCellToBody(tableLayout, labReport.TCNumber, 1);
     PDFGenerateUtilityHelper.AddCellToBody(tableLayout, labReport.TCDate.ToShortDateString(), 1);
     PDFGenerateUtilityHelper.AddCellToBody(tableLayout, labReport.LabName, 1);
     PDFGenerateUtilityHelper.AddCellToBody(tableLayout, resultCount.ToString(), 1);
 }
示例#2
0
        public static LabReportVM GetLabReportVMForReqIds(LabDbContext labDbContext, List <Int64> reqIdList)
        {
            List <LabResult_Denormalized_VM> resultsDenormalized = GetResultsDenormalized(labDbContext, reqIdList);
            LabReportVM retReport = FormatResultsForLabReportVM(resultsDenormalized, labDbContext);

            return(retReport);
        }
示例#3
0
        public static LabReportVM FormatResultsForLabReportVM(List <LabResult_Denormalized_VM> resultSets, LabDbContext labDbContext)
        {
            LabReportVM retData = (from r in resultSets
                                   select new LabReportVM()
            {
                Columns = r.ColSettingsJSON,
                FooterText = r.FooterText,
                Header = r.HeaderText,
                ReportId = r.LabReportId,
                Signatories = r.Signatories,
                TemplateType = r.TemplateType,
                TemplateHTML = r.TemplateHTML,
                Comments = r.LabReportComments,
                IsPrinted = r.IsPrinted,
                CreatedBy = r.CreatedBy,
                CreatedOn = r.CreatedOn,
                ReportCreatedBy = r.ReportCreatedBy,
                ReportCreatedOn = r.ReportCreatedOn,
                PrintCount = r.PrintCount,
                PrintedBy = r.PrintedBy,
                PrintedByName = r.PrintedByName,
                PrintedOn = r.PrintedOn
            }).GroupBy(tmp => tmp.TemplateType).Select(group => group.First()).FirstOrDefault();



            retData.Lookups   = GetLookup(resultSets);
            retData.Templates = GetTemplateVM(resultSets, labDbContext);
            return(retData);
        }
示例#4
0
 public static void UpdateLabReport(this LabReport labReport, LabReportVM labReportVM)
 {
     labReport.Description = labReportVM.Description;
     labReport.LabName     = labReportVM.LabName;
     labReport.SeqNum      = labReportVM.SeqNum;
     labReport.TCDate      = labReportVM.TCDate;
     labReport.TCNumber    = labReportVM.TCNumber;
 }
        private string GetLabOrMillTCDate(LabReportVM labReport, MillDetailVM millDetail)
        {
            if (millDetail != null && !string.IsNullOrWhiteSpace(millDetail.MillName) && !string.IsNullOrWhiteSpace(millDetail.TCNumber))
            {
                return(millDetail.TCDate.ToString("dd/MM/yyyy"));
            }

            if (labReport != null && !string.IsNullOrWhiteSpace(labReport.LabName) && !string.IsNullOrWhiteSpace(labReport.TCNumber))
            {
                return(labReport.TCDate.ToString("dd/MM/yyyy"));
            }

            return(string.Empty);
        }
示例#6
0
        // GET: LabReport/Edit/5
        public ActionResult Edit(Guid?id)
        {
            try
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                LabReport   labReport   = db.LabReports.Find(id);
                LabReportVM labReportVM = new LabReportVM
                {
                    Id             = labReport.Id,
                    CollectionDate = labReport.CollectionDate,
                    IssueDate      = labReport.IssueDate,
                    OrderedBy      = labReport.OrderedBy,
                    PatientId      = labReport.PatientId,
                    Status         = labReport.Status
                };

                var patient = labReport.Patient;
                ViewBag.PatientName = $"{patient.FirstName} {patient.LastName}";
                ViewBag.PatientId   = patient.Id;

                if (labReport == null)
                {
                    return(HttpNotFound());
                }

                return(View(labReportVM));
            }
            catch (Exception e)
            {
                ViewBag.ExceptionMessage = e.Message;
            }
            return(View("~/Views/Errors/Details.cshtml"));
        }
示例#7
0
        public ActionResult Create(Guid id, LabReportVM labReportVM, bool add_result) // this id is PatientId
        {
            try
            {
                if (ModelState.IsValid)
                {
                    LabReport labReport = new LabReport()
                    {
                        PatientId      = id,
                        Id             = Guid.NewGuid(),
                        CollectionDate = labReportVM.CollectionDate,
                        IssueDate      = DateTime.Now,
                        OrderedBy      = labReportVM.OrderedBy,
                        Status         = labReportVM.Status
                    };
                    db.LabReports.Add(labReport);
                    db.SaveChanges();

                    if (add_result)
                    {
                        return(RedirectToAction("Create", "LabResults", new { Id = labReport.Id }));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "LabReport", new { Id = labReport.PatientId }));
                    }
                }

                return(View(labReportVM));
            }
            catch (Exception e)
            {
                ViewBag.ExceptionMessage = e.Message;
            }
            return(View("~/Views/Errors/Details.cshtml"));
        }
示例#8
0
        public ActionResult Edit(LabReportVM labReportVM, bool add_result)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var patientId = labReportVM.PatientId;

                    LabReport labReport = new LabReport
                    {
                        OrderedBy      = labReportVM.OrderedBy,
                        Status         = labReportVM.Status,
                        CollectionDate = labReportVM.CollectionDate,
                        PatientId      = labReportVM.PatientId,
                        IssueDate      = labReportVM.IssueDate,
                        Id             = labReportVM.Id
                    };

                    db.Entry(labReport).State = EntityState.Modified;
                    db.SaveChanges();

                    if (add_result)
                    {
                        return(RedirectToAction("Create", "LabResults", new { Id = labReport.Id }));
                    }
                    return(RedirectToAction("Index", "LabReport", new { Id = labReport.PatientId }));
                }

                return(View(labReportVM));
            }
            catch (Exception e)
            {
                ViewBag.ExceptionMessage = e.Message;
            }
            return(View("~/Views/Errors/Details.cshtml"));
        }