private void btnRegisterConfirm_Click(object sender, EventArgs e) { String name = this.txtName.Text.Trim(); String id = this.txtID.Text.Trim(); String gender = this.rbtnMale.Checked ? "男" : this.rbtnFemale.Checked ? "女" : "保密"; String depart = this.txtDepart.Text.Trim(); String comment = this.txtComment.Text.Trim(); if (!checkInput(name,id, depart)) { MessageBox.Show("医生信息登记错误!"); return; } Doctor doctor = new Doctor(id, name, gender, depart, comment); if (!doctorDAO.updateDoctor(doctor)) { MessageBox.Show("医生信息登记失败!"); return; } this.DialogResult = DialogResult.OK; this.Close(); }
public DoctorsOfficeView() { Doctor Phil = new Doctor(new ContactInformation {FirstName = "Phil", LastName = "Steele"}); Doctor Jane = new Doctor(new ContactInformation {FirstName = "Jane", LastName = "Alexander"}); Doctor Barry = new Doctor(new ContactInformation {FirstName = "Barry", LastName = "Hall"}); this.Operations = new DoctorsOffice(new List<Doctor>() { Phil, Jane, Barry }); this.VMC = new ViewModelConverter(); }
public Patient(ContactInformation contactInformation, Symptom symptom, Insurance insurance, Doctor preferredDoctor, DateTime preferredDate, TimeSpan preferredTime) : base(contactInformation) { this.symptom = symptom; this.insurance = insurance; this.preferredDoctor = preferredDoctor; this.preferredDate = preferredDate; this.preferredTime = preferredTime; }
public bool CheckScheduleConflictions(DateTime requestedTime, Doctor doctor) { if (doctor.calendar.Count() != 0) { foreach (Appointment appointment in doctor.calendar) { if (requestedTime == appointment.Time) { return true; } } } return false; }
public bool updateDoctor(Doctor doctor) { String queryCmd = "select * from doctor where id = '" + doctor.id + "'"; bool exist = db.queryDataTable(queryCmd).Rows.Count == 1; String cmd = "insert into doctor values ('" + doctor.id + "', '" + doctor.name + "', '" + doctor.gender + "', '" + doctor.depart + "', '" + doctor.comment + "')"; if (exist) { cmd = "update doctor set name = '" + doctor.name + "', gender = '" + doctor.gender + "', comment = '" + doctor.comment + "', depart = '" + doctor.depart + "' where id = '" + doctor.id + "'"; } return db.update(cmd); }
public void AddAppointmentToCalendar(Patient patient, Doctor doctor) { SingleSchedule newScheduleItem = new SingleSchedule { Name = String.Format("Appointment for {0} with Dr. {1}", patient.contactInformation.Name, doctor.contactInformation.Name), TimeOfDay = patient.preferredTime, Date = patient.preferredDate, Patient = patient.contactInformation.Name, Doctor = doctor.contactInformation.Name, ID = GetAppointmentNumber() }; doctor.schedules.Add(newScheduleItem); doctor.GenerateCalendar(); Appointment appointment = doctor.getAppointmentByPatient(patient.contactInformation.Name); doctor.UpdateCalendar(appointment); }
public Doctor getDoctorById(String id) { DataTable table = db.queryDataTable("select id, name, gender, depart, comment from doctor where id = '" + id + "'"); if (table.Rows.Count == 0) { return null; } DataRow row = table.Rows[0]; Doctor doctor = new Doctor(); doctor.id = row.Field<String>("id"); doctor.name = row.Field<String>("name"); doctor.gender = row.Field<String>("gender"); doctor.depart = row.Field<String>("depart"); doctor.comment = row.Field<String>("comment"); return doctor; }
private void Sch_Apt_Click(object sender, RoutedEventArgs e) { googleCalendar.pushEvent(apt); doctorChoice = Doctor.SelectedValue.ToString(); doctorChoice = doctorChoice.Remove(0, 38); Patient p = new Patient(); Doctor d = new Doctor(); p.Name = apt.Summary; d.Name = doctorChoice; Appointment appointment = new Appointment(); appointment.Room = apt.Location; appointment.Description = apt.Description; appointment.Start = apt.Start.DateTime; appointment.End = apt.End.DateTime; appointment.Status = "open"; Visit v = new Visit(); v.apt = appointment; v.doc = d; v.patient = p; path = database.pathFormater(p.Name, d.Name, appointment); database.visitToXml(v, path); }
Apointment(Doctor doctor, Patient patient) { }
public void removeAppointmentFromCalendar(Patient patient, Doctor doctor) { Appointment appointment = doctor.getAppointmentByPatient(patient.contactInformation.Name); doctor.calendar.Remove(appointment); doctor.scheduleWriter.RemoveSchedule(appointment); }
partial void UpdateDoctor(Doctor instance);
partial void DeleteDoctor(Doctor instance);
private void CreateRolesandUsers() { ApplicationDbContext context = new ApplicationDbContext(); var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(context)); var UserManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(context)); if (!roleManager.RoleExists("Admin")) { var role = new IdentityRole { Name = "Admin" }; roleManager.Create(role); //creating super admin instantly var user = new ApplicationUser { UserName = "******", Email = "*****@*****.**" }; string userPassword = "******"; var admin = UserManager.Create(user, userPassword); if (admin.Succeeded) { var result1 = UserManager.AddToRole(user.Id, "Admin"); } } if (!roleManager.RoleExists("Doctor")) { var role = new IdentityRole { Name = "Doctor" }; roleManager.Create(role); var user = new ApplicationUser { UserName = "******", Email = "*****@*****.**" }; string docPath = "asdasd"; var doc = UserManager.Create(user, docPath); if (doc.Succeeded) { UserManager.AddToRole(user.Id, "Doctor"); } Doctor doctor = new Doctor { Name = "Bob", Specialization = "AloneDoctor", Email = user.Email, ImageUrl = "DoctorBob.jpg" }; context.Doctors.Add(doctor); context.SaveChanges(); } if (!roleManager.RoleExists("Patient")) { var role = new IdentityRole { Name = "Patient" }; roleManager.Create(role); } }
partial void InsertDoctor(Doctor instance);
static void Main(string[] args) { //HospitalCreate c = new HospitalCreate(15, "CREATOR", "Exponential"); //Doctor p0 = new Doctor(5, 8, "DOCTOR", "Exponential", 2); ////'''час следования в палату ////равномерно от 3 до 8 и следующая 3 это сопровождающие''' //HospitalProcess p1 = new HospitalProcess(3, 8, "CHAMBERS", "Exponential", 6); ////'''час обслуживания в регестратуре лаборатории //// мат.ожидание - 4.5 ////коэфф. - 3''' //HospitalProcess p2 = new HospitalProcess(3, 4.5, "REGISTRATION", "Exponential", 1); ////'''час проведения анализа //// мат.ожидание - 4 //// коэфф. - 2''' //Laboratory p3 = new Laboratory(2, 4, "LABORATORY", "Exponential", 2); //c.NextElement = p0; //p0.NextProcesses = new List<HospitalProcess> { p1, p2 }; //p2.NextProcesses = new List<HospitalProcess> { p3 }; //p3.NextProcesses = new List<HospitalProcess> { p0 }; //List<Element> elementsList = new List<Element> { c, p0, p1, p2, p3 }; //HospitalModel model = new HospitalModel(elementsList); //model.Simulate(1000.0); HospitalCreate c = new HospitalCreate(10, "CREATOR", "Exponential"); HospitalProcess p0 = new HospitalProcess(2, 5, "GO TO DOCTOR", "Uniform", 3); HospitalProcess p1 = new HospitalProcess(3, 8, "CHAMBERS", "Uniform", 3); HospitalProcess d = new HospitalProcess(3, 8, "EXIT", "Exponential", 3); HospitalProcess p2 = new HospitalProcess(3, 4.5, "REGISTRATION", "Erlang", 4); Laboratory p3 = new Laboratory(2, 4, "LABORATORY", "Erlang", 2); HospitalProcess p4 = new HospitalProcess(2, 5, "GO TO REGISTRATION", "Exponential", 3); Doctor p5 = new Doctor(2, 5, "DOCTOR", "Uniform", 2); c.NextElement = p0; c.PatientsTypes = new List <PatientType> { new PatientType(1, 0.5, 1 / 15), new PatientType(2, 0.1, 1 / 40), new PatientType(3, 0.4, 1 / 30) }; p0.NextProcesses = new List <HospitalProcess> { p5 }; p5.NextProcesses = new List <HospitalProcess> { p1, p4 }; p2.NextProcesses = new List <HospitalProcess> { p3 }; p3.NextProcesses = new List <HospitalProcess> { p0, d }; p4.NextProcesses = new List <HospitalProcess> { p2 }; List <Element> elementsList = new List <Element> { c, p0, p1, p2, p3, p4, p5, d }; HospitalModel model = new HospitalModel(elementsList); model.Simulate(1000.0); }
public Data BuildDataObject(Patient patient, Doctor doctor) { Appointment apt = doctor.getAppointmentByPatient(patient.contactInformation.Name); return new Data(patient.contactInformation, doctor.contactInformation.Name, apt, patient.insurance, patient.symptom); }
public void AddDoctor(Doctor doctor) { this.doctors.Add(doctor); }
private void ultraBtnSave_Click(object sender, EventArgs e) { objHospitalDB = new MyCompany.MyProject.Db.HospitalDB(); Doctor objDoctor = new Doctor(objHospitalDB); DoctorRow objDoctorRow = new MyCompany.MyProject.Db.DoctorRow(); objDoctorRow.FullName = ultraTextFullName.Text; objDoctorRow.Phone = ultraTextPhoneNumber.Text; objDoctorRow.Doc_Address = ultraTextAddress.Text; if (strFormMode == "NEW") { objDoctor.Insert(objDoctorRow); } else if (strFormMode == "EDIT") { objDoctorRow.Doctor_ID = Convert.ToInt32(ultraTextEditorID.Text); } objDoctor.Update(objDoctorRow); //string query = "insert into Doctor Values('" + ultraTextFullName.Text + "','" + ultraTextAddress.Text + "','" + ultraTextPhoneNumber.Text + "')"; //SqlConnection con = new SqlConnection(@"Data Source=DESKTOP-89LF16D;Initial Catalog=Hospital;Integrated Security=True"); /* if (strFormMode == "NEW") * { * try * { * * objHospitalDB = new HospitalDB(); * string query1 = "insert into Doctor Values('" + ultraTextFullName.Text + "','" + ultraTextAddress.Text + "','" + ultraTextPhoneNumber.Text + "')"; * SqlCommand cmd = objHospitalDB.CreateCommand(query1, false); * // cmd.Parameters.Add(new SqlParameter("@images", images)); * int p = cmd.ExecuteNonQuery(); * * MessageBox.Show(p.ToString() + "registerd"); * this.Close(); * } * catch (Exception ex) * { * MessageBox.Show(ex.Message); * if (objHospitalDB != null) * { * objHospitalDB.Dispose(); * } * } * } * else * { * try * { * * objHospitalDB = new HospitalDB(); * SqlCommand cmd = objHospitalDB.CreateCommand("update Doctor set FullName='" + ultraTextFullName.Text + "',Doc_Address='" + ultraTextAddress.Text + "',Phone='" + ultraTextPhoneNumber.Text + "' where Doctor_ID= '" + ultraTextEditorID.Text + "'",false); * int o = cmd.ExecuteNonQuery(); * * MessageBox.Show(o + ":updated"); * this.Close(); * } * catch (Exception ex) * { * MessageBox.Show(ex.Message); * if (objHospitalDB != null) * { * objHospitalDB.Dispose(); * } * } * }*/ }
public void WriteAppointmentToDatafile(Patient patient, Doctor doctor) { Data patientData = BuildDataObject(patient, doctor); string fileText = File.ReadAllText(fileWriter.path); if (fileText.Length == 0) { List<Data> dataEntries = new List<Data>() { patientData }; fileWriter.WriteAllText(dataEntries); } else if (!fileWriter.RecordExists(patient.contactInformation.Name)) { List<Data> dataFile = fileWriter.GetAllData(); dataFile.Add(patientData); fileWriter.WriteAllText(dataFile); } else { List<Data> existingData = fileWriter.GetAllData(); foreach (Data patientObject in existingData) { if (patientObject.contactInformation.Name == patient.contactInformation.Name) { patientObject.appointment = patientData.appointment; } } fileWriter.WriteAllText(existingData); } }
public static void Init(MySqlConnection conn, string role, string username, string password) { int line; switch (role) { case "doctor": Doctor doctor = new Doctor(username, password); doctor.ActivCommands(); line = Convert.ToInt16(Console.ReadLine()); switch (line) { case 2: doctor.MyRequest(conn, doctor); Start(true); break; case 3: doctor.PatientHistory(conn, doctor); Console.WriteLine(); Start(true); break; } break; case "patient": Patient patient = new Patient(username, password); patient.ActivCommands(); line = Convert.ToInt16(Console.ReadLine()); switch (line) { case 1: patient.RequestForConsultation(conn, patient); break; case 2: patient.MyRequest(conn, patient); Start(true); break; case 3: patient.PatientHistory(conn, patient); break; } break; case "admin": Admin admin = new Admin(username, password); admin.ActivCommands(); line = Convert.ToInt16(Console.ReadLine()); switch (line) { case 1: Console.Write("Username: "******"Username: "******""); Console.Write("Password: "******"Password: "******""); Console.Write("Proffesion: "); string profession = Console.ReadLine().Replace("Proffesion: ", ""); admin.AddDoctor(conn, username, password, profession); Start(true); break; case 2: //admin.MyRequest(conn, patient); break; } break; } Console.ReadLine(); }
public void Run() { string command = Console.ReadLine(); while (command != "Output") { string[] inputArgs = command .Split() .ToArray(); string departament = inputArgs[0]; string firstName = inputArgs[1]; string secondName = inputArgs[2]; string patient = inputArgs[3]; string fullName = firstName + " " + secondName; this.hospital.AddDoctor(firstName, secondName); this.hospital.AddDepartment(departament); this.hospital.AddPatient(fullName, departament, patient); command = Console.ReadLine(); } command = Console.ReadLine(); while (command != "End") { string[] args = command .Split(' ', StringSplitOptions.RemoveEmptyEntries) .ToArray(); if (args.Length == 1) { string deparmentName = args[0]; Department department = this.hospital.Departments.FirstOrDefault(x => x.Name == deparmentName); Console.WriteLine(department); } else if (args.Length == 2) { bool isRoom = int.TryParse(args[1], out int targetRoom); if (isRoom) { string deparmentName = args[0]; Room room = this.hospital.Departments.FirstOrDefault(x => x.Name == deparmentName).Rooms[targetRoom - 1]; Console.WriteLine(room); } else { string fullName = args[0] + " " + args[1]; Doctor doctor = this.hospital.Doctors.FirstOrDefault(x => x.FullName == fullName); Console.WriteLine(doctor); } } command = Console.ReadLine(); } }
public static void Main() { departments = new List <Department>(); doctors = new List <Doctor>(); string command = Console.ReadLine(); while (command != "Output") { string[] tokens = command.Split(); var departmentName = tokens[0]; var firstName = tokens[1]; var lastName = tokens[2]; var doctorName = firstName + " " + lastName; var patientName = tokens[3]; Department department = GetDepartment(departmentName); Doctor doctor = GetDoctor(doctorName); bool containsFreeSpace = department.Rooms.Sum(x => x.Patients.Count) < 60; if (containsFreeSpace) { for (int room = 0; room < department.Rooms.Count; room++) { if (department.Rooms[room].Patients.Count < 3) { department.Rooms[room].Patients.Add(patientName); doctor.Patients.Add(patientName); break; } } } command = Console.ReadLine(); } command = Console.ReadLine(); while (command != "End") { string[] commandArgs = command.Split(); if (commandArgs.Length == 1) { Department department = GetDepartment(commandArgs[0]); foreach (var room in department.Rooms.Where(r => r.Patients.Count > 0)) { Console.WriteLine(string.Join("\n", room.Patients)); } } else if (commandArgs.Length == 2 && int.TryParse(commandArgs[1], out int roomNumber)) { Department department = GetDepartment(commandArgs[0]); Console.WriteLine(string.Join("\n", department.Rooms[roomNumber - 1] .Patients .OrderBy(x => x))); } else { string doctorName = commandArgs[0] + " " + commandArgs[1]; Doctor doctor = GetDoctor(doctorName); Console.WriteLine(string.Join("\n", doctor.Patients.OrderBy(x => x))); } command = Console.ReadLine(); } }
public void Dispose() { Appointment.DeleteAll(); Doctor.DeleteAll(); Patient.DeleteAll(); }
public void PrintResult() { Console.WriteLine("---------------------RESULTS-----------------------"); int patients = 0; double tWaiting = 0; double timeBetweenLab = 0; List <double> types = new List <double> { 0, 0, 0 }; List <int> quantities = new List <int> { 0, 0, 0 }; foreach (var e in ElementsList) { patients += e.Quantity; //if (e.GetType() == typeof(HospitalCreate)) //{ // patients += e.Quantity; //} e.PrintResult(); if (e.GetType() == typeof(HospitalCreate)) { HospitalCreate c = (HospitalCreate)e; for (int i = 0; i < c.PatientsTypes.Count; i++) { quantities[i] = c.PatientsTypes[i].Quantity; } } if (e.GetType() == typeof(HospitalProcess)) { HospitalProcess process = new HospitalProcess(); process = (HospitalProcess)e; patients += process.Quantity; //if (process.Name == "LABORATORY" || process.Name == "DOCTOR" || process.Name == "CHAMBER") //{ tWaiting += process.WaitingTime; //} foreach (var t in process.Types) { types[t.Index - 1] += t.WaitingTime; //quantities[t.Index - 1] += process.Quantity; quantities[t.Index - 1] += t.Quantity; } double average = process.AverageQueue / process.TCurrent; double workload = process.AverageWorkload / process.TCurrent; Console.WriteLine($"name = {process.Name} max parallel = {process.MaxParallel} quantity = {process.Quantity} averageQ = {average} " + $" workload = {workload}"); } if (e.GetType() == typeof(Doctor)) { Doctor doctor = (Doctor)e; //patients += doctor.Quantity; tWaiting += doctor.WaitingTime; foreach (var t in doctor.Types) { types[t.Index - 1] += t.WaitingTime; //quantities[t.Index - 1] += doctor.Quantity; quantities[t.Index - 1] += t.Quantity; } double average = doctor.AverageQueue / doctor.TCurrent; double workload = doctor.AverageWorkload / doctor.TCurrent; Console.WriteLine($"name = {doctor.Name} max parallel = {doctor.MaxParallel} quantity = {doctor.Quantity} averageQ = {average} " + $" workload = {workload}"); timeBetweenLab = doctor.DelaySum / doctor.ToLabAmount; } } double AverageTime = tWaiting / patients; for (int i = 0; i < types.Count; i++) { types[i] /= quantities[i]; Console.WriteLine($"Average time in the hospital of type {i + 1} is {types[i]}"); } //Console.WriteLine($"Average time in the hospital is {AverageTime}"); Console.WriteLine($"Avg trip from doctor to lab duration is {timeBetweenLab}"); }