def post(self): """Add the new doctor""" doctorInput = request.get_json(force=True) doc_first_name=doctorInput['doc_first_name'] doc_last_name = doctorInput['doc_last_name'] doc_ph_no = doctorInput['doc_ph_no'] doc_address = doctorInput['doc_address'] doctorInput['doc_id']=conn.execute('''INSERT INTO doctor(doc_first_name,doc_last_name,doc_ph_no,doc_address) VALUES(?,?,?,?)''', (doc_first_name, doc_last_name,doc_ph_no,doc_address)).lastrowid conn.commit() return doctorInput
def put(self,id): """Update the doctor by its id""" doctorInput = request.get_json(force=True) doc_first_name=doctorInput['doc_first_name'] doc_last_name = doctorInput['doc_last_name'] doc_ph_no = doctorInput['doc_ph_no'] doc_address = doctorInput['doc_address'] conn.execute( "UPDATE doctor SET doc_first_name=?,doc_last_name=?,doc_ph_no=?,doc_address=? WHERE doc_id=?", (doc_first_name, doc_last_name, doc_ph_no, doc_address, id)) conn.commit() return doctorInput
def put(self,id): """api to update the patient by it id""" patientInput = request.get_json(force=True) pat_first_name = patientInput['pat_first_name'] pat_last_name = patientInput['pat_last_name'] pat_insurance_no = patientInput['pat_insurance_no'] pat_ph_no = patientInput['pat_ph_no'] pat_address = patientInput['pat_address'] conn.execute("UPDATE patient SET pat_first_name=?,pat_last_name=?,pat_insurance_no=?,pat_ph_no=?,pat_address=? WHERE pat_id=?", (pat_first_name, pat_last_name, pat_insurance_no,pat_ph_no,pat_address,id)) conn.commit() return patientInput
def post(self): """api to add the patient in the database""" patientInput = request.get_json(force=True) pat_first_name=patientInput['pat_first_name'] pat_last_name = patientInput['pat_last_name'] pat_insurance_no = patientInput['pat_insurance_no'] pat_ph_no = patientInput['pat_ph_no'] pat_address = patientInput['pat_address'] patientInput['pat_id']=conn.execute('''INSERT INTO patient(pat_first_name,pat_last_name,pat_insurance_no,pat_ph_no,pat_address) VALUES(?,?,?,?,?)''', (pat_first_name, pat_last_name, pat_insurance_no,pat_ph_no,pat_address)).lastrowid conn.commit() return patientInput
def delete(self, id): """Delete the doctor by its id""" conn.execute("DELETE FROM doctor WHERE doc_id=?", (id,)) conn.commit() return {'msg': 'sucessfully deleted'}
def delete(self,id): """api to delete the patiend by its id""" conn.execute("DELETE FROM patient WHERE pat_id=?",(id,)) conn.commit() return {'msg': 'sucessfully deleted'}
def delete(self, id): """Delete the nurse by its id""" conn.execute("DELETE FROM nurse WHERE nur_id=?", (id, )) conn.commit() return {'msg': 'sucessfully deleted'}
def delete(self, id): """Borra un terapista por ID""" conn.execute("DELETE FROM doctor WHERE doc_id=?", (id, )) conn.commit() return {'msg': 'sucessfully deleted'}
def delete(self, id): """Api que borra un paciente por su ID""" conn.execute("DELETE FROM patient WHERE pat_id=?", (id, )) conn.commit() return {'msg': 'sucessfully deleted'}