diff --git a/Log/OrbbecSDK.log.txt b/Log/OrbbecSDK.log.txt
index e13cab53..066f66de 100644
Binary files a/Log/OrbbecSDK.log.txt and b/Log/OrbbecSDK.log.txt differ
diff --git a/backend/database.py b/backend/database.py
index 14b07cab..828c822a 100644
--- a/backend/database.py
+++ b/backend/database.py
@@ -404,7 +404,7 @@ class DatabaseManager:
if keyword:
cursor.execute('''
- SELECT p.*, COALESCE(ds.session_count, 0) AS detection_count
+ SELECT p.*, COALESCE(ds.session_count, 0) AS num
FROM patients p
LEFT JOIN (
SELECT patient_id, COUNT(*) AS session_count
@@ -417,7 +417,7 @@ class DatabaseManager:
''', (f'%{keyword}%', f'%{keyword}%', f'%{keyword}%', size, offset))
else:
cursor.execute('''
- SELECT p.*, COALESCE(ds.session_count, 0) AS detection_count
+ SELECT p.*, COALESCE(ds.session_count, 0) AS num
FROM patients p
LEFT JOIN (
SELECT patient_id, COUNT(*) AS session_count
@@ -738,6 +738,40 @@ class DatabaseManager:
'''
cursor.execute(sql, update_values)
+ cursor.execute('SELECT patient_id, creator_id, start_time, end_time, status FROM detection_sessions WHERE id = ?', (session_id,))
+ srow = cursor.fetchone()
+ if srow:
+ patient_id = srow['patient_id']
+ creator_id = srow['creator_id']
+ session_status = srow['status']
+ start_time = srow['start_time']
+ end_time = srow['end_time']
+ doctor_name = ''
+ if creator_id:
+ cursor.execute('SELECT name FROM users WHERE id = ?', (creator_id,))
+ urow = cursor.fetchone()
+ if urow:
+ try:
+ doctor_name = dict(urow).get('name') or ''
+ except Exception:
+ doctor_name = urow[0] if urow and len(urow) > 0 else ''
+ check_time = end_time or start_time or self.get_china_time()
+ mh_obj = {}
+ try:
+ cursor.execute('SELECT medical_history FROM patients WHERE id = ?', (patient_id,))
+ prow = cursor.fetchone()
+ if prow and prow[0]:
+ try:
+ mh_obj = json.loads(prow[0]) if isinstance(prow[0], str) else {}
+ except Exception:
+ mh_obj = {}
+ except Exception:
+ mh_obj = {}
+ mh_obj['doctor'] = doctor_name
+ mh_obj['status'] = session_status or ''
+ mh_obj['lastcheck_time'] = str(check_time) if check_time is not None else self.get_china_time()
+ now_str = self.get_china_time()
+ cursor.execute('UPDATE patients SET medical_history = ?, updated_at = ? WHERE id = ?', (json.dumps(mh_obj, ensure_ascii=False), now_str, patient_id))
conn.commit()
updated_info = []
diff --git a/frontend/src/renderer/src/views/Dashboard.vue b/frontend/src/renderer/src/views/Dashboard.vue
index 4102c4c6..3c873bc5 100644
--- a/frontend/src/renderer/src/views/Dashboard.vue
+++ b/frontend/src/renderer/src/views/Dashboard.vue
@@ -28,16 +28,17 @@
-
-
-
+
+
+
- 未处理
- 已处理
+ 未处理
+ 检测已完成
+ 报告已生成
+ {{ scope.row.status }}
-
+
@@ -453,10 +454,28 @@ const loadPatients = async () => {
if (response.success) {
// 如果返回的是分页数据对象,提取patients数组
if (response.data && Array.isArray(response.data.patients)) {
- patients.value = response.data.patients
+ patients.value = (response.data.patients || []).map(p => {
+ let mh = {}
+ try {
+ mh = typeof p.medical_history === 'string' ? JSON.parse(p.medical_history) : (p.medical_history || {})
+ } catch {}
+ const doctor = mh && mh.doctor ? mh.doctor : ''
+ const status = mh && mh.status ? mh.status : ''
+ const lastcheck = mh && mh.lastcheck_time ? mh.lastcheck_time : ''
+ return { ...p, doctor, status, updated_at: lastcheck || p.updated_at }
+ })
patienttotal.value =response.data.total
} else if (Array.isArray(response.data)) {
- patients.value = response.data
+ patients.value = (response.data || []).map(p => {
+ let mh = {}
+ try {
+ mh = typeof p.medical_history === 'string' ? JSON.parse(p.medical_history) : (p.medical_history || {})
+ } catch {}
+ const doctor = mh && mh.doctor ? mh.doctor : ''
+ const status = mh && mh.status ? mh.status : ''
+ const lastcheck = mh && mh.lastcheck_time ? mh.lastcheck_time : ''
+ return { ...p, doctor, status, updated_at: lastcheck || p.updated_at }
+ })
patienttotal.value =response.total
} else {
patients.value = []
@@ -1124,7 +1143,7 @@ function editClick(){
.unprocessed-status{
margin: auto;
- width: 72px;
+ width: 100px;
height: 31px;
line-height: 31px;
background-color: rgba(228, 74, 74, 0.3);
@@ -1137,7 +1156,7 @@ function editClick(){
}
.processed-status{
margin: auto;
- width: 72px;
+ width: 100px;
height: 31px;
line-height: 31px;
background-color: rgba(59, 242, 198, 0.1);
diff --git a/frontend/src/renderer/src/views/Detection.vue b/frontend/src/renderer/src/views/Detection.vue
index 2f8da51d..65140587 100644
--- a/frontend/src/renderer/src/views/Detection.vue
+++ b/frontend/src/renderer/src/views/Detection.vue
@@ -1157,15 +1157,15 @@ function disconnectWebSocket() {
if (devicesSocket) {
if (devicesSocket.connected) {
// 取消订阅所有设备
- try {
- devicesSocket.emit('unsubscribe_device', { device_type: 'camera1' })
- devicesSocket.emit('unsubscribe_device', { device_type: 'camera2' })
- devicesSocket.emit('unsubscribe_device', { device_type: 'femtobolt' })
- devicesSocket.emit('unsubscribe_device', { device_type: 'imu' })
- devicesSocket.emit('unsubscribe_device', { device_type: 'pressure' })
- } catch (e) {
- console.warn('取消设备订阅时出错:', e)
- }
+ // try {
+ // devicesSocket.emit('unsubscribe_device', { device_type: 'camera1' })
+ // devicesSocket.emit('unsubscribe_device', { device_type: 'camera2' })
+ // devicesSocket.emit('unsubscribe_device', { device_type: 'femtobolt' })
+ // devicesSocket.emit('unsubscribe_device', { device_type: 'imu' })
+ // devicesSocket.emit('unsubscribe_device', { device_type: 'pressure' })
+ // } catch (e) {
+ // console.warn('取消设备订阅时出错:', e)
+ // }
// 移除所有事件监听器
devicesSocket.removeAllListeners()
@@ -1572,7 +1572,7 @@ async function handleDiagnosticInfo(status) {
async function saveDetectionData() {
console.log(tempInfo.value)
if (screenshotLoading.value) return
-
+ let titile_height = 24
try {
screenshotLoading.value = true
// 显示保存进度
@@ -1623,7 +1623,7 @@ async function saveDetectionData() {
session_id: patientInfo.value.sessionId,
patient_id: patientInfo.value.id,
- screen_location:screen_location,
+ screen_location:[Math.round(screen_location.x), Math.round(screen_location.y) + titile_height, Math.round(screen_location.width), Math.round(screen_location.height)],
head_pose:head_pose,
body_pose:null,
body_image: body_image,