Merge develop into test - sync latest code
This commit is contained in:
83
scripts/check_surgery_detail.py
Normal file
83
scripts/check_surgery_detail.py
Normal file
@@ -0,0 +1,83 @@
|
||||
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("=" * 80)
|
||||
print("检查手术医嘱的详细信息")
|
||||
print("=" * 80)
|
||||
print()
|
||||
|
||||
# 查询手术医嘱的详细信息
|
||||
cursor.execute("""
|
||||
SELECT
|
||||
id,
|
||||
prescription_no,
|
||||
category_enum,
|
||||
status_enum,
|
||||
patient_id,
|
||||
encounter_id,
|
||||
activity_id,
|
||||
generate_source_enum,
|
||||
content_json,
|
||||
create_time
|
||||
FROM wor_service_request
|
||||
WHERE prescription_no = 'OP202603311433'
|
||||
AND delete_flag = '0'
|
||||
""")
|
||||
|
||||
row = cursor.fetchone()
|
||||
if row:
|
||||
print("手术医嘱详细信息:")
|
||||
print(f" ID: {row[0]}")
|
||||
print(f" 单号: {row[1]}")
|
||||
print(f" category_enum: {row[2]} (4=手术)")
|
||||
print(f" status_enum: {row[3]} (1=待签发)")
|
||||
print(f" patient_id: {row[4]}")
|
||||
print(f" encounter_id: {row[5]}")
|
||||
print(f" activity_id: {row[6]}")
|
||||
print(f" generate_source_enum: {row[7]} (1=医生处方)")
|
||||
print(f" content_json: {row[8]}")
|
||||
print(f" create_time: {row[9]}")
|
||||
else:
|
||||
print("未找到手术医嘱")
|
||||
|
||||
print()
|
||||
print("=" * 80)
|
||||
|
||||
# 查询该就诊的所有医嘱
|
||||
cursor.execute("""
|
||||
SELECT
|
||||
id,
|
||||
prescription_no,
|
||||
category_enum,
|
||||
status_enum,
|
||||
activity_id
|
||||
FROM wor_service_request
|
||||
WHERE encounter_id = 2038823905749327873
|
||||
AND delete_flag = '0'
|
||||
ORDER BY category_enum, create_time DESC
|
||||
""")
|
||||
|
||||
rows = cursor.fetchall()
|
||||
print(f"就诊ID 2038823905749327873 的所有医嘱(共{len(rows)}条):")
|
||||
for row in rows:
|
||||
cat_names = {1: "西药", 2: "耗材", 3: "诊疗", 4: "手术"}
|
||||
cat_name = cat_names.get(row[2], f"类型{row[2]}")
|
||||
print(
|
||||
f" ID: {row[0]}, 单号: {row[1]}, 类型: {cat_name}({row[2]}), 状态: {row[3]}, activity_id: {row[4]}"
|
||||
)
|
||||
|
||||
cursor.close()
|
||||
conn.close()
|
||||
Reference in New Issue
Block a user