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:
1 parent
101efa4cf4
commit
5180eb127d
5 files changed
+24
-4
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user