ПИбд-23. Кобин В.О. Первая лабораторная работа #1

Open
vkobi wants to merge 2 commits from LabWork_1 into main
14 changed files with 292 additions and 0 deletions
Showing only changes of commit e3d900ec08 - Show all commits

View File

@ -0,0 +1,16 @@
namespace RegistrationOfPatients.Entities;
public class Doctor
{
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public static Doctor CreateEntity(int id, string name)
{
return new Doctor
{
Id = id,
Name = name
};
}
}

View File

@ -0,0 +1,21 @@
namespace RegistrationOfPatients.Entities;
public class DoctorPatient
{
public int Id { get; private set; }
public int PatientId { get; private set; }
public int DoctorId { get; private set; }
public DateTime DateStart { get; private set; }
public DateTime? DateStop { get; private set; }
public static DoctorPatient CreateElement(int id, int patientId, int doctorId, DateTime? dateStop = null)
{
return new DoctorPatient
{
Id = id,
PatientId = patientId,
DoctorId = doctorId,
DateStart = DateTime.Now,
DateStop = dateStop
};
}
}

View File

@ -0,0 +1,7 @@
namespace RegistrationOfPatients.Entities.Enums;
public enum HealthStatus
{
Ill = 0,
Healthy = 1
}

View File

@ -0,0 +1,17 @@
namespace RegistrationOfPatients.Entities;
public class Patient
{
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public string Phone { get; private set; } = string.Empty;
public static Patient CreateEntity(int id, string Name, string Phone)
{
return new Patient
{
Id = id,
Name = Name ?? string.Empty,
Phone = Phone ?? string.Empty
};
}
}

View File

@ -0,0 +1,23 @@
namespace RegistrationOfPatients.Entities;
public class Payment
{
public int Id { get; private set; }
public int Salary { get; private set; }
public int TotalPatients { get; private set; }
public DateTime Date { get; private set; }
public int PercentageOfRecoveries { get; private set; }
public int DoctorId { get; private set; }
public static Payment CreateOperation(int id, int salary, int totalPatients, int percentageOfRecoveries, int doctorId)
{
return new Payment
{
Id = id,
Salary = salary,
TotalPatients = totalPatients,
Date = DateTime.Now,
PercentageOfRecoveries = percentageOfRecoveries,
DoctorId = doctorId
};
}
}

View File

@ -0,0 +1,25 @@
using RegistrationOfPatients.Entities.Enums;
namespace RegistrationOfPatients.Entities;
public class Reception
{
public int Id { get; private set; }
public DateTime Date { get; private set; }
public HealthStatus HealthStatus { get; private set; }
public string Illness { get; private set; } = string.Empty;
public int PatientId { get; private set; }
public int DoctorId { get; private set; }
public static Reception CreateOperation(int id, HealthStatus healthStatus, string illness, int patientId, int doctorId)
{
return new Reception
{
Id = id,
Date = DateTime.Now,
HealthStatus = healthStatus,
Illness = illness ?? string.Empty,
PatientId = patientId,
DoctorId = doctorId
};
}
}

View File

@ -0,0 +1,21 @@
using RegistrationOfPatients.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationOfPatients.Repositories;
public interface IDoctorRepository
{
IEnumerable<Doctor> ReadDoctor();
Doctor ReadDoctorById(int id);
void CreateDoctor(Doctor doctor);
void UpdateDoctor(Doctor doctor);
void DeleteDoctor(int id);
}

View File

@ -0,0 +1,16 @@
using RegistrationOfPatients.Entities;
namespace RegistrationOfPatients.Repositories;
public interface IPatientRepository
{
IEnumerable<Patient> ReadPatient();
Patient ReadPatientById(int id);
void CreatePatient(Patient patient);
void UpdatePatient(Patient patient);
void DeletePatient(int id);
}

View File

@ -0,0 +1,17 @@
using RegistrationOfPatients.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationOfPatients.Repositories;
public interface IPaymentRepository
{
IEnumerable<Payment> ReadPayment(DateTime? dateForm = null, DateTime? dateTo = null, int? doctorId = null);
void CreateReception(Payment payment);
void DeletePayment(int id);
}

View File

@ -0,0 +1,10 @@
using RegistrationOfPatients.Entities;
namespace RegistrationOfPatients.Repositories;
public interface IReceptionRepository
{
IEnumerable<Reception> ReadReception(DateTime? dateForm = null, DateTime? dateTo = null, int? doctorId = null, int? patientId = null);
void CreateReception(Reception reception);
}

View File

@ -0,0 +1,36 @@
using RegistrationOfPatients.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationOfPatients.Repositories.Implementations;
public class DoctorRepository : IDoctorRepository
{
public void CreateDoctor(Doctor doctor)
{
}
public void DeleteDoctor(int id)
{
}
public IEnumerable<Doctor> ReadDoctor()
{
return Enumerable.Empty<Doctor>();
}
public Doctor ReadDoctorById(int id)
{
return Doctor.CreateEntity(0, string.Empty);
}
public void UpdateDoctor(Doctor doctor)
{
}
}

View File

@ -0,0 +1,36 @@
using RegistrationOfPatients.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationOfPatients.Repositories.Implementations;
internal class PatientRepository : IPatientRepository
{
public void CreatePatient(Patient patient)
{
}
public void DeletePatient(int id)
{
}
public IEnumerable<Patient> ReadPatient()
{
return Enumerable.Empty<Patient>();
}
public Patient ReadPatientById(int id)
{
return Patient.CreateEntity(0, string.Empty, string.Empty);
}
public void UpdatePatient(Patient patient)
{
}
}

View File

@ -0,0 +1,26 @@
using RegistrationOfPatients.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationOfPatients.Repositories.Implementations;
public class PaymentRepository : IPaymentRepository
{
public void CreateReception(Payment payment)
{
}
public void DeletePayment(int id)
{
}
public IEnumerable<Payment> ReadPayment(DateTime? dateForm = null, DateTime? dateTo = null, int? doctorId = null)
{
return Enumerable.Empty<Payment>();
}
}

View File

@ -0,0 +1,21 @@
using RegistrationOfPatients.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RegistrationOfPatients.Repositories.Implementations;
public class ReceptionRepository : IReceptionRepository
{
public void CreateReception(Reception reception)
{
}
public IEnumerable<Reception> ReadReception(DateTime? dateForm = null, DateTime? dateTo = null, int? doctorId = null, int? patientId = null)
{
return Enumerable.Empty<Reception>();
}
}