Skip to content

Commit

Permalink
Merge pull request #560 from mozzy11/2.8
Browse files Browse the repository at this point in the history
more fixes
  • Loading branch information
mozzy11 authored Sep 20, 2023
2 parents a797bec + c923e3e commit c41a1dd
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 29 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/pathology/PathologyCaseView.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ function PathologyCaseView() {
/>
</Column>
<Column lg={4}>
Pathology Report
<FormattedMessage id="pathology.label.report" />
</Column>
<Column lg={2} md={1} sm={2}>
{pathologySampleInfo.reports[index].image &&
Expand Down
107 changes: 81 additions & 26 deletions frontend/src/components/patient/resultsViewer/results-viewer.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { useContext, useState, useEffect, useRef } from 'react';
import { Heading, Grid, Column, Section, Loading, Breadcrumb, BreadcrumbItem, Tag} from '@carbon/react';
import { Heading, Grid, Column, Section, Loading, Breadcrumb, BreadcrumbItem, Tag } from '@carbon/react';
import { useTranslation } from 'react-i18next';
import { EmptyState, ErrorState } from './commons';
import { FilterContext, FilterProvider } from './filter';
import { useGetManyObstreeData } from './grouped-timeline';
import './results-viewer.styles.scss';
import { useParams } from 'react-router-dom';
import TreeViewWrapper from './tree-view';
import { FormattedMessage, injectIntl ,useIntl } from 'react-intl'
import { FormattedMessage, injectIntl, useIntl } from 'react-intl'
import config from '../../../config.json';
import { getFromOpenElisServer } from "../../utils/Utils";

Expand Down Expand Up @@ -62,7 +62,12 @@ const RoutedResultsViewer: React.FC<ResultsViewerProps> = () => {
const { t } = useTranslation();

if (error) {
return <ErrorState error={error} headerTitle={t('dataLoadError', 'Data Load Error')} />;
return (
<ErrorState
error={error}
headerTitle={t("dataLoadError", "Data Load Error")}
/>
);
}

if (loading) {
Expand All @@ -71,11 +76,11 @@ const RoutedResultsViewer: React.FC<ResultsViewerProps> = () => {
<Grid fullWidth={true}>
<Column lg={16}>
<EmptyState
headerTitle={t('testResults', 'Test Results')}
displayText={t('testResultsData', 'Test results data')}
headerTitle={t("testResults", "Test Results")}
displayText={t("testResultsData", "Test results data")}
/>
</Column>
</Grid>)
</Grid>
</>
);
}
Expand All @@ -84,22 +89,61 @@ const RoutedResultsViewer: React.FC<ResultsViewerProps> = () => {
<>

<Breadcrumb>
<BreadcrumbItem href="/">{intl.formatMessage({ id: "home.label" })}</BreadcrumbItem>
<BreadcrumbItem href="/PatientHistory">{intl.formatMessage({ id: "label.search.patient" })}</BreadcrumbItem>
<BreadcrumbItem href="/">
{intl.formatMessage({ id: "home.label" })}
</BreadcrumbItem>
<BreadcrumbItem href="/PatientHistory">
{intl.formatMessage({ id: "label.search.patient" })}
</BreadcrumbItem>
</Breadcrumb>

<Grid fullWidth={true}>
<Column lg={16}>
<Section>
<Section>
{patient ? (<div className="patient-header">
<div className="patient-name"><Tag type="blue">Name :</Tag>{patient.lastName} {patient.firstName}</div>
<div className="patient-dob"> <Tag type="blue">Gender :</Tag>{patient.gender === 'M'?"Male" : "Female" } <Tag type="blue">DOB :</Tag> {patient.birthDateForDisplay}</div>
<div className="patient-id"><Tag type="blue">Unique Health ID number :</Tag>{patient.subjectNumber} </div>
<div className="patient-id"><Tag type="blue">National ID :</Tag>{patient.nationalId}</div>
</div>) : (<div className="patient-header">
<div className="patient-name">Patient Id Doest Exist</div>
</div>)}
<div className="patient-name">
<Tag type="blue">
<FormattedMessage id="patient.label.name" /> :
</Tag>
{patient.lastName} {patient.firstName}
</div>
<div className="patient-dob">
{" "}
<Tag type="blue">
<FormattedMessage id="patient.label.sex" /> :
</Tag>
{patient.gender === "M" ? (
<FormattedMessage id="patient.male" />
) : (
<FormattedMessage id="patient.female" />
)}{" "}
<Tag type="blue">
<FormattedMessage id="patient.dob" /> :
</Tag>{" "}
{patient.birthDateForDisplay}
</div>
<div className="patient-id">
<Tag type="blue">
<FormattedMessage id="patient.subject.number" /> :
</Tag>
{patient.subjectNumber}{" "}
</div>
<div className="patient-id">
<Tag type="blue">
<FormattedMessage id="patient.natioanalid" /> :
</Tag>
{patient.nationalId}
</div>
</div>
) : (
<div className="patient-header">
<div className="patient-name">
{" "}
<FormattedMessage id="patient.label.nopatientid" />{" "}
</div>
</div>
)}
</Section>
</Section>
</Column>
Expand All @@ -108,34 +152,45 @@ const RoutedResultsViewer: React.FC<ResultsViewerProps> = () => {
<Grid fullWidth={true}>
<Column lg={16}>
<div className="orderLegendBody">
<FilterProvider roots={loading ? roots : []}>
<ResultsViewer patientId={patientId} basePath={config.serverBaseUrl} loading={loading} />
</FilterProvider>
<FilterProvider roots={loading ? roots : []}>
<ResultsViewer
patientId={patientId}
basePath={config.serverBaseUrl}
loading={loading}
/>
</FilterProvider>
</div>
</Column>
</Grid>
) : (<Grid fullWidth={true}>
<Column lg={16}>
<EmptyState
headerTitle={t('testResults', 'Test Results')}
displayText={t('testResultsData', 'Test results data')}
/>
</Column>
</Grid>)}
<div className="orderLegendBody">
<EmptyState
headerTitle={t("testResults", "Test Results")}
displayText={t("testResultsData", "Test results data")}
/>
</div>
</Column>
</Grid>
)}
</>

);
};

