Exemplo n.º 1
0
        public void Scheduling_Appointment_HappyPath()
        {
            //Arrange
            Setup();
            var providerDomain    = new ProviderDomain(new ProvidersRepository());
            var patientDomain     = new PatientDomain(new PatientsRepository());
            var serviceDomain     = new ServiceDomain(new ServicesRepository());
            var appointmentDomain = new AppointmentsDomain(new AppointmentsRepository());

            var savedProvider = providerDomain.GetProvider(1);
            var savedPatient  = patientDomain.GetPatient(1);
            var savedService  = serviceDomain.GetService(1);

            var appointment = new Appointment
            {
                Patient                  = savedPatient,
                Provider                 = savedProvider,
                Service                  = savedService,
                ReasonForVisit           = "There's no place like home",
                RequestedAppointmentDate = DateTime.Parse("2000/01/01 09:00:00.000"),
            };

            //Act
            var savedAppointment = appointmentDomain.SetAppointment(appointment);

            //Assert
            Assert.IsTrue(savedAppointment.Id != 0);
        }
Exemplo n.º 2
0
        public void Scheduling_Appointment_For_Unqualified_Provider_Should_Fail()
        {
            //Arrange
            Setup();
            var providerDomain    = new ProviderDomain(new ProvidersRepository());
            var patientDomain     = new PatientDomain(new PatientsRepository());
            var serviceDomain     = new ServiceDomain(new ServicesRepository());
            var appointmentDomain = new AppointmentsDomain(new AppointmentsRepository());

            var savedService        = serviceDomain.GetService(1);
            var savedPatient        = patientDomain.GetPatient(1);
            var unqualifiedProvider = new Provider
            {
                Name = "Dr Quack.",
                CertificationLevel = 1
            };

            unqualifiedProvider = providerDomain.CreateProvider(unqualifiedProvider);

            var appointment = new Appointment
            {
                Patient                  = savedPatient,
                Provider                 = unqualifiedProvider,
                Service                  = savedService,
                ReasonForVisit           = "There's no place like home",
                RequestedAppointmentDate = DateTime.Parse("2000/01/01 09:00:00.000"),
            };

            //Act
            var savedAppointment = appointmentDomain.SetAppointment(appointment);
        }
Exemplo n.º 3
0
        public void Scheduling_Appointment_For_Underage_Patients_Should_Fail()
        {
            //Arrange
            Setup();
            var providerDomain    = new ProviderDomain(new ProvidersRepository());
            var patientDomain     = new PatientDomain(new PatientsRepository());
            var serviceDomain     = new ServiceDomain(new ServicesRepository());
            var appointmentDomain = new AppointmentsDomain(new AppointmentsRepository());

            var savedProvider   = providerDomain.GetProvider(1);
            var savedService    = serviceDomain.GetService(1);
            var underagePatient = new Patient
            {
                Age  = 15,
                Name = "Lion"
            };

            underagePatient = patientDomain.CreatePatient(underagePatient);

            var appointment = new Appointment
            {
                Patient                  = underagePatient,
                Provider                 = savedProvider,
                Service                  = savedService,
                ReasonForVisit           = "There's no place like home",
                RequestedAppointmentDate = DateTime.Parse("2000/01/01 09:00:00.000"),
            };

            //Act
            var savedAppointment = appointmentDomain.SetAppointment(appointment);
        }
Exemplo n.º 4
0
        public void Scheduling_Appointment_After_Clinic_Hours_Should_Fail()
        {
            //Arrange
            Setup();
            var providerDomain    = new ProviderDomain(new ProvidersRepository());
            var patientDomain     = new PatientDomain(new PatientsRepository());
            var serviceDomain     = new ServiceDomain(new ServicesRepository());
            var appointmentDomain = new AppointmentsDomain(new AppointmentsRepository());

            var savedProvider = providerDomain.GetProvider(1);
            var savedPatient  = patientDomain.GetPatient(1);
            var savedService  = serviceDomain.GetService(1);

            var appointment = new Appointment
            {
                Patient                  = savedPatient,
                Provider                 = savedProvider,
                Service                  = savedService,
                ReasonForVisit           = "There's no place like home",
                RequestedAppointmentDate = DateTime.Parse("2000/01/01 16:00:01.000"),
            };

            //Act
            var savedAppointment = appointmentDomain.SetAppointment(appointment);
        }
