Beispiel #1
0
        // GET: PatientLog/EditAll
        public ActionResult EditAll()
        {
            var fromD = new DateTime();
            var toD   = new DateTime();

            //List<string> hospitals = new List<string>();

            if (Session["patientLogFromDate"] != null && Session["patientLogToDate"] != null)
            {
                fromD = Convert.ToDateTime(Session["patientLogFromDate"]);
                toD   = Convert.ToDateTime(Session["patientLogToDate"]);
            }
            else
            {
                fromD = DateTime.Now.AddDays(intDayFallback);
                toD   = DateTime.Now;
            }

            //if (Session["patientLogHospitals"] != null)
            //{
            //    hospitals = (List<string>)Session["patientLogHospitals"];
            //}

            PatientLogEditAllViewModel viewM = new PatientLogEditAllViewModel();

            viewM.FromDate = fromD.ToShortDateString();
            viewM.ToDate   = toD.ToShortDateString();
            //viewM.isAdmin = (HubSecurity.isAdmin || HubSecurity.isSiteLeader);

            PatientLogEditViewModel oneEntry;
            List <int> patientList = (List <int>)Session["patientLogListOfID"];

            //Checks if list is null, this should never be the case but stops page from erroring out. This session variable is only empty
            //if you browse to this page before using the Index page
            if (patientList != null)
            {
                foreach (int patID in patientList)
                {
                    oneEntry         = new PatientLogEditViewModel();
                    oneEntry.Patient = db.PatientLogs.Find(patID);

                    //oneEntry.GenderList = getGender(oneEntry.Patient.Gender);
                    oneEntry.HospitalList    = DataCollections.getHospital(db, oneEntry.Patient.Hospital);
                    oneEntry.PCPList         = DataCollections.getPCP(db, oneEntry.Patient.Hospital, oneEntry.Patient.PCP_Practice);
                    oneEntry.ServiceTypeList = DataCollections.getServiceType(db, oneEntry.Patient.ServiceType);
                    //oneEntry.PatientClassList = getPatientClass(oneEntry.Patient.PatientClass);
                    //oneEntry.PhysicianList = getAIMSPhy(oneEntry.Patient.Hospital, oneEntry.Patient.Physician);

                    viewM.Patients.Add(oneEntry);
                }
            }

            return(View("EditAll", viewM));
        }
Beispiel #2
0
        // GET: PatientLog/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PatientLog patientLog = await db.PatientLogs.FindAsync(id);

            PatientLogEditViewModel viewM = new PatientLogEditViewModel();

            if (patientLog == null)
            {
                return(HttpNotFound());
            }
            viewM.Patient = patientLog;

            //Checks if service type is faxable
            bool foundType = db.FaxServiceTypes.AsEnumerable().Any(f => f.Service == patientLog.ServiceType);

            //If faxable, check that a notification was not sent already, and return the result
            if (foundType)
            {
                string faxType = (from f in db.FaxServiceTypes
                                  where f.Service == patientLog.ServiceType
                                  select f.FaxType).Single() + "Notification";

                bool commSent = db.PCPCommunications.AsEnumerable().Where(c => c.PLRecord == id && c.DocumentType == faxType).Any();
                viewM.isFaxable    = !commSent;
                viewM.alreadyFaxed = commSent;
            }
            else
            {
                viewM.isFaxable = false;
            }

            List <int> idList = (List <int>)Session["patientLogListOfID"];

            //Populates index variables that the view uses to set up previous/next logic
            for (int i = 0; i < idList.Count; i++)
            {
                if (id == idList[i])
                {
                    viewM.Indexer = i;
                    break;
                }
            }
            viewM.IndexerDisplay = viewM.Indexer + 1;
            if (idList.Count() == 1)
            {
                viewM.SafeIndexerPrev = 0;
                viewM.SafeIndexerNext = 0;
            }
            else
            {
                if (viewM.Indexer == 0)
                {
                    viewM.SafeIndexerPrev = 1;
                }
                else
                {
                    viewM.SafeIndexerPrev = viewM.Indexer - 1;
                }
                if (viewM.Indexer == (idList.Count() - 1))
                {
                    viewM.SafeIndexerNext = viewM.Indexer - 1;
                }
                else
                {
                    viewM.SafeIndexerNext = viewM.Indexer + 1;
                }
            }

            //Populates dropdownlists with selected value of current patient
            viewM.GenderList       = DataCollections.getGender(db, viewM.Patient.Gender);
            viewM.HospitalList     = DataCollections.getHospital(db, viewM.Patient.Hospital);
            viewM.PCPList          = DataCollections.getPCP(db, viewM.Patient.Hospital, viewM.Patient.PCP_Practice);
            viewM.ServiceTypeList  = DataCollections.getServiceType(db, viewM.Patient.ServiceType);
            viewM.PatientClassList = DataCollections.getPatientClass(db, viewM.Patient.PatientClass);
            viewM.PhysicianList    = DataCollections.getAIMSPhy(db, viewM.Patient.Hospital, viewM.Patient.Physician);
            return(View(viewM));
        }