PDF-service/启动体检报告处理.bat
2026-04-16 13:27:01 +08:00

61 lines
1.7 KiB
Batchfile
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
chcp 65001
echo 正在启动体检报告处理程序...
REM 显示当前目录
echo 当前目录: %CD%
echo 正在检查文件...
REM 检测 Python优先 py 启动器,避免 WindowsApps 的 python 占位符抢先失败)
set "PYTHON_CMD="
py -3 --version >nul 2>&1 && set "PYTHON_CMD=py -3" && goto :py_found
py --version >nul 2>&1 && set "PYTHON_CMD=py" && goto :py_found
python --version >nul 2>&1 && set "PYTHON_CMD=python" && goto :py_found
python3 --version >nul 2>&1 && set "PYTHON_CMD=python3" && goto :py_found
echo Python未安装或未在 PATH 中!
echo 已尝试: py -3、py、python、python3
echo 若已安装请勾选安装程序中的「Add python.exe to PATH」或手动把 Python 目录加入系统环境变量 Path。
echo.
echo 按任意键退出...
pause >nul
exit /b 1
:py_found
echo 使用 Python 命令: %PYTHON_CMD%
REM 检查必要的Python包
echo 检查必要的Python包...
%PYTHON_CMD% -c "import requests" >nul 2>&1
if errorlevel 1 (
echo 正在安装必要的Python包...
%PYTHON_CMD% -m pip install requests
if errorlevel 1 (
echo 安装包失败!
echo 请手动执行: pip install requests
echo.
echo 按任意键退出...
pause > nul
exit /b 1
)
)
REM 检查JSON文件是否存在
dir headurl.json
if not exist "headurl.json" (
echo 错误:找不到 headurl.json 文件!
echo 请确保 headurl.json 文件在当前目录下。
echo 当前目录下的文件:
dir
echo.
echo 按任意键退出...
pause > nul
exit /b 1
)
echo 开始执行Python脚本...
%PYTHON_CMD% process_patients.py
echo.
echo 程序执行完毕,按任意键退出...
pause > nul