本文整理汇总了Python中EMR_utilities.getAllData方法的典型用法代码示例。如果您正苦于以下问题:Python EMR_utilities.getAllData方法的具体用法?Python EMR_utilities.getAllData怎么用?Python EMR_utilities.getAllData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EMR_utilities
的用法示例。
在下文中一共展示了EMR_utilities.getAllData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: listBilledICD
# 需要导入模块: import EMR_utilities [as 别名]
# 或者: from EMR_utilities import getAllData [as 别名]
def listBilledICD(pt_ID):
icdList = []
billedProblems = []
problems = []
for i in range(1,11):
#collect the icd10 codes billed with each note for every note in a given calendar year
qry = "SELECT icd%d FROM notes INNER JOIN demographics USING (patient_ID) \
WHERE date LIKE '2015%%' AND patient_ID = %s AND icd%d != '';" % (i,pt_ID,i)
results = EMR_utilities.getAllData(qry)
for r in results:
#create a list from the tuple
icdList.append(r)
#we make a set which eliminates any duplicates
billedIcdList = set(icdList) #during 2015 some will be icd9 and some icd10
for part in EMR_utilities.getAllData('SELECT short_des FROM problems10 WHERE patient_ID = %s;' % pt_ID):
#collects problem names in a list
problems.append(part[0])
for item in billedIcdList:
#gets list of billed problem's descriptions but pulls only icd10
try:
des = EMR_utilities.getData('SELECT short_des FROM icd10 WHERE icd10 = "%s";' % item[0])
billedProblems.append(des[0])
except: pass
#print 'Icd %s not found!' % item[0] #these should be all the icd9 codes billed
for val in billedProblems:
#subtracts billed problem's names from the pt's problem list
if val in problems:
problems.remove(val)
EMR_utilities.MESSAGES = EMR_utilities.MESSAGES + 'ICD codes not billed this year:\n\n'
for x in problems:
EMR_utilities.MESSAGES = EMR_utilities.MESSAGES + '--' + x + '\n'
EMR_utilities.MESSAGES = EMR_utilities.MESSAGES + '\n\n'
示例2: __init__
# 需要导入模块: import EMR_utilities [as 别名]
# 或者: from EMR_utilities import getAllData [as 别名]
def __init__(self, parent, visitSince='2010-10-01'):
'''Send letters to all my active patients.'''
#Here is the letter
myLtr = '''As you may recall from my letter dated September 8, 2011, I have been deployed by the US Army to Kuwait until early January 2012. I arranged for the Family Care Health Center to see my patients while I am gone. Unfortunately, their capacity to see my patients is more limited than I anticipated.
In order to address this issue, Dr Ladonna Finch has generously agreed to help. If you need an appointment, rather than calling the Family Care Health Center as my previous letter suggested, please call her office at 314-645-7265. Her office is located at 1031 Bellevue Avenue, Suite 349 in Richmond Heights, across the street from St. Mary's Hospital.
I encourage you to call my office for medication refills and non-urgent questions/issues that can be addressed via email.
Thank you for your understanding.'''
#Figure out who the active patients are and create a list of their patient_ID numbers
qry = 'SELECT patient_ID FROM notes WHERE date >= "%s";' % visitSince
results = EMR_utilities.getAllData(qry)
#Remove duplicates from the list
d = {}
for x in results:
d[x] = 1
myList = list(d.keys())
print len(myList)
#Step through the list creating letter using template in Printer
for items in myList:
myPtLtr(self, items[0], text=myLtr)
示例3: getProblems
# 需要导入模块: import EMR_utilities [as 别名]
# 或者: from EMR_utilities import getAllData [as 别名]
def getProblems(ptID, display=''):
qry = 'SELECT short_des FROM problems10 WHERE patient_ID = %s;' % (ptID)
results = EMR_utilities.getAllData(qry)
shortList = []
try:
for items in results:
#query = 'SELECT short_des FROM icd10 WHERE disease_name = "%s";' % items[0]
#short_name = EMR_utilities.getData(query)
shortList.append(items)
except: pass
if display == 'HTML':
string = "<b>Problems:</b><BR>"
separator = "<BR>"
else:
string = "Problems:\n"
separator = "\n"
if results == ():
string = string + "none"
else:
n = 1
for p in shortList:
try:
string = string + "%s) %s%s" % (n, p[0], separator)
n = n + 1
except: pass
return string
示例4: OnTextEnterICD
# 需要导入模块: import EMR_utilities [as 别名]
# 或者: from EMR_utilities import getAllData [as 别名]
def OnTextEnterICD(self, event):
#when user enters ' ' create single choice dialog with patient's problem list; inserts ICD code for selected problem
if event.GetString() == ' ':
qry = "SELECT short_des FROM problems10 WHERE patient_ID = %s;" % (self.PtID)
results = EMR_utilities.getAllData(qry)
ptProbList = []
for items in results:
ptProbList.append(items[0])
dialog = wx.SingleChoiceDialog(self, 'Select a problem', "Patient's Problem List", ptProbList)
if dialog.ShowModal() == wx.ID_OK:
try:
r = EMR_utilities.getData('SELECT icd10 FROM ICD10billable WHERE short_des = "%s" AND billable = "1";' % dialog.GetStringSelection())
event.EventObject.SetValue((r)[0])
event.EventObject.MarkDirty()
except:
wx.MessageBox('Not a billable ICD10 code. Please fix on problem list.', 'Message')
else: pass
#when user enters '?' pull up problem dialog to search for codes
elif event.GetString() == 'g':
string = wx.GetTextFromUser("Search diagnosis list for ...")
qry = 'SELECT disease_name FROM icd_9 WHERE disease_name LIKE "%%%s%%";' % (string)
results = EMR_utilities.getAllData(qry)
probList = []
for items in results:
probList.append(items[0])
dialog = wx.SingleChoiceDialog(self, 'Select a problem', 'Master Problem List', probList)
if dialog.ShowModal() == wx.ID_OK:
q = 'SELECT icd_9 FROM icd_9 WHERE disease_name = "%s";' % (dialog.GetStringSelection())
event.EventObject.SetValue(EMR_utilities.getData(q)[0])
event.EventObject.MarkDirty()
else: pass
elif event.GetString() == 'f':
#this option allows search of www.icd9data.com for specified term
term = wx.GetTextFromUser("Look up ICD-9 Code: eg, rotator+cuff")
string = 'https://icd10.clindesk.org/#/?q=%s' % term
results = EMR_utilities.HTML_Frame(self, "ICD-9 Help", html_str=string)
results.Show()
elif event.GetString() == '?':
code = icd10picker(self, self, -1, 'ICD 10 Finder')
self.icd10code = ''
if code.ShowModal() == wx.ID_OK:
event.EventObject.SetValue(self.icd10code[0])
event.EventObject.MarkDirty()
else: pass
code.Destroy()
else: pass
event.Skip()
示例5: geesandpees
# 需要导入模块: import EMR_utilities [as 别名]
# 或者: from EMR_utilities import getAllData [as 别名]
def geesandpees(ptID):
qry = 'SELECT short_des FROM problems10 WHERE patient_ID = %s;' % (ptID)
results = EMR_utilities.getAllData(qry)
for items in results:
r = re.search('G\dP\d', str(items))
if r:
return r.group()
else: pass
示例6: getAllergies
# 需要导入模块: import EMR_utilities [as 别名]
# 或者: from EMR_utilities import getAllData [as 别名]
def getAllergies(ptID):
qry = 'SELECT allergy FROM allergies WHERE patient_ID = %s;' % (ptID)
results = EMR_utilities.getAllData(qry)
string = "Allergies: "
if results == ():
string = string + "not recorded in chart"
else:
for items in results:
string = string + '%s, ' % (items)
return string
示例7: OnSearchEnter
# 需要导入模块: import EMR_utilities [as 别名]
# 或者: from EMR_utilities import getAllData [as 别名]
def OnSearchEnter(self, event):
qry = 'SELECT * FROM ICD10billable WHERE short_des LIKE "%%%s%%" AND billable = "1";' % (event.GetString())
self.results = EMR_utilities.getAllData(qry)
short_des_list = []
for items in self.results:
self.resultListBox.Append(str(items[4]))
short_des_list.append(items[4])
#find common words in results and present them in the refine list
refined = Counter(chain.from_iterable(wordpunct_tokenize(x) for x in short_des_list)).most_common(10)
for items in refined:
if len(items[0]) > 3:
self.refineListBox.Append(str(items).strip("()'").replace("'", ""))
示例8: OBweeks
# 需要导入模块: import EMR_utilities [as 别名]
# 或者: from EMR_utilities import getAllData [as 别名]
def OBweeks(ptID):
qry = 'SELECT short_des FROM problems10 WHERE patient_ID = %s;' % (ptID)
results = EMR_utilities.getAllData(qry)
for items in results:
r = re.search('\d\d\d\d-\d\d-\d\d', str(items))
if r:
edc = datetime.date(*map(int, r.group().split('-')))
pregnancy = datetime.timedelta(weeks=-40)
conception = edc + pregnancy
howfar = datetime.date.today() - conception
weeks, days = divmod(howfar.days, 7)
return '%s %s/7 weeks' % (weeks, days)
else: pass
示例9: OnRefineEnter
# 需要导入模块: import EMR_utilities [as 别名]
# 或者: from EMR_utilities import getAllData [as 别名]
def OnRefineEnter(self, event):
qry1 = '(SELECT * FROM ICD10billable WHERE short_des LIKE "%%%s%%" AND billable = "1")' % self.textctrl['Search'].GetValue()
qry2 = 'SELECT * FROM %s AS custom WHERE short_des LIKE "%%%s%%";' % (qry1, event.GetString())
self.results = EMR_utilities.getAllData(qry2)
self.resultListBox.Clear()
self.refineListBox.Clear()
short_des_list = []
for items in self.results:
self.resultListBox.Append(str(items[4]))
short_des_list.append(items[4])
refined = Counter(chain.from_iterable(wordpunct_tokenize(x) for x in short_des_list)).most_common(10)
for items in refined:
self.refineListBox.Append(str(items).strip("()'").replace("'", ""))
示例10: EvtSelRefineList
# 需要导入模块: import EMR_utilities [as 别名]
# 或者: from EMR_utilities import getAllData [as 别名]
def EvtSelRefineList(self, event):
if self.refineListBox.GetSelection() == 0:
#this was done because after appending new values to refineListBox the selection event was being triggered a second time
pass
else:
qry1 = '(SELECT * FROM ICD10billable WHERE short_des LIKE "%%%s%%" AND billable = "1")' % self.textctrl['Search'].GetValue()
qry2 = 'SELECT * FROM %s AS custom WHERE short_des LIKE "%%%s%%";' % (qry1, event.GetString().split(',')[0])
self.results = EMR_utilities.getAllData(qry2)
self.resultListBox.Clear()
self.refineListBox.Clear()
short_des_list = []
for items in self.results:
self.resultListBox.Append(str(items[1]))
short_des_list.append(items[1])
refined = Counter(chain.from_iterable(wordpunct_tokenize(x) for x in short_des_list)).most_common(10)
for items in refined:
if len(items[0]) > 3: #removes small words that aren't useful search terms like of, and, the
self.refineListBox.Append(str(items).strip("()'").replace("'", ""))
示例11: getMeds
# 需要导入模块: import EMR_utilities [as 别名]
# 或者: from EMR_utilities import getAllData [as 别名]
def getMeds(ptID, display='wrap'):
qry = 'SELECT med_name, dose, number_tablets, frequency FROM meds WHERE patient_ID = %s AND archive = 0;' % \
(ptID)
results = EMR_utilities.getAllData(qry)
if display == 'wrap':
string = "Meds: "
separator = ','
elif display == 'column':
string = "Current Medications:\n\t"
separator = '\n\t'
else:
string = "<b>Meds:</b><BR> "
separator = '<BR>'
if results == ():
string = string + "none"
else:
for items in results:
string = string + '%s %s take %s %s%s' % (items[0], items[1], items[2], items[3], separator)
return string
示例12: OnKillFocusICD
# 需要导入模块: import EMR_utilities [as 别名]
# 或者: from EMR_utilities import getAllData [as 别名]
def OnKillFocusICD(self, event):
#for item in dir(event.GetEventObject()):
# print item, ": ", getattr(event.GetEventObject(), item)
if event.GetEventObject().IsModified():
#remove any decimal points
icd = event.GetEventObject().GetValue().replace('.', '')
#save any updates to the database
d = {"ICD #1":"icd1", "ICD #2":"icd2", "ICD #3":"icd3", "ICD #4":"icd4", "ICD #5":"icd5",
"ICD #6":"icd6", "ICD #7":"icd7", "ICD #8":"icd8", "ICD #9":"icd9", "ICD #10":"icd10"}
try:
qry = 'UPDATE notes SET %s = "%s" WHERE date = "%s";' % (d[event.GetEventObject().Name], \
icd, self.textctrl['Date'].GetValue())
EMR_utilities.updateData(qry)
except:
print 'icd query didnt work, line 374'
if icd == ' ' or icd == '?' or icd == 'f' or icd == 'g':
pass #setting these values was triggering the OnTextEnterICD resulting in two dialog boxes
else:
event.GetEventObject().SetValue(icd)
qry = 'SELECT * FROM notes WHERE patient_ID = %s ORDER BY date DESC;' % (self.PtID)
self.results = EMR_utilities.getAllData(qry)
else: pass
示例13: loadList
# 需要导入模块: import EMR_utilities [as 别名]
# 或者: from EMR_utilities import getAllData [as 别名]
def loadList(self):
# self.listctrl.Set("")
qry = "SELECT * FROM education WHERE patient_ID = %s ORDER BY date DESC;" % (self.PtID)
self.results = EMR_utilities.getAllData(qry)
for items in self.results:
self.listctrl.Append(str(items[3]))
示例14: todo_find
# 需要导入模块: import EMR_utilities [as 别名]
# 或者: from EMR_utilities import getAllData [as 别名]
def todo_find(PtID, toggle=0):
qry = 'SELECT date, description, priority, category, memo, due_date, complete, todo_number FROM todo WHERE patient_ID = %s AND complete = %s;' % (PtID, toggle)
return EMR_utilities.getAllData(qry)
示例15: __init__
# 需要导入模块: import EMR_utilities [as 别名]
# 或者: from EMR_utilities import getAllData [as 别名]
def __init__(self, parent, PtID):
wx.Frame.__init__(self, parent, title='Add Consult', size=(700, 1000))
self.PtID = PtID
self.consultant = ''
self.addSpecialist = 0 #need to keep track of whether Add Consultant button has been pushed
#Controls created
self.textctrl = {}
reasonLBL = wx.StaticText(self, -1, 'Reason for consult')
self.textctrl['reason'] = wx.TextCtrl(self, -1)
memoLBL = wx.StaticText(self, -1, 'Further info...')
self.textctrl['memo'] = wx.TextCtrl(self, -1, size=(-1,100), style=wx.TE_MULTILINE)
dateLBL = wx.StaticText(self, -1, 'Date Due')
self.cal = wx.calendar.CalendarCtrl(self, -1, wx.DateTime_Now(),\
style = wx.calendar.CAL_SHOW_HOLIDAYS
| wx.calendar.CAL_SUNDAY_FIRST
| wx.calendar.CAL_SEQUENTIAL_MONTH_SELECTION)
self.Bind(wx.calendar.EVT_CALENDAR, self.OnCalSelected, self.cal)
self.Bind(wx.calendar.EVT_CALENDAR_SEL_CHANGED, self.OnCalSelected, self.cal)
self.textctrl['Due Date'] = '' #not actually a text ctrl but don't need it; just holds date after cal selected
self.tree_ctrl = wx.TreeCtrl(self, -1, style=wx.TR_DEFAULT_STYLE | \
wx.TR_FULL_ROW_HIGHLIGHT | \
wx.TR_EDIT_LABELS)
specialties = EMR_utilities.getAllData('SELECT DISTINCT specialty FROM consultants ORDER BY specialty;')
self.root = self.tree_ctrl.AddRoot('Pick a specialist')
for items in specialties:
try:
child = self.tree_ctrl.AppendItem(self.root, items[0])
doctors = EMR_utilities.getAllData('SELECT firstname, lastname, address, city, state FROM consultants WHERE specialty = "%s";' % items[0])
for n in doctors:
doc = self.tree_ctrl.AppendItem(child, '%s %s, %s, %s, %s' % (n[0], n[1], n[2], n[3], n[4]))
except: print 'there was an error in the specialist window'
self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged, self.tree_ctrl)
nameLBL = wx.StaticText(self, -1, 'First/Last Name')
self.textctrl['firstname'] = wx.TextCtrl(self, -1, size=(150,-1))
self.textctrl['lastname'] = wx.TextCtrl(self, -1, size=(150,-1))
addrLBL = wx.StaticText(self, -1, 'Address')
self.textctrl['address'] = wx.TextCtrl(self, -1)
cszLBL = wx.StaticText(self, -1, 'City, State, Zip')
self.textctrl['city'] = wx.TextCtrl(self, -1, size=(150,-1))
self.textctrl['state'] = wx.TextCtrl(self, -1, size=(50,-1))
self.textctrl['zipcode'] = wx.TextCtrl(self, -1, size=(70,-1))
phoneLBL = wx.StaticText(self, -1, 'Phone/Fax')
self.textctrl['phonenumber'] = wx.TextCtrl(self, -1)
self.textctrl['fax'] = wx.TextCtrl(self, -1)
specLBL = wx.StaticText(self, -1, 'Specialty')
self.textctrl['specialty'] = wx.TextCtrl(self, -1)
conButton = wx.Button(self, -1, label='Add Consultant')
doneButton = wx.Button(self, -1, label='Done')
conButton.Bind(wx.EVT_BUTTON, self.add_consultant)
doneButton.Bind(wx.EVT_BUTTON, self.OnDone)
#Now the layout
# the top level sizer is called mainSizer
mainSizer = wx.BoxSizer(wx.VERTICAL)
#sizer for top part of frame is topSizer
topSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5)
topSizer.AddGrowableCol(1)
topSizer.Add(reasonLBL, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
topSizer.Add(self.textctrl['reason'], 0, wx.EXPAND)
topSizer.Add(memoLBL, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
topSizer.Add(self.textctrl['memo'], 0, wx.EXPAND)
topSizer.Add(dateLBL, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
topSizer.Add(self.cal, 0)
mainSizer.Add(topSizer, 0, wx.EXPAND|wx.ALL, 10)
#middle part of frame is the tree control of consultants
mainSizer.Add(self.tree_ctrl, 1, wx.EXPAND|wx.ALL, 5)
#bottom part we add new consultants
#similar flexgridsizer to the top
addConsultFlexGridSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5)
addConsultFlexGridSizer.AddGrowableCol(1)
addConsultFlexGridSizer.Add(nameLBL, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
#name needs a horizontal sub-sizer
nameSizer = wx.BoxSizer(wx.HORIZONTAL)
nameSizer.Add(self.textctrl['firstname'], 1, wx.RIGHT, 5)
nameSizer.Add(self.textctrl['lastname'], 1)
addConsultFlexGridSizer.Add(nameSizer, 0, wx.EXPAND)
addConsultFlexGridSizer.Add(addrLBL, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
addConsultFlexGridSizer.Add(self.textctrl['address'], 0, wx.EXPAND)
addConsultFlexGridSizer.Add(cszLBL, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
#city, state, zip needs a horizontal sub-sizer
#.........这里部分代码省略.........