Files
medicus/MedicusWithClaude/check_last_dekurs.py
2026-03-18 07:13:47 +01:00

43 lines
1.2 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""check_last_dekurs.py zobrazí posledních 5 záznamů v DEKURS + FILES pro pacienta 9742"""
import fdb
conn = fdb.connect(
dsn=r'localhost:c:\medicus 3\data\medicus.fdb',
user='SYSDBA', password='masterkey', charset='WIN1250'
)
cur = conn.cursor()
print("=== Posledních 5 záznamů DEKURS pro Buzalka (idpac=9742) ===")
cur.execute("""
SELECT id, datum, cas, OCTET_LENGTH(dekurs) as delka
FROM dekurs WHERE idpac = 9742
ORDER BY id DESC ROWS 5
""")
for row in cur.fetchall():
print(f" ID={row[0]} datum={row[1]} cas={row[2]} délka={row[3]} B")
print()
print("=== Obsah posledního DEKURS záznamu ===")
cur.execute("""
SELECT dekurs FROM dekurs WHERE idpac = 9742
ORDER BY id DESC ROWS 1
""")
row = cur.fetchone()
if row:
text = row[0]
if isinstance(text, bytes):
text = text.decode('cp1250', errors='replace')
print(text)
print()
print("=== Posledních 5 záznamů FILES pro Buzalka (idpac=9742) ===")
cur.execute("""
SELECT id, filename, datum, OCTET_LENGTH(body) as bodylen
FROM files WHERE idpac = 9742
ORDER BY id DESC ROWS 5
""")
for row in cur.fetchall():
print(f" ID={row[0]} filename={row[1]} datum={row[2]} body={row[3]} B")
conn.close()