コード例 #1
0
ファイル: Program.cs プロジェクト: Rutva21198/WFH
        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;
                }
            }
        }
コード例 #2
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;
                }
            }
        }