-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
77 lines (55 loc) · 2.46 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from sqlalchemy import Column, DateTime, Integer, String, text
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
Base = declarative_base()
class DDepartment(Base):
__tablename__ = 'd_department'
id = Column(Integer, primary_key=True)
name = Column(String(10), nullable=False)
class DDigitalSign(Base):
__tablename__ = 'd_digital_sign'
id = Column(Integer, primary_key=True)
doctor_id = Column(Integer, nullable=False)
record_id = Column(Integer, nullable=False)
sign_1 = Column(String(50), nullable=False)
sign_2 = Column(String(50), nullable=False)
class DDoctorInfo(Base):
__tablename__ = 'd_doctor_info'
id = Column(Integer, primary_key=True)
name = Column(String(8), nullable=False)
department_id = Column(Integer, nullable=False)
gender = Column(Integer, server_default=text("'0'"))
age = Column(Integer)
private_key_id = Column(Integer, nullable=False)
class DMedicalRecord(Base):
__tablename__ = 'd_medical_record'
id = Column(Integer, primary_key=True)
r_name = Column(String(8), nullable=False)
company = Column(String(32), nullable=False)
gender = Column(Integer, nullable=False)
address = Column(String(128), nullable=False)
age = Column(Integer, nullable=False)
department_id = Column(Integer, nullable=False)
nation = Column(String(10), nullable=False)
r_date = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
symptom = Column(String(256), nullable=False)
conclusion = Column(String(256), nullable=False)
class DPrivateKey(Base):
__tablename__ = 'd_private_key'
id = Column(Integer, primary_key=True)
key_y = Column(String(308), nullable=False)
key_g = Column(String(308), nullable=False)
key_p = Column(String(308), nullable=False)
key_q = Column(String(308), nullable=False)
key_x = Column(String(308), nullable=False)
class DUser(Base):
__tablename__ = 'd_user'
id = Column(Integer, primary_key=True)
username = Column(String(12), nullable=False)
pwd = Column(String(64), nullable=False)
salt = Column(String(32), nullable=False)
doctor_info_id = Column(Integer, nullable=False)
from CONFIG import config
connect = create_engine(
'mysql+pymysql://' + config.DATABASE_USER + ':' + config.DATABASE_PASSWORD + '@' + config.DATABASE_HOST + ':' + str(
config.DATABASE_PORT) + '/' + config.DATABASE_NAME + '?charset='+config.DATABASE_ENCODING)