Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            IndoorPatient indoorPatient = db.IndoorPatient.Find(id);

            db.IndoorPatient.Remove(indoorPatient);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
        private void assignroom_Btn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(cboselroom_no.Text))
                {
                    MessageBox.Show("Please select a room no.", "Reminder", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }


                IndoorPatient indo = (IndoorPatient)dataGrid_IndoorPatients.SelectedItem;


                if (indo.indpat_status == "discharged")
                {
                    MessageBox.Show("Cannot assign room to discharged patient.", "Reminder", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }


                if (indo.room_id != null && indo.indpat_status == "admitted")
                {
                    Room currentRoom = hmsfac.getRoomByRid(indo.room_id);
                    currentRoom.availbeds++;
                    hmsfac.updateRoom(currentRoom);
                }


                indo.room_id = int.Parse(cboselroom_no.Text);

                Room newRoom = hmsfac.getRoomByRid(indo.room_id);

                if (newRoom.availbeds == 0)
                {
                    MessageBox.Show("Beds not available in this room. Please select any other room.", "Reminder", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }

                newRoom.availbeds--;

                hmsfac.updateIndoor(indo);
                hmsfac.updateRoom(newRoom);

                MessageBox.Show("Room Assigned successfully!", "Success!", MessageBoxButton.OK, MessageBoxImage.Information);
                dataGrid_IndoorPatients.Items.Refresh();
                roomList = hmsfac.getRoom();
                dataGrid_Room.Items.Refresh();

                this.roombtn_update.IsEnabled = false;
                this.assignroom_btn.IsEnabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Please first select the patient from Grid", "Reminder", MessageBoxButton.OKCancel, MessageBoxImage.Information);
                Console.WriteLine(ex.Message);
            }
        }
Пример #3
0
 public ActionResult Edit([Bind(Include = "IndoorPatientId,Name,Age,Gender,BedId,Admissiondate,Releasedate,DoctorId")] IndoorPatient indoorPatient)
 {
     if (ModelState.IsValid)
     {
         db.Entry(indoorPatient).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BedId    = new SelectList(db.Bed, "BedId", "BedNo", indoorPatient.BedId);
     ViewBag.DoctorId = new SelectList(db.Doctor, "DoctorId", "Name", indoorPatient.DoctorId);
     return(View(indoorPatient));
 }
Пример #4
0
        // GET: IndoorPatient/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            IndoorPatient indoorPatient = db.IndoorPatient.Find(id);

            if (indoorPatient == null)
            {
                return(HttpNotFound());
            }
            return(View(indoorPatient));
        }
Пример #5
0
        // GET: IndoorPatient/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            IndoorPatient indoorPatient = db.IndoorPatient.Find(id);

            if (indoorPatient == null)
            {
                return(HttpNotFound());
            }
            ViewBag.BedId    = new SelectList(db.Bed, "BedId", "BedNo", indoorPatient.BedId);
            ViewBag.DoctorId = new SelectList(db.Doctor, "DoctorId", "Name", indoorPatient.DoctorId);
            return(View(indoorPatient));
        }
