项目管理->访视列表和下载影像接口调试对接

main
wangxiaoshuang 2024-04-02 17:15:59 +08:00
parent 983d57861c
commit 77b03186d8
2 changed files with 223 additions and 36 deletions

View File

@ -238,6 +238,7 @@ export default {
handleSelectChange() {},
//
add(item) {},
addTrials() {},
},
};
</script>

View File

@ -5,16 +5,24 @@
<el-form :inline="true">
<!-- 受试者编号 -->
<el-form-item :label="$t('trials:crcQuestion:table:subjectId')">
<el-input v-model="searchData.SubjectInfo" style="width: 140px" />
<el-input
v-model="searchData.SubjectCode"
clearable
style="width: 140px"
/>
</el-form-item>
<!-- 患者姓名 -->
<el-form-item :label="$t('trials:uploadDicomList:table:patientName')">
<el-input v-model="searchData.SubjectInfo" style="width: 140px" />
<el-input
v-model="searchData.SubjectShortName"
clearable
style="width: 140px"
/>
</el-form-item>
<!-- 患者性别 -->
<el-form-item :label="$t('trials:subject:table:gender')">
<el-select
v-model="searchData.SiteId"
v-model="searchData.SubjectSex"
clearable
filterable
style="width: 150px"
@ -28,7 +36,7 @@
</el-select>
</el-form-item>
<!-- 访视名称 -->
<el-form-item :label="$t('trials:globalReview:table:visitName')">
<!-- <el-form-item :label="$t('trials:globalReview:table:visitName')">
<el-select
v-model="searchData.SiteId"
clearable
@ -42,9 +50,9 @@
:value="item.SiteId"
/>
</el-select>
</el-form-item>
</el-form-item> -->
<!-- 状态 -->
<el-form-item :label="$t('trials:trials-list:table:status')">
<!-- <el-form-item :label="$t('trials:trials-list:table:status')">
<el-select
v-model="searchData.SiteId"
clearable
@ -58,7 +66,7 @@
:value="item.SiteId"
/>
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item>
<!-- 查询 -->
<el-button type="primary" icon="el-icon-search" @click="handleSearch">
@ -95,66 +103,92 @@
></i>
</template>
</el-table-column>
<el-table-column type="index" width="40" />
<!-- 受试者编号 -->
<el-table-column
prop="StudyCode"
prop="SubjectCode"
:label="$t('trials:uploadMonitor:table:subjectId')"
show-overflow-tooltip
/>
<!-- 患者编号 -->
<el-table-column
prop="StudyCode"
:label="$t('trials:uploadMonitor:table:subjectId')"
prop="PatientList.PatientIdStr"
:label="$t('trials:uploadDicomList:table:pId')"
show-overflow-tooltip
/>
>
<template slot-scope="scope">
<span
v-for="(item, index) in scope.row.PatientList"
:key="`${index}${item.PatientId}`"
>
{{
index === scope.row.PatientList.length - 1
? item.PatientIdStr
: `${item.PatientIdStr}, `
}}
</span>
</template>
</el-table-column>
<!-- 患者姓名 -->
<el-table-column
prop="StudyCode"
prop="SubjectShortName"
:label="$t('trials:uploadDicomList:table:patientName')"
show-overflow-tooltip
/>
<!-- 性别 -->
<el-table-column
prop="StudyCode"
prop="SubjectSex"
:label="$t('trials:subject:table:gender')"
show-overflow-tooltip
/>
<!-- 访视名称 -->
<el-table-column
prop="StudyCode"
prop="VisitName"
:label="$t('trials:uploadMonitor:table:visitName')"
show-overflow-tooltip
/>
<!-- 数据收集 -->
<el-table-column
<!-- <el-table-column
prop="StudyCode"
:label="$t('trials:crcUpload:table:dataCollected')"
show-overflow-tooltip
/>
/> -->
<!-- 最早拍片日期 -->
<el-table-column
prop="StudyCode"
prop="VisitEarliestStudyTime"
:label="$t('trials:trials-panel:table:EarliestScanDate')"
show-overflow-tooltip
sortable="custom"
/>
<!-- 最晚拍片日期 -->
<el-table-column
prop="StudyCode"
prop="VisitLatestStudyTime"
:label="$t('trials:linkedRP:table:latestScanDate')"
show-overflow-tooltip
sortable="custom"
/>
<!-- 状态 -->
<el-table-column
prop="StudyCode"
prop="SubmitState"
:label="$t('trials:trials-list:table:status')"
show-overflow-tooltip
sortable="custom"
/>
>
<template slot-scope="scope">
<el-tag v-if="scope.row.SubmitState * 1 === 0" type="warning">{{
$fd("SubmitState", scope.row.SubmitState * 1)
}}</el-tag>
<el-tag v-else-if="scope.row.SubmitState * 1 === 1" type="danger">{{
$fd("SubmitState", scope.row.SubmitState * 1)
}}</el-tag>
<el-tag v-else-if="scope.row.SubmitState * 1 === 2">{{
$fd("SubmitState", scope.row.SubmitState * 1)
}}</el-tag>
</template>
</el-table-column>
<!-- 提交时间 -->
<el-table-column
prop="StudyCode"
prop="SubmitTime"
:label="$t('trials:crcUpload:table:submitTime')"
show-overflow-tooltip
sortable="custom"
@ -177,41 +211,44 @@
<el-button
type="text"
v-hasPermi="['trials:trials-panel:hirVisit:edit']"
@click="editStudy(scope.row)"
@click.stop="editStudy(scope.row)"
>{{ $t("trials:hirVisit:button:editStudy") }}</el-button
>
<!--提交-->
<el-button
type="text"
v-hasPermi="['trials:trials-panel:hirVisit:submit']"
@click="submit(scope.row)"
@click.stop="submit(scope.row)"
>{{ $t("common:button:submit") }}</el-button
>
<!--删除-->
<el-button
type="text"
v-hasPermi="['trials:trials-panel:hirVisit:remove']"
@click="remove(scope.row)"
@click.stop="remove(scope.row)"
>{{ $t("common:button:delete") }}</el-button
>
<!--评估结果-->
<el-button
type="text"
v-hasPermi="['trials:trials-panel:hirVisit:result']"
@click="result(scope.row)"
@click.stop="result(scope.row)"
>{{ $t("trials:adReview:title:result") }}</el-button
>
<!--下载影像-->
<el-button
type="text"
v-hasPermi="['trials:trials-panel:hirVisit:download']"
@click="downloadImage(scope.row)"
@click.stop="downloadImage(scope.row)"
>{{ $t("trials:reading:button:uploadImages") }}</el-button
>
<!--下载医疗报告-->
<el-button type="text" @click="downloadReport(scope.row)">{{
$t("trials:reading:button:uploadReport")
}}</el-button>
<el-button
type="text"
v-hasPermi="['trials:trials-panel:hirVisit:download']"
@click.stop="downloadReport(scope.row)"
>{{ $t("trials:reading:button:uploadReport") }}</el-button
>
</template>
</el-table-column>
</el-table>
@ -233,13 +270,31 @@
import BaseContainer from "@/components/BaseContainer";
import Pagination from "@/components/Pagination";
import editStudyList from "./components/edit-study-list.vue";
import {
getPatientSubejctVisitList,
getSubjectImageZipInfo,
} from "@/api/trials/visit.js";
import JSZip from "jszip";
import axios from "axios";
import { saveAs } from "file-saver";
const defaultSearchData = () => {
return {
subjectCode: null,
subjectShortName: null,
subjectSex: null,
pageIndex: 1,
pageSize: 20,
asc: false,
sortField: "SubmitTime",
};
};
export default {
name: "hirVisit",
components: { BaseContainer, Pagination, editStudyList },
data() {
return {
//
searchData: {},
searchData: defaultSearchData(),
visitOptions: [],
//
list: [
@ -253,15 +308,47 @@ export default {
editStudyVisible: false,
};
},
created() {
this.getList();
},
methods: {
//
handleSearch() {},
handleSearch() {
this.getList();
},
//
handleSearch() {},
handleReset() {
this.searchData = defaultSearchData();
this.getList();
},
//
handleSortByColumn() {},
handleSortByColumn(sort) {
this.searchData.SortField = sort.prop;
if (sort.order === "ascending") this.searchData.Asc = true;
if (sort.order === "descending") this.searchData.Asc = false;
if (!sort.order) this.searchData.SortField = null;
this.getList();
},
//
getList() {},
async getList() {
let data = {};
Object.keys(this.searchData).forEach((key) => {
data[key] = this.searchData[key];
});
data.TrialId = this.$route.query.trialId;
try {
this.loading = true;
let res = await getPatientSubejctVisitList(data);
this.loading = false;
if (res.IsSuccess) {
this.list = res.Result.CurrentPageData;
this.total = res.Result.TotalCount;
}
} catch (err) {
this.loading = false;
console.log(err);
}
},
//
editStudy(item) {
this.editStudyVisible = true;
@ -272,10 +359,109 @@ export default {
remove() {},
//
result() {},
//
downloadImage() {},
//
downloadReport() {},
//
async downloadImage(item) {
try {
let res = await getSubjectImageZipInfo(item.SubjectId);
if (res.IsSuccess) {
let item = res.Result;
await this.setfolder(item);
}
} catch (err) {
console.log(err);
}
},
async setfolder(item) {
const zip = new JSZip(); //
let zipObj = {};
const promises = [];
for (let patient of item.PatientList) {
if (!zipObj[patient.PatientIdStr]) {
zipObj[patient.PatientIdStr] = zip.folder(patient.PatientIdStr);
console.log(zipObj[patient.PatientIdStr]);
}
for (let visit of patient.VisitList) {
for (let study of visit.StudyList) {
let date = study.StudyTime.split(" ")[0];
if (!zipObj[`${patient.PatientIdStr}${date}`]) {
zipObj[`${patient.PatientIdStr}${date}`] =
zipObj[patient.PatientIdStr].folder(date);
}
for (let series of study.SeriesList) {
if (!zipObj[`${patient.PatientIdStr}${date}${series.Modality}`]) {
zipObj[`${patient.PatientIdStr}${date}${series.Modality}`] =
zipObj[`${patient.PatientIdStr}${date}`].folder(
series.Modality
);
}
for (let instance of series.InstancePathList) {
let obj = {
subjectCode: item.SubjectCode,
patientIdStr: patient.PatientIdStr,
visitName: visit.VisitName,
date: study.StudyTime.split(" ")[0],
modality: series.Modality,
instancePath: instance.Path,
dicomName: instance.Path.split("/Dicom/")[1],
};
const promise = this.handleBatchDown(
obj,
zipObj[`${patient.PatientIdStr}${date}${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, item.SubjectCode + new Date().getTime() + "_CV.zip"); // 使FileSaver.saveAs
zipObj = null;
});
})
.catch((reason) => {});
},
async handleBatchDown(item, zip) {
return new Promise((resolve) => {
let path = `/${item.subjectCode}_${item.patientIdStr}/${item.visitName}/${item.date}_${item.modality}${item.instancePath}`;
this.getFileData(
this.OSSclientConfig.basePath + path
// "https://th.bing.com/th/id/OIP.duz6S7Fvygrqd6Yj_DcXAQHaF7?rs=1&pid=ImgDetMain"
).then((res) => {
const fileName = item.dicomName + ".dcm";
zip.file(fileName, res.data, { binary: true });
resolve();
});
});
},
getFileData(fileUrl) {
return new Promise((resolve, reject) => {
axios(fileUrl, {
method: "GET",
responseType: "blob", // blob arraybuffer
})
.then((res) => {
resolve(res);
})
.catch((error) => {
reject(error);
});
});
},
},
};
</script>