Esempio n. 1
0
        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 comment = this.txtComment.Text.Trim();

            if (!checkInput(name,id))
            {
                MessageBox.Show("病人信息登记错误!");
                return;
            }

            Patient patient = new Patient(id, name, gender, comment);

            if (!patientDAO.updatePatient(patient))
            {
                MessageBox.Show("病人信息登记失败!");
                return;

            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Esempio n. 2
0
 public void addPatient(Patient newPaitent)
 {
     foreach (Patient p in pList)
     {
         if (p.Name == newPaitent.Name)
         {
             return;
         }
         else
         {
             pList.Add(newPaitent);
         }
     }
 }
Esempio n. 3
0
        public bool updatePatient(Patient patient)
        {
            String queryCmd = "select * from patient where id = '" + patient.id + "'";
            bool exist = db.queryDataTable(queryCmd).Rows.Count == 1;

            String cmd = "insert into patient values ('" + patient.id + "', '" + patient.name + "', '" + patient.gender + "', '"
                + patient.comment + "', '" + DateTime.Now + "')";

            if (exist)
            {
                cmd = "update patient set name = '" + patient.name + "', gender = '" + patient.gender +
                    "', comment = '" + patient.comment + "', time = '" + DateTime.Now + "' where id = '" + patient.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);
        }
Esempio n. 5
0
        public Patient getPatientById(String id)
        {
            DataTable table = db.queryDataTable("select id, name, gender, comment, time from patient where id = '" + id + "'");
            if (table.Rows.Count == 0)
            {
                return null;
            }

            DataRow row = table.Rows[0];
            Patient patient = new Patient();

            patient.id = row.Field<String>("id");
            patient.name = row.Field<String>("name");
            patient.gender = row.Field<String>("gender");
            patient.comment = row.Field<String>("comment");
            patient.time = row.Field<DateTime>("time").ToString();

            return patient;
        }
        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);

        }
 public void removeAppointmentFromCalendar(Patient patient, Doctor doctor)
 {
     Appointment appointment = doctor.getAppointmentByPatient(patient.contactInformation.Name);
     doctor.calendar.Remove(appointment);
     doctor.scheduleWriter.RemoveSchedule(appointment);
 }
        public void ReceiveAppointment(Patient patient)
        {
            Doctor doctor = patient.preferredDoctor;
            DateTime requestedTime = patient.preferredDate.Add(patient.preferredTime);

            if (CheckInsurance(patient.insurance))
            {
                if (CheckScheduleConflictions(requestedTime, doctor))
                {
                    throw new CustomExceptions.AppointmentException("Doctor has a conflicting appointment.");
                }
            } else
            {
                throw new CustomExceptions.AppointmentException("Patient does not have insurance.");
            }
            AddAppointmentToCalendar(patient, doctor);
            WriteAppointmentToDatafile(patient, doctor);
        }
Esempio n. 9
0
        Apointment(Doctor doctor, Patient patient)
        {

        }
Esempio n. 10
0
 partial void InsertPatient(Patient instance);
 public void Dispose()
 {
     Appointment.DeleteAll();
     Doctor.DeleteAll();
     Patient.DeleteAll();
 }
Esempio n. 12
0
 public ERTable(Patient p)
 {
     Patient = p;
     ETC     = p.TimeForProcedure + Hospital.CurrentTime;
 }
Esempio n. 13
0
        override public void OutAct()
        {
            SetTCurrForChannels();
            Quantity++;
            HospitalChannel hospitalChannel = GetChannelByTNext();

            Patient patient = hospitalChannel.CurrentPatient;

            Console.WriteLine("Out " + this.Name + ", Patient number " + patient.Index + "  Type = " + patient.PatientType.Name);
            hospitalChannel.CurrentPatient = null;
            hospitalChannel.OutAct();

            base.TNext = GetTNext();

            if (CheckFreeChannels() == true)
            {
                base.State = 0;
            }

            if (this.Queue > 0 && CheckFreeChannels() == true)
            {
                Queue--;

                HospitalChannel hospitalChannel1 = GetFreeChannel();
                hospitalChannel1.CurrentPatient = GetPatientFromQueue();
                hospitalChannel1.InAct();

                if (CheckFreeChannels() == false)
                {
                    base.State = 1;
                }
                base.TNext = GetTNext();
            }

            if (patient.PatientType.Name == "PatientType2")
            {
                Console.WriteLine("Patient number " + patient.Index + " has left the hospital");
                patient.finishTime   = TCurr;
                patient.timeInterval = patient.finishTime - patient.startTime;
                Patients.Add(new Patient()
                {
                    Index = patient.Index, PatientType = patient.PatientType, startTime = patient.startTime, finishTime = patient.finishTime, timeInterval = patient.timeInterval
                });
            }
            else
            {
                HospitalMassServiceSystem nextProcess = NextMss.Where(x => x.Name == "GO TO EMERGENCY ROOM").First();
                patient.finishTime   = TCurr;
                patient.timeInterval = patient.finishTime - patient.startTime;
                Patients.Add(new Patient()
                {
                    Index = patient.Index, PatientType = patient.PatientType, startTime = patient.startTime, finishTime = patient.finishTime, timeInterval = patient.timeInterval
                });

                Patient newPatient = new Patient
                {
                    PatientType = new PatientType
                    {
                        Name           = "PatientType1",
                        Frequency      = 0.5,
                        AvRegisterTime = 15
                    }
                };


                nextProcess.CurrentPatient = newPatient;

                nextProcess.InAct();
            }
        }
        public Patient SearchPatients(string name)
        {
            Data patientObject = fileWriter.FindDataObject(name);
            Patient patient = new Patient(patientObject.contactInformation, patientObject.symptom, patientObject.insurance, this.SearchDoctors(patientObject.doctor), patientObject.appointment.Time.Date, patientObject.appointment.Time.TimeOfDay);

            return patient;
        }
