Merge branch 'main' of https://gitea.frp.extimaging.com/XCKJ/irc_web into main
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
d27ed741db
|
@ -0,0 +1,95 @@
|
|||
<template>
|
||||
<base-model :config="model_cfg">
|
||||
<div slot="dialog-body">
|
||||
<el-table :data="modelList" style="width: 100%" height="300">
|
||||
<!--检查编号-->
|
||||
<el-table-column
|
||||
prop="StudyCode"
|
||||
:label="$t('trials:uploadImage:table:StudyCode')"
|
||||
/>
|
||||
<!--检查类型-->
|
||||
<el-table-column
|
||||
prop="ModalityForEdit"
|
||||
:label="$t('trials:uploadImage:table:ModalityForEdit')"
|
||||
/>
|
||||
<!--检查模态-->
|
||||
<el-table-column
|
||||
prop="Modalities"
|
||||
:label="$t('trials:uploadImage:table:Modalities')"
|
||||
/>
|
||||
<!--检查部位-->
|
||||
<el-table-column
|
||||
prop="BodyPartForEdit"
|
||||
:label="$t('trials:uploadImage:table:BodyPartForEdit')"
|
||||
/>
|
||||
<!--序列数量-->
|
||||
<el-table-column
|
||||
prop="SeriesCount"
|
||||
:label="$t('trials:uploadImage:table:SeriesCount')"
|
||||
/>
|
||||
<!--图像数量-->
|
||||
<el-table-column
|
||||
prop="InstanceCount"
|
||||
:label="$t('trials:uploadImage:table:InstanceCount')"
|
||||
/>
|
||||
<!--检查时间-->
|
||||
<el-table-column
|
||||
prop="StudyTime"
|
||||
:label="$t('trials:uploadImage:table:StudyTime')"
|
||||
min-width="130"
|
||||
/>
|
||||
<el-table-column
|
||||
:label="$t('common:action:action')"
|
||||
fixed="right"
|
||||
width="80"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<!--预览--->
|
||||
<el-button
|
||||
circle
|
||||
icon="el-icon-view"
|
||||
:title="$t('trials:uploadImage:button:download')"
|
||||
@click.stop="preview(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</base-model>
|
||||
</template>
|
||||
<script>
|
||||
import baseModel from "@/components/BaseModel";
|
||||
import { getToken } from "@/utils/auth";
|
||||
export default {
|
||||
name: "studyView",
|
||||
props: {
|
||||
model_cfg: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
modelList: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
components: {
|
||||
"base-model": baseModel,
|
||||
},
|
||||
methods: {
|
||||
// 预览
|
||||
preview(row) {
|
||||
var token = getToken();
|
||||
const routeData = this.$router.resolve({
|
||||
path: `/showdicom?studyId=${row.Id}&TokenKey=${token}&type=Study`,
|
||||
});
|
||||
window.open(routeData.href, "_blank");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
|
@ -0,0 +1,683 @@
|
|||
<template>
|
||||
<div class="uploadList">
|
||||
<el-divider content-position="left">{{
|
||||
$t("trials:uploadImage:button:uploadTableTitle")
|
||||
}}</el-divider>
|
||||
<div class="top" style="margin-bottom: 10px">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
class="el-icon-upload2"
|
||||
v-if="!isLoad"
|
||||
>
|
||||
<label for="file">
|
||||
{{ $t("trials:uploadImage:button:selectFolder") }}
|
||||
</label>
|
||||
</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
|
||||
type="file"
|
||||
name="file"
|
||||
id="file"
|
||||
ref="file"
|
||||
style="display: none"
|
||||
webkitdirectory
|
||||
multiple
|
||||
@change="beginScanFiles($event)"
|
||||
/>
|
||||
</div>
|
||||
<!--本地影像检查-->
|
||||
<el-table
|
||||
:data="uploadList"
|
||||
style="width: 100%"
|
||||
v-adaptive="{ bottomOffset: 50 }"
|
||||
>
|
||||
<el-table-column type="index" width="40" />
|
||||
<!--检查信息-->
|
||||
<el-table-column min-width="200" show-overflow-tooltip>
|
||||
<template slot="header">
|
||||
<el-tooltip placement="top">
|
||||
<div slot="content">
|
||||
{{ $t("trials:uploadImage:table:studyDetail1") }}<br />
|
||||
{{ $t("trials:uploadImage:table:studyDetail2") }}<br />
|
||||
{{ $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
|
||||
prop="schedule"
|
||||
:label="$t('trials:uploadImage:table:schedule')"
|
||||
min-width="150"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-progress
|
||||
color="#409eff"
|
||||
:percentage="scope.row.schedule"
|
||||
v-if="scope.row.schedule || scope.row.schedule === 0"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!--上传状态-->
|
||||
<el-table-column
|
||||
prop="status"
|
||||
:label="$t('trials:uploadImage:table:status')"
|
||||
min-width="120"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
:type="
|
||||
['warning', 'success', 'danger', 'primary', 'success', 'danger'][
|
||||
scope.row.status
|
||||
]
|
||||
"
|
||||
size="mini"
|
||||
plain
|
||||
v-if="scope.row.status || scope.row.status === 0"
|
||||
>{{ $fd("UploadStatus", scope.row.status) }}</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!--已有/成功/失败-->
|
||||
<el-table-column
|
||||
prop="scheduleNum"
|
||||
:label="$t('trials:uploadImage:table:scheduleNum')"
|
||||
min-width="140"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.count">{{
|
||||
`${scope.row.count} /${scope.row.successCount} / ${scope.row.failCount}`
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="$t('common:action:action')"
|
||||
fixed="right"
|
||||
width="140"
|
||||
>
|
||||
<!-- <template slot-scope="scope">
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
preArchiveDicomStudy,
|
||||
addOrUpdateArchiveTaskStudy,
|
||||
} from "@/api/load.js";
|
||||
import { parseDicom, getThumbnail, dicomToOSS } from "@/utils/parseDicom.js";
|
||||
export default {
|
||||
name: "uploadList",
|
||||
props: {
|
||||
SopInstanceUidList: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
StudyInstanceUidList: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoad: false,
|
||||
uploadList: [], // 待上传文件列表
|
||||
dicomList: [], // 上传的文件列表
|
||||
requestNum: 6,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 预上传
|
||||
async preArchiveDicomStudy(post, index) {
|
||||
try {
|
||||
let res = await preArchiveDicomStudy(post);
|
||||
if (res.IsSuccess) {
|
||||
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 {
|
||||
return false;
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
// 上传
|
||||
async beginScanFiles(e) {
|
||||
let files = e.target.files;
|
||||
try {
|
||||
this.dicomList = [];
|
||||
for (var i = 0; i < files.length; ++i) {
|
||||
let dicom = await parseDicom(files[i]);
|
||||
let has = this.StudyInstanceUidList.some(
|
||||
(item) => item.StudyInstanceUid === dicom.StudyInstanceUid
|
||||
);
|
||||
if (
|
||||
!dicom ||
|
||||
!has ||
|
||||
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;
|
||||
}
|
||||
this.isLoad = true;
|
||||
dicom.file = files[i];
|
||||
dicom.isUpload = 0;
|
||||
this.StudyInstanceUidList.some((item) => {
|
||||
if (item.StudyInstanceUid === dicom.StudyInstanceUid) {
|
||||
dicom.params = {
|
||||
TrialId: this.$route.query.trialId,
|
||||
SubjectId: item.SubjectId,
|
||||
VisitTaskId: item.VisitTaskId,
|
||||
SourceSubjectVisitId: item.SourceSubjectVisitId,
|
||||
};
|
||||
let uploadHas = this.uploadList.some((uploadData) => {
|
||||
if (uploadData.StudyInstanceUid === dicom.StudyInstanceUid) {
|
||||
if (uploadData.status > 0) {
|
||||
uploadData.count = 1;
|
||||
uploadData.successCount = 0;
|
||||
uploadData.failCount = 0;
|
||||
uploadData.schedule = 0;
|
||||
uploadData.status = 0;
|
||||
uploadData.FileSize = dicom.file.size;
|
||||
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 {
|
||||
uploadData.FileSize += dicom.file.size;
|
||||
uploadData.count++;
|
||||
}
|
||||
if (
|
||||
!uploadData.SeriesInstanceUidList.includes(
|
||||
dicom.SeriesInstanceUid
|
||||
)
|
||||
) {
|
||||
uploadData.SeriesInstanceUidList.push(
|
||||
dicom.SeriesInstanceUid
|
||||
);
|
||||
}
|
||||
if (
|
||||
item.SopInstanceUidList &&
|
||||
item.SopInstanceUidList.length > 0
|
||||
) {
|
||||
uploadData.IsDicomReUpload = true;
|
||||
}
|
||||
}
|
||||
|
||||
return uploadData.StudyInstanceUid === dicom.StudyInstanceUid;
|
||||
});
|
||||
if (!uploadHas) {
|
||||
let uploadData = {
|
||||
TrialId: this.$route.query.trialId,
|
||||
SubjectId: item.SubjectId,
|
||||
SourceSubjectVisitId: item.SourceSubjectVisitId,
|
||||
StudyId: dicom.StudyId,
|
||||
StudyInstanceUid: dicom.StudyInstanceUid,
|
||||
FileSize: dicom.file.size,
|
||||
count: 1,
|
||||
successCount: 0,
|
||||
failCount: 0,
|
||||
schedule: 0,
|
||||
status: 0,
|
||||
SeriesInstanceUidList: [dicom.SeriesInstanceUid],
|
||||
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 (
|
||||
item.SopInstanceUidList &&
|
||||
item.SopInstanceUidList.length > 0
|
||||
) {
|
||||
uploadData.IsDicomReUpload = true;
|
||||
}
|
||||
this.uploadList.push(uploadData);
|
||||
}
|
||||
}
|
||||
return item.StudyInstanceUid === dicom.StudyInstanceUid;
|
||||
});
|
||||
this.dicomList.push(dicom);
|
||||
}
|
||||
let funArr = [];
|
||||
for (let i = 0; i < this.uploadList.length; i++) {
|
||||
let item = this.uploadList[i];
|
||||
let data = {
|
||||
TrialId: item.TrialId,
|
||||
SubjectId: item.SubjectId,
|
||||
SubjectVisitId: item.SourceSubjectVisitId,
|
||||
FileSize: item.FileSize,
|
||||
IsDicomReUpload: item.IsDicomReUpload,
|
||||
FileCount: item.count,
|
||||
};
|
||||
funArr.push(this.preArchiveDicomStudy(data, i));
|
||||
}
|
||||
if (funArr && funArr.length > 0) {
|
||||
let res = await Promise.all(funArr);
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
},
|
||||
// 并发上传
|
||||
async handleUploadTask(arr, index) {
|
||||
arr[index].isUpload = 1;
|
||||
let path = `/${arr[index].params.TrialId}/TaskImage/${
|
||||
arr[index].params.SubjectId
|
||||
}/${arr[index].params.VisitTaskId}/${
|
||||
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) {
|
||||
arr[index].path = res;
|
||||
uploadDicom.successCount++;
|
||||
arr[index].isUpload = 2;
|
||||
} else {
|
||||
uploadDicom.status = 2;
|
||||
uploadDicom.failCount++;
|
||||
arr[index].isUpload = 3;
|
||||
}
|
||||
uploadDicom.schedule = Math.floor(
|
||||
((uploadDicom.successCount + uploadDicom.failCount) /
|
||||
uploadDicom.count) *
|
||||
100
|
||||
);
|
||||
if (
|
||||
uploadDicom.schedule >= 100 &&
|
||||
uploadDicom.successCount === uploadDicom.count
|
||||
) {
|
||||
uploadDicom.status = 1;
|
||||
let res = await this.formatDicom(arr, arr[index].StudyInstanceUid);
|
||||
if (res) {
|
||||
uploadDicom.Study = res[arr[index].StudyId];
|
||||
uploadDicom.status = 3;
|
||||
try {
|
||||
res = await addOrUpdateArchiveTaskStudy(uploadDicom);
|
||||
if (res.IsSuccess) {
|
||||
uploadDicom.status = 4;
|
||||
this.$emit("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;
|
||||
}
|
||||
}
|
||||
}
|
||||
let ind = arr.findIndex((item) => !item.isUpload);
|
||||
if (ind >= 0) {
|
||||
return this.handleUploadTask(arr, ind);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
// 数据整理
|
||||
async formatDicom(arr, StudyInstanceUid) {
|
||||
let studyObj = {};
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
let dicom = arr[i];
|
||||
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]) {
|
||||
studyObj[dicom.StudyId] = {
|
||||
StudyId: dicom.StudyId,
|
||||
StudyInstanceUid: dicom.StudyInstanceUid,
|
||||
StudyTime: this.getTime(dicom.StudyDate, dicom.StudyTime),
|
||||
Modalities: dicom.Modalities,
|
||||
Description: dicom.StudyDescription,
|
||||
SeriesCount: 1,
|
||||
InstanceCount: 1,
|
||||
InstitutionName: dicom.InstitutionName,
|
||||
PatientId: dicom.PatientId,
|
||||
PatientName: dicom.PatientName,
|
||||
PatientAge: dicom.PatientAge,
|
||||
PatientSex: dicom.PatientSex,
|
||||
AccessionNumber: dicom.AccessionNumber,
|
||||
PatientBirthDate: dicom.PatientBirthDate,
|
||||
AcquisitionTime: dicom.AcquisitionTime,
|
||||
AcquisitionNumber: dicom.AcquisitionNumber,
|
||||
TriggerTime: dicom.TriggerTime,
|
||||
BodyPartExamined: dicom.BodyPartExamined,
|
||||
SeriesList: [
|
||||
{
|
||||
StudyInstanceUid: dicom.StudyInstanceUid,
|
||||
SeriesInstanceUid: dicom.SeriesInstanceUid,
|
||||
SeriesNumber: dicom.SeriesNumber,
|
||||
SeriesTime: this.getTime(dicom.SeriesDate, dicom.SeriesTime),
|
||||
Modality: dicom.Modality,
|
||||
Description: dicom.SeriesDescription,
|
||||
InstanceCount: 1,
|
||||
SliceThickness: dicom.SliceThickness,
|
||||
ImagePositionPatient: dicom.ImagePosition,
|
||||
ImageOrientationPatient: dicom.ImageOrientation,
|
||||
BodyPartExamined: dicom.seriesBodyPartExamined,
|
||||
SequenceName: dicom.SequenceName,
|
||||
ProtocolName: dicom.ProtocolName,
|
||||
ImagerPixelSpacing: dicom.ImagePixelSpacing,
|
||||
AcquisitionTime: dicom.AcquisitionTime,
|
||||
AcquisitionNumber: dicom.AcquisitionNumber,
|
||||
TriggerTime: dicom.TriggerTime,
|
||||
ImageResizePath: await getThumbnail(
|
||||
dicom.file,
|
||||
thumbnailPath,
|
||||
dicom
|
||||
),
|
||||
InstanceList: [
|
||||
{
|
||||
StudyInstanceUid: dicom.StudyInstanceUid,
|
||||
SeriesInstanceUid: dicom.SeriesInstanceUid,
|
||||
SopInstanceUid: dicom.SopInstanceUid,
|
||||
InstanceNumber: dicom.ImageOrInstanceNumber,
|
||||
InstanceTime: this.getTime(
|
||||
dicom.ContentDate,
|
||||
dicom.ContentTime
|
||||
),
|
||||
ImageRows: dicom.Rows || 0,
|
||||
ImageColumns: dicom.Columns || 0,
|
||||
SliceLocation: dicom.SliceLocation,
|
||||
SliceThickness: dicom.SliceThickness,
|
||||
NumberOfFrames: dicom.NumberOfFrames || 0,
|
||||
PixelSpacing: dicom.PixelSpacing,
|
||||
ImagerPixelSpacing: dicom.ImagePixelSpacing,
|
||||
FrameOfReferenceUID: dicom.FrameOfReferenceUID,
|
||||
WindowCenter: dicom.WindowCenter,
|
||||
WindowWidth: dicom.WindowWidth,
|
||||
Path: dicom.path,
|
||||
HtmlPath: "",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
} else {
|
||||
let seriesHas = studyObj[dicom.StudyId].SeriesList.some((item) => {
|
||||
if (item.SeriesInstanceUid === dicom.SeriesInstanceUid) {
|
||||
item.InstanceCount++;
|
||||
let instance = {
|
||||
StudyInstanceUid: dicom.StudyInstanceUid,
|
||||
SeriesInstanceUid: dicom.SeriesInstanceUid,
|
||||
SopInstanceUid: dicom.SopInstanceUid,
|
||||
InstanceNumber: dicom.ImageOrInstanceNumber,
|
||||
InstanceTime: this.getTime(
|
||||
dicom.ContentDate,
|
||||
dicom.ContentTime
|
||||
),
|
||||
ImageRows: dicom.Rows || 0,
|
||||
ImageColumns: dicom.Columns || 0,
|
||||
SliceLocation: dicom.SliceLocation,
|
||||
SliceThickness: dicom.SliceThickness,
|
||||
NumberOfFrames: dicom.NumberOfFrames || 0,
|
||||
PixelSpacing: dicom.PixelSpacing,
|
||||
ImagerPixelSpacing: dicom.ImagePixelSpacing,
|
||||
FrameOfReferenceUID: dicom.FrameOfReferenceUID,
|
||||
WindowCenter: dicom.WindowCenter,
|
||||
WindowWidth: dicom.WindowWidth,
|
||||
Path: dicom.path,
|
||||
HtmlPath: "",
|
||||
};
|
||||
item.InstanceList.push(instance);
|
||||
}
|
||||
return item.SeriesInstanceUid === dicom.SeriesInstanceUid;
|
||||
});
|
||||
if (!seriesHas) {
|
||||
studyObj[dicom.StudyId].SeriesCount++;
|
||||
let series = {
|
||||
StudyInstanceUid: dicom.StudyInstanceUid,
|
||||
SeriesInstanceUid: dicom.SeriesInstanceUid,
|
||||
SeriesNumber: dicom.SeriesNumber,
|
||||
SeriesTime: this.getTime(dicom.SeriesDate, dicom.SeriesTime),
|
||||
Modality: dicom.Modality,
|
||||
Description: dicom.SeriesDescription,
|
||||
InstanceCount: 1,
|
||||
SliceThickness: dicom.SliceThickness,
|
||||
ImagePositionPatient: dicom.ImagePosition,
|
||||
ImageOrientationPatient: dicom.ImageOrientation,
|
||||
BodyPartExamined: dicom.seriesBodyPartExamined,
|
||||
SequenceName: dicom.SequenceName,
|
||||
ProtocolName: dicom.ProtocolName,
|
||||
ImagerPixelSpacing: dicom.ImagePixelSpacing,
|
||||
AcquisitionTime: dicom.AcquisitionTime,
|
||||
AcquisitionNumber: dicom.AcquisitionNumber,
|
||||
TriggerTime: dicom.TriggerTime,
|
||||
ImageResizePath: await getThumbnail(
|
||||
dicom.file,
|
||||
thumbnailPath,
|
||||
dicom
|
||||
),
|
||||
InstanceList: [
|
||||
{
|
||||
StudyInstanceUid: dicom.StudyInstanceUid,
|
||||
SeriesInstanceUid: dicom.SeriesInstanceUid,
|
||||
SopInstanceUid: dicom.SopInstanceUid,
|
||||
InstanceNumber: dicom.ImageOrInstanceNumber,
|
||||
InstanceTime: this.getTime(
|
||||
dicom.ContentDate,
|
||||
dicom.ContentTime
|
||||
),
|
||||
ImageRows: dicom.Rows || 0,
|
||||
ImageColumns: dicom.Columns || 0,
|
||||
SliceLocation: dicom.SliceLocation,
|
||||
SliceThickness: dicom.SliceThickness,
|
||||
NumberOfFrames: dicom.NumberOfFrames || 0,
|
||||
PixelSpacing: dicom.PixelSpacing,
|
||||
ImagerPixelSpacing: dicom.ImagePixelSpacing,
|
||||
FrameOfReferenceUID: dicom.FrameOfReferenceUID,
|
||||
WindowCenter: dicom.WindowCenter,
|
||||
WindowWidth: dicom.WindowWidth,
|
||||
Path: dicom.path,
|
||||
HtmlPath: "",
|
||||
},
|
||||
],
|
||||
};
|
||||
studyObj[dicom.StudyId].SeriesList.push(series);
|
||||
}
|
||||
studyObj[dicom.StudyId].InstanceCount++;
|
||||
}
|
||||
}
|
||||
return studyObj;
|
||||
},
|
||||
// dicom时间转换
|
||||
getTime(date, time) {
|
||||
let studyTime = "";
|
||||
if (date) {
|
||||
date = `${date.substring(0, 4)}-${date.substring(
|
||||
4,
|
||||
6
|
||||
)}-${date.substring(6, 8)}`;
|
||||
}
|
||||
if (time) {
|
||||
time = `${time.substring(0, 2)}:${time.substring(
|
||||
2,
|
||||
4
|
||||
)}:${time.substring(4, 6)}`;
|
||||
}
|
||||
if (date) {
|
||||
studyTime = time ? `${date} ${time}` : `${date} 00:00:00`;
|
||||
}
|
||||
return studyTime;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.colorOfRed {
|
||||
color: #f44336;
|
||||
}
|
||||
</style>
|
|
@ -75,294 +75,24 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-divider content-position="left">{{
|
||||
$t("trials:uploadImage:button:uploadTableTitle")
|
||||
}}</el-divider>
|
||||
<div
|
||||
class="top"
|
||||
style="margin-bottom: 10px"
|
||||
<upload-list
|
||||
v-if="Criterion.ImageUploadEnum > 0"
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
class="el-icon-upload2"
|
||||
v-if="!isLoad"
|
||||
>
|
||||
<label for="file">
|
||||
{{ $t("trials:uploadImage:button:selectFolder") }}
|
||||
</label>
|
||||
</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
|
||||
type="file"
|
||||
name="file"
|
||||
id="file"
|
||||
ref="file"
|
||||
style="display: none"
|
||||
webkitdirectory
|
||||
multiple
|
||||
@change="beginScanFiles($event)"
|
||||
:StudyInstanceUidList="StudyInstanceUidList"
|
||||
:SopInstanceUidList="SopInstanceUidList"
|
||||
@getList="getList"
|
||||
/>
|
||||
</div>
|
||||
<!--本地影像检查-->
|
||||
<el-table
|
||||
:data="uploadList"
|
||||
style="width: 100%"
|
||||
v-adaptive="{ bottomOffset: 50 }"
|
||||
>
|
||||
<el-table-column type="index" width="40" />
|
||||
<!--检查信息-->
|
||||
<el-table-column min-width="200" show-overflow-tooltip>
|
||||
<template slot="header">
|
||||
<el-tooltip placement="top">
|
||||
<div slot="content">
|
||||
{{ $t("trials:uploadImage:table:studyDetail1") }}<br />
|
||||
{{ $t("trials:uploadImage:table:studyDetail2") }}<br />
|
||||
{{ $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
|
||||
prop="schedule"
|
||||
:label="$t('trials:uploadImage:table:schedule')"
|
||||
min-width="150"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-progress
|
||||
color="#409eff"
|
||||
:percentage="scope.row.schedule"
|
||||
v-if="scope.row.schedule || scope.row.schedule === 0"
|
||||
<study-view
|
||||
v-if="model_cfg.visible"
|
||||
:model_cfg="model_cfg"
|
||||
:modelList="modelList"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!--上传状态-->
|
||||
<el-table-column
|
||||
prop="status"
|
||||
:label="$t('trials:uploadImage:table:status')"
|
||||
min-width="120"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
:type="
|
||||
['warning', 'success', 'danger', 'primary', 'success', 'danger'][
|
||||
scope.row.status
|
||||
]
|
||||
"
|
||||
size="mini"
|
||||
plain
|
||||
v-if="scope.row.status || scope.row.status === 0"
|
||||
>{{ $fd("UploadStatus", scope.row.status) }}</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!--已有/成功/失败-->
|
||||
<el-table-column
|
||||
prop="scheduleNum"
|
||||
:label="$t('trials:uploadImage:table:scheduleNum')"
|
||||
min-width="140"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.count">{{
|
||||
`${scope.row.count} /${scope.row.successCount} / ${scope.row.failCount}`
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="$t('common:action:action')"
|
||||
fixed="right"
|
||||
width="140"
|
||||
>
|
||||
<!-- <template slot-scope="scope">
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<base-model :config="model_cfg">
|
||||
<div slot="dialog-body">
|
||||
<el-table :data="modelList" style="width: 100%" height="300">
|
||||
<!--检查编号-->
|
||||
<el-table-column
|
||||
prop="StudyCode"
|
||||
:label="$t('trials:uploadImage:table:StudyCode')"
|
||||
/>
|
||||
<!--检查类型-->
|
||||
<el-table-column
|
||||
prop="ModalityForEdit"
|
||||
:label="$t('trials:uploadImage:table:ModalityForEdit')"
|
||||
/>
|
||||
<!--检查模态-->
|
||||
<el-table-column
|
||||
prop="Modalities"
|
||||
:label="$t('trials:uploadImage:table:Modalities')"
|
||||
/>
|
||||
<!--检查部位-->
|
||||
<el-table-column
|
||||
prop="BodyPartForEdit"
|
||||
:label="$t('trials:uploadImage:table:BodyPartForEdit')"
|
||||
/>
|
||||
<!--序列数量-->
|
||||
<el-table-column
|
||||
prop="SeriesCount"
|
||||
:label="$t('trials:uploadImage:table:SeriesCount')"
|
||||
/>
|
||||
<!--图像数量-->
|
||||
<el-table-column
|
||||
prop="InstanceCount"
|
||||
:label="$t('trials:uploadImage:table:InstanceCount')"
|
||||
/>
|
||||
<!--检查时间-->
|
||||
<el-table-column
|
||||
prop="StudyTime"
|
||||
:label="$t('trials:uploadImage:table:StudyTime')"
|
||||
min-width="130"
|
||||
/>
|
||||
<el-table-column
|
||||
:label="$t('common:action:action')"
|
||||
fixed="right"
|
||||
width="80"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<!--预览--->
|
||||
<el-button
|
||||
circle
|
||||
icon="el-icon-view"
|
||||
:title="$t('trials:uploadImage:button:download')"
|
||||
@click.stop="preview(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</base-model>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import baseModel from "@/components/BaseModel";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import {
|
||||
getSubjectImageUploadList,
|
||||
preArchiveDicomStudy,
|
||||
addOrUpdateArchiveTaskStudy,
|
||||
deleteTaskStudy,
|
||||
} from "@/api/load.js";
|
||||
import uploadList from "./components/upload-list.vue";
|
||||
import studyView from "./components/study-view.vue";
|
||||
import { getSubjectImageUploadList, deleteTaskStudy } from "@/api/load.js";
|
||||
import { downloadImage } from "@/utils/uploadZip.js";
|
||||
import { parseDicom, getThumbnail, dicomToOSS } from "@/utils/parseDicom.js";
|
||||
export default {
|
||||
name: "uploadImage",
|
||||
props: {
|
||||
|
@ -382,19 +112,15 @@ export default {
|
|||
},
|
||||
},
|
||||
components: {
|
||||
"base-model": baseModel,
|
||||
"upload-list": uploadList,
|
||||
"study-view": studyView,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoad: false,
|
||||
list: [],
|
||||
StudyInstanceUidList: [],
|
||||
SopInstanceUidList: [],
|
||||
|
||||
uploadList: [], // 待上传文件列表
|
||||
dicomList: [], // 上传的文件列表
|
||||
requestNum: 6,
|
||||
|
||||
// 检查数弹框
|
||||
model_cfg: {
|
||||
visible: false,
|
||||
|
@ -489,14 +215,6 @@ export default {
|
|||
this.modelList = item[list];
|
||||
this.model_cfg.visible = true;
|
||||
},
|
||||
// 预览
|
||||
preview(row) {
|
||||
var token = getToken();
|
||||
const routeData = this.$router.resolve({
|
||||
path: `/showdicom?studyId=${row.Id}&TokenKey=${token}&type=Study`,
|
||||
});
|
||||
window.open(routeData.href, "_blank");
|
||||
},
|
||||
// 打包下载
|
||||
async downloadImage(item) {
|
||||
try {
|
||||
|
@ -508,433 +226,6 @@ export default {
|
|||
console.log(err);
|
||||
}
|
||||
},
|
||||
// 预上传
|
||||
async preArchiveDicomStudy(post, index) {
|
||||
try {
|
||||
let res = await preArchiveDicomStudy(post);
|
||||
if (res.IsSuccess) {
|
||||
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 {
|
||||
return false;
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
// 上传
|
||||
async beginScanFiles(e) {
|
||||
let files = e.target.files;
|
||||
try {
|
||||
this.dicomList = [];
|
||||
for (var i = 0; i < files.length; ++i) {
|
||||
let dicom = await parseDicom(files[i]);
|
||||
let has = this.StudyInstanceUidList.some(
|
||||
(item) => item.StudyInstanceUid === dicom.StudyInstanceUid
|
||||
);
|
||||
if (
|
||||
!dicom ||
|
||||
!has ||
|
||||
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;
|
||||
}
|
||||
this.isLoad = true;
|
||||
dicom.file = files[i];
|
||||
dicom.isUpload = 0;
|
||||
this.StudyInstanceUidList.some((item) => {
|
||||
if (item.StudyInstanceUid === dicom.StudyInstanceUid) {
|
||||
dicom.params = {
|
||||
TrialId: this.$route.query.trialId,
|
||||
SubjectId: item.SubjectId,
|
||||
VisitTaskId: item.VisitTaskId,
|
||||
SourceSubjectVisitId: item.SourceSubjectVisitId,
|
||||
};
|
||||
let uploadHas = this.uploadList.some((uploadData) => {
|
||||
if (uploadData.StudyInstanceUid === dicom.StudyInstanceUid) {
|
||||
if (uploadData.status > 0) {
|
||||
uploadData.count = 1;
|
||||
uploadData.successCount = 0;
|
||||
uploadData.failCount = 0;
|
||||
uploadData.schedule = 0;
|
||||
uploadData.status = 0;
|
||||
uploadData.FileSize = dicom.file.size;
|
||||
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 {
|
||||
uploadData.FileSize += dicom.file.size;
|
||||
uploadData.count++;
|
||||
}
|
||||
if (
|
||||
!uploadData.SeriesInstanceUidList.includes(
|
||||
dicom.SeriesInstanceUid
|
||||
)
|
||||
) {
|
||||
uploadData.SeriesInstanceUidList.push(
|
||||
dicom.SeriesInstanceUid
|
||||
);
|
||||
}
|
||||
if (
|
||||
item.SopInstanceUidList &&
|
||||
item.SopInstanceUidList.length > 0
|
||||
) {
|
||||
uploadData.IsDicomReUpload = true;
|
||||
}
|
||||
}
|
||||
|
||||
return uploadData.StudyInstanceUid === dicom.StudyInstanceUid;
|
||||
});
|
||||
if (!uploadHas) {
|
||||
let uploadData = {
|
||||
TrialId: this.$route.query.trialId,
|
||||
SubjectId: item.SubjectId,
|
||||
SourceSubjectVisitId: item.SourceSubjectVisitId,
|
||||
StudyId: dicom.StudyId,
|
||||
StudyInstanceUid: dicom.StudyInstanceUid,
|
||||
FileSize: dicom.file.size,
|
||||
count: 1,
|
||||
successCount: 0,
|
||||
failCount: 0,
|
||||
schedule: 0,
|
||||
status: 0,
|
||||
SeriesInstanceUidList: [dicom.SeriesInstanceUid],
|
||||
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 (
|
||||
item.SopInstanceUidList &&
|
||||
item.SopInstanceUidList.length > 0
|
||||
) {
|
||||
uploadData.IsDicomReUpload = true;
|
||||
}
|
||||
this.uploadList.push(uploadData);
|
||||
}
|
||||
}
|
||||
return item.StudyInstanceUid === dicom.StudyInstanceUid;
|
||||
});
|
||||
this.dicomList.push(dicom);
|
||||
}
|
||||
let funArr = [];
|
||||
for (let i = 0; i < this.uploadList.length; i++) {
|
||||
let item = this.uploadList[i];
|
||||
let data = {
|
||||
TrialId: item.TrialId,
|
||||
SubjectId: item.SubjectId,
|
||||
SubjectVisitId: item.SourceSubjectVisitId,
|
||||
FileSize: item.FileSize,
|
||||
IsDicomReUpload: item.IsDicomReUpload,
|
||||
FileCount: item.count,
|
||||
};
|
||||
funArr.push(this.preArchiveDicomStudy(data, i));
|
||||
}
|
||||
if (funArr && funArr.length > 0) {
|
||||
let res = await Promise.all(funArr);
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
},
|
||||
// 并发上传
|
||||
async handleUploadTask(arr, index) {
|
||||
arr[index].isUpload = 1;
|
||||
let path = `/${arr[index].params.TrialId}/TaskImage/${
|
||||
arr[index].params.SubjectId
|
||||
}/${arr[index].params.VisitTaskId}/${
|
||||
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) {
|
||||
arr[index].path = res;
|
||||
uploadDicom.successCount++;
|
||||
arr[index].isUpload = 2;
|
||||
} else {
|
||||
uploadDicom.status = 2;
|
||||
uploadDicom.failCount++;
|
||||
arr[index].isUpload = 3;
|
||||
}
|
||||
uploadDicom.schedule = Math.floor(
|
||||
((uploadDicom.successCount + uploadDicom.failCount) /
|
||||
uploadDicom.count) *
|
||||
100
|
||||
);
|
||||
if (
|
||||
uploadDicom.schedule >= 100 &&
|
||||
uploadDicom.successCount === uploadDicom.count
|
||||
) {
|
||||
uploadDicom.status = 1;
|
||||
let res = await this.formatDicom(arr, arr[index].StudyInstanceUid);
|
||||
if (res) {
|
||||
uploadDicom.Study = res[arr[index].StudyId];
|
||||
uploadDicom.status = 3;
|
||||
try {
|
||||
res = await addOrUpdateArchiveTaskStudy(uploadDicom);
|
||||
if (res.IsSuccess) {
|
||||
uploadDicom.status = 4;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
let ind = arr.findIndex((item) => !item.isUpload);
|
||||
if (ind >= 0) {
|
||||
return this.handleUploadTask(arr, ind);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
// 数据整理
|
||||
async formatDicom(arr, StudyInstanceUid) {
|
||||
let studyObj = {};
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
let dicom = arr[i];
|
||||
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]) {
|
||||
studyObj[dicom.StudyId] = {
|
||||
StudyId: dicom.StudyId,
|
||||
StudyInstanceUid: dicom.StudyInstanceUid,
|
||||
StudyTime: this.getTime(dicom.StudyDate, dicom.StudyTime),
|
||||
Modalities: dicom.Modalities,
|
||||
Description: dicom.StudyDescription,
|
||||
SeriesCount: 1,
|
||||
InstanceCount: 1,
|
||||
InstitutionName: dicom.InstitutionName,
|
||||
PatientId: dicom.PatientId,
|
||||
PatientName: dicom.PatientName,
|
||||
PatientAge: dicom.PatientAge,
|
||||
PatientSex: dicom.PatientSex,
|
||||
AccessionNumber: dicom.AccessionNumber,
|
||||
PatientBirthDate: dicom.PatientBirthDate,
|
||||
AcquisitionTime: dicom.AcquisitionTime,
|
||||
AcquisitionNumber: dicom.AcquisitionNumber,
|
||||
TriggerTime: dicom.TriggerTime,
|
||||
BodyPartExamined: dicom.BodyPartExamined,
|
||||
SeriesList: [
|
||||
{
|
||||
StudyInstanceUid: dicom.StudyInstanceUid,
|
||||
SeriesInstanceUid: dicom.SeriesInstanceUid,
|
||||
SeriesNumber: dicom.SeriesNumber,
|
||||
SeriesTime: this.getTime(dicom.SeriesDate, dicom.SeriesTime),
|
||||
Modality: dicom.Modality,
|
||||
Description: dicom.SeriesDescription,
|
||||
InstanceCount: 1,
|
||||
SliceThickness: dicom.SliceThickness,
|
||||
ImagePositionPatient: dicom.ImagePosition,
|
||||
ImageOrientationPatient: dicom.ImageOrientation,
|
||||
BodyPartExamined: dicom.seriesBodyPartExamined,
|
||||
SequenceName: dicom.SequenceName,
|
||||
ProtocolName: dicom.ProtocolName,
|
||||
ImagerPixelSpacing: dicom.ImagePixelSpacing,
|
||||
AcquisitionTime: dicom.AcquisitionTime,
|
||||
AcquisitionNumber: dicom.AcquisitionNumber,
|
||||
TriggerTime: dicom.TriggerTime,
|
||||
ImageResizePath: await getThumbnail(
|
||||
dicom.file,
|
||||
thumbnailPath,
|
||||
dicom
|
||||
),
|
||||
InstanceList: [
|
||||
{
|
||||
StudyInstanceUid: dicom.StudyInstanceUid,
|
||||
SeriesInstanceUid: dicom.SeriesInstanceUid,
|
||||
SopInstanceUid: dicom.SopInstanceUid,
|
||||
InstanceNumber: dicom.ImageOrInstanceNumber,
|
||||
InstanceTime: this.getTime(
|
||||
dicom.ContentDate,
|
||||
dicom.ContentTime
|
||||
),
|
||||
ImageRows: dicom.Rows || 0,
|
||||
ImageColumns: dicom.Columns || 0,
|
||||
SliceLocation: dicom.SliceLocation,
|
||||
SliceThickness: dicom.SliceThickness,
|
||||
NumberOfFrames: dicom.NumberOfFrames || 0,
|
||||
PixelSpacing: dicom.PixelSpacing,
|
||||
ImagerPixelSpacing: dicom.ImagePixelSpacing,
|
||||
FrameOfReferenceUID: dicom.FrameOfReferenceUID,
|
||||
WindowCenter: dicom.WindowCenter,
|
||||
WindowWidth: dicom.WindowWidth,
|
||||
Path: dicom.path,
|
||||
HtmlPath: "",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
} else {
|
||||
let seriesHas = studyObj[dicom.StudyId].SeriesList.some((item) => {
|
||||
if (item.SeriesInstanceUid === dicom.SeriesInstanceUid) {
|
||||
item.InstanceCount++;
|
||||
let instance = {
|
||||
StudyInstanceUid: dicom.StudyInstanceUid,
|
||||
SeriesInstanceUid: dicom.SeriesInstanceUid,
|
||||
SopInstanceUid: dicom.SopInstanceUid,
|
||||
InstanceNumber: dicom.ImageOrInstanceNumber,
|
||||
InstanceTime: this.getTime(
|
||||
dicom.ContentDate,
|
||||
dicom.ContentTime
|
||||
),
|
||||
ImageRows: dicom.Rows || 0,
|
||||
ImageColumns: dicom.Columns || 0,
|
||||
SliceLocation: dicom.SliceLocation,
|
||||
SliceThickness: dicom.SliceThickness,
|
||||
NumberOfFrames: dicom.NumberOfFrames || 0,
|
||||
PixelSpacing: dicom.PixelSpacing,
|
||||
ImagerPixelSpacing: dicom.ImagePixelSpacing,
|
||||
FrameOfReferenceUID: dicom.FrameOfReferenceUID,
|
||||
WindowCenter: dicom.WindowCenter,
|
||||
WindowWidth: dicom.WindowWidth,
|
||||
Path: dicom.path,
|
||||
HtmlPath: "",
|
||||
};
|
||||
item.InstanceList.push(instance);
|
||||
}
|
||||
return item.SeriesInstanceUid === dicom.SeriesInstanceUid;
|
||||
});
|
||||
if (!seriesHas) {
|
||||
studyObj[dicom.StudyId].SeriesCount++;
|
||||
let series = {
|
||||
StudyInstanceUid: dicom.StudyInstanceUid,
|
||||
SeriesInstanceUid: dicom.SeriesInstanceUid,
|
||||
SeriesNumber: dicom.SeriesNumber,
|
||||
SeriesTime: this.getTime(dicom.SeriesDate, dicom.SeriesTime),
|
||||
Modality: dicom.Modality,
|
||||
Description: dicom.SeriesDescription,
|
||||
InstanceCount: 1,
|
||||
SliceThickness: dicom.SliceThickness,
|
||||
ImagePositionPatient: dicom.ImagePosition,
|
||||
ImageOrientationPatient: dicom.ImageOrientation,
|
||||
BodyPartExamined: dicom.seriesBodyPartExamined,
|
||||
SequenceName: dicom.SequenceName,
|
||||
ProtocolName: dicom.ProtocolName,
|
||||
ImagerPixelSpacing: dicom.ImagePixelSpacing,
|
||||
AcquisitionTime: dicom.AcquisitionTime,
|
||||
AcquisitionNumber: dicom.AcquisitionNumber,
|
||||
TriggerTime: dicom.TriggerTime,
|
||||
ImageResizePath: await getThumbnail(
|
||||
dicom.file,
|
||||
thumbnailPath,
|
||||
dicom
|
||||
),
|
||||
InstanceList: [
|
||||
{
|
||||
StudyInstanceUid: dicom.StudyInstanceUid,
|
||||
SeriesInstanceUid: dicom.SeriesInstanceUid,
|
||||
SopInstanceUid: dicom.SopInstanceUid,
|
||||
InstanceNumber: dicom.ImageOrInstanceNumber,
|
||||
InstanceTime: this.getTime(
|
||||
dicom.ContentDate,
|
||||
dicom.ContentTime
|
||||
),
|
||||
ImageRows: dicom.Rows || 0,
|
||||
ImageColumns: dicom.Columns || 0,
|
||||
SliceLocation: dicom.SliceLocation,
|
||||
SliceThickness: dicom.SliceThickness,
|
||||
NumberOfFrames: dicom.NumberOfFrames || 0,
|
||||
PixelSpacing: dicom.PixelSpacing,
|
||||
ImagerPixelSpacing: dicom.ImagePixelSpacing,
|
||||
FrameOfReferenceUID: dicom.FrameOfReferenceUID,
|
||||
WindowCenter: dicom.WindowCenter,
|
||||
WindowWidth: dicom.WindowWidth,
|
||||
Path: dicom.path,
|
||||
HtmlPath: "",
|
||||
},
|
||||
],
|
||||
};
|
||||
studyObj[dicom.StudyId].SeriesList.push(series);
|
||||
}
|
||||
studyObj[dicom.StudyId].InstanceCount++;
|
||||
}
|
||||
}
|
||||
console.log(studyObj);
|
||||
return studyObj;
|
||||
},
|
||||
// dicom时间转换
|
||||
getTime(date, time) {
|
||||
let studyTime = "";
|
||||
if (date) {
|
||||
date = `${date.substring(0, 4)}-${date.substring(
|
||||
4,
|
||||
6
|
||||
)}-${date.substring(6, 8)}`;
|
||||
}
|
||||
if (time) {
|
||||
time = `${time.substring(0, 2)}:${time.substring(
|
||||
2,
|
||||
4
|
||||
)}:${time.substring(4, 6)}`;
|
||||
}
|
||||
if (date) {
|
||||
studyTime = time ? `${date} ${time}` : `${date} 00:00:00`;
|
||||
}
|
||||
return studyTime;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -947,7 +238,4 @@ label {
|
|||
padding-top: 15px;
|
||||
}
|
||||
}
|
||||
.colorOfRed {
|
||||
color: #f44336;
|
||||
}
|
||||
</style>
|
|
@ -46,6 +46,12 @@
|
|||
</span>
|
||||
<!-- 账户信息 -->
|
||||
<el-menu-item v-if="!hasPermi(['role:air'])" index="4-2">{{ $t('trials:trials-myinfo:title:accountInfo') }}</el-menu-item>
|
||||
<!-- 管理后台 -->
|
||||
<el-menu-item
|
||||
v-if="hasPermi(['role:dev', 'role:oa', 'role:admin'])"
|
||||
index="4-4"
|
||||
>{{ $t("trials:trials-myinfo:title:system") }}</el-menu-item
|
||||
>
|
||||
<!-- 退出 -->
|
||||
<el-menu-item index="4-3">{{ $t('trials:trials-myinfo:button:loginout') }}</el-menu-item>
|
||||
</el-submenu>
|
||||
|
@ -108,6 +114,9 @@ export default {
|
|||
case '4-3':
|
||||
this.logout()
|
||||
break
|
||||
case "4-4":
|
||||
this.go("/system");
|
||||
break;
|
||||
case '1':
|
||||
this.go('/trials/trials-workbench')
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue