Skip to content

Commit

Permalink
add cr result to ui
Browse files Browse the repository at this point in the history
  • Loading branch information
mherman22 committed Aug 31, 2024
1 parent 959496e commit cbe7ba2
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 23 deletions.
3 changes: 3 additions & 0 deletions frontend/src/components/data/PatientResultsTableHeaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@ export const patientSearchHeaderData = [
{
key: "nationalId",
header: <FormattedMessage id="patient.natioanalid" />,
}, {
key: "dataSourceName",
header: <FormattedMessage id="patient.dataSourceName" />,
},
];
74 changes: 51 additions & 23 deletions frontend/src/components/patient/SearchPatientForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {
TableCell,
Pagination,
Loading,
Toggle,
Tag,
} from "@carbon/react";
import CustomLabNumberInput from "../common/CustomLabNumberInput";
import { patientSearchHeaderData } from "../data/PatientResultsTableHeaders";
Expand Down Expand Up @@ -73,7 +75,9 @@ function SearchPatientForm(props) {
"&gender=" +
values.gender +
"&suppressExternalSearch=" +
values.suppressExternalSearch;
values.suppressExternalSearch +
"&crResult=" +
values.crResult;
getFromOpenElisServer(searchEndPoint, fetchPatientResults);
setUrl(searchEndPoint);
};
Expand All @@ -90,8 +94,17 @@ function SearchPatientForm(props) {
const fetchPatientResults = (res) => {
let patientsResults = res.patientSearchResults;
if (patientsResults.length > 0) {
patientsResults.forEach((item) => (item.id = item.patientID));
setPatientSearchResults(patientsResults);
const openClientRegistryResults = patientsResults.filter(
(item) => item.dataSourceName === "Open Client Registry",
);

if (openClientRegistryResults.length > 0) {
openClientRegistryResults.forEach((item) => (item.id = item.patientID));
setPatientSearchResults(openClientRegistryResults);
} else {
patientsResults.forEach((item) => (item.id = item.patientID));
setPatientSearchResults(patientsResults);
}
} else {
setPatientSearchResults([]);
addNotification({
Expand Down Expand Up @@ -288,6 +301,13 @@ function SearchPatientForm(props) {
/>
)}
</Field>
<Toggle
labelText="crResult"
labelA="false"
labelB="true"
id="toggle-cr"
onClick={() => setFieldValue("crResult", true)}
/>
</Column>
<Column lg={8} md={4} sm={4}>
<Field name="gender">
Expand Down Expand Up @@ -408,27 +428,35 @@ function SearchPatientForm(props) {
</TableRow>
</TableHead>
<TableBody>
<>
{rows
.slice((page - 1) * pageSize)
.slice(0, pageSize)
.map((row) => (
<TableRow key={row.id}>
<TableCell>
{" "}
<RadioButton
name="radio-group"
onClick={patientSelected}
labelText=""
id={row.id}
/>
{rows
.slice((page - 1) * pageSize, page * pageSize)
.map((row) => (
<TableRow key={row.id}>
<TableCell>
<RadioButton
name="radio-group"
onClick={patientSelected}
labelText=""
id={row.id}
/>
</TableCell>
{row.cells.map((cell) => (
<TableCell key={cell.id}>
{cell.info.header === "dataSourceName" ? (
<Tag
type={
cell.value === "OpenELIS" ? "red" : "magenta"
}
>
{cell.value}
</Tag>
) : (
cell.value
)}
</TableCell>
{row.cells.map((cell) => (
<TableCell key={cell.id}>{cell.value}</TableCell>
))}
</TableRow>
))}
</>
))}
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@
"search.label.sample": "Select Sample Status",
"pathology.label.report": "Pathology Report",
"patient.natioanalid": "National ID",
"patient.dataSourceName":"Data Source Name",
"patient.label.additionalInfo": "Additional Information",
"sample.entry.available.tests": "Available Tests",
"sample.entry.panels": "Panels",
Expand Down

0 comments on commit cbe7ba2

Please sign in to comment.