Esempio n. 1
0
    def EvtSelTmplist(self, event):
	lt = "/home/mb/Desktop/GECKO/wellchild/%s.txt"
	at = ""
	wt = "C:\Documents and Settings\mbarron\My Documents\GECKO\wellchild\%s.txt"
	if event.GetString() == 'generic':
	    gen_note = EMR_formats.note(self.PtID)
	    if wx.GetTopLevelParent(self).nb.GetPage(2).reviewed == 1:
		gen_note = gen_note.replace('Meds', 'Meds(reviewed today)')
		gen_note = gen_note.replace('Allergies', 'Allergies(reviewed today)')
	    self.newsoapNote.SetValue(gen_note)
	    self.not_billable = 0
	elif event.GetString() == 'prenatal':
	    self.newsoapNote.SetValue(EMR_formats.prenatal(self.PtID))
	elif event.GetString() == 'procedure':
	    self.newsoapNote.SetValue(EMR_formats.procedure(self.PtID))
	elif event.GetString() == 'phonecon':
	    self.newsoapNote.SetValue(EMR_formats.phonecon(self.PtID))
	    self.not_billable = 1
	elif event.GetString() == 'well child':
	    choice = wx.GetSingleChoice('What age child?', "", ['Wt Check', '2 month', '4 month', '6 month', '9 month',
		'12 month', '15 month', '18 month', '2 year', '3-4 year', '6-7_yr_old', '7-8 year', '10-11_yr_old', 
		'12-13_yr_old', '9-12 year', '13-15 year'])
	    string = open(EMR_utilities.platformText(lt, at, wt) % choice, 'r')
	    s = string.read()
	    string.close()
	    result = s % (EMR_utilities.getAge(self.PtID), EMR_utilities.getSex(self.PtID), 
		EMR_formats.getVitals(self.PtID, baby=1))
	    self.newsoapNote.SetValue(result)
	    self.not_billable = 0
	else: pass
