def test_inherit_form(): instance = student.Student() s = instance.eat() instance = teacher.Teacher() t = instance.eat() instance = doctor.Doctor() d1 = instance.eat() d2 = instance.other() return '''<h3>%s</h3> <h3>%s</h3> <h3>%s But %s</h3>''' % (s, t, d1, d2)
def logowanie(self): statements.Stat.log_in() funkcja = input().upper() if funkcja == 'D': print('Logging to doctor\'s account') pesel = input("Enter PESEL number: ") haslo = input("Enter password: "******"Select * from lekarze where pesel_lek = %s and haslo_lek = %s", (pesel, haslo)) results_lekarze = self.kursor.fetchall() if (len(results_lekarze) == 1): print("Login succeeded") doctor.Doctor(pesel, self.kursor, self.polaczenie) else: print("Wrong PESEL number or password") self.logowanie() elif funkcja == 'P': print('Logging to patient account') pesel = input("Enter PESEL number: ") haslo = input("Enter password: "******"Select * from pacjenci where pesel = %s and haslo = %s", (pesel, haslo)) results_pacjenci = self.kursor.fetchall() if (len(results_pacjenci) == 1): print("Login Succeeded") patient.Patient(pesel, self.kursor, self.polaczenie) print("Program closed") else: print("Wrong PESEL number or password") self.logowanie() elif funkcja == 'X': print("Program closed") else: print("Entered data do not exist. Please try again. ") self.logowanie()
def csv_dict_reader(path): with open(path, 'r') as file_obj: childs = list() reader = csv.DictReader(file_obj, delimiter=',') for line in reader: tempDoc = doctor.Doctor(line["doctor_first_name"], line["doctor_last_name"], line["doctor_middle_name"]) doctors.append(tempDoc) for doc in doctors: if doc.doctor_first_name == tempDoc.doctor_first_name and doc.doctor_last_name == tempDoc.doctor_last_name and doc.doctor_middle_name == tempDoc.doctor_middle_name and tempDoc != doc: doctors.remove(tempDoc) tempDoc = doc break # print(line["child_first_name"]), childs.append( patient.Patient( line["mother_first_name"], line["mother_last_name"], line["mother_middle_name"], line["father_first_name"], line["father_last_name"], line["father_middle_name"], line["child_first_name"], line["child_last_name"], line["child_middle_name"], line["age"], tempDoc)) return childs
def create_new_doctor(self): new_doctor = doctor.Doctor() self.controller.show_frame(2) self.controller.frames[2].set_current_doctor(new_doctor)
import bata import doctor import os nro_talla=os.sys.argv[1] nombre_doctor=os.sys.argv[2] t1=bata.Bata(nro_talla,5,150,"A20N","algodon") d1=doctor.Doctor(nombre_doctor,t1,"masculino",20,2000) print("talla:"+t1.getTalla()) print("doctor:"+d1.getNombre()) d1.setBata(t1) print(d1.curar())
записи всей информации в него (в том числе пациентов врачей и графика работы медсестер). Предусмотреть хотя бы в 3 местах обработку возможных исключений. В каждом модуле провести подробное тестирование всех создаваемых объектов и функций. """ import doctor import nurse import hospital import pickle file = open("logs.txt", 'w') file.close() doctors = [] nurses = [] doctor1 = doctor.Doctor('Александр', 'Иванов', 35, 1, "Хирург") doctor1.list_update({11112: 'Коннов'}) doctor1.list_update({11113: 'Иванов'}) doctor1.list_update({11114: 'Смирнов'}) doctor2 = doctor.Doctor('Максим', 'Смирнов', 30, 2, 'Терапевт') doctor2.list_update({11115353: 'Ивашин'}) nurse1 = nurse.Nurse('Анна', 'Иванова', 20, 1, 'Хирургия') nurses.append(nurse1) nurse1.update_work_schedule({'понедельник': '9:00-15:00', 'Среда': '15:00-21:00'}) nurse2 = nurse.Nurse('Елена', 'Кудоявцева', 22, 2, 'Гинекология') nurses.append(nurse2) nurse2.update_work_schedule({'Вторник': '9:00-15:00', 'Пятница': '9:00-15:00'}) hospital1 = hospital.Hospital('Больница №1', 'Гагарина 7', doctors, nurses) hospital1 + doctor1
list = csv_dict_reader("input.csv") childs = ChildrenList(list) write_csv("output.csv", childs.create_csv_data()) doc = input("Enter surname of doctor to find: ") for i in doctors: if i.doctor_last_name == doc: print("List of patients of doctor", i.doctor_last_name, i.doctor_first_name) for j in i.patients: print(j.child_last_name, j.child_first_name) print( "Enter new patient Full name, his/her parents Full name, his/her doctor and age" ) info = input().split(',') tempDoc = doctor.Doctor(info[9], info[10], info[11]) doctors.append(tempDoc) for doc in doctors: if doc.doctor_first_name == tempDoc.doctor_first_name and doc.doctor_last_name == tempDoc.doctor_last_name and doc.doctor_middle_name == tempDoc.doctor_middle_name and tempDoc != doc: doctors.remove(tempDoc) tempDoc = doc isNewDoc = False childs.addChild( patient.Patient(info[0], info[1], info[2], info[3], info[4], info[5], info[6], info[7], info[8], info[12], tempDoc)) write_csv("output.csv", childs.create_csv_data())
def main(): """Define a general Doctor""" doctor_only = doctor.Doctor("Dr. General Practice", "555-567-1234", "*****@*****.**", "Sugar Land, TX", "Medicare and CHIP", 40) """Define the Surgeons""" surgeon_1 = \ doctor.Surgeon("Dr. Olu Joseph", "555-555-1111", "*****@*****.**", "Crosby, TX", "BBB Net Insurance", 20) surgeon_1.set_speciality("Plastic Surgery") surgeon_1.set_accepting_patients("yes") surgeon_1.set_available_time('Monday 4:00 pm', 'Tuesday 5:00 pm', 'Friday 10:00 am') surgeon_2 = doctor.Surgeon("Dr. Stephanie Yue Tian", "555-281-6666", "*****@*****.**", "Sheppard, TX", "Blue Monkey Insurance", 10) surgeon_2.set_speciality("Pediatric Surgery") surgeon_2.set_accepting_patients("Yes") surgeon_2.set_available_time("None") surgeon_3 = doctor.Surgeon("Dr. Sam Jon", "555-555-2222", "*****@*****.**", "Orange, TX", "Etna Insurance", 8) surgeon_3.set_speciality("General Surgery") surgeon_3.set_accepting_patients('yes') surgeon_3.set_available_time('Monday 8:00 am - 4:00 pm', 'Tuesday 8:00 am - 4:00 pm') """Define the Pediatricians""" pediatrician_1 = \ doctor.Pediatrician("Dr. Jay Joseph", "555-555-3333", "*****@*****.**", "Applewood, TX", "BBB Net Insurance", 30) pediatrician_1.set_speciality("Pediatric Oncology") pediatrician_1.set_accepting_patients("yes") pediatrician_1.set_available_time('Monday 4:00 pm', 'Tuesday 5:00 pm', 'Friday 10:00 am') pediatrician_2 = doctor.Pediatrician("Dr. Raj Joseph", "555-281-9999", "*****@*****.**", "Woodway, TX", "Red Insurance", 5) pediatrician_2.set_speciality("Pediatric Surgery") pediatrician_2.set_accepting_patients("no") pediatrician_2.set_available_time("None") pediatrician_3 = doctor.Pediatrician("Dr. Keyandi Aamir Amin", "555-555-8888", "*****@*****.**", "Houston, TX", "Medicare", 15) pediatrician_3.set_speciality("Pediatric General Practice") pediatrician_3.set_accepting_patients("yes") pediatrician_3.set_available_time('Monday 8:00 am - 4:00 pm', 'Tuesday 8:00 am - 4:00 pm', 'Friday 7:00 am - noon') """Add a menu here for user to select a Surgeon or Pediatrician""" print("Welcome to DocFind\n") while True: try: doc_type = int( input( "Please enter in \n1 " "for General Practice Doctor\n2 for Surgeon \n3 for Pediatrician\n" )) if 0 < doc_type <= 3: break print("Invalid number entered.") except Exception as e: print(e) if doc_type == 1: print("DOCTORS") print("_______") print(doctor_only) elif doc_type == 2: print("SURGEONS") print("________") print(surgeon_1) print(surgeon_2) print(surgeon_3) elif doc_type == 3: print("PEDIATRICIANS") print("_____________") print(pediatrician_1) print(pediatrician_2) print(pediatrician_3)
pat = patient.Patient(p_name, p_age, p_height, p_weight) print(pat) print('We have your history {}'.format(pat.history)) else: print('Welcome to CARLTON HOSPITAL.') pat = patient.Patient(p_name, p_age, p_height, p_weight) print(pat) print('This is your first time here') break elif visitor[0].lower() == 'd': while True: vis_id = input('What is your name? ') if vis_id.upper() in doc_on_call: doctor.Doctor(vis_id) print('Welcome back doctor') break else: print('You are not a doctor in CARLTON HOSPITAL') break else: print('We only help patients and doctors') # Doctors office nurse_request = input('Doctor should we send the patients in? (Y or N) ') if nurse_request[0].lower() == 'y': print('Okay, Let me send them in one by one') doctor.Doctor('JAMES').patients.append(pat) doctor.Doctor('POGBA').patients.append(pat)