def tb_bind(self, event):
     id_ = None
     for item in self.tb.selection():
         item_text = self.tb.item(item, "values")
         id_ = item_text[0]
     if id_:
         session = DBSession()
         try:
             p: Patient = session.query(Patient).filter_by(id=id_).first()
             session.delete(p)
             session.commit()
         except:
             messagebox.showerror('错误', '该病人已被其他关系绑定')
         session.close()
     self.refresh_table()
Ejemplo n.º 2
0
 def tb_bind(self, event):
     id_ = None
     for item in self.tb.selection():
         item_text = self.tb.item(item, "values")
         id_ = item_text[0]
     if id_:
         session = DBSession()
         try:
             o: Office = session.query(Office).filter_by(id=id_).first()
             session.delete(o)
             session.commit()
         except:
             messagebox.showerror('错误', '该科室已被病房或医生绑定')
         session.close()
     self.refresh_table()