1 """GNUmed patient overview widgets.
2
3 copyright: authors
4 """
5
6 __author__ = "K.Hilbert"
7 __license__ = "GPL v2 or later (details at http://www.gnu.org)"
8
9 import logging, sys
10
11
12 import wx
13
14
15 if __name__ == '__main__':
16 sys.path.insert(0, '../../')
17 from Gnumed.pycommon import gmTools
18 from Gnumed.pycommon import gmDispatcher
19 from Gnumed.pycommon import gmDateTime
20 from Gnumed.pycommon import gmNetworkTools
21
22 from Gnumed.business import gmPerson
23 from Gnumed.business import gmStaff
24 from Gnumed.business import gmDemographicRecord
25 from Gnumed.business import gmEMRStructItems
26 from Gnumed.business import gmFamilyHistory
27 from Gnumed.business import gmVaccination
28 from Gnumed.business import gmDocuments
29 from Gnumed.business import gmProviderInbox
30 from Gnumed.business import gmExternalCare
31 from Gnumed.business import gmAutoHints
32 from Gnumed.business import gmMedication
33
34 from Gnumed.wxpython import gmRegetMixin
35 from Gnumed.wxpython import gmDemographicsWidgets
36 from Gnumed.wxpython import gmContactWidgets
37 from Gnumed.wxpython import gmMedicationWidgets
38 from Gnumed.wxpython import gmEditArea
39 from Gnumed.wxpython import gmEMRStructWidgets
40 from Gnumed.wxpython import gmEncounterWidgets
41 from Gnumed.wxpython import gmFamilyHistoryWidgets
42 from Gnumed.wxpython import gmVaccWidgets
43 from Gnumed.wxpython import gmDocumentWidgets
44 from Gnumed.wxpython import gmGuiHelpers
45 from Gnumed.wxpython import gmPregWidgets
46 from Gnumed.wxpython import gmHabitWidgets
47 from Gnumed.wxpython import gmHospitalStayWidgets
48 from Gnumed.wxpython import gmProcedureWidgets
49
50
51 _log = logging.getLogger('gm.patient')
52
53 from Gnumed.wxGladeWidgets import wxgPatientOverviewPnl
54
55 -class cPatientOverviewPnl(wxgPatientOverviewPnl.wxgPatientOverviewPnl, gmRegetMixin.cRegetOnPaintMixin):
56
63
64
65
66
109
110
112 self._LCTRL_identity.set_string_items()
113 self._LCTRL_contacts.set_string_items()
114 self._LCTRL_encounters.set_string_items()
115
116 self._LCTRL_problems.set_string_items()
117 self._LCTRL_meds.set_string_items()
118 self._LCTRL_history.set_string_items()
119
120 self._LCTRL_inbox.set_string_items()
121 self._LCTRL_results.set_string_items()
122 self._LCTRL_documents.set_string_items()
123
124
125
126
128
129 gmDispatcher.connect(signal = 'pre_patient_unselection', receiver = self._on_pre_patient_unselection)
130 gmDispatcher.connect(signal = 'post_patient_selection', receiver = self._on_post_patient_selection)
131
132
133 gmDispatcher.connect(signal = 'gm_table_mod', receiver = self._on_database_signal)
134
135
136
137
138
139
140
141
142 gmDispatcher.connect(signal = 'clin.reviewed_test_results_mod_db', receiver = self._on_post_patient_selection)
143
144
145
146
147
148
150
151
152
153 self.__reset_ui_content()
154
155
157 self._schedule_data_reget()
158
159
161
162 pat = gmPerson.gmCurrentPatient()
163 if not pat.connected:
164 return True
165
166 if kwds['pk_identity'] != pat.ID:
167 return True
168
169 if kwds['table'] == 'dem.identity':
170 if kwds['operation'] != 'UPDATE':
171 return True
172
173 if kwds['table'] in [
174 'blobs.doc_med',
175 'clin.episode',
176 'clin.health_issue',
177 'clin.suppressed_hint',
178 'clin.substance_intake',
179 'clin.hospital_stay',
180 'clin.procedure',
181 'clin.vaccination',
182 'clin.family_history',
183 'clin.test_result',
184 'clin.export_item',
185 'clin.external_care',
186 'dem.identity',
187 'dem.names',
188 'dem.lnk_identity2comm',
189 'dem.lnk_job2person',
190 'dem.message_inbox',
191 'ref.auto_hint'
192 ]:
193 self._schedule_data_reget()
194 return True
195
196 return True
197
198
199
200
202 pat = gmPerson.gmCurrentPatient()
203 if not pat.connected:
204 self.__reset_ui_content()
205 return True
206
207 self.__refresh_identity(patient = pat)
208 self.__refresh_contacts(patient = pat)
209 self.__refresh_encounters(patient = pat)
210
211 self.__refresh_problems(patient = pat)
212 self.__refresh_meds(patient = pat)
213 self.__refresh_history(patient = pat)
214
215 self.__refresh_inbox(patient = pat)
216 self.__refresh_results(patient = pat)
217 self.__refresh_documents(patient = pat)
218
219 return True
220
221
222
223
225 list_items = []
226 list_data = []
227
228 emr = patient.emr
229 most_recent = emr.get_most_recent_results(no_of_results = 1)
230 if most_recent is None:
231 self._LCTRL_results.set_string_items(items = [])
232 self._LCTRL_results.set_data(data = [])
233 return
234
235 now = gmDateTime.pydt_now_here()
236 list_items.append(_('Latest: %s ago (%s %s%s%s%s)') % (
237 gmDateTime.format_interval_medically(now - most_recent['clin_when']),
238 most_recent['unified_abbrev'],
239 most_recent['unified_val'],
240 gmTools.coalesce(most_recent['val_unit'], '', ' %s'),
241 gmTools.coalesce(most_recent['abnormality_indicator'], '', ' %s'),
242 gmTools.bool2subst(most_recent['reviewed'], '', (' %s' % gmTools.u_writing_hand))
243 ))
244 list_data.append(most_recent)
245 most_recent_needs_red = False
246 if most_recent.is_considered_abnormal is True:
247 if most_recent['is_clinically_relevant']:
248 most_recent_needs_red = True
249
250 unsigned = emr.get_unsigned_results(order_by = "(trim(coalesce(abnormality_indicator), '') <> '') DESC NULLS LAST, unified_abbrev")
251 no_of_reds = 0
252 for result in unsigned:
253 if result['pk_test_result'] == most_recent['pk_test_result']:
254 continue
255 if result['abnormality_indicator'] is not None:
256 if result['abnormality_indicator'].strip() != '':
257 no_of_reds += 1
258 list_items.append(_('%s %s%s%s (%s ago, %s)') % (
259 result['unified_abbrev'],
260 result['unified_val'],
261 gmTools.coalesce(result['val_unit'], '', ' %s'),
262 gmTools.coalesce(result['abnormality_indicator'], '', ' %s'),
263 gmDateTime.format_interval_medically(gmDateTime.pydt_now_here() - result['clin_when']),
264 gmTools.u_writing_hand
265 ))
266 list_data.append(result)
267
268 self._LCTRL_results.set_string_items(items = list_items)
269 self._LCTRL_results.set_data(data = list_data)
270
271 if most_recent_needs_red:
272 self._LCTRL_results.SetItemTextColour(0, wx.Colour('RED'))
273 if no_of_reds > 0:
274 for idx in range(1, no_of_reds + 1):
275 self._LCTRL_results.SetItemTextColour(idx, wx.Colour('RED'))
276
277
280
281
283
284
285
286
287
288
289
290 gmDispatcher.send(signal = 'display_widget', name = 'gmMeasurementsGridPlugin')
291 return
292
293
294
296 list_items = []
297 list_data = []
298 highlight_list = []
299 line_idx = -1
300
301 overdue_messages = patient.overdue_messages
302 if len(overdue_messages) > 0:
303 highlight_list.extend(range(len(overdue_messages)))
304 for msg in overdue_messages:
305 line_idx += 1
306 list_items.append(_('overdue %s: %s') % (
307 gmDateTime.format_interval_medically(msg['interval_due']),
308 gmTools.coalesce(msg['comment'], '?')
309 ))
310 list_data.append(msg)
311
312 for msg in patient.get_messages(order_by = 'due_date NULLS LAST, importance DESC, received_when DESC'):
313
314 if msg['is_overdue']:
315 continue
316
317 if msg['is_expired']:
318 continue
319 line_idx += 1
320 if msg['due_date'] is None:
321 label = '%s%s' % (
322 msg['l10n_type'],
323 gmTools.coalesce(msg['comment'], '', ': %s')
324 )
325 else:
326 label = _('due in %s%s') % (
327 gmDateTime.format_interval_medically(msg['interval_due']),
328 gmTools.coalesce(msg['comment'], '', ': %s')
329 )
330 list_items.append(label)
331 list_data.append(msg)
332
333 pk_enc = patient.emr.active_encounter['pk_encounter']
334 for hint in patient._get_dynamic_hints(pk_encounter = pk_enc):
335 line_idx += 1
336 list_items.append(hint['title'])
337 list_data.append(hint)
338 if hint['highlight_as_priority']:
339 highlight_list.append(line_idx)
340
341 hints = patient.suppressed_hints
342 if len(hints) > 0:
343 list_items.append((_("suppr'd (%s):") % len(hints)) + ' ' + ','.join([h['title'][:7] + gmTools.u_ellipsis for h in hints]))
344 list_data.append(_('Suppressed hints:\n') + '\n'.join(['%s: %s' % (hints.index(h) + 1, h['title']) for h in hints]))
345
346 self._LCTRL_inbox.set_string_items(items = list_items)
347 self._LCTRL_inbox.set_data(data = list_data)
348
349 for idx in highlight_list:
350 self._LCTRL_inbox.SetItemTextColour(idx, wx.Colour('RED'))
351
352
370
371
410
411
413
414 list_items = []
415 list_data = []
416
417
418 item_count = len(patient.export_area.items)
419 if item_count == 1:
420 list_items.append(_('Export area: 1 item'))
421 list_data.append('')
422 if item_count > 1:
423 list_items.append(_('Export area: %s items') % item_count)
424 list_data.append('')
425
426 doc_folder = patient.get_document_folder()
427
428
429 docs = doc_folder.get_unsigned_documents()
430 no_of_unsigned = len(docs)
431 for doc in docs:
432 list_items.append('%s %s (%s)' % (
433 gmDateTime.pydt_strftime(doc['clin_when'], format = '%m/%Y', accuracy = gmDateTime.acc_months),
434 doc['l10n_type'],
435 gmTools.u_writing_hand
436 ))
437 list_data.append(doc)
438
439
440 docs = doc_folder.get_documents(order_by = 'ORDER BY clin_when DESC', exclude_unsigned = True)
441 for doc in docs[:5]:
442 list_items.append('%s %s' % (
443 gmDateTime.pydt_strftime(doc['clin_when'], format = '%m/%Y', accuracy = gmDateTime.acc_months),
444 doc['l10n_type']
445 ))
446 list_data.append(doc)
447 if len(docs) > 5:
448 list_items.append(_('%s %s more not shown %s') % (
449 gmTools.u_ellipsis,
450 len(docs) - 5,
451 gmTools.u_ellipsis
452 ))
453 list_data.append('')
454
455 self._LCTRL_documents.set_string_items(items = list_items)
456 self._LCTRL_documents.set_data(data = list_data)
457
458 if no_of_unsigned > 0:
459 start_idx = 0
460 if item_count > 0:
461 start_idx = 1
462 end_idx = no_of_unsigned + start_idx
463 for idx in range(start_idx, end_idx):
464 self._LCTRL_documents.SetItemTextColour(idx, wx.Colour('RED'))
465
473
489
490
492
493 emr = patient.emr
494
495 list_items = []
496 list_data = []
497
498 is_waiting = False
499 wlist = patient.get_waiting_list_entry()
500 if len(wlist) > 0:
501 is_waiting = True
502 list_items.append(_('Currently %s entries in waiting list') % len(wlist))
503 tt = []
504 for w in wlist:
505 tt.append('%s %s%s%s' % (
506 gmTools.u_triangular_bullet,
507 gmDateTime.format_interval_medically(w['waiting_time']),
508 gmTools.coalesce(w['waiting_zone'], '', ' in "%s"'),
509 gmTools.coalesce(w['comment'], '', ': %s')
510 ))
511 if len(tt) > 0:
512 tt = '\n'.join(tt)
513 else:
514 tt = None
515 list_data.append({'wlist': tt})
516
517 first = emr.get_first_encounter()
518 if first is not None:
519 list_items.append (
520 _('first (in GMd): %s, %s') % (
521 gmDateTime.pydt_strftime (
522 first['started'],
523 format = '%Y %b %d',
524 accuracy = gmDateTime.acc_days
525 ),
526 first['l10n_type']
527 )
528 )
529 list_data.append(first)
530
531 last = emr.get_last_but_one_encounter()
532 if last is not None:
533 list_items.append (
534 _('last: %s, %s') % (
535 gmDateTime.pydt_strftime (
536 last['started'],
537 format = '%Y %b %d',
538 accuracy = gmDateTime.acc_days
539 ),
540 last['l10n_type']
541 )
542 )
543 list_data.append(last)
544
545 encs = emr.get_encounter_stats_by_type()
546 for enc in encs:
547 item = ' %s x %s' % (enc['frequency'], enc['l10n_type'])
548 list_items.append(item)
549 list_data.append(item)
550
551 stays = emr.get_hospital_stay_stats_by_hospital()
552 for stay in stays:
553 item = ' %s x %s' % (
554 stay['frequency'],
555 stay['hospital']
556 )
557 list_items.append(item)
558 list_data.append({'stay': item})
559
560 self._LCTRL_encounters.set_string_items(items = list_items)
561 self._LCTRL_encounters.set_data(data = list_data)
562 if is_waiting:
563 self._LCTRL_encounters.SetItemTextColour(0, wx.Colour('RED'))
564
565
586
606
607
608
609 - def __refresh_history(self, patient=None):
610 emr = patient.emr
611
612 sort_key_list = []
613 date_format4sorting = '%Y %m %d %H %M %S'
614 now = gmDateTime.pydt_now_here()
615 data = {}
616
617
618
619 edc = emr.EDC
620 if edc is not None:
621 sort_key = '99999 edc'
622 if emr.EDC_is_fishy:
623 label = _('EDC (!?!): %s') % gmDateTime.pydt_strftime(edc, format = '%Y %b %d')
624 tt = _(
625 'The Expected Date of Confinement is rather questionable.\n'
626 '\n'
627 'Please check patient age, patient gender, time until/since EDC.'
628 )
629 else:
630 label = _('EDC: %s') % gmDateTime.pydt_strftime(edc, format = '%Y %b %d')
631 tt = ''
632 sort_key_list.append(sort_key)
633 data[sort_key] = [label, tt]
634
635
636 fhxs = emr.get_family_history()
637 for fhx in fhxs:
638 sort_key = '99998 %s::%s' % (fhx['l10n_relation'], fhx['pk_family_history'])
639 sort_key_list.append(sort_key)
640
641 label = '%s%s: %s' % (fhx['l10n_relation'], gmTools.coalesce(fhx['age_noted'], '', ' (@ %s)'), fhx['condition'])
642 data[sort_key] = [label, fhx]
643 del fhxs
644
645
646 issues = [
647 i for i in emr.get_health_issues()
648 if ((i['clinically_relevant'] is False) or (i['is_active'] is False))
649 ]
650 for issue in issues:
651 last_encounter = emr.get_last_encounter(issue_id = issue['pk_health_issue'])
652 linked_encounter = gmEMRStructItems.cEncounter(issue['pk_encounter'])
653 when_candidates = [issue['modified_when'], linked_encounter['last_affirmed']]
654 if last_encounter is not None:
655 when_candidates.append(last_encounter['last_affirmed'])
656 if (patient['dob'] is not None) and (issue['age_noted'] is not None):
657 when_candidates.append(patient['dob'] + issue['age_noted'])
658 if issue['is_active']:
659
660
661
662
663
664
665 relevant_date = max(when_candidates)
666 else:
667
668
669
670
671
672
673
674 if (patient['dob'] is not None) and (issue['age_noted'] is not None):
675 relevant_date = patient['dob'] + issue['age_noted']
676 else:
677 relevant_date = min(when_candidates)
678 sort_key = '%s::%s' % (gmDateTime.pydt_strftime(relevant_date, format = date_format4sorting), issue['pk_health_issue'])
679 relevant_date_str = gmDateTime.pydt_strftime(relevant_date, format = '%Y %b')
680 if issue['age_noted'] is None:
681 encounter = gmEMRStructItems.cEncounter(issue['pk_encounter'])
682 age = _(' (entered %s ago)') % gmDateTime.format_interval_medically(now - encounter['started'])
683 else:
684 age = ' (@ %s)' % gmDateTime.format_interval_medically(issue['age_noted'])
685 sort_key_list.append(sort_key)
686 data[sort_key] = ['%s %s%s' % (relevant_date_str, issue['description'], age), issue]
687 del issues
688
689 stays = emr.get_hospital_stays()
690 for stay in stays:
691 sort_key = '%s::%s' % (gmDateTime.pydt_strftime(stay['admission'], format = date_format4sorting), stay['pk_hospital_stay'])
692 label = '%s %s: %s (%s)' % (
693 gmDateTime.pydt_strftime(stay['admission'], format = '%Y %b'),
694 stay['hospital'],
695 stay['episode'],
696 _('%s ago') % gmDateTime.format_interval_medically(now - stay['admission'])
697 )
698 sort_key_list.append(sort_key)
699 data[sort_key] = [label, stay]
700 del stays
701
702 procs = emr.get_performed_procedures()
703 for proc in procs:
704 sort_key = '%s::%s' % (gmDateTime.pydt_strftime(proc['clin_when'], format = date_format4sorting), proc['pk_procedure'])
705 label = '%s%s %s (%s @ %s)' % (
706 gmDateTime.pydt_strftime(proc['clin_when'], format = '%Y %b'),
707 gmTools.bool2subst(proc['is_ongoing'], gmTools.u_ellipsis, '', ''),
708 proc['performed_procedure'],
709 _('%s ago') % gmDateTime.format_interval_medically(now - proc['clin_when']),
710 gmDateTime.format_interval_medically(proc['clin_when'] - patient['dob'])
711 )
712 sort_key_list.append(sort_key)
713 data[sort_key] = [label, proc]
714 del procs
715
716 vaccs = emr.get_latest_vaccinations()
717 for ind, tmp in vaccs.items():
718 no_of_shots, vacc = tmp
719 sort_key = '%s::%s::%s' % (gmDateTime.pydt_strftime(vacc['date_given'], format = date_format4sorting), vacc['pk_vaccination'], ind)
720 label = _('%s Vacc: %s (latest of %s: %s ago)') % (
721 gmDateTime.pydt_strftime(vacc['date_given'], format = '%Y %b'),
722 ind,
723 no_of_shots,
724 gmDateTime.format_interval_medically(now - vacc['date_given'])
725 )
726 sort_key_list.append(sort_key)
727 data[sort_key] = [label, vacc]
728 del vaccs
729
730 for abuse in [ a for a in emr.abused_substances if a['harmful_use_type'] == 3 ]:
731 sort_key = '%s::%s' % (gmDateTime.pydt_strftime(abuse['last_checked_when'], format = date_format4sorting), abuse['substance'])
732 label = _('Hx of addiction: %s') % abuse['substance']
733 sort_key_list.append(sort_key)
734 data[sort_key] = [label, abuse]
735
736 sort_key_list.sort()
737 sort_key_list.reverse()
738 list_items = []
739 list_data = []
740 for key in sort_key_list:
741 label, item = data[key]
742 list_items.append(label)
743 list_data.append(item)
744
745 self._LCTRL_history.set_string_items(items = list_items)
746 self._LCTRL_history.set_data(data = list_data)
747
748
750
751 if isinstance(data, gmEMRStructItems.cHealthIssue):
752 return data.format (
753 patient = gmPerson.gmCurrentPatient(),
754 with_medications = False,
755 with_hospital_stays = False,
756 with_procedures = False,
757 with_family_history = False,
758 with_documents = False,
759 with_tests = False,
760 with_vaccinations = False
761 ).strip('\n')
762
763 if isinstance(data, gmMedication.cSubstanceIntakeEntry):
764 return data.format(single_line = False)
765
766 if isinstance(data, gmFamilyHistory.cFamilyHistory):
767 return data.format(include_episode = True, include_comment = True)
768
769 if isinstance(data, gmEMRStructItems.cHospitalStay):
770 return data.format()
771
772 if isinstance(data, gmEMRStructItems.cPerformedProcedure):
773 return data.format(include_episode = True, include_codes = False, include_address = True, include_comm = True)
774
775 if isinstance(data, gmVaccination.cVaccination):
776 return '\n'.join(data.format (
777 with_indications = True,
778 with_comment = True,
779 with_reaction = True,
780 date_format = '%Y %b %d'
781 ))
782
783
784 if isinstance(data, str):
785 if data == '':
786 return None
787 return data
788
789 return None
790
791
793 data = self._LCTRL_history.get_selected_item_data(only_one = True)
794 if data is None:
795 return
796
797 if isinstance(data, str):
798 gmPregWidgets.calculate_edc(parent = self, patient = gmPerson.gmCurrentPatient())
799 return
800
801
802 if wx.GetKeyState(wx.WXK_CONTROL):
803 if isinstance(data, gmEMRStructItems.cHealthIssue):
804 gmEMRStructWidgets.edit_health_issue(parent = self, issue = data)
805 return
806 if isinstance(data, gmFamilyHistory.cFamilyHistory):
807 FamilyHistoryWidgets.edit_family_history(parent = self, family_history = data)
808 return
809 if isinstance(data, gmEMRStructItems.cHospitalStay):
810 gmHospitalStayWidgets.edit_hospital_stay(parent = self, hospital_stay = data)
811 return
812 if isinstance(data, gmEMRStructItems.cPerformedProcedure):
813 gmProcedureWidgets.edit_procedure(parent = self, procedure = data)
814 return
815 if isinstance(data, gmVaccination.cVaccination):
816 gmVaccWidgets.edit_vaccination(parent = self, vaccination = data, single_entry = True)
817 return
818 return
819
820 if isinstance(data, gmEMRStructItems.cHealthIssue):
821 gmDispatcher.send(signal = 'display_widget', name = 'gmEMRBrowserPlugin')
822 return
823 if isinstance(data, gmFamilyHistory.cFamilyHistory):
824 FamilyHistoryWidgets.manage_family_history(parent = self)
825 return
826 if isinstance(data, gmEMRStructItems.cHospitalStay):
827 gmHospitalStayWidgets.manage_hospital_stays(parent = self)
828 return
829 if isinstance(data, gmEMRStructItems.cPerformedProcedure):
830 gmProcedureWidgets.manage_performed_procedures(parent = self)
831 return
832 if isinstance(data, gmVaccination.cVaccination):
833 gmVaccWidgets.manage_vaccinations(parent = self)
834 return
835
836 return
837
838
840
841 emr = patient.emr
842
843 list_items = []
844 data_items = []
845 first_red = False
846
847
848 abuses = emr.abused_substances
849 if len([ a for a in abuses if a['harmful_use_type'] in [1, 2] ]) > 0:
850 list_items.append(_('active substance abuse'))
851 data_items.append('\n'.join([ a.format(left_margin=0, date_format='%Y %b %d', single_line=True) for a in abuses ]))
852
853
854 intakes = emr.get_current_medications(include_inactive = False, include_unapproved = True, order_by = 'substance')
855 multi_products_already_seen = []
856 for intake in intakes:
857 drug = intake.containing_drug
858 if len(drug['components']) == 1:
859 list_items.append(_('%s %s%s%s') % (
860 intake['substance'],
861 intake['amount'],
862 intake.formatted_units,
863 gmTools.coalesce(intake['schedule'], '', ': %s')
864 ))
865 data_items.append(intake)
866 else:
867 if intake['product'] in multi_products_already_seen:
868 continue
869 multi_products_already_seen.append(intake['product'])
870 list_items.append(_('%s %s%s') % (
871 intake['product'],
872 drug['l10n_preparation'],
873 gmTools.coalesce(intake['schedule'], '', ': %s')
874 ))
875 data_items.append(intake)
876
877 self._LCTRL_meds.set_string_items(items = list_items)
878 self._LCTRL_meds.set_data(data = data_items)
879
880 if first_red:
881 self._LCTRL_meds.SetItemTextColour(0, wx.Colour('RED'))
882
883
898
899
916
917
918
972
973
1030
1031
1051
1052
1053
1097
1098
1140
1141
1156
1157
1158
1188
1189
1208
1209
1211 data = self._LCTRL_identity.get_selected_item_data(only_one = True)
1212 if data is None:
1213 gmDispatcher.send(signal = 'display_widget', name = 'gmNotebookedPatientEditionPlugin')
1214
1215
1216 if not wx.GetKeyState(wx.WXK_CONTROL):
1217 gmDispatcher.send(signal = 'display_widget', name = 'gmNotebookedPatientEditionPlugin')
1218
1219
1220 if isinstance(data, gmPerson.cPersonName):
1221 ea = gmDemographicsWidgets.cPersonNameEAPnl(self, -1, name = data)
1222 dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area = ea, single_entry = True)
1223 dlg.SetTitle(_('Cloning name'))
1224 dlg.ShowModal()
1225 return
1226
1227 if isinstance(data, dict):
1228 key = list(data.keys())[0]
1229 val = data[key]
1230 if key == 'id':
1231 ea = gmDemographicsWidgets.cExternalIDEditAreaPnl(self, -1, external_id = val)
1232 ea.id_holder = gmPerson.gmCurrentPatient()
1233 dlg = gmEditArea.cGenericEditAreaDlg2(self, -1, edit_area = ea, single_entry = True)
1234 dlg.SetTitle(_('Editing external ID'))
1235 dlg.ShowModal()
1236 return
1237 if key == 'job':
1238 gmDemographicsWidgets.edit_occupation()
1239 return
1240
1241
1242
1243
1244 if __name__ == "__main__":
1245
1246 if len(sys.argv) < 2:
1247 sys.exit()
1248
1249 if sys.argv[1] != 'test':
1250 sys.exit()
1251
1252
1253
1254
1255
1256
1257
1258
1259