const ResultsViewer: React.FC<ResultsViewerProps> = ({ patientId, basePath, loading }) => {
const ResultsViewer: React.FC<ResultsViewerProps> = ({
patientId,
basePath,
}) => {
const { t } = useTranslation();
const { totalResultsCount } = useContext(FilterContext);
const { type, testUuid } = useParams();
return (
<div className="resultsContainer">
<div className="resultsHeader">
<div className="leftSection leftHeaderSection">
<h4 style={{ flexGrow: 1 }}>{`${t('Results', 'Results')} ${totalResultsCount ? `(${totalResultsCount})` : ''
<h4 style={{ flexGrow: 1 }}>{`${t("Results", "Results")} ${
totalResultsCount ? `(${totalResultsCount})` : ""
}`}</h4>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@
"search.label.loadnext" : "Load Next 99 Records Starting at Lab Number" ,
"search.label.analysis" : "Select Analysis Status" ,
"search.label.test" : "Select Test Name" ,
"search.label.sample" : "Select Sample Status"
"search.label.sample" : "Select Sample Status" ,
"pathology.label.report" : "Pathology Report",
"patient.natioanalid":"National ID "



Expand Down
4 changes: 3 additions & 1 deletion frontend/src/languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,5 +287,7 @@
"search.label.loadnext" : "Charger les 99 enregistrements suivants à partir du numéro de laboratoire",
"search.label.analysis" : "Sélectionnez l'état de l'analyse",
"search.label.test" : "Sélectionnez le nom du test",
"search.label.sample" : "Sélectionnez l'état de l'échantillon"
"search.label.sample" : "Sélectionnez l'état de l'échantillon",
"pathology.label.report": "Rapport de Pathologie",
"patient.nationalid": "Identifiant National"
}

0 comments on commit c41a1dd

Please sign in to comment.