def delete(self, pid): try: conn.execute("DELETE FROM patient WHERE id=?", (pid, )) conn.commit() except sqlite3.Error as e: return {'err': 'Appointment Exist'} return {'msg': 'sucessfully deleted'}
def post(self): appointment = request.get_json(force=True) pat_id = appointment['pat_id'] doc_id = appointment['doc_id'] appointment_date = appointment['appointment_date'] appointment['app_id'] = conn.execute('''INSERT INTO appointment(pat_id,doc_id,date) VALUES(?,?,?)''', (pat_id, doc_id,appointment_date)).lastrowid conn.commit() return appointment
def put(self, did): data = request.get_json(force=True) first_name = data['first_name'] last_name = data['last_name'] address = data['address'] mb_no = data['mb_no'] speciality = data['speciality'] conn.execute( "UPDATE doctor SET first_name=?, last_name=?, mb_no=?, address=?, speciality=? WHERE id=?", (first_name, last_name, mb_no, address, speciality, did)) conn.commit() return data
def post(self): data = request.get_json(force=True) first_name = data['first_name'] last_name = data['last_name'] address = data['address'] mb_no = data['mb_no'] speciality = data['speciality'] data['id'] = conn.execute( "INSERT INTO doctor (first_name, last_name, mb_no, address, speciality) VALUES (?,?,?,?,?)", (first_name, last_name, mb_no, address, speciality)).lastrowid conn.commit() return data
def put(self, pid): data = request.get_json(force=True) first_name = data['first_name'] last_name = data['last_name'] insurance_no = data['insurance_no'] address = data['address'] mb_no = data['mb_no'] disease = data['disease'] conn.execute( "UPDATE patient SET first_name=?, last_name=?, insurance_no=?, mb_no=?, address=?, disease=? WHERE id=?", (first_name, last_name, insurance_no, mb_no, address, disease, pid)) conn.commit() return data
def post(self): data = request.get_json(force=True) first_name = data['first_name'] last_name = data['last_name'] insurance_no = data['insurance_no'] address = data['address'] mb_no = data['mb_no'] disease = data['disease'] data['id'] = conn.execute( "INSERT INTO patient (first_name, last_name, insurance_no, mb_no, address, disease) VALUES (?,?,?,?,?,?)", (first_name, last_name, insurance_no, mb_no, address, disease)).lastrowid conn.commit() return data
def delete(self,aid): conn.execute("DELETE FROM appointment WHERE id=?",(aid,)) conn.commit(); return {'msg': 'sucessfully deleted'}