def add_MaT(self): #增加处方 Mno = self.LE_MaTno.text() Mname = self.LE_MaTname.text() num = self.MaTnum.value() if Mno == Mname == "": QMessageBox.about(self, "注意", "请输入药品/治疗名称或编号") elif num == 0: QMessageBox.about(self, "注意", "请输入药品/治疗数量") else: if Mno == "": res = dbo.select(self.db, "Dr_s_Mname_for_Mno_pri", Mname) if res != (): self.LE_MaTno.setText(res[0][0]) Mno = res[0][0] total = num * res[0][1] self.pre.append((Mno, Mname, num, eval(str(total)))) self.show_res(self.pre) else: QMessageBox.about(self, "提示", "系统内暂时无此项目") else: res = dbo.select(self.db, "Dr_s_Mno_for_Mname_pri", Mno) if res != (): self.LE_MaTname.setText(res[0][0]) Mname = res[0][0] total = num * res[0][1] self.pre.append((Mno, Mname, num, eval(str(total)))) self.show_res(self.pre) else: QMessageBox.about(self, "提示", "系统内暂时无此项目")
def search(self):#搜索s if self.MODE == 'MaT': Mno = self.LE_no.text() Mname = self.LE_name.text() if Mno == Mname == '': res = dbo.select(self.db,"pri_n") elif Mno == '': res = dbo.select(self.db,"pri_s_Mname",Mname) elif Mname == '': res = dbo.select(self.db,"pri_s_Mno",Mno) else: res = dbo.select(self.db,"pri_D",Mno,Mname) self.show_res(res) else: Sno = self.LE_no.text() Pno = self.LE_name.text() if Sno == Pno == '': res = dbo.select(self.db,"pri_SP_n") elif Sno == '': res = dbo.select(self.db,"pri_SP_s_Pno",Pno) elif Pno == '': res = dbo.select(self.db,"pri_SP_s_Sno",Sno) else: res = dbo.select(self.db,"pri_SP_D",Sno,Pno) self.show_res(res)
def _search_reg(self): #--------------------waiting for test if self.Sno.text() == "" and self.Sname.text() == "": res = dbo.select(self.db, 'reg_S_reg_n') self.show_res(res) elif self.Sno.text() == "": res = dbo.select(self.db, 'reg_S_reg_s_Sname', self.Sname.text()) self.show_res(res) elif self.Sname.text() == "": res = dbo.select(self.db, 'reg_S_reg_s_Sno', self.Sno.text()) self.show_res(res) else: res = dbo.select(self.db, 'reg_S_reg_D_info', self.Sno.text(), self.Sname.text()) self.show_res(res)
def _search_info(self): if self.Sno.text() == "" and self.Sname.text() == "": res = dbo.select(self.db, 'reg_S_info_n') self.show_res(res) elif self.Sno.text() == "": res = dbo.select(self.db, 'reg_S_info_s_Sname', self.Sname.text()) self.show_res(res) elif self.Sname.text() == "": res = dbo.select(self.db, 'reg_S_info_s_Sno', self.Sno.text()) self.show_res(res) else: res = dbo.select(self.db, 'reg_S_info_D_info', self.Sno.text(), self.Sname.text()) self.show_res(res)
def MaTsearch(self): Mno = self.LE_MaTno_search.text() Mname = self.LE_MaTname_search.text() if Mno == Mname == '': res = dbo.select(self.db, "pri_n") self.show_res_(res) elif Mno == '': res = dbo.select(self.db, "pri_s_Mname", Mname) self.show_res_(res) elif Mname == '': res = dbo.select(self.db, "pri_s_Mno", Mno) self.show_res_(res) else: res = dbo.select(self.db, "pri_D", Mno, Mname) self.show_res_(res)
def search(self, Pno): Sno = self.LE_Sno_search.text() Sname = self.LE_Sname_search.text() if Sno == Sname == "": res = dbo.select(self.db, "fin_n") self.show_res(res, self.TB_Stu_info) elif Sname == "": res = dbo.select(self.db, "fin_s_Sno", Sno) self.show_res(res, self.TB_Stu_info) elif Sno == "": res = dbo.select(self.db, "fin_s_Sname", Sname) self.show_res(res, self.TB_Stu_info) else: res = dbo.select(self.db, "fin_D", Sno, Sname) self.show_res(res, self.TB_Stu_info)
def reitems(self): #刷新CB内的选项 self.CB_Pno.clear() Sno = self.LE_Sno.text() if Sno == "": pass else: res = dbo.select(self.db, "Dr_Sno_to_Pno", Sno) if res == (): pass else: for i in res: self.CB_Pno.addItem(i[0])
def afr(self): Sno = self.LE_Sno_afr.text() mon = eval(self.LE_mon_afr.text()) res = dbo.select(self.db, "fin_s_Sno_to_fins", Sno) if res == (): QMessageBox.warning(self, "错误", "学生不存在!") elif res[0][-2] < mon: QMessageBox.warning(self, "错误", "报销金额过多!") else: ret = (res[0][0:-1], res[0][-1] + mon) a = dbo.update(self.db, "afr", ret)
def payone(self):#单独付费 n = self.tableWidget.currentRow() res_ = dbo.select(self.db,"fin_s_Sno_to_fins",self.res[n][0]) if res_ == (): QMessageBox.warning(self,"错误","无此学生!") dbo.update(self.db,"Stu_fin",res_[0][0],res_[0][2]-self.res[n][-2],res_[0][3]+self.res[n][-2]) a = dbo.update(self.db,"pri_onepay",self.res[n][0]) if a == 0: QMessageBox.about(self,"success","缴费成功") print(2) pass
def refresh(self): #刷新对应的诊疗记录 Sno = self.LE_Sno.text() Pno = self.CB_Pno.currentText() res = dbo.select(self.db, "Dr_D_Sno_Pno_for_sym_res", Sno, Pno) if res == ((None, None), ): self.TE_sym.setPlainText("请在这里书写") self.TE_res.setPlainText("请在这里书写") self.TE_sym.setReadOnly(False) self.TE_res.setReadOnly(False) else: self.TE_sym.setPlainText(res[0][0]) self.TE_res.setPlainText(res[0][1]) self.TE_sym.setReadOnly(True) self.TE_res.setReadOnly(True)
def cha_or_add(self): M_name = self.LE_MaTname.text() M_no = self.LE_MaTno.text() if M_name == M_no == "": self.B_MaT_CaA.setText("添加") self.M_Mode = "add" return if M_no == '': return else: res = dbo.select(self.db,"pri_s_Mno",M_no) if res == (): self.B_MaT_CaA.setText("添加") self.M_Mode = 'add' else: self.B_MaT_CaA.setText("修改") self.M_Mode = 'cha'
def MaT_CaA(self):#添加或修改药物 self.statusbar.showMessage("Working") M_name = self.LE_MaTname.text() M_no = self.LE_MaTno.text() M_pri = self.DSB_MaTpri.value() if self.M_Mode == "add": if M_no == '': QMessageBox.warning(self,"信息缺失","请输入药物/治疗编码") elif M_no[0] not in ['M','T']: QMessageBox.warning(self,"信息错误","药物/医疗编码编码应以M/T开头") elif M_name == '': QMessageBox.warning(self,"信息缺失","请输入药物/治疗名称") else: a = dbo.insert(self.db,"MaT",(M_no,M_name,M_pri)) if a == 0: QMessageBox.about(self,"success","加入药物/治疗成功") else: QMessageBox.warning(self,"fail","加入药物/治疗失败") else: if M_no == '': QMessageBox.warning(self,"信息缺失","请输入药物/治疗编码") return else: res = dbo.select(self.db,"pri_s_Mno",M_no) if M_name == '': self.LE_MaTname.setText(res[0][1]) M_name = res[0][1] reply = QMessageBox.question(self,'确认',"是否确认修改?",QMessageBox.No|QMessageBox.Yes,QMessageBox.No) if reply == QMessageBox.No: pass else: a = dbo.update(self.db,"MaT",M_no,M_name,M_pri) if a == 0: QMessageBox.about(self,"success","修改药物/治疗成功") else: QMessageBox.warning(self,"fail","修改药物/治疗失败") self.statusbar.showMessage("Ready") return
def register(self): self.statusBar.showMessage('Working') Sno = self.Sno_2.text() Sname = self.Sname_2.text() collage = self.collage.currentText() Age = self.Age.value() indent = self.indent.currentText() MT = self.MT.currentText() if Sno == '': QMessageBox.warning(self, "Warnning", "请输入学号!", QMessageBox.Yes) #空学号 self.statusBar.showMessage('Ready') return res = dbo.select(self.db, "reg_S_info_s_Sno", Sno) if res == (): #未知学号 if Sname == '': QMessageBox.warning(self, "提示", "创建新学生请输入姓名", QMessageBox.Yes) return else: reply = QMessageBox.question(self, "创建", "是否创建新学生?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply == QMessageBox.Yes: a = dbo.insert(self.db, "Stu_info", (Sno, Sname, Age, collage, indent, MT)) if a == 0: QMessageBox.about(self, "success", "创建完成") else: QMessageBox.warning(self, "fail", "创建失败") else: if Sname == "": #自动补全 self.Sname_2.setText(res[0][1]) Sname = res[0][1] if res[0][1:] != (Sname, Age, collage, indent, MT): reply = QMessageBox.question(self, "提示", "信息冲突,是否更新信息?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply == QMessageBox.No: self.statusBar.showMessage('Ready') return else: dbo.update(self.db, "reg_info_update", (Sno, Sname, Age, collage, indent, MT)) self._register({ "Sno": Sno, 'Sname': Sname, 'collage': collage, "Age": Age, "indent": indent, "MT": MT }) else: self._register({ "Sno": Sno, 'Sname': Sname, 'collage': collage, "Age": Age, "indent": indent, "MT": MT })