Добавлена БД Реестра Лекарственных Средств с сайта Мин.Здрав-а

This commit is contained in:
Роман Бородин 2020-05-03 18:40:31 +03:00
parent 2c01fb6fd2
commit 0948284f8a
3 changed files with 32 additions and 1 deletions

View File

@ -38,7 +38,38 @@ class Diag(DiagBaseModel):
category = ForeignKeyField(DiagCategory, backref='diagnosis') category = ForeignKeyField(DiagCategory, backref='diagnosis')
code = CharField(32) code = CharField(32)
title = TextField() title = TextField()
####################################################################
rls_db_file = os.path.join(init_db_dir, 'rls.db')
rls_db = CSqliteExtDatabase(rls_db_file, pragmas={
'foreign_keys': 'on',
'ignore_check_constraints': 'off'})
class RlsBaseModel(Model):
'Базовая таблица'
class Meta:
database = rls_db
class RlsInitPharmacoTherapeuticGroup(RlsBaseModel):
id = AutoIncrementField()
title = TextField(null=True)
class RlsInitCountry(RlsBaseModel):
id = AutoIncrementField()
title = TextField(null=True)
class RlsInit(RlsBaseModel):
id = AutoIncrementField()
regnumber = TextField(null=True)
regdate = DateField(null=True)
enddate = DateField(null=True)
cancellationdate = DateField(null=True)
nameregcertificate = TextField(null=True)
country = ForeignKeyField(RlsInitCountry, backref='rlsinit')
tradename = TextField(null=True)
internationalname = TextField(null=True)
formrelease = TextField(null=True)
stages = TextField(null=True)
barcodes = TextField(null=True)
normativedocumentation = TextField(null=True)
pharmacotherapeuticgroup = ForeignKeyField(RlsInitPharmacoTherapeuticGroup, backref='rlsinit')
#################################################################### ####################################################################
db = CSqliteExtDatabase(db_file, pragmas={ db = CSqliteExtDatabase(db_file, pragmas={

View File

@ -40,7 +40,7 @@ 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().limit(10)
if not len(q): if not len(q):
diag_db.connect() diag_db.connect()
__root_cat_map_ = {} __root_cat_map_ = {}

BIN
res/initdb/rls.db Normal file

Binary file not shown.