コード例 #1
0
ファイル: models.py プロジェクト: Sirahi/HospitalWebApp
class Diagnosis(UserMixin, db.Model):
    __tablename__ = 'diagnosis'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(64), index=True, unique=True)
    explanation = db.Column(db.String(1024))
    diagnosed_by = db.Column(db.String(64))
    patient_id = db.Column(db.Integer, db.ForeignKey('user.id'))
コード例 #2
0
class DiagonasticMaster(db.Model):
    __tablename__ = 'DiagonasticMaster'
    dName = db.Column(db.String(20), primary_key=True, nullable=False)
    amt = db.Column(db.Integer, nullable=False)

    def __repr__(self):
        return f"Diagonastic('{self.dName}','{self.amt}')"
コード例 #3
0
class Diagonastic(db.Model):
    __tablename__ = 'Diagonastic'
    dName = db.Column(db.String(20), primary_key=True, nullable=False)
    amt = db.Column(db.Integer, nullable=False)
    pid = db.Column(db.Integer, db.ForeignKey('Patient.id'), nullable=False)

    def __repr__(self):
        return f"Diagonastic('{self.dName}','{self.amt}')"
コード例 #4
0
class User(db.Model, UserMixin):
    __tablename__ = 'user'
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(80), unique=True)
    password = db.Column(db.String(80), nullable=False)
    utype = db.Column(db.String(80), nullable=False)

    def __repr__(self):
        return f"user('{self.username}','{self.password}')"
コード例 #5
0
class MedicineMaster(db.Model):
    __tablename__ = 'MedicineMaster'
    mName = db.Column(db.String(20), primary_key=True, nullable=False)
    qty = db.Column(db.Integer, nullable=False)
    rate = db.Column(db.Integer, nullable=False)
    status = db.Column(db.String, )

    def __repr__(self):
        return f"Medicine('{self.mName}','{self.qty}','{self.rate}','{self.status}')"
コード例 #6
0
class Medicine(db.Model):
    __tablename__ = 'Medicine'
    mName = db.Column(db.String(20), primary_key=True, nullable=False)
    qty = db.Column(db.Integer, nullable=False)
    rate = db.Column(db.Integer, nullable=False)
    amount = db.Column(db.Integer, nullable=False)
    pid = db.Column(db.Integer, db.ForeignKey('Patient.id'), nullable=False)

    def __repr__(self):
        return f"Medicine('{self.mName}','{self.qty}','{self.rate}','{self.amount}')"
コード例 #7
0
ファイル: models.py プロジェクト: Sirahi/HospitalWebApp
class User(UserMixin, db.Model):
    __tablename__ = 'user'

    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(64), index=True, unique=True)
    first_name = db.Column(db.String(64))
    last_name = db.Column(db.String(64))
    email = db.Column(db.String(120), index=True, unique=True)
    specialization = db.Column(db.String(120), nullable=True)
    checked = db.Column(db.Boolean)
    password_hash = db.Column(db.String(128))
    doctor = db.relationship('User',
                             backref='assigned_patients',
                             remote_side=[id])
    doctor_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    diagnosis = db.relationship('Diagnosis', backref='patient')

    def set_password(self, password):
        self.password_hash = generate_password_hash(password)

    def check_password(self, password):
        return check_password_hash(self.password_hash, password)

    @login.user_loader
    def load_user(id):
        return User.query.get(int(id))
コード例 #8
0
class Admin(db.Model, UserMixin):
    id_number = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20), nullable=False)
    surname = db.Column(db.String(20), nullable=False)
    id = db.Column(db.String(120), unique=True, nullable=False)
    image_file = db.Column(db.String(20),
                           nullable=False,
                           default='default.jpg')
    password = db.Column(db.String(60), nullable=False)
    role = db.Column(db.String(10), nullable=False, default='admin')

    #function for setting values, that class will return when calling the database
    def __repr__(self):
        return f"Admin('{self.name}','{self.surname}' ,'{self.id}', '{self.image_file}','{self.role}','{self.password}')"
コード例 #9
0
class Doctor(db.Model, UserMixin):
    id_number = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20), nullable=False)
    surname = db.Column(db.String(20), nullable=False)
    id = db.Column(db.String(120), unique=True, nullable=False)
    image_file = db.Column(db.String(20),
                           nullable=False,
                           default='default.jpg')
    password = db.Column(db.String(60), nullable=False)
    diagnosis = db.relationship('Diagnosis', backref='doctor', lazy=True)
    role = db.Column(db.String(10), nullable=False, default='doctor')

    #function for setting values, that class will return when calling the database
    def __repr__(self):
        return f"Doctor('{self.name}','{self.surname}' ,'{self.id}', '{self.image_file}','{self.role}')"
コード例 #10
0
class Diagnosis(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    status = db.Column(db.String(100), nullable=False)
    date_posted = db.Column(db.Date, nullable=False, default=date.today())
    image_file = db.Column(db.String(20),
                           nullable=False,
                           default='default.png')
    content = db.Column(db.Text, nullable=False)
    #foregin keys from patient and doctor tables
    patient_id = db.Column(db.Integer,
                           db.ForeignKey('patient.id_number'),
                           nullable=False)
    doctor_id = db.Column(db.Integer,
                          db.ForeignKey('doctor.id_number'),
                          nullable=False)

    #function for setting values, that class will return when calling the database
    def __repr__(self):
        return f"Diagnosis('{self.status}', '{self.date_posted}', '{self.image_file}')"
コード例 #11
0
class Patient(db.Model):
    __tablename__ = 'Patient'
    id = db.Column(db.Integer, primary_key=True)
    ssnid = db.Column(
        db.Integer,
        unique=True,
        nullable=False,
    )
    name = db.Column(db.String(20), nullable=False)
    age = db.Column(db.String(100), nullable=False)
    address = db.Column(db.String(100), nullable=False)
    city = db.Column(db.String(100), nullable=False)
    state = db.Column(db.String(100), nullable=False)
    bed = db.Column(db.String(50), nullable=False)
    status = db.Column(db.String(50), nullable=False)
    doj = db.Column(db.String(50), nullable=False)
    dodc = db.Column(db.String(50))
    medrelo = db.relationship('Medicine', backref='diag', lazy=True)
    diagrelo = db.relationship('Diagonastic', backref='med', lazy=True)

    def __repr__(self):
        return f"Patient('{self.id}','{self.ssnid}','{self.name}','{self.age}','{self.address}','{self.city}','{self.state}','{self.bed}','{self.doj}','{self.dodc}')"