Exemplo n.º 1
0
 public ChangeRoom(Form previousForm, ref RADGSHALibrary.Patient p, ref RADGSHALibrary.Visit v)
 {
     InitializeComponent();
     selectedPatient   = p;
     selectedVisit     = v;
     this.previousForm = previousForm;
 }
Exemplo n.º 2
0
        public Patient(Form previousForm, RADGSHALibrary.Patient selectedPatient)
        {
            selectedVisit  = selectedPatient.getCurrentVisit();
            editingPatient = false;
            InitializeComponent();
            this.previousForm    = previousForm;
            this.selectedPatient = selectedPatient;
            //set the patient passed to this form as the active patient
            displayPatient();
            disableCurrentPatientTextBoxes();


            //selectedVisit = new RADGSHALibrary.Visit();
            //selectedVisit.setPatientId(selectedPatient.getSSN());

            checkInOutButton.Text = (selectedVisit == null) ? "Check In" : "Check Out";
            //checkInOutButton.Text = (selectedVisit.getExitDate() == null) ? "Check Out" : "Check In";
        }
Exemplo n.º 3
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();
            }
        }
Exemplo n.º 4
0
        public List <string> querySymptoms(Patient patient, Visit visit, string symptomName = "")
        {
            string procedureName = "querySymptoms";

            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("@patientId", patient.getSSN()));
            parameters.Add(new SqlParameter("@entryDate", visit.getEntryDate()));
            parameters.Add(new SqlParameter("@symptomName", symptomName));
            SqlDataReader reader = executeStoredProcedure(procedureName, parameters);

            List <string> results = new List <string>();

            while (reader.Read()) // no query limit on symptoms
            {
                results.Add(reader.GetString((int)SymCol.SymptomName));
            }
            closeReader(ref reader);

            return(results);
        }
Exemplo n.º 5
0
        public void alterVisit(bool update, Visit visit, Patient patient)
        {
            string queryString = "addVisit";

            if (update)
            {
                queryString = "updateVisit";
            }
            SqlCommand command = new SqlCommand(queryString, conn);

            command.CommandType = System.Data.CommandType.StoredProcedure;
            command.Parameters.Add(new SqlParameter("@patientID", patient.getSSN()));
            command.Parameters.Add(new SqlParameter("@entryDate", visit.getEntryDate()));
            command.Parameters.Add(new SqlParameter("@attendingPhysician", visit.getAttendingPhysician()));
            //  '@attendingPhysician
            command.Parameters.Add(new SqlParameter("@diagnosis", visit.getDiagnosis()));
            command.Parameters.Add(new SqlParameter("@note", visit.getNote()));
            command.Connection = conn;

            SqlDataReader reader = command.ExecuteReader();

            reader.Close();
        }
Exemplo n.º 6
0
        /*
         * // Possibly won't use "getStaysIn methods but specialized versions that I'm writing below, such as getRoomList, and getRoomEntryExitDate
         * public void getStaysIn(string patientSSN, string roomNumber)
         * {
         *  getStaysIn(patientSSN, roomNumber, DateTime.MinValue, DateTime.MinValue);
         * }
         * public void getStaysIn(string patientSSN, string roomNumber, DateTime visitEntryDate)
         * {
         *  getStaysIn(patientSSN, roomNumber, visitEntryDate, DateTime.MinValue);
         * }
         *
         *
         * public void getStaysIn(string patientSSN, string roomNumber, DateTime visitEntryDate, DateTime roomEffectiveDate) // I'm not sure exactly what this will look like yet
         * // This will probably return something at some point. The other methods send DateTime.MinValue as an argument as a way of saying, we don't want to use that as a parameter
         * // Yeah, I know that's a bad hack
         * {
         *  string procedureName = "getStaysIn";
         *
         *  List<SqlParameter> parameters = new List<SqlParameter>();
         *  parameters.Add(new SqlParameter("@roomNumber", roomNumber));
         *  if (roomEffectiveDate == DateTime.MinValue)
         *      parameters.Add(new SqlParameter("@roomEffectiveDate", ""));
         *  else
         *      parameters.Add(new SqlParameter("@roomEffectiveDate", roomEffectiveDate));
         *  parameters.Add(new SqlParameter("@patientId", patientSSN));
         *  if (visitEntryDate == DateTime.MinValue)
         *      parameters.Add(new SqlParameter("@visitEntryDate", ""));
         *  else
         *      parameters.Add(new SqlParameter("@visitEntryDate", visitEntryDate));
         *  SqlDataReader reader = executeStoredProcedure(procedureName, parameters);
         *
         *  // Now we need to do something with the values that we retreive...
         *  // private enum staysInCol : int { RoomNumber, RoomEffectiveDate, PatientId, VisitEntryDate, RoomEntryDateTime, RoomExitDateTime };
         *  int count = 0;
         *  while (reader.Read() && count < QUERY_LIMIT)
         *  { */
        /* Console.WriteLine("Room Number: " + reader.GetString((int)staysInCol.RoomNumber)
         + "Room Effective Date: " + reader.GetDateTime((int)staysInCol.RoomEffectiveDate)
         + "Patient SSN: " + reader.GetString((int)staysInCol.PatientId));
         + Console.WriteLine("\tVisit Entry Date: " + reader.GetDateTime((int)staysInCol.VisitEntryDate)
         + "Room Entry Date: " + reader.GetDateTime((int)staysInCol.RoomEntryDateTime)
         + "Room Exit Date: " + reader.GetDateTime((int)staysInCol.RoomExitDateTime)); */
        /*
         * count++;
         * }
         * closeReader(ref reader);
         * }*/

        public void getRoomEntryExitDates(Patient patient, Visit visit, Room room, out DateTime roomEntryDate, out DateTime roomExitDate, out bool stillInRoom)
        {
            // When you are calculating a bill, and you know that a patient stayed in "room", call this method to return the dates the patient entered and exited the room
            string procedureName = "getStaysIn";

            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("@roomNumber", room.getRoomNumber()));

            parameters.Add(new SqlParameter("@roomEffectiveDate", room.getEffectiveDate()));

            parameters.Add(new SqlParameter("@visitEntryDate", visit.getEntryDate()));
            parameters.Add(new SqlParameter("@patientId", patient.getSSN()));

            SqlDataReader reader = executeStoredProcedure(procedureName, parameters);

            roomEntryDate = DateTime.MinValue;
            roomExitDate  = DateTime.MinValue;
            stillInRoom   = false;
            while (reader.Read())
            {
                Console.WriteLine("Reading entry and exit date values");
                roomEntryDate = reader.GetDateTime((int)staysInCol.RoomEntryDateTime);


                if (!reader.IsDBNull((int)staysInCol.RoomExitDateTime))
                {
                    roomExitDate = reader.GetDateTime((int)staysInCol.RoomExitDateTime);
                }
                else
                {
                    stillInRoom = true;
                }
            }
            closeReader(ref reader);
        }
Exemplo n.º 7
0
        public void updateVisit(Visit visit, Patient patient)
        {
            bool update = true;

            alterVisit(update, visit, patient);
        }
Exemplo n.º 8
0
        public void addVisit(Visit visit, Patient patient)
        {
            bool update = false;

            alterVisit(update, visit, patient);
        }
Exemplo n.º 9
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);
                }
            }
        }
Exemplo n.º 10
0
 public void setCurrentVisit(ref Visit visit)
 {
     curVisit = visit;
 }
Exemplo n.º 11
0
 public void addVisit(Visit newVisit) // add missing function for adding a new visit (not in design document)
 {
     visits.Add(newVisit);
 }