def _on_list_item_activated(self, evt): data = self.get_selected_item_data(only_one = True) pk_pat_col = self.__get_patient_pk_data_key(data = data) if pk_pat_col is None: gmDispatcher.send(signal = 'statustext', msg = _('List not known to be patient-related.')) return pat_data = data[pk_pat_col] try: pat_pk = int(pat_data) pat = gmPerson.cPerson(aPK_obj = pat_pk) except (ValueError, TypeError): searcher = gmPersonSearch.cPatientSearcher_SQL() idents = searcher.get_identities(pat_data) if len(idents) == 0: gmDispatcher.send(signal = 'statustext', msg = _('No matching patient found.')) return if len(idents) == 1: pat = idents[0] else: from Gnumed.wxpython import gmPatSearchWidgets dlg = gmPatSearchWidgets.cSelectPersonFromListDlg(parent=wx.GetTopLevelParent(self), id=-1) dlg.set_persons(persons=idents) result = dlg.ShowModal() if result == wx.ID_CANCEL: dlg.Destroy() return pat = dlg.get_selected_person() dlg.Destroy() from Gnumed.wxpython import gmPatSearchWidgets gmPatSearchWidgets.set_active_patient(patient = pat)
def test_select_narrative(): pat = gmPersonSearch.ask_for_patient() set_active_patient(patient = pat) app = wx.PyWidgetTester(size = (200, 200)) sels = select_narrative(parent=None, soap_cats = None) print("selected:") for sel in sels: print(sel)
def test_select_narrative_from_episodes(): pat = gmPersonSearch.ask_for_patient() set_active_patient(patient = pat) app = wx.PyWidgetTester(size = (200, 200)) sels = select_narrative_from_episodes_new() print("selected:") for sel in sels: print(sel)
def create_new_person(parent=None, activate=False): if parent is None: parent = wx.GetApp().GetTopWindow() if activate: # meaning we will switch away from the current patient if any msg = _( 'Before creating a new person review the encounter details\n' 'of the patient you just worked on:\n' ) gmEncounterWidgets.sanity_check_encounter_of_active_patient(parent = parent, msg = msg) msg = _('Edit the current encounter of the patient you are ABOUT TO LEAVE:') dbcfg = gmCfg.cCfgSQL() def_region = dbcfg.get2 ( option = 'person.create.default_region', workplace = gmPraxis.gmCurrentPraxisBranch().active_workplace, bias = 'user' ) def_country = None if def_region is None: def_country = dbcfg.get2 ( option = 'person.create.default_country', workplace = gmPraxis.gmCurrentPraxisBranch().active_workplace, bias = 'user' ) else: countries = gmDemographicRecord.get_country_for_region(region = def_region) if len(countries) == 1: def_country = countries[0]['code_country'] ea = cNewPatientEAPnl(parent, -1, country = def_country, region = def_region) dlg = gmEditArea.cGenericEditAreaDlg2(parent, -1, edit_area = ea, single_entry = True) dlg.SetTitle(_('Adding new person')) ea._PRW_lastname.SetFocus() result = dlg.ShowModal() pat = ea.data dlg.DestroyLater() if result != wx.ID_OK: return False _log.debug('created new person [%s]', pat.ID) if activate: from Gnumed.wxpython import gmPatSearchWidgets gmPatSearchWidgets.set_active_patient(patient = pat) gmDispatcher.send(signal = 'display_widget', name = 'gmNotebookedPatientEditionPlugin') return True
def test_cSoapPluginPnl(): patient = gmPersonSearch.ask_for_patient() if patient is None: print("No patient. Exiting gracefully...") return set_active_patient(patient=patient) application = wx.PyWidgetTester(size=(800,500)) soap_input = cSoapPluginPnl(application.frame, -1) application.frame.Show(True) soap_input._schedule_data_reget() application.MainLoop()
def _goto_vaccination_review(self, pk_context=None, pk_patient=None): msg = _('Supposedly there are conflicting vaccinations\n' 'for patient [%s]. However, I cannot find\n' 'that patient in the GNUmed database.' ) % pk_patient wx.BeginBusyCursor() try: pat = gmPerson.cPerson(aPK_obj = pk_patient) except gmExceptions.ConstructorError: wx.EndBusyCursor() _log.exception('patient [%s] not found', pk_patient) gmGuiHelpers.gm_show_error(msg, _('handling provider inbox item')) return False success = set_active_patient(patient = pat) wx.EndBusyCursor() if not success: gmGuiHelpers.gm_show_error(msg, _('handling provider inbox item')) return False wx.CallAfter(gmVaccWidgets.manage_vaccinations) return True
def _goto_measurements_review(self, pk_context=None, pk_patient=None): msg = _('Supposedly there are unreviewed results\n' 'for patient [%s]. However, I cannot find\n' 'that patient in the GNUmed database.' ) % pk_patient wx.BeginBusyCursor() try: pat = gmPerson.cPerson(aPK_obj = pk_patient) except gmExceptions.ConstructorError: wx.EndBusyCursor() _log.exception('patient [%s] not found', pk_patient) gmGuiHelpers.gm_show_error(msg, _('handling provider inbox item')) return False success = set_active_patient(patient = pat) wx.EndBusyCursor() if not success: gmGuiHelpers.gm_show_error(msg, _('handling provider inbox item')) return False gmDispatcher.send(signal = 'display_widget', name = 'gmMeasurementsGridPlugin') return True
def _goto_patient(self, pk_context=None, pk_patient=None): wx.BeginBusyCursor() msg = _('There is a message about patient [%s].\n\n' 'However, I cannot find that\n' 'patient in the GNUmed database.' ) % pk_patient try: pat = gmPerson.cPerson(aPK_obj = pk_patient) except gmExceptions.ConstructorError: wx.EndBusyCursor() _log.exception('patient [%s] not found', pk_patient) gmGuiHelpers.gm_show_error(msg, _('handling provider inbox item')) return False except: wx.EndBusyCursor() raise success = set_active_patient(patient = pat) wx.EndBusyCursor() if not success: gmGuiHelpers.gm_show_error(msg, _('handling provider inbox item')) return False return True
#---------------------------------------------------------------- if __name__ == '__main__': # GNUmed from Gnumed.business import gmPersonSearch from Gnumed.wxpython import gmMeasurementWidgets,gmPatSearchWidgets _log.info("starting Notebooked cardiac device input plugin...") try: # obtain patient patient = gmPersonSearch.ask_for_patient() if patient is None: print "None patient. Exiting gracefully..." sys.exit(0) gmPatSearchWidgets.set_active_patient(patient=patient) # display standalone multisash progress notes input application = wx.wx.PyWidgetTester(size = (800,600)) multisash_notes = gmMeasurementWidgets.cCardiacDeviceMeasurementsPnl(application.frame, -1) application.frame.Show(True) application.MainLoop() # clean up if patient is not None: try: patient.cleanup() except: print "error cleaning up patient" except Exception:
import sys import wx from Gnumed.business import gmPersonSearch from Gnumed.wxpython import gmPatSearchWidgets _log.info("starting emr browser plugin...") # obtain patient patient = gmPersonSearch.ask_for_patient() if patient is None: print("None patient. Exiting gracefully...") sys.exit(0) gmPatSearchWidgets.set_active_patient(patient=patient) # display standalone browser application = wx.wxPyWidgetTester(size=(800, 600)) emr_browser = gmEMRBrowser.cEMRBrowserPanel(application.frame, -1) emr_browser.refresh_tree() application.frame.Show(True) application.MainLoop() # clean up if patient is not None: try: patient.cleanup() except Exception: print("error cleaning up patient")
def create_new_person(parent=None, activate=False): if parent is None: parent = wx.GetApp().GetTopWindow() if activate: # meaning we will switch away from the current patient if any msg = _(u'Before creating a new person review the encounter details\n' u'of the patient you just worked on:\n') gmEncounterWidgets.sanity_check_encounter_of_active_patient( parent=parent, msg=msg) msg = _( 'Edit the current encounter of the patient you are ABOUT TO LEAVE:' ) dbcfg = gmCfg.cCfgSQL() def_region = dbcfg.get2( option=u'person.create.default_region', workplace=gmPraxis.gmCurrentPraxisBranch().active_workplace, bias=u'user') def_country = None if def_region is None: def_country = dbcfg.get2( option=u'person.create.default_country', workplace=gmPraxis.gmCurrentPraxisBranch().active_workplace, bias=u'user') else: countries = gmDemographicRecord.get_country_for_region( region=def_region) if len(countries) == 1: def_country = countries[0]['code_country'] ea = cNewPatientEAPnl(parent=parent, id=-1, country=def_country, region=def_region) dlg = gmEditArea.cGenericEditAreaDlg2(parent=parent, id=-1, edit_area=ea, single_entry=True) dlg.SetTitle(_('Adding new person')) ea._PRW_lastname.SetFocus() result = dlg.ShowModal() pat = ea.data dlg.Destroy() if result != wx.ID_OK: return False _log.debug('created new person [%s]', pat.ID) if activate: from Gnumed.wxpython import gmPatSearchWidgets gmPatSearchWidgets.set_active_patient(patient=pat) gmDispatcher.send(signal='display_widget', name='gmNotebookedPatientEditionPlugin') return True