def addnewBioEntry(self, data): """add new DB entry""" query = """ insert into patient.patient (file_number, surname, first_names, birth_date, gender, nationalid, nationality, note, callname, language, occupation, marital_status, ethnicity, employer) values(%(file_number)d, '%(surname)s', '%(first_names)s', '%(birth_date)s', '%(gender)s', '%(nationalid)s', '%(nationality)s', '%(note)s', '%(callname)s', '%(language)s', '%(occupation)s', '%(marital_status)s', '%(ethnicity)s', '%(employer)s') """ % data # print query try: cursor = self.conn.cursor() cursor.execute(query) self.conn.commit() except psycopg.IntegrityError, x: msg = "Failed to Add entry,\nFile Number %d already in use" % data['file_number'] from Dialogs.Utils import displayMessage displayMessage(msg) BARWRITER.write(msg) return
def __new(self, evt): """ new note for today""" # veto if one already exists st = time.strftime("%Y%m%d", time.gmtime()) if self.visitListCtrl.FindString(st) > -1 or self.visitListCtrl.FindString("*"+st) > -1: displayMessage("A visit for today already exists") return st = st + '-NEW' # old and busted self.visits[self.currentdate] = self.note.GetValue() self.note.Clear() self.visitListCtrl.InsertItems([st], 0) self.visitListCtrl.SetSelection(0) self.visits[st] = "" self.noteLabel.SetLabel("Note for visit at %s" % st) self.currentdate = st
def __saveData(self, evt): """ save the data""" if not self.visits: displayMessage("Nothing Selected") return curval = self.visitListCtrl.GetStringSelection() self.visits[curval] = self.note.GetValue() print self.visits # only work with visits data = {} if self.file_number: for k, v in self.visits.items(): if k[0] == "*": data[k[1:]] = v CONN.saveVisits(self.file_number, data) self.reload()