import os, fdb
from lxml import etree
import hashlib

# Connect to the Firebird database
conn = fdb.connect(
    dsn=r'localhost:u:\medicus 3\data\medicus.fdb',  # Database path
    user='SYSDBA',  # Username
    password="masterkey",  # Password,
    charset="win1250")
cur = conn.cursor()





# cur.execute("select distinct recept.idpac, rodcis, upper(kar.PRIJMENI || ', ' || kar.jmeno) as jmeno,notifikace_kontakt "
#             "from recept join kar on recept.idpac=kar.idpac "
#             "join registr on recept.idpac=registr.idpac where datum_zruseni is null "
#             "and notifikace_kontakt is not null "
#             "order by recept.datum desc")

cur.execute("select kar.idpac, kar.prijmeni, kar.rodcis,poradi, kontakt, popis, karkontakt.typ, vztah from karkontakt join kar on kar.idpac=karkontakt.idpac")

for radek in cur.fetchall():
    print(radek)


