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()
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()
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()
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()
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()
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
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)
def __init__(self, parent, ptID, text=""): '''Prints a letter, saves a copy to pt folder''' self.ptID = ptID lt = "%s/EMR_outputs/%s/Other/ltr-%s.pdf" % (settings.LINUXPATH, self.ptID, EMR_utilities.dateToday('file format')) at = "%s/EMR_outputs/%s/Other/ltr-%s.pdf" % (settings.APPLEPATH, self.ptID, EMR_utilities.dateToday('file format')) wt = "%s\EMR_outputs\%s\Other\ltr-%s.pdf" % (settings.WINPATH, self.ptID, EMR_utilities.dateToday('file format')) filename = EMR_utilities.platformText(lt, at, wt) 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('8515 Delmar Blvd #217', styleSheet['Address'])) elements.append(Paragraph('University City, MO 63124', 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'])) chooseSig(elements) elements.append(Paragraph(settings.NAME, styleSheet['Body'])) # write the document to disk doc.build(elements) choosePrinter(filename)
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
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)
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')
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)
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()
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)
def OnCarePlanBtn(self, event): #check to make sure a note has been stared if self.newsoapNote.GetValue() == '': #if there is a saved note for today, start care plan if self.soapNote.GetValue(): #check to make sure a care plan has not already been created; can only use it once qry = 'SELECT * FROM education WHERE date = "%s" AND patient_ID = "%s";' % (EMR_utilities.dateToday(), self.PtID) results = EMR_utilities.getData(qry) if results: dlg = wx.MessageDialog(None, "A saved care plan for today already exists. Look in the Education tab.", "Important", wx.OK) dlg.ShowModal() else: if self.GetParent().GetPage(7).neweducNote.GetValue() == '': cp = CarePlan.CarePlanFrame(self, self.PtID) cp.Show(True) cp.notesinstance = self else: dlg = wx.MessageDialog(None, "A new care plan for today already exists. Look in the Education tab.", "Important", wx.OK) dlg.ShowModal() #now we know there is neither a new or saved note, so give error message else: dlg = wx.MessageDialog(None, "Please start a note before starting care plan.", "Important", wx.OK) dlg.ShowModal() else: #check to make sure a care plan has not already been created; can only use it once qry = 'SELECT * FROM education WHERE date = "%s" AND patient_ID = "%s";' % (EMR_utilities.dateToday(), self.PtID) results = EMR_utilities.getData(qry) if results: dlg = wx.MessageDialog(None, "A saved care plan for today already exists. Look in the Education tab.", "Important", wx.OK) dlg.ShowModal() else: if self.GetParent().GetPage(7).neweducNote.GetValue() == '': cp = CarePlan.CarePlanFrame(self, self.PtID) cp.Show(True) cp.notesinstance = self else: dlg = wx.MessageDialog(None, "A new care plan for today already exists. Look in the Education tab.", "Important", wx.OK) dlg.ShowModal()
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()
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')
def __init__(self, PtID): #Setup authentication - this can be done once username = '******' password = '******' auth_string = base64.encodestring('%s:%s' % (username, password))[:-1] baseurl = 'https://myupdox.com/udb/jsonapi/%s' qry = "SELECT * FROM demographics WHERE patient_ID = %s" % PtID results = EMR_utilities.getDictData(qry) #The following is done for each request list = [ { "contactType": "patient", "id": PtID, "salutation": "", "firstName": results['firstname'], "middleName": results['mid_init'], "lastName": results['lastname'], "suffix": "", "emailAddress": results['email'], "sex": results['sex'][:1].capitalize(), "homePhone": results['phonenumber'], "workPhone": "", "address1": "", "city": "", "state": "", "zip5": "", "dob": str(results['dob']), "addedDate": str(EMR_utilities.dateToday()), "mobileNumber": "", "faxNumber": "", "defaultProvider": "Barron", "active": True }, ] req = urllib2.Request(url=baseurl % 'Core.SyncPatients', data='{"list":%s}' % json.dumps(list)) req.add_header("Authorization", "Basic %s" % auth_string) res = urllib2.urlopen(req) print res.read()
def __init__(self, parent, ID, PtID): wx.Panel.__init__(self, parent, ID) #I need some way to set the max size for the grid self.PtID = PtID self.qry = "SELECT * FROM vitals WHERE patient_ID = %s;" % (str(self.PtID)) self.vitals = list(EMR_utilities.getAllDictData(self.qry)) self.textctrl = {} self.vitalsList = ObjectListView(self, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER) self.vitalsList.SetColumns([ ColumnDefn("Weight", "center", 80, valueGetter="wt"), ColumnDefn("Height", "center", 80, valueGetter="ht"), ColumnDefn("HC", "center", 80, valueGetter="hc"), ColumnDefn("Systolic", "center", 80, valueGetter="sBP"), ColumnDefn("Diastolic", "center", 80, valueGetter="dBP"), ColumnDefn("Pulse", "center", 80, valueGetter="pulse"), ColumnDefn("Resp", "center", 80, valueGetter="resp"), ColumnDefn("O2 Sat", "center", 80, valueGetter="sats"), ColumnDefn("Temp", "center", 80, valueGetter="temp"), ColumnDefn("Date", "center", 120, valueGetter="vitals_date") ]) self.vitalsList.SetObjects(self.vitals) self.vitalsList.cellEditMode = ObjectListView.CELLEDIT_DOUBLECLICK self.vitalsList.Bind(EVT_CELL_EDIT_STARTING, self.HandleCellEditStarting) self.vitalsList.Bind(EVT_CELL_EDIT_FINISHED, self.listHandleCellEditFinished) self.vitalsbox = wx.BoxSizer(wx.HORIZONTAL) self.vitalsbox.Add(self.vitalsList, 1, wx.EXPAND |wx.ALL, 20) self.mainsizer = wx.BoxSizer(wx.VERTICAL) border = wx.StaticBox(self, -1, 'Add Vitals') f = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.LIGHT) border.SetFont(f) addvitals = wx.StaticBoxSizer(border, wx.HORIZONTAL) controls = [('Wt', 40), ('Ht', 30), ('HC', 30), ('Temp', 40), ('SBP', 40), ('DBP', 40), ('Pulse', 40), ('Resp', 30), \ ('O2 Sats', 30), ('Date', 80)] for label, size in controls: EMR_utilities.buildOneTextCtrl(self, label, size, addvitals) self.textctrl['Date'].SetValue(str(EMR_utilities.dateToday())) self.mainsizer.Add(self.vitalsbox) self.mainsizer.Add(addvitals, 0, wx.ALL, 20) buttonAdd = EMR_utilities.buildOneButton(self, self, 'Update Vitals', self.UpdateVitals) buttonDel = EMR_utilities.buildOneButton(self, self, 'Delete Vitals', self.DeleteVitals) self.mainsizer.Add(buttonAdd, 0, wx.ALIGN_LEFT|wx.ALIGN_TOP|wx.LEFT|wx.TOP, 20) self.mainsizer.Add(buttonDel, 0, wx.ALIGN_LEFT|wx.ALIGN_TOP|wx.LEFT|wx.TOP, 20) self.SetSizer(self.mainsizer)
def __init__(self, parent, ptID=None, noteID=None): wx.Frame.__init__(self, parent, -1, "Care Plan", size=(600, 500)) self.ptID = ptID self.counter = 1 self.icd = '' #self.ePage = notesinstance.GetParent().GetPage(7) #Getting pages out of order will screw this up self.ePage = wx.GetApp().frame.nb.GetPage( 7) #I think this works as well self.ePage.educNote.Show(False) self.ePage.neweducNote.Show(True) self.ePage.textctrl['Date'].SetValue( str(EMR_utilities.dateToday(t='sql'))) self.ePage.Layout() self.ePage.neweducNote.WriteText(EMR_formats.educNote(self.ptID)) sideSizer = wx.BoxSizer(wx.HORIZONTAL) mainSizer = wx.BoxSizer(wx.VERTICAL) btnSizer = wx.BoxSizer(wx.HORIZONTAL) loadBtn = EMR_utilities.buildOneButton(self, self, "Load", self.OnLoad, btnSizer) doneBtn = EMR_utilities.buildOneButton(self, self, "Done", self.OnDone, btnSizer) dxLabel = wx.StaticText(self, -1, 'Diagnosis') self.dxTextCtrl = wx.TextCtrl(self, -1, size=(500, 25)) instrLabel = wx.StaticText( self, -1, "Patient Instructions. Start lines with '-'.") self.instrTextCtrl = wx.TextCtrl(self, -1, size=(500, 150), style=wx.TE_MULTILINE) planLabel = wx.StaticText(self, -1, 'Other: thoughts, DDx, etc') self.planTextCtrl = wx.TextCtrl(self, -1, size=(500, 150), style=wx.TE_MULTILINE) mainSizer.AddMany([dxLabel, self.dxTextCtrl, (-1, 10), \ instrLabel, self.instrTextCtrl, (-1, 10), \ planLabel, self.planTextCtrl, (-1, 10), \ btnSizer]) sideSizer.AddMany([(10, -1), mainSizer]) self.SetSizer(sideSizer) self.Bind(wx.EVT_TEXT, self.OnTextEnterICD, self.dxTextCtrl)
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
def EvtSelListbox(self, event): self.textctrl['Take'].SetValue('1') self.textctrl['Frequency'].SetValue('daily') self.textctrl['Route'].SetValue('oral') self.textctrl['Date'].SetValue(str(EMR_utilities.dateToday())) self.textctrl['#'].SetFocus()
def OnNew(self, event): self.educNote.Show(False) self.neweducNote.Show(True) self.Layout() self.textctrl['Date'].SetValue(str(EMR_utilities.dateToday(t='sql')))
def OnNew(self, event): self.educNote.Show(False) self.neweducNote.Show(True) self.Layout() self.textctrl["Date"].SetValue(str(EMR_utilities.dateToday(t="sql")))
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)
def __init__(self, parent, ptID): lt = "%s/EMR_outputs/%s/Orders/%s.pdf" % (settings.LINUXPATH, ptID, EMR_utilities.dateToday('file format')) at = "%s/EMR_outputs/%s/Orders/%s.pdf" % (settings.APPLEPATH, ptID, EMR_utilities.dateToday('file format')) wt = "%s\EMR_outputs\%s\Orders\%s.pdf" % (settings.WINPATH, ptID, EMR_utilities.dateToday('file format')) filename = EMR_utilities.platformText(lt, at, wt) 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)) dem_data = EMR_utilities.getDictData('SELECT * FROM demographics WHERE patient_ID = %s;' % ptID) dem_data['phonenumber'] = EMR_formats.phone_format(dem_data['phonenumber']) test_dlg = wx.TextEntryDialog(None, "What studies would you like to order?", "Studies",style=wx.TE_MULTILINE|wx.OK|wx.CANCEL) if test_dlg.ShowModal() == wx.ID_OK: dem_data['tests'] = test_dlg.GetValue() dem_data['date'] = EMR_utilities.dateToday() else: pass dx_dlg = wx.TextEntryDialog(None, "What is the diagnosis?", "Diagnosis", style=wx.TE_MULTILINE|wx.OK|wx.CANCEL) if dx_dlg.ShowModal() == wx.ID_OK: dem_data['dx'] = dx_dlg.GetValue() else: pass results_dlg = wx.TextEntryDialog(None, "Due Date?", style=wx.OK|wx.CANCEL) if results_dlg.ShowModal() == wx.ID_OK: dem_data['results_date'] = results_dlg.GetValue() else: pass qry = "INSERT INTO todo SET patient_ID = %s, date = '%s', description = '%s', priority = 3, \ category = 'Test', due_date = '%s', complete = 0;" % (ptID, EMR_utilities.dateToday(), \ dem_data['tests'], dem_data['results_date']) EMR_utilities.updateData(qry) styleSheet = getSampleStyleSheet() styleSheet.add(ParagraphStyle(name='Address', fontSize=13, leading=15)) styleSheet.add(ParagraphStyle(name='Body', fontSize=12, leading=14)) elements.append(Paragraph('<para align=CENTER>Barron Family Medicine</para>', styleSheet['Address'])) elements.append(Paragraph('<para align=CENTER>8515 Delmar Blvd #217</para>', styleSheet['Address'])) elements.append(Paragraph('<para align=CENTER>University City, MO 63124</para>', styleSheet['Address'])) elements.append(Paragraph('<para align=CENTER>(314)667-5276 fax:(314)677-3838</para>', styleSheet['Address'])) elements.append(Paragraph('<para align=CENTER>Quest #33007741, Labcorp #24864540</para>', styleSheet['Address'])) elements.append(Spacer(1,48)) elements.append(Paragraph('<para align=RIGHT>%s</para>' % EMR_utilities.dateToday(t='display'), styleSheet['Body'])) elements.append(Spacer(1,48)) elements.append(Paragraph('%(firstname)s %(lastname)s' % dem_data, styleSheet['Body'])) elements.append(Paragraph('%(address)s' % dem_data, styleSheet['Body'])) elements.append(Paragraph('%(city)s, %(state)s %(zipcode)s' % dem_data, styleSheet['Body'])) elements.append(Paragraph('%(phonenumber)s' % dem_data, styleSheet['Body'])) elements.append(Paragraph('DOB: %(dob)s' % dem_data, styleSheet['Body'])) elements.append(Spacer(1, 36)) elements.append(Paragraph('<U>Tests:</U>', styleSheet['Address'])) elements.append(Spacer(1, 12)) elements.append(Paragraph(dem_data['tests'], styleSheet['Body'])) elements.append(Spacer(1, 24)) elements.append(Paragraph('<U>Diagnosis:</U>', styleSheet['Address'])) elements.append(Spacer(1,12)) elements.append(Paragraph(dem_data['dx'], styleSheet['Body'])) elements.append(Spacer(1,96)) #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) chooseSig(elements) elements.append(Paragraph(settings.NAME, styleSheet['Body'])) # write the document to disk doc.build(elements) choosePrinter(filename)
def __init__(self, parent, ptID, reason, background, consultant, dueDate): lt = "%s/EMR_outputs/%s/Consults/%s.pdf" % ( settings.LINUXPATH, ptID, EMR_utilities.dateToday('file format')) at = "%s/EMR_outputs/%s/Consults/%s.pdf" % ( settings.APPLEPATH, ptID, EMR_utilities.dateToday('file format')) wt = "%s\EMR_outputs\%s\Consults\%s.pdf" % ( settings.WINPATH, ptID, EMR_utilities.dateToday('file format')) filename = EMR_utilities.platformText(lt, at, wt) 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)) dem_data = EMR_utilities.getDictData( 'SELECT * FROM demographics WHERE patient_ID = %s;' % ptID) consultDoc = EMR_utilities.name_fixer(consultant) if consultDoc.firstname == '': consult_data = EMR_utilities.getDictData('SELECT * FROM consultants WHERE lastname = "%s";' \ % (consultDoc.lastname)) else: consult_data = EMR_utilities.getDictData( 'SELECT * FROM consultants WHERE lastname = "%s" \ AND firstname = "%s";' % (consultDoc.lastname, consultDoc.firstname)) dem_data['phonenumber'] = EMR_formats.phone_format( dem_data['phonenumber']) patient = 'RE: %(firstname)s %(lastname)s, DOB: %(dob)s, Phone: %(phonenumber)s' % dem_data salutation = 'Dear Dr. %(lastname)s:' % consult_data body = 'I am sending %s, a %s %s, to see you regarding %s. %s' % \ (dem_data['firstname'], EMR_utilities.getAge(ptID), dem_data['sex'], reason, background) problems = EMR_formats.getProblems(ptID) meds = EMR_formats.getMeds(ptID, display='column') qry = "INSERT INTO todo SET patient_ID = %s, date = '%s', description = '%s- %s', priority = 3, \ category = 'Consult', due_date = '%s', complete = 0;" % (ptID, EMR_utilities.dateToday(), \ consult_data['lastname'], reason, dueDate) EMR_utilities.updateData(qry) 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('8515 Delmar Blvd #217', styleSheet['Address'])) elements.append( Paragraph('University City, MO 63124', styleSheet['Address'])) elements.append( Paragraph('(314)667-5276 fax:(314)677-3838', 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, 24)) elements.append( Paragraph('Dr. %(lastname)s' % consult_data, styleSheet['Body'])) elements.append( Paragraph('%(address)s' % consult_data, styleSheet['Body'])) elements.append( Paragraph('%(city)s, %(state)s %(zipcode)s' % consult_data, styleSheet['Body'])) elements.append(Spacer(1, 12)) elements.append(Paragraph(patient, styleSheet['Body'])) elements.append(Spacer(1, 12)) elements.append(Paragraph(salutation, styleSheet['Body'])) elements.append(Spacer(1, 12)) elements.append(Paragraph(body, styleSheet['Body'])) elements.append(Spacer(1, 12)) elements.append( Paragraph( "I have attached current medications and problems. \ 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'])) #If you want the signature automatically then can un-comment these lines. For now I will sign all. #logo = "/home/%s/Dropbox/Office/%sSignature.png" % (settings.HOME_FOLDER, settings.HOME_FOLDER) #im = Image(logo, 2*inch, 0.75*inch) #im.hAlign = "LEFT" #elements.append(im) chooseSig(elements) elements.append(Paragraph(settings.NAME, styleSheet['Body'])) elements.append(Spacer(1, 12)) tableList = [[ problems, meds, ]] table = Table(tableList, colWidths=(3 * inch, 3 * inch), style=[('VALIGN', (0, 0), (-1, -1), 'TOP'), ('LEFTPADDING', (0, 0), (-1, -1), 0), ('RIGHTPADDING', (0, 0), (-1, -1), 20)]) table.hAlign = "LEFT" elements.append(table) # write the document to disk doc.build(elements) choosePrinter(filename)
def __init__(self, parent, ptID): lt = "%s/EMR_outputs/%s/Orders/%s.pdf" % ( settings.LINUXPATH, ptID, EMR_utilities.dateToday('file format')) at = "%s/EMR_outputs/%s/Orders/%s.pdf" % ( settings.APPLEPATH, ptID, EMR_utilities.dateToday('file format')) wt = "%s\EMR_outputs\%s\Orders\%s.pdf" % ( settings.WINPATH, ptID, EMR_utilities.dateToday('file format')) filename = EMR_utilities.platformText(lt, at, wt) 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)) dem_data = EMR_utilities.getDictData( 'SELECT * FROM demographics WHERE patient_ID = %s;' % ptID) dem_data['phonenumber'] = EMR_formats.phone_format( dem_data['phonenumber']) test_dlg = wx.TextEntryDialog(None, "What studies would you like to order?", "Studies", style=wx.TE_MULTILINE | wx.OK | wx.CANCEL) if test_dlg.ShowModal() == wx.ID_OK: dem_data['tests'] = test_dlg.GetValue() dem_data['date'] = EMR_utilities.dateToday() else: pass dx_dlg = wx.TextEntryDialog(None, "What is the diagnosis?", "Diagnosis", style=wx.TE_MULTILINE | wx.OK | wx.CANCEL) if dx_dlg.ShowModal() == wx.ID_OK: dem_data['dx'] = dx_dlg.GetValue() else: pass results_dlg = wx.TextEntryDialog(None, "Due Date?", style=wx.OK | wx.CANCEL) if results_dlg.ShowModal() == wx.ID_OK: dem_data['results_date'] = results_dlg.GetValue() else: pass qry = "INSERT INTO todo SET patient_ID = %s, date = '%s', description = '%s', priority = 3, \ category = 'Test', due_date = '%s', complete = 0;" % (ptID, EMR_utilities.dateToday(), \ dem_data['tests'], dem_data['results_date']) EMR_utilities.updateData(qry) styleSheet = getSampleStyleSheet() styleSheet.add(ParagraphStyle(name='Address', fontSize=13, leading=15)) styleSheet.add(ParagraphStyle(name='Body', fontSize=12, leading=14)) elements.append( Paragraph('<para align=CENTER>Barron Family Medicine</para>', styleSheet['Address'])) elements.append( Paragraph('<para align=CENTER>8515 Delmar Blvd #217</para>', styleSheet['Address'])) elements.append( Paragraph('<para align=CENTER>University City, MO 63124</para>', styleSheet['Address'])) elements.append( Paragraph( '<para align=CENTER>(314)667-5276 fax:(314)677-3838</para>', styleSheet['Address'])) elements.append( Paragraph( '<para align=CENTER>Quest #33007741, Labcorp #24864540</para>', styleSheet['Address'])) elements.append(Spacer(1, 48)) elements.append( Paragraph( '<para align=RIGHT>%s</para>' % EMR_utilities.dateToday(t='display'), styleSheet['Body'])) elements.append(Spacer(1, 48)) elements.append( Paragraph('%(firstname)s %(lastname)s' % dem_data, styleSheet['Body'])) elements.append(Paragraph('%(address)s' % dem_data, styleSheet['Body'])) elements.append( Paragraph('%(city)s, %(state)s %(zipcode)s' % dem_data, styleSheet['Body'])) elements.append( Paragraph('%(phonenumber)s' % dem_data, styleSheet['Body'])) elements.append( Paragraph('DOB: %(dob)s' % dem_data, styleSheet['Body'])) elements.append(Spacer(1, 36)) elements.append(Paragraph('<U>Tests:</U>', styleSheet['Address'])) elements.append(Spacer(1, 12)) elements.append(Paragraph(dem_data['tests'], styleSheet['Body'])) elements.append(Spacer(1, 24)) elements.append(Paragraph('<U>Diagnosis:</U>', styleSheet['Address'])) elements.append(Spacer(1, 12)) elements.append(Paragraph(dem_data['dx'], styleSheet['Body'])) elements.append(Spacer(1, 96)) #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) chooseSig(elements) elements.append(Paragraph(settings.NAME, styleSheet['Body'])) # write the document to disk doc.build(elements) choosePrinter(filename)
def __init__(self, parent, ptID, reason, background, consultant, dueDate): filename = "/home/mb/Desktop/GECKO/EMR_outputs/%s/Consults/%s.pdf" % (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)) dem_data = EMR_utilities.getDictData('SELECT * FROM demographics WHERE patient_ID = %s;' % ptID) consultDoc = EMR_utilities.name_fixer(consultant) if consultDoc.firstname == '': consult_data = EMR_utilities.getDictData('SELECT * FROM consultants WHERE lastname = "%s";' \ % (consultDoc.lastname)) else: consult_data = EMR_utilities.getDictData('SELECT * FROM consultants WHERE lastname = "%s" \ AND firstname = "%s";' % (consultDoc.lastname, consultDoc.firstname)) patient = 'RE: %(firstname)s %(lastname)s, DOB: %(dob)s' % dem_data salutation = 'Dear Dr. %(lastname)s:' % consult_data body = 'I am sending %s, a %s %s, to see you regarding %s. %s' % \ (dem_data['firstname'], EMR_utilities.getAge(ptID), dem_data['sex'], reason, background) problems = EMR_formats.getProblems(ptID) meds = EMR_formats.getMeds(ptID, display='column') qry = "INSERT INTO todo SET patient_ID = %s, date = '%s', description = '%s- %s', priority = 3, \ category = 'Consult', due_date = '%s', complete = 0;" % (ptID, EMR_utilities.dateToday(), \ consult_data['lastname'], reason, dueDate) EMR_utilities.updateData(qry) 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'])) elements.append(Spacer(1,24)) elements.append(Paragraph('<para align=RIGHT>%s</para>' % EMR_utilities.dateToday(t='display'), styleSheet['Body'])) elements.append(Spacer(1,24)) elements.append(Paragraph('Dr. %(lastname)s' % consult_data, styleSheet['Body'])) elements.append(Paragraph('%(address)s' % consult_data, styleSheet['Body'])) elements.append(Paragraph('%(city)s, %(state)s %(zipcode)s' % consult_data, styleSheet['Body'])) elements.append(Spacer(1, 12)) elements.append(Paragraph(patient, styleSheet['Body'])) elements.append(Spacer(1, 12)) elements.append(Paragraph(salutation, styleSheet['Body'])) elements.append(Spacer(1, 12)) elements.append(Paragraph(body, styleSheet['Body'])) elements.append(Spacer(1,12)) elements.append(Paragraph("I have attached current medications and problems. \ 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'])) elements.append(Spacer(1, 12)) tableList = [[problems, meds,]] table = Table(tableList, colWidths=(3*inch, 3*inch), style=[('VALIGN', (0,0), (-1,-1), 'TOP'), ('LEFTPADDING', (0,0), (-1,-1), 0), ('RIGHTPADDING', (0,0), (-1,-1), 20)]) table.hAlign = "LEFT" elements.append(table) # write the document to disk doc.build(elements) os.system("lp -d Updox %s" % filename) #extremely slick: prints directly to Updox Printer
def OnNew(self, event): self.soapNote.Show(False) self.newsoapNote.Show(True) self.Layout() self.textctrl['Date'].SetValue(str(EMR_utilities.dateToday(t='sql'))) self.billBtn.Show(False)
def __init__(self, ptID, noteNumber): self.ptID = ptID filename = "/home/mb/Desktop/GECKO/EMR_outputs/%s/Other/bill-%s.pdf" % (self.ptID, EMR_utilities.dateToday('file format')) doc = SimpleDocTemplate(filename, pagesize=letter, topMargin=60) # container for the 'Flowable' objects elements = [] styleSheet = getSampleStyleSheet() P0 = Paragraph('Barron Family Medicine', styleSheet['Normal']) P2 = Paragraph('1423 S Big Bend Blvd', styleSheet['Normal']) P3 = Paragraph('Richmond Heights, MO 63117', styleSheet['Normal']) T0 = Paragraph('<para align=RIGHT><font size=16><b>Statement of Charges and Payments</b></para></font>', styleSheet['Normal']) T1 = Spacer(1, 12) T2 = Paragraph('<para align=RIGHT><b>Date Printed:</b> %s</para>' % EMR_utilities.dateToday(), styleSheet['Normal']) T3 = Paragraph('<para align=RIGHT><b>Provider:</b> Michael Barron MD</para>', styleSheet['Normal']) T4 = Paragraph('<para align=RIGHT><b>Office Phone:</b> (314) 667-5276</para>', styleSheet['Normal']) data = [[[P0, P2, P3], [T0, T1, T2, T3, T4]]] t=Table(data, style=[('LEFTPADDING', (0,0), (-1,-1), 0), ('RIGHTPADDING', (0,0), (-1,-1), 0), ('VALIGN', (0,0), (-1,-1), 'TOP')]) t._argW[0]=2.5*inch elements.append(t) qry = 'SELECT * FROM demographics WHERE patient_ID = %s;' % self.ptID results = EMR_utilities.getDictData(qry) elements.append(Spacer(1,12)) ptext = '<para align=RIGHT><b>Patient:</b> %s %s</para>' % (results['firstname'], results['lastname']) elements.append(Paragraph(ptext, styleSheet['Normal'])) elements.append(Spacer(1,24)) elements.append(Paragraph('%(firstname)s %(lastname)s' % (results), styleSheet['Normal'])) elements.append(Paragraph('%(address)s' % results, styleSheet['Normal'])) elements.append(Paragraph('%(city)s, %(state)s %(zipcode)s' % results, styleSheet['Normal'])) elements.append(Spacer(1,36)) bill_data = [['Service Date', 'Qty', 'Description', 'CPT', 'Amount', 'Patient Balance'],] bill_qry = 'SELECT date, units, CPT_code, pt_pmt, 1_ins_pmt, 2_ins_pmt, balance FROM billing WHERE \ note_number = %s;' % noteNumber bill_results = EMR_utilities.getAllDictData(bill_qry) balance_due = decimal.Decimal() for n in range(len(bill_results)): cpt_qry = 'SELECT proc FROM fee_schedule WHERE cpt_code = "%s";' % bill_results[n]['CPT_code']#finds CPT description cpt_results = EMR_utilities.getData(cpt_qry) try: decimal.Decimal(bill_results[n]['1_ins_pmt']) except decimal.InvalidOperation: bill_results[n]['1_ins_pmt'] = 0 try: decimal.Decimal(bill_results[n]['2_ins_pmt']) except decimal.InvalidOperation: bill_results[n]['2_ins_pmt'] = 0 ins_payed = decimal.Decimal(bill_results[n]['1_ins_pmt']) + decimal.Decimal(bill_results[n]['2_ins_pmt'])#primary + secondary mylist = [bill_results[n]['date'], bill_results[n]['units'], cpt_results[0] + '\n Patient Co-pay\n Paid by Insurance', bill_results[n]['CPT_code'], '\n' + bill_results[n]['pt_pmt'] + '\n' + str(ins_payed), '\n\n\n' + bill_results[n]['balance']] bill_data.append(mylist) balance_due = balance_due + decimal.Decimal(bill_results[n]['balance']) T2 = Table(bill_data, style=[('VALIGN', (0,0), (-1,-1), 'TOP'), ('LEFTPADDING', (0,0), (-1,-1), 0), ('RIGHTPADDING', (0,0), (-1,-1), 20), ('LINEABOVE', (0,1), (-1,1), 1, colors.black)]) T2.hAlign = "LEFT" elements.append(T2) elements.append(Spacer(1,24)) elements.append(Paragraph('<para align=RIGHT><font size=14><b>Balance Due: </b>$%s</font>' % balance_due, styleSheet['Normal'])) mystring = wx.GetTextFromUser("Enter additional notes") elements.append(Paragraph('<b>NOTE:</b> %s' % mystring, styleSheet['Normal'])) elements.append(Spacer(1, 12)) elements.append(Paragraph('Sincerely,', styleSheet['Normal'])) '''logo = "/home/mb/Dropbox/Office/Signature.png" im = Image(logo, 2*inch, 0.75*inch) im.hAlign = "LEFT" elements.append(im)''' elements.append(Spacer(1,36)) elements.append(Paragraph('Michael Barron MD', styleSheet['Normal'])) elements.append(Spacer(1,24)) elements.append(Paragraph('<b>Address Change?</b> Please write below:', styleSheet['Normal'])) # write the document to disk doc.build(elements) os.system("lp %s" % filename)
def open_file(self): os.system('/usr/bin/gnome-open ' + "%s/EMR_outputs/%s/Other/rcpt-%s.pdf" % \ (settings.LINUXPATH, self.ptID, EMR_utilities.dateToday()))
def __init__(self, ptID, noteNumber): self.ptID = ptID filename = "/home/mb/Desktop/GECKO/EMR_outputs/%s/Other/bill-%s.pdf" % ( self.ptID, EMR_utilities.dateToday('file format')) doc = SimpleDocTemplate(filename, pagesize=letter, topMargin=60) # container for the 'Flowable' objects elements = [] styleSheet = getSampleStyleSheet() P0 = Paragraph('Barron Family Medicine', styleSheet['Normal']) P2 = Paragraph('1423 S Big Bend Blvd', styleSheet['Normal']) P3 = Paragraph('Richmond Heights, MO 63117', styleSheet['Normal']) T0 = Paragraph( '<para align=RIGHT><font size=16><b>Statement of Charges and Payments</b></para></font>', styleSheet['Normal']) T1 = Spacer(1, 12) T2 = Paragraph( '<para align=RIGHT><b>Date Printed:</b> %s</para>' % EMR_utilities.dateToday(), styleSheet['Normal']) T3 = Paragraph( '<para align=RIGHT><b>Provider:</b> Michael Barron MD</para>', styleSheet['Normal']) T4 = Paragraph( '<para align=RIGHT><b>Office Phone:</b> (314) 667-5276</para>', styleSheet['Normal']) data = [[[P0, P2, P3], [T0, T1, T2, T3, T4]]] t = Table(data, style=[('LEFTPADDING', (0, 0), (-1, -1), 0), ('RIGHTPADDING', (0, 0), (-1, -1), 0), ('VALIGN', (0, 0), (-1, -1), 'TOP')]) t._argW[0] = 2.5 * inch elements.append(t) qry = 'SELECT * FROM demographics WHERE patient_ID = %s;' % self.ptID results = EMR_utilities.getDictData(qry) elements.append(Spacer(1, 12)) ptext = '<para align=RIGHT><b>Patient:</b> %s %s</para>' % ( results['firstname'], results['lastname']) elements.append(Paragraph(ptext, styleSheet['Normal'])) elements.append(Spacer(1, 24)) elements.append( Paragraph('%(firstname)s %(lastname)s' % (results), styleSheet['Normal'])) elements.append( Paragraph('%(address)s' % results, styleSheet['Normal'])) elements.append( Paragraph('%(city)s, %(state)s %(zipcode)s' % results, styleSheet['Normal'])) elements.append(Spacer(1, 36)) bill_data = [ [ 'Service Date', 'Qty', 'Description', 'CPT', 'Amount', 'Patient Balance' ], ] bill_qry = 'SELECT date, units, CPT_code, pt_pmt, 1_ins_pmt, 2_ins_pmt, balance FROM billing WHERE \ note_number = %s;' % noteNumber bill_results = EMR_utilities.getAllDictData(bill_qry) balance_due = decimal.Decimal() for n in range(len(bill_results)): cpt_qry = 'SELECT proc FROM fee_schedule WHERE cpt_code = "%s";' % bill_results[ n]['CPT_code'] #finds CPT description cpt_results = EMR_utilities.getData(cpt_qry) try: decimal.Decimal(bill_results[n]['1_ins_pmt']) except decimal.InvalidOperation: bill_results[n]['1_ins_pmt'] = 0 try: decimal.Decimal(bill_results[n]['2_ins_pmt']) except decimal.InvalidOperation: bill_results[n]['2_ins_pmt'] = 0 ins_payed = decimal.Decimal( bill_results[n]['1_ins_pmt']) + decimal.Decimal( bill_results[n]['2_ins_pmt']) #primary + secondary mylist = [ bill_results[n]['date'], bill_results[n]['units'], cpt_results[0] + '\n Patient Co-pay\n Paid by Insurance', bill_results[n]['CPT_code'], '\n' + bill_results[n]['pt_pmt'] + '\n' + str(ins_payed), '\n\n\n' + bill_results[n]['balance'] ] bill_data.append(mylist) balance_due = balance_due + decimal.Decimal( bill_results[n]['balance']) T2 = Table(bill_data, style=[('VALIGN', (0, 0), (-1, -1), 'TOP'), ('LEFTPADDING', (0, 0), (-1, -1), 0), ('RIGHTPADDING', (0, 0), (-1, -1), 20), ('LINEABOVE', (0, 1), (-1, 1), 1, colors.black)]) T2.hAlign = "LEFT" elements.append(T2) elements.append(Spacer(1, 24)) elements.append( Paragraph( '<para align=RIGHT><font size=14><b>Balance Due: </b>$%s</font>' % balance_due, styleSheet['Normal'])) mystring = wx.GetTextFromUser("Enter additional notes") elements.append( Paragraph('<b>NOTE:</b> %s' % mystring, styleSheet['Normal'])) elements.append(Spacer(1, 12)) elements.append(Paragraph('Sincerely,', styleSheet['Normal'])) '''logo = "/home/mb/Dropbox/Office/Signature.png" im = Image(logo, 2*inch, 0.75*inch) im.hAlign = "LEFT" elements.append(im)''' elements.append(Spacer(1, 36)) elements.append(Paragraph('Michael Barron MD', styleSheet['Normal'])) elements.append(Spacer(1, 24)) elements.append( Paragraph('<b>Address Change?</b> Please write below:', styleSheet['Normal'])) # write the document to disk doc.build(elements) os.system("lp %s" % filename)
def __init__(self, parent, PtID): wx.Frame.__init__(self, parent, -1, title='Create CMS 1500 Form', pos=(100, 100), size=(800, 775)) self.PtID = PtID self.myparent = parent #allows access to notes page self.panel = wx.Panel(self, -1) self.columns = {} #this one is for the Gateway EDI print image file self.printImageDict = {} for n in range(1, 292): self.columns[n] = "" qry = "SELECT * FROM demographics WHERE patient_ID = %s;" % self.PtID self.ptResults = EMR_utilities.getDictData(qry) self.printImageDict.update( self.ptResults ) #starts collecting the data we need for print image self.columns[56] = 'X' self.columns[58] = 'X' self.columns[61] = 'X' self.renderingNPI = '1326063991' self.printImageDict['Admit'] = '' self.printImageDict['DC'] = '' self.whichIns = self.ptResults['insurance_company'] if self.ptResults['sex'].lower() == 'male': self.columns[21] = 'X' self.printImageDict['msex'] = 'X' elif self.ptResults['sex'] == '': dlg = wx.MessageBox( 'Gender information is missing on this patient.', 'Need more info', style=wx.OK) else: self.columns[22] = 'X' self.printImageDict['fsex'] = 'X' if self.ptResults['OtherInsuredGender'] == None: pass elif self.ptResults['OtherInsuredGender'].lower() == 'male': self.columns[51] = 'X' else: self.columns[52] = 'X' if self.ptResults['InsuredGender'] == None: pass elif self.ptResults['InsuredGender'].lower() == 'male': self.columns[65] = 'X' else: self.columns[66] = 'X' self.columns[70] = 'X' self.columns[71] = 'sof' #patient signature self.columns[ 73] = 'sof' #insured signature- authorizes payment to provider self.columns[100] = '26D2013625' #CLIA number self.columns[261] = '386525225' #TaxID self.columns[262] = 'X' #SSN; either SSN or EIN is checked self.columns[264] = self.PtID #PatientAcctNumber self.columns[265] = 'X' #AcceptAssignYes self.columns[267] = decimal.Decimal() #TotalCharges self.columns[268] = decimal.Decimal() #AmountPaid self.columns[270] = 'sof' #PhysicianSignature self.columns[271] = str( EMR_utilities.dateToday()) #PhysicianSignatureDate self.columns[272] = 'Barron' #PhysicianLast self.columns[273] = 'Michael' #PhysicianFirst self.columns[274] = 'O' #PhysicianMidInit self.columns[275] = 'Michael Barron MD' #FacilityName self.columns[276] = '8515 Delmar Blvd 217' #FacilityStreetAddr self.columns[277] = 'St. Louis' #FacilityCity self.columns[278] = 'MO' #FacilityState self.columns[279] = '63124-2168' #FacilityZip self.columns[280] = 'St. Louis, MO 63124-2168' #FacilityCityStateZip self.columns[281] = '1326063991' #FacilityNPI self.columns[284] = 'Michael Barron MD' #SupplierName self.columns[285] = '8515 Delmar Blvd #217' #SupplierStreetAddr self.columns[286] = 'St. Louis' #SupplierCity self.columns[287] = 'MO' #SupplierState self.columns[288] = '63124-2168' #SupplierZip self.columns[289] = 'St. Louis, MO 63124-2168' #SupplierCityStateZip self.columns[290] = '3146675276' #SupplierPhone self.columns[291] = '1326063991' #SupplierNPI self.columns[292] = '1326063991' #GroupID self.printImageDict['Fac_Adr'] = self.columns[280] """Basic plan is to create a dictionary with keys numbered from 1-228 which correspond to the columns in the office ally headers. Will then fill in the values based on queried data. Finally will step through the dictionary by key values and build the text file to submit to Office Ally. The columns are numbers rather than the columns names because we can easily step the number range to create the text file for OA. Comments include the Office Ally header names.""" #Insurance Address cpt_aFields = ('date', 'date', 'POS') cpt_bFields = ('CPT_code', 'mod_A', 'mod_B', 'mod_C', 'mod_D', 'dx_pter', 'total_charge') #insurance type, Box 1, is handled in OnSelectIns sizer = wx.GridBagSizer(10, 30) sizer.Add(wx.StaticText(self.panel, -1, "Insurance Type"), pos=(1, 1)) insListBox = wx.ListBox(self.panel, -1, choices=[ 'Medicare', 'Medicaid', 'Tricare', 'Champus', 'GHP', 'FECA', 'Other' ], style=wx.LB_SINGLE) sizer.Add(insListBox, pos=(2, 1), span=(4, 1), flag=wx.EXPAND) self.Bind(wx.EVT_LISTBOX, self.OnSelectIns, insListBox) sizer.Add(wx.StaticText(self.panel, -1, "Relation to Insured"), pos=(1, 2)) relListBox = wx.ListBox(self.panel, -1, choices=['self', 'spouse', 'child', 'other'], style=wx.LB_SINGLE) sizer.Add(relListBox, pos=(2, 2), span=(3, 1), flag=wx.EXPAND) self.Bind(wx.EVT_LISTBOX, self.OnSelectRel, relListBox) self.accList = ['n/a', 'employment', 'auto accident', 'other accident'] accBox = wx.RadioBox(self.panel, -1, "Illness/Injury due to ..?", choices=self.accList) self.Bind(wx.EVT_RADIOBOX, self.OnSelectAcc, accBox) sizer.Add(accBox, pos=(4, 3), span=(1, 3)) self.emplList = [ 'n/a', 'employed', 'full time student', 'part time student' ] emplBox = wx.RadioBox(self.panel, -1, "Employment Status?", choices=self.emplList) self.Bind(wx.EVT_RADIOBOX, self.OnSelectEmpl, emplBox) sizer.Add(emplBox, pos=(5, 3), span=(1, 3)) self.marList = ['n/a', 'single', 'married', 'other'] marBox = wx.RadioBox(self.panel, -1, "Marital status", choices=self.marList) self.Bind(wx.EVT_RADIOBOX, self.OnSelectMar, marBox) sizer.Add(marBox, pos=(6, 3), span=(1, 3)) otherInsBox = wx.CheckBox(self.panel, -1, "Check if there is other insurance") sizer.Add(otherInsBox, pos=(1, 3)) self.Bind(wx.EVT_CHECKBOX, self.OnSelectOtherIns, otherInsBox) self.billSecInsBox = wx.CheckBox(self.panel, -1, "Bill secondary insurance?") self.billSecAsPrim = wx.CheckBox(self.panel, -1, "as Primary?") secSizer = wx.BoxSizer(wx.HORIZONTAL) secSizer.Add(self.billSecInsBox, 0, wx.RIGHT, 5) secSizer.Add(self.billSecAsPrim, 0) sizer.Add(secSizer, pos=(2, 3)) self.Bind(wx.EVT_CHECKBOX, self.OnSelectSecIns, self.billSecInsBox) self.billForSue = wx.CheckBox(self.panel, -1, "Sue Leon is rendering provider") sizer.Add(self.billForSue, pos=(3, 3)) self.Bind(wx.EVT_CHECKBOX, self.OnBillForSue, self.billForSue) sizer.Add(wx.StaticText(self.panel, -1, "Date of Injury/Illness?"), pos=(7, 3)) dpc = wx.TextCtrl(self.panel, size=(120, -1)) sizer.Add(dpc, pos=(8, 3)) self.Bind(wx.EVT_KILL_FOCUS, self.OnDateChanged, dpc) #below pulls problem date from problem list; if not available then puts in the note's date dxQry = 'SELECT short_des FROM icd10 WHERE icd10 = "%s";' % self.myparent.textctrl[ 'ICD #1'].GetValue() dx = EMR_utilities.getData(dxQry) probDateQry = 'SELECT prob_date FROM problems10 WHERE short_des = "%s" AND patient_ID = %s;' % ( dx[0], self.PtID) probDate = EMR_utilities.getData(probDateQry) if probDate: dpc.SetValue(str(probDate[0])) else: dpc.SetValue(self.myparent.textctrl['Date'].GetValue()[:10]) self.hospAdmBox = wx.CheckBox(self.panel, -1, "Hospital Admission?") sizer.Add(self.hospAdmBox, pos=(9, 3)) self.admit_dpc = wx.DatePickerCtrl( self.panel, size=(100, -1), style=wx.DP_DEFAULT | wx.DP_SHOWCENTURY | wx.DP_ALLOWNONE) sizer.Add(self.admit_dpc, pos=(10, 3)) self.admit_dpc.Show(False) self.Bind(wx.EVT_DATE_CHANGED, self.OnAdmitDateChanged, self.admit_dpc) self.Bind(wx.EVT_CHECKBOX, self.OnHospAdmCheck, self.hospAdmBox) self.hospDC_Text = wx.StaticText(self.panel, -1, "Hospital Discharge") sizer.Add(self.hospDC_Text, pos=(8, 4)) self.hospDC_Text.Show(False) self.dc_dpc = wx.DatePickerCtrl(self.panel, size=(100, -1), style=wx.DP_DEFAULT | wx.DP_SHOWCENTURY | wx.DP_ALLOWNONE) self.dc_dpc.Show(False) sizer.Add(self.dc_dpc, pos=(9, 4)) self.Bind(wx.EVT_DATE_CHANGED, self.OnDischargeDateChanged, self.dc_dpc) self.FieldText = wx.StaticText( self.panel, -1, "Column:Content eg, 62:marcaine 1% 3cc") sizer.Add(self.FieldText, pos=(7, 1), span=(1, 2)) self.Field1 = wx.TextCtrl(self.panel, size=(200, -1)) sizer.Add(self.Field1, pos=(8, 1), span=(1, 2)) self.Field1.Bind(wx.EVT_KILL_FOCUS, self.OnFieldLoseFocus, self.Field1) doneBtn = EMR_utilities.buildOneButton(self, self.panel, "Done", self.OnDone) sizer.Add(doneBtn, pos=(11, 1)) self.panel.SetSizer(sizer) dt = time.strptime(dpc.GetValue(), "%Y-%m-%d") self.columns[74] = time.strftime("%m/%d/%y", dt)
def OnDone(self, event): #create file prnt = wx.GetTopLevelParent(self.myparent) #dem_page = parent.nb.GetPage(1) #figured this out using PyCrust (*this will mess up if you have extra pages*) path = EMR_utilities.getData("SELECT home_dir FROM users WHERE user_name = '%s'" % prnt.user) linuxpath = "/home/%s/Desktop/GECKO/Billing/OfficeAlly" % path[0] + "_%s.txt" applepath = "/Users/%s/Desktop/GECKO/Billing/OfficeAlly" % path[0] + "_%s.txt" windowspath = "C:\\Documents and Settings\\%s\\My Documents\\GECKO\\Billing\\OfficeAlly" % path[0] + "_%s.txt" daily_billing = EMR_utilities.platformText(linuxpath, applepath, windowspath) % EMR_utilities.dateToday() a_file = open(daily_billing, 'a') #'a' will both append to existing and create if nonexistent gateway_file = open("/home/%s/Desktop/GECKO/Billing/Gateway" % settings.HOME_FOLDER + "%s.txt" % EMR_utilities.dateToday(), 'a') #get demographic and insurance data insFields = (('InsurancePlanName', 1), ('InsurancePayerID', 2), ('InsuranceStreetAddr', 3), ('InsuranceCity', 4), \ ('InsuranceState', 5), ('InsuranceZip', 6), ('InsuranceCityStateZip', 7), ('InsurancePhone', 8)) fields = (('lastname', 17), ('firstname', 18), ('mid_init', 19), ('dob', 20), ('address', 26), \ ('city', 27), ('state', 28), ('zipcode', 29), ('phonenumber', 30), ('sof', 72), \ \ ('policy_ID', 16), ('InsuredLast', 23), ('InsuredFirst', 24), ('InsuredMidInit', 25), \ ('InsuredStreetAddress', 35), ('InsuredCity', 36), ('InsuredState', 37), \ ('InsuredZip', 38), ('InsuredPhone', 39), \ ('InsuredPolicyGroupOrFecaNumber', 63), ('InsuredDOB', 64), \ ('InsuredEmployerNameOrSchoolName', 67), ('InsuredInsurancePlanNameOrProgramName', 68), \ \ ('OtherInsuredLast', 46), ('OtherInsuredFirst', 47), ('OtherInsuredMidInit', 48), \ ('OtherInsuredPolicyOrGroupNumber', 49), ('OtherInsuredDOB', 50), \ ('OtherInsuredEmployerNameOrSchoolName', 53), ('OtherInsuredInsurancePlanOrProgramName', 54)) insQry = "SELECT * FROM ins_companies WHERE InsurancePlanName = '%s';" % self.whichIns insResults = EMR_utilities.getDictData(insQry) self.printImageDict.update(insResults) #adds more necessary data for print image self.createOADict(insFields, insResults) self.createOADict(fields, self.ptResults) self.get1500Data() self.columns[269] = self.columns[267] - self.columns[268] #BalanceDue if self.billSecInsBox.IsChecked(): EMR_utilities.updateData('UPDATE billing SET 2ndDate = CURDATE() \ WHERE note_number = %s;' % (self.noteNumber)) self.columns[16] = self.ptResults['secondary_ins_ID'] #replaces the primary ins ID self.columns[63] = self.ptResults['sec_PolicyGroupOrFecaNumber'] #replaces primary ins policy number if self.billSecAsPrim.IsChecked(): #allows billing secondary as primary pass else: self.columns[1] = self.columns[1] + ' secondary' #this is how OA does sec ins billing else: EMR_utilities.updateData('UPDATE billing SET 1stDate = CURDATE() \ WHERE note_number = %s;' % (self.noteNumber)) if self.hospAdmBox.IsChecked(): #checks to make sure dates are filled in if not self.columns[83]: self.columns[83] = EMR_utilities.dateToday('OA') if not self.columns[84]: self.columns[84] = EMR_utilities.dateToday('OA') for n in range(1, 292): #remove all the None entries which OA doesn't like if self.columns[n] == None: self.columns[n] = '' else: pass for n in range(1, 292): a_file.write(str(self.columns[n]) + '\t') a_file.write('\n') """Print image for Gateway EDI""" self.printImageDict['Name'] = self.printImageDict['lastname'] + ', ' + self.printImageDict['firstname'] self.printImageDict['InsuredName'] = self.printImageDict['InsuredLast'] + ', ' + self.printImageDict['InsuredFirst'] self.printImageDict['InsuranceCityStateZip'] = insResults['InsuranceCity'] + ', ' + insResults['InsuranceState'] + ' ' \ + insResults['InsuranceZip'] self.printImageDict['Medicare'] = self.columns[9] self.printImageDict['Medicaid'] = self.columns[10] self.printImageDict['Other'] = self.columns[15] self.printImageDict['self'] = self.columns[31] self.printImageDict['spouse'] = self.columns[32] self.printImageDict['child'] = self.columns[33] self.printImageDict['other'] = self.columns[34] self.printImageDict['empl_no'] = self.columns[56] self.printImageDict['auto_no'] = self.columns[58] self.printImageDict['other_no'] = self.columns[61] self.printImageDict['empl_yes'] = self.columns[55] self.printImageDict['auto_yes'] = self.columns[57] self.printImageDict['other_yes'] = self.columns[60] self.printImageDict['auto_state'] = self.columns[59] self.printImageDict['icd1'] = self.columns[89] self.printImageDict['icd2'] = self.columns[90] self.printImageDict['icd3'] = self.columns[91] self.printImageDict['icd4'] = self.columns[92] self.printImageDict['icd5'] = self.columns[93] self.printImageDict['icd6'] = self.columns[94] self.printImageDict['icd7'] = self.columns[95] self.printImageDict['icd8'] = self.columns[96] dateList = ['dob', 'sof', 'Admit', 'DC', '101', '117', '133', '149', '165', '181'] for item in dateList: #fixes problem with dates not showing up on print image try: self.printImageDict[item] = self.printImageDict[item].strftime("%m %d %y") except: self.printImageDict[item] = self.printImageDict[item].replace('/', ' ') self.printImageDict['sig'] = 'Signature on File' self.printImageDict['267'] = str(self.columns[267]) #total charges converting decimal.decimal to string self.printImageDict['268'] = str(self.columns[268]) #this is amount paid, same as above #this brings in secondary/other insurance info if present if self.ptResults['secondary_ins']: self.printImageDict['OtherInsuredDOB'] = self.printImageDict['dob'] self.printImageDict['OtherName'] = self.printImageDict['Name'] self.printImageDict['Taxonomy'] = '207Q00000X' self.printImageDict['CLIA'] = '26D2013625' myMap = {1:((49, 'InsurancePlanName'),), 2:((49, 'InsuranceStreetAddr'),), 3:((49, 'InsuranceCityStateZip'),), 4:((49, 'InsurancePayerID'),), 7:((2, 'Medicare'), (12, 'Medicaid'), (47, 'Other'), (51, 'policy_ID')), 9:((2, 'Name'), (31, 'dob'), (44, 'msex'), (48, 'fsex'), (51, 'InsuredName')), 11:((2, 'address'), (33, 'self'), (35, 'spouse'), (37, 'child'), (39, 'other'), (51, 'InsuredStreetAddress')), 13:((2, 'city'), (28, 'state'), (51, 'InsuredCity'), (74, 'InsuredState')), 15:((2, 'zipcode'), (16, 'phonenumber'), (51, 'InsuredZip'), (66, 'InsuredPhone')), 17:((2, 'OtherName'), (51, 'InsuredPolicyGroupOrFecaNumber')), 19:((2, 'secondary_ins_ID'), (38, 'empl_yes'), (42, 'empl_no')), 21:((2, 'OtherInsuredDOB'), (38, 'auto_yes'), (42, 'auto_no'), (45, 'auto_state')), 23:((38, 'other_yes'), (42, 'other_no'), (51, 'InsuredInsurancePlanNameOrProgramName')), 25:((2, 'secondary_ins'),), 29:((9, 'sig'), (39, 'sof'), (59, 'sig')), 33:((60, 'Admit'), (72, 'DC')), #37:((4, 'icd1'), (31, 'icd3')), 37:((4, 'icd1'), (10, 'icd3'), (16, 'icd5'), (22, 'icd7'), (28, 'icd9')), #39:((4, 'icd2'), (31, 'icd4'), (51, 'CLIA')), 39:((4, 'icd2'), (10, 'icd4'), (16, 'icd6'), (22, 'icd8'), (28, 'icd10'), (51, 'CLIA')), #42:((2, '101'), (21, '103'), (27, '105'), (34, '106'), (37, '107'), (40, '108'), (43, '109'), (47, '110'), (54, '111'), (61, '112'), (71, '116')), #44:((2, '117'), (21, '119'), (27, '121'), (34, '122'), (37, '123'), (40, '124'), (43, '125'), (47, '126'), (54, '127'), (61, '128'), (71, '132')), #46:((2, '133'), (21, '135'), (27, '137'), (34, '138'), (37, '139'), (40, '140'), (43, '141'), (47, '142'), (54, '143'), (61, '144'), (71, '148')), #48:((2, '149'), (21, '151'), (27, '153'), (34, '154'), (37, '155'), (40, '156'), (43, '157'), (47, '158'), (54, '159'), (61, '160'), (71, '164')), #50:((2, '165'), (21, '167'), (27, '169'), (34, '170'), (37, '171'), (40, '172'), (43, '173'), (47, '174'), (54, '175'), (61, '176'), (71, '180')), #52:((2, '181'), (21, '183'), (27, '185'), (34, '186'), (37, '187'), (40, '188'), (43, '189'), (47, '190'), (54, '191'), (61, '192'), (71, '196')), 42:((2, '101'), (21, '103'), (27, '105'), (34, '106'), (37, '107'), (40, '108'), (43, '109'), (47, '110'), (59, '111'), (66, '112'), (76, '116')), 44:((2, '117'), (21, '119'), (27, '121'), (34, '122'), (37, '123'), (40, '124'), (43, '125'), (47, '126'), (59, '127'), (66, '128'), (76, '132')), 46:((2, '133'), (21, '135'), (27, '137'), (34, '138'), (37, '139'), (40, '140'), (43, '141'), (47, '142'), (59, '143'), (66, '144'), (76, '148')), 48:((2, '149'), (21, '151'), (27, '153'), (34, '154'), (37, '155'), (40, '156'), (43, '157'), (47, '158'), (59, '159'), (66, '160'), (76, '164')), 50:((2, '165'), (21, '167'), (27, '169'), (34, '170'), (37, '171'), (40, '172'), (43, '173'), (47, '174'), (59, '175'), (66, '176'), (76, '180')), 52:((2, '181'), (21, '183'), (27, '185'), (34, '186'), (37, '187'), (40, '188'), (43, '189'), (47, '190'), (59, '191'), (66, '192'), (76, '196')), 53:((2, '261'), (18, '262'), (24, '264'), (40, '265'), (56, '267')), 54:((67, '290'),), 55:((25, '275'), (54, '284')), 56:((25, '276'), (54, '285')), 57:((2, '284'), (25, 'Fac_Adr'), (54, '289')), 58:((9, '101'), (25, '281'), (54, '291'), (71, 'Taxonomy'))} for a in range(1,59): s = '' try: for space, entry in myMap[a]: padding = space - len(s) bump = " " * padding try: s = s + bump + self.printImageDict[entry] except: pass #print entry + ' was empty' #this takes care of empty entries except: pass s = s + '\n' #write newline to myfile gateway_file.write(s) gateway_file.write('\n\n\n\n') gateway_file.close() a_file.close() self.Destroy()
def OnDone(self, event): #create file prnt = wx.GetTopLevelParent(self.myparent) #dem_page = parent.nb.GetPage(1) #figured this out using PyCrust (*this will mess up if you have extra pages*) path = EMR_utilities.getData( "SELECT home_dir FROM users WHERE user_name = '%s'" % prnt.user) linuxpath = "/home/%s/Desktop/GECKO/Billing/OfficeAlly" % path[ 0] + "_%s.txt" applepath = "/Users/%s/Desktop/GECKO/Billing/OfficeAlly" % path[ 0] + "_%s.txt" windowspath = "C:\\Documents and Settings\\%s\\My Documents\\GECKO\\Billing\\OfficeAlly" % path[ 0] + "_%s.txt" daily_billing = EMR_utilities.platformText( linuxpath, applepath, windowspath) % EMR_utilities.dateToday() a_file = open( daily_billing, 'a') #'a' will both append to existing and create if nonexistent gateway_file = open( "/home/%s/Desktop/GECKO/Billing/Gateway" % settings.HOME_FOLDER + "%s.txt" % EMR_utilities.dateToday(), 'a') #get demographic and insurance data insFields = (('InsurancePlanName', 1), ('InsurancePayerID', 2), ('InsuranceStreetAddr', 3), ('InsuranceCity', 4), \ ('InsuranceState', 5), ('InsuranceZip', 6), ('InsuranceCityStateZip', 7), ('InsurancePhone', 8)) fields = (('lastname', 17), ('firstname', 18), ('mid_init', 19), ('dob', 20), ('address', 26), \ ('city', 27), ('state', 28), ('zipcode', 29), ('phonenumber', 30), ('sof', 72), \ \ ('policy_ID', 16), ('InsuredLast', 23), ('InsuredFirst', 24), ('InsuredMidInit', 25), \ ('InsuredStreetAddress', 35), ('InsuredCity', 36), ('InsuredState', 37), \ ('InsuredZip', 38), ('InsuredPhone', 39), \ ('InsuredPolicyGroupOrFecaNumber', 63), ('InsuredDOB', 64), \ ('InsuredEmployerNameOrSchoolName', 67), ('InsuredInsurancePlanNameOrProgramName', 68), \ \ ('OtherInsuredLast', 46), ('OtherInsuredFirst', 47), ('OtherInsuredMidInit', 48), \ ('OtherInsuredPolicyOrGroupNumber', 49), ('OtherInsuredDOB', 50), \ ('OtherInsuredEmployerNameOrSchoolName', 53), ('OtherInsuredInsurancePlanOrProgramName', 54)) insQry = "SELECT * FROM ins_companies WHERE InsurancePlanName = '%s';" % self.whichIns insResults = EMR_utilities.getDictData(insQry) self.printImageDict.update( insResults) #adds more necessary data for print image self.createOADict(insFields, insResults) self.createOADict(fields, self.ptResults) self.get1500Data() self.columns[269] = self.columns[267] - self.columns[268] #BalanceDue if self.billSecInsBox.IsChecked(): EMR_utilities.updateData('UPDATE billing SET 2ndDate = CURDATE() \ WHERE note_number = %s;' % (self.noteNumber)) self.columns[16] = self.ptResults[ 'secondary_ins_ID'] #replaces the primary ins ID self.columns[63] = self.ptResults[ 'sec_PolicyGroupOrFecaNumber'] #replaces primary ins policy number if self.billSecAsPrim.IsChecked( ): #allows billing secondary as primary pass else: self.columns[1] = self.columns[ 1] + ' secondary' #this is how OA does sec ins billing else: EMR_utilities.updateData('UPDATE billing SET 1stDate = CURDATE() \ WHERE note_number = %s;' % (self.noteNumber)) if self.hospAdmBox.IsChecked( ): #checks to make sure dates are filled in if not self.columns[83]: self.columns[83] = EMR_utilities.dateToday('OA') if not self.columns[84]: self.columns[84] = EMR_utilities.dateToday('OA') for n in range( 1, 292): #remove all the None entries which OA doesn't like if self.columns[n] == None: self.columns[n] = '' else: pass for n in range(1, 292): a_file.write(str(self.columns[n]) + '\t') a_file.write('\n') """Print image for Gateway EDI""" self.printImageDict['Name'] = self.printImageDict[ 'lastname'] + ', ' + self.printImageDict['firstname'] self.printImageDict['InsuredName'] = self.printImageDict[ 'InsuredLast'] + ', ' + self.printImageDict['InsuredFirst'] self.printImageDict['InsuranceCityStateZip'] = insResults['InsuranceCity'] + ', ' + insResults['InsuranceState'] + ' ' \ + insResults['InsuranceZip'] self.printImageDict['Medicare'] = self.columns[9] self.printImageDict['Medicaid'] = self.columns[10] self.printImageDict['Other'] = self.columns[15] self.printImageDict['self'] = self.columns[31] self.printImageDict['spouse'] = self.columns[32] self.printImageDict['child'] = self.columns[33] self.printImageDict['other'] = self.columns[34] self.printImageDict['empl_no'] = self.columns[56] self.printImageDict['auto_no'] = self.columns[58] self.printImageDict['other_no'] = self.columns[61] self.printImageDict['empl_yes'] = self.columns[55] self.printImageDict['auto_yes'] = self.columns[57] self.printImageDict['other_yes'] = self.columns[60] self.printImageDict['auto_state'] = self.columns[59] self.printImageDict['icd1'] = self.columns[89] self.printImageDict['icd2'] = self.columns[90] self.printImageDict['icd3'] = self.columns[91] self.printImageDict['icd4'] = self.columns[92] self.printImageDict['icd5'] = self.columns[93] self.printImageDict['icd6'] = self.columns[94] self.printImageDict['icd7'] = self.columns[95] self.printImageDict['icd8'] = self.columns[96] dateList = [ 'dob', 'sof', 'Admit', 'DC', '101', '117', '133', '149', '165', '181' ] for item in dateList: #fixes problem with dates not showing up on print image try: self.printImageDict[item] = self.printImageDict[item].strftime( "%m %d %y") except: self.printImageDict[item] = self.printImageDict[item].replace( '/', ' ') self.printImageDict['sig'] = 'Signature on File' self.printImageDict['267'] = str( self.columns[267] ) #total charges converting decimal.decimal to string self.printImageDict['268'] = str( self.columns[268]) #this is amount paid, same as above #this brings in secondary/other insurance info if present if self.ptResults['secondary_ins']: self.printImageDict['OtherInsuredDOB'] = self.printImageDict['dob'] self.printImageDict['OtherName'] = self.printImageDict['Name'] self.printImageDict['Taxonomy'] = '207Q00000X' self.printImageDict['CLIA'] = '26D2013625' myMap = { 1: ((49, 'InsurancePlanName'), ), 2: ((49, 'InsuranceStreetAddr'), ), 3: ((49, 'InsuranceCityStateZip'), ), 4: ((49, 'InsurancePayerID'), ), 7: ((2, 'Medicare'), (12, 'Medicaid'), (47, 'Other'), (51, 'policy_ID')), 9: ((2, 'Name'), (31, 'dob'), (44, 'msex'), (48, 'fsex'), (51, 'InsuredName')), 11: ((2, 'address'), (33, 'self'), (35, 'spouse'), (37, 'child'), (39, 'other'), (51, 'InsuredStreetAddress')), 13: ((2, 'city'), (28, 'state'), (51, 'InsuredCity'), (74, 'InsuredState')), 15: ((2, 'zipcode'), (16, 'phonenumber'), (51, 'InsuredZip'), (66, 'InsuredPhone')), 17: ((2, 'OtherName'), (51, 'InsuredPolicyGroupOrFecaNumber')), 19: ((2, 'secondary_ins_ID'), (38, 'empl_yes'), (42, 'empl_no')), 21: ((2, 'OtherInsuredDOB'), (38, 'auto_yes'), (42, 'auto_no'), (45, 'auto_state')), 23: ((38, 'other_yes'), (42, 'other_no'), (51, 'InsuredInsurancePlanNameOrProgramName')), 25: ((2, 'secondary_ins'), ), 29: ((9, 'sig'), (39, 'sof'), (59, 'sig')), 33: ((60, 'Admit'), (72, 'DC')), #37:((4, 'icd1'), (31, 'icd3')), 37: ((4, 'icd1'), (10, 'icd3'), (16, 'icd5'), (22, 'icd7'), (28, 'icd9')), #39:((4, 'icd2'), (31, 'icd4'), (51, 'CLIA')), 39: ((4, 'icd2'), (10, 'icd4'), (16, 'icd6'), (22, 'icd8'), (28, 'icd10'), (51, 'CLIA')), #42:((2, '101'), (21, '103'), (27, '105'), (34, '106'), (37, '107'), (40, '108'), (43, '109'), (47, '110'), (54, '111'), (61, '112'), (71, '116')), #44:((2, '117'), (21, '119'), (27, '121'), (34, '122'), (37, '123'), (40, '124'), (43, '125'), (47, '126'), (54, '127'), (61, '128'), (71, '132')), #46:((2, '133'), (21, '135'), (27, '137'), (34, '138'), (37, '139'), (40, '140'), (43, '141'), (47, '142'), (54, '143'), (61, '144'), (71, '148')), #48:((2, '149'), (21, '151'), (27, '153'), (34, '154'), (37, '155'), (40, '156'), (43, '157'), (47, '158'), (54, '159'), (61, '160'), (71, '164')), #50:((2, '165'), (21, '167'), (27, '169'), (34, '170'), (37, '171'), (40, '172'), (43, '173'), (47, '174'), (54, '175'), (61, '176'), (71, '180')), #52:((2, '181'), (21, '183'), (27, '185'), (34, '186'), (37, '187'), (40, '188'), (43, '189'), (47, '190'), (54, '191'), (61, '192'), (71, '196')), 42: ((2, '101'), (21, '103'), (27, '105'), (34, '106'), (37, '107'), (40, '108'), (43, '109'), (47, '110'), (59, '111'), (66, '112'), (76, '116')), 44: ((2, '117'), (21, '119'), (27, '121'), (34, '122'), (37, '123'), (40, '124'), (43, '125'), (47, '126'), (59, '127'), (66, '128'), (76, '132')), 46: ((2, '133'), (21, '135'), (27, '137'), (34, '138'), (37, '139'), (40, '140'), (43, '141'), (47, '142'), (59, '143'), (66, '144'), (76, '148')), 48: ((2, '149'), (21, '151'), (27, '153'), (34, '154'), (37, '155'), (40, '156'), (43, '157'), (47, '158'), (59, '159'), (66, '160'), (76, '164')), 50: ((2, '165'), (21, '167'), (27, '169'), (34, '170'), (37, '171'), (40, '172'), (43, '173'), (47, '174'), (59, '175'), (66, '176'), (76, '180')), 52: ((2, '181'), (21, '183'), (27, '185'), (34, '186'), (37, '187'), (40, '188'), (43, '189'), (47, '190'), (59, '191'), (66, '192'), (76, '196')), 53: ((2, '261'), (18, '262'), (24, '264'), (40, '265'), (56, '267')), 54: ((67, '290'), ), 55: ((25, '275'), (54, '284')), 56: ((25, '276'), (54, '285')), 57: ((2, '284'), (25, 'Fac_Adr'), (54, '289')), 58: ((9, '101'), (25, '281'), (54, '291'), (71, 'Taxonomy')) } for a in range(1, 59): s = '' try: for space, entry in myMap[a]: padding = space - len(s) bump = " " * padding try: s = s + bump + self.printImageDict[entry] except: pass #print entry + ' was empty' #this takes care of empty entries except: pass s = s + '\n' #write newline to myfile gateway_file.write(s) gateway_file.write('\n\n\n\n') gateway_file.close() a_file.close() self.Destroy()
def open_file(self): os.system('/usr/bin/gnome-open ' + "/home/mb/Desktop/GECKO/EMR_outputs/%s/Other/rcpt-%s.pdf" % \ (self.ptID, EMR_utilities.dateToday()))
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 __init__(self, parent, ptID): self.ptID = ptID filename = "/home/mb/Desktop/GECKO/EMR_outputs/%s/Other/work-release-%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)) styleSheet.add( ParagraphStyle(name='Indent', fontSize=12, leading=14, leftIndent=25)) 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'])) elements.append(Spacer(1, 36)) elements.append( Paragraph( '<para align=RIGHT>%s</para>' % EMR_utilities.dateToday(t='display'), styleSheet['Body'])) qry = 'SELECT * FROM demographics WHERE patient_ID = %s;' % self.ptID results = EMR_utilities.getDictData(qry) name = '%(firstname)s %(lastname)s' % (results) elements.append(Spacer(1, 56)) elements.append( Paragraph( 'Physician Statement regarding %(firstname)s %(lastname)s, \ DOB: %(dob)s' % (results), styleSheet['Address'])) elements.append(Spacer(1, 36)) date_dlg = wx.TextEntryDialog(parent, "", "Return to Work Date", EMR_utilities.dateToday(t='display'), style=wx.OK | wx.CANCEL) date_dlg.ShowModal() place_dlg = wx.TextEntryDialog(parent, "Return to ...?", "school? work? daycare?", "work", style=wx.OK | wx.CANCEL) place_dlg.ShowModal() elements.append( Paragraph( '%s has been under my care and is released to return to %s on %s \ with the following restrictions:' % (name, place_dlg.GetValue(), date_dlg.GetValue()), styleSheet['Body'])) elements.append(Spacer(1, 24)) body = wx.TextEntryDialog( parent, "", "Work Restrictions", "No prolonged standing, bending, twisting, squatting or lifting more than 15 pounds for one week.", style=wx.TE_MULTILINE | wx.OK | wx.CANCEL) body.ShowModal() elements.append(Paragraph(body.GetValue(), styleSheet['Indent'])) elements.append(Spacer(1, 24)) 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)
def __init__(self, parent, ptID, reason, background, consultant, dueDate): lt = "%s/EMR_outputs/%s/Consults/%s.pdf" % (settings.LINUXPATH, ptID, EMR_utilities.dateToday('file format')) at = "%s/EMR_outputs/%s/Consults/%s.pdf" % (settings.APPLEPATH, ptID, EMR_utilities.dateToday('file format')) wt = "%s\EMR_outputs\%s\Consults\%s.pdf" % (settings.WINPATH, ptID, EMR_utilities.dateToday('file format')) filename = EMR_utilities.platformText(lt, at, wt) 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)) dem_data = EMR_utilities.getDictData('SELECT * FROM demographics WHERE patient_ID = %s;' % ptID) consultDoc = EMR_utilities.name_fixer(consultant) if consultDoc.firstname == '': consult_data = EMR_utilities.getDictData('SELECT * FROM consultants WHERE lastname = "%s";' \ % (consultDoc.lastname)) else: consult_data = EMR_utilities.getDictData('SELECT * FROM consultants WHERE lastname = "%s" \ AND firstname = "%s";' % (consultDoc.lastname, consultDoc.firstname)) dem_data['phonenumber'] = EMR_formats.phone_format(dem_data['phonenumber']) patient = 'RE: %(firstname)s %(lastname)s, DOB: %(dob)s, Phone: %(phonenumber)s' % dem_data salutation = 'Dear Dr. %(lastname)s:' % consult_data body = 'I am sending %s, a %s %s, to see you regarding %s. %s' % \ (dem_data['firstname'], EMR_utilities.getAge(ptID), dem_data['sex'], reason, background) problems = EMR_formats.getProblems(ptID) meds = EMR_formats.getMeds(ptID, display='column') qry = "INSERT INTO todo SET patient_ID = %s, date = '%s', description = '%s- %s', priority = 3, \ category = 'Consult', due_date = '%s', complete = 0;" % (ptID, EMR_utilities.dateToday(), \ consult_data['lastname'], reason, dueDate) EMR_utilities.updateData(qry) 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('8515 Delmar Blvd #217', styleSheet['Address'])) elements.append(Paragraph('University City, MO 63124', styleSheet['Address'])) elements.append(Paragraph('(314)667-5276 fax:(314)677-3838', 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,24)) elements.append(Paragraph('Dr. %(lastname)s' % consult_data, styleSheet['Body'])) elements.append(Paragraph('%(address)s' % consult_data, styleSheet['Body'])) elements.append(Paragraph('%(city)s, %(state)s %(zipcode)s' % consult_data, styleSheet['Body'])) elements.append(Spacer(1, 12)) elements.append(Paragraph(patient, styleSheet['Body'])) elements.append(Spacer(1, 12)) elements.append(Paragraph(salutation, styleSheet['Body'])) elements.append(Spacer(1, 12)) elements.append(Paragraph(body, styleSheet['Body'])) elements.append(Spacer(1,12)) elements.append(Paragraph("I have attached current medications and problems. \ 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'])) #If you want the signature automatically then can un-comment these lines. For now I will sign all. #logo = "/home/%s/Dropbox/Office/%sSignature.png" % (settings.HOME_FOLDER, settings.HOME_FOLDER) #im = Image(logo, 2*inch, 0.75*inch) #im.hAlign = "LEFT" #elements.append(im) chooseSig(elements) elements.append(Paragraph(settings.NAME, styleSheet['Body'])) elements.append(Spacer(1, 12)) tableList = [[problems, meds,]] table = Table(tableList, colWidths=(3*inch, 3*inch), style=[('VALIGN', (0,0), (-1,-1), 'TOP'), ('LEFTPADDING', (0,0), (-1,-1), 0), ('RIGHTPADDING', (0,0), (-1,-1), 20)]) table.hAlign = "LEFT" elements.append(table) # write the document to disk doc.build(elements) choosePrinter(filename)
def __init__(self, parent, ptID): self.ptID = ptID filename = "/home/mb/Desktop/GECKO/EMR_outputs/%s/Other/work-release-%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)) styleSheet.add(ParagraphStyle(name='Indent', fontSize=12, leading=14, leftIndent=25)) 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'])) elements.append(Spacer(1, 36)) elements.append(Paragraph('<para align=RIGHT>%s</para>' % EMR_utilities.dateToday(t='display'), styleSheet['Body'])) qry = 'SELECT * FROM demographics WHERE patient_ID = %s;' % self.ptID results = EMR_utilities.getDictData(qry) name = '%(firstname)s %(lastname)s' % (results) elements.append(Spacer(1,56)) elements.append(Paragraph('Physician Statement regarding %(firstname)s %(lastname)s, \ DOB: %(dob)s' % (results), styleSheet['Address'])) elements.append(Spacer(1,36)) date_dlg = wx.TextEntryDialog(parent, "", "Return to Work Date", EMR_utilities.dateToday(t='display'), style=wx.OK|wx.CANCEL) date_dlg.ShowModal() place_dlg = wx.TextEntryDialog(parent, "Return to ...?", "school? work? daycare?", "work", style=wx.OK|wx.CANCEL) place_dlg.ShowModal() elements.append(Paragraph('%s has been under my care and is released to return to %s on %s \ with the following restrictions:' % (name, place_dlg.GetValue(), date_dlg.GetValue()), styleSheet['Body'])) elements.append(Spacer(1,24)) body = wx.TextEntryDialog(parent, "", "Work Restrictions", "No prolonged standing, bending, twisting, squatting or lifting more than 15 pounds for one week.", style=wx.TE_MULTILINE|wx.OK|wx.CANCEL) body.ShowModal() elements.append(Paragraph(body.GetValue(), styleSheet['Indent'])) elements.append(Spacer(1,24)) 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)
def __init__(self, parent, PtID): wx.Frame.__init__(self, parent, -1, title='Create CMS 1500 Form', pos=(100,100), size=(800,775)) self.PtID = PtID self.myparent = parent #allows access to notes page self.panel = wx.Panel(self, -1) self.columns = {} #this one is for the Gateway EDI print image file self.printImageDict = {} for n in range(1, 292): self.columns[n] = "" qry = "SELECT * FROM demographics WHERE patient_ID = %s;" % self.PtID self.ptResults = EMR_utilities.getDictData(qry) self.printImageDict.update(self.ptResults) #starts collecting the data we need for print image self.columns[56] = 'X' self.columns[58] = 'X' self.columns[61] = 'X' self.renderingNPI = '1326063991' self.printImageDict['Admit'] = '' self.printImageDict['DC'] = '' self.whichIns = self.ptResults['insurance_company'] if self.ptResults['sex'].lower() == 'male': self.columns[21] = 'X' self.printImageDict['msex'] = 'X' elif self.ptResults['sex'] == '': dlg = wx.MessageBox('Gender information is missing on this patient.', 'Need more info', style=wx.OK) else: self.columns[22] = 'X' self.printImageDict['fsex'] = 'X' if self.ptResults['OtherInsuredGender'] == None: pass elif self.ptResults['OtherInsuredGender'].lower() == 'male': self.columns[51] = 'X' else: self.columns[52] = 'X' if self.ptResults['InsuredGender'] == None: pass elif self.ptResults['InsuredGender'].lower() == 'male': self.columns[65] = 'X' else: self.columns[66] = 'X' self.columns[70] = 'X' self.columns[71] = 'sof' #patient signature self.columns[73] = 'sof' #insured signature- authorizes payment to provider self.columns[100] = '26D2013625' #CLIA number self.columns[261] = '386525225' #TaxID self.columns[262] = 'X' #SSN; either SSN or EIN is checked self.columns[264] = self.PtID #PatientAcctNumber self.columns[265] = 'X' #AcceptAssignYes self.columns[267] = decimal.Decimal() #TotalCharges self.columns[268] = decimal.Decimal() #AmountPaid self.columns[270] = 'sof' #PhysicianSignature self.columns[271] = str(EMR_utilities.dateToday()) #PhysicianSignatureDate self.columns[272] = 'Barron' #PhysicianLast self.columns[273] = 'Michael' #PhysicianFirst self.columns[274] = 'O' #PhysicianMidInit self.columns[275] = 'Michael Barron MD' #FacilityName self.columns[276] = '8515 Delmar Blvd 217' #FacilityStreetAddr self.columns[277] = 'St. Louis' #FacilityCity self.columns[278] = 'MO' #FacilityState self.columns[279] = '63124-2168' #FacilityZip self.columns[280] = 'St. Louis, MO 63124-2168' #FacilityCityStateZip self.columns[281] = '1326063991' #FacilityNPI self.columns[284] = 'Michael Barron MD' #SupplierName self.columns[285] = '8515 Delmar Blvd #217' #SupplierStreetAddr self.columns[286] = 'St. Louis' #SupplierCity self.columns[287] = 'MO' #SupplierState self.columns[288] = '63124-2168' #SupplierZip self.columns[289] = 'St. Louis, MO 63124-2168' #SupplierCityStateZip self.columns[290] = '3146675276' #SupplierPhone self.columns[291] = '1326063991' #SupplierNPI self.columns[292] = '1326063991' #GroupID self.printImageDict['Fac_Adr'] = self.columns[280] """Basic plan is to create a dictionary with keys numbered from 1-228 which correspond to the columns in the office ally headers. Will then fill in the values based on queried data. Finally will step through the dictionary by key values and build the text file to submit to Office Ally. The columns are numbers rather than the columns names because we can easily step the number range to create the text file for OA. Comments include the Office Ally header names.""" #Insurance Address cpt_aFields = ('date', 'date', 'POS') cpt_bFields = ('CPT_code', 'mod_A', 'mod_B', 'mod_C', 'mod_D', 'dx_pter', 'total_charge') #insurance type, Box 1, is handled in OnSelectIns sizer = wx.GridBagSizer(10, 30) sizer.Add(wx.StaticText(self.panel, -1, "Insurance Type"), pos=(1, 1)) insListBox = wx.ListBox(self.panel, -1, choices=['Medicare', 'Medicaid', 'Tricare', 'Champus', 'GHP', 'FECA', 'Other'], style=wx.LB_SINGLE) sizer.Add(insListBox, pos=(2, 1), span=(4, 1), flag=wx.EXPAND) self.Bind(wx.EVT_LISTBOX, self.OnSelectIns, insListBox) sizer.Add(wx.StaticText(self.panel, -1, "Relation to Insured"), pos=(1, 2)) relListBox = wx.ListBox(self.panel, -1, choices=['self', 'spouse', 'child', 'other'], style=wx.LB_SINGLE) sizer.Add(relListBox, pos=(2, 2), span=(3, 1), flag=wx.EXPAND) self.Bind(wx.EVT_LISTBOX, self.OnSelectRel, relListBox) self.accList = ['n/a', 'employment', 'auto accident', 'other accident'] accBox = wx.RadioBox(self.panel, -1, "Illness/Injury due to ..?", choices=self.accList) self.Bind(wx.EVT_RADIOBOX, self.OnSelectAcc, accBox) sizer.Add(accBox, pos=(4, 3), span=(1, 3)) self.emplList = ['n/a', 'employed', 'full time student', 'part time student'] emplBox = wx.RadioBox(self.panel, -1, "Employment Status?", choices=self.emplList) self.Bind(wx.EVT_RADIOBOX, self.OnSelectEmpl, emplBox) sizer.Add(emplBox, pos=(5, 3), span=(1, 3)) self.marList = ['n/a', 'single', 'married', 'other'] marBox = wx.RadioBox(self.panel, -1, "Marital status", choices=self.marList) self.Bind(wx.EVT_RADIOBOX, self.OnSelectMar, marBox) sizer.Add(marBox, pos=(6, 3), span=(1, 3)) otherInsBox = wx.CheckBox(self.panel, -1, "Check if there is other insurance") sizer.Add(otherInsBox, pos=(1, 3)) self.Bind(wx.EVT_CHECKBOX, self.OnSelectOtherIns, otherInsBox) self.billSecInsBox = wx.CheckBox(self.panel, -1, "Bill secondary insurance?") self.billSecAsPrim = wx.CheckBox(self.panel, -1, "as Primary?") secSizer = wx.BoxSizer(wx.HORIZONTAL) secSizer.Add(self.billSecInsBox, 0, wx.RIGHT, 5) secSizer.Add(self.billSecAsPrim, 0) sizer.Add(secSizer, pos=(2, 3)) self.Bind(wx.EVT_CHECKBOX, self.OnSelectSecIns, self.billSecInsBox) self.billForSue = wx.CheckBox(self.panel, -1, "Sue Leon is rendering provider") sizer.Add(self.billForSue, pos=(3, 3)) self.Bind(wx.EVT_CHECKBOX, self.OnBillForSue, self.billForSue) sizer.Add(wx.StaticText(self.panel, -1, "Date of Injury/Illness?"), pos=(7, 3)) dpc = wx.TextCtrl(self.panel, size=(120,-1)) sizer.Add(dpc, pos=(8, 3)) self.Bind(wx.EVT_KILL_FOCUS, self.OnDateChanged, dpc) #below pulls problem date from problem list; if not available then puts in the note's date dxQry = 'SELECT short_des FROM icd10 WHERE icd10 = "%s";' % self.myparent.textctrl['ICD #1'].GetValue() dx = EMR_utilities.getData(dxQry) probDateQry = 'SELECT prob_date FROM problems10 WHERE short_des = "%s" AND patient_ID = %s;' % (dx[0], self.PtID) probDate = EMR_utilities.getData(probDateQry) if probDate: dpc.SetValue(str(probDate[0])) else: dpc.SetValue(self.myparent.textctrl['Date'].GetValue()[:10]) self.hospAdmBox = wx.CheckBox(self.panel, -1, "Hospital Admission?") sizer.Add(self.hospAdmBox, pos=(9, 3)) self.admit_dpc = wx.DatePickerCtrl(self.panel, size=(100,-1), style = wx.DP_DEFAULT | wx.DP_SHOWCENTURY | wx.DP_ALLOWNONE) sizer.Add(self.admit_dpc, pos=(10, 3)) self.admit_dpc.Show(False) self.Bind(wx.EVT_DATE_CHANGED, self.OnAdmitDateChanged, self.admit_dpc) self.Bind(wx.EVT_CHECKBOX, self.OnHospAdmCheck, self.hospAdmBox) self.hospDC_Text = wx.StaticText(self.panel, -1, "Hospital Discharge") sizer.Add(self.hospDC_Text, pos=(8, 4)) self.hospDC_Text.Show(False) self.dc_dpc = wx.DatePickerCtrl(self.panel, size=(100,-1), style = wx.DP_DEFAULT | wx.DP_SHOWCENTURY | wx.DP_ALLOWNONE) self.dc_dpc.Show(False) sizer.Add(self.dc_dpc, pos=(9, 4)) self.Bind(wx.EVT_DATE_CHANGED, self.OnDischargeDateChanged, self.dc_dpc) self.FieldText = wx.StaticText(self.panel, -1, "Column:Content eg, 62:marcaine 1% 3cc") sizer.Add(self.FieldText, pos=(7, 1), span=(1, 2)) self.Field1 = wx.TextCtrl(self.panel, size=(200, -1)) sizer.Add(self.Field1, pos=(8, 1), span=(1, 2)) self.Field1.Bind(wx.EVT_KILL_FOCUS, self.OnFieldLoseFocus, self.Field1) doneBtn = EMR_utilities.buildOneButton(self, self.panel, "Done", self.OnDone) sizer.Add(doneBtn, pos=(11, 1)) self.panel.SetSizer(sizer) dt = time.strptime(dpc.GetValue(), "%Y-%m-%d") self.columns[74] = time.strftime("%m/%d/%y", dt)
def __init__(self, parent, ptID, reason, background, consultant, dueDate): filename = "/home/mb/Desktop/GECKO/EMR_outputs/%s/Consults/%s.pdf" % ( 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)) dem_data = EMR_utilities.getDictData( 'SELECT * FROM demographics WHERE patient_ID = %s;' % ptID) consultDoc = EMR_utilities.name_fixer(consultant) if consultDoc.firstname == '': consult_data = EMR_utilities.getDictData('SELECT * FROM consultants WHERE lastname = "%s";' \ % (consultDoc.lastname)) else: consult_data = EMR_utilities.getDictData( 'SELECT * FROM consultants WHERE lastname = "%s" \ AND firstname = "%s";' % (consultDoc.lastname, consultDoc.firstname)) patient = 'RE: %(firstname)s %(lastname)s, DOB: %(dob)s' % dem_data salutation = 'Dear Dr. %(lastname)s:' % consult_data body = 'I am sending %s, a %s %s, to see you regarding %s. %s' % \ (dem_data['firstname'], EMR_utilities.getAge(ptID), dem_data['sex'], reason, background) problems = EMR_formats.getProblems(ptID) meds = EMR_formats.getMeds(ptID, display='column') qry = "INSERT INTO todo SET patient_ID = %s, date = '%s', description = '%s- %s', priority = 3, \ category = 'Consult', due_date = '%s', complete = 0;" % (ptID, EMR_utilities.dateToday(), \ consult_data['lastname'], reason, dueDate) EMR_utilities.updateData(qry) 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'])) elements.append(Spacer(1, 24)) elements.append( Paragraph( '<para align=RIGHT>%s</para>' % EMR_utilities.dateToday(t='display'), styleSheet['Body'])) elements.append(Spacer(1, 24)) elements.append( Paragraph('Dr. %(lastname)s' % consult_data, styleSheet['Body'])) elements.append( Paragraph('%(address)s' % consult_data, styleSheet['Body'])) elements.append( Paragraph('%(city)s, %(state)s %(zipcode)s' % consult_data, styleSheet['Body'])) elements.append(Spacer(1, 12)) elements.append(Paragraph(patient, styleSheet['Body'])) elements.append(Spacer(1, 12)) elements.append(Paragraph(salutation, styleSheet['Body'])) elements.append(Spacer(1, 12)) elements.append(Paragraph(body, styleSheet['Body'])) elements.append(Spacer(1, 12)) elements.append( Paragraph( "I have attached current medications and problems. \ 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'])) elements.append(Spacer(1, 12)) tableList = [[ problems, meds, ]] table = Table(tableList, colWidths=(3 * inch, 3 * inch), style=[('VALIGN', (0, 0), (-1, -1), 'TOP'), ('LEFTPADDING', (0, 0), (-1, -1), 0), ('RIGHTPADDING', (0, 0), (-1, -1), 20)]) table.hAlign = "LEFT" elements.append(table) # write the document to disk doc.build(elements) os.system("lp -d Updox %s" % filename) #extremely slick: prints directly to Updox Printer
def __init__(self, parent, ptID, text=""): '''Prints a letter, saves a copy to pt folder''' self.ptID = ptID lt = "%s/EMR_outputs/%s/Other/ltr-%s.pdf" % ( settings.LINUXPATH, self.ptID, EMR_utilities.dateToday('file format')) at = "%s/EMR_outputs/%s/Other/ltr-%s.pdf" % ( settings.APPLEPATH, self.ptID, EMR_utilities.dateToday('file format')) wt = "%s\EMR_outputs\%s\Other\ltr-%s.pdf" % ( settings.WINPATH, self.ptID, EMR_utilities.dateToday('file format')) filename = EMR_utilities.platformText(lt, at, wt) 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('8515 Delmar Blvd #217', styleSheet['Address'])) elements.append( Paragraph('University City, MO 63124', 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'])) chooseSig(elements) elements.append(Paragraph(settings.NAME, styleSheet['Body'])) # write the document to disk doc.build(elements) choosePrinter(filename)