public static void InitializePatients() { List <Patient> patientList = HospitalDB.FetchPatients(); foreach (Patient patient in patientList) { // Assigning Patient's Doctors List <String> doctorsIDs = HospitalDB.FetchPatientDoctors(patient.ID); foreach (String doctorID in doctorsIDs) { patient.assignDoctor((Doctor)Employees[doctorID]); ((Doctor)Employees[doctorID]).addPatient(patient); } if (patient.GetType() == typeof(ResidentPatient)) { // Fetching Patient's Department String departmentID = HospitalDB.FetchPersonDepartment(patient.ID); if (Departments.ContainsKey(departmentID)) { ((ResidentPatient)patient).Department = Departments[departmentID]; Departments[departmentID].Patients.Add(patient.ID, patient); } // Fetching Patient's Room from Database String roomID = HospitalDB.FetchPatientRoom(patient.ID); if (Rooms.ContainsKey(roomID)) { Rooms[roomID].addPatient(patient); ((ResidentPatient)patient).Room = Rooms[roomID]; // Assigning Patients to Nurses in the Same Room foreach (Nurse nurse in Rooms[roomID].Nurses.Values) { nurse.addPatient(patient); } } // Fetching Patient's Medicine from Database List <Medicine> medicineList = HospitalDB.FetchMedicine(patient.ID); foreach (Medicine medicine in medicineList) { ((ResidentPatient)patient).addMedicine(new Medicine { ID = medicine.ID, Name = medicine.Name, StartingDate = medicine.StartingDate, EndingDate = medicine.EndingDate }); } } Patients.Add(patient.ID, patient); } }
public static void InitializeEmployees() { List <Doctor> doctorList = HospitalDB.FetchDoctors(); foreach (Doctor doctor in doctorList) { // Fetching Doctor's Department String departmentID = HospitalDB.FetchPersonDepartment(doctor.ID); // Assigning Doctor to his Department if (Departments.ContainsKey(departmentID)) { doctor.Department = Departments[departmentID]; Departments[departmentID].addDoctor(doctor); // Checking if the Doctor is the Department's Head if (doctor.IsHead) { Departments[departmentID].HeadID = doctor.ID; } } Employees.Add(doctor.ID, doctor); } List <Nurse> nurseList = HospitalDB.FetchNurses(); foreach (Nurse nurse in nurseList) { // Fetching Nurse's Department String departmentID = HospitalDB.FetchPersonDepartment(nurse.ID); // Assigning Nurse to her Department if (Departments.ContainsKey(departmentID)) { nurse.Department = Departments[departmentID]; Departments[departmentID].addNurse(nurse); } // Fetching Nurse's Rooms List <String> roomsID = HospitalDB.FetchNurseRooms(nurse.ID); // Assigning Nurses to their Rooms foreach (String roomID in roomsID) { nurse.addRoom(Rooms[roomID]); Rooms[roomID].addNurse(nurse); } Employees.Add(nurse.ID, nurse); } }
/// <summary> /// 获取部门列表 /// </summary> /// <param name="agentid">代理商ID</param> /// <returns></returns> public static List <Department> GetDepartments(string agentid) { if (!Departments.ContainsKey(agentid)) { DataTable dt = new OrganizationDAL().GetDepartments(agentid); List <Department> list = new List <Department>(); foreach (DataRow dr in dt.Rows) { Department model = new Department(); model.FillData(dr); list.Add(model); } Departments.Add(agentid, list); return(list); } return(Departments[agentid].Where(m => m.Status == 1).ToList()); }