예제 #1
0
class FamilyBackgroundModel(BaseModel):
    __tablename__ = "antecedentes_familiares"

    family_background_type_id = Column("antecedentes_id", Integer,
                                       ForeignKey('antecedentes.id'))
    pacient_id = Column("pacientes_id", Integer, ForeignKey('pacientes.id'))
    family_member = Column("familiar", String(40))

    @classmethod
    def find_by_pacient_id(cls, pacient_id: str) -> "ClinicalStoryModel":
        return cls.query.filter_by(pacient_id=pacient_id).all()
예제 #2
0
class MetadataModel(BaseModel):
    __tablename__ = "metadatos"

    metadata_type_id = Column("tipo_metadatos_id", Integer,
                              ForeignKey(MetadataTypeModel.id))
    clinical_story_id = Column("historias_clinicas_id", Integer,
                               ForeignKey('historias_clinicas.id'))
    relevant = Column("relevante", Boolean, nullable=False)

    @classmethod
    def find_by_story_id(cls, story_id: str) -> "ExamResultModel":
        return cls.query.filter_by(clinical_story_id=story_id).all()

    @classmethod
    def find_by_metadata_id(cls, metadata_id: str) -> "ExamResultModel":
        return cls.query.filter_by(metadata_type_id=metadata_id).all()
예제 #3
0
class ProfessionHistoryModel(BaseModel):
    __tablename__ = "profesion"

    profession_type_id = Column("tipo_profesiones_id", Integer,
                                ForeignKey(ProfessionTypeModel.id))
    pacient_id = Column("pacientes_id", Integer, ForeignKey('pacientes.id'))
    start = Column("inicio", Date)
    end = Column("fin", Date)

    def __init__(self, profession_type_id, pacient_id, start=None, end=None):
        self.profession_type_id = profession_type_id
        self.pacient_id = pacient_id
        self.start = start
        self.end = end

    @classmethod
    def find_by_pacient_id(cls, pacient_id: str) -> "ClinicalStoryModel":
        return cls.query.filter_by(pacient_id=pacient_id).all()
예제 #4
0
class MedicineModel(BaseModel):
    __tablename__ = "medicaciones"

    medicine_type_id = Column("medicamentos_id", Integer,
                              ForeignKey(MedicineTypeModel.id))
    clinical_story_id = Column("historias_clinicas_id", Integer,
                               ForeignKey('historias_clinicas.id'))
    background = Column("antecedente", Boolean)

    @classmethod
    def get_list(cls, query_params=None) -> "ExamTypeModel":
        query = cls.query

        return query.all()

    @classmethod
    def find_by_story_id(cls, story_id: str) -> "ExamResultModel":
        return cls.query.filter_by(clinical_story_id=story_id).all()
예제 #5
0
class StateModel(BaseModel):
    __tablename__ = "estados"

    country_id = Column("paises_id", Integer, ForeignKey('paises.id'))
    name = Column("nombre", String(100), nullable=False)

    def __init__(self, name, country_id):
        self.name = name
        self.country_id = country_id

    @classmethod
    def get_all(cls):
        return cls.query.all()

    @classmethod
    def find_by_id(cls, id):
        return cls.query.filter_by(id=id).first()
예제 #6
0
class MunicipalityModel(BaseModel):
    __tablename__ = "municipios"

    state_id = Column("estado_id", Integer, ForeignKey('estados.id'))
    name = Column("nombre", String(100), nullable=False)

    def __init__(self, name, state_id):
        self.name = name
        self.state_id = state_id

    @classmethod
    def get_all(cls):
        return cls.query.all()

    @classmethod
    def find_by_id(cls, id):
        return cls.query.filter_by(id=id).first()
예제 #7
0
class DirectionModel(BaseModel):
    __tablename__ = "direcciones"

    municipality_id = Column("municipios_id", Integer,
                             ForeignKey('municipios.id'))
    description = Column("detalle", String(100))

    def __init__(self, municipality_id, description):
        self.municipality_id = municipality_id
        self.description = description

    @classmethod
    def get_all(cls):
        return cls.query.all()

    @classmethod
    def find_by_id(cls, id):
        return cls.query.filter_by(id=id).first()