feat: labelIds

This commit is contained in:
mozzie 2023-09-18 17:01:11 +08:00
parent 0bb16c94ae
commit d60469dae8
5 changed files with 105 additions and 43 deletions

View File

@ -1,5 +1,5 @@
import { TableColumnsType } from "antd"; import { TableColumnsType } from "antd";
import { SeriesItemType, StudyItemType } from "."; import { SeriesItemType, StudyItemType } from "./interface";
export const columnsForStudy: TableColumnsType<StudyItemType> = [ export const columnsForStudy: TableColumnsType<StudyItemType> = [
{ title: "PatientID", dataIndex: "PatientID", key: "PatientID" }, { title: "PatientID", dataIndex: "PatientID", key: "PatientID" },

View File

@ -4,48 +4,12 @@ import { useEffect, useState } from "react";
import { columnsForStudy, columnsForSeries } from "./columns"; import { columnsForStudy, columnsForSeries } from "./columns";
import { DesktopOutlined, FileZipOutlined } from "@ant-design/icons"; import { DesktopOutlined, FileZipOutlined } from "@ant-design/icons";
import { openOHIFViewer } from "../Upload/util"; import { openOHIFViewer } from "../Upload/util";
import { SeriesItemType, StudyItemType } from "./interface";
interface DicomListProps { interface DicomListProps {
children?: JSX.Element; children?: JSX.Element;
} }
export type SeriesItemType = {
BodyPartExamined: string;
ContrastBolusAgent: string;
ID: string;
ImageOrientationPatient: string;
Instances: string[];
Manufacturer: string;
Modality: string;
OperatorsName: string;
ProtocolName: string;
SeriesDate: string;
SeriesDescription: string;
SeriesInstanceUID: string;
SeriesNumber: string;
SeriesTime: string;
StationName: string;
Type: "study";
tags: any;
};
export type StudyItemType = {
AccessionNumber: string;
ID: string;
InstitutionName: string;
PatientBirthDate: string;
PatientID: string;
PatientName: string;
PatientSex: string;
ReferringPhysicianName: string;
StudyDate: string;
StudyID: string;
StudyInstanceUID: string;
StudyTime: string;
Type: "series";
subs: SeriesItemType[];
};
export const DicomList = (props: DicomListProps) => { export const DicomList = (props: DicomListProps) => {
const [dataSource, setDataSource] = useState<StudyItemType[]>([]); const [dataSource, setDataSource] = useState<StudyItemType[]>([]);
const [tableLoading, setTableLoading] = useState(false); const [tableLoading, setTableLoading] = useState(false);

View File

@ -0,0 +1,40 @@
export type SeriesItemType = {
BodyPartExamined: string;
ContrastBolusAgent: string;
ID: string;
ImageOrientationPatient: string;
Instances: string[];
Manufacturer: string;
Modality: string;
OperatorsName: string;
ProtocolName: string;
SeriesDate: string;
SeriesDescription: string;
SeriesInstanceUID: string;
SeriesNumber: string;
SeriesTime: string;
StationName: string;
Type: "study";
tags: {
PatientPosition: string;
BodyPartExamined: string;
SliceThickness: string;
};
};
export type StudyItemType = {
AccessionNumber: string;
ID: string;
InstitutionName: string;
PatientBirthDate: string;
PatientID: string;
PatientName: string;
PatientSex: string;
ReferringPhysicianName: string;
StudyDate: string;
StudyID: string;
StudyInstanceUID: string;
StudyTime: string;
Type: "series";
subs: SeriesItemType[];
};

View File

@ -23,6 +23,7 @@ import {
CaretRightOutlined, CaretRightOutlined,
CloseOutlined, CloseOutlined,
EditOutlined, EditOutlined,
FormOutlined,
TagOutlined, TagOutlined,
} from "@ant-design/icons"; } from "@ant-design/icons";
@ -89,7 +90,7 @@ export const LabelTree = (props: LabelTreeProps) => {
<Col span={6}> <Col span={6}>
<Space> <Space>
<Tooltip title={`编辑 ${item.name} 分类`}> <Tooltip title={`编辑 ${item.name} 分类`}>
<EditOutlined <FormOutlined
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
setActiveCategory(item); setActiveCategory(item);

View File

@ -1,6 +1,6 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useDomain } from "@/hook/useDomain"; import { useDomain } from "@/hook/useDomain";
import { Button, Space, Table, Tooltip } from "antd"; import { Button, Modal, Select, Space, Table, Tooltip } from "antd";
import { columns } from "./columns"; import { columns } from "./columns";
import { DesktopOutlined, TagOutlined } from "@ant-design/icons"; import { DesktopOutlined, TagOutlined } from "@ant-design/icons";
import { openOHIFViewer } from "@/modules/Admin/Dicom/Upload/util"; import { openOHIFViewer } from "@/modules/Admin/Dicom/Upload/util";
@ -9,10 +9,18 @@ interface ArchiveListProps {
children?: JSX.Element; children?: JSX.Element;
} }
type CategoryItemType = {
labels: { name: string; id: number }[];
};
export const ArchiveList = (props: ArchiveListProps) => { export const ArchiveList = (props: ArchiveListProps) => {
const [dataSource, setDataSource] = useState<any>([]); const [dataSource, setDataSource] = useState<CategoryItemType[]>([]);
const [tableLoading, setTableLoading] = useState(false); const [tableLoading, setTableLoading] = useState(false);
const { userDomainService } = useDomain(); const { userDomainService, labelDomainService } = useDomain();
const [isModalOpen, setIsModalOpen] = useState(false);
const [labelOptions, setLabelOptions] = useState<
{ label: string; value: string }[]
>([]);
useEffect(() => { useEffect(() => {
userDomainService.findArchiveTask().then((res) => { userDomainService.findArchiveTask().then((res) => {
@ -24,11 +32,40 @@ export const ArchiveList = (props: ArchiveListProps) => {
}); });
}, [userDomainService]); }, [userDomainService]);
useEffect(() => {
labelDomainService.findLabelCategory().then((res) => {
const { code, data } = res;
if (code === 0) {
const labels = (data as CategoryItemType[])
.map((i) => i.labels)
.flat()
.map((i) => ({ label: i.name, value: String(i.id) }));
setLabelOptions(labels);
}
});
}, []);
const onViewDicom = (record: any) => { const onViewDicom = (record: any) => {
const { StudyInstanceUID, SeriesInstanceUID } = record; const { StudyInstanceUID, SeriesInstanceUID } = record;
openOHIFViewer(StudyInstanceUID, SeriesInstanceUID); openOHIFViewer(StudyInstanceUID, SeriesInstanceUID);
}; };
const onLabelSelectChange = (labelIds: string[]) => {
console.log(
"选中的labelIds:",
labelIds.map((i) => Number(i))
);
};
const onUpdateLabelForSeries = () => {
console.log("onUpdateLabelForSeries");
};
const filterOption = (
input: string,
option: { label: string; value: string }
) => (option?.label ?? "").toLowerCase().includes(input.toLowerCase());
return ( return (
<div> <div>
<Table <Table
@ -52,7 +89,7 @@ export const ArchiveList = (props: ArchiveListProps) => {
<Button <Button
type="text" type="text"
icon={<TagOutlined />} icon={<TagOutlined />}
onClick={() => {}} onClick={() => setIsModalOpen(true)}
/> />
</Tooltip> </Tooltip>
</Space> </Space>
@ -61,6 +98,26 @@ export const ArchiveList = (props: ArchiveListProps) => {
]} ]}
rowKey="id" rowKey="id"
/> />
<Modal
open={isModalOpen}
title="添加标签"
cancelText="再想想"
okText="确认"
onCancel={() => setIsModalOpen(false)}
onOk={onUpdateLabelForSeries}
>
<Select
mode="multiple"
allowClear
style={{ width: "100%" }}
placeholder="请选择标签"
defaultValue={[]}
onChange={onLabelSelectChange}
options={labelOptions}
optionFilterProp="children"
filterOption={filterOption}
/>
</Modal>
</div> </div>
); );
}; };