Compare commits
1 Commits
prod-batam
...
v3.9.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f56d06fcd |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -59,5 +59,3 @@ tests/playwright-report/
|
||||
|
||||
# Dummy
|
||||
/dump
|
||||
platform/app/dist.zip
|
||||
platform/app/dist-sudirman.zip
|
||||
|
||||
@@ -26,6 +26,15 @@ const CornerstoneViewportDownloadForm = ({
|
||||
const activeViewportElement = enabledElement?.element;
|
||||
const activeViewportEnabledElement = getEnabledElement(activeViewportElement);
|
||||
|
||||
// console.log('cornerstoneViewportService', cornerstoneViewportService);
|
||||
const viewportInfo = cornerstoneViewportService.getViewportInfo("default");
|
||||
// console.log('viewportInfo', viewportInfo);
|
||||
|
||||
// Retrieve StudyInstanceUID from viewportInfo
|
||||
const StudyInstanceUID = viewportInfo.getViewportData().data[0].StudyInstanceUID;
|
||||
const SetInstanceUID = viewportInfo.getViewportData().data[0].displaySetInstanceUID;
|
||||
// console.log('StudyInstanceUID', StudyInstanceUID);
|
||||
// console.log('SetInstanceUID', SetInstanceUID);
|
||||
const {
|
||||
viewportId: activeViewportId,
|
||||
renderingEngineId,
|
||||
@@ -108,6 +117,10 @@ const CornerstoneViewportDownloadForm = ({
|
||||
|
||||
const downloadCanvas = getOrCreateCanvas(element);
|
||||
|
||||
// Log the canvas content before conversion
|
||||
const context = downloadCanvas.getContext('2d');
|
||||
const imageData = context.getImageData(0, 0, downloadCanvas.width, downloadCanvas.height);
|
||||
|
||||
const type = 'image/' + fileType;
|
||||
const dataUrl = downloadCanvas.toDataURL(type, 1);
|
||||
|
||||
@@ -214,6 +227,43 @@ const CornerstoneViewportDownloadForm = ({
|
||||
});
|
||||
};
|
||||
|
||||
// New function to send annotation data
|
||||
const sendAnnotationData = async (base64Image, activeViewportElement) => {
|
||||
try {
|
||||
// Get the SOPInstanceUID from the active viewport
|
||||
const activeViewportEnabledElement = getEnabledElement(activeViewportElement);
|
||||
const imageId = activeViewportEnabledElement?.viewport?.getCurrentImageId();
|
||||
|
||||
if (!base64Image || !StudyInstanceUID) {
|
||||
throw new Error('Missing required data');
|
||||
}
|
||||
|
||||
const payload = {
|
||||
image: base64Image,
|
||||
StudyInstanceUID: StudyInstanceUID
|
||||
};
|
||||
|
||||
const response = await fetch('http://host:port/one-api/tools/annotation/store', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log('Annotation data sent successfully:', data);
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error('Error sending annotation data:', error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
const downloadBlob = (filename, fileType) => {
|
||||
const file = `${filename}.${fileType}`;
|
||||
const divForDownloadViewport = document.querySelector(
|
||||
@@ -221,9 +271,16 @@ const CornerstoneViewportDownloadForm = ({
|
||||
);
|
||||
|
||||
html2canvas(divForDownloadViewport).then(canvas => {
|
||||
const dataUrl = canvas.toDataURL(fileType, 1.0);
|
||||
const base64Image = dataUrl.split(',')[1]; // Remove prefix 'data:image/png;base64,'
|
||||
|
||||
// Send annotation data
|
||||
sendAnnotationData(base64Image, activeViewportElement)
|
||||
.catch(error => console.error('Annotation data sending failed:', error));
|
||||
|
||||
const link = document.createElement('a');
|
||||
link.download = file;
|
||||
link.href = canvas.toDataURL(fileType, 1.0);
|
||||
link.href = dataUrl;
|
||||
link.click();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -26,8 +26,6 @@ const SidePanelWithServices = ({
|
||||
const [sidePanelOpen, setSidePanelOpen] = useState(activeTabIndexProp !== null);
|
||||
const [activeTabIndex, setActiveTabIndex] = useState(activeTabIndexProp);
|
||||
const [tabs, setTabs] = useState(tabsProp ?? panelService.getPanels(side));
|
||||
const [studyInstanceUID, setStudyInstanceUID] = useState('');
|
||||
const [lastActivatedStudyUID, setLastActivatedStudyUID] = useState('');
|
||||
|
||||
const handleActiveTabIndexChange = useCallback(({ activeTabIndex }) => {
|
||||
setActiveTabIndex(activeTabIndex);
|
||||
@@ -73,35 +71,11 @@ const SidePanelWithServices = ({
|
||||
const activatePanelSubscription = panelService.subscribe(
|
||||
panelService.EVENTS.ACTIVATE_PANEL,
|
||||
(activatePanelEvent: Types.ActivatePanelEvent) => {
|
||||
const isExpertisePanel = activatePanelEvent.panelId.includes('-exp-');
|
||||
const realPanelID = isExpertisePanel
|
||||
? activatePanelEvent.panelId.split('-exp-')[0]
|
||||
: activatePanelEvent.panelId;
|
||||
|
||||
// studyInstanceUID = take from activatePanelEvent.panelId after '-exp-
|
||||
setStudyInstanceUID(isExpertisePanel ? activatePanelEvent.panelId.split('-exp-')[1] : null);
|
||||
|
||||
const tabIndex = tabs.findIndex(tab => tab.id === realPanelID);
|
||||
|
||||
if (isExpertisePanel && side === 'right') {
|
||||
// Extract study UID from the panel ID
|
||||
const currentStudyUID = activatePanelEvent.panelId.split('-exp-')[1];
|
||||
|
||||
// Toggle logic - close if same study is clicked again, open if different study
|
||||
if (currentStudyUID === lastActivatedStudyUID && sidePanelOpen) {
|
||||
// Same study - close panel
|
||||
setSidePanelOpen(false);
|
||||
setActiveTabIndex(null);
|
||||
setLastActivatedStudyUID('');
|
||||
} else {
|
||||
// Different study or panel was closed - open panel with new study
|
||||
setSidePanelOpen(true);
|
||||
setActiveTabIndex(tabIndex !== -1 ? tabIndex : null);
|
||||
setStudyInstanceUID(currentStudyUID);
|
||||
setLastActivatedStudyUID(currentStudyUID);
|
||||
}
|
||||
} else if (tabIndex !== -1) {
|
||||
setActiveTabIndex(tabIndex);
|
||||
if (sidePanelOpen || activatePanelEvent.forceActive) {
|
||||
const tabIndex = tabs.findIndex(tab => tab.id === activatePanelEvent.panelId);
|
||||
if (tabIndex !== -1) {
|
||||
setActiveTabIndex(tabIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -109,7 +83,7 @@ const SidePanelWithServices = ({
|
||||
return () => {
|
||||
activatePanelSubscription.unsubscribe();
|
||||
};
|
||||
}, [tabs, sidePanelOpen, panelService, lastActivatedStudyUID]);
|
||||
}, [tabs, sidePanelOpen, panelService]);
|
||||
|
||||
return (
|
||||
<SidePanel
|
||||
@@ -121,8 +95,6 @@ const SidePanelWithServices = ({
|
||||
onClose={handleClose}
|
||||
onActiveTabIndexChange={handleActiveTabIndexChange}
|
||||
expandedWidth={expandedWidth}
|
||||
servicesManager={servicesManager} // Pass servicesManager ke SidePanel
|
||||
studyInstanceUID={studyInstanceUID}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -146,7 +146,6 @@ function ViewerLayout({
|
||||
side="right"
|
||||
activeTabIndex={rightPanelClosedState ? null : 0}
|
||||
servicesManager={servicesManager}
|
||||
expandedWidth={400}
|
||||
/>
|
||||
) : null}
|
||||
</React.Fragment>
|
||||
|
||||
@@ -6,7 +6,8 @@ function OHIFCornerstonePdfViewport({ displaySets }) {
|
||||
var [url, setUrl] = useState(null);
|
||||
|
||||
const sopInstanceUid = displaySets[0].SOPInstanceUID;
|
||||
url = `http://128.199.154.150:8080/rid/IHERetrieveDocument?requestType=DOCUMENT&documentUID=${sopInstanceUid}&preferredContentType=application%2Fpdf`;
|
||||
url = `http://${window.config.pacs_document_host}:${window.config.pacs_document_port}/rid/IHERetrieveDocument?requestType=DOCUMENT&documentUID=${sopInstanceUid}&preferredContentType=application%2Fpdf`;
|
||||
console.log("URL PDF", url);
|
||||
|
||||
useEffect(() => {
|
||||
document.body.addEventListener('drag', makePdfDropTarget);
|
||||
|
||||
@@ -25,7 +25,7 @@ const PROXY_DOMAIN = process.env.PROXY_DOMAIN;
|
||||
const PROXY_PATH_REWRITE_FROM = process.env.PROXY_PATH_REWRITE_FROM;
|
||||
const PROXY_PATH_REWRITE_TO = process.env.PROXY_PATH_REWRITE_TO;
|
||||
|
||||
const OHIF_PORT = Number(process.env.OHIF_PORT || 3000);
|
||||
const OHIF_PORT = Number(process.env.OHIF_PORT || 3030);
|
||||
const ENTRY_TARGET = process.env.ENTRY_TARGET || `${SRC_DIR}/index.js`;
|
||||
const Dotenv = require('dotenv-webpack');
|
||||
const writePluginImportFile = require('./writePluginImportsFile.js');
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
window.config = {
|
||||
routerBasename: '/',
|
||||
pacs_document_host: '152.42.173.210',
|
||||
pacs_document_port: 8080,
|
||||
// whiteLabeling: {},
|
||||
extensions: [],
|
||||
modes: [],
|
||||
@@ -24,19 +26,30 @@ window.config = {
|
||||
prefetch: 25,
|
||||
},
|
||||
expertise: false, //* Tambahan untuk enable expertise (CustomizableViewportOverlay)
|
||||
expertise_host: `http://192.168.2.13`, // IP ke NV di PACS Server, untuk fetch expertise bawaan versi NV
|
||||
pacs_document_host: `192.168.2.13`, // IP ke NV di PACS Server untuk ambil pdf
|
||||
pacs_document_port: 8080,
|
||||
// filterQueryParam: false,
|
||||
// defaultDataSourceName: 'dicomweb',
|
||||
defaultDataSourceName: 'local-proxy',
|
||||
// defaultDataSourceName: 'GCP',
|
||||
/* Dynamic config allows user to pass "configUrl" query string this allows to load config without recompiling application. The regex will ensure valid configuration source */
|
||||
// dangerouslyUseDynamicConfig: {
|
||||
// enabled: true,
|
||||
// // regex will ensure valid configuration source and default is /.*/ which matches any character. To use this, setup your own regex to choose a specific source of configuration only.
|
||||
// // Example 1, to allow numbers and letters in an absolute or sub-path only.
|
||||
// // regex: /(0-9A-Za-z.]+)(\/[0-9A-Za-z.]+)*/
|
||||
// // Example 2, to restricts to either hosptial.com or othersite.com.
|
||||
// // regex: /(https:\/\/hospital.com(\/[0-9A-Za-z.]+)*)|(https:\/\/othersite.com(\/[0-9A-Za-z.]+)*)/
|
||||
// regex: /.*/,
|
||||
// },
|
||||
dataSources: [
|
||||
{
|
||||
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
|
||||
sourceName: 'local-proxy',
|
||||
configuration: {
|
||||
friendlyName: 'Static WADO Local Data',
|
||||
friendlyName: 'DCM4CHEE Server',
|
||||
name: 'DCM4CHEE',
|
||||
qidoRoot: `http://192.168.2.13:5000/rs`, // IP ke dicomweb-proxy PACS Server. URI selalu /rs
|
||||
wadoRoot: `http://192.168.2.13:5000/rs`, // IP ke dicomweb-proxy PACS Server. URI selalu /rs qidoSupportsIncludeField: false,
|
||||
qidoRoot: 'http://152.42.173.210:5000/rs',
|
||||
wadoRoot: 'http://152.42.173.210:5000/rs',
|
||||
qidoSupportsIncludeField: false,
|
||||
supportsReject: true,
|
||||
supportsStow: true,
|
||||
imageRendering: 'wadors',
|
||||
@@ -45,14 +58,100 @@ window.config = {
|
||||
supportsFuzzyMatching: false,
|
||||
supportsWildcard: true,
|
||||
staticWado: true,
|
||||
singlepart: 'video',
|
||||
singlepart: 'bulkdata,video',
|
||||
bulkDataURI: {
|
||||
enabled: true,
|
||||
relativeResolution: 'studies',
|
||||
transform: url => url.replace('/pixeldata.mp4', '/rendered'),
|
||||
},
|
||||
omitQuotationForMultipartRequest: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
|
||||
sourceName: 'dicomweb',
|
||||
configuration: {
|
||||
friendlyName: 'AWS S3 Static wado server',
|
||||
name: 'aws',
|
||||
wadoUriRoot: 'https://d14fa38qiwhyfd.cloudfront.net/dicomweb',
|
||||
qidoRoot: 'https://d14fa38qiwhyfd.cloudfront.net/dicomweb',
|
||||
wadoRoot: 'https://d14fa38qiwhyfd.cloudfront.net/dicomweb',
|
||||
qidoSupportsIncludeField: false,
|
||||
imageRendering: 'wadors',
|
||||
thumbnailRendering: 'wadors',
|
||||
enableStudyLazyLoad: true,
|
||||
supportsFuzzyMatching: false,
|
||||
supportsWildcard: true,
|
||||
staticWado: true,
|
||||
singlepart: 'bulkdata,video',
|
||||
// whether the data source should use retrieveBulkData to grab metadata,
|
||||
// and in case of relative path, what would it be relative to, options
|
||||
// are in the series level or study level (some servers like series some study)
|
||||
bulkDataURI: {
|
||||
enabled: true,
|
||||
relativeResolution: 'studies',
|
||||
transform: url => url.replace('/pixeldata.mp4', '/rendered'),
|
||||
},
|
||||
omitQuotationForMultipartRequest: true,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
|
||||
sourceName: 'ohif2',
|
||||
configuration: {
|
||||
friendlyName: 'AWS S3 Static wado secondary server',
|
||||
name: 'aws',
|
||||
wadoUriRoot: 'https://dd14fa38qiwhyfd.cloudfront.net/dicomweb',
|
||||
qidoRoot: 'https://dd14fa38qiwhyfd.cloudfront.net/dicomweb',
|
||||
wadoRoot: 'https://dd14fa38qiwhyfd.cloudfront.net/dicomweb',
|
||||
qidoSupportsIncludeField: false,
|
||||
supportsReject: false,
|
||||
imageRendering: 'wadors',
|
||||
thumbnailRendering: 'wadors',
|
||||
enableStudyLazyLoad: true,
|
||||
supportsFuzzyMatching: false,
|
||||
supportsWildcard: true,
|
||||
staticWado: true,
|
||||
singlepart: 'bulkdata,video',
|
||||
// whether the data source should use retrieveBulkData to grab metadata,
|
||||
// and in case of relative path, what would it be relative to, options
|
||||
// are in the series level or study level (some servers like series some study)
|
||||
bulkDataURI: {
|
||||
enabled: true,
|
||||
relativeResolution: 'studies',
|
||||
},
|
||||
omitQuotationForMultipartRequest: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
|
||||
sourceName: 'ohif3',
|
||||
configuration: {
|
||||
friendlyName: 'AWS S3 Static wado secondary server',
|
||||
name: 'aws',
|
||||
wadoUriRoot: 'https://d3t6nz73ql33tx.cloudfront.net/dicomweb',
|
||||
qidoRoot: 'https://d3t6nz73ql33tx.cloudfront.net/dicomweb',
|
||||
wadoRoot: 'https://d3t6nz73ql33tx.cloudfront.net/dicomweb',
|
||||
qidoSupportsIncludeField: false,
|
||||
supportsReject: false,
|
||||
imageRendering: 'wadors',
|
||||
thumbnailRendering: 'wadors',
|
||||
enableStudyLazyLoad: true,
|
||||
supportsFuzzyMatching: false,
|
||||
supportsWildcard: true,
|
||||
staticWado: true,
|
||||
singlepart: 'bulkdata,video',
|
||||
// whether the data source should use retrieveBulkData to grab metadata,
|
||||
// and in case of relative path, what would it be relative to, options
|
||||
// are in the series level or study level (some servers like series some study)
|
||||
bulkDataURI: {
|
||||
enabled: true,
|
||||
relativeResolution: 'studies',
|
||||
},
|
||||
omitQuotationForMultipartRequest: true,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
namespace: '@ohif/extension-default.dataSourcesModule.dicomwebproxy',
|
||||
sourceName: 'dicomwebproxy',
|
||||
|
||||
@@ -3,7 +3,7 @@ window.config = {
|
||||
routerBasename: '/',
|
||||
pacs_document_host: '152.42.173.210',
|
||||
pacs_document_port: 8080,
|
||||
expertise: false,
|
||||
expertise:false,
|
||||
enableGoogleCloudAdapter: false,
|
||||
// below flag is for performance reasons, but it might not work for all servers
|
||||
showWarningMessageForCrossOrigin: true,
|
||||
@@ -41,9 +41,9 @@ window.config = {
|
||||
configuration: {
|
||||
friendlyName: 'dcmjs DICOMWeb Server',
|
||||
name: 'GCP',
|
||||
wadoUriRoot: `http://152.42.173.210:5555/dicomWeb`,
|
||||
qidoRoot: `http://152.42.173.210:5555/dicomWeb`,
|
||||
wadoRoot: `http://152.42.173.210:5555/dicomWeb`,
|
||||
wadoUriRoot: `http://${window.location.hostname}:5555/dicomWeb`,
|
||||
qidoRoot: `http://${window.location.hostname}:5555/dicomWeb`,
|
||||
wadoRoot: `http://${window.location.hostname}:5555/dicomWeb`,
|
||||
qidoSupportsIncludeField: true,
|
||||
imageRendering: 'wadors',
|
||||
thumbnailRendering: 'wadors',
|
||||
|
||||
@@ -4,7 +4,6 @@ import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { Icons } from '../Icons';
|
||||
import { TooltipTrigger, TooltipContent, TooltipProvider, Tooltip } from '../Tooltip';
|
||||
import { Separator } from '../Separator';
|
||||
import { ScrollArea } from '../ScrollArea';
|
||||
|
||||
type StyleMap = {
|
||||
open: {
|
||||
@@ -153,23 +152,10 @@ const SidePanel = ({
|
||||
onClose,
|
||||
expandedWidth = 280,
|
||||
onActiveTabIndexChange,
|
||||
servicesManager, // Tambah servicesManager as a prop
|
||||
studyInstanceUID,
|
||||
}) => {
|
||||
const [panelOpen, setPanelOpen] = useState(activeTabIndexProp !== null);
|
||||
const [activeTabIndex, setActiveTabIndex] = useState(0);
|
||||
|
||||
const [isExpertiseVisible, setIsExpertiseVisible] = useState(false); // New state for expertise visibility
|
||||
const [expertiseData, setExpertiseData] = useState(null);
|
||||
const [isExpertiseLoading, setIsExpertiseLoading] = useState(false);
|
||||
|
||||
const { cornerstoneViewportService } = servicesManager.services;
|
||||
const [viewportData, setViewportData] = useState(null);
|
||||
|
||||
// Harusnya (viewportId), tapi karena gabutuh perubahan viewport maka dihardcode 'default'
|
||||
// const viewportInfo = cornerstoneViewportService.getViewportInfo('default');
|
||||
// const studyInstanceUID = viewportInfo?.viewportData?.data?.[0]?.StudyInstanceUID || '';
|
||||
|
||||
const styleMap = createStyleMap(expandedWidth, borderSize, collapsedWidth);
|
||||
const baseStyle = createBaseStyle(expandedWidth);
|
||||
const gridAvailableWidth = expandedWidth - closeIconWidth - gridHorizontalPadding;
|
||||
@@ -210,16 +196,6 @@ const SidePanel = ({
|
||||
updateActiveTabIndex(activeTabIndexProp);
|
||||
}, [activeTabIndexProp, updateActiveTabIndex]);
|
||||
|
||||
const toggleExpertiseVisibility = () => {
|
||||
const shouldOpenExpertise = !isExpertiseVisible;
|
||||
setIsExpertiseVisible(shouldOpenExpertise);
|
||||
|
||||
// Open the side panel if the expertise panel is being shown
|
||||
if (shouldOpenExpertise && !panelOpen) {
|
||||
updatePanelOpen(true);
|
||||
}
|
||||
};
|
||||
|
||||
const getCloseStateComponent = () => {
|
||||
const _childComponents = Array.isArray(tabs) ? tabs : [tabs];
|
||||
return (
|
||||
@@ -279,196 +255,6 @@ const SidePanel = ({
|
||||
);
|
||||
};
|
||||
|
||||
// Tambahkan di atas useEffect fetchExpertiseData
|
||||
useEffect(() => {
|
||||
const fetchAccessionNumber = async () => {
|
||||
if (!studyInstanceUID) {
|
||||
console.warn('No StudyInstanceUID available');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const qidoRootUrl = getQidoRootUrl();
|
||||
if (!qidoRootUrl) {
|
||||
console.warn('QIDO root URL not configured');
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch data with specific fields including Accession Number
|
||||
const response = await fetch(
|
||||
`${qidoRootUrl}/studies?includefield=00080050&StudyInstanceUID=${studyInstanceUID}`
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch study data');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (data && data.length > 0) {
|
||||
// Extract accession number from DICOM tag 00080050
|
||||
const accessionNumber = data[0]['00080050']?.Value?.[0] || '';
|
||||
|
||||
// If we have an accession number, call fetchExpertiseData
|
||||
if (accessionNumber) {
|
||||
console.log('Found Accession Number:', accessionNumber);
|
||||
fetchExpertiseData(accessionNumber);
|
||||
} else {
|
||||
console.warn('Accession number not found in study data');
|
||||
}
|
||||
} else {
|
||||
console.warn('No study data returned');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching accession number:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// Helper function to get QIDO root URL
|
||||
const getQidoRootUrl = () => {
|
||||
const { config } = window;
|
||||
if (!config?.dataSources || !config.defaultDataSourceName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const dataSource = config.dataSources.find(
|
||||
ds => ds.sourceName === config.defaultDataSourceName
|
||||
);
|
||||
|
||||
return dataSource?.configuration?.qidoRoot;
|
||||
};
|
||||
|
||||
fetchAccessionNumber();
|
||||
}, [studyInstanceUID]); // Run when studyInstanceUID changes
|
||||
|
||||
// Ubah fungsi fetchExpertiseData menjadi dengan parameter accessionNumber
|
||||
const fetchExpertiseData = async accessionNumber => {
|
||||
try {
|
||||
// Check if window.config.expertise_host exists
|
||||
if (!window.config?.expertise_host) {
|
||||
console.warn('Expertise host not configured in window.config.expertise_host');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!accessionNumber) {
|
||||
console.warn('No accession number available for expertise lookup');
|
||||
return;
|
||||
}
|
||||
|
||||
setIsExpertiseLoading(true);
|
||||
const url = `${window.config.expertise_host}/nv/query.php?method=view&AccessionNumber=${encodeURIComponent(accessionNumber)}`;
|
||||
|
||||
const response = await fetch(url);
|
||||
const data = await response.json();
|
||||
console.log('Study data:', data);
|
||||
|
||||
if (data?.study?.expertise && data.study.expertise.length > 0) {
|
||||
setExpertiseData(data.study.expertise[0]);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching expertise data:', error);
|
||||
} finally {
|
||||
setIsExpertiseLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const getExpertisePanel = () => {
|
||||
if (side !== 'right') return null; // Only show in the right side panel
|
||||
|
||||
if (isExpertiseLoading) {
|
||||
return (
|
||||
<div className="flex h-[500px] w-[350px] items-center justify-center text-white">
|
||||
Loading expertise data...
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!expertiseData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const parseExpertise = text => {
|
||||
if (!text) return {};
|
||||
|
||||
const result = {};
|
||||
let currentSection = 'Keterangan';
|
||||
|
||||
// Split expertise text by lines and process each line
|
||||
const lines = text.split('\r\n').filter(line => line.trim() !== '');
|
||||
|
||||
lines.forEach(line => {
|
||||
// Check if this is a section header
|
||||
if (line.includes(':') && !line.trim().startsWith('-')) {
|
||||
const parts = line.split(':');
|
||||
currentSection = parts[0].trim();
|
||||
const value = parts[1]?.trim() || '';
|
||||
|
||||
if (value) {
|
||||
if (!result[currentSection]) {
|
||||
result[currentSection] = [];
|
||||
}
|
||||
result[currentSection].push(value);
|
||||
}
|
||||
} else if (line.toLowerCase().includes('kesan')) {
|
||||
currentSection = 'Kesan';
|
||||
} else {
|
||||
// Add line to current section
|
||||
if (!result[currentSection]) {
|
||||
result[currentSection] = [];
|
||||
}
|
||||
result[currentSection].push(line.trim());
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const parsedSections = parseExpertise(expertiseData.expertise);
|
||||
|
||||
// Create formatted data structure
|
||||
const formattedData = [
|
||||
{ label: 'Dokter Pengirim', value: expertiseData.ordering_physician || '' },
|
||||
{ label: 'Dokter Radiologis', value: expertiseData.radiologist || '' },
|
||||
{ label: 'Waktu Expertise', value: expertiseData.expertise_dttm || '' },
|
||||
];
|
||||
|
||||
// Add additional sections from parsed text
|
||||
Object.entries(parsedSections).forEach(([key, value]) => {
|
||||
formattedData.push({
|
||||
label: key,
|
||||
value: Array.isArray(value) ? value : [value],
|
||||
});
|
||||
});
|
||||
|
||||
return (
|
||||
<ScrollArea className="border-input bg-background h-[500px] w-full rounded-md border p-2 text-sm text-white">
|
||||
<h3 className="mb-4 text-lg font-bold">Expertise</h3>
|
||||
{formattedData.map((section, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="mb-4"
|
||||
>
|
||||
<h5 className="text-base font-bold">{section.label}:</h5>
|
||||
{Array.isArray(section.value) ? (
|
||||
<ul className="list-disc pl-6">
|
||||
{section.value.map((item, idx) => (
|
||||
<li
|
||||
key={idx}
|
||||
className="break-words"
|
||||
>
|
||||
{item}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<p className="break-words">{section.value}</p>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</ScrollArea>
|
||||
);
|
||||
};
|
||||
|
||||
const getCloseIcon = () => {
|
||||
return (
|
||||
<div
|
||||
@@ -600,7 +386,6 @@ const SidePanel = ({
|
||||
}
|
||||
return null;
|
||||
})}
|
||||
{getExpertisePanel()} {/* Add expertise panel here */}
|
||||
</>
|
||||
) : (
|
||||
<React.Fragment>{getCloseStateComponent()}</React.Fragment>
|
||||
@@ -628,8 +413,6 @@ SidePanel.propTypes = {
|
||||
onClose: PropTypes.func,
|
||||
onActiveTabIndexChange: PropTypes.func,
|
||||
expandedWidth: PropTypes.number,
|
||||
servicesManager: PropTypes.object.isRequired, // Tambah servicesManager prop
|
||||
studyInstanceUID: PropTypes.string, // Tambahkan prop studyInstanceUID
|
||||
};
|
||||
|
||||
export { SidePanel };
|
||||
|
||||
@@ -62,8 +62,6 @@ const StudyBrowser = ({
|
||||
data-cy="thumbnail-list"
|
||||
viewPreset={viewPreset}
|
||||
onThumbnailContextMenu={onThumbnailContextMenu}
|
||||
servicesManager={servicesManager} // Pass servicesManager ke Study Item
|
||||
studyInstanceUid={studyInstanceUid}
|
||||
/>
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
@@ -20,11 +20,7 @@ const StudyItem = ({
|
||||
onClickUntrack,
|
||||
viewPreset = 'thumbnails',
|
||||
onThumbnailContextMenu,
|
||||
servicesManager, // Tambah servicesManager as a prop
|
||||
studyInstanceUid = '',
|
||||
}: withAppTypes) => {
|
||||
// FETCHING ACCESSION NUMBER DAN EXPERTISE
|
||||
|
||||
return (
|
||||
<Accordion
|
||||
type="single"
|
||||
@@ -59,33 +55,15 @@ const StudyItem = ({
|
||||
}}
|
||||
>
|
||||
{isExpanded && displaySets && (
|
||||
<>
|
||||
{/* Expertise Button */}
|
||||
<div
|
||||
className="bg-primary-dark hover:bg-primary-active mx-8 my-4 cursor-pointer rounded-lg border border-white py-3 text-center text-white"
|
||||
onClick={() => {
|
||||
// Trigger the expertise panel in the right side panel (segmentation Panel)
|
||||
servicesManager.services.panelService.activatePanel(
|
||||
// '@ohif/extension-cornerstone.panelModule.panelSegmentation-exp',
|
||||
`@ohif/extension-cornerstone.panelModule.panelSegmentation-exp-${studyInstanceUid}`,
|
||||
true
|
||||
);
|
||||
}}
|
||||
>
|
||||
Expertise
|
||||
</div>
|
||||
|
||||
{/* Thumbnails */}
|
||||
<ThumbnailList
|
||||
thumbnails={displaySets}
|
||||
activeDisplaySetInstanceUIDs={activeDisplaySetInstanceUIDs}
|
||||
onThumbnailClick={onClickThumbnail}
|
||||
onThumbnailDoubleClick={onDoubleClickThumbnail}
|
||||
onClickUntrack={onClickUntrack}
|
||||
viewPreset={viewPreset}
|
||||
onThumbnailContextMenu={onThumbnailContextMenu}
|
||||
/>
|
||||
</>
|
||||
<ThumbnailList
|
||||
thumbnails={displaySets}
|
||||
activeDisplaySetInstanceUIDs={activeDisplaySetInstanceUIDs}
|
||||
onThumbnailClick={onClickThumbnail}
|
||||
onThumbnailDoubleClick={onDoubleClickThumbnail}
|
||||
onClickUntrack={onClickUntrack}
|
||||
viewPreset={viewPreset}
|
||||
onThumbnailContextMenu={onThumbnailContextMenu}
|
||||
/>
|
||||
)}
|
||||
</AccordionContent>
|
||||
</AccordionItem>
|
||||
@@ -108,8 +86,6 @@ StudyItem.propTypes = {
|
||||
onDoubleClickThumbnail: PropTypes.func,
|
||||
onClickUntrack: PropTypes.func,
|
||||
viewPreset: PropTypes.string,
|
||||
servicesManager: PropTypes.object.isRequired, // Tambah servicesManager prop
|
||||
studyInstanceUid: PropTypes.string.string,
|
||||
};
|
||||
|
||||
export { StudyItem };
|
||||
|
||||
Reference in New Issue
Block a user