Compare commits
7 Commits
auth-patch
...
bisone-int
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63b9bc5ffc | ||
|
|
f4dea5a9d6 | ||
|
|
860a738734 | ||
|
|
f323b0b046 | ||
|
|
ca84179aa6 | ||
|
|
841f84bfdb | ||
|
|
02a1abc93f |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -12,6 +12,7 @@ coverage/
|
|||||||
.yarn/
|
.yarn/
|
||||||
.nx/
|
.nx/
|
||||||
addOns/yarn.lock
|
addOns/yarn.lock
|
||||||
|
**.zip
|
||||||
|
|
||||||
# YALC (for Erik)
|
# YALC (for Erik)
|
||||||
.yalc
|
.yalc
|
||||||
@@ -59,3 +60,4 @@ tests/playwright-report/
|
|||||||
|
|
||||||
# Dummy
|
# Dummy
|
||||||
/dump
|
/dump
|
||||||
|
platform/app/dist.zip
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ const SidePanelWithServices = ({
|
|||||||
const [sidePanelOpen, setSidePanelOpen] = useState(activeTabIndexProp !== null);
|
const [sidePanelOpen, setSidePanelOpen] = useState(activeTabIndexProp !== null);
|
||||||
const [activeTabIndex, setActiveTabIndex] = useState(activeTabIndexProp);
|
const [activeTabIndex, setActiveTabIndex] = useState(activeTabIndexProp);
|
||||||
const [tabs, setTabs] = useState(tabsProp ?? panelService.getPanels(side));
|
const [tabs, setTabs] = useState(tabsProp ?? panelService.getPanels(side));
|
||||||
|
const [studyInstanceUID, setStudyInstanceUID] = useState('');
|
||||||
|
const [lastActivatedStudyUID, setLastActivatedStudyUID] = useState('');
|
||||||
|
|
||||||
const handleActiveTabIndexChange = useCallback(({ activeTabIndex }) => {
|
const handleActiveTabIndexChange = useCallback(({ activeTabIndex }) => {
|
||||||
setActiveTabIndex(activeTabIndex);
|
setActiveTabIndex(activeTabIndex);
|
||||||
@@ -71,11 +73,35 @@ const SidePanelWithServices = ({
|
|||||||
const activatePanelSubscription = panelService.subscribe(
|
const activatePanelSubscription = panelService.subscribe(
|
||||||
panelService.EVENTS.ACTIVATE_PANEL,
|
panelService.EVENTS.ACTIVATE_PANEL,
|
||||||
(activatePanelEvent: Types.ActivatePanelEvent) => {
|
(activatePanelEvent: Types.ActivatePanelEvent) => {
|
||||||
if (sidePanelOpen || activatePanelEvent.forceActive) {
|
const isExpertisePanel = activatePanelEvent.panelId.includes('-exp-');
|
||||||
const tabIndex = tabs.findIndex(tab => tab.id === activatePanelEvent.panelId);
|
const realPanelID = isExpertisePanel
|
||||||
if (tabIndex !== -1) {
|
? activatePanelEvent.panelId.split('-exp-')[0]
|
||||||
setActiveTabIndex(tabIndex);
|
: 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -83,7 +109,7 @@ const SidePanelWithServices = ({
|
|||||||
return () => {
|
return () => {
|
||||||
activatePanelSubscription.unsubscribe();
|
activatePanelSubscription.unsubscribe();
|
||||||
};
|
};
|
||||||
}, [tabs, sidePanelOpen, panelService]);
|
}, [tabs, sidePanelOpen, panelService, lastActivatedStudyUID]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SidePanel
|
<SidePanel
|
||||||
@@ -95,6 +121,8 @@ const SidePanelWithServices = ({
|
|||||||
onClose={handleClose}
|
onClose={handleClose}
|
||||||
onActiveTabIndexChange={handleActiveTabIndexChange}
|
onActiveTabIndexChange={handleActiveTabIndexChange}
|
||||||
expandedWidth={expandedWidth}
|
expandedWidth={expandedWidth}
|
||||||
|
servicesManager={servicesManager} // Pass servicesManager ke SidePanel
|
||||||
|
studyInstanceUID={studyInstanceUID}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ function OHIFCornerstonePdfViewport({ displaySets }) {
|
|||||||
var [url, setUrl] = useState(null);
|
var [url, setUrl] = useState(null);
|
||||||
|
|
||||||
const sopInstanceUid = displaySets[0].SOPInstanceUID;
|
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('PDF URL:', url);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.body.addEventListener('drag', makePdfDropTarget);
|
document.body.addEventListener('drag', makePdfDropTarget);
|
||||||
@@ -33,13 +35,15 @@ function OHIFCornerstonePdfViewport({ displaySets }) {
|
|||||||
|
|
||||||
const { pdfUrl } = displaySets[0];
|
const { pdfUrl } = displaySets[0];
|
||||||
|
|
||||||
useEffect(() => {
|
// console.log('Dicomweb PDF URL:', pdfUrl);
|
||||||
const load = async () => {
|
|
||||||
setUrl(await pdfUrl);
|
|
||||||
};
|
|
||||||
|
|
||||||
load();
|
// useEffect(() => {
|
||||||
}, [pdfUrl]);
|
// const load = async () => {
|
||||||
|
// setUrl(await pdfUrl);
|
||||||
|
// };
|
||||||
|
|
||||||
|
// load();
|
||||||
|
// }, [pdfUrl]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -50,9 +54,7 @@ function OHIFCornerstonePdfViewport({ displaySets }) {
|
|||||||
data={url}
|
data={url}
|
||||||
type="application/pdf"
|
type="application/pdf"
|
||||||
className={style}
|
className={style}
|
||||||
>
|
></object>
|
||||||
<div>No online PDF viewer installed</div>
|
|
||||||
</object>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,10 @@ window.config = {
|
|||||||
// above, the number of requests can be go a lot higher.
|
// above, the number of requests can be go a lot higher.
|
||||||
prefetch: 25,
|
prefetch: 25,
|
||||||
},
|
},
|
||||||
expertise: true, //* Tambahan untuk enable expertise (CustomizableViewportOverlay)
|
expertise: false, //* Tambahan untuk enable expertise (CustomizableViewportOverlay)
|
||||||
|
expertise_host: `https://devone.aplikasi.web.id/one-api/mockup/pacsmwl/Workorder/get_dummy_expertise`, //* Tambahan untuk fetch data Expertise)
|
||||||
|
pacs_document_host: `152.42.173.210`,
|
||||||
|
pacs_document_port: 8080,
|
||||||
// filterQueryParam: false,
|
// filterQueryParam: false,
|
||||||
// defaultDataSourceName: 'dicomweb',
|
// defaultDataSourceName: 'dicomweb',
|
||||||
defaultDataSourceName: 'local-proxy',
|
defaultDataSourceName: 'local-proxy',
|
||||||
@@ -38,100 +41,14 @@ window.config = {
|
|||||||
// regex: /.*/,
|
// regex: /.*/,
|
||||||
// },
|
// },
|
||||||
dataSources: [
|
dataSources: [
|
||||||
{
|
|
||||||
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.dicomweb',
|
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
|
||||||
sourceName: 'local-proxy',
|
sourceName: 'local-proxy',
|
||||||
configuration: {
|
configuration: {
|
||||||
friendlyName: 'Static WADO Local Data',
|
friendlyName: 'Static WADO Local Data',
|
||||||
name: 'DCM4CHEE',
|
name: 'DCM4CHEE',
|
||||||
qidoRoot: 'http://128.199.154.150:5000/rs',
|
qidoRoot: `http://152.42.173.210:5000/rs`,
|
||||||
wadoRoot: 'http://128.199.154.150:5000/rs',
|
wadoRoot: `http://152.42.173.210:5000/rs`,
|
||||||
qidoSupportsIncludeField: false,
|
qidoSupportsIncludeField: false,
|
||||||
supportsReject: true,
|
supportsReject: true,
|
||||||
supportsStow: true,
|
supportsStow: true,
|
||||||
|
|||||||
@@ -1,44 +1,15 @@
|
|||||||
/** @type {AppTypes.Config} */
|
/** @type {AppTypes.Config} */
|
||||||
window.config = {
|
window.config = {
|
||||||
routerBasename: '/',
|
routerBasename: '/',
|
||||||
|
pacs_document_host: '152.42.173.210',
|
||||||
|
pacs_document_port: 8080,
|
||||||
|
expertise: false,
|
||||||
enableGoogleCloudAdapter: false,
|
enableGoogleCloudAdapter: false,
|
||||||
// below flag is for performance reasons, but it might not work for all servers
|
// below flag is for performance reasons, but it might not work for all servers
|
||||||
showWarningMessageForCrossOrigin: true,
|
showWarningMessageForCrossOrigin: true,
|
||||||
showCPUFallbackMessage: true,
|
showCPUFallbackMessage: true,
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
strictZSpacingForVolumeViewport: true,
|
strictZSpacingForVolumeViewport: true,
|
||||||
// This is an array, but we'll only use the first entry for now
|
|
||||||
oidc: [
|
|
||||||
{
|
|
||||||
// ~ REQUIRED
|
|
||||||
// Authorization Server URL
|
|
||||||
authority: 'https://accounts.google.com',
|
|
||||||
client_id: '382212153306-7q39hdie4ecj0uhemkitvedo93bnvfhn.apps.googleusercontent.com',
|
|
||||||
redirect_uri: '/callback',
|
|
||||||
response_type: 'id_token token',
|
|
||||||
scope:
|
|
||||||
'email profile openid https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/cloud-healthcare', // email profile openid
|
|
||||||
// ~ OPTIONAL
|
|
||||||
post_logout_redirect_uri: '/logout-redirect.html',
|
|
||||||
revoke_uri: 'https://accounts.google.com/o/oauth2/revoke?token=',
|
|
||||||
automaticSilentRenew: true,
|
|
||||||
revokeAccessTokenOnSignout: true,
|
|
||||||
|
|
||||||
// Tambahan dari Google CLoud Secret
|
|
||||||
project_id: "westone-433204",
|
|
||||||
auth_uri: "https://accounts.google.com/o/oauth2/auth",
|
|
||||||
token_uri: "https://oauth2.googleapis.com/token",
|
|
||||||
auth_provider_x509_cert_url: "https://www.googleapis.com/oauth2/v1/certs",
|
|
||||||
client_secret: "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",
|
|
||||||
redirect_uris: [
|
|
||||||
"http://devkedungdoro.aplikasi.web.id:3000/callback"
|
|
||||||
],
|
|
||||||
javascript_origins: [
|
|
||||||
"https://devone.aplikasi.web.id",
|
|
||||||
"http://devkedungdoro.aplikasi.web.id:3000"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
],
|
|
||||||
extensions: [],
|
extensions: [],
|
||||||
modes: [],
|
modes: [],
|
||||||
showStudyList: true,
|
showStudyList: true,
|
||||||
@@ -51,12 +22,9 @@ window.config = {
|
|||||||
configuration: {
|
configuration: {
|
||||||
friendlyName: 'dcmjs DICOMWeb Server',
|
friendlyName: 'dcmjs DICOMWeb Server',
|
||||||
name: 'GCP',
|
name: 'GCP',
|
||||||
wadoUriRoot:
|
wadoUriRoot: `http://152.42.173.210:5555/dicomWeb`,
|
||||||
'https://healthcare.googleapis.com/v1/projects/westone-433204/locations/asia-southeast2/datasets/sas-dicom-storage/dicomStores/ohif/dicomWeb',
|
qidoRoot: `http://152.42.173.210:5555/dicomWeb`,
|
||||||
qidoRoot:
|
wadoRoot: `http://152.42.173.210:5555/dicomWeb`,
|
||||||
'https://healthcare.googleapis.com/v1/projects/westone-433204/locations/asia-southeast2/datasets/sas-dicom-storage/dicomStores/ohif/dicomWeb',
|
|
||||||
wadoRoot:
|
|
||||||
'https://healthcare.googleapis.com/v1/projects/westone-433204/locations/asia-southeast2/datasets/sas-dicom-storage/dicomStores/ohif/dicomWeb',
|
|
||||||
qidoSupportsIncludeField: true,
|
qidoSupportsIncludeField: true,
|
||||||
imageRendering: 'wadors',
|
imageRendering: 'wadors',
|
||||||
thumbnailRendering: 'wadors',
|
thumbnailRendering: 'wadors',
|
||||||
@@ -66,12 +34,6 @@ window.config = {
|
|||||||
dicomUploadEnabled: true,
|
dicomUploadEnabled: true,
|
||||||
omitQuotationForMultipartRequest: true,
|
omitQuotationForMultipartRequest: true,
|
||||||
configurationAPI: 'ohif.dataSourceConfigurationAPI.google',
|
configurationAPI: 'ohif.dataSourceConfigurationAPI.google',
|
||||||
defaultDicomStoreConfiguredItems: {
|
|
||||||
id: 'projects/westone-433204/locations/asia-southeast2/datasets/sas-dicom-storage',
|
|
||||||
itemType: '3',
|
|
||||||
name: 'ohif',
|
|
||||||
url: 'https://healthcare.googleapis.com/v1/projects/westone-433204/locations/asia-southeast2/datasets/sas-dicom-storage/dicomStores/ohif'
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import React, { useCallback, useEffect, useState } from 'react';
|
|||||||
import { Icons } from '../Icons';
|
import { Icons } from '../Icons';
|
||||||
import { TooltipTrigger, TooltipContent, TooltipProvider, Tooltip } from '../Tooltip';
|
import { TooltipTrigger, TooltipContent, TooltipProvider, Tooltip } from '../Tooltip';
|
||||||
import { Separator } from '../Separator';
|
import { Separator } from '../Separator';
|
||||||
|
import { ScrollArea } from '../ScrollArea';
|
||||||
|
|
||||||
type StyleMap = {
|
type StyleMap = {
|
||||||
open: {
|
open: {
|
||||||
@@ -152,10 +153,23 @@ const SidePanel = ({
|
|||||||
onClose,
|
onClose,
|
||||||
expandedWidth = 280,
|
expandedWidth = 280,
|
||||||
onActiveTabIndexChange,
|
onActiveTabIndexChange,
|
||||||
|
servicesManager, // Tambah servicesManager as a prop
|
||||||
|
studyInstanceUID,
|
||||||
}) => {
|
}) => {
|
||||||
const [panelOpen, setPanelOpen] = useState(activeTabIndexProp !== null);
|
const [panelOpen, setPanelOpen] = useState(activeTabIndexProp !== null);
|
||||||
const [activeTabIndex, setActiveTabIndex] = useState(0);
|
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 styleMap = createStyleMap(expandedWidth, borderSize, collapsedWidth);
|
||||||
const baseStyle = createBaseStyle(expandedWidth);
|
const baseStyle = createBaseStyle(expandedWidth);
|
||||||
const gridAvailableWidth = expandedWidth - closeIconWidth - gridHorizontalPadding;
|
const gridAvailableWidth = expandedWidth - closeIconWidth - gridHorizontalPadding;
|
||||||
@@ -196,6 +210,16 @@ const SidePanel = ({
|
|||||||
updateActiveTabIndex(activeTabIndexProp);
|
updateActiveTabIndex(activeTabIndexProp);
|
||||||
}, [activeTabIndexProp, updateActiveTabIndex]);
|
}, [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 getCloseStateComponent = () => {
|
||||||
const _childComponents = Array.isArray(tabs) ? tabs : [tabs];
|
const _childComponents = Array.isArray(tabs) ? tabs : [tabs];
|
||||||
return (
|
return (
|
||||||
@@ -255,6 +279,224 @@ 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}?accessionNo=${accessionNumber}`;
|
||||||
|
|
||||||
|
const response = await fetch(url);
|
||||||
|
const data = await response.json();
|
||||||
|
if (data?.status === 'OK' && data?.data) {
|
||||||
|
// Create expertise data in the format expected by your component
|
||||||
|
const formattedExpertiseData = {
|
||||||
|
ordering_physician: data.data.senderDoctorName,
|
||||||
|
radiologist: data.data.pjDoctorName,
|
||||||
|
expertise_dttm: data.data.expTime,
|
||||||
|
// Convert the expertise object to a string format that parseExpertise can handle
|
||||||
|
expertise: formatExpertiseToString(data.data.expertise),
|
||||||
|
};
|
||||||
|
|
||||||
|
setExpertiseData(formattedExpertiseData);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching expertise data:', error);
|
||||||
|
} finally {
|
||||||
|
setIsExpertiseLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Helper function to convert expertise object to string format
|
||||||
|
const formatExpertiseToString = expertiseObj => {
|
||||||
|
if (!expertiseObj) return '';
|
||||||
|
|
||||||
|
let result = '';
|
||||||
|
|
||||||
|
// Add each section with proper formatting
|
||||||
|
if (expertiseObj.Indikasi) {
|
||||||
|
result += `KLINIS: ${expertiseObj.Indikasi}\r\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (expertiseObj.Teknik) {
|
||||||
|
result += `TEKNIK: ${expertiseObj.Teknik}\r\n\r\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (expertiseObj.Deskripsi) {
|
||||||
|
result += `KETERANGAN:\r\n${expertiseObj.Deskripsi.replace(/\n/g, '\r\n')}\r\n\r\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (expertiseObj.Kesan) {
|
||||||
|
result += `KESAN: ${expertiseObj.Kesan}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
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-[350px] 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}>{item}</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
) : (
|
||||||
|
<p>{section.value}</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</ScrollArea>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const getCloseIcon = () => {
|
const getCloseIcon = () => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -386,6 +628,7 @@ const SidePanel = ({
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
})}
|
})}
|
||||||
|
{getExpertisePanel()} {/* Add expertise panel here */}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<React.Fragment>{getCloseStateComponent()}</React.Fragment>
|
<React.Fragment>{getCloseStateComponent()}</React.Fragment>
|
||||||
@@ -413,6 +656,8 @@ SidePanel.propTypes = {
|
|||||||
onClose: PropTypes.func,
|
onClose: PropTypes.func,
|
||||||
onActiveTabIndexChange: PropTypes.func,
|
onActiveTabIndexChange: PropTypes.func,
|
||||||
expandedWidth: PropTypes.number,
|
expandedWidth: PropTypes.number,
|
||||||
|
servicesManager: PropTypes.object.isRequired, // Tambah servicesManager prop
|
||||||
|
studyInstanceUID: PropTypes.string, // Tambahkan prop studyInstanceUID
|
||||||
};
|
};
|
||||||
|
|
||||||
export { SidePanel };
|
export { SidePanel };
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ const StudyBrowser = ({
|
|||||||
data-cy="thumbnail-list"
|
data-cy="thumbnail-list"
|
||||||
viewPreset={viewPreset}
|
viewPreset={viewPreset}
|
||||||
onThumbnailContextMenu={onThumbnailContextMenu}
|
onThumbnailContextMenu={onThumbnailContextMenu}
|
||||||
|
servicesManager={servicesManager} // Pass servicesManager ke Study Item
|
||||||
|
studyInstanceUid={studyInstanceUid}
|
||||||
/>
|
/>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -20,7 +20,11 @@ const StudyItem = ({
|
|||||||
onClickUntrack,
|
onClickUntrack,
|
||||||
viewPreset = 'thumbnails',
|
viewPreset = 'thumbnails',
|
||||||
onThumbnailContextMenu,
|
onThumbnailContextMenu,
|
||||||
|
servicesManager, // Tambah servicesManager as a prop
|
||||||
|
studyInstanceUid = '',
|
||||||
}: withAppTypes) => {
|
}: withAppTypes) => {
|
||||||
|
// FETCHING ACCESSION NUMBER DAN EXPERTISE
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Accordion
|
<Accordion
|
||||||
type="single"
|
type="single"
|
||||||
@@ -55,15 +59,33 @@ const StudyItem = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isExpanded && displaySets && (
|
{isExpanded && displaySets && (
|
||||||
<ThumbnailList
|
<>
|
||||||
thumbnails={displaySets}
|
{/* Expertise Button */}
|
||||||
activeDisplaySetInstanceUIDs={activeDisplaySetInstanceUIDs}
|
<div
|
||||||
onThumbnailClick={onClickThumbnail}
|
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"
|
||||||
onThumbnailDoubleClick={onDoubleClickThumbnail}
|
onClick={() => {
|
||||||
onClickUntrack={onClickUntrack}
|
// Trigger the expertise panel in the right side panel (segmentation Panel)
|
||||||
viewPreset={viewPreset}
|
servicesManager.services.panelService.activatePanel(
|
||||||
onThumbnailContextMenu={onThumbnailContextMenu}
|
// '@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}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</AccordionContent>
|
</AccordionContent>
|
||||||
</AccordionItem>
|
</AccordionItem>
|
||||||
@@ -86,6 +108,8 @@ StudyItem.propTypes = {
|
|||||||
onDoubleClickThumbnail: PropTypes.func,
|
onDoubleClickThumbnail: PropTypes.func,
|
||||||
onClickUntrack: PropTypes.func,
|
onClickUntrack: PropTypes.func,
|
||||||
viewPreset: PropTypes.string,
|
viewPreset: PropTypes.string,
|
||||||
|
servicesManager: PropTypes.object.isRequired, // Tambah servicesManager prop
|
||||||
|
studyInstanceUid: PropTypes.string.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export { StudyItem };
|
export { StudyItem };
|
||||||
|
|||||||
Reference in New Issue
Block a user