Диплом: Автоматизация учета пациентов на примере ООО «АРХИДЕНТ»

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
97
</DataGrid.Columns>
</DataGrid>
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="5">
<Button Content="Новыйпациент" Click="ButtonNewPatient_Click"
Margin="0 0 5 0" Padding="5 0 5 0"/>
<Button Content="Карточкапациента" Click="ButtonPatientCard_Click"
Margin="0 0 5 0" Padding="5 0 5 0"/>
<Button Content="Назначитьприем" Click="ButtonNewReception_Click"
Margin="0 0 5 0" Padding="5 0 5 0"/>
<Button Content="удалитьзаписьприема"
Click="ButtonDeleteReception_Click" Margin="0 0 5 0" Padding="5 0 5 0"/>
</StackPanel>
</Grid>
</Grid>
</Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
98
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Reception
{
public class Patient
{
public int Id { get; set; }
public string namePatient { get; set; }
public string surname { get; set; }
public string patronymic { get; set; }
public int age { get; set; }
public string FIO { get; set; }
public string passport { get; set; }
public string phone { get; set; }
public DateTime registration_date { get; set; }
}
public class Doctor
{
public int Id { get; set; }
public string nameDoctor { get; set; }
public string surname { get; set; }
public string patronymic { get; set; }
public string password { get; set; }
public int position_id { get; set; }
public string positionname { get; set; }
public string FIO { get; set; }
99
}
public class Position
{
public int Id { get; set; }
public string namePosition { get; set; }
}
public class Position_Procedure
{
public int Id { get; set; }
public int position { get; set; }
public int procedure { get; set; }
}
public class Procedure
{
public int Id { get; set; }
public string nameProcedure { get; set; }
public int price { get; set; }
}
public class Reception_
{
public int Id { get; set; }
public int doctor_id { get; set; }
public string nameDoctor { get; set; }
public string surnameDoctor { get; set; }
public string patronymicDoctor { get; set; }
public int patient_id { get; set; }
public string namePatient { get; set; }
public string surnamePatient { get; set; }
100
public string patronymicPatient { get; set; }
public int procedure { get; set; }
public string nameProcedure { get; set; }
public DateTime begin_reception { get; set; }
public bool status { get; set; }
public int price { get; set; }
}
public partial class MainWindow : Window
{
SqlConnection connection;
SqlCommand command;
SqlDataReader reader;
string sqlExpression;
Patient SelectionObj = null;
public MainWindow()
{
InitializeComponent();
//проверкасущ. базы + диалогеслиеенет
string path = SettingsApp.Default.FullPathDataBase;
if (path == "") { path = "C:\\"; }
FileInfo file = new FileInfo(path);
if (!file.Exists)
101
{
MessageBox.Show(
"Ненайденфайлбазыданных: " +
SettingsApp.Default.FullPathDataBase,
"Warning", MessageBoxButton.OK,
MessageBoxImage.Warning);
Microsoft.Win32.OpenFileDialog dialog = new
Microsoft.Win32.OpenFileDialog();
if (dialog.ShowDialog().ToString() == "True")
{
path = dialog.FileName;
SettingsApp.Default.FullPathDataBase = dialog.FileName;
SettingsApp.Default.Save();
}
else
{
SettingsApp.Default.FullPathDataBase = "DBApp.mdb";
SettingsApp.Default.Save();
MessageBox.Show("err");
Environment.Exit(0);
}
}
//подключение
connection = new SqlConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" + path + ";Persist Security Info=True");
try
{
102
connection.Open();
/*MessageBox.Show(
"ПодключениекБДуспешнооткрыто.\r\n" +
" Параметры подключениея к базе данных: " + "\r\n" +
" |базаданных: ---------- " + connection.Database + "\r\n" +
" |сервер: --------------- " + connection.DataSource + "\r\n" +
" |версиясервера: ------- " + connection.ServerVersion + "\r\n" +
" |состояние: ------------ " + connection.State);*/
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message, "ERROR DB
CONNECTION", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBoxResult result =
MessageBox.Show("Сброситьпутьдобазыданных ?", "err db connect",
MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
SettingsApp.Default.FullPathDataBase = "C:\\";
SettingsApp.Default.Save();
}
Environment.Exit(0);
}
//загрузкапациентов
sqlExpression = "SELECT Id_patient, namePatient, surname, patronymic,
age, passport, phone, registration_date FROM Patient;";
command = new SqlCommand(sqlExpression, connection);
103
reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
Patient temp = new Patient();
temp.Id = reader.GetInt32(0);
temp.namePatient = reader.GetString(1);
temp.surname = reader.GetString(2);
temp.patronymic = reader.GetString(3);
temp.age = reader.GetInt32(4);
temp.passport = reader.GetString(5);
temp.phone = reader.GetString(6);
//не работает загрузка даты регистрации
PatientDataGrid.Items.Add(temp);
}
}
//загрузкарасписания
sqlExpression = "SELECT [Reception].[Id_Reception],
[Reception].[doctor], [Doctor].[nameDoctor], [Doctor].[surname],
[Doctor].[patronymic], [Reception].[patient], [Patient].[namePatient],
[Patient].[surname], [Patient].[patronymic], [Reception].[procedure],
[Procedure].[nameProcedure], [Reception].[begin_reception], [Reception].[status],
[Reception].[price] FROM (([Reception] LEFT JOIN [Doctor] ON
[Reception].[doctor] = [Doctor].[Id_doc]) LEFT JOIN [Patient] ON
[Reception].[patient] = [Patient].[Id_patient]) LEFT JOIN [Procedure] ON
[Reception].[procedure] = [Procedure].[Id_Procedure]";
command = new SqlCommand(sqlExpression, connection);
104
reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
Reception_ temp = new Reception_();
temp.Id = reader.GetInt32(0);
temp.doctor_id = reader.GetInt32(1);
temp.nameDoctor = reader.GetString(2);
temp.surnameDoctor = reader.GetString(3);
temp.patronymicDoctor = reader.GetString(4);
temp.patient_id = reader.GetInt32(5);
temp.namePatient = reader.GetString(6);
temp.surnamePatient = reader.GetString(7);
temp.patronymicPatient = reader.GetString(8);
temp.procedure = reader.GetInt32(9);
temp.nameProcedure = reader.GetString(10);
temp.begin_reception = reader.GetDateTime(11);
temp.status = reader.GetBoolean(12);
temp.price = reader.GetInt32(13);
ReceptionDataGrid.Items.Add(temp);
}
}
105
//загрузкапроцедур
sqlExpression = "SELECT [Procedure].[Id_Procedure],
[Procedure].[nameProcedure] FROM [Procedure]";
command = new SqlCommand(sqlExpression, connection);
reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
Procedure temp = new Procedure();
temp.Id = reader.GetInt32(0);
temp.nameProcedure = reader.GetString(1);
ProcedureDataGrid.Items.Add(temp);
}
}
//загрузкаврачей
sqlExpression = "SELECT [Doctor].[Id_doc], [Doctor].[nameDoctor],
[Doctor].[surname], [Doctor].[patronymic], [Doctor].[position],
[Position].[namePosition] FROM [Doctor] LEFT JOIN [Position] ON
[Doctor].[position] = [Position].[Id_position]";
command = new SqlCommand(sqlExpression, connection);
reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
Doctor temp = new Doctor();
106
temp.Id = reader.GetInt32(0);
temp.nameDoctor = reader.GetString(1);
temp.surname = reader.GetString(2);
temp.patronymic = reader.GetString(3);
temp.position_id = reader.GetInt32(4);
temp.positionname = reader.GetString(5);
DoctorDataGrid.Items.Add(temp);
}
}
}
private void ButtonNewPatient_Click(object sender, RoutedEventArgs e)
{
Patient newpatient = new Patient();
PatientCard patientCard = new PatientCard(newpatient, connection,
true);
patientCard.Show();
}
private void ButtonPatientCard_Click(object sender, RoutedEventArgs e)
{
if (SelectionObj != null)
{
PatientCard patientCard = new PatientCard(SelectionObj,
connection);
patientCard.Show();
}
else
{
MessageBox.Show("Что бы открыть карточку пациента,

Смотрите также:

"Автоматизация обработки заявок ООО "Проектно-Строительная Компания"
"Автоматизация процесса аттестации персонала для ООО "Нэт Бай Нэт Холдинг"
"Анализ интернет-активности конкурентов ( на примере конкурентов "Газпром нефть")
"Бухгалтерский учёт и аудит расчётов с подотчётними лицами в организации на примере ООО "ЛОЦ 10""
«Психологическое сопровождение персонала в организации на примере ООО «Крокус»
«Управление ресурсами проекта» (на примере организации ООО «ЛАКОСТЭ»)
Agile-методология в управлении проектами на примере ООО «Ресурсный центр «Академия КлассИнфо»
Aвтoмaтизaция пpoцecca вeдeния инфopмaциoннoй бaзы o дoлжнocтяx и вaкaнcияx c укaзaниeм тpeбoвaний к уpoвню знaний и нaвыкoв кaндидaтoв для гpуппы кaдpoв вoйcкoвoй чacти 3474»
Cовершенствование деловой оценки персонала в организации (на примере ООО "Даймонд кейтеринг развитие")
Cовершенствование управления рентабельности предприятия (на примере гуипп «бендерская типография «полиграфист»)