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} |
|
* | limit | {number} |
|
||||||
* | offset | {number} |
|
* | offset | {number} |
|
||||||
*/
|
*/
|
||||||
import { DICOMWeb } from '@ohif/core';
|
import { DICOMWeb, utils } from '@ohif/core';
|
||||||
|
|
||||||
const { getString, getName, getModalities } = DICOMWeb;
|
const { getString, getName, getModalities } = DICOMWeb;
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ function processResults(qidoStudies) {
|
|||||||
time: getString(qidoStudy['00080030']), // HHmmss.SSS (24-hour, minutes, seconds, fractional seconds)
|
time: getString(qidoStudy['00080030']), // HHmmss.SSS (24-hour, minutes, seconds, fractional seconds)
|
||||||
accession: getString(qidoStudy['00080050']) || '', // short string, probably a number?
|
accession: getString(qidoStudy['00080050']) || '', // short string, probably a number?
|
||||||
mrn: getString(qidoStudy['00100020']) || '', // medicalRecordNumber
|
mrn: getString(qidoStudy['00100020']) || '', // medicalRecordNumber
|
||||||
patientName: getName(qidoStudy['00100010']) || '',
|
patientName: utils.formatPN(getName(qidoStudy['00100010'])) || '',
|
||||||
instances: Number(getString(qidoStudy['00201208'])) || 0, // number
|
instances: Number(getString(qidoStudy['00201208'])) || 0, // number
|
||||||
description: getString(qidoStudy['00081030']) || '',
|
description: getString(qidoStudy['00081030']) || '',
|
||||||
modalities:
|
modalities:
|
||||||
|
|||||||
@ -250,7 +250,7 @@ function OHIFCornerstoneSRViewport({
|
|||||||
seriesDescription: SeriesDescription,
|
seriesDescription: SeriesDescription,
|
||||||
modality: Modality,
|
modality: Modality,
|
||||||
patientInformation: {
|
patientInformation: {
|
||||||
patientName: PatientName ? PatientName.Alphabetic || '' : '',
|
patientName: PatientName ? OHIF.utils.formatPN(PatientName.Alphabetic) : '',
|
||||||
patientSex: PatientSex || '',
|
patientSex: PatientSex || '',
|
||||||
patientAge: PatientAge || '',
|
patientAge: PatientAge || '',
|
||||||
MRN: PatientID || '',
|
MRN: PatientID || '',
|
||||||
|
|||||||
@ -233,7 +233,7 @@ function TrackedCornerstoneViewport({
|
|||||||
seriesDescription: SeriesDescription,
|
seriesDescription: SeriesDescription,
|
||||||
modality: Modality,
|
modality: Modality,
|
||||||
patientInformation: {
|
patientInformation: {
|
||||||
patientName: PatientName ? PatientName.Alphabetic || '' : '',
|
patientName: PatientName ? OHIF.utils.formatPN(PatientName.Alphabetic) : '',
|
||||||
patientSex: PatientSex || '',
|
patientSex: PatientSex || '',
|
||||||
patientAge: PatientAge || '',
|
patientAge: PatientAge || '',
|
||||||
MRN: PatientID || '',
|
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 hotkeys from './hotkeys';
|
||||||
import Queue from './Queue';
|
import Queue from './Queue';
|
||||||
import isDicomUid from './isDicomUid';
|
import isDicomUid from './isDicomUid';
|
||||||
|
import formatPN from './formatPN';
|
||||||
import resolveObjectPath from './resolveObjectPath';
|
import resolveObjectPath from './resolveObjectPath';
|
||||||
import * as hierarchicalListUtils from './hierarchicalListUtils';
|
import * as hierarchicalListUtils from './hierarchicalListUtils';
|
||||||
import * as progressTrackingUtils from './progressTrackingUtils';
|
import * as progressTrackingUtils from './progressTrackingUtils';
|
||||||
@ -26,6 +27,7 @@ const utils = {
|
|||||||
addServers,
|
addServers,
|
||||||
sortBy,
|
sortBy,
|
||||||
writeScript,
|
writeScript,
|
||||||
|
formatPN,
|
||||||
b64toBlob,
|
b64toBlob,
|
||||||
StackManager,
|
StackManager,
|
||||||
studyMetadataManager,
|
studyMetadataManager,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user