функции анамнеза в окне приёма
This commit is contained in:
parent
6995916d8a
commit
eaf76e6428
|
@ -29,6 +29,9 @@ with open(catalog_row_file, 'r') as f:
|
|||
diagnosis_row_file = os.path.join(ui_dir, 'diagnosis_row.glade')
|
||||
with open(diagnosis_row_file, 'r') as f:
|
||||
diagnosis_row_ui_str = f.read()
|
||||
anamnesis_row_file = os.path.join(ui_dir, 'anamnesis_row.glade')
|
||||
with open(anamnesis_row_file, 'r') as f:
|
||||
anamnesis_row_ui_str = f.read()
|
||||
|
||||
main_win_file = os.path.join(ui_dir, 'main_win.glade')
|
||||
new_patient_win_file = os.path.join(ui_dir, 'new_patient_win.glade')
|
||||
|
|
|
@ -4,6 +4,7 @@ gi.require_version('Gtk', '3.0')
|
|||
from gi.repository import Gtk, GObject, Gdk
|
||||
from mods.db import db, Reception, Patient, ReceptionDiagnosis, ReceptionAnamnesis
|
||||
from mods.files import new_reception_win_file, reception_row_ui_str, reception_list_settings_win_file, open_reception_win_file, diagnosis_row_ui_str
|
||||
from mods.files import anamnesis_row_ui_str
|
||||
from mods.settings import s_get_reception_list, s_set_reception_list
|
||||
from mods.diagnosis import create_choose_diagnosis_win, get_giagnosis
|
||||
from mods.lists import get_listrecord
|
||||
|
@ -56,6 +57,13 @@ class ReceptionDiagnosisRow(Gtk.ListBoxRow):
|
|||
@db_id.setter
|
||||
def db_id_setter(self, value):
|
||||
self._db_id = value
|
||||
class ReceptionAnamnesisRow(Gtk.ListBoxRow):
|
||||
@GObject.Property
|
||||
def db_id(self):
|
||||
return self._db_id
|
||||
@db_id.setter
|
||||
def db_id_setter(self, value):
|
||||
self._db_id = value
|
||||
|
||||
def get_reception(reception_id):
|
||||
with db.atomic():
|
||||
|
@ -138,7 +146,17 @@ def build_reception_diagnosis_row(diagnosis):
|
|||
row.props.db_id = diagnosis.id
|
||||
row.add(box)
|
||||
return row
|
||||
|
||||
def build_reception_anamnesis_row(anamnesis):
|
||||
b = Gtk.Builder()
|
||||
b.add_from_string(anamnesis_row_ui_str)
|
||||
win = b.get_object('win')
|
||||
box = b.get_object('anamnesis_box')
|
||||
b.get_object('title').set_text(f'{anamnesis.text}')
|
||||
win.remove(win.get_children()[0])
|
||||
row = ReceptionAnamnesisRow()
|
||||
row.props.db_id = anamnesis.id
|
||||
row.add(box)
|
||||
return row
|
||||
def create_open_reception_win():
|
||||
b = Gtk.Builder()
|
||||
reception_list = builder.get_object('reception_list')
|
||||
|
@ -153,14 +171,23 @@ def create_open_reception_win():
|
|||
reception_diag_list.remove(row)
|
||||
disable_widget([remove_diag_button])
|
||||
reception_diag_list.show_all()
|
||||
def remove_anamnesis(self, button):
|
||||
row = reception_anam_list.get_selected_row()
|
||||
reception_anam_list.remove(row)
|
||||
disable_widget([remove_anam_button])
|
||||
reception_anam_list.show_all()
|
||||
def diagnosis_selected(self, *s):
|
||||
enable_widget([remove_diag_button])
|
||||
def anamnesis_selected(self, *a):
|
||||
enable_widget([remove_anam_button])
|
||||
def save(self, button):
|
||||
# Диагнозы
|
||||
diag_id_list = list(map(lambda x: x.props.db_id, reception_diag_list.get_children()))
|
||||
save_reception_diagnosisses(reception, diag_id_list)
|
||||
#######
|
||||
|
||||
# Анамнез
|
||||
anam_id_list = list(map(lambda x: x.props.db_id, reception_anam_list.get_children()))
|
||||
save_reception_anamnesisses(reception, anam_id_list)
|
||||
#######
|
||||
w.destroy()
|
||||
b.add_from_file(open_reception_win_file)
|
||||
|
@ -171,9 +198,12 @@ def create_open_reception_win():
|
|||
reception_dt = b.get_object('reception_datetime')
|
||||
reception_dt.set_markup(f'<span size="x-large">{reception_row.props.datetime.strftime("%d.%m.%Y - %H:%M")}</span>')
|
||||
reception_diag_list = b.get_object('diagnosis_list')
|
||||
reception_anam_list = b.get_object('anamnesis_list')
|
||||
remove_diag_button = b.get_object('remove_diag_button')
|
||||
remove_anam_button = b.get_object('remove_anam_button')
|
||||
# Анамнезы
|
||||
|
||||
for ra in [x.anamnesis for x in get_reception_anamnesisses(reception)]:
|
||||
reception_anam_list.add(build_reception_anamnesis_row(ra))
|
||||
#
|
||||
# Диагнозы
|
||||
for rd in [x.diagnosis for x in get_reception_diagnosisses(reception)]:
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkWindow" id="win">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="decorated">False</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="anamnesis_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="title">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">label</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
|
@ -222,7 +222,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<object class="GtkButton" id="remove_anam_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
|
Loading…
Reference in New Issue