Example #1
0
        //private readonly ApplicationdbContect _db = new ApplicationdbContect();
        //private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        // GET: G0506
        public ActionResult Index(int PatientId)
        {
            var primaryinsurance   = new G0506_PrimaryInsurance();
            var secondaryinsurance = new G0506_SecondaryInsurance();
            var patientinfo        = _db.G0506_PatientsInfo.Where(p => p.PatientId == PatientId).FirstOrDefault();

            if (patientinfo != null)
            {
                primaryinsurance   = _db.G0506_PrimaryInsurance.Where(p => p.Id == patientinfo.G0506_PrimaryInsuranceId).FirstOrDefault();
                secondaryinsurance = _db.G0506_SecondaryInsurance.Where(p => p.Id == patientinfo.G0506_SecondaryInsuranceId).FirstOrDefault();
            }


            G0506ViewModel viewModel = new G0506ViewModel();

            viewModel.G0506_PatientsInfo       = patientinfo;
            viewModel.G0506_PrimaryInsurance   = primaryinsurance;
            viewModel.G0506_SecondaryInsurance = secondaryinsurance;



            ViewBag.PatientId = PatientId;
            var Category = "G0506 INITIAL VISIT";

            ViewBag.Message         = Category;
            ViewBag.BillingReviewId = HelperExtensions.ReviewTimeGet(Category, PatientId, User.Identity.GetUserId(), BillingCodeHelper.G0506BillingCatagoryid);
            var G0506FormDataViewModel = new G0506FormDataViewModel();


            var PatientInfo = _db.G0506_PatientsInfo.Where(x => x.PatientId == PatientId).FirstOrDefault();

            if (patientinfo == null)
            {
                patientinfo           = new G0506_PatientsInfo();
                patientinfo.PatientId = PatientId;
                patientinfo.CreatedBy = User.Identity.GetUserId();
                patientinfo.CreatedOn = DateTime.Now;
                _db.G0506_PatientsInfo.Add(patientinfo);
                _db.SaveChanges();
            }



            if (PatientInfo != null)
            {
                ViewBag.AdditionalProviders = _db.G0506_AdditionalProviders.Where(sd => sd.G0506_PatientsInfoId == PatientInfo.Id).ToList();
            }
            else
            {
                ViewBag.AdditionalProviders = new List <G0506_AdditionalProviders>();
            }


            ViewBag.G0506Status = CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(PatientId, BillingCodeHelper.G0506BillingCatagoryid, null);

            return(View(viewModel));
        }
Example #2
0
        public async Task <ActionResult> GeneratePdfG0506Async(int?PatientId)
        {
            var patient = await _db.Patients.FindAsync(PatientId);

            if (patient != null)
            {
                var PatientsInfo        = _db.G0506_PatientsInfo.Where(x => x.PatientId == patient.Id).FirstOrDefault();
                var PrimaryInsurance    = PatientsInfo.G0506_PrimaryInsurance;
                var SecondaryInsurance  = PatientsInfo.G0506_SecondaryInsurance;
                var AdditionalProviders = PatientsInfo.AdditionalProvidersList;

                var G0506FormViewModal = new G0506FormDataViewModel();
                G0506FormViewModal.G0506_PrimaryInsurance   = PatientsInfo.G0506_PrimaryInsurance;
                G0506FormViewModal.G0506_SecondaryInsurance = PatientsInfo.G0506_SecondaryInsurance;
                G0506FormViewModal.G0506_PrimaryInsurance   = PatientsInfo.G0506_PrimaryInsurance;
                if (PatientsInfo.AdditionalProvidersList.Count > 0)
                {
                    G0506FormViewModal.G0506_PatientsInfo.AdditionalProvidersList = PatientsInfo.AdditionalProvidersList;
                }
                if (PatientsInfo.BirthDate != null)
                {
                    G0506FormViewModal.G0506_PatientsInfo.BirthDate = PatientsInfo.BirthDate;
                }
                G0506FormViewModal.G0506_PatientsInfo.CreatedBy                  = PatientsInfo.CreatedBy;
                G0506FormViewModal.G0506_PatientsInfo.CreatedOn                  = PatientsInfo.CreatedOn;
                G0506FormViewModal.G0506_PatientsInfo.DateConsentcompleted       = PatientsInfo.DateConsentcompleted;
                G0506FormViewModal.G0506_PatientsInfo.DesignatedCCMContact       = PatientsInfo.DesignatedCCMContact;
                G0506FormViewModal.G0506_PatientsInfo.G0506_PrimaryInsurance     = PatientsInfo.G0506_PrimaryInsurance;
                G0506FormViewModal.G0506_PatientsInfo.G0506_SecondaryInsurance   = PatientsInfo.G0506_SecondaryInsurance;
                G0506FormViewModal.G0506_PatientsInfo.G0506_SecondaryInsuranceId = PatientsInfo.G0506_SecondaryInsuranceId;
                G0506FormViewModal.G0506_PatientsInfo.Id = PatientsInfo.Id;
                G0506FormViewModal.G0506_PatientsInfo.IsCCMConsentcompleted  = PatientsInfo.IsCCMConsentcompleted;
                G0506FormViewModal.G0506_PatientsInfo.IsCurrentlyActiveinCCM = PatientsInfo.IsCurrentlyActiveinCCM;
                G0506FormViewModal.G0506_PatientsInfo.PatientId = PatientsInfo.PatientId;
                G0506FormViewModal.G0506_PatientsInfo.Patients  = PatientsInfo.Patients;
                G0506FormViewModal.G0506_PatientsInfo.Status    = PatientsInfo.Status;
                G0506FormViewModal.G0506_PatientsInfo.UpdatedBy = PatientsInfo.UpdatedBy;
                G0506FormViewModal.G0506_PatientsInfo.UpdatedOn = PatientsInfo.UpdatedOn;
                G0506FormViewModal.G0506_PatientsInfo.FullName  = PatientsInfo.FullName;
                G0506FormViewModal.UrgencyContactList           = await _db.PatientProfile_UrgencyContacts.AsNoTracking().Where(m => m.PatientId == patient.Id).ToListAsync();

                G0506FormViewModal.EvaluationViewModel = GetEvaluationForm(BillingCodeHelper.G0506BillingCatagoryid, patient.Id);
                var footer = "--footer-center \"Last Updated on " + DateTime.Now.ToString("MM/dd/yyyy @ hh:mmtt ") +
                             "- Page: [page]/[toPage]\"" + " --footer-font-size \"8\" --footer-spacing \"6\" --footer-font-name \"times\"";
                var generatePdf = new ViewAsPdf("G0506Report", G0506FormViewModal)
                {
                    FileName = "CCM_Health_" + patient.FirstName + "_" + patient.LastName + "_G0506.pdf",
                    //MinimumFontSize =10,
                    CustomSwitches = footer,
                    IsLowQuality   = false,

                    PageOrientation = Rotativa.Options.Orientation.Portrait,

                    PageSize    = Rotativa.Options.Size.A5,
                    PageMargins = new Margins(5, 5, 5, 5),
                    //PageMargins = new Margins(3, 3,3, 3),
                    //PageMargins = { Left = 20, Bottom = 20, Right = 20, Top = 20 }
                };
                var pdf = generatePdf.BuildPdf(ControllerContext);
                var ms  = new System.IO.MemoryStream(pdf);
                return(new FileStreamResult(ms, "application/pdf"));
            }
            return(View());
            //ViewBag.Message = "Patient Not Found!";
            //return View("Error");
        }