Exemplo 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
Exemplo n.º 2
0
    def OnPrintVaccines(self, event):
        obj = self.vaccineList.GetObjects()
        string = ''
        v = []
        for items in obj:
            v.append((items['vaccine'], items['dates'], items['notes']))
        for things in sorted(v):
            string = '%s     %s     %s\n' % \
                            (things[1], things[0], things[2]) + string

        form_lt = "%s/EMR_outputs/Vaccines.html" % settings.LINUXPATH
        form_at = "%s/EMR_outputs/Vaccines.html" % settings.APPLEPATH
        form_wt = "%s\EMR_outputs\Vaccines.html" % settings.WINPATH
        form = open(EMR_utilities.platformText(form_lt, form_at, form_wt), 'r')
        s = form.read()
        form.close()
        dem_data = EMR_utilities.getDictData(
            'SELECT * FROM demographics WHERE patient_ID = %s;' % self.ptID)
        dem_data['string'] = string
        dem_data['date'] = EMR_utilities.dateToday()
        dem_data['name_address'] = EMR_formats.format_address(dem_data)
        script_text = s % (dem_data)
        printer = EMR_utilities.Printer()
        printer.PreviewText(script_text)
        '''path_lt = "%s/EMR_outputs/%s/Orders" % (settings.LINUXPATH, self.ptID)
Exemplo n.º 3
0
    def OnpRintMed(self, event):
        obj = self.list.GetSelectedObjects()
        string = ''
        for items in obj:
            string = '%s %s\n   take %s %s %s   #%s refills: %s\n\n' % \
                     (items["med_name"],
                      items["dose"],
                      items["number_tablets"],
                      items["route"],
                      items["frequency"],
                      items["number_pills"],
                      items["refills"]) + string
        
	form_lt = "%s/EMR_outputs/Script.html" % settings.LINUXPATH
	form_at = "%s/EMR_outputs/Script.html" % settings.APPLEPATH
	form_wt = "%s\EMR_outputs\Script.html" % settings.WINPATH
        form = open(EMR_utilities.platformText(form_lt, form_at, form_wt), 'r')
	s = form.read()
	form.close()
	dem_data = EMR_utilities.getDictData('SELECT * FROM demographics WHERE patient_ID = %s;' % self.ptID)
	dem_data['string'] = string
	dem_data['date'] = EMR_utilities.dateToday()
	dem_data['name_address'] = EMR_formats.format_address(dem_data)
	script_text = s % (dem_data)
	printer = EMR_utilities.Printer()
	printer.PreviewText(script_text)
	path_lt = "%s/EMR_outputs/%s/Orders" % (settings.LINUXPATH, self.ptID)
	path_at = "%s/EMR_outputs/%s/Orders" % (settings.APPLEPATH, self.ptID)
	path_wt = "%s\EMR_outputs\%s\Orders" % (settings.WINPATH, self.ptID)
	path = EMR_utilities.platformText(path_lt, path_at, path_wt)
	filename = "%s/script%s.html" % (path, EMR_utilities.dateToday(t='file format'))
	f = open(filename, 'w')
	f.write(script_text)
	f.close()	
Exemplo n.º 4
0
 def OnApply(self, event):
     num = self.list.GetItemCount()
     for i in range(num):
         if i == 0: self.log.Clear()
         if self.list.IsChecked(i):
             #retrieve the patient_ID: p = patient_ID
             #query database for complete demographic info on that patient
             results = EMR_utilities.getDictData(
                 'SELECT * FROM demographics WHERE patient_ID = %s;' %
                 (self.list.GetItemText(i)))
             b = EMR_formats.format_address(results)
             self.log.AppendText(b + '\n')
Exemplo n.º 5
0
 def OnApply(self, event):
     num = self.list.GetItemCount()
     for i in range(num):
         if i == 0:
             self.log.Clear()
         if self.list.IsChecked(i):
             # retrieve the patient_ID: p = patient_ID
             # query database for complete demographic info on that patient
             results = EMR_utilities.getDictData(
                 "SELECT * FROM demographics WHERE patient_ID = %s;" % (self.list.GetItemText(i))
             )
             b = EMR_formats.format_address(results)
             self.log.AppendText(b + "\n")
Exemplo n.º 6
0
    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)
Exemplo n.º 7
0
    def OnpRintMed(self, event):
        obj = self.list.GetSelectedObjects()
        string = ''
        for items in obj:
            string = '%s %s\n   take %s %s %s   #%s refills: %s\n\n' % \
                     (items["med_name"],
                      items["dose"],
                      items["number_tablets"],
                      items["route"],
                      items["frequency"],
                      items["number_pills"],
                      items["refills"]) + string

        form_lt = "%s/EMR_outputs/Script.html" % settings.LINUXPATH
        form_at = "%s/EMR_outputs/Script.html" % settings.APPLEPATH
        form_wt = "%s\EMR_outputs\Script.html" % settings.WINPATH
        form = open(EMR_utilities.platformText(form_lt, form_at, form_wt), 'r')
        s = form.read()
        form.close()
        dem_data = EMR_utilities.getDictData(
            'SELECT * FROM demographics WHERE patient_ID = %s;' % self.ptID)
        dem_data['string'] = string
        dem_data['date'] = EMR_utilities.dateToday()
        dem_data['name_address'] = EMR_formats.format_address(dem_data)
        script_text = s % (dem_data)
        printer = EMR_utilities.Printer()
        printer.PreviewText(script_text)
        path_lt = "%s/EMR_outputs/%s/Orders" % (settings.LINUXPATH, self.ptID)
        path_at = "%s/EMR_outputs/%s/Orders" % (settings.APPLEPATH, self.ptID)
        path_wt = "%s\EMR_outputs\%s\Orders" % (settings.WINPATH, self.ptID)
        path = EMR_utilities.platformText(path_lt, path_at, path_wt)
        filename = "%s/script%s.html" % (
            path, EMR_utilities.dateToday(t='file format'))
        f = open(filename, 'w')
        f.write(script_text)
        f.close()
Exemplo n.º 8
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
Exemplo n.º 9
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
Exemplo n.º 10
0
    def __init__(self, parent, id=-1, title=None, ptID=None):
	wx.Panel.__init__(self, parent, id, title)

	self.ptID = ptID	
	self.textctrl = {}
	font1 = wx.Font(12, wx.SWISS, wx.NORMAL, wx.LIGHT)
	Font2 = wx.Font(7, wx.SWISS, wx.NORMAL, wx.LIGHT)
	self.labels = (('First Name', 50, 'firstname'), ('Last Name', 75, 'lastname'), ('Mid Initial', 20, 'mid_init'),
		('Address', 100, 'address'), ('City', 75, 'city'), ('State', 30, 'state'), ('Zip', 40, 'zipcode'), 
		('Phone', 40, 'phonenumber'), ('Sex', 20, 'sex'), ('DOB', 50, 'dob'), 
		('Insured', 30,  'relation_to_insured'), ('SSN', 30, 'SSN'), ('Email', 125, 'email'), 
		('Signature on File', 40, 'sof'),

		('Insurance Co', 0, 'insurance_company'), ('Policy ID', 50, 'policy_ID'), 
		('Sec Insurance', 100, 'secondary_ins'), ('Sec Policy ID', 50, 'secondary_ins_ID'), 
		('Sec Policy #', 50, 'sec_PolicyGroupOrFecaNumber'), 
		('Plan Name', 75, 'InsuredInsurancePlanNameOrProgramName'), 
		('Ins Policy/Group/FECA Number', 50, 'InsuredPolicyGroupOrFecaNumber'), 

		('Ins Last', 75, 'InsuredLast'),  ('Ins First', 50, 'InsuredFirst'), 
		('Ins Mid Initial', 20, 'InsuredMidInit'), ('Ins Address', 100, 'InsuredStreetAddress'), 
		('Ins City', 75, 'InsuredCity'), ('Ins State', 30, 'InsuredState'), ('Ins Zip', 40, 'InsuredZip'), 
		('Ins Phone', 40, 'InsuredPhone'), 

		#These were removed to make space for other demographics fields; they were not being used; still in the db though
		#('Ins DOB', 40, 'InsuredDOB'),
		#('Ins Gender', 20, 'InsuredGender'), ('Ins Employer', 100, 'InsuredEmployerNameOrSchoolName'),
		 
		('Guarantor Last', 75, 'guarantor_last'), ('Guarantor First', 50, 'guarantor_first'), 
		('Guarantor Address', 100, 'guarantor_address'), ('Guarantor City', 75, 'guarantor_city'),
		('Guarantor State', 30, 'guarantor_state'), ('Guarantor Zip', 40, 'guarantor_zip'), 
		('Guarantor Phone', 40, 'guarantor_phone'),

		('Race', 100, 'race'), ('Primary Language', 50, 'language'), ('PCP', 50, 'pcp'))
		
	for label, size, field in self.labels:
	    EMR_utilities.buildOneTextCtrl(self, label, size)

	demosizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5)
	demo2sizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5)
	demo3sizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5)
	demo4sizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5)
	demo5sizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5)
	demosizer.AddGrowableCol(1)
	demo2sizer.AddGrowableCol(1)
	demo3sizer.AddGrowableCol(1)
	demo4sizer.AddGrowableCol(1)
	demo5sizer.AddGrowableCol(1)

	#Patient Info
	nameLabel = wx.StaticText(self, -1, 'First, Middle, Last')
	nameLabel.SetFont(Font2)
	demosizer.Add(nameLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	namesizer = wx.BoxSizer(wx.HORIZONTAL)
	namesizer.Add(self.textctrl['First Name'], 2)
	namesizer.Add(self.textctrl['Mid Initial'], 1, wx.RIGHT|wx.LEFT, 5)
	namesizer.Add(self.textctrl['Last Name'], 3, wx.EXPAND)
	demosizer.Add(namesizer, 0, wx.EXPAND)
	addrLabel = wx.StaticText(self, -1, 'Address')
	addrLabel.SetFont(Font2)
	demosizer.Add(addrLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	demosizer.Add(self.textctrl['Address'], 1, wx.EXPAND)
	cityLabel = wx.StaticText(self, -1, ' City State Zip Phone')
	cityLabel.SetFont(Font2)
	demosizer.Add(cityLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	cstsizer = wx.BoxSizer(wx.HORIZONTAL)
	cstsizer.Add(self.textctrl['City'], 3)
	cstsizer.Add(self.textctrl['State'], 1, wx.LEFT|wx.RIGHT, 5)
	cstsizer.Add(self.textctrl['Zip'], 2, wx.RIGHT, 5)
	cstsizer.Add(self.textctrl['Phone'], 4, wx.EXPAND)
	demosizer.Add(cstsizer, 0, wx.EXPAND)
	dobLabel = wx.StaticText(self, -1, 'DOB Sex email')
	dobLabel.SetFont(Font2)
	demosizer.Add(dobLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	sexsizer = wx.BoxSizer(wx.HORIZONTAL)
	sexsizer.Add(self.textctrl['DOB'], 3)
	sexsizer.Add(self.textctrl['Sex'], 2, wx.LEFT|wx.RIGHT, 5)
	sexsizer.Add(self.textctrl['Email'], 5, wx.EXPAND)
	demosizer.Add(sexsizer, 0, wx.EXPAND)
	InsLabel = wx.StaticText(self, -1, 'Insured  SSN SOF')
	InsLabel.SetFont(Font2)
	demosizer.Add(InsLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	insuredsizer = wx.BoxSizer(wx.HORIZONTAL)
	insuredsizer.Add(self.textctrl['Insured'], 2, wx.RIGHT, 5)
	insuredsizer.Add(self.textctrl['SSN'], 4, wx.RIGHT, 5)
	insuredsizer.Add(self.textctrl['Signature on File'], 3, wx.EXPAND)
	demosizer.Add(insuredsizer, 0, wx.EXPAND)
	
	#Insurance Info
	insTuple = EMR_utilities.getAllData('SELECT InsurancePlanName FROM ins_companies;')
	insList = []	#this control forces me to choose from one of the insurance policies I accept or 'self'
	for item in insTuple:
	    insList.append(item[0])
	self.insChoice = wx.Choice(self, -1, choices=insList)

	InsCoLabel = wx.StaticText(self, -1, 'Primary Insurance Co')
	InsCoLabel.SetFont(Font2)
	demo3sizer.Add(InsCoLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	demo3sizer.Add(self.insChoice, 1, wx.EXPAND)
	IDLabel = wx.StaticText(self, -1, 'ID  Group#  Plan')
	IDLabel.SetFont(Font2)
	demo3sizer.Add(IDLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	pgrpsizer = wx.BoxSizer(wx.HORIZONTAL)
	pgrpsizer.Add(self.textctrl['Policy ID'], 1)
	pgrpsizer.Add(self.textctrl['Ins Policy/Group/FECA Number'], 1, wx.LEFT|wx.RIGHT, 5)
	pgrpsizer.Add(self.textctrl['Plan Name'], 1, wx.EXPAND)
	demo3sizer.Add(pgrpsizer, 0, wx.EXPAND)
	SecInsLabel = wx.StaticText(self, -1, 'Secondary Ins Co')
	SecInsLabel.SetFont(Font2)
	demo3sizer.Add(SecInsLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	demo3sizer.Add(self.textctrl['Sec Insurance'], 1, wx.EXPAND)
	SecIDLabel = wx.StaticText(self, -1, 'Sec ID  Policy#')
	SecIDLabel.SetFont(Font2)
	demo3sizer.Add(SecIDLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	sgrpsizer = wx.BoxSizer(wx.HORIZONTAL)
	sgrpsizer.Add(self.textctrl['Sec Policy ID'], 1, wx.RIGHT, 5)
	sgrpsizer.Add(self.textctrl['Sec Policy #'], 1, wx.EXPAND)
	demo3sizer.Add(sgrpsizer, 0, wx.EXPAND)
	
	#Insured Info (if not the patient)
	InsNameLabel = wx.StaticText(self, -1, 'First, Middle, Last')
	InsNameLabel.SetFont(Font2)
	demo2sizer.Add(InsNameLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	insnamesizer = wx.BoxSizer(wx.HORIZONTAL)
	insnamesizer.Add(self.textctrl['Ins First'], 2)
	insnamesizer.Add(self.textctrl['Ins Mid Initial'], 1, wx.LEFT|wx.RIGHT, 5)
	insnamesizer.Add(self.textctrl['Ins Last'], 3, wx.EXPAND)
	self.textctrl['Ins Last'].Bind(wx.EVT_KILL_FOCUS, self.OnInsKillFocus)
	demo2sizer.Add(insnamesizer, 0, wx.EXPAND)
	InsAddrLabel = wx.StaticText(self, -1, 'Address')
	InsAddrLabel.SetFont(Font2)
	demo2sizer.Add(InsAddrLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	demo2sizer.Add(self.textctrl['Ins Address'], 1, wx.EXPAND)
	InsCityLabel = wx.StaticText(self, -1, 'City State Zip Phone')
	InsCityLabel.SetFont(Font2)
	demo2sizer.Add(InsCityLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	inscstsizer = wx.BoxSizer(wx.HORIZONTAL)
	inscstsizer.Add(self.textctrl['Ins City'], 3)
	inscstsizer.Add(self.textctrl['Ins State'], 1, wx.LEFT|wx.RIGHT, 5)
	inscstsizer.Add(self.textctrl['Ins Zip'], 2, wx.RIGHT, 5)
	inscstsizer.Add(self.textctrl['Ins Phone'], 4, wx.EXPAND)
	demo2sizer.Add(inscstsizer, 0, wx.EXPAND)
	#InsDOBLabel = wx.StaticText(self, -1, 'DOB  Sex')
	#InsDOBLabel.SetFont(Font2)
	#demo2sizer.Add(InsDOBLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	#inssexsizer = wx.BoxSizer(wx.HORIZONTAL)
	#inssexsizer.Add(self.textctrl['Ins DOB'], 1, wx.RIGHT, 5)
	#inssexsizer.Add(self.textctrl['Ins Gender'], 1, wx.EXPAND)
	#demo2sizer.Add(inssexsizer, 0, wx.EXPAND)
	#emplLabel = wx.StaticText(self, -1, 'Employer')
	#emplLabel.SetFont(Font2)
	#demo2sizer.Add(emplLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	#demo2sizer.Add(self.textctrl['Ins Employer'], 1, wx.EXPAND)
	
	#Contact Info
	relationshipLabel = wx.StaticText(self, -1, 'Advanced Directive?') 
	relationshipLabel.SetFont(Font2)
	demo4sizer.Add(relationshipLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	relationshipSizer = wx.BoxSizer(wx.HORIZONTAL)
	self.adv_dirYesRB = wx.RadioButton(self, -1, 'Yes', style=wx.RB_GROUP)
        self.adv_dirNoRB = wx.RadioButton(self, -1, 'No')
	self.adv_dirUnknownRB = wx.RadioButton(self, -1, 'Unknown')
	self.adv_dirYesRB.SetFont(Font2)
	relationshipSizer.Add(self.adv_dirYesRB)
	self.adv_dirNoRB.SetFont(Font2)
	relationshipSizer.Add(self.adv_dirNoRB)
	self.adv_dirUnknownRB.SetFont(Font2)
	relationshipSizer.Add(self.adv_dirUnknownRB)
	self.proxyBox = wx.CheckBox(self, -1, "Contact is healthcare proxy.")
	self.proxyBox.SetFont(Font2)
	relationshipSizer.Add((35, -1))
	relationshipSizer.Add(self.proxyBox)
	demo4sizer.Add(relationshipSizer, 0, wx.EXPAND)
	guarNameLabel = wx.StaticText(self, -1, 'First, Last Name')
	guarNameLabel.SetFont(Font2)
	demo4sizer.Add(guarNameLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	guarnamesizer = wx.BoxSizer(wx.HORIZONTAL)
	guarnamesizer.Add(self.textctrl['Guarantor First'], 1, wx.RIGHT, 5)
	guarnamesizer.Add(self.textctrl['Guarantor Last'], 1, wx.EXPAND)
	self.textctrl['Guarantor Last'].Bind(wx.EVT_KILL_FOCUS, self.OnGuarKillFocus)
	demo4sizer.Add(guarnamesizer, 0, wx.EXPAND)
	gAddrLabel = wx.StaticText(self, -1, 'Address')
	gAddrLabel.SetFont(Font2)
	demo4sizer.Add(gAddrLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	demo4sizer.Add(self.textctrl['Guarantor Address'], 0, wx.EXPAND)
	gCityLabel = wx.StaticText(self, -1, 'City State Zip Phone')
	gCityLabel.SetFont(Font2)
	demo4sizer.Add(gCityLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	guarcstsizer = wx.BoxSizer(wx.HORIZONTAL)
	guarcstsizer.Add(self.textctrl['Guarantor City'], 3)
	guarcstsizer.Add(self.textctrl['Guarantor State'], 1, wx.LEFT|wx.RIGHT, 5)
	guarcstsizer.Add(self.textctrl['Guarantor Zip'], 2, wx.RIGHT, 5)
	guarcstsizer.Add(self.textctrl['Guarantor Phone'], 4, wx.EXPAND)
	demo4sizer.Add(guarcstsizer, 0, wx.EXPAND)

	#Other Info (mainly added for NCQA purposes)
	demo5sizer.Add(wx.StaticText(self, -1, '                        ')) #no label needed, spacing only
	marriedSizer = wx.BoxSizer(wx.HORIZONTAL)
	self.marriedBox = wx.CheckBox(self, -1, "Married?")
	self.marriedBox.SetFont(Font2)
	marriedSizer.Add(self.marriedBox)
	self.inactiveBox = wx.CheckBox(self, -1, "Inactive Patient")
	self.inactiveBox.SetFont(Font2)
	marriedSizer.Add(self.inactiveBox)
	demo5sizer.Add(marriedSizer, 0, wx.EXPAND)
	languageLabel = wx.StaticText(self, -1, 'Language, PCP')
	languageLabel.SetFont(Font2)
	demo5sizer.Add(languageLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	languageSizer = wx.BoxSizer(wx.HORIZONTAL)
	languageSizer.Add(self.textctrl['Primary Language'], 1, wx.RIGHT, 5)
	languageSizer.Add(self.textctrl['PCP'], 1, wx.EXPAND)
	demo5sizer.Add(languageSizer, 0, wx.EXPAND)
	raceLabel = wx.StaticText(self, -1, 'Race')
	raceLabel.SetFont(Font2)
	demo5sizer.Add(raceLabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
	demo5sizer.Add(self.textctrl['Race'], 0, wx.EXPAND)


	
	box = wx.StaticBox(self, -1, 'Patient')
	box2 = wx.StaticBox(self, -1, 'Insured')		
	box3 = wx.StaticBox(self, -1, 'Insurance Information')		
	box4 = wx.StaticBox(self, -1, 'Contact')
	box5 = wx.StaticBox(self, -1, 'Other Info')	
	box.SetFont(font1)
	box2.SetFont(font1)
	box3.SetFont(font1)
	box4.SetFont(font1)
	box5.SetFont(font1)
	boxsizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
	box2sizer = wx.StaticBoxSizer(box2, wx.HORIZONTAL)
	box3sizer = wx.StaticBoxSizer(box3, wx.HORIZONTAL)
	box4sizer = wx.StaticBoxSizer(box4, wx.HORIZONTAL)
	box5sizer = wx.StaticBoxSizer(box5, wx.HORIZONTAL)
	boxsizer.Add(demosizer, 1, wx.EXPAND|wx.TOP|wx.BOTTOM, 25)
	box2sizer.Add(demo2sizer, 1, wx.EXPAND|wx.TOP|wx.BOTTOM, 25)
	box3sizer.Add(demo3sizer, 1, wx.EXPAND|wx.TOP|wx.BOTTOM, 25)
	box4sizer.Add(demo4sizer, 1, wx.EXPAND|wx.TOP|wx.BOTTOM, 25)
	box5sizer.Add(demo5sizer, 1, wx.EXPAND|wx.TOP|wx.BOTTOM, 25)

	leftsizer = wx.BoxSizer(wx.VERTICAL)
	leftsizer.Add(boxsizer, 0, wx.EXPAND|wx.BOTTOM, 10)
	leftsizer.Add(box3sizer, 0, wx.EXPAND)
	addPtBtn = EMR_utilities.buildOneButton(self, self, "Add New Patient", self.OnAddPt)
	buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
	leftsizer.Add((-1, 25))
	buttonSizer.Add(addPtBtn, 0)
	rightsizer = wx.BoxSizer(wx.VERTICAL)
	rightsizer.Add(box2sizer, 0, wx.EXPAND|wx.BOTTOM, 10)
	rightsizer.Add(box4sizer, 0, wx.EXPAND|wx.BOTTOM, 10)
	rightsizer.Add(box5sizer, 0, wx.EXPAND)

	if ptID == None:
	    pass
	else:
	    results = EMR_utilities.getDictData('SELECT * FROM demographics WHERE patient_ID = %s;' % (ptID))
	    for label, size, field in self.labels:
		self.textctrl[label].SetValue(str(results[field]))
	    self.textctrl['Phone'].SetValue(EMR_formats.phone_format(self.textctrl['Phone'].GetValue()))
	    self.textctrl['Ins Phone'].SetValue(EMR_formats.phone_format(self.textctrl['Ins Phone'].GetValue()))
	    self.textctrl['Guarantor Phone'].SetValue(EMR_formats.phone_format(self.textctrl['Guarantor Phone'].GetValue()))
	    self.insChoice.SetStringSelection(self.textctrl['Insurance Co'].GetValue())
	    if results['adv_dir'] == '1':
		self.adv_dirYesRB.SetValue(True)
	    elif results['adv_dir'] == '2':
		self.adv_dirNoRB.SetValue(True)
	    else: 
		self.adv_dirUnknownRB.SetValue(True)
	    if results['proxy'] == '1':
		self.proxyBox.SetValue(1)
	    if results['marital_status'] == '1':
		self.marriedBox.SetValue(1)
	    if results['inactive'] == '1':
		self.inactiveBox.SetValue(1)
	    editPtBtn = EMR_utilities.buildOneButton(self, self, "Update Demographics", self.OnEditPt)
	    scanBtn = EMR_utilities.buildOneButton(self, self, "Scan", self.OnScan)
	    buttonSizer.Add(scanBtn, wx.ALL, 10)
	    buttonSizer.Add(editPtBtn, 0)

	leftsizer.Add(buttonSizer, 0)
	mainsizer = wx.BoxSizer(wx.HORIZONTAL)
	mainsizer.Add(leftsizer, 0, wx.RIGHT, 10)
	mainsizer.Add(rightsizer, 0, wx.EXPAND)
	self.SetSizer(mainsizer)
Exemplo n.º 11
0
    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)
Exemplo n.º 12
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)
Exemplo n.º 13
0
    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)
Exemplo n.º 14
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)