Esempio n. 15
0
 partial void UpdatePatient(Patient instance);
 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);
     }
 }
Esempio n. 17
0
 partial void DeletePatient(Patient instance);
 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);
 }
Esempio n. 19
0
        private void new_accnt_btn_Click(object sender, EventArgs e)
        {
            string    imageName = DateTime.Now.ToString("yyyyMMddssHHmm") + img.SafeFileName;
            WebClient webclient = new WebClient();
            string    path      = @"C:\Users\Dr.Rashad\source\repos\Hospital\Hospital\Upload\" + imageName;

            webclient.DownloadFile(img.FileName, path);
            int     title_id   = db.Titles.Where(t => t.Title_name == comboBoxTitle.Text).First().Id;
            int     mr_st_id   = db.Marital_Statuses.Where(t => t.Marital_status_name == marital_status.Text).First().Id;
            int     st_org_id  = db.State_of_origins.Where(t => t.State_of_origin_name == stateof_origin.Text).First().Id;
            int     rel_id     = db.Religions.Where(t => t.Religion_name == religion.Text).First().Id;
            int     occ_id     = db.Occupations.Where(t => t.Occupation_name == occupation.Text).First().Id;
            int     card_id    = db.Card_Types.Where(t => t.Card_type_name == card_type.Text).First().Id;
            int     rel_st_org = db.State_of_origins.Where(r => r.State_of_origin_name == rel_stateof_origin.Text).First().Id;
            int     relation   = db.Next_of_kins.Where(r => r.Kin_fullname == relat.Text).First().Id;
            Patient ptnt       = new Patient();

            ptnt.Patient_title_id   = title_id;
            ptnt.Patient_firstname  = firstname.Text;
            ptnt.Patient_middlename = middlename.Text;
            ptnt.Patient_surname    = surname.Text;
            string value     = "";
            bool   isChecked = male_btn.Checked;

            if (isChecked)
            {
                value = male_btn.Text;
            }
            else
            {
                value = female_btn.Text;
            }
            ptnt.Patient_gender            = value;
            ptnt.Patient_marital_status_id = mr_st_id;
            ptnt.Patient_dateof_birth      = dateof_birth.Value;
            ptnt.Patient_stateof_origin_id = st_org_id;
            ptnt.Patient_tribe             = tribe.Text;
            ptnt.Patient_religion_id       = rel_id;
            ptnt.Patient_occupation_id     = occ_id;
            ptnt.Patient_permanent_address = perm_address.Text;
            ptnt.Patient_home_address      = home_address.Text;
            ptnt.Patient_phone             = phone.Text;
            ptnt.Patient_account_no        = Convert.ToInt32(account_no.Text);
            ptnt.Patient_photo             = imageName;
            ptnt.Patient_file         = file_nmbr.Text;
            ptnt.Patient_card_type_id = card_id;
            ptnt.Patient_status       = checkBoxEdit.Checked;
            ptnt.Patient_relation_id  = relation;
            Next_of_kins next = new Next_of_kins();

            next.Kin_fullname = rel_fullname.Text;
            string kvalue      = "";
            bool   k_isChecked = rel_male_btn.Checked;

            if (isChecked)
            {
                value = rel_male_btn.Text;
            }
            else
            {
                value = rel_female_btn.Text;
            }
            next.Kin_gender              = kvalue;
            next.Kin_stateof_origin_id   = rel_st_org;
            next.Kin_phone               = rel_phone.Text;
            next.Kin_address             = rel_address.Text;
            next.Kin_relation_of_patient = rel_of_patient.Text;
            db.Patients.Add(ptnt);
            db.Next_of_kins.Add(next);
            db.SaveChanges();
        }