Example #1
0
    def __init__(self, pt_ID, amount):
        self.amount = amount
        self.pt_ID = pt_ID
        from reportlab.lib.pagesizes import letter
        from reportlab.pdfgen import canvas

        lt = "%s/EMR_outputs/%s/Other/rcpt-%s.pdf" % (
            settings.LINUXPATH, self.pt_ID,
            EMR_utilities.dateToday('file format'))
        at = "%s/EMR_outputs/%s/Other/rcpt-%s.pdf" % (
            settings.APPLEPATH, self.pt_ID,
            EMR_utilities.dateToday('file format'))
        wt = "%s\EMR_outputs\%s\Other\rcpt-%s.pdf" % (
            settings.WINPATH, self.pt_ID,
            EMR_utilities.dateToday('file format'))
        filename = EMR_utilities.platformText(lt, at, wt)
        canvas = canvas.Canvas(filename, pagesize=letter)
        canvas.setLineWidth(.3)
        canvas.setFont('Helvetica', 12)

        canvas.drawString(
            30, 750, 'PAYMENT FOR MEDICAL SERVICES FOR %s' % self.name_find())
        canvas.drawString(30, 735, 'RENDERED AT BARRON FAMILY MEDICINE')
        canvas.drawString(500, 750, "%s" % EMR_utilities.dateToday())
        canvas.line(480, 747, 580, 747)

        canvas.drawString(275, 725, 'AMOUNT PAID:')
        canvas.drawString(500, 725, "$%s" % self.amount)
        canvas.line(378, 723, 580, 723)

        canvas.drawString(30, 703, 'RECEIVED BY:')
        canvas.line(120, 700, 580, 700)
        canvas.drawString(120, 703, settings.NAME)

        canvas.save()
