Exemple #1
0
class Doctor(db.Model):
    __tablename__ = 'doctor'
    id = db.Column(db.Integer, primary_key=True)
    doctor_name = db.Column(db.String(150), unique=False)
    doctor_email = db.Column(db.String(50), unique=False)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)

    def __repr__(self):
        return f"Doctor('{self.doctor_name}', '{self.doctor_email}')"
Exemple #2
0
class usergroup(db.Model,BaseModel):
    '''
    定义用户角色关系表
    '''
    __tablename__ = 'usergroup'
    guid = db.Column(Integer, unique=True, primary_key=True, autoincrement=True)
    user_code = db.Column('user_code',db.String(50))
    groupid = db.Column('groupid',db.String(50))

    def __int__(self, user_code=None, groupid=None):
        self.user_code = user_code
        self.groupid = groupid
Exemple #3
0
class mission_user(db.Model, BaseModel):
    '''
    定义了任务与用户关系
    '''
    __tablename__ = 'mission_user'
    guid = db.Column(Integer, unique=True, primary_key=True, autoincrement=True)
    missionid = db.Column('missionid',db.String(10))
    user_code = db.Column('user_code', db.String(50))

    def __int__(self, missionid=None, user_code=None):
        self.missionid = missionid
        self.user_code = user_code
Exemple #4
0
class User(Base, UserMixin):
    __tablename__ = 'user'
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(15), unique=True)
    email = db.Column(db.String(50), unique=True)
    password = db.Column(db.String(80))
    join_date = db.Column(db.DateTime)
    picture = db.Column(db.String(20), nullable=False, default='default.jpg')
    readings = db.relationship('Readings', backref='creator', lazy=True)

    def __repr__(self):
        # return '<User %r>' % self.username, self.email, self.picture
        return f"User('{self.username}', '{self.email}', '{self.picture}')"
Exemple #5
0
class mission_barcode(db.Model, BaseModel):
    '''
    定义任务与资产标签号关系
    '''
    __tablename__ = 'mission_barcode'
    guid = db.Column(Integer, unique=True, primary_key=True, autoincrement=True)
    missionid = db.Column('missionid', db.String(10))
    barcode = db.Column('barcode', db.String(100))
    msgid = db.Column('msgid')

    def __int__(self, missionid=None, barcode=None, msgid=None):
        self.missionid = missionid
        self.barcode = barcode
        self.msgid = msgid
Exemple #6
0
class Readings(db.Model):
    __tablename__ = 'readings'
    id = db.Column(db.Integer, primary_key=True)
    date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow())
    #date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
    systolic = db.Column(db.Integer())
    diastolic = db.Column(db.Integer())
    notes = db.Column(db.String(250))
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)

    def __repr__(self):
        return f"Readings('{self.date_posted}', '{self.systolic}', '{self.diastolic}', '{self.notes}')"
Exemple #7
0
class mission(db.Model, BaseModel):
    '''
    定义了任务
    '''
    __tablename__ = 'mission'

    guid = db.Column(Integer, unique=True, primary_key=True, autoincrement=True)
    missionname = db.Column('missionname', db.String(100))
    startdate = db.Column('startdate',db.DATE)
    enddate = db.Column('enddate',db.DATE)

    def __int__(self, missionname=None, startdate=None, enddate=None):
        self.missionname = missionname
        self.startdate = startdate
        self.enddate = enddate
Exemple #8
0
class Doctor(Base):
    __tablename__ = 'doctor'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(150), unique=False)
    email = db.Column(db.String(50), unique=False)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)