ecg-form/src/api/processImage/index.ts

89 lines
2.3 KiB
TypeScript
Raw Normal View History

2025-05-16 10:27:49 +08:00
import axios from 'axios'
// const apiUrl = 'https://zzxmc.gw12320.com/processImage'
const apiUrl = 'https://pacs.gw12320.com/adminecg/admin-api/tblist/ecganalysisparas/rpc-processImage'
2025-05-16 15:09:17 +08:00
const imageAddress = 'F://陕西省咸阳市礼泉县心电图FTP/ecgimage/'
const originImageAddress = 'https://zzxmc.gw12320.com/ecgimage/'
2025-05-19 17:00:27 +08:00
// const apiUrl = 'https://localhost:48080/admin-api/tblist/ecganalysisparas/rpc-processImage'
// const imageAddress = 'F://陕西省咸阳市礼泉县心电图FTP/ecgimage/'
// const originImageAddress = 'https://zzxmc.gw12320.com/ecgimage/'
2025-05-16 10:27:49 +08:00
// 超声组件 API
export const processImageApi = {
// 查询模版表数据
2025-05-19 17:00:27 +08:00
paramsList:{
"礼泉县裴寨卫生院":{
startX:1800,
startY:100,
height:400,
width:900,
step:"诊断结果:",
options:{watermarkFontSize:40}
},
"药王洞卫生院":{
startX:1200,
startY:140,
height:350,
width:950,
step:" 诊断结果:",
options:{watermarkFontSize:40}
},
"史德卫生院":{
startX:990,
startY:2910,
height:400,
width:800,
step:" ",
options:{watermarkFontSize:40}
},
"礼泉县城关卫生院":{
startX:2700,
startY:340,
height:600,
width:2400,
step:"诊断结果:",
options:{watermarkFontSize:40}
},
"北屯中心卫生院":{
startX:1800,
startY:100,
height:400,
width:900,
step:"诊断结果:",
options:{watermarkFontSize:40}
}
},
2025-05-16 10:27:49 +08:00
processImg: async (params: any) => {
try {
const response = await axios({
method: 'post',
2025-05-16 15:09:17 +08:00
url: apiUrl,
2025-05-16 10:27:49 +08:00
data: params,
withCredentials: true
})
2025-05-19 17:00:27 +08:00
return response
2025-05-16 10:27:49 +08:00
} catch (error) {
console.error('Error fetching image:', error)
throw error
}
2025-05-16 15:09:17 +08:00
},
urlToAddress:(url)=>{
// https://zzxmc.gw12320.com/ecgimage/北屯中心/K021180213001N0003_20250418162136.jpg
if (!url){
return
}
console.log(imageAddress)
const str = url.replace(originImageAddress,imageAddress)
// console.log(str)
2025-05-16 15:09:17 +08:00
return str;
},
addressToUrl:(address)=>{
if (!address){
return
}
// console.log(imageAddress)
2025-05-16 15:09:17 +08:00
const str = address.replace(imageAddress,originImageAddress)
// console.log(str)
2025-05-16 15:09:17 +08:00
return str;
2025-05-16 10:27:49 +08:00
}
}