fix: upload and refresh patient list
This commit is contained in:
parent
039325b768
commit
c52b3f1e00
|
@ -8,11 +8,12 @@ export const registerDicomHandler = () => {
|
||||||
const dia = await dialog.showOpenDialog({ properties: ["openDirectory"] });
|
const dia = await dialog.showOpenDialog({ properties: ["openDirectory"] });
|
||||||
if (dia.canceled) return null;
|
if (dia.canceled) return null;
|
||||||
const dcmPaths = await filterDicoms(dia.filePaths[0]);
|
const dcmPaths = await filterDicoms(dia.filePaths[0]);
|
||||||
uploadFilesInBatches({
|
await uploadFilesInBatches({
|
||||||
filePaths: dcmPaths,
|
filePaths: dcmPaths,
|
||||||
batchSize: 6,
|
batchSize: 6,
|
||||||
feedback: (d) => event.reply("dicom:upload:detail", d),
|
feedback: (d) => event.reply("dicom:upload:detail", d),
|
||||||
});
|
});
|
||||||
|
event.reply("dicom:upload:finished"); // 重新刷新病人列表
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle("dicom:select", async () => {
|
ipcMain.handle("dicom:select", async () => {
|
||||||
|
|
|
@ -23,7 +23,7 @@ export const Datasource = () => {
|
||||||
const [selectedStudyId, setSelectedStudyId] = useState<string | null>(null);
|
const [selectedStudyId, setSelectedStudyId] = useState<string | null>(null);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
useEffect(() => {
|
const fetchPatients = () => {
|
||||||
window.ipcRenderer
|
window.ipcRenderer
|
||||||
.invoke("dicom:select")
|
.invoke("dicom:select")
|
||||||
.then((patients: PatientInfo[]) => {
|
.then((patients: PatientInfo[]) => {
|
||||||
|
@ -31,6 +31,17 @@ export const Datasource = () => {
|
||||||
rawPatientsRef.current = patients;
|
rawPatientsRef.current = patients;
|
||||||
setPatients(patients);
|
setPatients(patients);
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetchPatients();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
window.ipcRenderer.on("dicom:upload:finished", fetchPatients);
|
||||||
|
return () => {
|
||||||
|
window.ipcRenderer.off("dicom:upload:finished", fetchPatients);
|
||||||
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handlePatientSearch = (filterValue: string) => {
|
const handlePatientSearch = (filterValue: string) => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user