上传、下载影像
continuous-integration/drone/push Build is passing Details

uat_us
wangxiaoshuang 2024-05-24 16:47:35 +08:00
parent 0baa90d86f
commit 56b94a97fd
3 changed files with 384 additions and 142 deletions

View File

@ -31,3 +31,12 @@ export function addOrUpdateArchiveTaskStudy(data) {
data data
}) })
} }
// 删除上传文件
export function deleteTaskStudy(params) {
return request({
url: '/DownloadAndUpload/deleteTaskStudy',
method: 'delete',
params
})
}

View File

@ -7,6 +7,10 @@
:before-close="beforeClose" :before-close="beforeClose"
> >
<span slot="title">{{ $t("trials:uploadImage:title:uploadImages") }}</span> <span slot="title">{{ $t("trials:uploadImage:title:uploadImages") }}</span>
<el-divider content-position="left">{{
$t("trials:uploadImage:button:uploadTableTitle1")
}}</el-divider>
<!--已上传影像检查-->
<el-table :data="list" style="width: 100%" height="300" :loading="loading"> <el-table :data="list" style="width: 100%" height="300" :loading="loading">
<!--受试者--> <!--受试者-->
<el-table-column <el-table-column
@ -23,12 +27,19 @@
prop="OrginalStudyList" prop="OrginalStudyList"
:label="$t('trials:uploadImage:table:orginalStudyListNum')" :label="$t('trials:uploadImage:table:orginalStudyListNum')"
> >
<template slot-scope="scope">{{ <template slot-scope="scope">
<el-button
v-if="
scope.row.OrginalStudyList && scope.row.OrginalStudyList &&
Array.isArray(scope.row.OrginalStudyList) scope.row.OrginalStudyList.length >= 1
? scope.row.OrginalStudyList.length "
: 0 type="text"
}}</template> @click="handleOpenDialog(scope.row, 'study')"
>
<span>{{ scope.row.OrginalStudyList.length }}</span>
</el-button>
<span v-else>0</span>
</template>
</el-table-column> </el-table-column>
<!--后处理检查数--> <!--后处理检查数-->
<el-table-column <el-table-column
@ -64,17 +75,33 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<p class="line">{{ $t("trials:uploadImage:button:uploadTableTitle") }}</p> <el-divider content-position="left">{{
$t("trials:uploadImage:button:uploadTableTitle")
}}</el-divider>
<div <div
class="top" class="top"
style="margin-bottom: 10px" style="margin-bottom: 10px"
v-if="Criterion.ImageUploadEnum > 0" v-if="Criterion.ImageUploadEnum > 0"
> >
<el-button type="primary" size="small" class="el-icon-upload2"> <el-button
type="primary"
size="small"
class="el-icon-upload2"
v-if="!isLoad"
>
<label for="file"> <label for="file">
{{ $t("trials:uploadImage:button:selectFolder") }} {{ $t("trials:uploadImage:button:selectFolder") }}
</label> </label>
</el-button> </el-button>
<el-button
type="primary"
size="small"
class="el-icon-upload2"
@click.stop="notUp"
v-else
>
{{ $t("trials:uploadImage:button:selectFolder") }}
</el-button>
<input <input
type="file" type="file"
name="file" name="file"
@ -86,21 +113,131 @@
@change="beginScanFiles($event)" @change="beginScanFiles($event)"
/> />
</div> </div>
<!--本地影像检查-->
<el-table <el-table
:data="uploadList" :data="uploadList"
style="width: 100%" style="width: 100%"
v-adaptive="{ bottomOffset: 40 }" v-adaptive="{ bottomOffset: 50 }"
> >
<!--检查编号--> <el-table-column type="index" width="40" />
<el-table-column <!--检查信息-->
prop="StudyId" <el-table-column min-width="200" show-overflow-tooltip>
:label="$t('trials:uploadImage:table:StudyId')" <template slot="header">
/> <el-tooltip placement="top">
<!--患者姓名--> <div slot="content">
<el-table-column {{ $t("trials:uploadImage:table:studyDetail1") }}<br />
prop="PatientName" {{ $t("trials:uploadImage:table:studyDetail2") }}<br />
:label="$t('trials:uploadImage:table:PatientName')" {{ $t("trials:uploadedDicoms:table:studyDate") }}
/> </div>
<span>{{ $t("trials:uploadImage:table:studyInfo") }}</span>
</el-tooltip>
</template>
<template slot-scope="scope">
<div style="line-height: 15px">
<div>
<div>
<span>
<span style="font-weight: 500">Acc:</span>
<span
:class="{
colorOfRed: !scope.row.dicomInfo.AccessionNumber,
}"
>{{ scope.row.dicomInfo.AccessionNumber || "N/A" }}</span
>
</span>
</div>
<div style="display: inline-block; margin-right: 2px">
<span v-if="scope.row.dicomInfo.Modalities.length > 0">
{{ scope.row.dicomInfo.Modalities.join("、") }},
</span>
<span v-else style="color: #f44336">N/A,</span>
</div>
<div style="display: inline-block; margin-right: 2px">
<span v-if="scope.row.SeriesInstanceUidList.length"
>{{ scope.row.SeriesInstanceUidList.length }} Series,
</span>
<span v-else style="color: #f44336">N/A,</span>
</div>
<div style="display: inline-block">
<span v-if="scope.row.count"
>{{ scope.row.count }} Instances
</span>
<span v-else style="color: #f44336">N/A</span>
</div>
</div>
<div>
<div style="display: inline-block; margin-right: 2px">
<span v-if="scope.row.dicomInfo.seriesBodyPartExamined">
{{ scope.row.dicomInfo.seriesBodyPartExamined }},
</span>
<span v-else style="color: #f44336">N/A, </span>
</div>
<div style="display: inline-block">
<span v-if="scope.row.dicomInfo.StudyDescription">
{{ scope.row.dicomInfo.StudyDescription }}</span
>
<span v-else style="color: #f44336">N/A</span>
</div>
</div>
<div>
{{ scope.row.dicomInfo.StudyTime }}
</div>
</div>
</template>
</el-table-column>
<!--患者信息-->
<el-table-column min-width="130" show-overflow-tooltip>
<template slot="header">
<el-tooltip placement="top">
<div slot="content">
{{ $t("trials:uploadImage:table:pId") }}<br />
{{ $t("trials:uploadImage:table:patientName") }}<br />
{{ $t("trials:uploadImage:table:pInfo") }}
</div>
<span>{{ $t("trials:uploadImage:table:patientInfo") }}</span>
</el-tooltip>
</template>
<template slot-scope="scope">
<div style="line-height: 15px">
<div>
<span v-if="scope.row.dicomInfo.PatientId"
><span style="font-weight: 500">PID: </span
>{{ scope.row.dicomInfo.PatientId }}</span
>
<span v-else style="color: #f44336">N/A</span>
</div>
<div>
<span
:class="[scope.row.dicomInfo.PatientName ? '' : 'colorOfRed']"
>
{{ scope.row.dicomInfo.PatientName || "N/A" }}
</span>
</div>
<div>
<span
:class="[scope.row.dicomInfo.PatientSex ? '' : 'colorOfRed']"
>
{{ scope.row.dicomInfo.PatientSex || "N/A" }},
</span>
<span
:class="[scope.row.dicomInfo.PatientAge ? '' : 'colorOfRed']"
>
{{ scope.row.dicomInfo.PatientAge || "N/A" }},
</span>
<span
:class="[
scope.row.dicomInfo.PatientBirthDate ? '' : 'colorOfRed',
]"
>
{{ scope.row.dicomInfo.PatientBirthDate || "N/A" }}
</span>
</div>
</div>
</template>
</el-table-column>
<!--上传进度--> <!--上传进度-->
<el-table-column <el-table-column
prop="schedule" prop="schedule"
@ -123,7 +260,11 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
:type="['warning', 'success', 'danger'][scope.row.status]" :type="
['warning', 'success', 'danger', 'primary', 'success', 'danger'][
scope.row.status
]
"
size="mini" size="mini"
plain plain
v-if="scope.row.status || scope.row.status === 0" v-if="scope.row.status || scope.row.status === 0"
@ -160,10 +301,10 @@ import {
getSubjectImageUploadList, getSubjectImageUploadList,
preArchiveDicomStudy, preArchiveDicomStudy,
addOrUpdateArchiveTaskStudy, addOrUpdateArchiveTaskStudy,
deleteTaskStudy,
} from "@/api/load.js"; } from "@/api/load.js";
import { downloadImage } from "@/utils/uploadZip.js"; import { downloadImage } from "@/utils/uploadZip.js";
import { parseDicom, getThumbnail } from "@/utils/parseDicom.js"; import { parseDicom, getThumbnail, dicomToOSS } from "@/utils/parseDicom.js";
import { dcmUpload } from "@/utils/dcmUpload/dcmUpload";
export default { export default {
name: "uploadImage", name: "uploadImage",
props: { props: {
@ -187,6 +328,7 @@ export default {
}, },
data() { data() {
return { return {
isLoad: false,
list: [], list: [],
StudyInstanceUidList: [], StudyInstanceUidList: [],
SopInstanceUidList: [], SopInstanceUidList: [],
@ -203,6 +345,14 @@ export default {
beforeClose() { beforeClose() {
this.$emit("update:visible", false); this.$emit("update:visible", false);
}, },
notUp() {
this.$confirm(this.$t("trials:uploadImage:confirmMessage:notUp"), {
type: "warning",
distinguishCancelAndClose: true,
confirmButtonText: this.$t("common:button:confirm"),
cancelButtonText: this.$t("common:button:cancel"),
});
},
// //
async getList() { async getList() {
try { try {
@ -223,6 +373,10 @@ export default {
data.VisitTaskId = item.VisitTaskId; data.VisitTaskId = item.VisitTaskId;
data.SourceSubjectVisitId = item.SourceSubjectVisitId; data.SourceSubjectVisitId = item.SourceSubjectVisitId;
this.StudyInstanceUidList.push(data); this.StudyInstanceUidList.push(data);
});
}
if (item.UploadStudyList && Array.isArray(item.UploadStudyList)) {
item.UploadStudyList.forEach((data) => {
data.SopInstanceUidList && data.SopInstanceUidList &&
this.SopInstanceUidList.push(...data.SopInstanceUidList); this.SopInstanceUidList.push(...data.SopInstanceUidList);
}); });
@ -235,7 +389,32 @@ export default {
} }
}, },
// //
remove(item) {}, async remove(item) {
try {
let confirm = await this.$confirm(
this.$t("trials:uploadImage:confirm:delMessage"),
{
type: "warning",
distinguishCancelAndClose: true,
confirmButtonText: this.$t("common:button:confirm"),
cancelButtonText: this.$t("common:button:cancel"),
}
);
if (confirm !== "confirm") return;
let params = {
VisitTaskId: item.VisitTaskId,
};
let res = await deleteTaskStudy(params);
if (res.IsSuccess) {
this.getList();
this.$message.success(
this.$t("trials:uploadImage:message:delSuccess")
);
}
} catch (err) {
console.log(err);
}
},
// //
async downloadImage(item) { async downloadImage(item) {
try { try {
@ -248,11 +427,23 @@ export default {
} }
}, },
// //
async preArchiveDicomStudy(post) { async preArchiveDicomStudy(post, index) {
try { try {
let res = await preArchiveDicomStudy(post); let res = await preArchiveDicomStudy(post);
if (res.IsSuccess) { if (res.IsSuccess) {
return res.Result; let item = this.uploadList[index];
item.StudyMonitorId = res.Result;
let arr = this.dicomList.filter(
(dicom) => dicom.StudyInstanceUid === item.StudyInstanceUid
);
let num = arr.length > this.requestNum ? this.requestNum : arr.length;
let funArr = [];
for (let i = 0; i < num; i++) {
funArr.push(this.handleUploadTask(arr, i));
}
if (funArr.length > 0) {
let res = await Promise.all(funArr);
}
} else { } else {
return false; return false;
} }
@ -275,8 +466,23 @@ export default {
!dicom || !dicom ||
!has || !has ||
this.SopInstanceUidList.includes(dicom.SopInstanceUid) this.SopInstanceUidList.includes(dicom.SopInstanceUid)
) ) {
if (i === files.length - 1 && this.dicomList.length <= 0) {
let confirm = await this.$confirm(
this.$t("trials:uploadImage:confirmMessage:failSubject"),
{
type: "warning",
distinguishCancelAndClose: true,
confirmButtonText: this.$t("common:button:confirm"),
cancelButtonText: this.$t("common:button:cancel"),
}
);
if (confirm !== "confirm") continue;
this.$refs.file.click();
}
continue; continue;
}
this.isLoad = true;
dicom.file = files[i]; dicom.file = files[i];
dicom.isUpload = 0; dicom.isUpload = 0;
this.StudyInstanceUidList.some((item) => { this.StudyInstanceUidList.some((item) => {
@ -287,8 +493,7 @@ export default {
VisitTaskId: item.VisitTaskId, VisitTaskId: item.VisitTaskId,
SourceSubjectVisitId: item.SourceSubjectVisitId, SourceSubjectVisitId: item.SourceSubjectVisitId,
}; };
let uploadHas = this.uploadList.some( let uploadHas = this.uploadList.some((uploadData) => {
(uploadData, uploadIndex) => {
if (uploadData.StudyInstanceUid === dicom.StudyInstanceUid) { if (uploadData.StudyInstanceUid === dicom.StudyInstanceUid) {
if (uploadData.status > 0) { if (uploadData.status > 0) {
uploadData.count = 1; uploadData.count = 1;
@ -298,22 +503,44 @@ export default {
uploadData.status = 0; uploadData.status = 0;
uploadData.FileSize = dicom.file.size; uploadData.FileSize = dicom.file.size;
uploadData.IsDicomReUpload = false; uploadData.IsDicomReUpload = false;
uploadData.SeriesInstanceUidList = [
dicom.SeriesInstanceUid,
];
uploadData.dicomInfo = {
AccessionNumber: dicom.AccessionNumber,
Modalities: dicom.Modalities,
seriesBodyPartExamined: dicom.seriesBodyPartExamined,
StudyDescription: dicom.StudyDescription,
StudyTime: this.getTime(dicom.StudyDate, dicom.StudyTime),
PatientName: dicom.PatientName,
PatientId: dicom.PatientId,
PatientAge: dicom.PatientAge,
PatientSex: dicom.PatientSex,
PatientBirthDate: dicom.PatientBirthDate,
};
} else { } else {
uploadData.FileSize += dicom.file.size; uploadData.FileSize += dicom.file.size;
uploadData.count++; uploadData.count++;
} }
if (
!uploadData.SeriesInstanceUidList.includes(
dicom.SeriesInstanceUid
)
) {
uploadData.SeriesInstanceUidList.push(
dicom.SeriesInstanceUid
);
}
if ( if (
item.SopInstanceUidList && item.SopInstanceUidList &&
item.SopInstanceUidList.length > 0 item.SopInstanceUidList.length > 0
) { ) {
uploadData.IsDicomReUpload = true; uploadData.IsDicomReUpload = true;
} }
dicom.uploadIndex = uploadIndex;
} }
return uploadData.StudyInstanceUid === dicom.StudyInstanceUid; return uploadData.StudyInstanceUid === dicom.StudyInstanceUid;
} });
);
if (!uploadHas) { if (!uploadHas) {
let uploadData = { let uploadData = {
TrialId: this.$route.query.trialId, TrialId: this.$route.query.trialId,
@ -327,7 +554,20 @@ export default {
failCount: 0, failCount: 0,
schedule: 0, schedule: 0,
status: 0, status: 0,
SeriesInstanceUidList: [dicom.SeriesInstanceUid],
IsDicomReUpload: false, IsDicomReUpload: false,
dicomInfo: {
AccessionNumber: dicom.AccessionNumber,
Modalities: dicom.Modalities,
seriesBodyPartExamined: dicom.seriesBodyPartExamined,
StudyDescription: dicom.StudyDescription,
StudyTime: this.getTime(dicom.StudyDate, dicom.StudyTime),
PatientName: dicom.PatientName,
PatientId: dicom.PatientId,
PatientAge: dicom.PatientAge,
PatientSex: dicom.PatientSex,
PatientBirthDate: dicom.PatientBirthDate,
},
}; };
if ( if (
item.SopInstanceUidList && item.SopInstanceUidList &&
@ -336,13 +576,13 @@ export default {
uploadData.IsDicomReUpload = true; uploadData.IsDicomReUpload = true;
} }
this.uploadList.push(uploadData); this.uploadList.push(uploadData);
dicom.uploadIndex = this.uploadList.length - 1;
} }
} }
return item.StudyInstanceUid === dicom.StudyInstanceUid; return item.StudyInstanceUid === dicom.StudyInstanceUid;
}); });
this.dicomList.push(dicom); this.dicomList.push(dicom);
} }
let funArr = [];
for (let i = 0; i < this.uploadList.length; i++) { for (let i = 0; i < this.uploadList.length; i++) {
let item = this.uploadList[i]; let item = this.uploadList[i];
let data = { let data = {
@ -353,21 +593,11 @@ export default {
IsDicomReUpload: item.IsDicomReUpload, IsDicomReUpload: item.IsDicomReUpload,
FileCount: item.count, FileCount: item.count,
}; };
let res = await this.preArchiveDicomStudy(data); funArr.push(this.preArchiveDicomStudy(data, i));
if (res) {
item.StudyMonitorId = res;
let arr = this.dicomList.filter((dicom) => dicom.uploadIndex === i);
let num =
arr.length > this.requestNum ? this.requestNum : arr.length;
let funArr = [];
for (let i = 0; i < num; i++) {
funArr.push(this.handleUploadTask(arr, i));
} }
if (funArr.length > 0) { if (funArr && funArr.length > 0) {
let res = await Promise.all(funArr); let res = await Promise.all(funArr);
} }
}
}
} catch (err) { } catch (err) {
console.log(err); console.log(err);
} }
@ -375,42 +605,58 @@ export default {
// //
async handleUploadTask(arr, index) { async handleUploadTask(arr, index) {
arr[index].isUpload = 1; arr[index].isUpload = 1;
let res = await this.dicomToOSS( let path = `/${arr[index].params.TrialId}/TaskImage/${
arr[index].file, arr[index].params.SubjectId
arr[index].params, }/${arr[index].params.VisitTaskId}/${
arr[index] arr[index].StudyInstanceUid
); }/${this.getGuid(
arr[index].StudyInstanceUid +
arr[index].SeriesInstanceUid +
arr[index].SOPInstanceUid +
arr[index].params.TrialId +
arr[index].params.VisitTaskId
)}`;
let uploadDicom = this.uploadList.filter(
(item) => item.StudyInstanceUid === arr[index].StudyInstanceUid
)[0];
let res = await dicomToOSS(arr[index].file, path);
if (res) { if (res) {
arr[index].path = res; arr[index].path = res;
this.uploadList[arr[index].uploadIndex].successCount++; uploadDicom.successCount++;
arr[index].isUpload = 2; arr[index].isUpload = 2;
} else { } else {
this.uploadList[arr[index].uploadIndex].status = 2; uploadDicom.status = 2;
this.uploadList[arr[index].uploadIndex].failCount++; uploadDicom.failCount++;
arr[index].isUpload = 3; arr[index].isUpload = 3;
} }
this.uploadList[arr[index].uploadIndex].schedule = Math.floor( uploadDicom.schedule = Math.floor(
((this.uploadList[arr[index].uploadIndex].successCount + ((uploadDicom.successCount + uploadDicom.failCount) /
this.uploadList[arr[index].uploadIndex].failCount) / uploadDicom.count) *
this.uploadList[arr[index].uploadIndex].count) *
100 100
); );
if ( if (
this.uploadList[arr[index].uploadIndex].schedule >= 100 && uploadDicom.schedule >= 100 &&
this.uploadList[arr[index].uploadIndex].successCount === uploadDicom.successCount === uploadDicom.count
this.uploadList[arr[index].uploadIndex].count
) { ) {
this.uploadList[arr[index].uploadIndex].status = 1; uploadDicom.status = 1;
let res = await this.formatDicom(arr, arr[index].uploadIndex); let res = await this.formatDicom(arr, arr[index].StudyInstanceUid);
if (res) { if (res) {
this.uploadList[arr[index].uploadIndex].Study = uploadDicom.Study = res[arr[index].StudyId];
res[arr[index].StudyId]; uploadDicom.status = 3;
this.uploadList[arr[index].uploadIndex].status = 3; try {
res = await addOrUpdateArchiveTaskStudy( res = await addOrUpdateArchiveTaskStudy(uploadDicom);
this.uploadList[arr[index].uploadIndex]
);
if (res.IsSuccess) { if (res.IsSuccess) {
uploadDicom.status = 4;
this.getList(); this.getList();
} else {
uploadDicom.status = 5;
}
let flag = this.uploadList.every((item) => item.status > 3);
if (flag) this.isLoad = false;
} catch (err) {
uploadDicom.status = 5;
let flag = this.uploadList.every((item) => item.status > 3);
if (flag) this.isLoad = false;
} }
} }
} }
@ -422,11 +668,12 @@ export default {
} }
}, },
// //
async formatDicom(arr, index) { async formatDicom(arr, StudyInstanceUid) {
let studyObj = {}; let studyObj = {};
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
let dicom = arr[i]; let dicom = arr[i];
if (dicom.uploadIndex !== index) continue; if (dicom.StudyInstanceUid !== StudyInstanceUid) continue;
let thumbnailPath = `/${dicom.params.TrialId}/TaskImage/${dicom.params.SubjectId}/${dicom.params.VisitTaskId}/${dicom.StudyInstanceUid}/${dicom.SeriesInstanceUid}.png`;
if (!studyObj[dicom.StudyId]) { if (!studyObj[dicom.StudyId]) {
studyObj[dicom.StudyId] = { studyObj[dicom.StudyId] = {
StudyId: dicom.StudyId, StudyId: dicom.StudyId,
@ -468,7 +715,7 @@ export default {
TriggerTime: dicom.TriggerTime, TriggerTime: dicom.TriggerTime,
ImageResizePath: await getThumbnail( ImageResizePath: await getThumbnail(
dicom.file, dicom.file,
dicom.params, thumbnailPath,
dicom dicom
), ),
InstanceList: [ InstanceList: [
@ -550,7 +797,7 @@ export default {
TriggerTime: dicom.TriggerTime, TriggerTime: dicom.TriggerTime,
ImageResizePath: await getThumbnail( ImageResizePath: await getThumbnail(
dicom.file, dicom.file,
dicom.params, thumbnailPath,
dicom dicom
), ),
InstanceList: [ InstanceList: [
@ -606,26 +853,6 @@ export default {
} }
return studyTime; return studyTime;
}, },
//
async dicomToOSS(file, params, dicomInfo) {
let path = `/${params.TrialId}/TaskImage/${params.SubjectId}/${
params.VisitTaskId
}/${dicomInfo.StudyInstanceUid}/${this.getGuid(
dicomInfo.StudyInstanceUid +
dicomInfo.SeriesInstanceUid +
dicomInfo.SOPInstanceUid +
params.TrialId +
params.VisitTaskId
)}`;
try {
let res = await dcmUpload(path, file);
if (!res || !res.url) return false;
return this.$getObjectName(res.url);
} catch (err) {
console.log(err);
return false;
}
},
}, },
}; };
</script> </script>
@ -633,18 +860,12 @@ export default {
label { label {
cursor: pointer; cursor: pointer;
} }
.line { ::v-deep .el-dialog {
width: 100%; .el-dialog__header {
display: flex; padding-top: 15px;
align-items: center;
justify-content: space-between;
margin: 20px 0;
&::after {
display: block;
content: "";
flex: 1;
height: 1px;
border-top: 1px solid #ddd;
} }
} }
.colorOfRed {
color: #f44336;
}
</style> </style>

View File

@ -5,6 +5,7 @@ cornerstoneWADOImageLoader.external.dicomParser = dicomParser;
cornerstoneWADOImageLoader.external.cornerstone = cornerstone; cornerstoneWADOImageLoader.external.cornerstone = cornerstone;
import { convertBytes } from "@/utils/dicom-character-set"; import { convertBytes } from "@/utils/dicom-character-set";
import Vue from 'vue'; import Vue from 'vue';
import { dcmUpload } from "@/utils/dcmUpload/dcmUpload";
let dicom = { let dicom = {
PatientName: "x00100010", // 患者姓名 PatientName: "x00100010", // 患者姓名
PatientId: "x00100020", // 患者ID PatientId: "x00100020", // 患者ID
@ -133,8 +134,20 @@ export const parseDicom = (file, name = false) => {
reader.readAsArrayBuffer(file); reader.readAsArrayBuffer(file);
}); });
}; };
// 影像上传
// 影像上传
export const dicomToOSS = async (file, path) => {
try {
let res = await dcmUpload(path, file);
if (!res || !res.url) return false;
return Vue.prototype.$getObjectName(res.url);
} catch (err) {
console.log(err);
return false;
}
};
// 获取缩略图 // 获取缩略图
export const getThumbnail = async (file, params, dicomInfo) => { export const getThumbnail = async (file, ossPath, dicomInfo) => {
try { try {
if (dicomInfo.modality !== "SR") { if (dicomInfo.modality !== "SR") {
let fileId = cornerstoneWADOImageLoader.wadouri.fileManager.add(file); let fileId = cornerstoneWADOImageLoader.wadouri.fileManager.add(file);
@ -144,9 +157,8 @@ export const getThumbnail = async (file, params, dicomInfo) => {
dicomInfo.Rows dicomInfo.Rows
); );
if (!blob) return ""; if (!blob) return "";
let thumbnailPath = `/${params.TrialId}/TaskImage/${params.SubjectId}/${params.VisitTaskId}/${dicomInfo.StudyInstanceUid}/${dicomInfo.SeriesInstanceUid}.png`;
let OSSclient = Vue.prototype.OSSclient; let OSSclient = Vue.prototype.OSSclient;
let seriesRes = await OSSclient.put(thumbnailPath, blob); let seriesRes = await OSSclient.put(ossPath, blob);
if (seriesRes && seriesRes.url) { if (seriesRes && seriesRes.url) {
return Vue.prototype.$getObjectName(seriesRes.url); return Vue.prototype.$getObjectName(seriesRes.url);
} else { } else {