Esempio n. 2
0
    def OnGetPt(self, event):
        t1 = time.clock()
        import Meds, Problems, PMH, Vitals, Notes, demographics, ToDo, Queries, Prevention, Education

        t2 = time.clock()
        lt = "%s/EMR_outputs" % settings.LINUXPATH
        at = "%s/EMR_outputs" % settings.APPLEPATH
        wt = "%s\EMR_outputs" % settings.WINPATH
        f = wx.GetTopLevelParent(self)
        num = self.list.GetItemCount()
        if num == 0:
            dlg = wx.MessageDialog(
                None, "There are no patients to select.  Close window?", "Problem", style=wx.YES_NO | wx.YES_DEFAULT
            )
            answer = dlg.ShowModal()
            if answer == wx.ID_YES:
                f.nb.DeletePage(self)

        else:
            for i in range(num):
                if self.list.IsChecked(i):
                    medspage = Meds.Meds(f.nb, -1, self.list.GetItemText(i))
                    medspage.ptID = self.list.GetItemText(i)
                    probpage = Problems.Problems(f.nb, -1, self.list.GetItemText(i))
                    probpage.ptID = self.list.GetItemText(i)
                    pmhpage = PMH.PMH(f.nb, -1, self.list.GetItemText(i))
                    pmhpage.ptID = self.list.GetItemText(i)
                    vitalspage = Vitals.Vitals(f.nb, -1, self.list.GetItemText(i))
                    vitalspage.ptID = self.list.GetItemText(i)
                    notespage = Notes.Notes(f.nb, -1, self.list.GetItemText(i))
                    f.nb.DeletePage(0)
                    demogr_page = demographics.demographics(f.nb, ptID=self.list.GetItemText(i))
                    todo_page = ToDo.todo(f.nb, -1, PtID=self.list.GetItemText(i))
                    queries_page = Queries.queries(f.nb, ptID=self.list.GetItemText(i))
                    preventspage = Prevention.Prevention(f.nb, -1, ptID=self.list.GetItemText(i))
                    preventspage.ptID = self.list.GetItemText(i)
                    educpage = Education.Notes(f.nb, -1, self.list.GetItemText(i))
                    f.nb.AddPage(demogr_page, "Demographics")
                    f.nb.AddPage(medspage, "Medications")
                    f.nb.AddPage(probpage, "Problems")
                    f.nb.AddPage(pmhpage, "Past Medical History")
                    f.nb.AddPage(vitalspage, "Vitals")
                    f.nb.AddPage(notespage, "Notes")
                    f.nb.AddPage(educpage, "Education")
                    f.nb.AddPage(todo_page, "To Do")
                    f.nb.AddPage(preventspage, "Health Maintenance")
                    f.nb.AddPage(queries_page, "Queries")
                    base_path = EMR_utilities.platformText(lt, at, wt)
                    folders = [
                        "SOAP_notes",
                        "Labs",
                        "Radiology",
                        "Consults",
                        "Old_Records",
                        "Insurance",
                        "Other",
                        "Orders",
                    ]
                    if sys.platform == "win32":
                        if os.path.exists("%s\%s" % (base_path, self.list.GetItemText(i))):
                            pass
                        else:
                            for item in folders:
                                os.makedirs("%s\%s\%s" % (base_path, self.list.GetItemText(i), item))
                    else:
                        if os.path.exists("%s/%s" % (base_path, self.list.GetItemText(i))):
                            pass
                        else:
                            for item in folders:
                                os.makedirs("%s/%s/%s" % (base_path, self.list.GetItemText(i), item))
                    qry = (
                        'SELECT firstname, lastname, SUM(balance) FROM demographics INNER JOIN billing \
				USING (patient_ID) WHERE patient_ID = "%s";'
                        % self.list.GetItemText(i)
                    )
                    results = EMR_utilities.getDictData(qry)
                    try:
                        f.ptText.SetLabel(
                            "  %s %s    %s        $%d"
                            % (
                                results["firstname"],
                                results["lastname"],
                                EMR_utilities.getAge(self.list.GetItemText(i)),
                                results["SUM(balance)"],
                            )
                        )
                    except:
                        f.ptText.SetLabel(
                            "  %s %s    %s    no balance"
                            % (
                                results["firstname"],
                                results["lastname"],
                                EMR_utilities.getAge(self.list.GetItemText(i)),
                            )
                        )
                    f.ptID = self.list.GetItemText(i)

        t3 = time.clock()
        if f.ptMsgs:
            f.ptMsgs.messages.SetLabel(EMR_utilities.MESSAGES)
            f.ptMsgs.panel.Layout()
        else:
            wx.MessageBox(
                "You have turned off messages.  Please restart program to see patient messages.", "Messages OFF"
            )
            pass
Esempio n. 3
0
    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
Esempio n. 4
0
    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
