Ejemplo n.º 1
0
	def _save_as_new(self):

		pat = gmPerson.gmCurrentPatient()
		emr = pat.emr

		stay = self._PRW_hospital_stay.GetData()
		if stay is None:
			epi = self._PRW_episode.GetData(can_create = True)
		else:
			epi = gmEMRStructItems.cHospitalStay(aPK_obj = stay)['pk_episode']

		proc = emr.add_performed_procedure (
			episode = epi,
			location = self._PRW_location.GetData(),
			hospital_stay = stay,
			procedure = self._PRW_procedure.GetValue().strip()
		)

		proc['clin_when'] = self._DPRW_date.GetData().get_pydt()
		if self._DPRW_end.GetData() is None:
			proc['clin_end'] = None
		else:
			proc['clin_end'] = self._DPRW_end.GetData().get_pydt()
		proc['is_ongoing'] = self._CHBOX_ongoing.IsChecked()
		proc['comment'] = self._TCTRL_comment.GetValue()
		proc['pk_doc'] = self._PRW_document.GetData()
		proc.save()

		proc.generic_codes = [ c['data'] for c in self._PRW_codes.GetData() ]

		self.data = proc

		return True
Ejemplo n.º 2
0
	def _save_as_new(self):

		pat = gmPerson.gmCurrentPatient()
		emr = pat.emr

		stay = self._PRW_hospital_stay.GetData()
		if stay is None:
			epi = self._PRW_episode.GetData(can_create = True)
		else:
			epi = gmEMRStructItems.cHospitalStay(aPK_obj = stay)['pk_episode']

		proc = emr.add_performed_procedure (
			episode = epi,
			location = self._PRW_location.GetData(),
			hospital_stay = stay,
			procedure = self._PRW_procedure.GetValue().strip()
		)

		proc['clin_when'] = self._DPRW_date.GetData().get_pydt()
		if self._DPRW_end.GetData() is None:
			proc['clin_end'] = None
		else:
			proc['clin_end'] = self._DPRW_end.GetData().get_pydt()
		proc['is_ongoing'] = self._CHBOX_ongoing.IsChecked()
		proc['comment'] = self._TCTRL_comment.GetValue()
		proc['pk_doc'] = self._PRW_document.GetData()
		proc.save()

		proc.generic_codes = [ c['data'] for c in self._PRW_codes.GetData() ]

		self.data = proc

		return True
Ejemplo n.º 3
0
    def _refresh_as_new_from_existing(self):
        self._refresh_as_new()

        self._PRW_episode.SetText(value=self.data['episode'],
                                  data=self.data['pk_episode'])

        if self.data['pk_hospital_stay'] is None:
            self._PRW_hospital_stay.SetText()
            self._PRW_hospital_stay.Enable(False)
            self._LBL_hospital_details.SetLabel(u'')
            self._PRW_location.SetText(
                value=u'%s @ %s' %
                (self.data['unit'], self.data['organization']),
                data=self.data['pk_org_unit'])
            self._PRW_location.Enable(True)
            self._PRW_episode.Enable(True)
        else:
            self._PRW_hospital_stay.SetText(
                value=u'%s @ %s' %
                (self.data['unit'], self.data['organization']),
                data=self.data['pk_hospital_stay'])
            self._PRW_hospital_stay.Enable(True)
            self._LBL_hospital_details.SetLabel(
                gmEMRStructItems.cHospitalStay(
                    aPK_obj=self.data['pk_hospital_stay']).format())
            self._PRW_location.SetText()
            self._PRW_location.Enable(False)
            self._PRW_episode.Enable(False)

        self._PRW_procedure.SetFocus()
Ejemplo n.º 4
0
    def _save_as_update(self):
        self.data['clin_when'] = self._DPRW_date.GetData().get_pydt()
        self.data['is_ongoing'] = self._CHBOX_ongoing.IsChecked()
        self.data['pk_org_unit'] = self._PRW_location.GetData()
        self.data['pk_hospital_stay'] = self._PRW_hospital_stay.GetData()
        self.data['performed_procedure'] = self._PRW_procedure.GetValue(
        ).strip()
        self.data['comment'] = self._TCTRL_comment.GetValue()
        self.data['pk_doc'] = self._PRW_document.GetData()
        if self._DPRW_end.GetData() is None:
            self.data['clin_end'] = None
        else:
            self.data['clin_end'] = self._DPRW_end.GetData().get_pydt()
        if self.data['pk_hospital_stay'] is None:
            self.data['pk_episode'] = self._PRW_episode.GetData()
        else:
            self.data['pk_episode'] = gmEMRStructItems.cHospitalStay(
                aPK_obj=self._PRW_hospital_stay.GetData())['pk_episode']
        self.data.save()

        self.data.generic_codes = [
            c['data'] for c in self._PRW_codes.GetData()
        ]

        return True
