新增影像保存时候保存PDF到FTP
This commit is contained in:
parent
67ce66a747
commit
c14962967d
@ -111,8 +111,8 @@ export const ApplyformApi = {
|
||||
return await request.post({ url: `/applyregistration/applyform/batchupdateFJ`, data})
|
||||
},
|
||||
// 同步
|
||||
SyncDb: async (AppCode: string) => {
|
||||
return await request.get({ url: `/applyregistration/applyform/SyncDb?AppCode=` + AppCode })
|
||||
SyncDb: async (AppCode: string,type:string) => {
|
||||
return await request.get({ url: `/applyregistration/applyform/SyncDb?AppCode=${AppCode}&&type=${type}` })
|
||||
},
|
||||
// 获取登记单统计信息
|
||||
GetReglistCount: async () => {
|
||||
|
@ -35,7 +35,12 @@ export interface PatientexamlistVO {
|
||||
StudyInsta:string
|
||||
isFavourite:string //是否收藏
|
||||
}
|
||||
export interface inspdfscreenshotVO {
|
||||
|
||||
id: string // 主键
|
||||
imagebase: string // 图片
|
||||
|
||||
}
|
||||
// PACS检查列表 API
|
||||
export const PatientexamlistApi = {
|
||||
// 查询PACS检查列表分页
|
||||
@ -106,4 +111,8 @@ export const PatientexamlistApi = {
|
||||
CollectAndCancellation: async (id: String,type:string) => {
|
||||
return await request.get({ url: `/tblist/patientexamlist/CollectAndCancellation?id=${id}&&type=${type}`})
|
||||
},
|
||||
|
||||
ftppdf: async (data:inspdfscreenshotVO) => {
|
||||
return await request.post({ url: `/tblist/patientexamlist/ftppdf`,data})
|
||||
},
|
||||
}
|
||||
|
@ -143,7 +143,8 @@
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
|
||||
<el-button @click="Sync"
|
||||
<el-button
|
||||
@click="Sync"
|
||||
style="background-color: rgb(28, 176, 117);font-size: 14; color: rgb(255, 255, 255);"><Icon icon="ep:refresh" class="mr-5px" /> 同步</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
@ -340,10 +341,11 @@ const resetQuery = () => {
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 同步操作
|
||||
// 同步操作 1接口 2 数据库
|
||||
const Sync = async () => {
|
||||
const data = await ApplyformApi.SyncDb('DB001')
|
||||
const data = await ApplyformApi.SyncDb('API001',"1")
|
||||
if (data) {
|
||||
message.alertSuccess(data)
|
||||
getList()
|
||||
}
|
||||
}
|
||||
|
@ -4,15 +4,22 @@
|
||||
:title="dialogTitle"
|
||||
class="my-custom-close-icon"
|
||||
:fullscreen="true"
|
||||
@close="
|
||||
() => {
|
||||
newSrc = 'about:blank'
|
||||
dataLoaded = false
|
||||
}
|
||||
"
|
||||
>
|
||||
<el-tabs v-model="activeName" type="card">
|
||||
<el-tab-pane v-if="tagLoaded" label="影像" name="first">
|
||||
<iframe
|
||||
ref="dicomframe"
|
||||
v-if="dataLoaded"
|
||||
frameborder="0"
|
||||
scrolling="no"
|
||||
:src="newSrc"
|
||||
style="width: 100%; height: 87vh"
|
||||
:src="newSrc"
|
||||
></iframe>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="报告单" name="second">
|
||||
@ -289,6 +296,7 @@
|
||||
>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--报告 保存的时候 存base64-->
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@ -297,10 +305,16 @@ import { ultrasoniccomApi, updateexamineimageVO } from '@/api/ultrasoniccom'
|
||||
import axios from 'axios'
|
||||
import { PatientexamlistApi, PatientexamlistVO } from '@/api/tblist/patientexamlist'
|
||||
import { getUserProfile, ProfileVO } from '@/api/system/user/profile'
|
||||
import PdfContent from '@/views/applyregistration/reportPrintStatistics/ReportInfoCT.vue' // 引入你的PDF内容组件
|
||||
import { createVNode, render } from 'vue'
|
||||
import html2canvas from 'html2canvas'
|
||||
import { jsPDF } from 'jspdf'
|
||||
|
||||
/** dicom */
|
||||
defineOptions({ name: 'DicomViewForm' })
|
||||
|
||||
//存放生成的pdfbase
|
||||
const pdfBase64 = ref('')
|
||||
const dicomframe = ref()
|
||||
const Profilevo = ref<ProfileVO>({} as ProfileVO) //当前登录人信息
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
@ -403,7 +417,74 @@ const examine = async () => {
|
||||
return
|
||||
}
|
||||
}
|
||||
//生成pdfbase64
|
||||
const exportPdfToBase64 = async () => {
|
||||
// 创建一个临时的DOM元素来挂载PdfContent组件
|
||||
const tempDiv = document.createElement('div')
|
||||
document.body.appendChild(tempDiv)
|
||||
|
||||
// 使用createVNode创建一个虚拟节点
|
||||
// 渲染组件到临时DOM元素 传递数据
|
||||
const componentInstance = createVNode(PdfContent, {
|
||||
...applyFormVO.value,
|
||||
showQRcode: false
|
||||
})
|
||||
|
||||
// 使用render函数将虚拟节点渲染到临时DOM元素中
|
||||
render(componentInstance, tempDiv)
|
||||
|
||||
// 等待Vue组件渲染完成
|
||||
await new Promise((resolve) => setTimeout(resolve, 0)) // 使用setTimeout来模拟nextTick
|
||||
|
||||
// 使用html2canvas将DOM元素转换为canvas,并设置scale参数提高分辨率
|
||||
const canvas = await html2canvas(tempDiv, {
|
||||
scale: 1, // 根据需要调整scale值
|
||||
useCORS: true
|
||||
})
|
||||
|
||||
// 移除临时DOM元素
|
||||
document.body.removeChild(tempDiv)
|
||||
|
||||
// 使用jsPDF生成PDF
|
||||
const imgData = canvas.toDataURL('image/jpeg', 0.8)
|
||||
const pdf = new jsPDF({
|
||||
orientation: 'landscape',
|
||||
unit: 'mm',
|
||||
format: 'a4' // 设置PDF的尺寸与canvas一致
|
||||
})
|
||||
|
||||
const scalefactor = 1 // 设置一个放大因子
|
||||
|
||||
const imgWidth = pdf.internal.pageSize.getWidth() * scalefactor
|
||||
const imgHeight = ((canvas.height * imgWidth) / canvas.width) * scalefactor
|
||||
|
||||
pdf.addImage(imgData, 'jpeg', 0, 0, imgWidth, imgHeight)
|
||||
const pdfBase64String = pdf.output('datauristring') // 获取base64编码的PDF文件
|
||||
|
||||
// 更新pdfBase64的值
|
||||
pdfBase64.value = pdfBase64String
|
||||
await PatientexamlistApi.ftppdf({ id: ID.toString(), imagebase: pdfBase64String })
|
||||
}
|
||||
const infoParams = ref({
|
||||
id: '',
|
||||
examId: '',
|
||||
regId: '',
|
||||
orgId: '',
|
||||
pname: '',
|
||||
gender: '',
|
||||
birthday: '',
|
||||
billDoctorDepartment: '',
|
||||
applicationDate: '',
|
||||
examDescription: '',
|
||||
diagResults: '',
|
||||
examItemName: '',
|
||||
deviceName: '',
|
||||
deviceType: '',
|
||||
diagDoctor: '',
|
||||
diagDate: '',
|
||||
reviewDoctor: '',
|
||||
reviewDate: ''
|
||||
})
|
||||
// 计算年龄
|
||||
const age = ref()
|
||||
const calculateAge = (birthdate) => {
|
||||
@ -513,7 +594,7 @@ const regId = ref('')
|
||||
|
||||
const examid = ref('')
|
||||
//内嵌网页加载增加时间戳 防止缓存
|
||||
const newSrc = ref('')
|
||||
const newSrc = ref('about:blank')
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (id: number, orgid: string, regid: string, examId: string, isLoaded: string) => {
|
||||
@ -527,6 +608,7 @@ const open = async (id: number, orgid: string, regid: string, examId: string, is
|
||||
tagLoaded.value = true
|
||||
activeName.value = 'first'
|
||||
}
|
||||
|
||||
console.log('orgid' + orgid)
|
||||
console.log('regid' + regid)
|
||||
console.log('id' + id)
|
||||
@ -551,17 +633,22 @@ const open = async (id: number, orgid: string, regid: string, examId: string, is
|
||||
'1'
|
||||
)
|
||||
privateData.value = pridate
|
||||
await iframeData()
|
||||
//查询患者信息 根据ID
|
||||
getPatientexamlist(id)
|
||||
|
||||
//获取登录人信息
|
||||
getlogininfo()
|
||||
iframeData()
|
||||
// 延迟1秒后加载iframe
|
||||
setTimeout(() => {
|
||||
dataLoaded.value = true // 确保iframe只在弹窗打开时加载
|
||||
}, 200)
|
||||
} finally {
|
||||
if (newSrc.value != 'about:blank') {
|
||||
nextTick(async () => {
|
||||
console.log('------------aaaaaaaaaa--------')
|
||||
await new Promise((resolve) => setTimeout(resolve, 350))
|
||||
console.log('------------aaaaaaaaaa1--------')
|
||||
dataLoaded.value = true
|
||||
console.log('------------aaaaaaaaaa2--------')
|
||||
})
|
||||
}
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
@ -612,6 +699,7 @@ const getPatientexamlist = async (id: number) => {
|
||||
} else {
|
||||
savedisabled.value = true
|
||||
}
|
||||
exportPdfToBase64()
|
||||
}
|
||||
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
@ -659,26 +747,31 @@ const resetForm = () => {
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
}
|
||||
*/ /* 报告区域 左侧模版选择字体大小 */
|
||||
*/
|
||||
/* 报告区域 左侧模版选择字体大小 */
|
||||
.treeStyle {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
/* 分割线内部的间距 */
|
||||
.el-divider--horizontal {
|
||||
margin: 6px;
|
||||
}
|
||||
|
||||
/* 阴性 阳性 */
|
||||
.radio-group-wrapper {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 10px; /* 调整上方外边距 */
|
||||
margin-top: 10px;
|
||||
/* 调整上方外边距 */
|
||||
margin-right: 33px;
|
||||
}
|
||||
|
||||
/* 诊断医生等样式 */
|
||||
.form-row-yx {
|
||||
display: flex;
|
||||
justify-content: space-around; /* 将元素左右对齐 */
|
||||
justify-content: space-around;
|
||||
/* 将元素左右对齐 */
|
||||
margin-top: 10px;
|
||||
margin-left: 100px;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user