Esempio n. 5
0
    def OnGetPt(self, event):
        t1 = time.clock()
        import Meds, Problems, PMH, Vitals, Notes, demographics, ToDo, Queries, Prevention, Education
        t2 = time.clock()
        lt = "%s/EMR_outputs" % settings.LINUXPATH
        at = "%s/EMR_outputs" % settings.APPLEPATH
        wt = "%s\EMR_outputs" % settings.WINPATH
        f = wx.GetTopLevelParent(self)
        num = self.list.GetItemCount()
        if num == 0:
            dlg = wx.MessageDialog(
                None,
                'There are no patients to select.  Close window?',
                'Problem',
                style=wx.YES_NO | wx.YES_DEFAULT)
            answer = dlg.ShowModal()
            if answer == wx.ID_YES:
                f.nb.DeletePage(self)

        else:
            for i in range(num):
                if self.list.IsChecked(i):
                    medspage = Meds.Meds(f.nb, -1, self.list.GetItemText(i))
                    medspage.ptID = self.list.GetItemText(i)
                    probpage = Problems.Problems(f.nb, -1,
                                                 self.list.GetItemText(i))
                    probpage.ptID = self.list.GetItemText(i)
                    pmhpage = PMH.PMH(f.nb, -1, self.list.GetItemText(i))
                    pmhpage.ptID = self.list.GetItemText(i)
                    vitalspage = Vitals.Vitals(f.nb, -1,
                                               self.list.GetItemText(i))
                    vitalspage.ptID = self.list.GetItemText(i)
                    notespage = Notes.Notes(f.nb, -1, self.list.GetItemText(i))
                    f.nb.DeletePage(0)
                    demogr_page = demographics.demographics(
                        f.nb, ptID=self.list.GetItemText(i))
                    todo_page = ToDo.todo(f.nb,
                                          -1,
                                          PtID=self.list.GetItemText(i))
                    queries_page = Queries.queries(
                        f.nb, ptID=self.list.GetItemText(i))
                    preventspage = Prevention.Prevention(
                        f.nb, -1, ptID=self.list.GetItemText(i))
                    preventspage.ptID = self.list.GetItemText(i)
                    educpage = Education.Notes(f.nb, -1,
                                               self.list.GetItemText(i))
                    f.nb.AddPage(demogr_page, 'Demographics')
                    f.nb.AddPage(medspage, 'Medications')
                    f.nb.AddPage(probpage, 'Problems')
                    f.nb.AddPage(pmhpage, 'Past Medical History')
                    f.nb.AddPage(vitalspage, 'Vitals')
                    f.nb.AddPage(notespage, 'Notes')
                    f.nb.AddPage(educpage, 'Education')
                    f.nb.AddPage(todo_page, 'To Do')
                    f.nb.AddPage(preventspage, 'Health Maintenance')
                    f.nb.AddPage(queries_page, 'Queries')
                    base_path = EMR_utilities.platformText(lt, at, wt)
                    folders = [
                        'SOAP_notes', 'Labs', 'Radiology', 'Consults',
                        'Old_Records', 'Insurance', 'Other', 'Orders'
                    ]
                    if sys.platform == 'win32':
                        if os.path.exists(
                                "%s\%s" %
                            (base_path, self.list.GetItemText(i))):
                            pass
                        else:
                            for item in folders:
                                os.makedirs('%s\%s\%s' %
                                            (base_path,
                                             self.list.GetItemText(i), item))
                    else:
                        if os.path.exists(
                                "%s/%s" %
                            (base_path, self.list.GetItemText(i))):
                            pass
                        else:
                            for item in folders:
                                os.makedirs('%s/%s/%s' %
                                            (base_path,
                                             self.list.GetItemText(i), item))
                    qry = 'SELECT firstname, lastname, SUM(balance) FROM demographics INNER JOIN billing \
				USING (patient_ID) WHERE patient_ID = "%s";' % self.list.GetItemText(i)
                    results = EMR_utilities.getDictData(qry)
                    try:
                        f.ptText.SetLabel('  %s %s    %s        $%d' % (results['firstname'], results['lastname'], \
                            EMR_utilities.getAge(self.list.GetItemText(i)), results['SUM(balance)']))
                    except:
                        f.ptText.SetLabel('  %s %s    %s    no balance' % (results['firstname'], results['lastname'], \
                            EMR_utilities.getAge(self.list.GetItemText(i))))
                    f.ptID = self.list.GetItemText(i)

        t3 = time.clock()
        if f.ptMsgs:
            f.ptMsgs.messages.SetLabel(EMR_utilities.MESSAGES)
            f.ptMsgs.panel.Layout()
        else:
            wx.MessageBox(
                "You have turned off messages.  Please restart program to see patient messages.",
                "Messages OFF")
            pass
Esempio n. 6
0
    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)
Esempio n. 7
0
    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)