using System;
using System.Collections.Generic;
class Patient
{
public string Fio, Oms, Dms; // null — полиса нет
public DateTime? Insurance; // дата окончания страховки, не выводится
public Patient(string fio, string oms, string dms, DateTime? ins)
{ Fio = fio; Oms = oms; Dms = dms; Insurance = ins; }
}
class Checker
{
public bool HasPolicy(Patient p) { return p.Oms != null || p.Dms != null; }
public bool InsuranceValid(Patient p) { return p.Insurance != null && p.Insurance >= DateTime.Today; }
}
class Service
{
public void Provide(Patient p, Checker c)
{
if (!c.HasPolicy(p)) Console.WriteLine("Услуга НЕ оказана: нет ни ОМС, ни ДМС.");
else if (p.Insurance == null) Console.WriteLine("Услуга НЕ оказана: нет страховки.");
else if (!c.InsuranceValid(p)) Console.WriteLine("Услуга НЕ оказана: страховка истекла.");
else Console.WriteLine("Услуга оказана.");
}
}
class Program
{
static void Main()
{
var patients = new List<Patient> {
new Patient("Иванов Иван Иванович", "1234567890", "DMS-111", new DateTime(2027, 5, 1)),
new Patient("Петров Пётр Петрович", "9876543210", null, new DateTime(2025, 1, 1)),
new Patient("Сидорова Анна Сергеевна", null, "DMS-222", null) };
Console.Write("Введите ФИО пациента: ");
string fio = Console.ReadLine().Trim().ToLower();
Patient p = patients.Find(x => x.Fio.ToLower() == fio);
if (p == null) { Console.WriteLine("Пациент не найден."); return; }
if (p.Oms != null) Console.WriteLine("ОМС: " + p.Oms);
if (p.Dms != null) Console.WriteLine("ДМС: " + p.Dms);
new Service().Provide(p, new Checker());
}
}