terra-clinical-result
Version:
The Terra Clinical Result package is a collection of standardized views for presenting clinical results documented to a Patient's Medical Chart, such as Vital Signs, Laboratory Results, and Discretely Documented Values
133 lines (132 loc) • 6.76 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _classnames = _interopRequireDefault(require("classnames"));
var _bind = _interopRequireDefault(require("classnames/bind"));
var _terraThemeContext = _interopRequireDefault(require("terra-theme-context"));
var _ClinicalResultDisplay = _interopRequireDefault(require("./_ClinicalResultDisplay"));
var _ResultError = _interopRequireDefault(require("./common/other/_ResultError"));
var _KnownNoData = _interopRequireDefault(require("./common/other/_KnownNoData"));
var _statusPropTypes = _interopRequireDefault(require("./proptypes/statusPropTypes"));
var _interpretationPropTypes = _interopRequireDefault(require("./proptypes/interpretationPropTypes"));
var _valuePropTypes = _interopRequireDefault(require("./proptypes/valuePropTypes"));
var _ClinicalResultModule = _interopRequireDefault(require("./ClinicalResult.module.scss"));
var _excluded = ["eventId", "result", "interpretation", "hideUnit", "isTruncated", "isUnverified", "isModified", "hasComment", "hasResultError", "hasResultNoData", "hideAccessoryDisplays", "conceptDisplay", "status", "datetimeDisplay"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
var cx = _bind.default.bind(_ClinicalResultModule.default);
var propTypes = {
/**
* A unique event identifier attached to the result data
*/
eventId: _propTypes.default.string,
/**
* Value and optional Unit of Measure for the Observation Result
*/
result: _valuePropTypes.default,
/**
* Interpretation of the Result, indicates Criticality
*/
interpretation: _interpretationPropTypes.default,
/**
* Adds indicator if result value has not been verified, typically if it has not been
* authenticated and committed to the patient's chart.
*/
isUnverified: _propTypes.default.bool,
/**
* Display to show the full Result Name/Label Concept, e.g. `'Temperature Oral'`.
*/
conceptDisplay: _propTypes.default.string,
/**
* Display to show an appropriate clinically relevant documented datetime.
*/
datetimeDisplay: _propTypes.default.string,
/**
* Visually hides the unit of measure when presented in a series of side-by-side columns of the same unit.
*/
hideUnit: _propTypes.default.bool,
/**
* Whether or not the text should be truncated in display. Restricts clinical result details each to one line.
*/
isTruncated: _propTypes.default.bool,
/**
* Adds indicator if the result value has been modified to a different value from its
* previously documented value for the same clinical result date & time.
*/
isModified: _propTypes.default.bool,
/**
* Adds indicator if the result value has an additional comment applied to the clinical result value.
*/
hasComment: _propTypes.default.bool,
/**
* Override that shows an Error display. Used when there is a known error or problem when retrieving or assembling the clinical result data.
*/
hasResultError: _propTypes.default.bool,
/**
* Override that shows a known "No Data" display. Used when there is known to be no value for a given clinical result concept at a specific datetime.
*/
hasResultNoData: _propTypes.default.bool,
/**
* Enum for possible Result Statuses.
* One of `'entered-in-error'`s.
*/
status: _statusPropTypes.default,
/**
* @private
* Used by Flowsheet Result Cell to hide icons because it displays them in different positions.
*/
hideAccessoryDisplays: _propTypes.default.bool
};
var ClinicalResult = function ClinicalResult(props) {
var eventId = props.eventId,
result = props.result,
interpretation = props.interpretation,
hideUnit = props.hideUnit,
isTruncated = props.isTruncated,
isUnverified = props.isUnverified,
isModified = props.isModified,
hasComment = props.hasComment,
hasResultError = props.hasResultError,
hasResultNoData = props.hasResultNoData,
hideAccessoryDisplays = props.hideAccessoryDisplays,
conceptDisplay = props.conceptDisplay,
status = props.status,
datetimeDisplay = props.datetimeDisplay,
customProps = _objectWithoutProperties(props, _excluded);
var clinicalResultDisplay;
if (hasResultError) {
clinicalResultDisplay = /*#__PURE__*/_react.default.createElement(_ResultError.default, null);
} else if (hasResultNoData) {
clinicalResultDisplay = /*#__PURE__*/_react.default.createElement(_KnownNoData.default, null);
} else {
clinicalResultDisplay = /*#__PURE__*/_react.default.createElement(_ClinicalResultDisplay.default, {
eventId: eventId,
result: result,
interpretation: interpretation,
isUnverified: isUnverified,
status: status,
hideUnit: hideUnit,
isTruncated: isTruncated,
hideAccessoryDisplays: hideAccessoryDisplays,
isModified: isModified,
hasComment: hasComment,
conceptDisplay: conceptDisplay,
datetimeDisplay: datetimeDisplay
});
}
var theme = _react.default.useContext(_terraThemeContext.default);
var clinicalResultClassnames = (0, _classnames.default)(cx('clinical-result', {
truncated: isTruncated
}, theme.className), customProps.className);
return /*#__PURE__*/_react.default.createElement("div", _extends({}, customProps, {
className: clinicalResultClassnames
}), clinicalResultDisplay);
};
ClinicalResult.propTypes = propTypes;
var _default = exports.default = ClinicalResult;