This commit is contained in:
jingna 2025-08-06 17:14:53 +08:00
commit 1861025f2f
6 changed files with 350 additions and 14 deletions

View File

@ -194492,3 +194492,183 @@ transform: {rot: [0.994135, -0.00252459, 0.00230278, 0.00226079, 0.994134, 0.108
[08/06 09:16:02.117816][debug][2648][DeviceManager.cpp:64] DeviceManager Destructors done [08/06 09:16:02.117816][debug][2648][DeviceManager.cpp:64] DeviceManager Destructors done
[08/06 09:16:02.118401][debug][2648][MfPal.cpp:128] WmfPal destroyed! [08/06 09:16:02.118401][debug][2648][MfPal.cpp:128] WmfPal destroyed!
[08/06 09:16:02.118676][info][2648][Context.cpp:84] Context destroyed [08/06 09:16:02.118676][info][2648][Context.cpp:84] Context destroyed
[08/06 16:03:14.044503][debug][17676][Context.cpp:30] Context creating, work_dir=D:\Trae_space\BodyBalanceEvaluation
[08/06 16:03:14.044599][debug][17676][Context.cpp:49] Config file version=1.1
[08/06 16:03:14.044628][debug][17676][FrameBufferManager.cpp:23] Max global frame buffer size updated! size=2048.000MB
[08/06 16:03:14.044652][info][17676][Context.cpp:68] Context created with config: default config!
[08/06 16:03:14.044936][info][17676][Context.cpp:73] Work directory=D:\Trae_space\BodyBalanceEvaluation, SDK version=v1.10.11-20240724-aeaa107e5
[08/06 16:03:14.045171][debug][17676][DeviceManager.cpp:30] DeviceManager init ...
[08/06 16:03:14.045184][info][17676][MfPal.cpp:105] createObPal: create WinPal!
[08/06 16:03:14.045278][debug][17676][MfPal.cpp:110] WmfPal init ...
[08/06 16:03:14.074226][debug][17676][MfPal.cpp:117] WmfPal created!
[08/06 16:03:14.074266][debug][17676][DeviceManager.cpp:34] Enable USB Device Enumerator ...
[08/06 16:03:14.097196][debug][17676][EnumeratorLibusb.cpp:321] queryDevicesInfo done!
[08/06 16:03:14.097473][debug][17676][MfPal.cpp:216] Create WinEventDeviceWatcher!
[08/06 16:03:14.097687][debug][17676][UsbDeviceEnumerator.cpp:78] No matched usb device found!
[08/06 16:03:14.097720][info][17676][DeviceManager.cpp:15] Current found device(s): (0)
[08/06 16:03:14.097850][debug][17676][DeviceManager.cpp:52] DeviceManager construct done!
[08/06 16:03:14.097871][debug][17676][Context.cpp:81] Context destroying ...
[08/06 16:03:14.097881][debug][17676][DeviceManager.cpp:56] DeviceManager destroy ...
[08/06 16:03:14.097890][debug][17676][DeviceManager.cpp:64] DeviceManager Destructors done
[08/06 16:03:14.098772][debug][17676][MfPal.cpp:128] WmfPal destroyed!
[08/06 16:03:14.099070][info][17676][Context.cpp:84] Context destroyed
[08/06 16:06:30.815796][debug][29672][Context.cpp:30] Context creating, work_dir=D:\Trae_space\BodyBalanceEvaluation
[08/06 16:06:30.815899][debug][29672][Context.cpp:49] Config file version=1.1
[08/06 16:06:30.815926][debug][29672][FrameBufferManager.cpp:23] Max global frame buffer size updated! size=2048.000MB
[08/06 16:06:30.815947][info][29672][Context.cpp:68] Context created with config: default config!
[08/06 16:06:30.816126][info][29672][Context.cpp:73] Work directory=D:\Trae_space\BodyBalanceEvaluation, SDK version=v1.10.11-20240724-aeaa107e5
[08/06 16:06:30.816393][debug][29672][DeviceManager.cpp:30] DeviceManager init ...
[08/06 16:06:30.816414][info][29672][MfPal.cpp:105] createObPal: create WinPal!
[08/06 16:06:30.816552][debug][29672][MfPal.cpp:110] WmfPal init ...
[08/06 16:06:30.844118][debug][29672][MfPal.cpp:117] WmfPal created!
[08/06 16:06:30.844165][debug][29672][DeviceManager.cpp:34] Enable USB Device Enumerator ...
[08/06 16:06:30.867078][debug][29672][EnumeratorLibusb.cpp:321] queryDevicesInfo done!
[08/06 16:06:30.867402][debug][29672][MfPal.cpp:216] Create WinEventDeviceWatcher!
[08/06 16:06:30.867705][debug][29672][UsbDeviceEnumerator.cpp:78] No matched usb device found!
[08/06 16:06:30.867736][info][29672][DeviceManager.cpp:15] Current found device(s): (0)
[08/06 16:06:30.867967][debug][29672][DeviceManager.cpp:52] DeviceManager construct done!
[08/06 16:06:30.868046][debug][29672][Context.cpp:81] Context destroying ...
[08/06 16:06:30.868082][debug][29672][DeviceManager.cpp:56] DeviceManager destroy ...
[08/06 16:06:30.868091][debug][29672][DeviceManager.cpp:64] DeviceManager Destructors done
[08/06 16:06:30.868890][debug][29672][MfPal.cpp:128] WmfPal destroyed!
[08/06 16:06:30.869245][info][29672][Context.cpp:84] Context destroyed
[08/06 16:08:52.321145][debug][26380][Context.cpp:30] Context creating, work_dir=D:\Trae_space\BodyBalanceEvaluation
[08/06 16:08:52.321267][debug][26380][Context.cpp:49] Config file version=1.1
[08/06 16:08:52.321306][debug][26380][FrameBufferManager.cpp:23] Max global frame buffer size updated! size=2048.000MB
[08/06 16:08:52.321328][info][26380][Context.cpp:68] Context created with config: default config!
[08/06 16:08:52.321578][info][26380][Context.cpp:73] Work directory=D:\Trae_space\BodyBalanceEvaluation, SDK version=v1.10.11-20240724-aeaa107e5
[08/06 16:08:52.321776][debug][26380][DeviceManager.cpp:30] DeviceManager init ...
[08/06 16:08:52.321793][info][26380][MfPal.cpp:105] createObPal: create WinPal!
[08/06 16:08:52.321887][debug][26380][MfPal.cpp:110] WmfPal init ...
[08/06 16:08:52.361501][debug][26380][MfPal.cpp:117] WmfPal created!
[08/06 16:08:52.361555][debug][26380][DeviceManager.cpp:34] Enable USB Device Enumerator ...
[08/06 16:08:52.392828][debug][26380][EnumeratorLibusb.cpp:321] queryDevicesInfo done!
[08/06 16:08:52.393196][debug][26380][MfPal.cpp:216] Create WinEventDeviceWatcher!
[08/06 16:08:52.393539][debug][26380][UsbDeviceEnumerator.cpp:78] No matched usb device found!
[08/06 16:08:52.393582][info][26380][DeviceManager.cpp:15] Current found device(s): (0)
[08/06 16:08:52.393837][debug][26380][DeviceManager.cpp:52] DeviceManager construct done!
[08/06 16:08:52.393864][debug][26380][Context.cpp:81] Context destroying ...
[08/06 16:08:52.393877][debug][26380][DeviceManager.cpp:56] DeviceManager destroy ...
[08/06 16:08:52.393887][debug][26380][DeviceManager.cpp:64] DeviceManager Destructors done
[08/06 16:08:52.398033][debug][26380][MfPal.cpp:128] WmfPal destroyed!
[08/06 16:08:52.398403][info][26380][Context.cpp:84] Context destroyed
[08/06 16:10:21.638974][debug][29392][Context.cpp:30] Context creating, work_dir=D:\Trae_space\BodyBalanceEvaluation
[08/06 16:10:21.639110][debug][29392][Context.cpp:49] Config file version=1.1
[08/06 16:10:21.639149][debug][29392][FrameBufferManager.cpp:23] Max global frame buffer size updated! size=2048.000MB
[08/06 16:10:21.639172][info][29392][Context.cpp:68] Context created with config: default config!
[08/06 16:10:21.639421][info][29392][Context.cpp:73] Work directory=D:\Trae_space\BodyBalanceEvaluation, SDK version=v1.10.11-20240724-aeaa107e5
[08/06 16:10:21.639616][debug][29392][DeviceManager.cpp:30] DeviceManager init ...
[08/06 16:10:21.639637][info][29392][MfPal.cpp:105] createObPal: create WinPal!
[08/06 16:10:21.639888][debug][29392][MfPal.cpp:110] WmfPal init ...
[08/06 16:10:21.684336][debug][29392][MfPal.cpp:117] WmfPal created!
[08/06 16:10:21.684398][debug][29392][DeviceManager.cpp:34] Enable USB Device Enumerator ...
[08/06 16:10:21.721401][debug][29392][EnumeratorLibusb.cpp:321] queryDevicesInfo done!
[08/06 16:10:21.721922][debug][29392][MfPal.cpp:216] Create WinEventDeviceWatcher!
[08/06 16:10:21.722414][debug][29392][UsbDeviceEnumerator.cpp:78] No matched usb device found!
[08/06 16:10:21.722485][info][29392][DeviceManager.cpp:15] Current found device(s): (0)
[08/06 16:10:21.722732][debug][29392][DeviceManager.cpp:52] DeviceManager construct done!
[08/06 16:10:21.722788][debug][29392][Context.cpp:81] Context destroying ...
[08/06 16:10:21.722811][debug][29392][DeviceManager.cpp:56] DeviceManager destroy ...
[08/06 16:10:21.722831][debug][29392][DeviceManager.cpp:64] DeviceManager Destructors done
[08/06 16:10:21.726464][debug][29392][MfPal.cpp:128] WmfPal destroyed!
[08/06 16:10:21.726866][info][29392][Context.cpp:84] Context destroyed
[08/06 16:10:57.645092][debug][20760][Context.cpp:30] Context creating, work_dir=D:\Trae_space\BodyBalanceEvaluation
[08/06 16:10:57.645324][debug][20760][Context.cpp:49] Config file version=1.1
[08/06 16:10:57.645407][debug][20760][FrameBufferManager.cpp:23] Max global frame buffer size updated! size=2048.000MB
[08/06 16:10:57.645444][info][20760][Context.cpp:68] Context created with config: default config!
[08/06 16:10:57.645773][info][20760][Context.cpp:73] Work directory=D:\Trae_space\BodyBalanceEvaluation, SDK version=v1.10.11-20240724-aeaa107e5
[08/06 16:10:57.646061][debug][20760][DeviceManager.cpp:30] DeviceManager init ...
[08/06 16:10:57.646083][info][20760][MfPal.cpp:105] createObPal: create WinPal!
[08/06 16:10:57.646291][debug][20760][MfPal.cpp:110] WmfPal init ...
[08/06 16:10:57.693789][debug][20760][MfPal.cpp:117] WmfPal created!
[08/06 16:10:57.693860][debug][20760][DeviceManager.cpp:34] Enable USB Device Enumerator ...
[08/06 16:10:57.734267][debug][20760][EnumeratorLibusb.cpp:321] queryDevicesInfo done!
[08/06 16:10:57.734690][debug][20760][MfPal.cpp:216] Create WinEventDeviceWatcher!
[08/06 16:10:57.734988][debug][20760][UsbDeviceEnumerator.cpp:78] No matched usb device found!
[08/06 16:10:57.735041][info][20760][DeviceManager.cpp:15] Current found device(s): (0)
[08/06 16:10:57.735528][debug][20760][DeviceManager.cpp:52] DeviceManager construct done!
[08/06 16:10:57.735616][debug][20760][Context.cpp:81] Context destroying ...
[08/06 16:10:57.735659][debug][20760][DeviceManager.cpp:56] DeviceManager destroy ...
[08/06 16:10:57.735689][debug][20760][DeviceManager.cpp:64] DeviceManager Destructors done
[08/06 16:10:57.741115][debug][20760][MfPal.cpp:128] WmfPal destroyed!
[08/06 16:10:57.741988][info][20760][Context.cpp:84] Context destroyed
[08/06 16:12:16.098220][debug][28004][Context.cpp:30] Context creating, work_dir=D:\Trae_space\BodyBalanceEvaluation
[08/06 16:12:16.098394][debug][28004][Context.cpp:49] Config file version=1.1
[08/06 16:12:16.098436][debug][28004][FrameBufferManager.cpp:23] Max global frame buffer size updated! size=2048.000MB
[08/06 16:12:16.098468][info][28004][Context.cpp:68] Context created with config: default config!
[08/06 16:12:16.098742][info][28004][Context.cpp:73] Work directory=D:\Trae_space\BodyBalanceEvaluation, SDK version=v1.10.11-20240724-aeaa107e5
[08/06 16:12:16.098886][debug][28004][DeviceManager.cpp:30] DeviceManager init ...
[08/06 16:12:16.098901][info][28004][MfPal.cpp:105] createObPal: create WinPal!
[08/06 16:12:16.099085][debug][28004][MfPal.cpp:110] WmfPal init ...
[08/06 16:12:16.134815][debug][28004][MfPal.cpp:117] WmfPal created!
[08/06 16:12:16.134858][debug][28004][DeviceManager.cpp:34] Enable USB Device Enumerator ...
[08/06 16:12:16.172781][debug][28004][EnumeratorLibusb.cpp:321] queryDevicesInfo done!
[08/06 16:12:16.173306][debug][28004][MfPal.cpp:216] Create WinEventDeviceWatcher!
[08/06 16:12:16.173613][debug][28004][UsbDeviceEnumerator.cpp:78] No matched usb device found!
[08/06 16:12:16.173659][info][28004][DeviceManager.cpp:15] Current found device(s): (0)
[08/06 16:12:16.173897][debug][28004][DeviceManager.cpp:52] DeviceManager construct done!
[08/06 16:12:16.173941][debug][28004][Context.cpp:81] Context destroying ...
[08/06 16:12:16.173956][debug][28004][DeviceManager.cpp:56] DeviceManager destroy ...
[08/06 16:12:16.173968][debug][28004][DeviceManager.cpp:64] DeviceManager Destructors done
[08/06 16:12:16.175519][debug][28004][MfPal.cpp:128] WmfPal destroyed!
[08/06 16:12:16.176049][info][28004][Context.cpp:84] Context destroyed
[08/06 16:13:23.391846][debug][13332][Context.cpp:30] Context creating, work_dir=D:\Trae_space\BodyBalanceEvaluation
[08/06 16:13:23.391992][debug][13332][Context.cpp:49] Config file version=1.1
[08/06 16:13:23.392025][debug][13332][FrameBufferManager.cpp:23] Max global frame buffer size updated! size=2048.000MB
[08/06 16:13:23.392050][info][13332][Context.cpp:68] Context created with config: default config!
[08/06 16:13:23.392226][info][13332][Context.cpp:73] Work directory=D:\Trae_space\BodyBalanceEvaluation, SDK version=v1.10.11-20240724-aeaa107e5
[08/06 16:13:23.392496][debug][13332][DeviceManager.cpp:30] DeviceManager init ...
[08/06 16:13:23.392526][info][13332][MfPal.cpp:105] createObPal: create WinPal!
[08/06 16:13:23.392681][debug][13332][MfPal.cpp:110] WmfPal init ...
[08/06 16:13:23.435989][debug][13332][MfPal.cpp:117] WmfPal created!
[08/06 16:13:23.436054][debug][13332][DeviceManager.cpp:34] Enable USB Device Enumerator ...
[08/06 16:13:23.466488][debug][13332][EnumeratorLibusb.cpp:321] queryDevicesInfo done!
[08/06 16:13:23.466890][debug][13332][MfPal.cpp:216] Create WinEventDeviceWatcher!
[08/06 16:13:23.467292][debug][13332][UsbDeviceEnumerator.cpp:78] No matched usb device found!
[08/06 16:13:23.467338][info][13332][DeviceManager.cpp:15] Current found device(s): (0)
[08/06 16:13:23.467777][debug][13332][DeviceManager.cpp:52] DeviceManager construct done!
[08/06 16:13:23.467808][debug][13332][Context.cpp:81] Context destroying ...
[08/06 16:13:23.467821][debug][13332][DeviceManager.cpp:56] DeviceManager destroy ...
[08/06 16:13:23.467831][debug][13332][DeviceManager.cpp:64] DeviceManager Destructors done
[08/06 16:13:23.474014][debug][13332][MfPal.cpp:128] WmfPal destroyed!
[08/06 16:13:23.474445][info][13332][Context.cpp:84] Context destroyed
[08/06 16:15:59.453762][debug][13332][Context.cpp:30] Context creating, work_dir=D:\Trae_space\BodyBalanceEvaluation
[08/06 16:15:59.453814][debug][13332][Context.cpp:49] Config file version=1.1
[08/06 16:15:59.453833][debug][13332][FrameBufferManager.cpp:23] Max global frame buffer size updated! size=2048.000MB
[08/06 16:15:59.453848][info][13332][Context.cpp:68] Context created with config: default config!
[08/06 16:15:59.453949][info][13332][Context.cpp:73] Work directory=D:\Trae_space\BodyBalanceEvaluation, SDK version=v1.10.11-20240724-aeaa107e5
[08/06 16:15:59.454063][debug][13332][DeviceManager.cpp:30] DeviceManager init ...
[08/06 16:15:59.454074][info][13332][MfPal.cpp:105] createObPal: create WinPal!
[08/06 16:15:59.454171][debug][13332][MfPal.cpp:110] WmfPal init ...
[08/06 16:15:59.478375][debug][13332][MfPal.cpp:117] WmfPal created!
[08/06 16:15:59.478410][debug][13332][DeviceManager.cpp:34] Enable USB Device Enumerator ...
[08/06 16:15:59.503981][debug][13332][EnumeratorLibusb.cpp:321] queryDevicesInfo done!
[08/06 16:15:59.504283][debug][13332][MfPal.cpp:216] Create WinEventDeviceWatcher!
[08/06 16:15:59.504495][debug][13332][UsbDeviceEnumerator.cpp:78] No matched usb device found!
[08/06 16:15:59.504521][info][13332][DeviceManager.cpp:15] Current found device(s): (0)
[08/06 16:15:59.504714][debug][13332][DeviceManager.cpp:52] DeviceManager construct done!
[08/06 16:15:59.504732][debug][13332][Context.cpp:81] Context destroying ...
[08/06 16:15:59.504742][debug][13332][DeviceManager.cpp:56] DeviceManager destroy ...
[08/06 16:15:59.504751][debug][13332][DeviceManager.cpp:64] DeviceManager Destructors done
[08/06 16:15:59.505619][debug][13332][MfPal.cpp:128] WmfPal destroyed!
[08/06 16:15:59.506002][info][13332][Context.cpp:84] Context destroyed
[08/06 16:16:20.739938][debug][18856][Context.cpp:30] Context creating, work_dir=D:\Trae_space\BodyBalanceEvaluation
[08/06 16:16:20.740031][debug][18856][Context.cpp:49] Config file version=1.1
[08/06 16:16:20.740058][debug][18856][FrameBufferManager.cpp:23] Max global frame buffer size updated! size=2048.000MB
[08/06 16:16:20.740075][info][18856][Context.cpp:68] Context created with config: default config!
[08/06 16:16:20.740333][info][18856][Context.cpp:73] Work directory=D:\Trae_space\BodyBalanceEvaluation, SDK version=v1.10.11-20240724-aeaa107e5
[08/06 16:16:20.740472][debug][18856][DeviceManager.cpp:30] DeviceManager init ...
[08/06 16:16:20.740485][info][18856][MfPal.cpp:105] createObPal: create WinPal!
[08/06 16:16:20.740642][debug][18856][MfPal.cpp:110] WmfPal init ...
[08/06 16:16:20.768187][debug][18856][MfPal.cpp:117] WmfPal created!
[08/06 16:16:20.768248][debug][18856][DeviceManager.cpp:34] Enable USB Device Enumerator ...
[08/06 16:16:20.791752][debug][18856][EnumeratorLibusb.cpp:321] queryDevicesInfo done!
[08/06 16:16:20.792149][debug][18856][MfPal.cpp:216] Create WinEventDeviceWatcher!
[08/06 16:16:20.792375][debug][18856][UsbDeviceEnumerator.cpp:78] No matched usb device found!
[08/06 16:16:20.792412][info][18856][DeviceManager.cpp:15] Current found device(s): (0)
[08/06 16:16:20.792631][debug][18856][DeviceManager.cpp:52] DeviceManager construct done!
[08/06 16:16:20.792653][debug][18856][Context.cpp:81] Context destroying ...
[08/06 16:16:20.792664][debug][18856][DeviceManager.cpp:56] DeviceManager destroy ...
[08/06 16:16:20.792673][debug][18856][DeviceManager.cpp:64] DeviceManager Destructors done
[08/06 16:16:20.794234][debug][18856][MfPal.cpp:128] WmfPal destroyed!
[08/06 16:16:20.794542][info][18856][Context.cpp:84] Context destroyed

View File

@ -0,0 +1,20 @@
[08/06 16:05:29.947597][debug][29212][Context.cpp:30] Context creating, work_dir=D:\Trae_space\BodyBalanceEvaluation\backend
[08/06 16:05:29.947770][debug][29212][Context.cpp:49] Config file version=1.1
[08/06 16:05:29.947818][debug][29212][FrameBufferManager.cpp:23] Max global frame buffer size updated! size=2048.000MB
[08/06 16:05:29.947857][info][29212][Context.cpp:68] Context created with config: default config!
[08/06 16:05:29.948048][info][29212][Context.cpp:73] Work directory=D:\Trae_space\BodyBalanceEvaluation\backend, SDK version=v1.10.11-20240724-aeaa107e5
[08/06 16:05:29.948256][debug][29212][DeviceManager.cpp:30] DeviceManager init ...
[08/06 16:05:29.948529][info][29212][MfPal.cpp:105] createObPal: create WinPal!
[08/06 16:05:29.948659][debug][29212][MfPal.cpp:110] WmfPal init ...
[08/06 16:05:29.984405][debug][29212][MfPal.cpp:117] WmfPal created!
[08/06 16:05:29.984501][debug][29212][DeviceManager.cpp:34] Enable USB Device Enumerator ...
[08/06 16:05:30.020645][debug][29212][EnumeratorLibusb.cpp:321] queryDevicesInfo done!
[08/06 16:05:30.021037][debug][29212][MfPal.cpp:216] Create WinEventDeviceWatcher!
[08/06 16:05:30.021274][debug][29212][UsbDeviceEnumerator.cpp:78] No matched usb device found!
[08/06 16:05:30.021308][info][29212][DeviceManager.cpp:15] Current found device(s): (0)
[08/06 16:05:30.021507][debug][29212][DeviceManager.cpp:52] DeviceManager construct done!
[08/06 16:05:30.021539][debug][29212][Context.cpp:81] Context destroying ...
[08/06 16:05:30.021552][debug][29212][DeviceManager.cpp:56] DeviceManager destroy ...
[08/06 16:05:30.021562][debug][29212][DeviceManager.cpp:64] DeviceManager Destructors done
[08/06 16:05:30.030937][debug][29212][MfPal.cpp:128] WmfPal destroyed!
[08/06 16:05:30.031392][info][29212][Context.cpp:84] Context destroyed

View File

@ -119,7 +119,8 @@ def init_app():
except Exception as e: except Exception as e:
logger.error(f'应用初始化失败: {e}') logger.error(f'应用初始化失败: {e}')
raise logger.warning('部分功能可能不可用,但服务将继续运行')
# 不再抛出异常,让应用继续运行
# ==================== 基础API ==================== # ==================== 基础API ====================
@ -804,6 +805,68 @@ def get_detection_status(session_id):
logger.error(f'获取检测状态失败: {e}') logger.error(f'获取检测状态失败: {e}')
return jsonify({'success': False, 'error': str(e)}), 500 return jsonify({'success': False, 'error': str(e)}), 500
@app.route('/api/detection/<session_id>/save-info', methods=['POST'])
def save_session_info(session_id):
"""保存会话信息(诊断、处理、建议、状态)"""
try:
if not db_manager:
return jsonify({'success': False, 'error': '数据库管理器未初始化'}), 500
if not session_id:
return jsonify({
'success': False,
'error': '缺少会话ID'
}), 400
# 获取请求数据
data = flask_request.get_json() or {}
diagnosis_info = data.get('diagnosis_info')
treatment_info = data.get('treatment_info')
suggestion_info = data.get('suggestion_info')
status = data.get('status')
# 验证至少提供一个要更新的字段
if not any([diagnosis_info, treatment_info, suggestion_info, status]):
return jsonify({
'success': False,
'error': '至少需要提供一个要更新的字段diagnosis_info, treatment_info, suggestion_info, status'
}), 400
# 调用数据库管理器的批量更新方法
db_manager.update_session_all_info(
session_id=session_id,
diagnosis_info=diagnosis_info,
treatment_info=treatment_info,
suggestion_info=suggestion_info,
status=status
)
# 构建更新信息反馈
updated_fields = []
if diagnosis_info is not None:
updated_fields.append('诊断信息')
if treatment_info is not None:
updated_fields.append('处理信息')
if suggestion_info is not None:
updated_fields.append('建议信息')
if status is not None:
updated_fields.append(f'状态({status})')
logger.info(f'会话信息保存成功: {session_id}, 更新字段: {", ".join(updated_fields)}')
return jsonify({
'success': True,
'message': f'会话信息保存成功,更新字段: {", ".join(updated_fields)}',
'data': {
'session_id': session_id,
'updated_fields': updated_fields
}
})
except Exception as e:
logger.error(f'保存会话信息失败: {e}')
return jsonify({'success': False, 'error': str(e)}), 500
@app.route('/api/detection/<session_id>/collect', methods=['POST']) @app.route('/api/detection/<session_id>/collect', methods=['POST'])
def collect_detection_data(session_id): def collect_detection_data(session_id):
"""采集检测数据""" """采集检测数据"""

View File

@ -276,7 +276,7 @@ class DatabaseManager:
diagnosis_info TEXT, -- 诊断信息 diagnosis_info TEXT, -- 诊断信息
treatment_info TEXT, -- 处理信息 treatment_info TEXT, -- 处理信息
suggestion_info TEXT, -- 建议信息 suggestion_info TEXT, -- 建议信息
status TEXT DEFAULT 'created', -- 会话状态created/running/completed/failed status TEXT DEFAULT 'created', -- 会话状态created/running/diagnosed/completed)
created_at TIMESTAMP, -- 记录创建时间 created_at TIMESTAMP, -- 记录创建时间
FOREIGN KEY (patient_id) REFERENCES patients (id), -- 患者表外键约束 FOREIGN KEY (patient_id) REFERENCES patients (id), -- 患者表外键约束
FOREIGN KEY (creator_id) REFERENCES users (id) -- 用户表外键约束 FOREIGN KEY (creator_id) REFERENCES users (id) -- 用户表外键约束
@ -820,6 +820,69 @@ class DatabaseManager:
logger.error(f'更新会话建议信息失败: {e}') logger.error(f'更新会话建议信息失败: {e}')
raise raise
def update_session_all_info(self, session_id: str, diagnosis_info: str = None, treatment_info: str = None, suggestion_info: str = None, status: str = None):
"""同时更新会话的诊断信息、处理信息、建议信息和状态"""
conn = self.get_connection()
cursor = conn.cursor()
try:
# 构建动态SQL语句只更新非None的字段
update_fields = []
update_values = []
if diagnosis_info is not None:
update_fields.append('diagnosis_info = ?')
update_values.append(diagnosis_info)
if treatment_info is not None:
update_fields.append('treatment_info = ?')
update_values.append(treatment_info)
if suggestion_info is not None:
update_fields.append('suggestion_info = ?')
update_values.append(suggestion_info)
if status is not None:
update_fields.append('status = ?')
update_values.append(status)
# 如果状态是完成、停止或错误,同时更新结束时间
if status in ['completed', 'stopped', 'error']:
update_fields.append('end_time = ?')
update_values.append(self.get_china_time())
if not update_fields:
logger.warning(f'没有提供要更新的信息: {session_id}')
return
# 添加session_id到参数列表
update_values.append(session_id)
sql = f'''
UPDATE detection_sessions SET {', '.join(update_fields)}
WHERE id = ?
'''
cursor.execute(sql, update_values)
conn.commit()
updated_info = []
if diagnosis_info is not None:
updated_info.append('诊断信息')
if treatment_info is not None:
updated_info.append('处理信息')
if suggestion_info is not None:
updated_info.append('建议信息')
if status is not None:
updated_info.append(f'状态({status})')
logger.info(f'批量更新会话信息成功: {session_id}, 更新字段: {", ".join(updated_info)}')
except Exception as e:
conn.rollback()
logger.error(f'批量更新会话信息失败: {e}')
raise
def get_detection_sessions(self, page: int = 1, size: int = 10, patient_id: str = None) -> List[Dict]: def get_detection_sessions(self, page: int = 1, size: int = 10, patient_id: str = None) -> List[Dict]:

View File

@ -66,8 +66,12 @@ class DeviceManager:
# 推流状态和线程 # 推流状态和线程
self.camera_streaming = False self.camera_streaming = False
self.femtobolt_streaming = False self.femtobolt_streaming = False
self.imu_streaming = False
self.pressure_streaming = False
self.camera_streaming_thread = None self.camera_streaming_thread = None
self.femtobolt_streaming_thread = None self.femtobolt_streaming_thread = None
self.imu_thread = None
self.pressure_thread = None
self.streaming_stop_event = threading.Event() self.streaming_stop_event = threading.Event()
# 全局帧缓存机制 # 全局帧缓存机制
@ -244,17 +248,22 @@ class DeviceManager:
self.femtobolt_config.synchronized_images_only = True self.femtobolt_config.synchronized_images_only = True
# 视效范围参数示例假设SDK支持depth_range_min和depth_range_max # 视效范围参数示例假设SDK支持depth_range_min和depth_range_max
# 直接尝试启动设备pykinect_azure库没有设备数量检测API # 启动FemtoBolt设备直接尝试启动失败时优雅处理
logger.info('准备启动FemtoBolt设备...')
# 启动FemtoBolt设备
logger.info('尝试启动FemtoBolt设备...') logger.info('尝试启动FemtoBolt设备...')
self.femtobolt_camera = pykinect.start_device(config=self.femtobolt_config) try:
if self.femtobolt_camera: self.femtobolt_camera = pykinect.start_device(config=self.femtobolt_config)
self.device_status['femtobolt'] = True if self.femtobolt_camera:
logger.info('✓ FemtoBolt深度相机初始化成功!') self.device_status['femtobolt'] = True
else: logger.info('✓ FemtoBolt深度相机初始化成功!')
raise Exception('设备启动返回None') else:
logger.warning('FemtoBolt设备启动失败设备返回None可能未连接设备')
self.femtobolt_camera = None
self.device_status['femtobolt'] = False
except BaseException as device_error:
logger.warning(f'FemtoBolt设备启动失败: {device_error}')
logger.info('这通常表示没有连接FemtoBolt设备系统将继续运行但不包含深度相机功能')
self.femtobolt_camera = None
self.device_status['femtobolt'] = False
except Exception as e: except Exception as e:
logger.warning(f'FemtoBolt深度相机初始化失败: {e}') logger.warning(f'FemtoBolt深度相机初始化失败: {e}')

View File

@ -16,7 +16,8 @@ api.interceptors.request.use(
if (window.electronAPI) { if (window.electronAPI) {
config.baseURL = window.electronAPI.getBackendUrl() config.baseURL = window.electronAPI.getBackendUrl()
} else { } else {
config.baseURL = 'http://192.168.1.173:5000' config.baseURL = 'http://192.168.1.58:5000'
} }
// 添加时间戳防止缓存 // 添加时间戳防止缓存
@ -599,7 +600,7 @@ export const getBackendUrl = () => {
if (window.electronAPI) { if (window.electronAPI) {
return window.electronAPI.getBackendUrl() return window.electronAPI.getBackendUrl()
} else { } else {
return 'http://192.168.1.173:5000' return 'http://192.168.1.58:5000'
} }
} }