def add_appointment_result(): print 'which appointment?' appointment_list = get_appointment_list() print_dict_list(appointment_list) print 'which appointment?: ' appointment = make_a_selection(appointment_list) diagnosis = create_diagnosis(appointment) insert_diagnosis(diagnosis) prescription = create_prescription(diagnosis) insert_prescription(prescription)
def create_prescription(diagnosis): prescription = {'Diagnosis_Id': diagnosis['Diagnosis_Id']} # choose medication print 'which medication?' prescription['ISDN'] = make_a_selection(get_medication_list())['ISDN'] while True: try: quantity_str = raw_input('quantity of the medication(integer): ') prescription['Quantity'] = int(quantity_str) break except ValueError as e: print e.message while True: try: dose_str = raw_input('dose of the medication(float): ') prescription['Prescribed_Dose'] = float(dose_str) break except ValueError as e: print e.message prescription['Frequency'] = raw_input('frequency of the medication: ') prescription['Pharmacy_Id'] = make_a_selection(get_pharmacy_list())['Pharmacy_Id'] return prescription
def create_person(): # get basic info person = {} while True: try: fname = raw_input('please input first name: ') if fname == '': raise Exception('first name cannot be empty') person['First_Name'] = fname break except Exception as e: print e.message while True: try: lname = raw_input('please input last name: ') if lname == '': raise Exception('last name cannot be empty') person['Last_Name'] = lname break except Exception as e: print e.message while True: try: date_of_birth_str = raw_input('please input date of birth(yyyy/mm/dd): ') person['Date_Of_Birth'] = datetime.datetime.strptime(date_of_birth_str, '%Y/%m/%d').date() break except ValueError as e: print e.message while True: try: deceased = raw_input('is this person deceased?(Y/N) ') deceased = deceased.upper() if deceased != 'Y' and deceased != 'N': raise Exception('please input Y or N') person['Deceased'] = deceased break except Exception as e: print e.message # select primary physician print 'select a primary physician for this person' person['Primary_Physician'] = make_a_selection(get_doctor_list())['Doctor_Id'] # print person['First_Name'], person['Last_Name'], person['Date_Of_Birth'], person['Deceased'] print 'a summary of this person:' print_dict_list([person]) return person
def create_insurance_coverage(person_id): insurance_coverage = {} while True: try: date_str = raw_input('please input start date of insurance coverage(yyyy/mm/dd): ') insurance_coverage['Coverage_Start_Date'] = datetime.datetime.strptime(date_str, '%Y/%m/%d').date() break except ValueError as e: print e.message while True: try: date_str = raw_input('please input end date of insurance coverage(yyyy/mm/dd): ') insurance_coverage['Coverage_End_date'] = datetime.datetime.strptime(date_str, '%Y/%m/%d').date() break except ValueError as e: print e.message # select insurer print 'which inserer?' insurance_coverage['Insurer_Id'] = make_a_selection(get_insurer_list())['Insurer_Id'] insurance_coverage['Person_Id'] = person_id print 'a summary of insurance coverage' print_dict_list([insurance_coverage]) return insurance_coverage
def create_pharmacy_designation(person_id): pharmacy_designation = {} print 'which pharmacy?' pharmacy_designation['Pharmacy_Id'] = make_a_selection(get_pharmacy_list())['Pharmacy_Id'] pharmacy_designation['Patient_Id'] = person_id return pharmacy_designation