OHIF-163: Patient Name is displayed in correct format "Last Name, First Name" (#1820)
* Add util to formatpn * Format patient name in patient information tab
This commit is contained in:
parent
101efa4cf4
commit
5180eb127d
@ -22,7 +22,7 @@
|
||||
* | limit | {number} |
|
||||
* | offset | {number} |
|
||||
*/
|
||||
import { DICOMWeb } from '@ohif/core';
|
||||
import { DICOMWeb, utils } from '@ohif/core';
|
||||
|
||||
const { getString, getName, getModalities } = DICOMWeb;
|
||||
|
||||
@ -50,7 +50,7 @@ function processResults(qidoStudies) {
|
||||
time: getString(qidoStudy['00080030']), // HHmmss.SSS (24-hour, minutes, seconds, fractional seconds)
|
||||
accession: getString(qidoStudy['00080050']) || '', // short string, probably a number?
|
||||
mrn: getString(qidoStudy['00100020']) || '', // medicalRecordNumber
|
||||
patientName: getName(qidoStudy['00100010']) || '',
|
||||
patientName: utils.formatPN(getName(qidoStudy['00100010'])) || '',
|
||||
instances: Number(getString(qidoStudy['00201208'])) || 0, // number
|
||||
description: getString(qidoStudy['00081030']) || '',
|
||||
modalities:
|
||||
|
||||
@ -250,7 +250,7 @@ function OHIFCornerstoneSRViewport({
|
||||
seriesDescription: SeriesDescription,
|
||||
modality: Modality,
|
||||
patientInformation: {
|
||||
patientName: PatientName ? PatientName.Alphabetic || '' : '',
|
||||
patientName: PatientName ? OHIF.utils.formatPN(PatientName.Alphabetic) : '',
|
||||
patientSex: PatientSex || '',
|
||||
patientAge: PatientAge || '',
|
||||
MRN: PatientID || '',
|
||||
|
||||
@ -233,7 +233,7 @@ function TrackedCornerstoneViewport({
|
||||
seriesDescription: SeriesDescription,
|
||||
modality: Modality,
|
||||
patientInformation: {
|
||||
patientName: PatientName ? PatientName.Alphabetic || '' : '',
|
||||
patientName: PatientName ? OHIF.utils.formatPN(PatientName.Alphabetic) : '',
|
||||
patientSex: PatientSex || '',
|
||||
patientAge: PatientAge || '',
|
||||
MRN: PatientID || '',
|
||||
|
||||
18
platform/core/src/utils/formatPN.js
Normal file
18
platform/core/src/utils/formatPN.js
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Formats a patient name for display purposes
|
||||
*/
|
||||
export default function formatPN(name) {
|
||||
if (!name) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert the first ^ to a ', '. String.replace() only affects
|
||||
// the first appearance of the character.
|
||||
const commaBetweenFirstAndLast = name.replace('^', ', ');
|
||||
|
||||
// Replace any remaining '^' characters with spaces
|
||||
const cleaned = commaBetweenFirstAndLast.replace(/\^/g, ' ');
|
||||
|
||||
// Trim any extraneous whitespace
|
||||
return cleaned.trim();
|
||||
}
|
||||
@ -15,6 +15,7 @@ import makeCancelable from './makeCancelable';
|
||||
import hotkeys from './hotkeys';
|
||||
import Queue from './Queue';
|
||||
import isDicomUid from './isDicomUid';
|
||||
import formatPN from './formatPN';
|
||||
import resolveObjectPath from './resolveObjectPath';
|
||||
import * as hierarchicalListUtils from './hierarchicalListUtils';
|
||||
import * as progressTrackingUtils from './progressTrackingUtils';
|
||||
@ -26,6 +27,7 @@ const utils = {
|
||||
addServers,
|
||||
sortBy,
|
||||
writeScript,
|
||||
formatPN,
|
||||
b64toBlob,
|
||||
StackManager,
|
||||
studyMetadataManager,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user