新增影像保存时候保存PDF到FTP

This commit is contained in:
lxd 2024-10-18 10:54:02 +08:00
parent 67ce66a747
commit c14962967d
4 changed files with 120 additions and 16 deletions

View File

@ -111,8 +111,8 @@ export const ApplyformApi = {
return await request.post({ url: `/applyregistration/applyform/batchupdateFJ`, data}) return await request.post({ url: `/applyregistration/applyform/batchupdateFJ`, data})
}, },
// 同步 // 同步
SyncDb: async (AppCode: string) => { SyncDb: async (AppCode: string,type:string) => {
return await request.get({ url: `/applyregistration/applyform/SyncDb?AppCode=` + AppCode }) return await request.get({ url: `/applyregistration/applyform/SyncDb?AppCode=${AppCode}&&type=${type}` })
}, },
// 获取登记单统计信息 // 获取登记单统计信息
GetReglistCount: async () => { GetReglistCount: async () => {

View File

@ -35,7 +35,12 @@ export interface PatientexamlistVO {
StudyInsta:string StudyInsta:string
isFavourite:string //是否收藏 isFavourite:string //是否收藏
} }
export interface inspdfscreenshotVO {
id: string // 主键
imagebase: string // 图片
}
// PACS检查列表 API // PACS检查列表 API
export const PatientexamlistApi = { export const PatientexamlistApi = {
// 查询PACS检查列表分页 // 查询PACS检查列表分页
@ -106,4 +111,8 @@ export const PatientexamlistApi = {
CollectAndCancellation: async (id: String,type:string) => { CollectAndCancellation: async (id: String,type:string) => {
return await request.get({ url: `/tblist/patientexamlist/CollectAndCancellation?id=${id}&&type=${type}`}) 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})
},
} }

View File

@ -143,7 +143,8 @@
<Icon icon="ep:download" class="mr-5px" /> 导出 <Icon icon="ep:download" class="mr-5px" /> 导出
</el-button> </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 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> </el-form-item>
@ -340,10 +341,11 @@ const resetQuery = () => {
handleQuery() handleQuery()
} }
// // 1 2
const Sync = async () => { const Sync = async () => {
const data = await ApplyformApi.SyncDb('DB001') const data = await ApplyformApi.SyncDb('API001',"1")
if (data) { if (data) {
message.alertSuccess(data)
getList() getList()
} }
} }

View File

@ -4,15 +4,22 @@
:title="dialogTitle" :title="dialogTitle"
class="my-custom-close-icon" class="my-custom-close-icon"
:fullscreen="true" :fullscreen="true"
@close="
() => {
newSrc = 'about:blank'
dataLoaded = false
}
"
> >
<el-tabs v-model="activeName" type="card"> <el-tabs v-model="activeName" type="card">
<el-tab-pane v-if="tagLoaded" label="影像" name="first"> <el-tab-pane v-if="tagLoaded" label="影像" name="first">
<iframe <iframe
ref="dicomframe"
v-if="dataLoaded" v-if="dataLoaded"
frameborder="0" frameborder="0"
scrolling="no" scrolling="no"
:src="newSrc"
style="width: 100%; height: 87vh" style="width: 100%; height: 87vh"
:src="newSrc"
></iframe> ></iframe>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="报告单" name="second"> <el-tab-pane label="报告单" name="second">
@ -289,6 +296,7 @@
> >
</div> </div>
</el-dialog> </el-dialog>
<!--报告 保存的时候 存base64-->
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -297,10 +305,16 @@ import { ultrasoniccomApi, updateexamineimageVO } from '@/api/ultrasoniccom'
import axios from 'axios' import axios from 'axios'
import { PatientexamlistApi, PatientexamlistVO } from '@/api/tblist/patientexamlist' import { PatientexamlistApi, PatientexamlistVO } from '@/api/tblist/patientexamlist'
import { getUserProfile, ProfileVO } from '@/api/system/user/profile' 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 */ /** dicom */
defineOptions({ name: 'DicomViewForm' }) defineOptions({ name: 'DicomViewForm' })
//pdfbase
const pdfBase64 = ref('')
const dicomframe = ref()
const Profilevo = ref<ProfileVO>({} as ProfileVO) // const Profilevo = ref<ProfileVO>({} as ProfileVO) //
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
@ -403,7 +417,74 @@ const examine = async () => {
return return
} }
} }
//pdfbase64
const exportPdfToBase64 = async () => {
// DOMPdfContent
const tempDiv = document.createElement('div')
document.body.appendChild(tempDiv)
// 使createVNode
// DOM
const componentInstance = createVNode(PdfContent, {
...applyFormVO.value,
showQRcode: false
})
// 使renderDOM
render(componentInstance, tempDiv)
// Vue
await new Promise((resolve) => setTimeout(resolve, 0)) // 使setTimeoutnextTick
// 使html2canvasDOMcanvasscale
const canvas = await html2canvas(tempDiv, {
scale: 1, // scale
useCORS: true
})
// DOM
document.body.removeChild(tempDiv)
// 使jsPDFPDF
const imgData = canvas.toDataURL('image/jpeg', 0.8)
const pdf = new jsPDF({
orientation: 'landscape',
unit: 'mm',
format: 'a4' // PDFcanvas
})
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') // base64PDF
// 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 age = ref()
const calculateAge = (birthdate) => { const calculateAge = (birthdate) => {
@ -513,7 +594,7 @@ const regId = ref('')
const examid = 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) => { 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 tagLoaded.value = true
activeName.value = 'first' activeName.value = 'first'
} }
console.log('orgid' + orgid) console.log('orgid' + orgid)
console.log('regid' + regid) console.log('regid' + regid)
console.log('id' + id) console.log('id' + id)
@ -551,17 +633,22 @@ const open = async (id: number, orgid: string, regid: string, examId: string, is
'1' '1'
) )
privateData.value = pridate privateData.value = pridate
await iframeData()
// ID // ID
getPatientexamlist(id) getPatientexamlist(id)
// //
getlogininfo() getlogininfo()
iframeData()
// 1iframe
setTimeout(() => {
dataLoaded.value = true // iframe
}, 200)
} finally { } 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 formLoading.value = false
} }
} }
@ -612,6 +699,7 @@ const getPatientexamlist = async (id: number) => {
} else { } else {
savedisabled.value = true savedisabled.value = true
} }
exportPdfToBase64()
} }
defineExpose({ open }) // open defineExpose({ open }) // open
@ -659,26 +747,31 @@ const resetForm = () => {
height: 100vh; height: 100vh;
width: 100vw; width: 100vw;
} }
*/ /* 报告区域 左侧模版选择字体大小 */ */
/* 报告区域 左侧模版选择字体大小 */
.treeStyle { .treeStyle {
font-size: 20px; font-size: 20px;
} }
/* 分割线内部的间距 */ /* 分割线内部的间距 */
.el-divider--horizontal { .el-divider--horizontal {
margin: 6px; margin: 6px;
} }
/* 阴性 阳性 */ /* 阴性 阳性 */
.radio-group-wrapper { .radio-group-wrapper {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
margin-top: 10px; /* 调整上方外边距 */ margin-top: 10px;
/* 调整上方外边距 */
margin-right: 33px; margin-right: 33px;
} }
/* 诊断医生等样式 */ /* 诊断医生等样式 */
.form-row-yx { .form-row-yx {
display: flex; display: flex;
justify-content: space-around; /* 将元素左右对齐 */ justify-content: space-around;
/* 将元素左右对齐 */
margin-top: 10px; margin-top: 10px;
margin-left: 100px; margin-left: 100px;
} }