Example #2
0
    def OnPrintVaccines(self, event):
        obj = self.vaccineList.GetObjects()
        string = ''
        v = []
        for items in obj:
            v.append((items['vaccine'], items['dates'], items['notes']))
        for things in sorted(v):
            string = '%s     %s     %s\n' % \
                            (things[1], things[0], things[2]) + string

        form_lt = "%s/EMR_outputs/Vaccines.html" % settings.LINUXPATH
        form_at = "%s/EMR_outputs/Vaccines.html" % settings.APPLEPATH
        form_wt = "%s\EMR_outputs\Vaccines.html" % settings.WINPATH
        form = open(EMR_utilities.platformText(form_lt, form_at, form_wt), 'r')
        s = form.read()
        form.close()
        dem_data = EMR_utilities.getDictData(
            'SELECT * FROM demographics WHERE patient_ID = %s;' % self.ptID)
        dem_data['string'] = string
        dem_data['date'] = EMR_utilities.dateToday()
        dem_data['name_address'] = EMR_formats.format_address(dem_data)
        script_text = s % (dem_data)
        printer = EMR_utilities.Printer()
        printer.PreviewText(script_text)
        '''path_lt = "%s/EMR_outputs/%s/Orders" % (settings.LINUXPATH, self.ptID)
Example #3
0
 def OnArchMed(self, event):		#need add/edit form pulled up on selected meds, update query, requery meds 
     #open AddEditMed form with selected/checked med filled in
     obj = self.list.GetSelectedObjects()
     for items in obj:
         qry = 'UPDATE meds SET archive = 1 WHERE med_number = %s;' % items['med_number']
         self.list.RemoveObject(items)
         EMR_utilities.updateData(qry)
Example #4
0
    def OnEditPt(self, event):
	self.textctrl['Insurance Co'].SetValue(self.insChoice.GetStringSelection())
	checkBoxes = ''
	if self.adv_dirYesRB.GetValue() == True:
	    checkBoxes = ' adv_dir = "1",'
	elif self.adv_dirNoRB.GetValue() == True:
	    checkBoxes = ' adv_dir = "2",'
	else:
	    checkBoxes = ' adv_dir = "0",'
	if self.proxyBox.IsChecked():
	    checkBoxes = checkBoxes + ' proxy = "1",'
	else:
	    checkBoxes = checkBoxes + ' proxy = "0",'
	if self.marriedBox.IsChecked():
	    checkBoxes = checkBoxes + ' marital_status = "1",'
	else:
	    checkBoxes = checkBoxes + ' marital_status = "0",'
	if self.inactiveBox.IsChecked():
	    checkBoxes = checkBoxes + ' inactive = "1",'
	else:
	    checkBoxes = checkBoxes + ' inactive = "0",'
	qry = 'UPDATE demographics SET' + checkBoxes
	for label, size, field in self.labels:
	    qry = ' '.join([qry, '%s = "%s",' % (field, self.textctrl[label].GetValue())])
	qry = qry.rstrip(',') + ' WHERE patient_ID = %s;' % (self.ptID)
	EMR_utilities.updateData(qry)
Example #5
0
 def OnRemAll(self, event):
     obj = self.allergylist.GetSelectedObjects()
     for items in obj:
         qry = 'DELETE FROM allergies WHERE allergy_number = %s;' % items[
             'allergy_number']
         self.allergylist.RemoveObject(items)
         EMR_utilities.updateData(qry)
Example #6
0
    def __init__(self, pt_ID, amount):
	self.amount = amount
	self.pt_ID = pt_ID
	from reportlab.lib.pagesizes import letter
	from reportlab.pdfgen import canvas
	
	canvas = canvas.Canvas("/home/mb/Desktop/GECKO/EMR_outputs/%s/Other/rcpt-%s.pdf" % \
						(self.pt_ID, EMR_utilities.dateToday()), pagesize=letter)
	canvas.setLineWidth(.3)
	canvas.setFont('Helvetica', 12)
 
	canvas.drawString(30,750,'PAYMENT FOR MEDICAL SERVICES FOR %s' % self.name_find())
	canvas.drawString(30,735,'RENDERED AT BARRON FAMILY MEDICINE')
	canvas.drawString(500,750,"%s" % EMR_utilities.dateToday())
	canvas.line(480,747,580,747)
 
	canvas.drawString(275,725,'AMOUNT PAID:')
	canvas.drawString(500,725,"$%s" % self.amount)
	canvas.line(378,723,580,723)
 
	canvas.drawString(30,703,'RECEIVED BY:')
	canvas.line(120,700,580,700)
	canvas.drawString(120,703,"MICHAEL BARRON MD")
 
	canvas.save()
Example #7
0
    def OnOk(self, event):
	qry = 'INSERT INTO todo SET date = "%s", description = "%s", priority = "%s", category = "%s", memo = "%s", due_date = "%s", complete = "0", patient_ID = %s;' % (self.textctrl['Date'].GetValue(), 
		     self.textctrl['Description'].GetValue(), self.textctrl['Priority'].GetValue(), 
		     self.textctrl['Category'].GetValue(), self.textctrl['Memo'].GetValue(), 
		     self.textctrl['Due Date'].GetValue(), self.PtID)
	EMR_utilities.updateData(qry)	
	EMR_utilities.updateList(todo_find(self.PtID), self.List)
Example #8
0
 def OnDelVaccine(self, event):
     obj = self.vaccineList.GetSelectedObjects()
     for items in obj:
         qry = 'DELETE FROM vaccines WHERE vaccine_number = %s;' % items[
             'vaccine_number']
         self.vaccineList.RemoveObject(items)
         EMR_utilities.updateData(qry)
Example #9
0
 def OnRemProb(self, event):
     obj = self.problist.GetSelectedObjects()
     for items in obj:
         qry = 'DELETE FROM problems10 WHERE problem_number = %s;' % items[
             'problem_number']
         self.problist.RemoveObject(items)
         EMR_utilities.updateData(qry)
Example #10
0
    def OnpRintMed(self, event):
        obj = self.list.GetSelectedObjects()
        string = ''
        for items in obj:
            string = '%s %s\n   take %s %s %s   #%s refills: %s\n\n' % \
                     (items["med_name"],
                      items["dose"],
                      items["number_tablets"],
                      items["route"],
                      items["frequency"],
                      items["number_pills"],
                      items["refills"]) + string
        
	form_lt = "%s/EMR_outputs/Script.html" % settings.LINUXPATH
	form_at = "%s/EMR_outputs/Script.html" % settings.APPLEPATH
	form_wt = "%s\EMR_outputs\Script.html" % settings.WINPATH
        form = open(EMR_utilities.platformText(form_lt, form_at, form_wt), 'r')
	s = form.read()
	form.close()
	dem_data = EMR_utilities.getDictData('SELECT * FROM demographics WHERE patient_ID = %s;' % self.ptID)
	dem_data['string'] = string
	dem_data['date'] = EMR_utilities.dateToday()
	dem_data['name_address'] = EMR_formats.format_address(dem_data)
	script_text = s % (dem_data)
	printer = EMR_utilities.Printer()
	printer.PreviewText(script_text)
	path_lt = "%s/EMR_outputs/%s/Orders" % (settings.LINUXPATH, self.ptID)
	path_at = "%s/EMR_outputs/%s/Orders" % (settings.APPLEPATH, self.ptID)
	path_wt = "%s\EMR_outputs\%s\Orders" % (settings.WINPATH, self.ptID)
	path = EMR_utilities.platformText(path_lt, path_at, path_wt)
	filename = "%s/script%s.html" % (path, EMR_utilities.dateToday(t='file format'))
	f = open(filename, 'w')
	f.write(script_text)
	f.close()	
Example #11
0
    def __init__(self, parent, id, starts_with='ba'):
        wx.Panel.__init__(self, parent, id)

        self.log = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE)
        ptcolumns = (('Patient ID', 95), ('Firstname', 125), ('Lastname', 150),
                     ('Phone', 125), ('SSN', 125), ('DOB', 100))
        patients = name_find(starts_with)
        self.list = EMR_utilities.buildCheckListCtrl(self, ptcolumns, patients)

        vbox = wx.BoxSizer(wx.VERTICAL)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        vbox2 = wx.BoxSizer(wx.VERTICAL)

        buttons = (('Get Record', self.OnGetPt,
                    vbox2), ('Deselect', self.OnDeselectAll, vbox2),
                   ('Patient Info', self.OnApply, vbox2))
        for label, handler, sizer in buttons:
            EMR_utilities.buildOneButton(self, self, label, handler, sizer)
        clock = EMR_utilities.makeClock(self, vbox2)

        vbox.Add(self.list, 2, wx.EXPAND | wx.TOP, 3)
        vbox.Add((-1, 10))
        vbox.Add(self.log, 1, wx.EXPAND)
        vbox.Add((-1, 10))
        hbox.Add(vbox2, 0, wx.RIGHT, 5)
        hbox.Add(vbox, 1, wx.EXPAND)
        hbox.Add((3, -1))

        self.SetSizer(hbox)

        self.Centre()
        self.Show(True)
Example #12
0
def listBilledICD(pt_ID):
    icdList = []
    billedProblems = []
    problems = []
    for i in range(1,11):
        #collect the icd10 codes billed with each note for every note in a given calendar year
        qry = "SELECT icd%d FROM notes INNER JOIN demographics USING (patient_ID) \
                WHERE date LIKE '2015%%' AND patient_ID = %s AND icd%d != '';" % (i,pt_ID,i)
        results = EMR_utilities.getAllData(qry)
	for r in results:
        #create a list from the tuple
	    icdList.append(r)
    #we make a set which eliminates any duplicates
    billedIcdList = set(icdList) #during 2015 some will be icd9 and some icd10
    for part in EMR_utilities.getAllData('SELECT short_des FROM problems10 WHERE patient_ID = %s;' % pt_ID):
        #collects problem names in a list
        problems.append(part[0])
    for item in billedIcdList:
        #gets list of billed problem's descriptions but pulls only icd10
        try:
            des = EMR_utilities.getData('SELECT short_des FROM icd10 WHERE icd10 = "%s";' % item[0])
            billedProblems.append(des[0])
        except: pass
            #print 'Icd %s not found!' % item[0]    #these should be all the icd9 codes billed
    for val in billedProblems:
        #subtracts billed problem's names from the pt's problem list
        if val in problems:
            problems.remove(val)
    EMR_utilities.MESSAGES = EMR_utilities.MESSAGES + 'ICD codes not billed this year:\n\n'
    for x in problems:
        EMR_utilities.MESSAGES = EMR_utilities.MESSAGES + '--' + x + '\n'	    
        EMR_utilities.MESSAGES = EMR_utilities.MESSAGES + '\n\n'
Example #13
0
    def __init__(self, pt_ID, amount):
	self.amount = amount
	self.pt_ID = pt_ID
	from reportlab.lib.pagesizes import letter
	from reportlab.pdfgen import canvas
	
	lt = "%s/EMR_outputs/%s/Other/rcpt-%s.pdf" % (settings.LINUXPATH, self.pt_ID, EMR_utilities.dateToday('file format'))
	at = "%s/EMR_outputs/%s/Other/rcpt-%s.pdf" % (settings.APPLEPATH, self.pt_ID, EMR_utilities.dateToday('file format'))
	wt = "%s\EMR_outputs\%s\Other\rcpt-%s.pdf" % (settings.WINPATH, self.pt_ID, EMR_utilities.dateToday('file format'))
	filename = EMR_utilities.platformText(lt, at, wt)
	canvas = canvas.Canvas(filename, pagesize=letter)
	canvas.setLineWidth(.3)
	canvas.setFont('Helvetica', 12)
 
	canvas.drawString(30,750,'PAYMENT FOR MEDICAL SERVICES FOR %s' % self.name_find())
	canvas.drawString(30,735,'RENDERED AT BARRON FAMILY MEDICINE')
	canvas.drawString(500,750,"%s" % EMR_utilities.dateToday())
	canvas.line(480,747,580,747)
 
	canvas.drawString(275,725,'AMOUNT PAID:')
	canvas.drawString(500,725,"$%s" % self.amount)
	canvas.line(378,723,580,723)
 
	canvas.drawString(30,703,'RECEIVED BY:')
	canvas.line(120,700,580,700)
	canvas.drawString(120,703, settings.NAME)
 
	canvas.save()
Example #14
0
    def EvtSelTmplist(self, event):
	lt = "/home/mb/Desktop/GECKO/wellchild/%s.txt"
	at = ""
	wt = "C:\Documents and Settings\mbarron\My Documents\GECKO\wellchild\%s.txt"
	if event.GetString() == 'generic':
	    gen_note = EMR_formats.note(self.PtID)
	    if wx.GetTopLevelParent(self).nb.GetPage(2).reviewed == 1:
		gen_note = gen_note.replace('Meds', 'Meds(reviewed today)')
		gen_note = gen_note.replace('Allergies', 'Allergies(reviewed today)')
	    self.newsoapNote.SetValue(gen_note)
	    self.not_billable = 0
	elif event.GetString() == 'prenatal':
	    self.newsoapNote.SetValue(EMR_formats.prenatal(self.PtID))
	elif event.GetString() == 'procedure':
	    self.newsoapNote.SetValue(EMR_formats.procedure(self.PtID))
	elif event.GetString() == 'phonecon':
	    self.newsoapNote.SetValue(EMR_formats.phonecon(self.PtID))
	    self.not_billable = 1
	elif event.GetString() == 'well child':
	    choice = wx.GetSingleChoice('What age child?', "", ['Wt Check', '2 month', '4 month', '6 month', '9 month',
		'12 month', '15 month', '18 month', '2 year', '3-4 year', '6-7_yr_old', '7-8 year', '10-11_yr_old', 
		'12-13_yr_old', '9-12 year', '13-15 year'])
	    string = open(EMR_utilities.platformText(lt, at, wt) % choice, 'r')
	    s = string.read()
	    string.close()
	    result = s % (EMR_utilities.getAge(self.PtID), EMR_utilities.getSex(self.PtID), 
		EMR_formats.getVitals(self.PtID, baby=1))
	    self.newsoapNote.SetValue(result)
	    self.not_billable = 0
	else: pass
Example #15
0
def getVitals(ptID, baby=0):
    qry = "SELECT temp, sBP, dBP, pulse, resp, sats, wt, ht FROM vitals WHERE patient_ID = %s AND vitals_date = '%s;'" \
          % (ptID, str(EMR_utilities.dateToday()))
    results = EMR_utilities.getData(qry)
    string = "Vitals: "
    try:
        bmi = format(
            (decimal.Decimal(results[6]) /
             (decimal.Decimal(results[7]) * decimal.Decimal(results[7]))) *
            703, '.1f')
    except:
        bmi = 'not calculated'
    if baby == 0:
        if results == None:
            string = string + "none taken today"
        else:
            string = string + 'T%s %s/%s P%s R%s O2Sats: %s Wt:%s BMI: %s' % (results[0], results[1], results[2], results[3], \
                 results[4], results[5], results[6], bmi)
        return string
    else:
        if results == None:
            string = string + "none taken today"
        else:
            string = string + 'Wt: %s, Length: %s' % (results[6], results[7])
        return string
Example #16
0
def listBilledICD(pt_ID):
    icdList = []
    billedProblems = []
    problems = []
    for i in range(1, 11):
        qry = "SELECT icd%d FROM notes INNER JOIN demographics USING (patient_ID) WHERE date LIKE '2015%%' AND patient_ID = %s AND icd%d != '';" % (
            i, pt_ID, i)
        results = EMR_utilities.getAllData(qry)
        for r in results:
            icdList.append(r)
    billedIcdList = set(icdList)
    for part in EMR_utilities.getAllData(
            'SELECT short_des FROM problems10 WHERE patient_ID = %s;' % pt_ID):
        problems.append(part[0])
    for item in billedIcdList:
        try:
            des = EMR_utilities.getData(
                'SELECT short_des FROM icd10 WHERE icd10 = "%s";' % item[0])
            billedProblems.append(des[0])
        except:
            print 'Icd %s not found' % item[0]
    for val in billedProblems:
        if val in problems:
            problems.remove(val)
    EMR_utilities.MESSAGES = EMR_utilities.MESSAGES + 'ICD codes not billed this year:\n\n'
    for x in problems:
        EMR_utilities.MESSAGES = EMR_utilities.MESSAGES + '--' + x + '\n'
    EMR_utilities.MESSAGES = EMR_utilities.MESSAGES + '\n\n'
Example #17
0
    def OnAddPt(self, event):
	self.textctrl['Insurance Co'].SetValue(self.insChoice.GetStringSelection())
	checkBoxes = ''
	if self.adv_dirYesRB.GetValue() == True:
	    checkBoxes = ' adv_dir = "1",'
	elif self.adv_dirNoRB.GetValue() == True:
	    checkBoxes = ' adv_dir = "2",'
	else: 
	    checkBoxes = ' adv_dir = "0",'
	if self.proxyBox.IsChecked():
	    checkBoxes = checkBoxes + ' proxy = "1",'
	if self.marriedBox.IsChecked():
	    checkBoxes = checkBoxes + ' marital_status = "1",'
	qry = 'INSERT INTO demographics SET' + checkBoxes
	for label, size, field in self.labels:
	    qry = ' '.join([qry, '%s = "%s",' % (field, self.textctrl[label].GetValue())])
	qry = qry.rstrip(',') + ';'
	#check to make sure patient doesn't already exist
	dupCheck = 'SELECT firstname, lastname, dob FROM demographics WHERE firstname = "%s" AND lastname = "%s";' \
		% (self.textctrl['First Name'].GetValue(), self.textctrl['Last Name'].GetValue())
	dupResults = EMR_utilities.getData(dupCheck)
	if dupResults:
	    wx.MessageBox("A patient with this name already exists.", 'DUPLICATE', wx.OK)
	else:
	    EMR_utilities.updateData(qry)
	    pt_ID = EMR_utilities.getData("SELECT LAST_INSERT_ID();")
	    UpdoxImporter.Importer(str(pt_ID[0]))
Example #18
0
 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))
Example #19
0
 def OnDeleteMed(self, event):
     obj = self.list.GetSelectedObjects()
     for items in obj:
         qry = 'DELETE FROM meds WHERE med_number = %s;' % items[
             'med_number']
         self.list.RemoveObject(items)
         EMR_utilities.updateData(qry)
Example #20
0
 def OnDelPrevent(self, event):
     obj = self.preventList.GetSelectedObjects()
     for items in obj:
         qry = 'DELETE FROM prevents2 WHERE prevent_number = %s;' % items[
             'prevent_number']
         self.preventList.RemoveObject(items)
         EMR_utilities.updateData(qry)
Example #21
0
    def __init__(self, pt_ID, amount):
        self.amount = amount
        self.pt_ID = pt_ID
        from reportlab.lib.pagesizes import letter
        from reportlab.pdfgen import canvas

        canvas = canvas.Canvas("/home/mb/Desktop/GECKO/EMR_outputs/%s/Other/rcpt-%s.pdf" % \
             (self.pt_ID, EMR_utilities.dateToday()), pagesize=letter)
        canvas.setLineWidth(.3)
        canvas.setFont('Helvetica', 12)

        canvas.drawString(
            30, 750, 'PAYMENT FOR MEDICAL SERVICES FOR %s' % self.name_find())
        canvas.drawString(30, 735, 'RENDERED AT BARRON FAMILY MEDICINE')
        canvas.drawString(500, 750, "%s" % EMR_utilities.dateToday())
        canvas.line(480, 747, 580, 747)

        canvas.drawString(275, 725, 'AMOUNT PAID:')
        canvas.drawString(500, 725, "$%s" % self.amount)
        canvas.line(378, 723, 580, 723)

        canvas.drawString(30, 703, 'RECEIVED BY:')
        canvas.line(120, 700, 580, 700)
        canvas.drawString(120, 703, "MICHAEL BARRON MD")

        canvas.save()
Example #22
0
    def PrintLtr(self):
	#need consultant first and lastname by parsing self.consultant 
	conName = self.consultant[0:self.consultant.find(',')]
	Printer.myConsultLtr(self, self.PtID, self.textctrl['reason'].GetValue(), self.textctrl['memo'].GetValue(), \
				conName, self.textctrl['Due Date'])
	EMR_utilities.updateList(todo_find(self.PtID, toggle=0), self.todoInstance.todo_list)
	self.Destroy()
Example #23
0
 def PrintLtr(self):
     #need consultant first and lastname by parsing self.consultant
     conName = self.consultant[0:self.consultant.find(',')]
     Printer.myConsultLtr(self, self.PtID, self.textctrl['reason'].GetValue(), self.textctrl['memo'].GetValue(), \
        conName, self.textctrl['Due Date'])
     EMR_utilities.updateList(todo_find(self.PtID, toggle=0),
                              self.todoInstance.todo_list)
     self.Destroy()
Example #24
0
    def OnComplete(self, event):
	num = self.todo_list.GetItemCount()
	for i in range(num):
            if i == 0: pass
            if self.todo_list.IsChecked(i):
		qry = 'UPDATE todo SET complete = 1 WHERE todo_number = %s;' % (self.todo_list.GetItem(i, 7).GetText())
		EMR_utilities.updateData(qry)
		self.todo_list.DeleteItem(i)	
Example #25
0
    def add_consultant(self, evt):
        qry = "INSERT INTO consultants SET firstname = '%s', lastname = '%s', address = '%s', city = '%s', state = '%s', zipcode = '%s', phone = '%s', fax = '%s', specialty = '%s';" % \
		(self.textctrl['firstname'].GetValue(), self.textctrl['lastname'].GetValue(), self.textctrl['address'].GetValue(), \
		self.textctrl['city'].GetValue(), self.textctrl['state'].GetValue(), self.textctrl['zipcode'].GetValue(), \
		self.textctrl['phonenumber'].GetValue(), self.textctrl['fax'].GetValue(), self.textctrl['specialty'].GetValue())
	EMR_utilities.updateData(qry)
	self.consultant = self.textctrl['firstname'].GetValue() + ' ' + self.textctrl['lastname'].GetValue() + ','
	self.addSpecialist = 1	#tells whether Add Consultant button has been pushed
Example #26
0
    def __init__(self, parent, ptID, text=""):
	'''Prints a letter, saves a copy to pt folder'''
	self.ptID = ptID
	filename = "/home/mb/Desktop/GECKO/EMR_outputs/%s/Other/ltr-%s.pdf" % (self.ptID, EMR_utilities.dateToday())
	doc = SimpleDocTemplate(filename, pagesize=letter, topMargin=60)
	# container for the 'Flowable' objects
	elements = []
 
	styleSheet = getSampleStyleSheet()
	styleSheet.add(ParagraphStyle(name='Address', fontSize=13, leading=15))
	styleSheet.add(ParagraphStyle(name='Body', fontSize=12, leading=14))

	elements.append(Paragraph('Barron Family Medicine', styleSheet['Address']))
	elements.append(Paragraph('1423 S Big Bend Blvd', styleSheet['Address']))
	elements.append(Paragraph('Richmond Heights, MO 63117', styleSheet['Address']))

	qry = 'SELECT * FROM demographics WHERE patient_ID = %s;' % self.ptID
	results = EMR_utilities.getDictData(qry)
	elements.append(Spacer(1,48))
	elements.append(Paragraph('%(firstname)s %(lastname)s' % (results), styleSheet['Address']))
	elements.append(Paragraph('%(address)s' % results, styleSheet['Address']))
	elements.append(Paragraph('%(city)s, %(state)s  %(zipcode)s' % results, styleSheet['Address']))
	elements.append(Spacer(1,24))
	elements.append(Paragraph('<para align=RIGHT>%s</para>' % EMR_utilities.dateToday(t='display'), styleSheet['Body']))
	
	elements.append(Spacer(1,36))

	if results['sex'] == 'male':
	    def_salutation = 'Dear Mr. %s:' % results['lastname']
	else: 
	    def_salutation = 'Dear Ms. %s:' % results['lastname']
	salutation = wx.GetTextFromUser("Dear ?:", default_value=def_salutation)
	elements.append(Paragraph(salutation, styleSheet['Body']))
	elements.append(Spacer(1,12))
	
	if text == "":
	    body = wx.TextEntryDialog(parent, "Main Paragraph", style=wx.TE_MULTILINE|wx.OK|wx.CANCEL)
	    body.ShowModal()
	    elements.append(Paragraph(body.GetValue(), styleSheet['Body']))
	else:
	    elements.append(Paragraph(text, styleSheet['Body']))
	elements.append(Spacer(1,12))
	elements.append(Paragraph("If you have any questions, don't hesitate to call me at (314) 667-5276.", styleSheet['Body']))
	elements.append(Spacer(1,12))

	elements.append(Paragraph('Sincerely,', styleSheet['Body']))
	elements.append(Spacer(1, 48))
	'''If you want the signature automatically then can un-comment these lines.  For now I will sign all.
	logo = "/home/mb/Dropbox/Office/Signature.png"
	im = Image(logo, 2*inch, 0.75*inch)
	im.hAlign = "LEFT"
	elements.append(im)'''

	elements.append(Paragraph('Michael Barron MD', styleSheet['Body']))
	
	# write the document to disk
	doc.build(elements)
	os.system("lp %s" % filename)	#extremely slick: prints directly to Updox Printer
Example #27
0
    def __init__(self, parent, ptID, text=""):
	'''Prints a letter, saves a copy to pt folder'''
	self.ptID = ptID
	filename = "/home/mb/Desktop/GECKO/EMR_outputs/%s/Other/ltr-%s.pdf" % (self.ptID, EMR_utilities.dateToday())
	doc = SimpleDocTemplate(filename, pagesize=letter, topMargin=60)
	# container for the 'Flowable' objects
	elements = []
 
	styleSheet = getSampleStyleSheet()
	styleSheet.add(ParagraphStyle(name='Address', fontSize=13, leading=15))
	styleSheet.add(ParagraphStyle(name='Body', fontSize=12, leading=14))

	elements.append(Paragraph('Barron Family Medicine', styleSheet['Address']))
	elements.append(Paragraph('1423 S Big Bend Blvd', styleSheet['Address']))
	elements.append(Paragraph('Richmond Heights, MO 63117', styleSheet['Address']))

	qry = 'SELECT * FROM demographics WHERE patient_ID = %s;' % self.ptID
	results = EMR_utilities.getDictData(qry)
	elements.append(Spacer(1,48))
	elements.append(Paragraph('%(firstname)s %(lastname)s' % (results), styleSheet['Address']))
	elements.append(Paragraph('%(address)s' % results, styleSheet['Address']))
	elements.append(Paragraph('%(city)s, %(state)s  %(zipcode)s' % results, styleSheet['Address']))
	elements.append(Spacer(1,24))
	elements.append(Paragraph('<para align=RIGHT>%s</para>' % EMR_utilities.dateToday(t='display'), styleSheet['Body']))
	
	elements.append(Spacer(1,36))

	if results['sex'] == 'male':
	    def_salutation = 'Dear Mr. %s:' % results['lastname']
	else: 
	    def_salutation = 'Dear Ms. %s:' % results['lastname']
	salutation = wx.GetTextFromUser("Dear ?:", default_value=def_salutation)
	elements.append(Paragraph(salutation, styleSheet['Body']))
	elements.append(Spacer(1,12))
	
	if text == "":
	    body = wx.TextEntryDialog(parent, "Main Paragraph", style=wx.TE_MULTILINE|wx.OK|wx.CANCEL)
	    body.ShowModal()
	    elements.append(Paragraph(body.GetValue(), styleSheet['Body']))
	else:
	    elements.append(Paragraph(text, styleSheet['Body']))
	elements.append(Spacer(1,12))
	elements.append(Paragraph("If you have any questions, don't hesitate to call me at (314) 667-5276.", styleSheet['Body']))
	elements.append(Spacer(1,12))

	elements.append(Paragraph('Sincerely,', styleSheet['Body']))
	elements.append(Spacer(1, 48))
	'''If you want the signature automatically then can un-comment these lines.  For now I will sign all.
	logo = "/home/mb/Dropbox/Office/Signature.png"
	im = Image(logo, 2*inch, 0.75*inch)
	im.hAlign = "LEFT"
	elements.append(im)'''

	elements.append(Paragraph('Michael Barron MD', styleSheet['Body']))
	
	# write the document to disk
	doc.build(elements)
	os.system("lp %s" % filename)	#extremely slick: prints directly to Updox Printer
Example #28
0
    def __init__(self, parent, id=-1, title=None, ptID=None):
        wx.Panel.__init__(self, parent, id, title)
        self.ptID = ptID

        #sizers
        top = wx.BoxSizer(wx.HORIZONTAL)
        midtop = wx.BoxSizer(wx.VERTICAL)
        mainsizer = wx.BoxSizer(wx.VERTICAL)

        #list of table names in gecko, goes in top
        tables = [{'title':'allergies'}, {'title':'consultants'}, {'title':'demographics'}, {'title':'icd_9'}, {'title':'meds'}, \
                  {'title':'notes'}, {'title':'past_history'}, {'title':'problems'}, {'title':'todo'}, {'title':'vitals'}]
        self.tablesList = ObjectListView(self,
                                         -1,
                                         style=wx.LC_REPORT | wx.SUNKEN_BORDER)
        self.tablesList.SetColumns(
            [ColumnDefn("Tables", "center", 300, valueGetter='title')])
        self.tablesList.SetObjects(tables)
        top.Add(self.tablesList, 3, wx.EXPAND | wx.ALL, 5)

        #buttons go in midtop; midtop goes in top sizer
        btns = (('Show Columns', self.OnShowColumns), ('Delete Query',
                                                       self.OnDelQuery),
                ('Run Query', self.OnRunQuery), ('Print Query',
                                                 self.OnPrintQuery))
        for label, handler in btns:
            EMR_utilities.buildOneButton(self, self, label, handler, midtop)
        top.Add(midtop, 1, wx.EXPAND | wx.ALL, 5)

        #columns list goes in top sizer
        self.columns = []
        self.columnsList = ObjectListView(self,
                                          -1,
                                          style=wx.LC_REPORT
                                          | wx.SUNKEN_BORDER)
        self.columnsList.SetColumns(
            [ColumnDefn("Columns", "center", 300, valueGetter="Field")])
        self.columnsList.SetObjects(self.columns)
        top.Add(self.columnsList, 3, wx.EXPAND | wx.ALL, 5)
        mainsizer.Add(top, 3, wx.EXPAND)

        #textctrl for 'where' statement goes below top sizer in main sizer
        self.wherectrl = wx.TextCtrl(self, -1, size=(-1, -1))
        wheretxt = wx.StaticText(
            self, -1, 'e.g. WHERE patient_ID > 1000 AND short_des LIKE %%DM%%')
        mainsizer.Add(self.wherectrl, 1, wx.EXPAND | wx.ALL, 5)
        mainsizer.Add((-1, 10))
        mainsizer.Add(wheretxt, 1, wx.EXPAND | wx.ALL, 5)

        #results list goes below 'where' statement in mainsizer

        self.resultsList = ObjectListView(self,
                                          -1,
                                          style=wx.LC_REPORT
                                          | wx.SUNKEN_BORDER)
        mainsizer.Add(self.resultsList, 5, wx.EXPAND | wx.ALL, 5)
        self.SetSizer(mainsizer)
Example #29
0
    def OnRemove(self, event):
	
	num = self.todo_list.GetItemCount()
	for i in range(num):
            if i == 0: pass
            if self.todo_list.IsChecked(i):
		qry = 'DELETE FROM todo WHERE todo_number = %s;' % (self.todo_list.GetItem(i, 7).GetText())
		EMR_utilities.updateData(qry)
		self.todo_list.DeleteItem(i)		
Example #30
0
    def OnNewAll(self, event):
	allergy = wx.GetTextFromUser('What is the patient allergic to?', 'New Allergy')
	if allergy == "": pass
	else:
	    reaction = wx.GetTextFromUser('What happened?', 'Reaction')
	    query = 'INSERT INTO allergies SET allergy = "%s", reaction = "%s", patient_ID = %s;' % \
			(allergy, reaction, self.ptID)
	    EMR_utilities.updateData(query)
	    self.UpdateAllergy()
Example #31
0
 def OnComplete(self, event):
     num = self.todo_list.GetItemCount()
     for i in range(num):
         if i == 0: pass
         if self.todo_list.IsChecked(i):
             qry = 'UPDATE todo SET complete = 1 WHERE todo_number = %s;' % (
                 self.todo_list.GetItem(i, 7).GetText())
             EMR_utilities.updateData(qry)
             self.todo_list.DeleteItem(i)
Example #32
0
   def add_consultant(self, evt):
       qry = "INSERT INTO consultants SET firstname = '%s', lastname = '%s', address = '%s', city = '%s', state = '%s', zipcode = '%s', phone = '%s', fax = '%s', specialty = '%s';" % \
 (self.textctrl['firstname'].GetValue(), self.textctrl['lastname'].GetValue(), self.textctrl['address'].GetValue(), \
 self.textctrl['city'].GetValue(), self.textctrl['state'].GetValue(), self.textctrl['zipcode'].GetValue(), \
 self.textctrl['phonenumber'].GetValue(), self.textctrl['fax'].GetValue(), self.textctrl['specialty'].GetValue())
       EMR_utilities.updateData(qry)
       self.consultant = self.textctrl['firstname'].GetValue(
       ) + ' ' + self.textctrl['lastname'].GetValue() + ','
       self.addSpecialist = 1  #tells whether Add Consultant button has been pushed
Example #33
0
 def OnPDF(self, event):
     if self.educNote.IsShown():
         EMR_utilities.notePDF(self.PtID,
                               self.educNote.GetValue(),
                               visit_date=self.textctrl['Date'].GetValue())
     else:
         EMR_utilities.notePDF(self.PtID,
                               self.neweducNote.GetValue(),
                               visit_date=self.textctrl['Date'].GetValue())
Example #34
0
    def __init__(self, ptID, amount):

        self.ptID = ptID
        filename = "/home/mb/Desktop/GECKO/EMR_outputs/%s/Other/rcpt-%s.pdf" % (
            self.ptID, EMR_utilities.dateToday())
        doc = SimpleDocTemplate(filename,
                                pagesize=letter,
                                rightMargin=72,
                                leftMargin=72,
                                topMargin=72,
                                bottomMargin=18)
        Story = []
        logo = "/home/mb/Documents/icons/idealmedicalpractice-logo-small.png"
        formatted_time = time.strftime("%d %b %Y")
        full_name = "Michael Barron MD"
        address_parts = ["1423 S Big Bend Blvd", "Richmond Heights, MO 63117"]

        im = Image(logo, 2.5 * inch, 2 * inch)
        Story.append(im)

        styles = getSampleStyleSheet()
        Story.append(Spacer(1, 12))
        styles.add(ParagraphStyle(name='Justify', alignment=TA_JUSTIFY))
        ptext = '<font size=12>%s</font>' % formatted_time

        Story.append(Paragraph(ptext, styles["Normal"]))
        Story.append(Spacer(1, 12))

        # Create return address
        ptext = '<font size=12>%s</font>' % full_name
        Story.append(Paragraph(ptext, styles["Normal"]))
        for part in address_parts:
            ptext = '<font size=12>%s</font>' % part.strip()
            Story.append(Paragraph(ptext, styles["Normal"]))

        Story.append(Spacer(1, 12))
        ptext = '<font size=12>To Whom it May Concern::</font>'
        Story.append(Paragraph(ptext, styles["Normal"]))
        Story.append(Spacer(1, 12))

        qry = 'SELECT firstname, lastname FROM demographics WHERE patient_ID = %s;' % ptID
        results = EMR_utilities.getData(qry)
        ptext = "<font size=12>%s %s was seen in my office today and paid $%s toward their bill.  \
		If there are any further questions, please don't hesitate to contact me at the \
		above address or by phone at (314) 667-5276.</font>" % (results[0],
                                                          results[1], amount)
        Story.append(Paragraph(ptext, styles["Justify"]))
        Story.append(Spacer(1, 12))

        ptext = '<font size=12>Sincerely,</font>'
        Story.append(Paragraph(ptext, styles["Normal"]))
        Story.append(Spacer(1, 48))
        ptext = '<font size=12>Michael Barron MD</font>'
        Story.append(Paragraph(ptext, styles["Normal"]))
        Story.append(Spacer(1, 12))
        doc.build(Story)
Example #35
0
    def __init__(self, ptID, amount):

	self.ptID = ptID
	lt = "%s/EMR_outputs/%s/Other/rcpt-%s.pdf" % (settings.LINUXPATH, self.ptID, EMR_utilities.dateToday())
	at = "%s/EMR_outputs/%s/Other/rcpt-%s.pdf" % (settings.APPLEPATH, self.ptID, EMR_utilities.dateToday())
	wt = "%s\EMR_outputs\%s\Other\rcpt-%s.pdf" % (settings.WINPATH, self.ptID, EMR_utilities.dateToday())
	filename = EMR_utilities.platformText(lt, at, wt)
	doc = SimpleDocTemplate(filename,pagesize=letter,
                        rightMargin=72,leftMargin=72,
                        topMargin=72,bottomMargin=18)
	Story=[]
	#logo = "/home/mb/Documents/icons/idealmedicalpractice-logo-small.png"
	formatted_time = time.strftime("%d %b %Y")
	full_name = settings.NAME
	address_parts = ["8515 Delmar Blvd #217", "University City, MO 63124"]
 
	#im = Image(logo, 2.5*inch, 2*inch)
	#Story.append(im)
 
	styles=getSampleStyleSheet()
	Story.append(Spacer(1, 12))
	styles.add(ParagraphStyle(name='Justify', alignment=TA_JUSTIFY))
	ptext = '<font size=12>%s</font>' % formatted_time
 
	Story.append(Paragraph(ptext, styles["Normal"]))
	Story.append(Spacer(1, 12))
 
	# Create return address
	ptext = '<font size=12>%s</font>' % full_name
	Story.append(Paragraph(ptext, styles["Normal"]))
	for part in address_parts:
	    ptext = '<font size=12>%s</font>' % part.strip()
	    Story.append(Paragraph(ptext, styles["Normal"]))
 
	Story.append(Spacer(1, 12))
	ptext = '<font size=12>To Whom it May Concern::</font>'
	Story.append(Paragraph(ptext, styles["Normal"]))
	Story.append(Spacer(1, 12))

	qry = 'SELECT firstname, lastname FROM demographics WHERE patient_ID = %s;' % ptID 
	results = EMR_utilities.getData(qry)
	ptext = "<font size=12>%s %s was seen in my office today and paid $%s toward their bill.  \
		If there are any further questions, please don't hesitate to contact me at the \
		above address or by phone at (314) 667-5276.</font>" % (results[0], 
									results[1],
									amount)
	Story.append(Paragraph(ptext, styles["Justify"]))
	Story.append(Spacer(1, 12))
 
	ptext = '<font size=12>Sincerely,</font>'
	Story.append(Paragraph(ptext, styles["Normal"]))
	Story.append(Spacer(1, 48))
	ptext = '<font size=12>%s</font>' % settings.NAME
	Story.append(Paragraph(ptext, styles["Normal"]))
	Story.append(Spacer(1, 12))
	doc.build(Story)
Example #36
0
    def OnRemove(self, event):

        num = self.todo_list.GetItemCount()
        for i in range(num):
            if i == 0: pass
            if self.todo_list.IsChecked(i):
                qry = 'DELETE FROM todo WHERE todo_number = %s;' % (
                    self.todo_list.GetItem(i, 7).GetText())
                EMR_utilities.updateData(qry)
                self.todo_list.DeleteItem(i)
Example #37
0
 def OnNewAll(self, event):
     allergy = wx.GetTextFromUser('What is the patient allergic to?',
                                  'New Allergy')
     if allergy == "": pass
     else:
         reaction = wx.GetTextFromUser('What happened?', 'Reaction')
         query = 'INSERT INTO allergies SET allergy = "%s", reaction = "%s", patient_ID = %s;' % \
       (allergy, reaction, self.ptID)
         EMR_utilities.updateData(query)
         self.UpdateAllergy()
Example #38
0
 def OnOk(self, event):
     qry = 'INSERT INTO todo SET date = "%s", description = "%s", priority = "%s", category = "%s", memo = "%s", due_date = "%s", complete = "0", patient_ID = %s;' % (
         self.textctrl['Date'].GetValue(),
         self.textctrl['Description'].GetValue(),
         self.textctrl['Priority'].GetValue(),
         self.textctrl['Category'].GetValue(),
         self.textctrl['Memo'].GetValue(),
         self.textctrl['Due Date'].GetValue(), self.PtID)
     EMR_utilities.updateData(qry)
     EMR_utilities.updateList(todo_find(self.PtID), self.List)
Example #39
0
 def OnAddPrevent(self, event):
     prev = wx.GetTextFromUser('What is the new health maintance item?',
                               'Health Maintenance')
     if prev == "": pass
     else:
         note = wx.GetTextFromUser('Any notes?', 'Notes')
         query = 'INSERT INTO prevents2 SET prevent_name = "%s", date = "%s", reason = "normal", p_interval = 1, notes = "%s", patient_ID = %s;' % \
      (prev, EMR_utilities.dateToday(), note, self.ptID)
         EMR_utilities.updateData(query)
         self.UpdatePrevents()
Example #40
0
 def OnArchMed(
     self, event
 ):  #need add/edit form pulled up on selected meds, update query, requery meds
     #open AddEditMed form with selected/checked med filled in
     obj = self.list.GetSelectedObjects()
     for items in obj:
         qry = 'UPDATE meds SET archive = 1 WHERE med_number = %s;' % items[
             'med_number']
         self.list.RemoveObject(items)
         EMR_utilities.updateData(qry)
Example #41
0
    def OnScan(self, event):
	dlg = wx.MultiChoiceDialog(self, "What would you like to scan?", "Scan Options", ['ID Cards', 'Assignment Notice', \
				   'Release of Information', 'Consult Note', 'Old Records', 'Insurance Info', 'Labs', \
				   'Radiology', 'Other'])
	if dlg.ShowModal() == wx.ID_OK:
	    if dlg.GetSelections() == [0]:
		EMR_utilities.Scan(185, 65, self.ptID, "Insurance", "card", mode='duplex')
	    elif dlg.GetSelections() == [1]:
		EMR_utilities.Scan(215, 278, self.ptID, "Insurance", "notice")
	    elif dlg.GetSelections() == [2]:
		EMR_utilities.Scan(215, 278, self.ptID, "Other", "ROI", mode='ADF')
	    elif dlg.GetSelections() == [3]:
		EMR_utilities.Scan(215, 278, self.ptID, "Consults", "note", mode='ADF')
	    elif dlg.GetSelections() == [4]:
		EMR_utilities.Scan(215, 278, self.ptID, "Old_Records", "rec", mode='ADF')
	    elif dlg.GetSelections() == [5]:
		EMR_utilities.Scan(215, 278, self.ptID, "Insurance", "misc", mode='ADF')
	    elif dlg.GetSelections() == [6]:
		EMR_utilities.Scan(215, 278, self.ptID, "Labs", "lab", mode='ADF')
	    elif dlg.GetSelections() == [7]:
		EMR_utilities.Scan(215, 278, self.ptID, "Radiology", "rads", mode='ADF')
	    elif dlg.GetSelections() == [8]:
		EMR_utilities.Scan(215, 278, self.ptID, "Other", "misc", mode='ADF')
	else: 
	    wx.MessageBox("If you need to scan, hit the scan button again and select what you want to scan", '', wx.OK)
Example #42
0
    def get1500Data(self):
	#collect CPT info from the Billing module
	noteQry = 'SELECT * FROM notes WHERE date = "%s";' % self.myparent.textctrl['Date'].GetValue()
	noteResults = EMR_utilities.getDictData(noteQry)
	self.noteNumber = noteResults['note_number']	#need this for OnDone
	self.columns[89] = noteResults['icd1']		#DiagCode1, etc
	self.columns[90] = noteResults['icd2']
	self.columns[91] = noteResults['icd3']
	self.columns[92] = noteResults['icd4']
	self.columns[93] = noteResults['icd5']
	self.columns[94] = noteResults['icd6']
	self.columns[95] = noteResults['icd7']
	self.columns[96] = noteResults['icd8']
	self.printImageDict['icd9'] = noteResults['icd9']
	self.printImageDict['icd10'] = noteResults['icd10']
	
	cptQry = 'SELECT * FROM billing WHERE note_number = %d;' % noteResults['note_number']
	cptResults = EMR_utilities.getAllDictData(cptQry)
	#amt_pd = decimal.Decimal()
	res = len(cptResults)
	if res > 6:
	    dlg = wx.MessageDialog(None, "No more than 6 CPT codes per 1500 form.", "Error")
	    dlg.ShowModal()
	else:
	    for n in range(res):
	    	self.columns[101 + (n*16)] = cptResults[n]['date']		#FromDateOfService
		self.columns[102 + (n*16)] = cptResults[n]['date']		#ToDateOfService
		self.columns[103 + (n*16)] = cptResults[n]['POS']		#PlaceOfService
		self.columns[104 + (n*16)] = ""					#EMG (not used so blank)
		self.columns[105 + (n*16)] = cptResults[n]['CPT_code']		#CPT
		self.columns[106 + (n*16)] = cptResults[n]['mod_A']		#ModifierA
		self.columns[107 + (n*16)] = cptResults[n]['mod_B']		#ModifierB
		self.columns[108 + (n*16)] = cptResults[n]['mod_C']		#ModifierC
		self.columns[109 + (n*16)] = cptResults[n]['mod_D']		#ModifierD
		self.columns[110 + (n*16)] = cptResults[n]['dx_pter']		#DiagCodePointer
		self.columns[111 + (n*16)] = cptResults[n]['total_charge']	#Charges
		self.columns[112 + (n*16)] = cptResults[n]['units']		#Units
		try:
		    if int(cptResults[n]['CPT_code']) > 99380 and int(cptResults[n]['CPT_code']) < 99396:
			self.columns[113 + (n*16)] = 'Y'			#EPSDT- catches well-baby and physicals
			#puts Y in all physicals, should only be EPSDT physicals
		except: pass							#J/G codes raise error- not integers
		self.columns[114 + (n*16)] = ""					#RenderingPhysQualifier
		self.columns[115 + (n*16)] = ""					#RenderingPhysID
		self.columns[116 + (n*16)] = self.renderingNPI			#RenderingPhysNPI  
		emptyStringProblemChildren = ['total_charge', '1_ins_pmt', '2_ins_pmt', 'pt_pmt']
		for kids in emptyStringProblemChildren:				#empty strings raised decimal error
		    try: decimal.Decimal(cptResults[n][kids])
		    except decimal.InvalidOperation: cptResults[n][kids] = 0 	#must convert them to 0 before using them
		self.columns[267] = self.columns[267] + decimal.Decimal(cptResults[n]['total_charge'])	#TotalCharges
		self.columns[268] = self.columns[268] + decimal.Decimal(cptResults[n]['1_ins_pmt']) + \
				    decimal.Decimal(cptResults[n]['2_ins_pmt']) + \
				    decimal.Decimal(cptResults[n]['pt_pmt'])	#AmountPaid
	    for i in range(101, 292):
		self.printImageDict[str(i)] = self.columns[i]
Example #43
0
 def OnAddVaccine(self, event):
     vac = wx.GetTextFromUser('What is the new vaccine?', 'Vaccines')
     dates = wx.GetTextFromUser('What date(s) was vaccine given?',
                                'Vaccines')
     if vac == "": pass
     else:
         note = wx.GetTextFromUser('Any notes?', 'Notes')
         query = 'INSERT INTO vaccines SET vaccine = "%s", dates = "%s", notes = "%s", patient_ID = %s;' % \
       (vac, dates, note, self.ptID)
         EMR_utilities.updateData(query)
         self.UpdateVaccines()
Example #44
0
    def OnToggle(self, event):					#changes list display from active to completed items
	if self.toggler == 'Active':				
	    self.toggler = 'Completed'
	    self.todoTitle.SetLabel(self.toggler)
	    data = todo_find(self.PtID, toggle=1)
	    EMR_utilities.updateList(data, self.todo_list)
	else:
	    self.toggler = 'Active'				#and back
	    self.todoTitle.SetLabel(self.toggler)
	    data = todo_find(self.PtID, toggle=0)
	    EMR_utilities.updateList(data, self.todo_list)
Example #45
0
 def OnUpdate(self, event):
     qry = 'UPDATE billing SET'
     for label, size, field in self.cptLabels:
         qry = ' '.join(
             [qry,
              '%s = "%s",' % (field, self.textctrl[label].GetValue())])
     qry = ' '.join([qry, 'notes = "%s" WHERE charge_number = %s;' % (self.textctrl['Notes'].GetValue(), \
            self.textctrl['charge_number'].GetValue())])
     EMR_utilities.updateData(qry)
     self.results = EMR_utilities.getAllDictData(
         'SELECT * FROM billing WHERE note_number = %s;' % (self.noteID[0]))
Example #46
0
    def __init__(self, ptID, amount):

	self.ptID = ptID
	filename = "/home/mb/Desktop/GECKO/EMR_outputs/%s/Other/rcpt-%s.pdf" % (self.ptID, EMR_utilities.dateToday())
	doc = SimpleDocTemplate(filename,pagesize=letter,
                        rightMargin=72,leftMargin=72,
                        topMargin=72,bottomMargin=18)
	Story=[]
	logo = "/home/mb/Documents/icons/idealmedicalpractice-logo-small.png"
	formatted_time = time.strftime("%d %b %Y")
	full_name = "Michael Barron MD"
	address_parts = ["1423 S Big Bend Blvd", "Richmond Heights, MO 63117"]
 
	im = Image(logo, 2.5*inch, 2*inch)
	Story.append(im)
 
	styles=getSampleStyleSheet()
	Story.append(Spacer(1, 12))
	styles.add(ParagraphStyle(name='Justify', alignment=TA_JUSTIFY))
	ptext = '<font size=12>%s</font>' % formatted_time
 
	Story.append(Paragraph(ptext, styles["Normal"]))
	Story.append(Spacer(1, 12))
 
	# Create return address
	ptext = '<font size=12>%s</font>' % full_name
	Story.append(Paragraph(ptext, styles["Normal"]))
	for part in address_parts:
	    ptext = '<font size=12>%s</font>' % part.strip()
	    Story.append(Paragraph(ptext, styles["Normal"]))
 
	Story.append(Spacer(1, 12))
	ptext = '<font size=12>To Whom it May Concern::</font>'
	Story.append(Paragraph(ptext, styles["Normal"]))
	Story.append(Spacer(1, 12))

	qry = 'SELECT firstname, lastname FROM demographics WHERE patient_ID = %s;' % ptID 
	results = EMR_utilities.getData(qry)
	ptext = "<font size=12>%s %s was seen in my office today and paid $%s toward their bill.  \
		If there are any further questions, please don't hesitate to contact me at the \
		above address or by phone at (314) 667-5276.</font>" % (results[0], 
									results[1],
									amount)
	Story.append(Paragraph(ptext, styles["Justify"]))
	Story.append(Spacer(1, 12))
 
	ptext = '<font size=12>Sincerely,</font>'
	Story.append(Paragraph(ptext, styles["Normal"]))
	Story.append(Spacer(1, 48))
	ptext = '<font size=12>Michael Barron MD</font>'
	Story.append(Paragraph(ptext, styles["Normal"]))
	Story.append(Spacer(1, 12))
	doc.build(Story)
Example #47
0
 def rowFormatter(self, listItem, model):
     qryBill = 'SELECT billable FROM ICD10billable WHERE icd10 = "%s";' % model.icd10
     qryHCC = 'SELECT hcc FROM hcc WHERE icd10 = "%s";' % model.icd10
     resultsBill = EMR_utilities.getData(qryBill)
     resultsHCC = EMR_utilities.getData(qryHCC)
     if resultsBill[0] == '0':
         listItem.SetTextColour(wx.RED)
     else: pass
     try:
         if resultsHCC[0] == 'Yes':
             listItem.SetBackgroundColour('Light Grey')
     except: pass      
Example #48
0
 def OnNewProb(self, event):
     #opens dialog window with fields for new problem, does lookup based on description only, updates MySQL,
     #then clears the list and resets the lists with new query for problems
     dlg = AddProblemDialog(self, self, -1, 'New Problem')
     dlg.ProbInstance = self
     dlg.CenterOnScreen()
     if dlg.ShowModal() == wx.ID_OK:
         today = datetime.date.today()
         newICD = EMR_utilities.getData('SELECT icd10 FROM ICD10billable WHERE short_des = "%s";' % self.problem)
         query = 'INSERT INTO problems10 SET short_des = "%s", prob_date = "%s", patient_ID = "%s", icd10 = "%s";' % \
             (self.problem, today, self.ptID, newICD[0])
         EMR_utilities.updateData(query)
         self.UpdateList()
     dlg.Destroy()
Example #49
0
    def __init__(self, parent, id, ptID):
        wx.Panel.__init__(self, parent, id)

        self.PtID = ptID
        self.textctrl = {}
        self.not_billable = 0
        textcontrols = [("Date", 100)]
        cptsizer = wx.BoxSizer(wx.VERTICAL)
        for label, size in textcontrols:
            EMR_utilities.buildOneTextCtrl(self, label, size, cptsizer)
        cptsizer.Add((-1, 10))
        cptsizer.Add(wx.StaticText(self, -1, "Select a template:"))
        self.tmplist = wx.ListBox(
            self,
            -1,
            pos=wx.DefaultPosition,
            size=(90, 110),
            choices=["HTN", "DM", "Obesity", "GI", "Back Pain"],
            style=wx.LB_HSCROLL,
        )
        self.Bind(wx.EVT_LISTBOX, self.EvtSelTmplist, self.tmplist)

        cptsizer.Add(self.tmplist)
        cptsizer.Add((-1, 10))

        noteSizer = wx.BoxSizer(wx.VERTICAL)
        noteLabel = wx.StaticText(self, -1, "SOAP Note")
        self.educNote = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE)
        self.educNote.Show(False)
        self.neweducNote = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE)
        noteSizer.Add(noteLabel, 0, wx.ALIGN_TOP | wx.ALIGN_LEFT, 5)
        noteSizer.Add(self.educNote, 1, wx.EXPAND)
        noteSizer.Add(self.neweducNote, 1, wx.EXPAND)

        buttons = [("Save", self.OnSave), ("New", self.OnNew), ("Print", self.OnPrint), ("PDF", self.OnPDF)]
        leftsizer = wx.BoxSizer(wx.VERTICAL)
        for label, handler in buttons:
            EMR_utilities.buildOneButton(self, self, label, handler, leftsizer)
        self.listctrl = wx.ListBox(self, -1, pos=wx.DefaultPosition, size=(145, 200), choices=[], style=wx.LB_HSCROLL)
        leftsizer.AddMany([(-1, 20), (wx.StaticText(self, -1, "Select a note:")), (self.listctrl)])
        self.Bind(wx.EVT_LISTBOX, self.EvtSelListBox, self.listctrl)
        self.Bind(wx.EVT_LISTBOX_DCLICK, self.EvtSelListBox, self.listctrl)

        mainsizer = wx.BoxSizer(wx.HORIZONTAL)
        mainsizer.AddMany(
            [(leftsizer, 0, wx.ALL, 10), (noteSizer, 1, wx.EXPAND | wx.ALL, 10), (cptsizer, 0, wx.ALL, 10)]
        )
        self.SetSizer(mainsizer)
        self.loadList()
Example #50
0
 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("")
Example #51
0
    def __init__(self, parent, id, PtID, List):
	wx.Panel.__init__(self, parent, id)

	border = wx.StaticBox(self, -1, "Add To Do Item")
	SBsizer = wx.StaticBoxSizer(border, wx.HORIZONTAL)
	sizer = wx.GridBagSizer(hgap=5, vgap=5)
	self.PtID = PtID
	self.List = List
	self.textctrl = {}
	labels = (('Date', 90), ('Priority', 90), ('Category', 90), ('Due Date', 90))
	row = 0
	col = 0
	for label, size in labels:
	    self.textctrl[label] = wx.TextCtrl(self, -1, size=(size, -1))
	    sizer.Add(wx.StaticText(self, -1, label), pos=(row,col), flag=wx.ALIGN_RIGHT)
	    sizer.Add(self.textctrl[label], pos=(row, (col + 1)))
	    col = col + 2
	sizer.Add(wx.StaticText(self, -1, 'Description'), pos=(1, 0), flag=wx.ALIGN_RIGHT)
	self.textctrl['Description'] = wx.TextCtrl(self, -1, size=(300,50), style=wx.TE_MULTILINE)
	self.textctrl['Memo'] = wx.TextCtrl(self, -1, size=(300,50), style=wx.TE_MULTILINE)
	sizer.Add(self.textctrl['Description'], pos=(1, 1), span=(2, 3))
	sizer.Add(wx.StaticText(self, -1, 'Memo'), pos=(1, 4), flag=wx.ALIGN_RIGHT)
	sizer.Add(self.textctrl['Memo'], pos=(1, 5), span=(2, 3))  

	btn = wx.Button(self, wx.ID_OK)
        btn.SetDefault()
        sizer.Add(btn, pos=(3, 0))
	self.Bind(wx.EVT_BUTTON, self.OnOk, btn)
	SBsizer.Add(sizer)
	self.SetSizer(SBsizer)
	self.textctrl['Date'].SetValue(EMR_utilities.dateToday())
	self.textctrl['Priority'].SetValue('3')
Example #52
0
    def OnEdit(self, event):
	num = self.todo_list.GetItemCount()
	items = []
	n = 0
	for i in range(num):
            if i == 0: pass
            if self.todo_list.IsChecked(i):
		qry = 'DELETE FROM todo WHERE todo_number = %s;' % (self.todo_list.GetItem(i, 7).GetText())
		EMR_utilities.updateData(qry)
		for columns in range(self.todo_list.GetColumnCount()):
		    items.append(self.todo_list.GetItem(i, columns).GetText())
		self.todo_list.DeleteItem(i)
	ctrls = ['Date', 'Description', 'Priority', 'Category', 'Memo', 'Due Date']	
	for i in ctrls:
	    self.addtodo.textctrl[i].SetValue(items[n])
	    n = n + 1
Example #53
0
    def EvtSelListBox(self, event):
	"""Problem: because the notes are displayed based on date, if there are more than one note with the same date
	   they will get displayed together in the text control in series.  To fix this I need to add another column 
	   for note_number to the listctrl which is not visible and then reference that number rather than the date 
	   so that notes can be displayed by their ID number.""" 
	#self.loadList()
	self.textctrl['Date'].SetValue("")
	self.soapNote.SetValue("")
	self.textctrl['Date'].AppendText(event.GetString())
	self.newsoapNote.Show(False)
	self.soapNote.Show(True)
	self.Layout()
	for items in self.results:
	    if str(items[3]) == event.GetString():
		self.soapNote.AppendText(items[2])
		try:
		    for i in range(1,11):
			self.textctrl['ICD #%s' % i].SetValue(items[i + 3])
		except: print 'Error: icd value would not set, line 197, Notes.py. Probably a NULL somewhere.'
		#self.textctrl['ICD #1'].SetValue(items[4])
		#self.textctrl['ICD #2'].SetValue(items[5])
		#self.textctrl['ICD #3'].SetValue(items[6])
		#self.textctrl['ICD #4'].SetValue(items[7])
		#self.textctrl['ICD #5'].SetValue(items[8])
		#self.textctrl['ICD #6'].SetValue(items[9])
		#self.textctrl['ICD #7'].SetValue(items[10])
		#self.textctrl['ICD #8'].SetValue(items[11])
		#self.textctrl['ICD #9'].SetValue(items[12])
		#self.textctrl['ICD #10'].SetValue(items[13])
	    else: pass
	self.note_number = EMR_utilities.getData('SELECT note_number FROM notes WHERE date = "%s";' % (event.GetString()))
Example #54
0
    def __init__(self, parent, visitSince='2010-10-01'):

	'''Send letters to all my active patients.'''

	#Here is the letter
	myLtr = '''As you may recall from my letter dated September 8, 2011, I have been deployed by the US Army to Kuwait until early January 2012. I arranged for the Family Care Health Center to see my patients while I am gone. Unfortunately, their capacity to see my patients is more limited than I anticipated.

