ini bisone internal click dari bisone -p 3000

This commit is contained in:
mario
2025-05-19 15:54:36 +07:00
parent 860a738734
commit f4dea5a9d6
4 changed files with 42 additions and 33 deletions

View File

@@ -356,14 +356,21 @@ const SidePanel = ({
}
setIsExpertiseLoading(true);
const url = `${window.config.expertise_host}/nv/query.php?method=view&AccessionNumber=${encodeURIComponent(accessionNumber)}`;
const url = `${window.config.expertise_host}?accessionNo=${accessionNumber}`;
const response = await fetch(url);
const data = await response.json();
console.log('Study data:', data);
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),
};
if (data?.study?.expertise && data.study.expertise.length > 0) {
setExpertiseData(data.study.expertise[0]);
setExpertiseData(formattedExpertiseData);
}
} catch (error) {
console.error('Error fetching expertise data:', error);
@@ -372,6 +379,32 @@ const SidePanel = ({
}
};
// 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