Модель

This commit is contained in:
Bulat 2024-10-30 21:21:10 +03:00
parent 21b3786b45
commit ee58b404cc
7 changed files with 190 additions and 0 deletions

View File

@ -0,0 +1,30 @@
using RegistrationPatientsPolyclinic.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationPatientsPolyclinic.Entities;
public class Doctor
{
public int Id { get; private set; }
public string First_Name { get; private set; } = string.Empty;
public string Last_Name { get; private set; } = string.Empty;
public DoctorPost DoctorPost { get; private set; } // объявляется свойство DoctorPost, которое имеет тип DoctorPost
public static Doctor CreateEntity(int id, string first_Name, string last_Name, DoctorPost doctorPost)
{
return new Doctor
{
Id = id,
First_Name = first_Name,
Last_Name = last_Name,
DoctorPost = doctorPost
};
}
}

View File

@ -0,0 +1,33 @@
using RegistrationPatientsPolyclinic.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationPatientsPolyclinic.Entities;
public class DoctorPayments
{
public int Id { get; private set; }
public int IdDoctor { get; private set; }
public string Month { get; private set; } = string.Empty;
public int Count_Patient { get; private set; }
public int Payment { get; private set; }
public static DoctorPayments CreateElement(int id, int idDoctor, string month, int count_patient, int payment)
{
return new DoctorPayments
{
Id = id,
IdDoctor = idDoctor,
Month = month,
Count_Patient = count_patient,
Payment = payment
};
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationPatientsPolyclinic.Entities.Enums;
[Flags] // Flag - атрибут, его значения будут комбинироваться, например, если мы создадим объект от соотрудника,
// то его поле DoctorPost, то мы в него занесем только один из возможных вариантов(None, Junior, Senior, Head)
// а по атрибуту Flags позволяет хранить несколько записей
// ВАЖНО!!! Чтобы в перечеслении значения были степени двойки
public enum Diagnosis
{
None = 0,
Flu = 1,
Quinsy = 2,
Callous = 4,
Bronchitis = 8
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationPatientsPolyclinic.Entities.Enums;
public enum DoctorPost
{
None = 0,
Junior = 1,
Senior = 2,
Head = 3
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationPatientsPolyclinic.Entities.Enums;
public enum Status
{
None = 0,
Sick = 1,
Recovered = 2
}

View File

@ -0,0 +1,36 @@
using RegistrationPatientsPolyclinic.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationPatientsPolyclinic.Entities;
public class MedicalHistory
{
public int Id { get; private set; }
public int PatientId { get; private set; }
public int DoctorId { get; private set; }
public Diagnosis Diagnosis { get; private set; }
public DateTime VisitDate { get; private set; }
public Status Status { get; private set; }
public static MedicalHistory CreateEntity(int id, int patientId,int doctorId,Diagnosis diagnosis, int visitData, Status status)
{
return new MedicalHistory
{
Id = id,
PatientId = patientId,
DoctorId = doctorId,
Diagnosis = diagnosis,
VisitDate = DateTime.Now,
Status = status
};
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationPatientsPolyclinic.Entities;
public class Patient
{
public int Id { get; private set; }
public string Firts_Name { get; private set; } = string .Empty; // string.Empty - означает, что по умолчанию это свойство будет содержать пустую строку, а не null(то же самое "")
public string Last_Name { get; private set; } = string.Empty;
public int ContactNumber { get; private set; }
// ТУТ СДЕЛАЕМ СТАТИСТИЧЕСКИЙ МЕТОД
public static Patient CreatePatient(int id, string firts_Name, string last_Name, int contactNumber)
{
return new Patient
{
Id = id,
Firts_Name = firts_Name,
Last_Name = last_Name,
ContactNumber = contactNumber
};
}
}