CREATE TABLE IF NOT EXISTS medevio.medevio_pacient (
    patient_id              VARCHAR(36)   NOT NULL PRIMARY KEY,
    name                    VARCHAR(100),
    surname                 VARCHAR(100),
    identification_number   VARCHAR(20)   COMMENT 'Rodne cislo bez lomitka',
    sex                     VARCHAR(10)   COMMENT 'Male / Female',
    dob                     DATE          COMMENT 'Datum narozeni',
    email                   VARCHAR(200),
    phone                   VARCHAR(50),
    insurance_code          INT           COMMENT 'Kod pojistovny (111=VZP, 207=OZP, ...)',
    insurance_name          VARCHAR(100)  COMMENT 'Nazev pojistovny',
    status                  VARCHAR(20)   COMMENT 'ACTIVE / INACTIVE',
    is_in_clinic            TINYINT(1)    DEFAULT 1,
    has_mobile_app          TINYINT(1)    DEFAULT 0,
    anamnesis_shared        TINYINT(1)    DEFAULT 0,
    note                    TEXT          COMMENT 'Interni poznamka lekare',
    city                    VARCHAR(200),
    street                  VARCHAR(200),
    house_number            VARCHAR(50),
    user_id                 VARCHAR(36)   COMMENT 'ID uzivatelskeho uctu (PatientUser)',
    user_email              VARCHAR(200)  COMMENT 'Email spravujici osoby',
    user_phone              VARCHAR(50)   COMMENT 'Telefon spravujici osoby',
    created_at              DATETIME      COMMENT 'Kdy byl pacient vytvoren v Medeviu',
    synced_at               DATETIME      NOT NULL COMMENT 'Cas posledni synchronizace'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