Ejemplo n.º 5
0
	def _on_hospital_stay_lost_focus(self):
		stay = self._PRW_hospital_stay.GetData()
		if stay is None:
			self._PRW_hospital_stay.SetText()
			self._PRW_location.Enable(True)
			self._PRW_episode.Enable(True)
			self._LBL_hospital_details.SetLabel('')
		else:
			self._PRW_location.SetText()
			self._PRW_location.Enable(False)
			self._PRW_episode.SetText()
			self._PRW_episode.Enable(False)
			self._LBL_hospital_details.SetLabel(gmEMRStructItems.cHospitalStay(aPK_obj = stay).format())
Ejemplo n.º 6
0
	def _on_hospital_stay_lost_focus(self):
		stay = self._PRW_hospital_stay.GetData()
		if stay is None:
			self._PRW_hospital_stay.SetText()
			self._PRW_location.Enable(True)
			self._PRW_episode.Enable(True)
			self._LBL_hospital_details.SetLabel('')
		else:
			self._PRW_location.SetText()
			self._PRW_location.Enable(False)
			self._PRW_episode.SetText()
			self._PRW_episode.Enable(False)
			self._LBL_hospital_details.SetLabel(gmEMRStructItems.cHospitalStay(aPK_obj = stay).format())
Ejemplo n.º 7
0
    def _refresh_from_existing(self):
        self._DPRW_date.SetData(data=self.data['clin_when'])
        if self.data['clin_end'] is None:
            self._DPRW_end.SetText()
            self._CHBOX_ongoing.Enable(True)
            self._CHBOX_ongoing.SetValue(self.data['is_ongoing'])
        else:
            self._DPRW_end.SetData(data=self.data['clin_end'])
            self._CHBOX_ongoing.Enable(False)
            now = gmDateTime.pydt_now_here()
            if self.data['clin_end'] > now:
                self._CHBOX_ongoing.SetValue(True)
            else:
                self._CHBOX_ongoing.SetValue(False)
        self._PRW_episode.SetText(value=self.data['episode'],
                                  data=self.data['pk_episode'])
        self._PRW_procedure.SetText(value=self.data['performed_procedure'],
                                    data=self.data['performed_procedure'])
        self._PRW_document.SetData(self.data['pk_doc'])
        self._TCTRL_comment.SetValue(
            gmTools.coalesce(self.data['comment'], u''))

        if self.data['pk_hospital_stay'] is None:
            self._PRW_hospital_stay.SetText()
            self._PRW_hospital_stay.Enable(False)
            self._LBL_hospital_details.SetLabel(u'')
            self._PRW_location.SetText(
                value=u'%s @ %s' %
                (self.data['unit'], self.data['organization']),
                data=self.data['pk_org_unit'])
            self._PRW_location.Enable(True)
            self._PRW_episode.Enable(True)
        else:
            self._PRW_hospital_stay.SetText(
                value=u'%s @ %s' %
                (self.data['unit'], self.data['organization']),
                data=self.data['pk_hospital_stay'])
            self._PRW_hospital_stay.Enable(True)
            self._LBL_hospital_details.SetLabel(
                gmEMRStructItems.cHospitalStay(
                    aPK_obj=self.data['pk_hospital_stay']).format())
            self._PRW_location.SetText()
            self._PRW_location.Enable(False)
            self._PRW_episode.Enable(False)

        val, data = self._PRW_codes.generic_linked_codes2item_dict(
            self.data.generic_codes)
        self._PRW_codes.SetText(val, data)

        self._PRW_procedure.SetFocus()
Ejemplo n.º 8
0
	def _refresh_as_new_from_existing(self):
		self._refresh_as_new()

		self._PRW_episode.SetText(value = self.data['episode'], data = self.data['pk_episode'])

		if self.data['pk_hospital_stay'] is None:
			self._PRW_hospital_stay.SetText()
			self._PRW_hospital_stay.Enable(False)
			self._LBL_hospital_details.SetLabel('')
			self._PRW_location.SetText(value = '%s @ %s' % (self.data['unit'], self.data['organization']), data = self.data['pk_org_unit'])
			self._PRW_location.Enable(True)
			self._PRW_episode.Enable(True)
		else:
			self._PRW_hospital_stay.SetText(value = '%s @ %s' % (self.data['unit'], self.data['organization']), data = self.data['pk_hospital_stay'])
			self._PRW_hospital_stay.Enable(True)
			self._LBL_hospital_details.SetLabel(gmEMRStructItems.cHospitalStay(aPK_obj = self.data['pk_hospital_stay']).format())
			self._PRW_location.SetText()
			self._PRW_location.Enable(False)
			self._PRW_episode.Enable(False)

		self._PRW_procedure.SetFocus()
