Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/dotnet_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: .NET Tests

on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore Polyclinic/Polyclinic.sln

- name: Build
run: dotnet build Polyclinic/Polyclinic.sln --no-restore --configuration Release

- name: Test
run: dotnet test Polyclinic/Polyclinic.sln --no-build --configuration Release --verbosity normal
47 changes: 47 additions & 0 deletions Polyclinic/Polyclinic.Domain/Entities/Appointment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
namespace Polyclinic.Domain.Entities;

/// <summary>
/// Запись пациента на прием к врачу
/// </summary>
public class Appointment
{
/// <summary>
/// Уникальный идентификатор записи
/// </summary>
public int Id { get; set; }

/// <summary>
/// Дата и время приема
/// </summary>
public DateTime AppointmentDateTime { get; set; }

/// <summary>
/// Номер кабинета
/// </summary>
public required string RoomNumber { get; set; }

/// <summary>
/// Флаг повторного приема
/// </summary>
public bool IsRepeat { get; set; }

/// <summary>
/// Идентификатор пациента
/// </summary>
public int PatientId { get; set; }

/// <summary>
/// Идентификатор врача
/// </summary>
public int DoctorId { get; set; }

/// <summary>
/// Навигационное свойство: пациент
/// </summary>
public Patient? Patient { get; set; }

/// <summary>
/// Навигационное свойство: врач
/// </summary>
public Doctor? Doctor { get; set; }
}
57 changes: 57 additions & 0 deletions Polyclinic/Polyclinic.Domain/Entities/Doctor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
namespace Polyclinic.Domain.Entities;

/// <summary>
/// Врач поликлиники
/// </summary>
public class Doctor
{
/// <summary>
/// Уникальный идентификатор врача
/// </summary>
public int Id { get; set; }

/// <summary>
/// Номер паспорта (уникальный)
/// </summary>
public required string PassportNumber { get; set; }

/// <summary>
/// ФИО врача
/// </summary>
public required string FullName { get; set; }

/// <summary>
/// Дата рождения
/// </summary>
public DateTime BirthDate { get; set; }

/// <summary>
/// Идентификатор специализации
/// </summary>
public int SpecializationId { get; set; }

/// <summary>
/// Стаж работы (в годах)
/// </summary>
public int ExperienceYears { get; set; }

/// <summary>
/// Навигационное свойство: специализация
/// </summary>
public Specialization? Specialization { get; set; }

/// <summary>
/// Список приемов у этого врача
/// </summary>
public List<Appointment> Appointments { get; set; } = [];

/// <summary>
/// Вычисление возраста врача на указанную дату
/// </summary>
public int GetAge(DateTime onDate)
{
var age = onDate.Year - BirthDate.Year;
if (BirthDate.Date > onDate.AddYears(-age)) age--;
return age;
}
}
69 changes: 69 additions & 0 deletions Polyclinic/Polyclinic.Domain/Entities/Patient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using Polyclinic.Domain.Enums;

namespace Polyclinic.Domain.Entities;

/// <summary>
/// Пациент поликлиники
/// </summary>
public class Patient
{
/// <summary>
/// Уникальный идентификатор пациента
/// </summary>
public int Id { get; set; }

/// <summary>
/// Номер паспорта (уникальный)
/// </summary>
public required string PassportNumber { get; set; }

/// <summary>
/// ФИО пациента
/// </summary>
public required string FullName { get; set; }

/// <summary>
/// Пол пациента
/// </summary>
public Gender Gender { get; set; }

/// <summary>
/// Дата рождения
/// </summary>
public DateTime BirthDate { get; set; }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вот тут у вас как раз дата, это правильнее. Сделайте также для доктора.


/// <summary>
/// Адрес проживания
/// </summary>
public required string Address { get; set; }

/// <summary>
/// Группа крови
/// </summary>
public BloodGroup BloodGroup { get; set; }

/// <summary>
/// Резус-фактор
/// </summary>
public RhFactor RhFactor { get; set; }

/// <summary>
/// Контактный телефон
/// </summary>
public required string PhoneNumber { get; set; }

/// <summary>
/// Список записей на прием этого пациента
/// </summary>
public List<Appointment> Appointments { get; set; } = [];

/// <summary>
/// Вычисление возраста пациента на указанную дату
/// </summary>
public int GetAge(DateTime onDate)
{
var age = onDate.Year - BirthDate.Year;
if (BirthDate.Date > onDate.AddYears(-age)) age--;
return age;
}
}
32 changes: 32 additions & 0 deletions Polyclinic/Polyclinic.Domain/Entities/Specialization.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
namespace Polyclinic.Domain.Entities;

/// <summary>
/// Специализация врача (справочник)
/// </summary>
public class Specialization
{
/// <summary>
/// Уникальный идентификатор специализации
/// </summary>
public int Id { get; set; }

/// <summary>
/// Название специализации
/// </summary>
public required string Name { get; set; }

/// <summary>
/// Описание специализации
/// </summary>
public required string Description { get; set; }

/// <summary>
/// Код специализации
/// </summary>
public required string Code { get; set; }

/// <summary>
/// Список врачей с этой специализацией
/// </summary>
public List<Doctor> Doctors { get; set; } = [];
}
27 changes: 27 additions & 0 deletions Polyclinic/Polyclinic.Domain/Enums/BloodGroup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace Polyclinic.Domain.Enums;

/// <summary>
/// Группа крови пациента
/// </summary>
public enum BloodGroup
{
/// <summary>
/// Первая (0)
/// </summary>
O,

/// <summary>
/// Вторая (A)
/// </summary>
A,

/// <summary>
/// Третья (B)
/// </summary>
B,

/// <summary>
/// Четвертая (AB)
/// </summary>
Ab
}
22 changes: 22 additions & 0 deletions Polyclinic/Polyclinic.Domain/Enums/Gender.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace Polyclinic.Domain.Enums;

/// <summary>
/// Пол пациента
/// </summary>
public enum Gender
{
/// <summary>
/// Не указано
/// </summary>
NotSet,

/// <summary>
/// Мужской
/// </summary>
Male,

/// <summary>
/// Женский
/// </summary>
Female
}
17 changes: 17 additions & 0 deletions Polyclinic/Polyclinic.Domain/Enums/RhFactor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Polyclinic.Domain.Enums;

/// <summary>
/// Резус-фактор пациента
/// </summary>
public enum RhFactor
{
/// <summary>
/// Положительный
/// </summary>
Positive,

/// <summary>
/// Отрицательный
/// </summary>
Negative
}
9 changes: 9 additions & 0 deletions Polyclinic/Polyclinic.Domain/Polyclinic.Domain.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
30 changes: 30 additions & 0 deletions Polyclinic/Polyclinic.Tests/Polyclinic.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Polyclinic.Domain\Polyclinic.Domain.csproj" />
</ItemGroup>

<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>

</Project>
Loading