add backend source code

This commit is contained in:
2026-02-28 15:06:52 +08:00
parent 1bc330e20c
commit 2c37aa9064
67 changed files with 11654 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
"""创建数据库脚本"""
import asyncio
import asyncpg
async def main():
conn = await asyncpg.connect(
'postgresql://postgresql:Jchl1528@192.168.110.252:15432/postgres'
)
try:
# 检查数据库是否存在
exists = await conn.fetchval(
"SELECT 1 FROM pg_database WHERE datname = 'hospital_performance'"
)
if exists:
print('数据库 hospital_performance 已存在')
else:
# 创建数据库
await conn.execute('CREATE DATABASE hospital_performance')
print('数据库 hospital_performance 创建成功')
finally:
conn.terminate()
if __name__ == '__main__':
asyncio.run(main())