import json
import oracledb
# Construct the Editor.js JSON structure using our new structured 'grid' blocks
json_data = {
"time": 1700000000000,
"blocks": [
{
"type": "stickyNav",
"data": {
"title": "Tầm nhìn - Sứ mệnh",
"bgColor": "#ffffff",
"items": [
{"label": "Giới thiệu tổng quan", "link": "/page/gioi-thieu-tong-quan"},
{"label": "Lịch sử hình thành", "link": "/page/lich-su-hinh-thanh"},
{"label": "Tầm nhìn - Sứ mệnh - Giá trị cốt lõi", "link": "/page/tam-nhin-su-menh-gia-tri-cot-loi"},
{"label": "Ban lãnh đạo", "link": "/page/doi-ngu-lanh-dao"},
{"label": "Các đơn vị", "link": "/page/cac-don-vi"},
{"label": "Thành tựu và giải thưởng", "link": "/page/thanh-tuu-va-giai-thuong"}
]
}
},
{
"type": "grid",
"data": {
"cols": 2,
"type1": "html",
"col1": """
TẦM NHÌN
Trở thành bệnh viện đại học dẫn đầu Việt Nam đạt chuẩn quốc tế
""",
"width1": 6,
"class1": "relative z-10",
"type2": "image",
"col2": {
"file": {
"url": "/images/umass/mission.jpeg"
},
"caption": "",
"withBorder": False,
"withBackground": False,
"stretched": False
},
"width2": 6,
"class2": "shadow-lg rounded"
}
},
{
"type": "grid",
"data": {
"cols": 2,
"type1": "image",
"col1": {
"file": {
"url": "/images/umass/vision.jpeg"
},
"caption": "",
"withBorder": False,
"withBackground": False,
"stretched": False
},
"width1": 6,
"class1": "shadow-lg rounded",
"type2": "html",
"col2": """
SỨ MỆNH
Mang đến giải pháp chăm sóc sức khỏe tối ưu từ sự tích hợp giữa điều trị, nghiên cứu và đào tạo
""",
"width2": 6
}
},
{
"type": "grid",
"data": {
"cols": 4,
"type1": "flex",
"col1": {
"cols": 2,
"direction": "column",
"justify": "center",
"align": "center",
"gap": "2",
"type1": "image",
"col1": {
"file": {
"url": "/images/career/core-hover-1.webp"
},
"caption": "",
"withBorder": False,
"withBackground": False,
"stretched": False
},
"type2": "html",
"col2": """
Tiên phong
Phát triển và ứng dụng kỹ thuật tiên tiến vào điều trị, giảng dạy, nghiên cứu
"""
},
"width1": 3,
"class1": "rounded-lg shadow bg-primary-600 text-white p-4 h-full",
"type2": "flex",
"col2": {
"cols": 2,
"direction": "column",
"justify": "center",
"align": "center",
"gap": "2",
"type1": "image",
"col1": {
"file": {
"url": "/images/career/core-2.webp"
},
"caption": "",
"withBorder": False,
"withBackground": False,
"stretched": False
},
"type2": "html",
"col2": """
Thấu hiểu
Nỗi đau thể xác và tinh thần của người bệnh để đưa ra giải pháp điều trị tối ưu
"""
},
"width2": 3,
"class2": "rounded-lg shadow bg-white text-primary-600 p-4 h-full border border-primary-100",
"type3": "flex",
"col3": {
"cols": 2,
"direction": "column",
"justify": "center",
"align": "center",
"gap": "2",
"type1": "image",
"col1": {
"file": {
"url": "/images/career/core-3.webp"
},
"caption": "",
"withBorder": False,
"withBackground": False,
"stretched": False
},
"type2": "html",
"col2": """
Chuẩn mực
Về y đức và học thuật của người thầy giáo – thầy thuốc
"""
},
"width3": 3,
"class3": "rounded-lg shadow bg-white text-primary-600 p-4 h-full border border-primary-100",
"type4": "flex",
"col4": {
"cols": 2,
"direction": "column",
"justify": "center",
"align": "center",
"gap": "2",
"type1": "image",
"col1": {
"file": {
"url": "/images/career/core-4.webp"
},
"caption": "",
"withBorder": False,
"withBackground": False,
"stretched": False
},
"type2": "html",
"col2": """
An toàn
Cho người bệnh, nhân viên y tế và cộng đồng
"""
},
"width4": 3,
"class4": "rounded-lg shadow bg-white text-primary-600 p-4 h-full border border-primary-100"
}
}
],
"version": "2.30.8"
}
json_string = json.dumps(json_data, ensure_ascii=False, indent=2)
with open("tam_nhin_su_menh_import.json", "w", encoding="utf-8") as f:
f.write(json_string)
print("Generated structured tam_nhin_su_menh_import.json successfully using Grid block configurations!")
# Automatically update Oracle Database
try:
conn = oracledb.connect(user='sisvietnam', password='sisvietnam', dsn='localhost:1521/sisvietnam')
cursor = conn.cursor()
cursor.execute("UPDATE sis_page SET content = :content WHERE slug = 'tam-nhin-su-menh-gia-tri-cot-loi'", content=json_string)
conn.commit()
print("Updated database table 'sis_page' for slug 'tam-nhin-su-menh-gia-tri-cot-loi' with structured Grid block layouts!")
conn.close()
except Exception as e:
print("DB Update failed:", e)