Начало диалога выбора диагноза

This commit is contained in:
Бородин Роман 2019-12-24 13:19:35 +03:00
parent e26e20662c
commit f3a9d1cd5e
5 changed files with 185 additions and 1 deletions

View File

@ -109,11 +109,12 @@ class Diagnosis(BaseModel):
title = TextField() title = TextField()
class DiagnosisIndex(BaseFTSModel): class DiagnosisIndex(BaseFTSModel):
rowid = RowIDField() rowid = RowIDField()
code = SearchField()
title = SearchField() title = SearchField()
class ReceptionDiagnosis(BaseModel): class ReceptionDiagnosis(BaseModel):
id = AutoIncrementField() id = AutoIncrementField()
reception = ForeignKeyField(Reception, backref='reception_diagnosisses', on_delete='CASCADE') 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): class ReceptionAnamnesis(BaseModel):
id = AutoIncrementField() id = AutoIncrementField()
reception = ForeignKeyField(Reception, backref='reception_anamnesisses', on_delete='CASCADE') reception = ForeignKeyField(Reception, backref='reception_anamnesisses', on_delete='CASCADE')

15
mods/diagnosis.py Normal file
View File

@ -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

View File

@ -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') 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') 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') 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')

View File

@ -38,6 +38,7 @@ with db.atomic():
q = Settings.select().where(Settings.key == S_KEY_RECEPTION_LIST) q = Settings.select().where(Settings.key == S_KEY_RECEPTION_LIST)
if not len(q): if not len(q):
s_set_reception_list([8,0], [17,0], 30) s_set_reception_list([8,0], [17,0], 30)
##########################
# Загрузка диагнозов МКБ 10 # Загрузка диагнозов МКБ 10
q = Diagnosis.select() q = Diagnosis.select()
if not len(q): 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) new_diag = Diagnosis.create(category=__subcat_map_[sc], code=diag.code, title=diag.title)
DiagnosisIndex.insert({ DiagnosisIndex.insert({
DiagnosisIndex.rowid: new_diag.id, DiagnosisIndex.rowid: new_diag.id,
DiagnosisIndex.code: new_diag.code,
DiagnosisIndex.title: new_diag.title DiagnosisIndex.title: new_diag.title
}).execute() }).execute()
del __subcat_map_ del __subcat_map_
del __root_cat_map_ del __root_cat_map_
diag_db.close() diag_db.close()
###########################

View File

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkListStore" id="category_list">
<columns>
<!-- column-name str1 -->
<column type="str"/>
</columns>
</object>
<object class="GtkWindow" id="choose_diagnosis_window">
<property name="width_request">800</property>
<property name="height_request">600</property>
<property name="can_focus">False</property>
<property name="window_position">center</property>
<property name="type_hint">dialog</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Выбор диагноза</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">object-select-symbolic</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkScrolledWindow">
<property name="width_request">250</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkTreeView" id="category_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">category_list</property>
<property name="headers_visible">False</property>
<property name="enable_search">False</property>
<property name="level_indentation">4</property>
<property name="enable_tree_lines">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkListBox" id="diagnosis_list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">3</property>
<property name="margin_bottom">3</property>
<child>
<object class="GtkFixed">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="diagnosis_filter">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFixed">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>