诊断信息:
-
未处理
-
-

-
+
未处理
+
已处理
+
-
+
-
-
-
@@ -324,9 +328,10 @@
import { ref, reactive, computed, onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus'
-import { patientAPI, detectionAPI } from '../services/api.js'
+import { patientAPI, detectionAPI,historyAPI } from '../services/api.js'
import Header from '@/views/Header.vue'
-
+import { getBackendUrl } from '../services/api.js'
+const BACKEND_URL = getBackendUrl()
const router = useRouter()
const route = useRoute()
@@ -359,6 +364,57 @@ const diagnosticForm = ref({
treatment_info: '',
suggestion_info: ''
})
+
+
+const calculateExactDaysDifference = (date2) => {
+ // 解析日期字符串
+ const parseDate = (dateStr) => {
+ if (!dateStr) return new Date();
+ const parts = dateStr.split(' ');
+ const datePart = parts[0].split('-');
+ const timePart = parts[1].split(':');
+
+ return new Date(
+ parseInt(datePart[0]), // 年
+ parseInt(datePart[1]) - 1, // 月 (0-indexed)
+ parseInt(datePart[2]), // 日
+ parseInt(timePart[0]), // 小时
+ parseInt(timePart[1]), // 分钟
+ parseInt(timePart[2]) // 秒
+ );
+ };
+
+ const d1 = new Date();
+ const d2 = parseDate(date2);
+
+ // 计算时间差(毫秒)
+ const timeDiff = Math.abs(d1.getTime() - d2.getTime());
+
+ // 转换为天数
+ const daysDiff = Math.floor(timeDiff / (1000 * 3600 * 24));
+ return daysDiff + "天";
+}
+
+const sessionsInit = async () => {
+ try {
+ let params ={
+ patient_id: route.params.id
+ }
+ // 导出报告逻辑
+ const response = await historyAPI.sessionsPage(params)
+ if (response.success) {
+ response.data.sessions.forEach(element => {
+ element.list = [{}]
+ });
+ profileInfo.value = response.data.sessions
+ }
+ } catch (error) {
+ ElMessage.error('获取失败')
+ }
+}
+
+
+
const dialogVisible = ref(false)
const handleClose = () => {
dialogVisible.value = false
@@ -598,7 +654,15 @@ const loadDetectionRecords = async () => {
}
}
//修改诊断信息
-function editClick() {
+function editClick(row,index) {
+ diagnosticForm.value = {
+ id: row.id,
+ diagnosis_info: row.diagnosis_info,
+ treatment_info: row.treatment_info,
+ suggestion_info: row.suggestion_info,
+ status: row.status,
+ index: index
+ }
dialogVisible.value = true
}
//数据详情
@@ -607,52 +671,148 @@ function patientdetails() {
}
async function handleDiagnosticInfo(status) {
try {
- // // 检查是否有活跃的会话ID
- // if (!patientInfo.value.sessionId) {
- // throw new Error('缺少会话Id')
- // }
- // // 调用后端API采集检测数据
- // const response = await fetch(`${BACKEND_URL}/api/detection/${patientInfo.value.sessionId}/save-info`, {
- // method: 'POST',
- // headers: {
- // 'Content-Type': 'application/json'
- // },
- // body: JSON.stringify({
- // diagnosis_info:diagnosticForm.diagnosis_info,
- // treatment_info:diagnosticForm.treatment_info,
- // suggestion_info:diagnosticForm.suggestion_info,
- // status:status,
- // session_id:patientInfo.value.sessionId,
- // })
- // })
- // if (!response.ok) {
- // throw new Error(`HTTP ${response.status}: ${response.statusText}`)
- // }
+ // 检查是否有活跃的会话ID
+ if (!diagnosticForm.value.id) {
+ throw new Error('缺少会话Id')
+ }
+ // 调用后端API采集检测数据
+ const response = await fetch(`${BACKEND_URL}/api/detection/${diagnosticForm.value.id}/save-info`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ diagnosis_info:diagnosticForm.value.diagnosis_info,
+ treatment_info:diagnosticForm.value.treatment_info,
+ suggestion_info:diagnosticForm.value.suggestion_info,
+ status:status,
+ id:diagnosticForm.value.id,
+ })
+ })
+ if (!response.ok) {
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`)
+ }
- // const result = await response.json()
- // if (result.success) {
- // // 显示成功消息
- // ElMessage.success({
- // message: status + '诊断信息成功',
- // duration: 5000
- // })
- // patientInfo.value.sessionId = null
- // } else {
- // throw new Error(result.message || '诊断信息失败')
- // }
+ const result = await response.json()
+ if (result.success) {
+ profileInfo.value[diagnosticForm.value.index].diagnosis_info = diagnosticForm.value.diagnosis_info
+ profileInfo.value[diagnosticForm.value.index].treatment_info = diagnosticForm.value.treatment_info
+ profileInfo.value[diagnosticForm.value.index].suggestion_info = diagnosticForm.value.suggestion_info
+ profileInfo.value[diagnosticForm.value.index].status = status
+ ElMessage.success({
+ message: '诊断信息成功',
+ duration: 5000
+ })
+ dialogVisible.value =false
+ } else {
+ throw new Error(result.message || '诊断信息失败')
+ }
} catch (error) {
- // ElMessage.error({
- // message: errorMessage,
- // duration: 5000
- // })
- // patientInfo.value.sessionId = null
+ ElMessage.error({
+ message: errorMessage,
+ duration: 5000
+ })
} finally {
- // patientInfo.value.sessionId = null
}
}
+
+// 暂停视频
+const pauseVideo = (index) => {
+ if (videoPlayerRef.value) {
+ videoPlayerRef.value[index].pause()
+ }
+}
+
+ // 播放视频
+const playNewVideo = () => {
+ if (videoPlayerRef.value) {
+ videoPlayerRef.value[index].play()
+ }
+}
+
+const deleteClick = async (row) => {
+
+ ElMessageBox.confirm(
+ '确定义删除此条数据?',
+ '提示',
+ {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ }
+ ).then(() => {
+ historyAPI.detectionDelById(row.id).then((response)=>{
+ console.log(response.data)
+ }).catch(()=>{
+
+ })
+ })
+
+
+ // try {
+ // // 检查是否有活跃的会话ID
+ // if (!row.id) {
+ // throw new Error('缺少会话Id');
+ // }
+
+ // // 显示确认对话框
+ // await ElMessageBox.confirm(
+ // '确定要删除此条数据?',
+ // '警告',
+ // {
+ // confirmButtonText: '确定',
+ // cancelButtonText: '取消',
+ // type: 'warning',
+ // }
+ // );
+
+ // // 调用后端API删除数据
+ // const response = await fetch(`${BACKEND_URL}/api/detection/data/${row.id}`, {
+ // method: 'DELETE',
+ // headers: {
+ // 'Content-Type': 'application/json'
+ // },
+ // });
+
+ // if (!response.ok) {
+ // throw new Error(`HTTP ${response.status}: ${response.statusText}`);
+ // }
+
+ // const result = await response.json();
+ // if (result.success) {
+ // ElMessage.success({
+ // message: '删除成功',
+ // duration: 5000
+ // });
+ // } else {
+ // throw new Error(result.message || '删除失败');
+ // }
+ // } catch (error) {
+ // // 如果是用户取消操作,不显示错误
+ // if (error === 'cancel' || error === 'close') {
+ // return;
+ // }
+
+ // ElMessage.error({
+ // message: error.message || '删除过程中发生错误',
+ // duration: 5000
+ // });
+ // }
+}
+// // 其他控制方法
+// const togglePlayPause = () => {
+// if (videoPlayerRef.value) {
+// if (videoPlayerRef.value.paused) {
+// videoPlayerRef.value.play()
+// } else {
+// videoPlayerRef.value.pause()
+// }
+// }
+// }
// 生命周期
onMounted(() => {
loadPatientInfo()
+ sessionsInit()
// loadDetectionRecords()
})
@@ -734,7 +894,19 @@ onMounted(() => {
color: #E6A23C;
text-align: center;
border-radius: 5px;
+ border: 1px solid rgba(230, 162, 60, 0.3);
}
+.content-right-top-text3 {
+ width: 62px;
+ height: 32px;
+ line-height: 32px;
+ background: rgba(103, 194, 58, 0.1);
+ color: rgb(103, 194, 58);
+ text-align: center;
+ border-radius: 5px;
+ border: 1px solid rgba(103, 194, 58, 0.3);
+}
+
.content-right-top-content {
height: calc(100% - 75px);
@@ -819,6 +991,13 @@ onMounted(() => {
color: #ffffff;
}
+:deep(.el-checkbox__inner) {
+ width:20px;
+ height: 20px;
+ background: transparent;
+}
+
+
.patient-profile-container {
height: 100vh;
display: flex;