private sbyte mySqlUpdateMedicationDose() { DBConnection dbCon = MySqlHelper.dbCon; MedicationDose dose = MedicationAdministrationControl.SelectedDose; Patient pat = dose.ForPatient; Medication med = dose.ForMedication; ArrayList response = dbCon.selectQuery( string.Format("SELECT update_dose({0}, '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', {7})", dose.Id, med.Id, pat.Id, 0, scheduleTextBox.Text, Convert.timeStrToMySqlDateStr(timePeriodTextBox.Text), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "NULL")); MySqlHelper.disconnect(); if ((sbyte)(response[0] as ArrayList)[0] == 0) MessageBox.Show("Medication dose not updated.", "Update Error", MessageBoxButton.OK, MessageBoxImage.Error); else MedicationDose.refreshMedicationDosePool(PatientPoolControl.SelectedPatient.Id); return (sbyte)(response[0] as ArrayList)[0]; }
private long mySqlAddNewMedicationDose() { DBConnection dbCon = MySqlHelper.dbCon; Patient pat = PatientPoolControl.SelectedPatient; Medication med = MedicationPoolWindow.SelectedMedication; ArrayList response = dbCon.selectQuery( string.Format("SELECT add_dose({0}, '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', {7})", "NULL", med.Id, pat.Id, 0, scheduleTextBox.Text, Convert.timeStrToMySqlDateStr(timePeriodTextBox.Text), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "NULL")); MySqlHelper.disconnect(); if ((long)(response[0] as ArrayList)[0] == 0) MessageBox.Show("Medication dose not saved.", "Save Error", MessageBoxButton.OK, MessageBoxImage.Error); else MedicationDose.refreshMedicationDosePool(PatientPoolControl.SelectedPatient.Id); return (long)(response[0] as ArrayList)[0]; }
private void MedicationPoolWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { e.Cancel = true; MedicationDose.refreshMedicationDosePool(PatientPoolControl.SelectedPatient.Id); Hide(); }
private void generateMarButton_Click(object sender, RoutedEventArgs e) { StreamWriter sWriter = new StreamWriter("mar.html"); if (sWriter == null) { MessageBox.Show("mar.html could not be created.", "Write Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } Patient pat = patientPoolListView.SelectedItem as Patient; MedicationDose.refreshMedicationDosePool(pat.Id); ObservableCollection<MedicationDose> doses = MedicationDose.MedicationDosePool; string style = @"<style>body {margin: auto;font-size: 10pt;font-family: Arial, Verdana, sans-serif;}" + ".border {border: 1px solid black; border-collapse: collapse; border-spacing: 0;} .border td {border: 1px solid black;}" + "table {width: 100%;table-layout: fixed;border-collapse: collapse; border-spacing: 0;} bottom-border {border: 0;} .bottom-border td {border-bottom: 1px solid black;}</style>"; sWriter.WriteLine(@"<!doctype html><html lang='en'><head><title>MAR Sheet</title><meta charset='utf-8'>" + style + "</head><body>"); sWriter.WriteLine(@"<table>"); sWriter.WriteLine(string.Format("<tr><td colspan='2'> {0}</td><td colspan='7'>MEDICATION ADMINISTRATION RECORD</td></tr>", DateTime.Today.ToString("MM/dd/yyyy"))); sWriter.WriteLine("<tr><td colspan='2'>Time Verified 2300</td><td colspan='7'>Gulf Coast State College Nursing Hospital</td></tr><tr><td colspan='9'> <br> </td></tr>"); sWriter.WriteLine("<tr><td colspan='9'>Checked by:__________________________________</td></tr>"); sWriter.WriteLine(string.Format("<tr><td>Diagnosis:</td><td colspan='2'>{0}</td></tr>", pat.Diagnosis)); sWriter.WriteLine(string.Format("<tr><td>Allergies:</td><td colspan='2'>{0}</td><td>Diet:</td><td colspan='2'>{1}</td>" + "<td colspan='3'><b>{2}</b></td></tr>", pat.Allergies, pat.Diet, pat.Name)); sWriter.WriteLine(string.Format("<tr><td colspan='6'> </td><td colspan='3'>Rm {0}</td></tr>", pat.RoomNumber)); sWriter.WriteLine(string.Format("<tr><td colspan='3'>Notes:</td><td colspan='3'>Admission Date: {0}</td>" + "<td colspan='3'>{1}</td></tr>", pat.AdmissionDate.ToString("MM/dd/yyyy"), pat.DrName)); sWriter.WriteLine(string.Format("<tr class='bottom-border'><td colspan='3'> </td><td colspan='2'>Wt: {0} lbs.</td>" + "<td colspan='1'>Age: 34</td><td colspan='1'>Gender: {1}</td><td colspan='2'>DOB: {2}</td></tr>", pat.Weight, pat.Gender == PatientGender.Male ? 'M' : 'F', pat.DateOfBirth.ToString("MM/dd/yyyy"))); sWriter.WriteLine(string.Format("<tr><td colspan='4' style='text-align: right;'>Administration Period</td><td> </td>" + "<td colspan='4'>2300 {0} to 2259 {1}</td></tr></table>", DateTime.Today.Subtract(new TimeSpan(1, 0, 0, 0)).ToString("MM/dd/yyyy"), DateTime.Today.ToString("MM/dd/yyyy"))); //--- sWriter.WriteLine("<table class='border'>"); sWriter.WriteLine("<tr class='border'><td style='text-align: left;' colspan='4'>Drug Name, Strength, Route, Schedule</td>" + "<td style='text-align: center;'>Start</td><td style='text-align: center;'>Stop</td><td style='text-align: center;'>2300-0659</td>" + "<td style='text-align: center;'>0700-1459</td><td style='text-align: center;'>1500-2259</td></tr>"); //preformatted text for medication doses string preformatted = "<tr class='border'><td colspan='4'>{0}, {1}, {2}, {3}<br> </td>" + "<td>{4}<br> </td><td> </td><td>{5}<br> </td><td>{6}<br> </td><td>{7}<br> </td></tr>"; //write the doses out foreach (MedicationDose d in doses) sWriter.WriteLine(string.Format(preformatted, d.ForMedication.Name, d.ForMedication.Strength, Medication.Routes[d.ForMedication.Route], d.Schedule, d.StartTime.ToString("MM/dd/yyyy"), Util.get1stTimePeriod(d), Util.get2ndTimePeriod(d), Util.get3rdTimePeriod(d))); sWriter.WriteLine("</table>"); //--- sWriter.WriteLine("<table>"); sWriter.WriteLine("<tr><td colspan='3'>INJECTION CODE:</td><td colspan='4'>DOCUMENT EACH INJ. SITE</td>" + "<td colspan='2'>WITH A CODE LETTER</td></tr>"); sWriter.WriteLine("<tr><td colspan='2'>A.= L.U.Q.</td><td colspan='2'>B.= R.U.Q.</td><td colspan='2'>C.= L. Thigh</td>" + "<td colspan='2'>D.= R. Thigh</td><td>E.= L. Arm</td></tr>"); sWriter.WriteLine("<tr><td colspan='2'>F.= R. Arm</td><td colspan='2'>G.= L. ABD.</td><td colspan='2'>H.= R. ABD.</td>" + "<td colspan='2'>I.= RVG</td><td>J.= LVG</td></tr>"); sWriter.WriteLine(@"</table>"); //--- sWriter.WriteLine("<table class='border' style='border-style: double;'>"); sWriter.WriteLine("<tr><td>Initials</td><td colspan='2'>Signature</td><td>Initials</td>" + "<td colspan='2'>Signature</td><td>Initials</td><td colspan='2'>Signature</td></tr>"); sWriter.WriteLine("<tr><td> </td><td colspan='2'> </td><td> </td>" + "<td colspan='2'> </td><td> </td><td colspan='2'> </td></tr>"); sWriter.WriteLine("<tr><td>Initials</td><td colspan='2'>Signature</td><td>Initials</td>" + "<td colspan='2'>Signature</td><td>Initials</td><td colspan='2'>Signature</td></tr>"); sWriter.WriteLine("<tr><td> </td><td colspan='2'> </td><td> </td>" + "<td colspan='2'> </td><td> </td><td colspan='2'> </td></tr>"); sWriter.WriteLine("<tr><td>Initials</td><td colspan='2'>Signature</td><td>Initials</td>" + "<td colspan='2'>Signature</td><td>Initials</td><td colspan='2'>Signature</td></tr>"); sWriter.WriteLine(@"</table>"); //--- sWriter.WriteLine(@"<table>"); sWriter.WriteLine("<tr><td> </td><td colspan='2'> </td><td> </td>" + "<td colspan='2'> </td><td> </td><td colspan='2'> </td></tr>"); sWriter.WriteLine(string.Format("<table><tr><td colspan='6'> <br> <br>Room: {0}</td>" + "<td colspan='3'> <br> <br>Physician: {1}</td></tr>", pat.RoomNumber, pat.DrName)); sWriter.WriteLine(@"</table>"); sWriter.WriteLine(@"</body></html>"); sWriter.Close(); //launch in default browser Process.Start("mar.html"); } //End generateMarButton_Click()
private void removeButton_Click(object sender, RoutedEventArgs e) { MySqlHelper.removeMedicationDose(SelectedDose.Id); MedicationDose.refreshMedicationDosePool(SelectedDose.ForPatient.Id); }
private void editButton_Click(object sender, RoutedEventArgs e) { PatientEditorWindow.Instance.ActionMode = ActionMode.EditMode; MedicationDose.refreshMedicationDosePool(PatientPoolControl.SelectedPatient.Id); PatientEditorWindow.Instance.ShowDialog(); }