Compare commits
2 Commits
2ec111faae
...
13f4d91366
Author | SHA1 | Date | |
---|---|---|---|
13f4d91366 | |||
e16b154578 |
@ -26,6 +26,27 @@ namespace MedicalBusinessLogic.BusinessLogics
|
||||
|
||||
protected abstract V GetViewModel(M model);
|
||||
|
||||
public bool DeleteAll(out double elapsedMilliseconds)
|
||||
{
|
||||
elapsedMilliseconds = 0;
|
||||
try
|
||||
{
|
||||
_storage.DeleteAll(out elapsedMilliseconds);
|
||||
_logger.LogInformation($"Delete ALL operation success");
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning($"Delete ALL operation failed: {ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool DeleteAll()
|
||||
{
|
||||
return DeleteAll(out _);
|
||||
}
|
||||
|
||||
public bool Create(M model)
|
||||
{
|
||||
return Create(model, out _);
|
||||
@ -51,7 +72,7 @@ namespace MedicalBusinessLogic.BusinessLogics
|
||||
return Update(model, out _);
|
||||
}
|
||||
|
||||
public virtual List<V> ReadList(out long elapsedMilliseconds, S? searchModel = null)
|
||||
public virtual List<V> ReadList(out double elapsedMilliseconds, S? searchModel = null)
|
||||
{
|
||||
var elements = _storage.GetAll(out elapsedMilliseconds);
|
||||
|
||||
@ -64,7 +85,7 @@ namespace MedicalBusinessLogic.BusinessLogics
|
||||
return elements.Select(x => GetViewModel(x)).ToList();
|
||||
}
|
||||
|
||||
public virtual V? ReadElement(int id, out long elapsedMilliseconds)
|
||||
public virtual V? ReadElement(int id, out double elapsedMilliseconds)
|
||||
{
|
||||
var element = _storage.Get(id, out elapsedMilliseconds);
|
||||
if (element == null)
|
||||
@ -76,7 +97,7 @@ namespace MedicalBusinessLogic.BusinessLogics
|
||||
return GetViewModel(element);
|
||||
}
|
||||
|
||||
public virtual bool Create(M model, out long elapsedMilliseconds)
|
||||
public virtual bool Create(M model, out double elapsedMilliseconds)
|
||||
{
|
||||
elapsedMilliseconds = 0;
|
||||
try
|
||||
@ -93,7 +114,7 @@ namespace MedicalBusinessLogic.BusinessLogics
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Update(M model, out long elapsedMilliseconds)
|
||||
public virtual bool Update(M model, out double elapsedMilliseconds)
|
||||
{
|
||||
elapsedMilliseconds = 0;
|
||||
try
|
||||
@ -110,7 +131,7 @@ namespace MedicalBusinessLogic.BusinessLogics
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Delete(int id, out long elapsedMilliseconds)
|
||||
public virtual bool Delete(int id, out double elapsedMilliseconds)
|
||||
{
|
||||
elapsedMilliseconds = 0;
|
||||
try
|
||||
|
@ -53,7 +53,8 @@ namespace MedicalBusinessLogic.BusinessLogics
|
||||
Gender = model.Gender,
|
||||
Birthday = model.Birthday,
|
||||
Weight = model.Weight,
|
||||
Height = model.Height
|
||||
Height = model.Height,
|
||||
Age = model.GetAge()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -11,16 +11,19 @@ namespace MedicalBusinessLogic.BusinessLogics
|
||||
private readonly IStorage<Patient> _patientStorage;
|
||||
private readonly IStorage<Doctor> _doctorStorage;
|
||||
private readonly IStorage<Diagnose> _diagnoseStorage;
|
||||
private readonly IStorage<Specialization> _specializationStorage;
|
||||
public VisitLogic(
|
||||
ILogger<AbstractLogic<Visit, VisitViewModel, VisitSearchModel>> logger,
|
||||
IStorage<Visit> storage,
|
||||
IStorage<Patient> patientStorage,
|
||||
IStorage<Doctor> doctorStorage,
|
||||
IStorage<Diagnose> diagnoseStorage) : base(logger, storage)
|
||||
IStorage<Diagnose> diagnoseStorage,
|
||||
IStorage<Specialization> specializationStorage) : base(logger, storage)
|
||||
{
|
||||
_patientStorage = patientStorage;
|
||||
_doctorStorage = doctorStorage;
|
||||
_diagnoseStorage = diagnoseStorage;
|
||||
_specializationStorage = specializationStorage;
|
||||
}
|
||||
|
||||
protected override bool CheckModelBySearchModel(Visit model, VisitSearchModel searchModel)
|
||||
@ -53,6 +56,17 @@ namespace MedicalBusinessLogic.BusinessLogics
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
var patient = _patientStorage.Get(model.PatientId);
|
||||
var doctor = _doctorStorage.Get(model.DoctorId);
|
||||
var specialization = _specializationStorage.Get(doctor.SpecializationId);
|
||||
if (patient.GetAge() < 18 && !specialization.IsPediatric)
|
||||
{
|
||||
throw new InvalidOperationException("Нельзя записать ребенка к взрослому врачу");
|
||||
}
|
||||
if (patient.GetAge() >= 18 && !specialization.IsTherapeutic)
|
||||
{
|
||||
throw new InvalidOperationException("Нельзя записать взрослого к детскому врачу");
|
||||
}
|
||||
if (!modelUpdate && ReadList(new VisitSearchModel {
|
||||
DoctorId = model.DoctorId,
|
||||
Date = model.Date,
|
||||
|
@ -10,14 +10,16 @@ namespace MedicalDatabaseContracts
|
||||
where S : AbstractSearchModel
|
||||
{
|
||||
List<V> ReadList(S? searchModel = null);
|
||||
List<V> ReadList(out long elapsedMilliseconds, S? searchModel = null);
|
||||
List<V> ReadList(out double elapsedMilliseconds, S? searchModel = null);
|
||||
V? ReadElement(int id);
|
||||
V? ReadElement(int id, out long elapsedMilliseconds);
|
||||
V? ReadElement(int id, out double elapsedMilliseconds);
|
||||
bool Create(M model);
|
||||
bool Create(M model, out long elapsedMilliseconds);
|
||||
bool Create(M model, out double elapsedMilliseconds);
|
||||
bool Update(M model);
|
||||
bool Update(M model, out long elapsedMilliseconds);
|
||||
bool Update(M model, out double elapsedMilliseconds);
|
||||
bool Delete(int id);
|
||||
bool Delete(int id, out long elapsedMilliseconds);
|
||||
bool Delete(int id, out double elapsedMilliseconds);
|
||||
bool DeleteAll();
|
||||
bool DeleteAll(out double elapsedMilliseconds);
|
||||
}
|
||||
}
|
||||
|
@ -4,15 +4,17 @@ namespace MedicalDatabaseContracts
|
||||
{
|
||||
public interface IStorage<T> where T : AbstractModel
|
||||
{
|
||||
T? Get(int id, out long elapsedMilliseconds);
|
||||
T? Get(int id, out double elapsedMilliseconds);
|
||||
T? Get(int id);
|
||||
List<T> GetAll(out long elapsedMilliseconds);
|
||||
List<T> GetAll(out double elapsedMilliseconds);
|
||||
List<T> GetAll();
|
||||
void Insert(T item, out long elapsedMilliseconds);
|
||||
void Insert(T item, out double elapsedMilliseconds);
|
||||
void Insert(T item);
|
||||
void Update(T item, out long elapsedMilliseconds);
|
||||
void Update(T item, out double elapsedMilliseconds);
|
||||
void Update(T item);
|
||||
void Delete(int id, out long elapsedMilliseconds);
|
||||
void Delete(int id, out double elapsedMilliseconds);
|
||||
void Delete(int id);
|
||||
void DeleteAll(out double elapsedMilliseconds);
|
||||
void DeleteAll();
|
||||
}
|
||||
}
|
||||
|
@ -8,5 +8,12 @@ namespace MedicalDatabaseContracts.Models
|
||||
public DateTime Birthday { get; set; }
|
||||
public int Weight { get; set; }
|
||||
public int Height { get; set; }
|
||||
public int GetAge()
|
||||
{
|
||||
var today = DateTime.Today;
|
||||
int age = today.Year - Birthday.Year;
|
||||
if (Birthday.Date > today.AddYears(-age)) age--;
|
||||
return age;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,8 @@ namespace MedicalDatabaseContracts.ViewModels
|
||||
public int Weight { get; set; }
|
||||
[DisplayName("Рост, см")]
|
||||
public int Height { get; set; }
|
||||
[DisplayName("Возраст")]
|
||||
public int Age { get; set; }
|
||||
public override string ToString()
|
||||
{
|
||||
return GetFIO() + ", " + Birthday.ToShortDateString();
|
||||
|
@ -3,6 +3,7 @@ using MedicalDatabaseContracts.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Npgsql;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
|
||||
namespace MedicalPostgresqlDatabase
|
||||
{
|
||||
@ -13,6 +14,9 @@ namespace MedicalPostgresqlDatabase
|
||||
protected readonly string PRIMARY_KEY_COLUMN_NAME;
|
||||
protected readonly string PRIMARY_KEY_SEQUENCE_NAME;
|
||||
|
||||
protected readonly string TIME_LOG_FILENAME_SUFFIX;
|
||||
protected readonly string TIME_LOG_FOLDERNAME;
|
||||
|
||||
protected AbstractPostgresqlStorage(
|
||||
ILogger<IStorage<T>> logger,
|
||||
string tableName,
|
||||
@ -23,17 +27,52 @@ namespace MedicalPostgresqlDatabase
|
||||
TABLE_NAME = tableName;
|
||||
PRIMARY_KEY_COLUMN_NAME = primaryKeyColumnName;
|
||||
PRIMARY_KEY_SEQUENCE_NAME = primary_key_sequence_name;
|
||||
|
||||
TIME_LOG_FILENAME_SUFFIX = "sqltimelog.csv";
|
||||
TIME_LOG_FOLDERNAME = "timelogs";
|
||||
}
|
||||
|
||||
protected abstract T CreateEntityFromReader(NpgsqlDataReader reader);
|
||||
|
||||
protected abstract Dictionary<string, object> GetEntityAttributesDictionary(T item);
|
||||
|
||||
public void DeleteAll(out double elapsedMilliseconds)
|
||||
{
|
||||
using var connection = GetConnection();
|
||||
connection.Open();
|
||||
using var cmd = new NpgsqlCommand($"DELETE FROM {TABLE_NAME}", connection);
|
||||
_logger.LogDebug(cmd.CommandText);
|
||||
Stopwatch stopwatch = new();
|
||||
stopwatch.Start();
|
||||
cmd.ExecuteNonQuery();
|
||||
stopwatch.Stop();
|
||||
elapsedMilliseconds = stopwatch.Elapsed.TotalMilliseconds;
|
||||
WriteTimeToFile(stopwatch, "DELETEALL");
|
||||
}
|
||||
public void DeleteAll()
|
||||
{
|
||||
DeleteAll(out _);
|
||||
}
|
||||
|
||||
protected void WriteTimeToFile(Stopwatch stopwatch, string filenamePrefix)
|
||||
{
|
||||
if (!Directory.Exists(TIME_LOG_FOLDERNAME))
|
||||
{
|
||||
Directory.CreateDirectory(TIME_LOG_FOLDERNAME);
|
||||
}
|
||||
string filename = GetType().Name + "_" + filenamePrefix + "_" + TIME_LOG_FILENAME_SUFFIX;
|
||||
string path = Path.Combine(TIME_LOG_FOLDERNAME, filename);
|
||||
using (StreamWriter sw = new StreamWriter(path, true))
|
||||
{
|
||||
sw.WriteLine(stopwatch.Elapsed.TotalMilliseconds);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Delete(int id)
|
||||
{
|
||||
Delete(id, out _);
|
||||
}
|
||||
public virtual void Delete(int id, out long elapsedMilliseconds)
|
||||
public virtual void Delete(int id, out double elapsedMilliseconds)
|
||||
{
|
||||
using var connection = GetConnection();
|
||||
connection.Open();
|
||||
@ -44,13 +83,14 @@ namespace MedicalPostgresqlDatabase
|
||||
stopwatch.Start();
|
||||
cmd.ExecuteNonQuery();
|
||||
stopwatch.Stop();
|
||||
elapsedMilliseconds = stopwatch.ElapsedMilliseconds;
|
||||
elapsedMilliseconds = stopwatch.Elapsed.TotalMilliseconds;
|
||||
WriteTimeToFile(stopwatch, "DELETE");
|
||||
}
|
||||
public virtual T? Get(int id)
|
||||
{
|
||||
return Get(id, out _);
|
||||
}
|
||||
public virtual T? Get(int id, out long elapsedMilliseconds)
|
||||
public virtual T? Get(int id, out double elapsedMilliseconds)
|
||||
{
|
||||
using var connection = GetConnection();
|
||||
connection.Open();
|
||||
@ -61,7 +101,8 @@ namespace MedicalPostgresqlDatabase
|
||||
stopwatch.Start();
|
||||
using var reader = cmd.ExecuteReader();
|
||||
stopwatch.Stop();
|
||||
elapsedMilliseconds = stopwatch.ElapsedMilliseconds;
|
||||
elapsedMilliseconds = stopwatch.Elapsed.TotalMilliseconds;
|
||||
WriteTimeToFile(stopwatch, "GET");
|
||||
if (reader.Read())
|
||||
{
|
||||
return CreateEntityFromReader(reader);
|
||||
@ -72,7 +113,7 @@ namespace MedicalPostgresqlDatabase
|
||||
{
|
||||
return GetAll(out _);
|
||||
}
|
||||
public virtual List<T> GetAll(out long elapsedMilliseconds)
|
||||
public virtual List<T> GetAll(out double elapsedMilliseconds)
|
||||
{
|
||||
var items = new List<T>();
|
||||
using var connection = GetConnection();
|
||||
@ -83,7 +124,8 @@ namespace MedicalPostgresqlDatabase
|
||||
stopwatch.Start();
|
||||
using var reader = cmd.ExecuteReader();
|
||||
stopwatch.Stop();
|
||||
elapsedMilliseconds = stopwatch.ElapsedMilliseconds;
|
||||
elapsedMilliseconds = stopwatch.Elapsed.TotalMilliseconds;
|
||||
WriteTimeToFile(stopwatch, "GETALL");
|
||||
while (reader.Read())
|
||||
{
|
||||
items.Add(CreateEntityFromReader(reader));
|
||||
@ -94,7 +136,7 @@ namespace MedicalPostgresqlDatabase
|
||||
{
|
||||
Insert(item, out _);
|
||||
}
|
||||
public virtual void Insert(T item, out long elapsedMilliseconds)
|
||||
public virtual void Insert(T item, out double elapsedMilliseconds)
|
||||
{
|
||||
using var connection = GetConnection();
|
||||
connection.Open();
|
||||
@ -133,13 +175,14 @@ namespace MedicalPostgresqlDatabase
|
||||
stopwatch.Start();
|
||||
cmd.ExecuteNonQuery();
|
||||
stopwatch.Stop();
|
||||
elapsedMilliseconds = stopwatch.ElapsedMilliseconds;
|
||||
elapsedMilliseconds = stopwatch.Elapsed.TotalMilliseconds;
|
||||
WriteTimeToFile(stopwatch, "INSERT");
|
||||
}
|
||||
public virtual void Update(T item)
|
||||
{
|
||||
Update(item, out _);
|
||||
}
|
||||
public virtual void Update(T item, out long elapsedMilliseconds)
|
||||
public virtual void Update(T item, out double elapsedMilliseconds)
|
||||
{
|
||||
using var connection = GetConnection();
|
||||
connection.Open();
|
||||
@ -176,7 +219,8 @@ namespace MedicalPostgresqlDatabase
|
||||
stopwatch.Start();
|
||||
cmd.ExecuteNonQuery();
|
||||
stopwatch.Stop();
|
||||
elapsedMilliseconds = stopwatch.ElapsedMilliseconds;
|
||||
elapsedMilliseconds = stopwatch.Elapsed.TotalMilliseconds;
|
||||
WriteTimeToFile(stopwatch, "UPDATE");
|
||||
}
|
||||
|
||||
protected NpgsqlConnection GetConnection()
|
||||
|
@ -16,7 +16,7 @@ namespace MedicalPostgresqlDatabase.Storages
|
||||
Id = Convert.ToInt32(reader.GetValue(PRIMARY_KEY_COLUMN_NAME)),
|
||||
Name = Convert.ToString(reader.GetValue("name")),
|
||||
Surname = Convert.ToString(reader.GetValue("surname")),
|
||||
Patronymic = Convert.ToString(reader.GetValue("patronymic")),
|
||||
Patronymic = reader.GetValue("patronymic") is DBNull ? null : Convert.ToString(reader.GetValue("patronymic")),
|
||||
PhoneNumber = Convert.ToString(reader.GetValue("phone_number")),
|
||||
SpecializationId = Convert.ToInt32(reader.GetValue("specialization_id"))
|
||||
};
|
||||
@ -29,7 +29,7 @@ namespace MedicalPostgresqlDatabase.Storages
|
||||
{ PRIMARY_KEY_COLUMN_NAME, item.Id },
|
||||
{ "name", item.Name },
|
||||
{ "surname", item.Surname },
|
||||
{ "patronymic", item.Patronymic ?? string.Empty },
|
||||
{ "patronymic", item.Patronymic },
|
||||
{ "phone_number", item.PhoneNumber },
|
||||
{ "specialization_id", item.SpecializationId }
|
||||
};
|
||||
|
@ -16,7 +16,7 @@ namespace MedicalPostgresqlDatabase.Storages
|
||||
Id = Convert.ToInt32(reader.GetValue(PRIMARY_KEY_COLUMN_NAME)),
|
||||
Name = Convert.ToString(reader.GetValue("name")),
|
||||
Surname = Convert.ToString(reader.GetValue("surname")),
|
||||
Patronymic = Convert.ToString(reader.GetValue("patronymic")),
|
||||
Patronymic = reader.GetValue("patronymic") is DBNull ? null : Convert.ToString(reader.GetValue("patronymic")),
|
||||
PhoneNumber = Convert.ToString(reader.GetValue("phone_number")),
|
||||
Gender = Convert.ToString(reader.GetValue("gender")),
|
||||
Birthday = Convert.ToDateTime(reader.GetValue("birthday")),
|
||||
@ -32,7 +32,7 @@ namespace MedicalPostgresqlDatabase.Storages
|
||||
{ PRIMARY_KEY_COLUMN_NAME, item.Id },
|
||||
{ "name", item.Name },
|
||||
{ "surname", item.Surname },
|
||||
{ "patronymic", item.Patronymic ?? string.Empty },
|
||||
{ "patronymic", item.Patronymic },
|
||||
{ "phone_number", item.PhoneNumber },
|
||||
{ "gender", item.Gender },
|
||||
{ "birthday", item.Birthday },
|
||||
|
@ -93,7 +93,7 @@ namespace MedicalView
|
||||
SetStatusStripText("Загрузка списка...");
|
||||
try
|
||||
{
|
||||
long elapsed;
|
||||
double elapsed;
|
||||
var items = _logic.ReadList(out elapsed);
|
||||
|
||||
dataGridView.DataSource = items;
|
||||
|
130
Medical/MedicalView/FormMain.Designer.cs
generated
130
Medical/MedicalView/FormMain.Designer.cs
generated
@ -33,14 +33,16 @@
|
||||
специализацииToolStripMenuItem = new ToolStripMenuItem();
|
||||
диагнозыToolStripMenuItem = new ToolStripMenuItem();
|
||||
врачиToolStripMenuItem = new ToolStripMenuItem();
|
||||
пациентыToolStripMenuItem1 = new ToolStripMenuItem();
|
||||
PatientsToolStripMenuItem = new ToolStripMenuItem();
|
||||
RefreshToolStripMenuItem = new ToolStripMenuItem();
|
||||
dataGridView = new DataGridView();
|
||||
panel = new Panel();
|
||||
buttonEdit = new Button();
|
||||
buttonClearSearch = new Button();
|
||||
buttonDeleteAllData = new Button();
|
||||
buttonGenerateRandomData = new Button();
|
||||
buttonDelete = new Button();
|
||||
buttonAdd = new Button();
|
||||
dateTimePicker1 = new DateTimePicker();
|
||||
comboBoxDoctor = new ComboBox();
|
||||
comboBoxPatient = new ComboBox();
|
||||
statusStrip = new StatusStrip();
|
||||
toolStripStatusLabel = new ToolStripStatusLabel();
|
||||
menuStrip.SuspendLayout();
|
||||
@ -52,17 +54,17 @@
|
||||
// menuStrip
|
||||
//
|
||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, пациентыToolStripMenuItem1 });
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, RefreshToolStripMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Padding = new Padding(7, 3, 0, 3);
|
||||
menuStrip.Size = new Size(863, 30);
|
||||
menuStrip.Size = new Size(1000, 30);
|
||||
menuStrip.TabIndex = 0;
|
||||
menuStrip.Text = "menuStrip1";
|
||||
//
|
||||
// справочникиToolStripMenuItem
|
||||
//
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { специализацииToolStripMenuItem, диагнозыToolStripMenuItem, врачиToolStripMenuItem });
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { специализацииToolStripMenuItem, диагнозыToolStripMenuItem, врачиToolStripMenuItem, PatientsToolStripMenuItem });
|
||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
справочникиToolStripMenuItem.Size = new Size(117, 24);
|
||||
справочникиToolStripMenuItem.Text = "Справочники";
|
||||
@ -88,12 +90,19 @@
|
||||
врачиToolStripMenuItem.Text = "Врачи";
|
||||
врачиToolStripMenuItem.Click += DoctorsToolStripMenuItem_Click;
|
||||
//
|
||||
// пациентыToolStripMenuItem1
|
||||
// PatientsToolStripMenuItem
|
||||
//
|
||||
пациентыToolStripMenuItem1.Name = "пациентыToolStripMenuItem1";
|
||||
пациентыToolStripMenuItem1.Size = new Size(94, 24);
|
||||
пациентыToolStripMenuItem1.Text = "Пациенты";
|
||||
пациентыToolStripMenuItem1.Click += PatientsToolStripMenuItem1_Click;
|
||||
PatientsToolStripMenuItem.Name = "PatientsToolStripMenuItem";
|
||||
PatientsToolStripMenuItem.Size = new Size(203, 26);
|
||||
PatientsToolStripMenuItem.Text = "Пациенты";
|
||||
PatientsToolStripMenuItem.Click += PatientsToolStripMenuItem_Click;
|
||||
//
|
||||
// RefreshToolStripMenuItem
|
||||
//
|
||||
RefreshToolStripMenuItem.Name = "RefreshToolStripMenuItem";
|
||||
RefreshToolStripMenuItem.Size = new Size(92, 24);
|
||||
RefreshToolStripMenuItem.Text = "Обновить";
|
||||
RefreshToolStripMenuItem.Click += RefreshToolStripMenuItem_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
@ -109,39 +118,58 @@
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 25;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(863, 331);
|
||||
dataGridView.Size = new Size(1000, 331);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonEdit);
|
||||
panel.Controls.Add(buttonClearSearch);
|
||||
panel.Controls.Add(buttonDeleteAllData);
|
||||
panel.Controls.Add(buttonGenerateRandomData);
|
||||
panel.Controls.Add(buttonDelete);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Controls.Add(dateTimePicker1);
|
||||
panel.Controls.Add(comboBoxDoctor);
|
||||
panel.Controls.Add(comboBoxPatient);
|
||||
panel.Dock = DockStyle.Top;
|
||||
panel.Location = new Point(0, 30);
|
||||
panel.Margin = new Padding(3, 4, 3, 4);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(863, 39);
|
||||
panel.Size = new Size(1000, 39);
|
||||
panel.TabIndex = 2;
|
||||
//
|
||||
// buttonEdit
|
||||
// buttonClearSearch
|
||||
//
|
||||
buttonEdit.Anchor = AnchorStyles.Left;
|
||||
buttonEdit.Location = new Point(478, 3);
|
||||
buttonEdit.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonEdit.Name = "buttonEdit";
|
||||
buttonEdit.Size = new Size(86, 31);
|
||||
buttonEdit.TabIndex = 4;
|
||||
buttonEdit.Text = "Изменить";
|
||||
buttonEdit.UseVisualStyleBackColor = true;
|
||||
buttonEdit.Click += buttonEdit_Click;
|
||||
buttonClearSearch.Location = new Point(360, 4);
|
||||
buttonClearSearch.Name = "buttonClearSearch";
|
||||
buttonClearSearch.Size = new Size(94, 29);
|
||||
buttonClearSearch.TabIndex = 7;
|
||||
buttonClearSearch.Text = "Сбросить";
|
||||
buttonClearSearch.UseVisualStyleBackColor = true;
|
||||
buttonClearSearch.Click += buttonClearSearch_Click;
|
||||
//
|
||||
// buttonDeleteAllData
|
||||
//
|
||||
buttonDeleteAllData.Location = new Point(852, 2);
|
||||
buttonDeleteAllData.Name = "buttonDeleteAllData";
|
||||
buttonDeleteAllData.Size = new Size(143, 31);
|
||||
buttonDeleteAllData.TabIndex = 6;
|
||||
buttonDeleteAllData.Text = "Очистить базу";
|
||||
buttonDeleteAllData.UseVisualStyleBackColor = true;
|
||||
buttonDeleteAllData.Click += buttonDeleteAllData_Click;
|
||||
//
|
||||
// buttonGenerateRandomData
|
||||
//
|
||||
buttonGenerateRandomData.Location = new Point(711, 2);
|
||||
buttonGenerateRandomData.Name = "buttonGenerateRandomData";
|
||||
buttonGenerateRandomData.Size = new Size(135, 31);
|
||||
buttonGenerateRandomData.TabIndex = 5;
|
||||
buttonGenerateRandomData.Text = "Сгенерировать";
|
||||
buttonGenerateRandomData.UseVisualStyleBackColor = true;
|
||||
buttonGenerateRandomData.Click += buttonGenerateRandomData_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.Anchor = AnchorStyles.Left;
|
||||
buttonDelete.Location = new Point(570, 3);
|
||||
buttonDelete.Location = new Point(601, 2);
|
||||
buttonDelete.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(86, 31);
|
||||
@ -153,7 +181,7 @@
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Anchor = AnchorStyles.Left;
|
||||
buttonAdd.Location = new Point(385, 3);
|
||||
buttonAdd.Location = new Point(509, 2);
|
||||
buttonAdd.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(86, 31);
|
||||
@ -162,25 +190,18 @@
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// dateTimePicker1
|
||||
// comboBoxPatient
|
||||
//
|
||||
dateTimePicker1.Anchor = AnchorStyles.Left;
|
||||
dateTimePicker1.Location = new Point(207, 4);
|
||||
dateTimePicker1.Margin = new Padding(3, 4, 3, 4);
|
||||
dateTimePicker1.Name = "dateTimePicker1";
|
||||
dateTimePicker1.Size = new Size(158, 27);
|
||||
dateTimePicker1.TabIndex = 1;
|
||||
//
|
||||
// comboBoxDoctor
|
||||
//
|
||||
comboBoxDoctor.Anchor = AnchorStyles.Left;
|
||||
comboBoxDoctor.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxDoctor.FormattingEnabled = true;
|
||||
comboBoxDoctor.Location = new Point(3, 4);
|
||||
comboBoxDoctor.Margin = new Padding(3, 4, 3, 4);
|
||||
comboBoxDoctor.Name = "comboBoxDoctor";
|
||||
comboBoxDoctor.Size = new Size(196, 28);
|
||||
comboBoxDoctor.TabIndex = 0;
|
||||
comboBoxPatient.Anchor = AnchorStyles.Left;
|
||||
comboBoxPatient.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
|
||||
comboBoxPatient.AutoCompleteSource = AutoCompleteSource.ListItems;
|
||||
comboBoxPatient.FormattingEnabled = true;
|
||||
comboBoxPatient.Location = new Point(3, 5);
|
||||
comboBoxPatient.Margin = new Padding(3, 4, 3, 4);
|
||||
comboBoxPatient.Name = "comboBoxPatient";
|
||||
comboBoxPatient.Size = new Size(351, 28);
|
||||
comboBoxPatient.TabIndex = 0;
|
||||
comboBoxPatient.SelectedIndexChanged += comboBoxPatient_SelectedIndexChanged;
|
||||
//
|
||||
// statusStrip
|
||||
//
|
||||
@ -188,7 +209,7 @@
|
||||
statusStrip.Items.AddRange(new ToolStripItem[] { toolStripStatusLabel });
|
||||
statusStrip.Location = new Point(0, 379);
|
||||
statusStrip.Name = "statusStrip";
|
||||
statusStrip.Size = new Size(863, 22);
|
||||
statusStrip.Size = new Size(1000, 22);
|
||||
statusStrip.TabIndex = 3;
|
||||
statusStrip.Text = "statusStrip1";
|
||||
//
|
||||
@ -201,14 +222,14 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(863, 401);
|
||||
ClientSize = new Size(1000, 401);
|
||||
Controls.Add(statusStrip);
|
||||
Controls.Add(panel);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(menuStrip);
|
||||
MainMenuStrip = menuStrip;
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
MinimumSize = new Size(683, 438);
|
||||
MinimumSize = new Size(683, 448);
|
||||
Name = "FormMain";
|
||||
Text = "Записи посещений";
|
||||
Load += FormMain_Load;
|
||||
@ -231,13 +252,16 @@
|
||||
private DataGridView dataGridView;
|
||||
private ToolStripMenuItem специализацииToolStripMenuItem;
|
||||
private Panel panel;
|
||||
private DateTimePicker dateTimePicker1;
|
||||
private ComboBox comboBoxDoctor;
|
||||
private ComboBox comboBoxPatient;
|
||||
private ToolStripMenuItem пациентыToolStripMenuItem1;
|
||||
private Button buttonDelete;
|
||||
private Button buttonAdd;
|
||||
private Button buttonEdit;
|
||||
private StatusStrip statusStrip;
|
||||
private ToolStripStatusLabel toolStripStatusLabel;
|
||||
private Button buttonGenerateRandomData;
|
||||
private Button buttonDeleteAllData;
|
||||
private ToolStripMenuItem RefreshToolStripMenuItem;
|
||||
private ToolStripMenuItem PatientsToolStripMenuItem;
|
||||
private Button buttonClearSearch;
|
||||
}
|
||||
}
|
@ -14,18 +14,21 @@ namespace MedicalView.Visits
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogic<Visit, VisitViewModel, VisitSearchModel> _visitLogic;
|
||||
public FormMain(ILogger<FormMain> logger, ILogic<Visit, VisitViewModel, VisitSearchModel> visitLogic)
|
||||
private readonly ILogic<Patient, PatientViewModel, PatientSearchModel> _patientLogic;
|
||||
public FormMain(ILogger<FormMain> logger, ILogic<Visit, VisitViewModel, VisitSearchModel> visitLogic, ILogic<Patient, PatientViewModel, PatientSearchModel> patientLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
dataGridView.CellDoubleClick += buttonEdit_Click;
|
||||
dataGridView.CellContentDoubleClick += buttonEdit_Click;
|
||||
_logger = logger;
|
||||
_visitLogic = visitLogic;
|
||||
_patientLogic = patientLogic;
|
||||
}
|
||||
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
LoadPatients();
|
||||
//LoadData();
|
||||
}
|
||||
|
||||
private void DiagnosesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@ -55,22 +58,21 @@ namespace MedicalView.Visits
|
||||
}
|
||||
}
|
||||
|
||||
private void PatientsToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormPatients));
|
||||
if (service is FormPatients form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void LoadData()
|
||||
{
|
||||
SetStatusStripText("Загрузка списка...");
|
||||
try
|
||||
{
|
||||
long elapsed;
|
||||
var items = _visitLogic.ReadList(out elapsed);
|
||||
double elapsed;
|
||||
|
||||
VisitSearchModel? searchModel = null;
|
||||
|
||||
if (comboBoxPatient.SelectedIndex != -1)
|
||||
{
|
||||
searchModel = new VisitSearchModel { PatientId = (comboBoxPatient.SelectedItem as PatientViewModel).Id };
|
||||
}
|
||||
|
||||
var items = _visitLogic.ReadList(out elapsed, searchModel);
|
||||
|
||||
dataGridView.DataSource = items;
|
||||
foreach (DataGridViewTextBoxColumn column in dataGridView.Columns)
|
||||
@ -103,6 +105,10 @@ namespace MedicalView.Visits
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormVisit));
|
||||
if (service is FormVisit form)
|
||||
{
|
||||
if (comboBoxPatient.SelectedIndex != -1)
|
||||
{
|
||||
form.PatientId = (comboBoxPatient.SelectedItem as PatientViewModel).Id;
|
||||
}
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
@ -150,5 +156,76 @@ namespace MedicalView.Visits
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonGenerateRandomData_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("Сшенерировать случайные данные?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormVisit));
|
||||
if (service is FormVisit form)
|
||||
{
|
||||
form.GenerateRandomDatabaseData();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDeleteAllData_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("Удалить ВСЕ данные?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormVisit));
|
||||
if (service is FormVisit form)
|
||||
{
|
||||
form.DeleteAllDatabaseData();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadPatients();
|
||||
//LoadData();
|
||||
}
|
||||
|
||||
private void PatientsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormPatients));
|
||||
if (service is FormPatients form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
LoadPatients();
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBoxPatient_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadPatients()
|
||||
{
|
||||
var patients = _patientLogic.ReadList();
|
||||
int? selectedPatientId = null;
|
||||
if (comboBoxPatient.SelectedItem != null)
|
||||
{
|
||||
selectedPatientId = (comboBoxPatient.SelectedItem as PatientViewModel).Id;
|
||||
}
|
||||
comboBoxPatient.DataSource = patients;
|
||||
if (selectedPatientId != null)
|
||||
{
|
||||
comboBoxPatient.SelectedIndex = patients.FindIndex(x => x.Id == selectedPatientId);
|
||||
}
|
||||
else
|
||||
{
|
||||
comboBoxPatient.SelectedIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonClearSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
comboBoxPatient.SelectedIndex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,15 @@ namespace MedicalView.Visits
|
||||
private readonly ILogic<Diagnose, DiagnoseViewModel, DiagnoseSearchModel> _diagnoseLogic;
|
||||
private readonly ILogic<Doctor, DoctorViewModel, DoctorSearchModel> _doctorLogic;
|
||||
private readonly ILogic<Patient, PatientViewModel, PatientSearchModel> _patientLogic;
|
||||
private readonly ILogic<Specialization, SpecializationViewModel, SpecializationSearchModel> _specLogic;
|
||||
public int? PatientId { get; set; }
|
||||
public FormVisit(
|
||||
ILogger<FormVisit> logger,
|
||||
ILogic<Visit, VisitViewModel, VisitSearchModel> visitLogic,
|
||||
ILogic<Diagnose, DiagnoseViewModel, DiagnoseSearchModel> diagnoseLogic,
|
||||
ILogic<Doctor, DoctorViewModel, DoctorSearchModel> doctorLogic,
|
||||
ILogic<Patient, PatientViewModel, PatientSearchModel> patientLogic)
|
||||
ILogic<Patient, PatientViewModel, PatientSearchModel> patientLogic,
|
||||
ILogic<Specialization, SpecializationViewModel, SpecializationSearchModel> specLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
@ -27,6 +30,7 @@ namespace MedicalView.Visits
|
||||
_diagnoseLogic = diagnoseLogic;
|
||||
_doctorLogic = doctorLogic;
|
||||
_patientLogic = patientLogic;
|
||||
_specLogic = specLogic;
|
||||
}
|
||||
|
||||
private void ApplyToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@ -41,6 +45,19 @@ namespace MedicalView.Visits
|
||||
MessageBox.Show("Выберите врача", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
var patient = _patientLogic.ReadElement((comboBoxPatient.SelectedItem as PatientViewModel).Id);
|
||||
var doctor = _doctorLogic.ReadElement((comboBoxDoctor.SelectedItem as DoctorViewModel).Id);
|
||||
var specialization = _specLogic.ReadElement(doctor.SpecializationId);
|
||||
if (patient.Age < 18 && !specialization.IsPediatric)
|
||||
{
|
||||
MessageBox.Show("Нельзя записать ребенка к взрослому врачу", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (patient.Age >= 18 && !specialization.IsTherapeutic)
|
||||
{
|
||||
MessageBox.Show("Нельзя записать взрослого к детскому врачу", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение модели приема");
|
||||
try
|
||||
{
|
||||
@ -48,8 +65,8 @@ namespace MedicalView.Visits
|
||||
{
|
||||
Id = ModelId ?? 0,
|
||||
Comment = textBoxComment.Text,
|
||||
PatientId = (comboBoxPatient.SelectedItem as PatientViewModel).Id,
|
||||
DoctorId = (comboBoxDoctor.SelectedItem as DoctorViewModel).Id,
|
||||
PatientId = patient.Id,
|
||||
DoctorId = doctor.Id,
|
||||
DiagnoseId = comboBoxDiagnose.SelectedItem != null ? (comboBoxDiagnose.SelectedItem as DiagnoseViewModel).Id : null,
|
||||
Date = DateOnly.FromDateTime(datePicker.Value),
|
||||
Time = TimeOnly.FromDateTime(timePicker.Value)
|
||||
@ -84,6 +101,11 @@ namespace MedicalView.Visits
|
||||
comboBoxPatient.DataSource = patients;
|
||||
comboBoxPatient.SelectedIndex = -1;
|
||||
|
||||
if (PatientId.HasValue)
|
||||
{
|
||||
comboBoxPatient.SelectedIndex = patients.FindIndex(x => x.Id == PatientId);
|
||||
}
|
||||
|
||||
comboBoxDoctor.DataSource = doctors;
|
||||
comboBoxDoctor.SelectedIndex = -1;
|
||||
|
||||
@ -100,7 +122,7 @@ namespace MedicalView.Visits
|
||||
{
|
||||
textBoxComment.Text = view.Comment;
|
||||
datePicker.Value = view.Date.ToDateTime(view.Time);
|
||||
timePicker.Value = view.Date.ToDateTime(view.Time);
|
||||
timePicker.Value = view.Date.ToDateTime(view.Time);
|
||||
if (view.DiagnoseId != null)
|
||||
{
|
||||
comboBoxDiagnose.SelectedIndex = diagnoses.FindIndex(x => x.Id == view.DiagnoseId);
|
||||
@ -116,5 +138,129 @@ namespace MedicalView.Visits
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteAllDatabaseData()
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Удаление всех данных БД");
|
||||
_visitLogic.DeleteAll();
|
||||
_diagnoseLogic.DeleteAll();
|
||||
_doctorLogic.DeleteAll();
|
||||
_specLogic.DeleteAll();
|
||||
_patientLogic.DeleteAll();
|
||||
MessageBox.Show("Все данные успешно удалены", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения модели приема");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
public void GenerateRandomDatabaseData()
|
||||
{
|
||||
int specsCount = 100;
|
||||
int diagnosesCount = 100;
|
||||
int doctorsCount = 100;
|
||||
int patientsCount = 100;
|
||||
int visitsCount = 100;
|
||||
|
||||
double avgInsertSpecsTimer = 0;
|
||||
double avgInsertDiagnosesTimer = 0;
|
||||
double avgInsertDoctorsTimer = 0;
|
||||
double avgInsertPatientsTimer = 0;
|
||||
double avgInsertVisitsTimer = 0;
|
||||
double temp = 0;
|
||||
|
||||
Random rnd = new();
|
||||
|
||||
for (int i = 0; i < specsCount; i++)
|
||||
{
|
||||
_specLogic.Create(new Specialization
|
||||
{
|
||||
Name = i.ToString(),
|
||||
IsPediatric = Convert.ToBoolean(rnd.Next(2)),
|
||||
IsTherapeutic = Convert.ToBoolean(rnd.Next(2))
|
||||
}, out temp);
|
||||
avgInsertSpecsTimer += temp;
|
||||
}
|
||||
avgInsertSpecsTimer /= specsCount;
|
||||
|
||||
var specs = _specLogic.ReadList();
|
||||
|
||||
for (int i = 0; i < diagnosesCount; i++)
|
||||
{
|
||||
_diagnoseLogic.Create(new Diagnose
|
||||
{
|
||||
Name = i.ToString()
|
||||
}, out temp);
|
||||
avgInsertDiagnosesTimer += temp;
|
||||
}
|
||||
avgInsertDiagnosesTimer /= diagnosesCount;
|
||||
|
||||
var diagnoses = _diagnoseLogic.ReadList();
|
||||
|
||||
for (int i = 0; i < doctorsCount; i++)
|
||||
{
|
||||
_doctorLogic.Create(new Doctor {
|
||||
Name = i.ToString(),
|
||||
Surname = i.ToString(),
|
||||
Patronymic = i.ToString(),
|
||||
PhoneNumber = i.ToString(),
|
||||
SpecializationId = specs[rnd.Next(specs.Count)].Id
|
||||
}, out temp);
|
||||
avgInsertDoctorsTimer += temp;
|
||||
}
|
||||
|
||||
avgInsertDoctorsTimer /= doctorsCount;
|
||||
|
||||
var doctors = _doctorLogic.ReadList();
|
||||
|
||||
for (int i = 0; i < patientsCount; i++)
|
||||
{
|
||||
_patientLogic.Create(new Patient {
|
||||
Name = i.ToString(),
|
||||
Surname = i.ToString(),
|
||||
Patronymic = i.ToString(),
|
||||
PhoneNumber = i.ToString(),
|
||||
Birthday = new DateTime(2021, 12, 21),
|
||||
Gender = rnd.Next(2) == 0 ? "М" : "Ж",
|
||||
Height = rnd.Next(100, 250),
|
||||
Weight = rnd.Next(50, 100)
|
||||
}, out temp);
|
||||
avgInsertPatientsTimer += temp;
|
||||
}
|
||||
|
||||
avgInsertPatientsTimer /= patientsCount;
|
||||
var patients = _patientLogic.ReadList();
|
||||
|
||||
for (int i = 0; i < visitsCount; i++)
|
||||
{
|
||||
_visitLogic.Create(new Visit {
|
||||
Date = new DateOnly(2021, 12, 12),
|
||||
Time = new TimeOnly(12, 34),
|
||||
PatientId = patients[rnd.Next(patients.Count)].Id,
|
||||
DoctorId = doctors[rnd.Next(doctors.Count)].Id,
|
||||
DiagnoseId = diagnoses[rnd.Next(diagnoses.Count)].Id,
|
||||
Comment = "iusnefiuesnfes yf ey fiuewfwe fhweiufiuefiuweh fwehf uewyiufwe fuewoiuf oweyiuf weuif ioewfuyewuif yweufoiwefuywef"
|
||||
}, out temp);
|
||||
avgInsertVisitsTimer += temp;
|
||||
}
|
||||
|
||||
avgInsertVisitsTimer /= visitsCount;
|
||||
|
||||
MessageBox.Show(
|
||||
"Данные успешно сгенерированы!\n\n" +
|
||||
"Среднее время вставки:\n" +
|
||||
$"Специализации: {specsCount} шт : {avgInsertSpecsTimer} мск\n" +
|
||||
$"Диагнозы: {diagnosesCount} шт : {avgInsertDiagnosesTimer} мск\n" +
|
||||
$"Врачи: {doctorsCount} шт : {avgInsertDoctorsTimer} мск\n" +
|
||||
$"Пациенты: {patientsCount} шт : {avgInsertPatientsTimer} мск\n" +
|
||||
$"Приемы: {visitsCount} шт : {avgInsertVisitsTimer} мск\n",
|
||||
"Успех",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user