public ActionResult Index(string encountertype)
        {
            userId = Session["UserId"].ToString();
            var Pdfviewmodel = new PDFViewModel();
            var encttype     = encountertype.ToString();

            if (encttype == "P")
            {
                if (userId != "a8a56c1d-203c-4c53-9d95-972dec7a2ef5" || userId == "f40ca8e9-dc6c-44de-9936-266249a7a201" || userId == "a24e6d62-414d-4434-bbe3-b3eec3a026e7")
                {
                    encttype = "I,A";
                }

                Pdfviewmodel.Reporttitle = "Inpatient and Ambulatory report for";
            }
            else if (encttype == "I")
            {
                Pdfviewmodel.Reporttitle = "Inpatient Patient Summary Report for";
            }
            else if (encttype == "A")
            {
                Pdfviewmodel.Reporttitle = "Ambulatory Patient Summary Report for";
            }
            else if (encttype == "T")
            {
                encttype = "I";
                Pdfviewmodel.Reporttitle = "Inpatient Transfer Report for";
            }
            else if (encttype == "R")
            {
                encttype = "A";
                Pdfviewmodel.Reporttitle = "Ambulatory Transfer Report for";
            }
            Pdfviewmodel.PatientMDS          = _patients.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable();
            Pdfviewmodel.MyPhysicians        = _physicians.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable();
            Pdfviewmodel.EncounterInfos      = _encountinfos.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable();
            Pdfviewmodel.VitalSigns          = _Vitals.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable();
            Pdfviewmodel.MedicationAllergies = _Allergies.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable();
            Pdfviewmodel.Problems            = _problems.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable();
            Pdfviewmodel.Medications         = _medications.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable();
            Pdfviewmodel.Vaccinations        = _vaccinations.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable();
            Pdfviewmodel.ProcedureDetails    = _procedures.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable();
            Pdfviewmodel.CarePlans           = _careplans.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable();
            Pdfviewmodel.LabResults          = _labresults.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable();
            Pdfviewmodel.SocialHistories     = _socialhistories.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable();
            Pdfviewmodel.EncounterDisgnos    = _encountdiagnos.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable();
            Pdfviewmodel.CognFunStatus       = _cogfuncstatus.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable();
            Pdfviewmodel.Reasonhospitals     = _reasonhospital.GetByUserId(userId).Where(e => e.EncounterType.Contains(encttype)).AsEnumerable();


            EncounterReport erp = new EncounterReport();

            erp.RefId     = "Report";
            erp.PatientId = userId;
            erp.UpdateBy  = userId;
            erp.Action    = "View Report";
            var encreports = encrepo.AddEncReport(erp);

            return(PDFView(Pdfviewmodel));
        }
        public ActionResult EditExistingPatient(string Id)
        {
            var userId       = Id;
            var Pdfviewmodel = new PDFViewModel();

            Pdfviewmodel.PatientMDS          = _patients.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.MyPhysicians        = _physicians.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.EncounterInfos      = _encountinfos.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.VitalSigns          = _Vitals.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.MedicationAllergies = _Allergies.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.Problems            = _problems.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.Medications         = _medications.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.Vaccinations        = _vaccinations.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.ProcedureDetails    = _procedures.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.CarePlans           = _careplans.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.LabResults          = _labresults.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.SocialHistories     = _socialhistories.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.EncounterDisgnos    = _encountdiagnos.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.CognFunStatus       = _cogfuncstatus.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.Reasonhospitals     = _reasonhospital.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.Immunizations       = _immunizations.GetbyUserId(userId).AsEnumerable();
            Pdfviewmodel.InsuranceBillings   = _insbilling.GetByUserId(userId).AsEnumerable();
            Pdfviewmodel.Appointments        = _appointments.GetByUserId(userId).AsEnumerable();

            return(View(Pdfviewmodel));
        }
        public IEnumerable <VitalSign> Get()
        {
            var session = HttpContext.Current.Session;

            if (session["UserId"] != null)
            {
                userId = session["UserId"].ToString();
            }
            IEnumerable <VitalSign> vitals = _Vitals.GetByUserId(userId);

            return(vitals);
            // return repository.GetAll();
        }