Пример #6
0
        private void searchtxt_indpat_TextChanged(object sender, TextChangedEventArgs e)
        {
            TextBox         t      = (TextBox)sender;
            String          filter = t.Text;
            ICollectionView cv     = CollectionViewSource.GetDefaultView(dataGrid_IndoorPatients.ItemsSource);

            if (filter == "")
            {
                cv.Filter = null;
            }
            else
            {
                cv.Filter = o =>
                {
                    IndoorPatient indp = o as IndoorPatient;
                    if (cbosearchindpat_Indpat.SelectedValue != null)
                    {
                        String selected = cbosearchindpat_Indpat.Text.ToString().ToLower();
                        if (selected == "patient name")
                        {
                            return(indp.Patient.pat_name.ToLower().StartsWith(filter.ToLower()));
                        }
                        else if (selected == "gender")
                        {
                            return(indp.Patient.pat_gender.ToLower().StartsWith(filter.ToLower()));
                        }
                        else if (selected == "disease")
                        {
                            return(indp.indpat_disease.ToLower().StartsWith(filter.ToLower()));
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                };
            }
        }
Пример #7
0
        private void searchpattxt_nurse_TextChanged(object sender, TextChangedEventArgs e)
        {
            TextBox         t      = (TextBox)sender;
            string          filter = t.Text;
            ICollectionView cv     = CollectionViewSource.GetDefaultView(dataGrid_MyPatient.ItemsSource);

            if (filter == "")
            {
                cv.Filter = null;
            }
            else
            {
                cv.Filter = o =>
                {
                    IndoorPatient indo = o as IndoorPatient;
                    if (searchpatcombo_nurse.SelectedValue != null)
                    {
                        String selected = searchpatcombo_nurse.Text.ToString().ToLower();
                        if (selected == "name")
                        {
                            return(indo.Patient.pat_name.ToLower().StartsWith(filter.ToLower()));
                        }
                        else if (selected == "gender")
                        {
                            return(indo.Patient.pat_gender.ToLower().StartsWith(filter.ToLower()));
                        }
                        else if (selected == "room no")
                        {
                            return(indo.room_id.ToString().ToLower().StartsWith(filter.ToLower()));
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    return(false);
                };
            }
        }
        private void dataGrid_MyPrescriptions_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            this.indexSelected = dataGrid_MyPrescriptions.SelectedIndex;
            if (indexSelected == -1 || presList.Count <= indexSelected)
            {
                presSelected            = null;
                updteBtn_pres.IsEnabled = false;
                return;
            }
            ;


            updteBtn_pres.IsEnabled = true;
            //presSelected = (prescription)presList.ElementAt<prescription>(dataGrid_Pres.SelectedIndex);
            presSelected = (Prescription)dataGrid_MyPrescriptions.SelectedItem;
            if (presSelected.Patient == null)
            {
                return;
            }

            else if (presSelected.Patient.pat_type != null)
            {
                mypresc_pattype.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(presSelected.Patient.pat_type);
            }
            if (presSelected.Patient.pat_type.Equals("outdoor"))
            {
                mypresc_disease.IsEnabled = false;
            }
            else if (presSelected.Patient.pat_type.Equals("indoor"))
            {
                IndoorPatient indo = hmsfac.getIndoorByPid(presSelected.pat_id);
                mypresc_disease.IsEnabled = true;
                mypresc_disease.Text      = indo.indpat_disease;
            }

            mypresc_med.Text    = presSelected.Medicine.med_name;
            mypresc_dosage.Text = presSelected.presc_dosage;
        }
        private void submit_presc_Click(object sender, RoutedEventArgs e)
        {
            if (patSelected == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(pattypecombo_doc.Text))
            {
                MessageBox.Show("Please select patient type.", "Reminder", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }


            if (pattypecombo_doc.Text.Equals("Indoor"))
            {
                if (string.IsNullOrEmpty(patdisease_doc.Text))
                {
                    MessageBox.Show("Please enter a diease", "Reminder", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                IndoorPatient patIndoor = new IndoorPatient();
                DateTime      admitdate = DateTime.Today;
                patIndoor.indpat_disease = patdisease_doc.Text;
                patIndoor.Patient        = patSelected;
                patIndoor.admit_date     = admitdate;
                patIndoor.indpat_status  = "admitted";
                hmsfac.addIndoor(patIndoor);
                patSelected.pat_type = "indoor";
            }
            else
            {
                patSelected.pat_type = "outdoor";
            }


            if (!string.IsNullOrEmpty(patmed_doc.Text))
            {
                int mid1 = int.Parse(patmed_doc.SelectedValue.ToString());

                string dosage1 = patdosage_doc.Text;

                Prescription p1 = new Prescription();
                p1.med_id       = mid1;
                p1.presc_dosage = dosage1;
                p1.pat_id       = patSelected.pat_id;
                p1.doc_id       = docOwner.doc_id;
                hmsfac.addPrescription(p1);
                presList.Add(p1);


                if (!string.IsNullOrEmpty(patmed1_doc.Text))
                {
                    Prescription p2 = new Prescription();
                    p2.med_id       = int.Parse(patmed1_doc.SelectedValue.ToString());
                    p2.presc_dosage = patdosage1_doc.Text;
                    p2.pat_id       = patSelected.pat_id;
                    p2.doc_id       = docOwner.doc_id;
                    hmsfac.addPrescription(p2);
                    presList.Add(p2);
                }

                if (!string.IsNullOrEmpty(patmed2_doc.Text.ToString()))
                {
                    Prescription p3 = new Prescription();
                    p3.med_id       = int.Parse(patmed2_doc.SelectedValue.ToString());
                    p3.presc_dosage = patdosage2_doc.Text;
                    p3.pat_id       = patSelected.pat_id;
                    p3.doc_id       = docOwner.doc_id;
                    hmsfac.addPrescription(p3);
                    presList.Add(p3);
                }

                patSelected.doc_id = docOwner.doc_id;
                hmsfac.updatePatient(patSelected);
                NewPatientList.Remove(patSelected);
                dataGrid_NewPatient.Items.Refresh();
                dataGrid_MyPrescriptions.Items.Refresh();
                MessageBox.Show("Prescription submisson success.", "Success!", MessageBoxButton.OK, MessageBoxImage.Information);
                dataGrid_OldPatient.ItemsSource = hmsfac.getMyOldPatients(docOwner);
                dataGrid_OldPatient.Items.Refresh();
                this.pattypecombo_doc.Text  = "";
                this.patmed_doc.Text        = "";
                this.patdisease_doc.Text    = "";
                this.patdosage_doc.Text     = "";
                this.patdosage1_doc.Text    = "";
                this.patdosage2_doc.Text    = "";
                this.patmed1_doc.Text       = "";
                this.patmed2_doc.Text       = "";
                this.submit_presc.IsEnabled = true;
            }
            else
            {
                MessageBox.Show("At least one medicine is required for prescription", "Reminder", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
        }
        private void updteBtn_pres_Click(object sender, RoutedEventArgs e)
        {
            if (presSelected == null)
            {
                return;
            }



            String patType = mypresc_pattype.Text;
            int    mid     = int.Parse(mypresc_med.SelectedValue.ToString());
            String Dosage  = mypresc_dosage.Text;
            String disease = null;

            if (string.IsNullOrEmpty(patType) || string.IsNullOrEmpty(Dosage))
            {
                MessageBox.Show("Please make sure all attributes are compelted.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }


            string prevType = presSelected.Patient.pat_type;

            presSelected.Patient.pat_type = patType.ToLower();
            presSelected.med_id           = mid;
            presSelected.presc_dosage     = Dosage;



            IndoorPatient indo = hmsfac.getIndoorByPid(presSelected.pat_id);

            if (patType.ToLower().Equals("indoor") && prevType.Equals("outdoor"))
            {
                this.mypresc_disease.IsEnabled = true;
                disease = mypresc_disease.Text;
                if (!String.IsNullOrEmpty(disease))
                {
                    IndoorPatient indpat = new IndoorPatient();
                    indpat.indpat_disease = disease;
                    indpat.pat_id         = presSelected.pat_id;
                    indpat.indpat_status  = "admitted";
                    hmsfac.addIndoor(indpat);
                }
                else
                {
                    MessageBox.Show("Please enter a diesease.");
                    return;
                }
            }
            else if (patType.ToLower().Equals("outdoor"))
            {
                if (indo != null)
                {
                    hmsfac.remove(indo);
                }
            }
            else
            {
                indo.indpat_disease = disease;
                hmsfac.updateIndoor(indo);
            }



            hmsfac.updatePrescription(presSelected);


            MessageBox.Show("Record updated success.", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
            dataGrid_MyPrescriptions.Items.Refresh();
            NewPatientList = hmsfac.getPatient();
            dataGrid_NewPatient.Items.Refresh();
        }
 private void dataGrid_OldPatient_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     oldPatSelected             = (IndoorPatient)dataGrid_OldPatient.SelectedItem;
     addpresc_doc.IsEnabled     = true;
     changestatus_doc.IsEnabled = true;
 }