Ejemplo n.º 9
0
	def _save_as_update(self):
		self.data['clin_when'] = self._DPRW_date.GetData().get_pydt()
		self.data['is_ongoing'] = self._CHBOX_ongoing.IsChecked()
		self.data['pk_org_unit'] = self._PRW_location.GetData()
		self.data['pk_hospital_stay'] = self._PRW_hospital_stay.GetData()
		self.data['performed_procedure'] = self._PRW_procedure.GetValue().strip()
		self.data['comment'] = self._TCTRL_comment.GetValue()
		self.data['pk_doc'] = self._PRW_document.GetData()
		if self._DPRW_end.GetData() is None:
			self.data['clin_end'] = None
		else:
			self.data['clin_end'] = self._DPRW_end.GetData().get_pydt()
		if self.data['pk_hospital_stay'] is None:
			self.data['pk_episode'] = self._PRW_episode.GetData()
		else:
			self.data['pk_episode'] = gmEMRStructItems.cHospitalStay(aPK_obj = self._PRW_hospital_stay.GetData())['pk_episode']
		self.data.save()

		self.data.generic_codes = [ c['data'] for c in self._PRW_codes.GetData() ]

		return True
Ejemplo n.º 10
0
	def _refresh_from_existing(self):
		self._DPRW_date.SetData(data = self.data['clin_when'])
		if self.data['clin_end'] is None:
			self._DPRW_end.SetText()
			self._CHBOX_ongoing.Enable(True)
			self._CHBOX_ongoing.SetValue(self.data['is_ongoing'])
		else:
			self._DPRW_end.SetData(data = self.data['clin_end'])
			self._CHBOX_ongoing.Enable(False)
			now = gmDateTime.pydt_now_here()
			if self.data['clin_end'] > now:
				self._CHBOX_ongoing.SetValue(True)
			else:
				self._CHBOX_ongoing.SetValue(False)
		self._PRW_episode.SetText(value = self.data['episode'], data = self.data['pk_episode'])
		self._PRW_procedure.SetText(value = self.data['performed_procedure'], data = self.data['performed_procedure'])
		self._PRW_document.SetData(self.data['pk_doc'])
		self._TCTRL_comment.SetValue(gmTools.coalesce(self.data['comment'], ''))

		if self.data['pk_hospital_stay'] is None:
			self._PRW_hospital_stay.SetText()
			self._PRW_hospital_stay.Enable(False)
			self._LBL_hospital_details.SetLabel('')
			self._PRW_location.SetText(value = '%s @ %s' % (self.data['unit'], self.data['organization']), data = self.data['pk_org_unit'])
			self._PRW_location.Enable(True)
			self._PRW_episode.Enable(True)
		else:
			self._PRW_hospital_stay.SetText(value = '%s @ %s' % (self.data['unit'], self.data['organization']), data = self.data['pk_hospital_stay'])
			self._PRW_hospital_stay.Enable(True)
			self._LBL_hospital_details.SetLabel(gmEMRStructItems.cHospitalStay(aPK_obj = self.data['pk_hospital_stay']).format())
			self._PRW_location.SetText()
			self._PRW_location.Enable(False)
			self._PRW_episode.Enable(False)

		val, data = self._PRW_codes.generic_linked_codes2item_dict(self.data.generic_codes)
		self._PRW_codes.SetText(val, data)

		self._PRW_procedure.SetFocus()
Ejemplo n.º 11
0
 def _get_hospital_stay(self):
     if self._payload[self._idx['pk_hospital_stay']] is None:
         return None
     from Gnumed.business import gmEMRStructItems
     return gmEMRStructItems.cHospitalStay(
         self._payload[self._idx['pk_hospital_stay']])
Ejemplo n.º 12
0
	def _get_hospital_stay(self):
		if self._payload[self._idx['pk_hospital_stay']] is None:
			return None
		from Gnumed.business import gmEMRStructItems
		return gmEMRStructItems.cHospitalStay(self._payload[self._idx['pk_hospital_stay']])