예제 #1
0
def configure_fallback_primary_provider(parent=None):

    if parent is None:
        parent = wx.GetApp().GetTopWindow()

    staff = gmStaff.get_staff_list()
    choices = [[
        s[u'short_alias'],
        u'%s%s %s' % (gmTools.coalesce(
            s['title'], u'', u'%s '), s['firstnames'], s['lastnames']),
        s['l10n_role'],
        gmTools.coalesce(s['comment'], u'')
    ] for s in staff if s['is_active'] is True]
    data = [s['pk_staff'] for s in staff if s['is_active'] is True]

    gmCfgWidgets.configure_string_from_list_option(
        parent=parent,
        message=_('\n'
                  'Please select the provider to fall back to in case\n'
                  'no primary provider is configured for a patient.\n'),
        option='patient.fallback_primary_provider',
        bias='user',
        default_value=None,
        choices=choices,
        columns=[_('Alias'),
                 _('Provider'),
                 _('Role'), _('Comment')],
        data=data,
        caption=_('Configuring fallback primary provider'))
예제 #2
0
파일: gmStaffWidgets.py 프로젝트: sk/gnumed
    def __init_ui_data(self):
        lbl_active = {True: _("active"), False: _("inactive")}
        lbl_login = {True: _("can login"), False: _("can not login")}

        self._LCTRL_staff.DeleteAllItems()
        staff_list = gmStaff.get_staff_list()
        pos = len(staff_list) + 1
        for staff in staff_list:
            row_num = self._LCTRL_staff.InsertStringItem(pos, label=staff["short_alias"])
            self._LCTRL_staff.SetStringItem(index=row_num, col=1, label=staff["db_user"])
            self._LCTRL_staff.SetStringItem(index=row_num, col=2, label=staff["l10n_role"])
            title = gmTools.coalesce(staff["title"], "")
            self._LCTRL_staff.SetStringItem(
                index=row_num, col=3, label="%s %s, %s" % (title, staff["lastnames"], staff["firstnames"])
            )
            self._LCTRL_staff.SetStringItem(index=row_num, col=4, label=gmTools.coalesce(staff["comment"], ""))
            self._LCTRL_staff.SetStringItem(
                index=row_num,
                col=5,
                label="%s / %s" % (lbl_active[bool(staff["is_active"])], lbl_login[bool(staff["can_login"])]),
            )
            # color
            if staff["is_active"] and staff["can_login"]:
                # self._LCTRL_staff.SetItemTextColour(row_num, col=wx.NamedColour('BLUE'))
                pass
            elif not staff["is_active"] and not staff["can_login"]:
                self._LCTRL_staff.SetItemTextColour(row_num, col=wx.LIGHT_GREY)
            else:
                self._LCTRL_staff.SetItemTextColour(row_num, col=wx.NamedColour("RED"))
                # data
            self._LCTRL_staff.SetItemData(item=row_num, data=staff["pk_staff"])

        if len(staff_list) > 0:
            self._LCTRL_staff.SetColumnWidth(col=0, width=wx.LIST_AUTOSIZE)
            self._LCTRL_staff.SetColumnWidth(col=1, width=wx.LIST_AUTOSIZE_USEHEADER)
            self._LCTRL_staff.SetColumnWidth(col=2, width=wx.LIST_AUTOSIZE)
            self._LCTRL_staff.SetColumnWidth(col=3, width=wx.LIST_AUTOSIZE)
            self._LCTRL_staff.SetColumnWidth(col=4, width=wx.LIST_AUTOSIZE)
            self._LCTRL_staff.SetColumnWidth(col=5, width=wx.LIST_AUTOSIZE)

            # disable buttons
        self._btn_save.Enable(False)
        self._btn_delete.Enable(False)
        self._btn_deactivate.Enable(False)
        self._btn_activate.Enable(False)
        # clear editor
        self._TCTRL_name.SetValue("")
        self._TCTRL_alias.SetValue("")
        self._TCTRL_account.SetValue("")
        self._PRW_user_role.SetText(value=u"", data=None)
        self._TCTRL_comment.SetValue("")
