9 lines
510 B
Python
9 lines
510 B
Python
import psycopg2, sys
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
conn = psycopg2.connect(host='192.168.110.252', port=15432, dbname='postgresql', user='postgresql', password='Jchl1528', options='-c search_path=healthlink_his')
|
|
cur = conn.cursor()
|
|
cur.execute('SELECT id, patient_name, surgery_name, host_user_name, status FROM sys_preop_discussion ORDER BY id LIMIT 5')
|
|
for row in cur.fetchall():
|
|
print(f' id={row[0]} patient={row[1]} surgery={row[2]} host={row[3]} status={row[4]}')
|
|
cur.close()
|
|
conn.close() |