diff --git a/frontend/src/renderer/src/views/GenerateReport.vue b/frontend/src/renderer/src/views/GenerateReport.vue index a80a39f6..f2093035 100644 --- a/frontend/src/renderer/src/views/GenerateReport.vue +++ b/frontend/src/renderer/src/views/GenerateReport.vue @@ -4,12 +4,12 @@
生成报告
取消
-
确定
+
确定
- +
体态测量报告单
检测时间:{{ detectionInfo.start_time }}
@@ -190,11 +190,11 @@
【诊断结果】
记录
-
记录信息
+
{{ detectionInfo.diagnosis_info }}
处理
-
保持观察,不予处理
+
{{ detectionInfo.treatment_info }}
备注
-
备注信息
+
{{ detectionInfo.suggestion_info }}
@@ -208,6 +208,9 @@ import { ref, reactive, computed, onMounted, onUnmounted } from 'vue' import { useRouter, useRoute } from 'vue-router' import { ElMessage, ElMessageBox } from 'element-plus' import { patientAPI, detectionAPI,historyAPI,getBackendUrl } from '@/services/api.js' +// import { ipcRenderer } from 'electron' +import html2canvas from 'html2canvas'; +import jsPDF from 'jspdf'; import SelectData from '@/views/SelectData.vue' const emit = defineEmits([ 'closeGenerateReport' ]); @@ -287,6 +290,10 @@ onMounted(() => { function closeCancel() { emit("closeGenerateReport",false) } +function confirmCancel() { + // generatePDF() + // emit("closeGenerateReport",false) +} onUnmounted(() => { }) @@ -314,6 +321,41 @@ function closeSelectData(is,val){ } isSelectData.value = false } + + +const generatePDF = async () => { + // 1. 通过 id 获取 DOM 元素 + const element = document.getElementById('pdf-content'); + + // 2. 转为 Canvas + const canvas = await html2canvas(element, { + scale: 2, // 提高清晰度 + useCORS: true, // 允许跨域图片 + }); + + // 3. 生成 PDF + const pdf = new jsPDF('p', 'mm', 'a4'); // 纵向、毫米、A4尺寸 + const imgData = canvas.toDataURL('image/jpeg', 1.0); + + // 计算图片在 PDF 中的尺寸 + const pdfWidth = pdf.internal.pageSize.getWidth(); + const pdfHeight = (canvas.height * pdfWidth) / canvas.width; + + // 添加图片到 PDF + pdf.addImage(imgData, 'JPEG', 0, 0, pdfWidth, pdfHeight); + + // 4. 获取 PDF 流(Blob 对象) + const pdfBlob = pdf.output('blob'); + + // 5. 使用流(示例:上传或下载) + // 上传示例:const formData = new FormData(); formData.append('file', pdfBlob); + // 下载示例: + const url = URL.createObjectURL(pdfBlob); + const a = document.createElement('a'); + a.href = url; + a.download = 'document.pdf'; + a.click(); + }; \ No newline at end of file diff --git a/frontend/src/renderer/src/views/ImageDetailsCompare.vue b/frontend/src/renderer/src/views/ImageDetailsCompare.vue index 31576300..43f5aee3 100644 --- a/frontend/src/renderer/src/views/ImageDetailsCompare.vue +++ b/frontend/src/renderer/src/views/ImageDetailsCompare.vue @@ -34,14 +34,78 @@
{{ ImageDetailsInfoLeft.order }}
- +
+
+ + + +
+
+
左: + {{headPoseMaxValuesLeft.rotationLeftMax}}° + +
+
左: + {{headPoseMaxValuesLeft.tiltLeftMax}}° +
+
俯: + {{headPoseMaxValuesLeft.pitchDownMax}}° +
+
+
+
右: + {{headPoseMaxValuesLeft.rotationRightMax}}° +
+
右: + + {{headPoseMaxValuesLeft.tiltRightMax}}° + +
+
仰: + + {{headPoseMaxValuesLeft.pitchUpMax}}° + +
+
+
+ style="width: 630px;height: 100%;margin-left: 50px;">
{{ ImageDetailsInfoRight.order }}
- +
+
+ + + +
+
+
左: + {{headPoseMaxValuesRight.rotationLeftMax}}° + +
+
左: + {{headPoseMaxValuesRight.tiltLeftMax}}° +
+
俯: + {{headPoseMaxValuesRight.pitchDownMax}}° +
+
+
+
右: + {{headPoseMaxValuesRight.rotationRightMax}}° +
+
右: + + {{headPoseMaxValuesRight.tiltRightMax}}° + +
+
仰: + + {{headPoseMaxValuesRight.pitchUpMax}}° + +
+
+
@@ -109,12 +173,34 @@ const indexActive = ref(0) // 图片详情索引 const ImageDetailsInfoLeft = ref({}) // 左图片详情信息 const ImageDetailsInfoRight = ref({}) // 右图片详情信息 const pageIndex = ref(0) +const headPoseMaxValuesLeft = ref({ + rotationLeftMax: 0, // 旋转-左旋最大值 + rotationRightMax: 0, // 旋转-右旋最大值 + tiltLeftMax: 0, // 倾斜-左倾最大值 + tiltRightMax: 0, // 倾斜-右倾最大值 + pitchUpMax: 0, // 俯仰-上仰最大值 + pitchDownMax: 0 }) + + const headPoseMaxValuesRight= ref({ + rotationLeftMax: 0, // 旋转-左旋最大值 + rotationRightMax: 0, // 旋转-右旋最大值 + tiltLeftMax: 0, // 倾斜-左倾最大值 + tiltRightMax: 0, // 倾斜-右倾最大值 + pitchUpMax: 0, // 俯仰-上仰最大值 + pitchDownMax: 0 }) + // 生命周期 onMounted(() => { pageIndex.value = props.selectIndex if(props.ImageDetailsList.length == 2){ ImageDetailsInfoLeft.value = props.ImageDetailsList[0] + if(props.ImageDetailsList[0].head_pose !=null){ + headPoseMaxValuesLeft.value = JSON.parse(props.ImageDetailsList[0].head_pose).headPoseMaxValues + } ImageDetailsInfoRight.value = props.ImageDetailsList[1] + if(props.ImageDetailsList[1].head_pose !=null){ + headPoseMaxValuesRight.value = JSON.parse(props.ImageDetailsList[1].head_pose).headPoseMaxValues + } } }) @@ -217,4 +303,14 @@ onUnmounted(() => { margin-bottom: 20px; width: 100%; } + +.ImageDetailsCompare-content-imgbox .rollyawpitchtext{ + font-style: normal; + color: #282828; + font-size: 24px; + width: 170px; +} +.ImageDetailsCompare-content-imgbox .rollyawpitchtextcolor{ + color:#14AAFF; +} \ No newline at end of file diff --git a/frontend/src/renderer/src/views/PatientProfile.vue b/frontend/src/renderer/src/views/PatientProfile.vue index 532ff6ae..e3f3767b 100644 --- a/frontend/src/renderer/src/views/PatientProfile.vue +++ b/frontend/src/renderer/src/views/PatientProfile.vue @@ -173,7 +173,7 @@
-
+
@@ -286,6 +286,8 @@ +
@@ -312,6 +314,7 @@ import { patientAPI, detectionAPI,historyAPI,getBackendUrl } from '@/services/ap import { useAuthStore } from '@/stores/index.js' import GenerateReport from '@/views/GenerateReport.vue' import ImageDetailsCompare from '@/views/ImageDetailsCompare.vue' +import ImageDetails from '@/views/ImageDetails.vue' const formatDate = (date) => { const d = new Date(date) @@ -350,7 +353,8 @@ const profileInfo = ref({ const selectedRecord = ref({}) const recordData =ref([]) const isImageDetailsCompare = ref(false) // 是否显示对比图片详情 - +const isImageDetails =ref(false) // 是否显示图片详情 +const selectIndex = ref(0) // 图片详情选中的索引 const ImageDetailsList = ref([]) // 图片详情列表 const checkboxGroup = ref([]) // 图片列表选中的数据 @@ -374,6 +378,11 @@ function getNo(order) { return order } } +function clickImg(item,index){ + debugger + selectIndex.value = index + isImageDetails.value =true +} const calculateAge = (birthDate) => { // 获取年龄 if (!birthDate) return '—' const today = new Date() @@ -676,9 +685,10 @@ function closeGenerateReport(){ // 关闭生成报告页面 } function viewCompareImg(){ - if(checkboxGroup.length != 2){ + if(checkboxGroup.value.length != 2){ return } + ImageDetailsList.value = [] for(let i=0;i{ background-color: #14aaff; color: #fff; } +.patientprofile-container-info .el-select__placeholder{ + color: #fff; +}