Ejemplo n.º 1
0
        private void checkInOutButton_Click(object sender, EventArgs e)
        {
            if (selectedVisit != null)
            {
                //the patient must be checking out, as they never exited their last visit.

                CheckOut C = new CheckOut(this, ref selectedPatient, ref selectedVisit);
                C.Closed += (s, args) => this.Close();
                C.Show();
                Hide();
                //selectedVisit.setExitDate(DateTime.Now);
                //RADGSHALibrary.DBConnectionObject conn = RADGSHALibrary.DBConnectionObject.getInstance();
                //conn.addVisit(selectedVisit, selectedPatient);
                //checkInOutButton.Text = "Check In";
                //selectedVisit = null;
            }
            else
            {
                DBConnectionObject conn = DBConnectionObject.getInstance();
                //The patient has already finished their last visit, must be checking into a new visit.
                //this.Hide();

                selectedPatient.checkIn();
                selectedVisit = selectedPatient.getCurrentVisit();
                selectedVisit.setEntryDate(DateTime.Now);
                selectedVisit.changeDiagnosis(VisitDiagnosisTextBox.Text);
                selectedVisit.setAttendingPhysician(textAttendingPhy.Text);
                selectedVisit.setNote(visitNotes.Text);
                ChangeRoom C = new ChangeRoom(this, ref selectedPatient, ref selectedVisit);

                // C.Closed += (s, args) => this.Close();
                C.ShowDialog();
                conn.addVisit(selectedVisit, selectedPatient);
                for (int i = 0; i < textSymptoms.Lines.Length; i++)
                {
                    selectedVisit.addSymptom(textSymptoms.Lines[i].Trim());
                    conn.addSymptom(selectedPatient, selectedVisit, textSymptoms.Lines[i].Trim());
                }
                // if (selectedVisit.getRoomList()[0]!=null) conn.addStaysIn(selectedVisit.getRoomList()[0], selectedPatient, selectedVisit);
                checkInOutButton.Text = "Check Out";
                displayPatient();
            }
        }
Ejemplo n.º 2
0
        public void getVisits(ref Patient patient)
        {
            /* This attaches a list of visits to patient.
             * Symptoms are pulled from the symptoms table and attached to visits
             * Rooms are attached to visits
             * TODO: Items and Services still need to be attached to the visit!
             *
             */

            patient.getVisitList().Clear(); // should probably clear the list so as not to duplicate?

            string     queryString = "getVisits";
            SqlCommand command     = new SqlCommand(queryString, conn);

            command.CommandType = System.Data.CommandType.StoredProcedure;
            command.Parameters.Add(new SqlParameter("@ssn", patient.getSSN()));

            command.Connection = conn;

            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                Visit visit = new Visit();

                if (!reader.IsDBNull((int)VisCol.EntryDate))
                {
                    visit.setEntryDate(reader.GetDateTime((int)VisCol.EntryDate));
                }

                if (!reader.IsDBNull((int)VisCol.ExitDate))
                {
                    visit.setExitDate(reader.GetDateTime((int)VisCol.ExitDate));
                }
                else
                {
                    patient.setCurrentVisit(ref visit);
                }

                if (!reader.IsDBNull((int)VisCol.AttendingPhysician))
                {
                    visit.setAttendingPhysician(reader.GetString((int)VisCol.AttendingPhysician));
                }
                if (!reader.IsDBNull((int)VisCol.Diagnosis))
                {
                    visit.changeDiagnosis(reader.GetString((int)VisCol.Diagnosis));
                }
                if (!reader.IsDBNull((int)VisCol.Notes))
                {
                    visit.setNote(reader.GetString((int)VisCol.Notes));
                }
                patient.addVisit(visit);
            }
            reader.Close();

            // while we are getting patient visits, we might as well populate patient symptoms

            List <Visit> visits = patient.getVisitList();

            Console.WriteLine("Visits: " + visits.Count);
            for (int i = 0; i < visits.Count; i++)
            {
                List <string> symptoms = querySymptoms(patient, visits[i]);
                Console.WriteLine("Symptoms: " + symptoms.Count);

                foreach (string s in symptoms) // add symptoms
                {
                    Console.WriteLine(s);
                    visits[i].addSymptom(s);
                    Console.WriteLine("Symptoms LIst: " + patient.getVisitList()[i].getSymptomList().Count);
                }
                Visit v = visits[i];

                getRoomList(ref patient, ref v);

                foreach (Room r in visits[i].getRoomList()) // add rooms
                {
                    Console.WriteLine("Patient " + patient.getFirstName() + " " + patient.getLastName() + " stayed in room " + r.getRoomNumber() + " which has an hourly rate of " + r.getHourlyRate());
                    getRoomEntryExitDates(patient, visits[i], r, out DateTime entryDate, out DateTime exitDate, out bool stillInroom);
                    Console.WriteLine("Patient stayed in room from " + entryDate + " to " + exitDate);
                }
            }
        }
Ejemplo n.º 3
0
        private void saveCurrentPatient()
        {
            DBConnectionObject conn = DBConnectionObject.getInstance();

            selectedPatient.setFirstName(patientFirstNameTextBox.Text);
            selectedPatient.setMiddleInitial(PatientMiddleInitialTextBox.Text[0]);
            selectedPatient.setFirstName(patientFirstNameTextBox.Text);
            selectedPatient.setLastName(patientLastNameTextBox.Text);
            selectedPatient.setAddressLine1(patientAddressLine1TextBox.Text);
            selectedPatient.setAddressLine2(patientAddressLine2TextBox.Text);
            selectedPatient.setCity(patientCityTextBox.Text);
            selectedPatient.setState(patientStateTextBox.Text);
            selectedPatient.setZipcode(patientZipTextBox.Text);
            selectedPatient.setGender(patientGenderTextBox.Text[0]);
            selectedPatient.setInsurer(patientInsurerID.Text);

            if (patientDNR.Text == "True")
            {
                selectedPatient.setDoNotResuscitateStatus(true);
            }
            else if (patientDNR.Text == "False")
            {
                selectedPatient.setDoNotResuscitateStatus(false);
            }

            if (patientOrganDonor.Text == "True")
            {
                selectedPatient.setOrganDonorStatus(true);
            }
            else if (patientOrganDonor.Text == "False")
            {
                selectedPatient.setOrganDonorStatus(false);
            }



            selectedPatient.setBirthDate(dateBirthdate.Value);

            conn.updatePatient(selectedPatient);

            if (selectedVisit != null)
            {
                selectedVisit.setEntryDate(EntryDatePicker.Value);
                selectedVisit.setAttendingPhysician(textAttendingPhy.Text);
                selectedVisit.changeDiagnosis(VisitDiagnosisTextBox.Text);
                selectedVisit.setNote(visitNotes.Text);

                for (int i = 0; i < textSymptoms.Lines.Length; i++)
                {
                    bool hasSymptom = false;;
                    foreach (string s in selectedVisit.getSymptomList())
                    {
                        if (textSymptoms.Lines[i].Trim() == s)
                        {
                            hasSymptom = true;
                        }
                    }
                    if (hasSymptom == false)
                    {
                        conn.addSymptom(selectedPatient, selectedVisit, textSymptoms.Lines[i].Trim());
                    }
                }

                conn.updateVisit(selectedVisit, selectedPatient);
            }
        }