예제 #3
0
	def __init_ui_data(self):
		lbl_active = {True: _('active'), False: _('inactive')}
		lbl_login = {True: _('can login'), False: _('can not login')}

		self._LCTRL_staff.DeleteAllItems()
		staff_list = gmStaff.get_staff_list()
		pos = len(staff_list) + 1
		for staff in staff_list:
			row_num = self._LCTRL_staff.InsertItem(pos, label=staff['short_alias'])
			self._LCTRL_staff.SetItem(index = row_num, column = 1, label = staff['db_user'])
			self._LCTRL_staff.SetItem(index = row_num, column = 2, label = staff['l10n_role'])
			title = gmTools.coalesce(staff['title'], '')
			self._LCTRL_staff.SetItem(index = row_num, column = 3, label = '%s %s, %s' % (title, staff['lastnames'], staff['firstnames']))
			self._LCTRL_staff.SetItem(index = row_num, column = 4, label = gmTools.coalesce(staff['comment'], ''))
			self._LCTRL_staff.SetItem(index = row_num, column = 5, label = '%s / %s' % (lbl_active[bool(staff['is_active'])], lbl_login[bool(staff['can_login'])]))
			# color
			if staff['is_active'] and staff['can_login']:
				#self._LCTRL_staff.SetItemTextColour(row_num, wx.Colour('BLUE'))
				pass
			elif not staff['is_active'] and not staff['can_login']:
				self._LCTRL_staff.SetItemTextColour(row_num, wx.LIGHT_GREY)
			else:
				self._LCTRL_staff.SetItemTextColour(row_num, wx.Colour('RED'))
			# data
			self._LCTRL_staff.SetItemData(item = row_num, data = staff['pk_staff'])

		if len(staff_list) > 0:
			self._LCTRL_staff.SetColumnWidth(0, wx.LIST_AUTOSIZE)
			self._LCTRL_staff.SetColumnWidth(1, wx.LIST_AUTOSIZE_USEHEADER)
			self._LCTRL_staff.SetColumnWidth(2, wx.LIST_AUTOSIZE)
			self._LCTRL_staff.SetColumnWidth(3, wx.LIST_AUTOSIZE)
			self._LCTRL_staff.SetColumnWidth(4, wx.LIST_AUTOSIZE)
			self._LCTRL_staff.SetColumnWidth(5, wx.LIST_AUTOSIZE)

		# disable buttons
		self._btn_save.Enable(False)
		self._btn_delete.Enable(False)
		self._btn_deactivate.Enable(False)
		self._btn_activate.Enable(False)
		# clear editor
		self._TCTRL_name.SetValue('')
		self._TCTRL_alias.SetValue('')
		self._TCTRL_account.SetValue('')
		self._PRW_user_role.SetText(value = '', data = None)
		self._TCTRL_comment.SetValue('')
예제 #4
0
파일: gmChartPulling.py 프로젝트: sk/gnumed
def _check_for_provider_chart_access(person):

	curr_prov = gmStaff.gmCurrentProvider()

	# can view my own chart
	if person.ID == curr_prov['pk_identity']:
		return True

	# primary provider can view patient
	if person['pk_primary_provider'] == curr_prov['pk_staff']:
		return True

	# is the patient a provider ?
	if person.ID not in [ s['pk_identity'] for s in gmStaff.get_staff_list() ]:
		return True

	prov = u'%s (%s%s %s)' % (
		curr_prov['short_alias'],
		gmTools.coalesce(curr_prov['title'], u'', u'%s '),
		curr_prov['firstnames'],
		curr_prov['lastnames']
	)
	pat = u'%s%s %s' % (
		gmTools.coalesce(person['title'], u'', u'%s '),
		person['firstnames'],
		person['lastnames']
	)
	# notify the staff member
	gmProviderInbox.create_inbox_message (
		staff = person.staff_id,
		message_type = _('Privacy notice'),
		message_category = u'administrative',
		subject = _('%s: Your chart has been accessed by %s (without user interaction, probably by a script).') % (pat, prov),
		patient = person.ID
	)
	# notify /me about the staff member notification
	gmProviderInbox.create_inbox_message (
		staff = curr_prov['pk_staff'],
		message_type = _('Privacy notice'),
		message_category = u'administrative',
		subject = _('%s: Staff member %s has been notified of your chart access.') % (prov, pat)
	)

	return True
