diff --git a/src/api/load.js b/src/api/load.js new file mode 100644 index 00000000..e9ba36a1 --- /dev/null +++ b/src/api/load.js @@ -0,0 +1,17 @@ +import request from '@/utils/request' +// 下载打包影像 +export function requestPackageAndAnonymizImage(params) { + return request({ + url: '/DownloadAndUpload/requestPackageAndAnonymizImage', + method: 'post', + params + }) +} +// 获取影像上传列表 +export function getSubjectImageUploadList(params) { + return request({ + url: '/DownloadAndUpload/getSubjectImageUploadList', + method: 'get', + params + }) +} \ No newline at end of file diff --git a/src/components/uploadImage/index.vue b/src/components/uploadImage/index.vue new file mode 100644 index 00000000..bfc5573d --- /dev/null +++ b/src/components/uploadImage/index.vue @@ -0,0 +1,182 @@ + + + \ No newline at end of file diff --git a/src/utils/uploadZip.js b/src/utils/uploadZip.js new file mode 100644 index 00000000..89f309ea --- /dev/null +++ b/src/utils/uploadZip.js @@ -0,0 +1,144 @@ +import JSZip from "jszip"; +import axios from "axios"; +import { saveAs } from "file-saver"; +import Vue from 'vue'; +import { + requestPackageAndAnonymizImage, +} from "@/api/load.js"; +let flag = {}; +export const downloadImage = async (id, id2) => { + if (flag[id2]) return + flag[id2] = true + try { + let params = { + TrialId: id, + SubjectVisitId: id2 + } + let res = await requestPackageAndAnonymizImage(params); + flag[id2] = false; + if (res.IsSuccess) { + if (!res.Result) { + Vue.prototype.$message.warning(Vue.prototype.$t("trials:upload:message:not")) + return 1; + } + let a = document.createElement("a"); + let href = Vue.prototype.OSSclientConfig.basePath + res.Result; + let fileName = + res.Result.split("/")[res.Result.split("/").length - 1]; + a.download = fileName; + a.href = href; + a.click(); + URL.revokeObjectURL(href); + let timer = setTimeout(() => { + a = null; + href = null; + timer = null; + }, 500) + return 2; + } else { + return false; + } + } catch (err) { + flag[id2] = false; + console.log(err); + } +}; +const setfolder = async (item) => { + const zip = new JSZip(); // 创建实例对象 + let patientIds = item.PatientList.map(i => i.PatientIdStr); + let zipName = `${item.SubjectCode}_${patientIds.join(',')}`; + let zipObj = {}; + const promises = []; + for (let visit of item.VisitList) { + if (!zipObj[`${visit.VisitName}`]) { + zipObj[`${visit.VisitName}`] = zip.folder(visit.VisitName); + } + for (let study of visit.StudyList) { + let date = study.StudyTime.split(" ")[0]; + for (let series of study.SeriesList) { + if ( + !zipObj[ + `${visit.VisitName}${series.Modality}` + ] + ) { + zipObj[ + `${visit.VisitName}${series.Modality}` + ] = zipObj[`${visit.VisitName}`].folder( + `${date}_${series.Modality}` + ); + } + for (let instance of series.InstancePathList) { + let obj = { + subjectCode: item.SubjectCode, + visitName: visit.VisitName, + date: study.StudyTime.split(" ")[0], + modality: series.Modality, + instancePath: instance.Path, + dicomName: instance.Path.split("/Dicom/")[1], + }; + const promise = handleBatchDown( + obj, + zipObj[ + `${visit.VisitName}${series.Modality}` + ], + ); + promises.push(promise); + } + } + } + } + // 生成 zip 文件 + Promise.all(promises) + .then(() => { + // 生成zip 文件 + zip + .generateAsync({ + type: "blob", + compression: "DEFLATE", // STORE: 默认不压缩, DEFLATE:需要压缩 + compressionOptions: { + level: 9, // 压缩等级 1~9 1 压缩速度最快, 9 最优压缩方式 + }, + }) + .then((res) => { + saveAs(res, zipName + ".zip"); // 使用FileSaver.saveAs保存文件,文件名可自定义 + flag[id2] = false; + zipObj = null; + }); + }) + .catch((reason) => { flag[id2] = false; }); +}; +const handleBatchDown = async (item, zip) => { + return new Promise((resolve) => { + getFileData( + Vue.prototype.OSSclientConfig.basePath + item.instancePath + ).then((res) => { + const fileName = item.dicomName + ".dcm"; + zip.file(fileName, res.data, { binary: true }); + resolve(); + }); + }); +}; +const getFileData = (fileUrl) => { + return new Promise((resolve, reject) => { + axios(fileUrl, { + method: "GET", + responseType: "blob", // 返回的数据会被强制转为blob类型 ,转换成arraybuffer 也行 + }) + .then((res) => { + resolve(res); + }) + .catch((error) => { + reject(error); + }); + }); +}; +export const fileDownload = (content, filename) => { + const eleLink = document.createElement("a"); + eleLink.download = filename; + eleLink.style.display = "none"; + const blob = new Blob([content]); + eleLink.href = URL.createObjectURL(blob); + document.body.appendChild(eleLink); + eleLink.click(); + document.body.removeChild(eleLink); +}; \ No newline at end of file diff --git a/src/views/trials/trials-panel/reading/reading-task/index.vue b/src/views/trials/trials-panel/reading/reading-task/index.vue index 8de89eb8..5ed78073 100644 --- a/src/views/trials/trials-panel/reading/reading-task/index.vue +++ b/src/views/trials/trials-panel/reading/reading-task/index.vue @@ -1,34 +1,61 @@ - + -
- +
+ - - {{ randomReadInfo.UnReadTaskCount }} + + {{ + randomReadInfo.UnReadTaskCount + }} - - {{ randomReadInfo.UnReadJudgeTaskCount }} + + {{ + randomReadInfo.UnReadJudgeTaskCount + }} - + {{ randomReadInfo.FinishTaskCount }} - - {{ randomReadInfo.FinishJudgeTaskCount }} + + {{ + randomReadInfo.FinishJudgeTaskCount + }} - {{ $t('trials:pendingReadingTasks:button:beginRandomReview') }} + {{ $t("trials:pendingReadingTasks:button:beginRandomReview") }} @@ -188,153 +293,195 @@ --> + diff --git a/src/views/trials/trials-panel/setting/reading-unit/components/ReadingRules.vue b/src/views/trials/trials-panel/setting/reading-unit/components/ReadingRules.vue index 13a7ec99..0b6b618e 100644 --- a/src/views/trials/trials-panel/setting/reading-unit/components/ReadingRules.vue +++ b/src/views/trials/trials-panel/setting/reading-unit/components/ReadingRules.vue @@ -788,7 +788,9 @@ export default { this.form[k] = res.Result[k]; } } - this.CriterionModalitys = this.form.CriterionModalitys.split("|"); + this.CriterionModalitys = this.form.CriterionModalitys + ? this.form.CriterionModalitys.split("|") + : []; this.form.TrialCriterionAdditionalAssessmentTypeList.forEach((v) => { this.$set(v, "IsSelected", v.IsSelected || false); this.$set(