diff --git a/mods/db.py b/mods/db.py index a447649..02f72b4 100644 --- a/mods/db.py +++ b/mods/db.py @@ -85,7 +85,7 @@ class BaseModel(Model): class BaseFTSModel(FTS5Model): class Meta: database = db - options = {'tokenize': 'porter'} + options = {'tokenize': 'porter', 'content': ''} class Patient(BaseModel): id = AutoIncrementField() last_name = TextField() @@ -158,18 +158,21 @@ class Rls(BaseModel): enddate = DateField(null=True, help_text='Дата окончания действия регистрационного удостоверения') cancellationdate = DateField(null=True, help_text='Дата аннулирования регистрационного удостоверения') nameregcertificate = TextField(null=True, help_text='Юридическое лицо, на имя которого выдано регистрационное удостоверение') - country = ForeignKeyField(RlsCountry, backref='rlsinit', help_text='Страна производства') + country = ForeignKeyField(RlsCountry, backref='rls', help_text='Страна производства') tradename = TextField(null=True, help_text='Торговое наименование лекарственного средства') internationalname = TextField(null=True, help_text='Международное непатентованное или химическое наименование лекарственного средства') formrelease = TextField(null=True, help_text='Формы выпуска') stages = TextField(null=True, help_text='Сведения о стадиях производства') barcodes = TextField(null=True, help_text='Штрих-коды потребительской упаковки') normativedocumentation = TextField(null=True, help_text='Нормативная документация') - pharmacotherapeuticgroup = ForeignKeyField(RlsPharmacoTherapeuticGroup, backref='rlsinit', help_text='Фармако-терапевтическая группа') + pharmacotherapeuticgroup = ForeignKeyField(RlsPharmacoTherapeuticGroup, backref='rls', help_text='Фармако-терапевтическая группа') class RlsIndex(BaseFTSModel): rowid = RowIDField() tradename = SearchField() internationalname = SearchField() +class MedicineOrder(BaseModel): + id = AutoIncrementField() + order = TextField(unique=True) class ReceptionDiagnosis(BaseModel): id = AutoIncrementField() reception = ForeignKeyField(Reception, backref='reception_diagnosisses', on_delete='CASCADE') @@ -186,6 +189,7 @@ class ReceptionMedicine(BaseModel): id = AutoIncrementField() reception = ForeignKeyField(Reception, backref='reception_medicine', on_delete='CASCADE') medicine = ForeignKeyField(Rls, backref='reception_medicine', on_delete='CASCADE') + order = ForeignKeyField(MedicineOrder, backref='reception_medicine', on_delete='CASCADE') ### Настройки class Settings(BaseModel): @@ -223,5 +227,6 @@ db.create_tables([ RlsCountry, Rls, RlsIndex, + MedicineOrder, Settings ]) diff --git a/mods/lists.py b/mods/lists.py index e9d9a7f..266845b 100644 --- a/mods/lists.py +++ b/mods/lists.py @@ -9,10 +9,12 @@ import peewee ANAMNEZ_LIST = 'anamnez' OBSERVE_LIST = 'observ' +MED_ORDER = 'med_order' lists_map = { ANAMNEZ_LIST: 'Анамнез', OBSERVE_LIST: 'Осмотр', + MED_ORDER: 'Порядок приёма медикаментов' } for s_id in lists_map: