public void addSymptom(Patient patient, Visit v, string symptom) { string procedureName = "addSymptom"; List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@patientId", patient.getSSN())); parameters.Add(new SqlParameter("@entryDate", v.getEntryDate())); parameters.Add(new SqlParameter("@symptomName", symptom)); SqlDataReader reader = executeStoredProcedure(procedureName, parameters); closeReader(ref reader); }
public void closeVisit(Patient patient, Visit v) { string procedureName = "closeVisit"; List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@patientId", patient.getSSN())); parameters.Add(new SqlParameter("@entryDate", v.getEntryDate())); parameters.Add(new SqlParameter("@exitDate", v.getExitDate())); SqlDataReader reader = executeStoredProcedure(procedureName, parameters); closeReader(ref reader); }
public void addStaysIn(Room room, Patient patient, Visit v) { string procedureName = "addStaysIn"; List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@patientId", patient.getSSN())); parameters.Add(new SqlParameter("@roomNumber", room.getRoomNumber())); parameters.Add(new SqlParameter("@roomEffectiveDate", room.getEffectiveDate())); parameters.Add(new SqlParameter("@visitEntrydate", v.getEntryDate())); SqlDataReader reader = executeStoredProcedure(procedureName, parameters); closeReader(ref reader); }
public void addUses(Inventory inventory, Patient patient, Visit v, int quantityUsed) { string procedureName = "addUses"; List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@stockId", inventory.getStockID())); parameters.Add(new SqlParameter("@patientId", patient.getSSN())); parameters.Add(new SqlParameter("@entryDate", v.getEntryDate())); parameters.Add(new SqlParameter("@quantityUsed", quantityUsed)); SqlDataReader reader = executeStoredProcedure(procedureName, parameters); closeReader(ref reader); }
public void getRoomList(ref Patient patient, ref Visit visit) // Attaches the room(s) associated with this patient visit { string procedureName = "getStaysIn"; List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@roomNumber", "")); parameters.Add(new SqlParameter("@patientId", patient.getSSN())); parameters.Add(new SqlParameter("@visitEntryDate", visit.getEntryDate())); SqlDataReader reader = executeStoredProcedure(procedureName, parameters); int count = 0; List <Room> rooms = visit.getRoomList(); rooms.Clear(); // make sure we clear the room list, as we are adding room(s) back on SortedList <string, DateTime> roomDataHolder = new SortedList <string, DateTime>(); while (reader.Read() && count < QUERY_LIMIT) { string roomNum = reader.GetString((int)staysInCol.RoomNumber); DateTime roomEffectiveDate = reader.GetDateTime((int)staysInCol.RoomEffectiveDate); roomDataHolder.Add(roomNum, roomEffectiveDate); /* 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); foreach (KeyValuePair <string, DateTime> kvp in roomDataHolder) { Room room = getRoom(kvp.Key, kvp.Value); visit.addRoom(room); } }
public int getUses(Patient p, Visit v, string stockID) // returns the quantity of the item used { string procedureName = "getUses"; List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@patientId", p.getSSN())); parameters.Add(new SqlParameter("@entryDateTime", v.getEntryDate())); parameters.Add(new SqlParameter("@stockID", stockID)); SqlDataReader reader = executeStoredProcedure(procedureName, parameters); reader.Read(); int quantity = reader.GetInt32((int)UsesCol.amount); closeReader(ref reader); return(quantity); }
public List <string> queryUses(Patient p, Visit v) { string procedureName = "queryUses"; List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@patientId", p.getSSN())); parameters.Add(new SqlParameter("@entryDateTime", v.getEntryDate())); SqlDataReader reader = executeStoredProcedure(procedureName, parameters); List <string> ids = new List <string>(); while (reader.Read()) { ids.Add(reader.GetString((int)UsesCol.StockId)); } closeReader(ref reader); return(ids); }
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); }
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(); }
/* * // 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); }
private void displayPatient() { patientFirstNameTextBox.Text = selectedPatient.getFirstName(); PatientMiddleInitialTextBox.Text = selectedPatient.getMiddleInitial().ToString(); patientLastNameTextBox.Text = selectedPatient.getLastName(); patientAddressLine1TextBox.Text = selectedPatient.getAddressLine1(); patientAddressLine2TextBox.Text = selectedPatient.getAddressLine2(); patientCityTextBox.Text = selectedPatient.getCity(); patientStateTextBox.Text = selectedPatient.getState(); patientZipTextBox.Text = selectedPatient.getZipcode(); patientGenderTextBox.Text = selectedPatient.getGender().ToString(); patientSSN.Text = selectedPatient.getSSN(); patientInsurerID.Text = selectedPatient.getInsurer(); if (selectedPatient.getDoNotResuscitateStatus()) { patientDNR.Text = "True"; } else { patientDNR.Text = "False"; } if (selectedPatient.getOrganDonorStatus()) { patientOrganDonor.Text = "True"; } else { patientOrganDonor.Text = "False"; } //patientBirthdateTextBox.Text = selectedPatient.getBirthDate().ToString("MM/dd/yyyy"); dateBirthdate.Value = selectedPatient.getBirthDate(); if (selectedVisit == null) { EntryDatePicker.Visible = false; changeRoomButton.Enabled = false; diagnosisWizardButton.Enabled = false; useInventoryButton.Enabled = false; } else { EntryDatePicker.Visible = true; EntryDatePicker.Value = selectedVisit.getEntryDate(); if (selectedVisit.getRoomList().Count > 0) { visitRoomNumber.Text = selectedVisit.getRoomList()[selectedVisit.getRoomList().Count - 1].getRoomNumber(); } textSymptoms.Text = ""; foreach (string s in selectedVisit.getSymptomList()) { textSymptoms.Text += s + "\r\n"; } VisitDiagnosisTextBox.Text = selectedVisit.getDiagnosis(); textAttendingPhy.Text = selectedVisit.getAttendingPhysician(); visitNotes.Text = selectedVisit.getNote(); changeRoomButton.Enabled = true; diagnosisWizardButton.Enabled = true; useInventoryButton.Enabled = true; //roomNumber.Items = selectedVisit.getRoomList() } listPreviousVisits.Items.Clear(); for (int i = selectedPatient.getVisitList().Count - 1; i >= 0; i--) // selectedPatient.getVisitList.Count Visit v in selectedPatient.getVisitList()) { Visit v = selectedPatient.getVisitList()[i]; if (selectedVisit != null && selectedVisit.getEntryDate() == v.getEntryDate()) { continue; // we don't want to display current visit in previous visit list } Console.WriteLine("Adding previous visit at date: " + v.getEntryDate().ToShortDateString()); ListViewItem previousVisit = new ListViewItem(v.getEntryDate().ToString()); previousVisit.SubItems.Add(v.getAttendingPhysician()); previousVisit.SubItems.Add(v.getDiagnosis()); // previousVisitList.Items.Add(previousVisit); listPreviousVisits.Items.Add(previousVisit); } if (selectedVisit == null) { textSymptoms.Enabled = true; VisitDiagnosisTextBox.Enabled = true; textAttendingPhy.Enabled = true; visitNotes.Enabled = true; } else { textSymptoms.Enabled = false; VisitDiagnosisTextBox.Enabled = false; textAttendingPhy.Enabled = false; visitNotes.Enabled = false; } }