In order to address this issue, Dr Ladonna Finch has generously agreed to help. If you need an appointment, rather than calling the Family Care Health Center as my previous letter suggested, please call her office at 314-645-7265.  Her office is located at 1031 Bellevue Avenue, Suite 349 in Richmond Heights, across the street from St. Mary's Hospital.

I encourage you to call my office for medication refills and non-urgent questions/issues that can be addressed via email.  

Thank you for your understanding.'''
    
	#Figure out who the active patients are and create a list of their patient_ID numbers
	qry = 'SELECT patient_ID FROM notes WHERE date >= "%s";' % visitSince
	results = EMR_utilities.getAllData(qry)

	#Remove duplicates from the list
	d = {}
	for x in results:
	    d[x] = 1
	myList = list(d.keys())
	print len(myList)
	
	#Step through the list creating letter using template in Printer
	for items in myList:
	    myPtLtr(self, items[0], text=myLtr)
Example #55
0
    def __init__(self, instance, parent, id, title):
	wx.Dialog.__init__(self, parent, id, title, size=(1100, 600))

	self.results = []
	self.textctrl = {}
	self.parentInstance = instance
	mainSizer = wx.BoxSizer(wx.VERTICAL)
	textSizer = wx.BoxSizer(wx.HORIZONTAL)
	btnSizer = wx.StdDialogButtonSizer()
	listSizer = wx.BoxSizer(wx.HORIZONTAL)
	self.textctrl['Search'] = wx.TextCtrl(self, -1, size=(250, -1), name='Search', style=wx.TE_PROCESS_ENTER)
	self.textctrl['Refine'] = wx.TextCtrl(self, -1, size=(150, -1), name='Refine', style=wx.TE_PROCESS_ENTER)
	textSizer.AddMany([(wx.StaticText(self, -1, 'Search')), (self.textctrl['Search']), (wx.StaticText(self, -1, 'Refine')), (self.textctrl['Refine'])])
	clearButton = EMR_utilities.buildOneButton(self, self, 'Clear', self.OnClear, textSizer)
	self.resultListBox = wx.ListBox(self, -1, pos=wx.DefaultPosition, choices = [], size=(700,300), style=wx.LB_HSCROLL)
	self.refineListBox = wx.ListBox(self, -1, pos=wx.DefaultPosition, choices = [], size=(200,300), style=wx.LB_HSCROLL)
	listSizer.AddMany([self.resultListBox, (20, -1), self.refineListBox])
	self.Bind(wx.EVT_TEXT_ENTER, self.OnSearchEnter, self.textctrl['Search'])
	self.Bind(wx.EVT_TEXT_ENTER, self.OnRefineEnter, self.textctrl['Refine'])
	btnOK = wx.Button(self, wx.ID_OK)
	btnCL = wx.Button(self, wx.ID_CANCEL)
        btnOK.SetDefault()
	btnCL.SetDefault()
	btnSizer.AddButton(btnOK)
	btnSizer.AddButton(btnCL)
	btnSizer.Realize()
	self.Bind(wx.EVT_LISTBOX, self.EvtSelRefineList, self.refineListBox)
	self.Bind(wx.EVT_LISTBOX, self.EvtSelResultList, self.resultListBox)
	mainSizer.AddMany([(textSizer, 0, wx.ALL, 10), (listSizer, 0, wx.ALL, 10), (btnSizer, 0, wx.ALL, 10)])
	self.SetSizer(mainSizer)
Example #56
0
def getProblems(ptID, display=''):
	qry = 'SELECT short_des FROM problems10 WHERE patient_ID = %s;' % (ptID)
	results = EMR_utilities.getAllData(qry)
	shortList = []
	try:
	    for items in results:
		#query = 'SELECT short_des FROM icd10 WHERE disease_name = "%s";' % items[0]
		#short_name = EMR_utilities.getData(query)
		shortList.append(items)
	except: pass
	if display == 'HTML':
	    string = "<b>Problems:</b><BR>"
	    separator = "<BR>"
	else:
	    string = "Problems:\n"
	    separator = "\n"
	if results == ():
	    string = string + "none"
	else:
	    n = 1
	    for p in shortList:
		try:
		    string = string + "%s) %s%s" % (n, p[0], separator)
		    n = n + 1
		except: pass
	return string