예제 #5
0
def configure_fallback_primary_provider(parent=None):

	if parent is None:
		parent = wx.GetApp().GetTopWindow()

	staff = gmStaff.get_staff_list()
	choices = [ [
			s[u'short_alias'],
			u'%s%s %s' % (
				gmTools.coalesce(s['title'], u'', u'%s '),
				s['firstnames'],
				s['lastnames']
			),
			s['l10n_role'],
			gmTools.coalesce(s['comment'], u'')
		]
		for s in staff
		if s['is_active'] is True
	]
	data = [ s['pk_staff'] for s in staff if s['is_active'] is True ]

	gmCfgWidgets.configure_string_from_list_option (
		parent = parent,
		message = _(
			'\n'
			'Please select the provider to fall back to in case\n'
			'no primary provider is configured for a patient.\n'
		),
		option = 'patient.fallback_primary_provider',
		bias = 'user',
		default_value = None,
		choices = choices,
		columns = [_('Alias'), _('Provider'), _('Role'), _('Comment')],
		data = data,
		caption = _('Configuring fallback primary provider')
	)
예제 #6
0
    def __init_ui_data(self):
        lbl_active = {True: _('active'), False: _('inactive')}
        lbl_login = {True: _('can login'), False: _('can not login')}

        self._LCTRL_staff.DeleteAllItems()
        staff_list = gmStaff.get_staff_list()
        pos = len(staff_list) + 1
        for staff in staff_list:
            row_num = self._LCTRL_staff.InsertItem(pos,
                                                   label=staff['short_alias'])
            self._LCTRL_staff.SetItem(index=row_num,
                                      column=1,
                                      label=staff['db_user'])
            self._LCTRL_staff.SetItem(index=row_num,
                                      column=2,
                                      label=staff['l10n_role'])
            title = gmTools.coalesce(staff['title'], '')
            self._LCTRL_staff.SetItem(
                index=row_num,
                column=3,
                label='%s %s, %s' %
                (title, staff['lastnames'], staff['firstnames']))
            self._LCTRL_staff.SetItem(index=row_num,
                                      column=4,
                                      label=gmTools.coalesce(
                                          staff['comment'], ''))
            self._LCTRL_staff.SetItem(
                index=row_num,
                column=5,
                label='%s / %s' % (lbl_active[bool(
                    staff['is_active'])], lbl_login[bool(staff['can_login'])]))
            # color
            if staff['is_active'] and staff['can_login']:
                #self._LCTRL_staff.SetItemTextColour(row_num, wx.Colour('BLUE'))
                pass
            elif not staff['is_active'] and not staff['can_login']:
                self._LCTRL_staff.SetItemTextColour(row_num, wx.LIGHT_GREY)
            else:
                self._LCTRL_staff.SetItemTextColour(row_num, wx.Colour('RED'))
            # data
            self._LCTRL_staff.SetItemData(item=row_num, data=staff['pk_staff'])

        if len(staff_list) > 0:
            self._LCTRL_staff.SetColumnWidth(0, wx.LIST_AUTOSIZE)
            self._LCTRL_staff.SetColumnWidth(1, wx.LIST_AUTOSIZE_USEHEADER)
            self._LCTRL_staff.SetColumnWidth(2, wx.LIST_AUTOSIZE)
            self._LCTRL_staff.SetColumnWidth(3, wx.LIST_AUTOSIZE)
            self._LCTRL_staff.SetColumnWidth(4, wx.LIST_AUTOSIZE)
            self._LCTRL_staff.SetColumnWidth(5, wx.LIST_AUTOSIZE)

        # disable buttons
        self._btn_save.Enable(False)
        self._btn_delete.Enable(False)
        self._btn_deactivate.Enable(False)
        self._btn_activate.Enable(False)
        # clear editor
        self._TCTRL_name.SetValue('')
        self._TCTRL_alias.SetValue('')
        self._TCTRL_account.SetValue('')
        self._PRW_user_role.SetText(value='', data=None)
        self._TCTRL_comment.SetValue('')