Exemplo n.º 5
0
        public void Setup()
        {
            var providerDomain = new ProviderDomain(new ProvidersRepository());
            var patientDomain  = new PatientDomain(new PatientsRepository());
            var serviceDomain  = new ServiceDomain(new ServicesRepository());

            var provider = new Provider
            {
                Name = "Dr. Oz",
                CertificationLevel = 10
            };

            var differentProvider = new Provider
            {
                Name = "Dr. Jekyll",
                CertificationLevel = 10
            };

            var patient = new Patient
            {
                Name = "Dorothy",
                Age  = 16
            };

            var differentPatient = new Patient
            {
                Name = "Glenda",
                Age  = 99
            };

            var service = new Service
            {
                Name                       = "A New Heart",
                Duration                   = TimeSpan.FromHours(5),
                MinimumRequiredAge         = 16,
                RequiredCertificationLevel = 10
            };

            var shortService = new Service
            {
                Name                       = "Consultation",
                Duration                   = TimeSpan.FromMinutes(30),
                MinimumRequiredAge         = 16,
                RequiredCertificationLevel = 10
            };

            providerDomain.CreateProvider(provider);
            providerDomain.CreateProvider(differentProvider);
            patientDomain.CreatePatient(patient);
            patientDomain.CreatePatient(differentPatient);
            serviceDomain.CreateService(service);
            serviceDomain.CreateService(shortService);
        }
Exemplo n.º 6
0
        public void Scheduling_Appointment_For_Provider_More_Than_Five_Minutes_After_Previous_Booking_But_Not_Overlapping_Next_Booking_Should_Pass()
        {
            //Arrange
            Setup();
            var providerDomain    = new ProviderDomain(new ProvidersRepository());
            var patientDomain     = new PatientDomain(new PatientsRepository());
            var serviceDomain     = new ServiceDomain(new ServicesRepository());
            var appointmentDomain = new AppointmentsDomain(new AppointmentsRepository());

            var savedProvider     = providerDomain.GetProvider(1);
            var savedService      = serviceDomain.GetService(1);
            var savedPatient      = patientDomain.GetPatient(1);
            var savedShortService = serviceDomain.GetService(2);


            var appointment = new Appointment
            {
                Patient                  = savedPatient,
                Provider                 = savedProvider,
                Service                  = savedService,
                ReasonForVisit           = "There's no place like home",
                RequestedAppointmentDate = DateTime.Parse("2000/01/01 09:00:00.000"),
            };

            //Act
            var savedAppointment = appointmentDomain.SetAppointment(appointment);

            var nextAppointment = new Appointment
            {
                Patient  = savedPatient,
                Provider = savedProvider,
                Service  = savedService,
                RequestedAppointmentDate = DateTime.Parse("2000/01/01 09:00:00.000").AddHours(savedAppointment.PlannedDuration.Hours + 1),
                ReasonForVisit           = "A New Brain"
            };

            var savedNextAppointment = appointmentDomain.SetAppointment(nextAppointment);

            var inBetweenAppointment = new Appointment
            {
                Patient  = savedPatient,
                Provider = savedProvider,
                Service  = savedShortService,
                RequestedAppointmentDate = DateTime.Parse("2000/01/01 09:00:00.000").AddHours(savedAppointment.PlannedDuration.Hours).AddMinutes(6),
                ReasonForVisit           = "I just want to go home"
            };

            var savedInBetweenAppointment = appointmentDomain.SetAppointment(inBetweenAppointment);

            Assert.IsTrue(savedInBetweenAppointment.Id != 0);
        }
