diff --git a/Medical/MedicalDatabaseContracts/Models/Visit.cs b/Medical/MedicalDatabaseContracts/Models/Visit.cs index d9ccab6..bb3120d 100644 --- a/Medical/MedicalDatabaseContracts/Models/Visit.cs +++ b/Medical/MedicalDatabaseContracts/Models/Visit.cs @@ -1,6 +1,4 @@ -using System.ComponentModel; - -namespace MedicalDatabaseContracts.Models +namespace MedicalDatabaseContracts.Models { public class Visit : AbstractModel { @@ -8,5 +6,7 @@ namespace MedicalDatabaseContracts.Models public int DoctorId { get; set; } public int DiagnoseId { get; set; } public string? Comment { get; set; } + public DateOnly Date { get; set; } + public TimeOnly Time { get; set; } } } diff --git a/Medical/MedicalDatabaseContracts/ViewModels/VisitViewModel.cs b/Medical/MedicalDatabaseContracts/ViewModels/VisitViewModel.cs index a1171b5..edbaeab 100644 --- a/Medical/MedicalDatabaseContracts/ViewModels/VisitViewModel.cs +++ b/Medical/MedicalDatabaseContracts/ViewModels/VisitViewModel.cs @@ -15,6 +15,10 @@ namespace MedicalDatabaseContracts.ViewModels public string DoctorFIO { get; set; } = string.Empty; [DisplayName("Диагноз")] public string DiagnoseName { get; set; } = string.Empty; + [DisplayName("Дата")] + public DateOnly Date { get; set; } + [DisplayName("Время")] + public TimeOnly Time { get; set; } } } diff --git a/Medical/MedicalPostgresqlDatabase/Storages/VisitStorage.cs b/Medical/MedicalPostgresqlDatabase/Storages/VisitStorage.cs index 5cb0c50..e4858bb 100644 --- a/Medical/MedicalPostgresqlDatabase/Storages/VisitStorage.cs +++ b/Medical/MedicalPostgresqlDatabase/Storages/VisitStorage.cs @@ -19,6 +19,8 @@ namespace MedicalPostgresqlDatabase.Storages DoctorId = Convert.ToInt32(reader.GetValue("doctor_id")), DiagnoseId = Convert.ToInt32(reader.GetValue("diagnose_id")), Comment = Convert.ToString(reader.GetValue("comment")), + Date = DateOnly.FromDateTime(Convert.ToDateTime(reader.GetValue("date"))), + Time = TimeOnly.FromTimeSpan((TimeSpan)reader.GetValue("time")), }; } @@ -30,7 +32,9 @@ namespace MedicalPostgresqlDatabase.Storages { "patient_id", item.PatientId.ToString() }, { "doctor_id", item.DoctorId.ToString() }, { "diagnose_id", item.DiagnoseId.ToString() }, - { "comment", item.Comment }, + { "comment", item.Comment ?? string.Empty }, + { "date", item.Date.ToString() }, + { "time", item.Time.ToString() }, }; return dict; }