def add_recall(vaccination=None): if vaccination is None: subject = _('vaccination recall') else: subject = _('vaccination recall (%s)') % vaccination['vaccine'] recall = gmProviderInbox.create_inbox_message ( message_type = _('Vaccination'), subject = subject, patient = pat.ID, staff = None ) if vaccination is not None: recall['data'] = _('Existing vaccination:\n\n%s') % u'\n'.join(vaccination.format( with_indications = True, with_comment = True, with_reaction = False, date_format = '%Y %b %d' )) recall.save() from Gnumed.wxpython import gmProviderInboxWidgets gmProviderInboxWidgets.edit_inbox_message ( parent = parent, message = recall, single_entry = False ) return False
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
def _save_as_new(self): pat_id = None if self._CHBOX_active_patient.GetValue() is True: pat_id = gmPerson.gmCurrentPatient().ID else: if self._PRW_patient.person is not None: pat_id = self._PRW_patient.person.ID receiver = None if self._CHBOX_send_to_me.IsChecked(): receiver = gmStaff.gmCurrentProvider()['pk_staff'] else: if self._PRW_receiver.GetData() is not None: receiver = self._PRW_receiver.GetData() msg = gmProviderInbox.create_inbox_message ( patient = pat_id, staff = receiver, message_type = self._PRW_type.GetData(can_create = True), subject = self._TCTRL_subject.GetValue().strip() ) msg['data'] = self._TCTRL_message.GetValue().strip() if self._PRW_due.is_valid_timestamp(): msg['due_date'] = self._PRW_due.date if self._PRW_expiry.is_valid_timestamp(): msg['expiry_date'] = self._PRW_expiry.date if self._RBTN_normal.GetValue() is True: msg['importance'] = 0 elif self._RBTN_high.GetValue() is True: msg['importance'] = 1 else: msg['importance'] = -1 msg.save() self.data = msg return True
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