diff --git a/mods/db.py b/mods/db.py index 492f0ff..0d6fd72 100644 --- a/mods/db.py +++ b/mods/db.py @@ -109,11 +109,12 @@ class Diagnosis(BaseModel): title = TextField() class DiagnosisIndex(BaseFTSModel): rowid = RowIDField() + code = SearchField() title = SearchField() class ReceptionDiagnosis(BaseModel): id = AutoIncrementField() reception = ForeignKeyField(Reception, backref='reception_diagnosisses', on_delete='CASCADE') - diagnosis = ForeignKeyField(CatalogRecord, backref='reception_diagnosisses', on_delete='CASCADE') + diagnosis = ForeignKeyField(Diagnosis, backref='reception_diagnosisses', on_delete='CASCADE') class ReceptionAnamnesis(BaseModel): id = AutoIncrementField() reception = ForeignKeyField(Reception, backref='reception_anamnesisses', on_delete='CASCADE') diff --git a/mods/diagnosis.py b/mods/diagnosis.py new file mode 100644 index 0000000..12bea7b --- /dev/null +++ b/mods/diagnosis.py @@ -0,0 +1,15 @@ +import gi +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk +from mods.files import choose_diagnosis_win_file + + + +def create_choose_diagnosis_win(reception): + class ChooseDiagnosisWinHandler: + pass + b = Gtk.Builder() + b.add_from_file(choose_diagnosis_win_file) + b.connect_signals(ChooseDiagnosisWinHandler()) + w = b.get_object('choose_diagnosis_window') + return w diff --git a/mods/files.py b/mods/files.py index 480a02f..fa409e3 100644 --- a/mods/files.py +++ b/mods/files.py @@ -36,3 +36,4 @@ reception_list_settings_win_file = os.path.join(ui_dir, 'reception_list_settings new_catalog_win_file = os.path.join(ui_dir, 'new_catalog_win.glade') choose_patient_win_file = os.path.join(ui_dir, 'choose_patient_win.glade') open_reception_win_file = os.path.join(ui_dir, 'open_reception_win.glade') +choose_diagnosis_win_file = os.path.join(ui_dir, 'choose_diagnosis_win.glade') diff --git a/mods/settings.py b/mods/settings.py index 59cc859..c6afb1b 100644 --- a/mods/settings.py +++ b/mods/settings.py @@ -38,6 +38,7 @@ with db.atomic(): q = Settings.select().where(Settings.key == S_KEY_RECEPTION_LIST) if not len(q): s_set_reception_list([8,0], [17,0], 30) +########################## # Загрузка диагнозов МКБ 10 q = Diagnosis.select() if not len(q): @@ -55,8 +56,10 @@ if not len(q): new_diag = Diagnosis.create(category=__subcat_map_[sc], code=diag.code, title=diag.title) DiagnosisIndex.insert({ DiagnosisIndex.rowid: new_diag.id, + DiagnosisIndex.code: new_diag.code, DiagnosisIndex.title: new_diag.title }).execute() del __subcat_map_ del __root_cat_map_ diag_db.close() +########################### diff --git a/res/ui/choose_diagnosis_win.glade b/res/ui/choose_diagnosis_win.glade new file mode 100644 index 0000000..546e4b5 --- /dev/null +++ b/res/ui/choose_diagnosis_win.glade @@ -0,0 +1,164 @@ + + + + + + + + + + + + 800 + 600 + False + center + dialog + + + True + False + Выбор диагноза + True + + + True + True + True + + + True + False + object-select-symbolic + + + + + + + + + True + False + + + 250 + True + True + in + + + True + False + + + True + True + category_list + False + False + 4 + True + + + + + + + + + + False + True + 0 + + + + + True + False + vertical + + + True + True + in + + + True + False + + + True + False + + + + + + + True + True + 0 + + + + + True + False + 3 + 3 + + + True + False + + + True + True + 0 + + + + + True + True + edit-find-symbolic + False + False + + + True + True + 1 + + + + + True + False + + + True + True + 2 + + + + + False + True + 1 + + + + + True + True + 1 + + + + + +