import psycopg2 import sys sys.stdout.reconfigure(encoding="utf-8") conn = psycopg2.connect( host="192.168.110.252", port=15432, database="postgresql", user="postgresql", password="Jchl1528", ) cursor = conn.cursor() cursor.execute("SET search_path TO hisdev, public") print("wor_service_request therapy相关列:") cursor.execute(""" SELECT column_name FROM information_schema.columns WHERE table_schema = 'hisdev' AND table_name = 'wor_service_request' AND column_name LIKE '%therapy%' """) for row in cursor.fetchall(): print(f" {row[0]}") print() print("med_medication_request therapy相关列:") cursor.execute(""" SELECT column_name FROM information_schema.columns WHERE table_schema = 'hisdev' AND table_name = 'med_medication_request' AND column_name LIKE '%therapy%' """) for row in cursor.fetchall(): print(f" {row[0]}") print() print("wor_device_request therapy相关列:") cursor.execute(""" SELECT column_name FROM information_schema.columns WHERE table_schema = 'hisdev' AND table_name = 'wor_device_request' AND column_name LIKE '%therapy%' """) for row in cursor.fetchall(): print(f" {row[0]}") cursor.close() conn.close()