示例#1
0
	def _on_save_note_under_button_pressed(self, event):
		encounter = gmEncounterWidgets.select_encounters (
			parent = self,
			patient = self.__pat,
			single_selection = True
		)
		# cancelled or None selected:
		if encounter is None:
			return

		self._NB_soap_editors.save_current_editor (
			emr = self.__pat.emr,
			encounter = encounter['pk_encounter'],
			episode_name_candidates = [
				gmTools.none_if(self._TCTRL_aoe.GetValue().strip(), ''),
				gmTools.none_if(self._TCTRL_rfe.GetValue().strip(), '')
			]
		)
		event.Skip()
示例#2
0
	def _on_save_note_under_button_pressed(self, event):
		encounter = gmEncounterWidgets.select_encounters (
			parent = self,
			patient = self.__pat,
			single_selection = True
		)
		# cancelled or None selected:
		if encounter is None:
			return

		self._NB_soap_editors.save_current_editor (
			emr = self.__pat.emr,
			encounter = encounter['pk_encounter'],
			episode_name_candidates = [
				gmTools.none_if(self._TCTRL_aoe.GetValue().strip(), ''),
				gmTools.none_if(self._TCTRL_rfe.GetValue().strip(), '')
			]
		)
		event.Skip()
示例#3
0
def move_progress_notes_to_another_encounter(parent=None,
                                             encounters=None,
                                             episodes=None,
                                             patient=None,
                                             move_all=False):

    # sanity checks
    if patient is None:
        patient = gmPerson.gmCurrentPatient()

    if not patient.connected:
        gmDispatcher.send(
            signal='statustext',
            msg=_('Cannot move progress notes. No active patient.'))
        return False

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

    emr = patient.emr

    if encounters is None:
        all_encs_in_epi = emr.get_encounters(episodes=episodes,
                                             skip_empty=True)
        # nothing to do ?
        if len(all_encs_in_epi) == 0:
            return True
        encounters = gmEncounterWidgets.select_encounters(
            parent=parent,
            patient=patient,
            single_selection=False,
            encounters=all_encs_in_epi)
        # cancelled
        if encounters is None:
            return True
        # none selected
        if len(encounters) == 0:
            return True

    notes = emr.get_clin_narrative(encounters=encounters, episodes=episodes)

    # which narrative
    if move_all:
        selected_narr = notes
    else:
        selected_narr = gmListWidgets.get_choices_from_list(
            parent=parent,
            caption=_('Moving progress notes between encounters ...'),
            single_selection=False,
            can_return_empty=True,
            data=notes,
            msg=_('\n Select the progress notes to move from the list !\n\n'),
            columns=[_('when'), _('who'),
                     _('type'), _('entry')],
            choices=[[
                narr['date'].strftime('%x %H:%M'), narr['modified_by'],
                gmSoapDefs.soap_cat2l10n[narr['soap_cat']],
                narr['narrative'].replace('\n', '/').replace('\r', '/')
            ] for narr in notes])

    if not selected_narr:
        return True

    # which encounter to move to
    enc2move2 = gmEncounterWidgets.select_encounters(parent=parent,
                                                     patient=patient,
                                                     single_selection=True)

    if not enc2move2:
        return True

    for narr in selected_narr:
        narr['pk_encounter'] = enc2move2['pk_encounter']
        narr.save()

    return True
示例#4
0
def move_progress_notes_to_another_encounter(parent=None, encounters=None, episodes=None, patient=None, move_all=False):

	# sanity checks
	if patient is None:
		patient = gmPerson.gmCurrentPatient()

	if not patient.connected:
		gmDispatcher.send(signal = 'statustext', msg = _('Cannot move progress notes. No active patient.'))
		return False

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

	emr = patient.emr

	if encounters is None:
		all_encs_in_epi = emr.get_encounters(episodes = episodes, skip_empty = True)
		# nothing to do ?
		if len(all_encs_in_epi) == 0:
			return True
		encounters = gmEncounterWidgets.select_encounters (
			parent = parent,
			patient = patient,
			single_selection = False,
			encounters = all_encs_in_epi
		)
		# cancelled
		if encounters is None:
			return True
		# none selected
		if len(encounters) == 0:
			return True

	notes = emr.get_clin_narrative (
		encounters = encounters,
		episodes = episodes
	)

	# which narrative
	if move_all:
		selected_narr = notes
	else:
		selected_narr = gmListWidgets.get_choices_from_list (
			parent = parent,
			caption = _('Moving progress notes between encounters ...'),
			single_selection = False,
			can_return_empty = True,
			data = notes,
			msg = _('\n Select the progress notes to move from the list !\n\n'),
			columns = [_('when'), _('who'), _('type'), _('entry')],
			choices = [
				[	narr['date'].strftime('%x %H:%M'),
					narr['modified_by'],
					gmSoapDefs.soap_cat2l10n[narr['soap_cat']],
					narr['narrative'].replace('\n', '/').replace('\r', '/')
				] for narr in notes
			]
		)

	if not selected_narr:
		return True

	# which encounter to move to
	enc2move2 = gmEncounterWidgets.select_encounters (
		parent = parent,
		patient = patient,
		single_selection = True
	)

	if not enc2move2:
		return True

	for narr in selected_narr:
		narr['pk_encounter'] = enc2move2['pk_encounter']
		narr.save()

	return True