예제 #7
0
def _verify_staff_chart_access(patient=None):

	if patient is None:
		return True

	# staff ?
	if patient.ID not in [ s['pk_identity'] for s in gmStaff.get_staff_list() ]:
		return True

	curr_prov = gmStaff.gmCurrentProvider()

	# can view my own chart
	if patient.ID == curr_prov['pk_identity']:
		return True

	# primary provider can view patient
	if patient['pk_primary_provider'] == curr_prov['pk_staff']:
		return True

	proceed = gmGuiHelpers.gm_show_question (
		aTitle = _('Privacy check'),
		aMessage = _(
			'You have selected the chart of a member of staff,\n'
			'for whom privacy is especially important:\n'
			'\n'
			'  %s, %s\n'
			'\n'
			'This may be OK depending on circumstances.\n'
			'\n'
			'Please be aware that accessing patient charts is\n'
			'logged and that %s%s will be\n'
			'notified of the access if you choose to proceed.\n'
			'\n'
			'Are you sure you want to draw this chart ?'
		) % (
			patient.get_description_gender(),
			patient.get_formatted_dob(),
			gmTools.coalesce(patient['title'], '', '%s '),
			patient['lastnames']
		)
	)

	if proceed:
		prov = '%s (%s%s %s)' % (
			curr_prov['short_alias'],
			gmTools.coalesce(curr_prov['title'], '', '%s '),
			curr_prov['firstnames'],
			curr_prov['lastnames']
		)
		pat = '%s%s %s' % (
			gmTools.coalesce(patient['title'], '', '%s '),
			patient['firstnames'],
			patient['lastnames']
		)
		# notify the staff member
		gmProviderInbox.create_inbox_message (
			staff = patient.staff_id,
			message_type = _('Privacy notice'),
			message_category = 'administrative',
			subject = _('%s: Your chart has been accessed by %s.') % (pat, prov),
			patient = patient.ID
		)
		# notify /me about the staff member notification
		gmProviderInbox.create_inbox_message (
			staff = curr_prov['pk_staff'],
			message_type = _('Privacy notice'),
			message_category = 'administrative',
			subject = _('%s: Staff member %s has been notified of your chart access.') % (prov, pat)
		)

	return proceed
예제 #8
0
def _verify_staff_chart_access(patient=None):

	if patient is None:
		return True

	# staff ?
	if patient.ID not in [ s['pk_identity'] for s in gmStaff.get_staff_list() ]:
		return True

	curr_prov = gmStaff.gmCurrentProvider()

	# can view my own chart
	if patient.ID == curr_prov['pk_identity']:
		return True

	# primary provider can view patient
	if patient['pk_primary_provider'] == curr_prov['pk_staff']:
		return True

	proceed = gmGuiHelpers.gm_show_question (
		aTitle = _('Privacy check'),
		aMessage = _(
			'You have selected the chart of a member of staff,\n'
			'for whom privacy is especially important:\n'
			'\n'
			'  %s, %s\n'
			'\n'
			'This may be OK depending on circumstances.\n'
			'\n'
			'Please be aware that accessing patient charts is\n'
			'logged and that %s%s will be\n'
			'notified of the access if you choose to proceed.\n'
			'\n'
			'Are you sure you want to draw this chart ?'
		) % (
			patient.get_description_gender(),
			patient.get_formatted_dob(),
			gmTools.coalesce(patient['title'], '', '%s '),
			patient['lastnames']
		)
	)

	if proceed:
		prov = '%s (%s%s %s)' % (
			curr_prov['short_alias'],
			gmTools.coalesce(curr_prov['title'], '', '%s '),
			curr_prov['firstnames'],
			curr_prov['lastnames']
		)
		pat = '%s%s %s' % (
			gmTools.coalesce(patient['title'], '', '%s '),
			patient['firstnames'],
			patient['lastnames']
		)
		# notify the staff member
		gmProviderInbox.create_inbox_message (
			staff = patient.staff_id,
			message_type = _('Privacy notice'),
			message_category = 'administrative',
			subject = _('%s: Your chart has been accessed by %s.') % (pat, prov),
			patient = patient.ID
		)
		# notify /me about the staff member notification
		gmProviderInbox.create_inbox_message (
			staff = curr_prov['pk_staff'],
			message_type = _('Privacy notice'),
			message_category = 'administrative',
			subject = _('%s: Staff member %s has been notified of your chart access.') % (prov, pat)
		)

	return proceed