notebookVB
This commit is contained in:
34
10 Tests/2026-01-16 1.py
Normal file
34
10 Tests/2026-01-16 1.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import pymysql
|
||||
|
||||
mysql = pymysql.connect(
|
||||
host="192.168.1.76",
|
||||
port=3307,
|
||||
user="root",
|
||||
password="Vlado9674+",
|
||||
database="medevio",
|
||||
charset="utf8mb4",
|
||||
cursorclass=pymysql.cursors.DictCursor
|
||||
)
|
||||
|
||||
sql = """
|
||||
SELECT rc
|
||||
FROM (
|
||||
SELECT rc, stav,
|
||||
ROW_NUMBER() OVER (PARTITION BY rc ORDER BY k_datu DESC) AS rn
|
||||
FROM vzp_stav_pojisteni
|
||||
) t
|
||||
WHERE rn = 1
|
||||
AND stav <> '1'
|
||||
"""
|
||||
|
||||
with mysql.cursor() as cur:
|
||||
cur.execute(sql)
|
||||
rows = cur.fetchall()
|
||||
|
||||
# výsledná množina rodných čísel
|
||||
rc_not_insured = {row["rc"] for row in rows}
|
||||
|
||||
mysql.close()
|
||||
|
||||
print(f"Nalezeno {len(rc_not_insured)} nepojištěných pacientů")
|
||||
# print(rc_not_insured) # volitelně
|
||||
Reference in New Issue
Block a user