Exemplo n.º 7
0
        public void Scheduling_Appointment_For_Provider_Less_Than_Five_Minutes_After_Previous_Booking_Should_Fail()
        {
            //Arrange
            Setup();
            var providerDomain    = new ProviderDomain(new ProvidersRepository());
            var patientDomain     = new PatientDomain(new PatientsRepository());
            var serviceDomain     = new ServiceDomain(new ServicesRepository());
            var appointmentDomain = new AppointmentsDomain(new AppointmentsRepository());

            var savedProvider = providerDomain.GetProvider(1);
            var savedService  = serviceDomain.GetService(1);
            var savedPatient  = patientDomain.GetPatient(1);

            var appointment = new Appointment
            {
                Patient                  = savedPatient,
                Provider                 = savedProvider,
                Service                  = savedService,
                ReasonForVisit           = "There's no place like home",
                RequestedAppointmentDate = DateTime.Parse("2000/01/01 09:00:00.000"),
            };

            //Act
            var savedAppointment = appointmentDomain.SetAppointment(appointment);

            var overlappingAppointment = new Appointment
            {
                Patient  = savedPatient,
                Provider = savedProvider,
                Service  = savedService,
                RequestedAppointmentDate = DateTime.Parse("2000/01/01 09:00:00.000").AddHours(savedAppointment.PlannedDuration.Hours).AddMinutes(5),
                ReasonForVisit           = "A New Brain"
            };

            var savedOverlappingAppointment = appointmentDomain.SetAppointment(overlappingAppointment);
        }
 public PatientController()
 {
     this.patientDomain = new PatientDomain();
 }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            bool carryon = true;

            while (carryon)
            {
                Console.WriteLine("Welcome in Hospital App...\n1. Add Patient \n2. View Patient\n3. Add Doctor\n4. View Doctor\n5. Take Appointment\n6. Allot Drugs\nEnter Your Choice : ");
                int choice = Convert.ToInt32(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    Patient p = new Patient();
                    Console.WriteLine("Enter First Name : ");
                    p.FirstName = Console.ReadLine();
                    Console.WriteLine("Enter Last Name : ");
                    p.LastName = Console.ReadLine();
                    Console.WriteLine("Enter Age : ");
                    p.Age = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Enter Gender : ");
                    var Gender = Console.ReadLine();
                    if (Gender.Equals("Female") || Gender.Equals("female"))
                    {
                        p.Gender = true;
                    }
                    if (Gender.Equals("Male") || Gender.Equals("male"))
                    {
                        p.Gender = false;
                    }
                    PatientDomain patientDomain = new PatientDomain();
                    patientDomain.AddPatient(p);

                    break;

                case 2:
                    Console.WriteLine("\n====== View All Patients =====");

                    PatientDomain patient = new PatientDomain();

                    int j = 1;
                    foreach (Patient pt in patient.GetPatients())
                    {
                        Console.WriteLine("Patient - " + j);
                        Console.WriteLine("Id : " + pt.PatientId);
                        Console.WriteLine("Name : " + pt.FirstName + " " + pt.LastName);
                        Console.WriteLine("DoctorId : " + pt.Gender);
                        Console.WriteLine("------------------------------------------------");
                    }
                    break;

                case 3:
                    Doctor dr = new Doctor();
                    Console.WriteLine("Enter Name : ");
                    dr.Name = Console.ReadLine();
                    Console.WriteLine("Enter Degree : ");
                    dr.Degree = Console.ReadLine();
                    Console.WriteLine("Enter WorkExperience : ");
                    dr.WorkExperience = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Enter Gender : ");
                    Gender = Console.ReadLine();
                    if (Gender.Equals("Female") || Gender.Equals("female"))
                    {
                        dr.Gender = true;
                    }
                    if (Gender.Equals("Male") || Gender.Equals("male"))
                    {
                        dr.Gender = false;
                    }
                    Console.WriteLine("\n--------View Doctors Department----------");

                    DoctorDomain dpDomain = new DoctorDomain();

                    foreach (Departments dp in dpDomain.GetDepartments())
                    {
                        Console.WriteLine("DepartmentId : " + dp.DepartmentId);
                        Console.WriteLine("DepartmentName : " + dp.Department);
                    }
                    Console.WriteLine("Enter DepartmentId : ");
                    dr.DepartmentId = Convert.ToInt32(Console.ReadLine());
                    DoctorDomain doctorDomain1 = new DoctorDomain();
                    doctorDomain1.AddDoctor(dr);
                    break;

                case 4:
                    Console.WriteLine("\n====== View All Doctors =====");

                    DoctorDomain doctorDomain = new DoctorDomain();

                    int i = 1;
                    foreach (Doctor doctor in doctorDomain.GetDoctors())
                    {
                        Console.WriteLine("Doctor - " + i);
                        Console.WriteLine("DoctorId : " + doctor.DoctorId);
                        Console.WriteLine("Name : " + doctor.Name);
                        Console.WriteLine("Degree : " + doctor.Degree);
                        Console.WriteLine("WorkExperience : " + doctor.WorkExperience);
                        Console.WriteLine("------------------------------------------------");
                    }
                    break;

                case 5:
                    Appointment ap = new Appointment();
                    Console.WriteLine("Enter Patient Name : ");
                    ap.PatientName = Console.ReadLine();
                    Console.WriteLine("Enter Age : ");
                    ap.Age = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Enter Gender : ");
                    Gender = Console.ReadLine();
                    if (Gender.Equals("Female") || Gender.Equals("female"))
                    {
                        ap.Gender = true;
                    }
                    if (Gender.Equals("Male") || Gender.Equals("male"))
                    {
                        ap.Gender = false;
                    }
                    Console.WriteLine("Enter Patient Problem : ");
                    ap.Problem = Console.ReadLine();
                    Console.WriteLine("Enter PatientId those already added : ");
                    ap.PatientId = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Enter Doctor Id : ");
                    ap.DoctorId = Convert.ToInt32(Console.ReadLine());
                    AppointmentDomain ad = new AppointmentDomain();
                    ad.AddAppointment(ap);
                    break;

                case 6:
                    DrugAllocation da = new DrugAllocation();
                    Console.WriteLine("Enter Drug Id : ");
                    da.DrugId = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Enter Patient Id : ");
                    da.PatientId = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Enter Age : ");
                    da.DoctorId = Convert.ToInt32(Console.ReadLine());
                    DrugDomain dd = new DrugDomain();
                    dd.DrugAllocation(da);
                    break;

                default:
                    Console.WriteLine("You Enter Invalid Choice \n Thank You for Visisting...");
                    Console.ReadLine();
                    break;
                }
                Console.WriteLine("\nDo You want continue? press y for yes\nEnter Key :");
                char c = Convert.ToChar(Console.ReadLine());
                if (c.Equals('y') || c.Equals('Y'))
                {
                    Console.Clear();
                    carryon = true;
                }
                else
                {
                    carryon = false;
                }
            }
        }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Hospital List Application");
            bool                    showMenu                = true;
            AdmitDomain             admitDomain             = new AdmitDomain();
            AppointmentDomain       appointmentDomain       = new AppointmentDomain();
            BedDomain               bedDomain               = new BedDomain();
            DepartmentDomain        departmentDomain        = new DepartmentDomain();
            DoctorDomain            doctorDomain            = new DoctorDomain();
            EmployeeDomain          employeeDomain          = new EmployeeDomain();
            MedicineDomain          medicineDomain          = new MedicineDomain();
            NursingDomain           nursingDomain           = new NursingDomain();
            PatientDomain           patientDomain           = new PatientDomain();
            PrescribeMedicineDomain prescribeMedicineDomain = new PrescribeMedicineDomain();
            PrescriptionDomain      prescriptionDomain      = new PrescriptionDomain();
            ProblemDomain           problemDomain           = new ProblemDomain();
            TreatmentDomain         treatmentDomain         = new TreatmentDomain();

            while (showMenu)
            {
                Console.Clear();
                Console.WriteLine("Choose an option:");
                Console.WriteLine("1) Appointment");
                Console.WriteLine("2) Admit");
                Console.WriteLine("3) List Admits");
                Console.WriteLine("4) Exit");
                Console.Write("\r\nSelect an option: ");

                switch (Console.ReadLine().Trim())
                {
                case "1":
                {
                    Appointment appointment = new Appointment();
                    Patient     patient     = new Patient();
                    Console.Write("Enter Name : ");
                    patient.PatientName = Console.ReadLine().Trim();
                    Console.Write("Enter Age : ");
                    patient.Age = Convert.ToInt32(Console.ReadLine().Trim());
                    Console.Write("Enter Gender : ");
                    patient.Gender = Convert.ToInt32(Console.ReadLine().Trim());
                    Console.Write("Enter PhoneNo : ");
                    patient.PhoneNo = Convert.ToInt64(Console.ReadLine().Trim());
                    Console.Write("Enter Address : ");
                    patient.Address = Console.ReadLine().Trim();
                    patientDomain.AddPatient(patient);
                    Console.Write("Patient Added");
                    appointment.PatientId = patient.PatientId;
                    Console.WriteLine("No     Name     Speciality");
                    foreach (Doctor doctor in doctorDomain.GetDoctors())
                    {
                        Console.WriteLine($"{doctor.DoctorId}     {doctor.DoctorName}     {doctor.Speciality}");
                    }
                    Console.Write("Select Doctor by No : ");
                    appointment.DoctorId = Convert.ToInt32(Console.ReadLine().Trim());
                    Console.WriteLine("No     ProblemType     Description");
                    foreach (Problem problem in problemDomain.GetProblem())
                    {
                        Console.WriteLine($"{problem.ProblemId}     {problem.ProblemType}     {problem.Description}");
                    }
                    Console.Write("Select Problem by No : ");
                    appointment.ProblemId = Convert.ToInt32(Console.ReadLine().Trim());
                    Console.Write("Enter Appointment DateTime : ");
                    appointment.DateTime = Convert.ToDateTime(Console.ReadLine().Trim()).Date;
                    appointmentDomain.AddApointment(appointment);
                    Console.ReadLine();
                    break;
                }

                case "2":
                {
                    Admit admit = new Admit();
                    Console.WriteLine("No     Name     PhoneNo");
                    foreach (Patient patient in patientDomain.GetPatients())
                    {
                        Console.WriteLine($"{patient.PatientId}     {patient.PatientName}     {patient.PhoneNo}");
                    }
                    Console.Write("Select Patient by No : ");
                    admit.PatientId = Convert.ToInt32(Console.ReadLine().Trim());
                    Console.WriteLine("No     Name     Speciality");
                    foreach (Doctor doctor in doctorDomain.GetDoctors())
                    {
                        Console.WriteLine($"{doctor.DoctorId}     {doctor.DoctorName}     {doctor.Speciality}");
                    }
                    Console.Write("Select Doctor by No : ");
                    admit.DoctorId = Convert.ToInt32(Console.ReadLine().Trim());
                    Console.WriteLine("No     Department Name");
                    foreach (Department department in departmentDomain.GetDepartments())
                    {
                        Console.WriteLine($"{department.DepartmentId}     {department.DepartmentName}");
                    }
                    Console.Write("Select Department by No : ");
                    admit.DepartmentId = Convert.ToInt32(Console.ReadLine().Trim());
                    Console.WriteLine("No    BedNo    RoomNo");
                    foreach (Bed bed in bedDomain.GetBeds())
                    {
                        Console.WriteLine($"{bed.BedId}     {bed.BedNo}     {bed.RoomNo}");
                    }
                    Console.Write("Select Bed by No : ");
                    admit.DepartmentId = Convert.ToInt32(Console.ReadLine().Trim());
                    Console.Write("Enter Admit Start DateTime : ");
                    admit.StartDate = Convert.ToDateTime(Console.ReadLine().Trim()).Date;
                    admitDomain.AddAdmit(admit);
                    Console.ReadLine();
                    break;
                }

                case "3":
                {
                    Console.WriteLine("No     Patient Name     BedNo     Doctor Name     StartDate");
                    foreach (Admit admit in admitDomain.GetAdmits())
                    {
                        Console.WriteLine($"{admit.AdmitId}     {admit.Patient.PatientName}     {admit.Bed.BedNo}     {admit.Doctor.DoctorName}     {admit.StartDate}");
                    }
                    Console.ReadLine();
                    break;
                }

                case "4":
                    showMenu = false;
                    break;

                default:
                    Console.WriteLine("please enter correct option");
                    break;
                }
            }
        }