def OnSign(self, event): #check to see if note has already been signed checkQry = 'SELECT stamp FROM notes WHERE patient_ID = "%s" AND date = "%s";' % (self.PtID, self.textctrl['Date'].GetValue()) nullCheck = EMR_utilities.getData(checkQry) try: if nullCheck[0]: wx.MessageBox('Note has already been signed.', 'Message') else: #get user prnt = wx.GetTopLevelParent(self) userQry = EMR_utilities.getData('SELECT full_name FROM users WHERE user_name = "%s";' % prnt.user) #add signed text at bottom of note note = self.soapNote.GetValue() + '\n\n' + 'ELECTRONICALLY SIGNED BY %s ON %s' % (userQry[0], str(EMR_utilities.dateToday(t='sql'))) #use timestamper cli = timestamping.ts_client.TimeStampClient('http://198.199.64.101:8000') data = str(self.PtID) + note + self.textctrl['Date'].GetValue() val = cli.stamp(data) #update the record for that note to include utctime and stamp noteQry = 'UPDATE notes SET soap = %s, utctime = %s, stamp = %s WHERE patient_ID = %s AND date = %s' values = (note, val['utctime'], val['stamp'], self.PtID, self.textctrl['Date'].GetValue()) EMR_utilities.valuesUpdateData(noteQry, values) self.listctrl.Set("") self.loadList() except: # catch *all* exceptions e0 = sys.exc_info()[0] e1 = sys.exc_info()[1] wx.MessageBox("Error: %s, %s" % (e0, e1))
def OnSave(self, event): if self.textctrl['ICD #1'].GetValue(): #look to see which note is being saved, new vs old prnt = wx.GetTopLevelParent(self) if self.newsoapNote.IsShownOnScreen(): qry = 'INSERT INTO notes (patient_ID, soap, date, icd1, icd2, icd3, icd4, icd5, \ icd6, icd7, icd8, icd9, icd10, not_billable, user) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)' values = (self.PtID, self.newsoapNote.GetValue(), EMR_utilities.strToDate(self.textctrl['Date'].GetValue()), self.textctrl['ICD #1'].GetValue(), self.textctrl['ICD #2'].GetValue(), self.textctrl['ICD #3'].GetValue(), self.textctrl['ICD #4'].GetValue(), self.textctrl['ICD #5'].GetValue(), self.textctrl['ICD #6'].GetValue(), self.textctrl['ICD #7'].GetValue(), self.textctrl['ICD #8'].GetValue(), self.textctrl['ICD #9'].GetValue(), self.textctrl['ICD #10'].GetValue(),self.not_billable, prnt.user) EMR_utilities.valuesUpdateData(qry, values) else: #check to see if note has already been signed checkQry = 'SELECT stamp FROM notes WHERE patient_ID = "%s" AND date = "%s";' % (self.PtID, self.textctrl['Date'].GetValue()) nullCheck = EMR_utilities.getData(checkQry) if nullCheck[0]: wx.MessageBox('No changes allowed; note has already been signed.', 'Message') else: qry = 'UPDATE notes SET soap = %s, user = %s WHERE patient_ID = %s AND date = %s' values = (self.soapNote.GetValue(), prnt.user, self.PtID, self.textctrl['Date'].GetValue()) EMR_utilities.valuesUpdateData(qry, values) self.listctrl.Set("") self.loadList() self.textctrl['Date'].SetValue("") self.soapNote.SetValue("") self.newsoapNote.SetValue("") self.billBtn.Show(True) else: wx.MessageBox('You forgot to enter an ICD-9 Code', 'Grave Mistake!')
def OnSave(self, event): # look to see which note is being saved, new vs old if self.neweducNote.IsShownOnScreen(): qry = "INSERT INTO education (patient_ID, note, date) VALUES (%s, %s, %s)" values = (self.PtID, self.neweducNote.GetValue(), EMR_utilities.strToDate(self.textctrl["Date"].GetValue())) EMR_utilities.valuesUpdateData(qry, values) else: qry = "UPDATE education SET note = %s WHERE patient_ID = %s AND date = %s" values = (self.educNote.GetValue(), self.PtID, self.textctrl["Date"].GetValue()) EMR_utilities.valuesUpdateData(qry, values) self.listctrl.Set("") self.loadList() self.textctrl["Date"].SetValue("") self.educNote.SetValue("") self.neweducNote.SetValue("")
def OnSave(self, event): #look to see which note is being saved, new vs old if self.neweducNote.IsShownOnScreen(): qry = 'INSERT INTO education (patient_ID, note, date) VALUES (%s, %s, %s)' values = (self.PtID, self.neweducNote.GetValue(), EMR_utilities.strToDate( self.textctrl['Date'].GetValue())) EMR_utilities.valuesUpdateData(qry, values) else: qry = 'UPDATE education SET note = %s WHERE patient_ID = %s AND date = %s' values = (self.educNote.GetValue(), self.PtID, self.textctrl['Date'].GetValue()) EMR_utilities.valuesUpdateData(qry, values) self.listctrl.Set("") self.loadList() self.textctrl['Date'].SetValue("") self.educNote.SetValue("") self.neweducNote.SetValue("")