Skip to content

Commit

Permalink
Merge pull request #561 from mozzy11/2.8
Browse files Browse the repository at this point in the history
more work on modify Order
  • Loading branch information
mozzy11 authored Sep 21, 2023
2 parents 9a39721 + ffd2bf2 commit a182ac4
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 124 deletions.
18 changes: 0 additions & 18 deletions frontend/src/components/admin/Admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,6 @@ function Admin() {
<FormattedMessage id="sidenav.label.admin.testmgt.calculated" />
</SideNavMenuItem>
</SideNavMenu>
{/* <SideNavMenu
title={intl.formatMessage({ id: "sidenav.label.admin.usermgt" })}
>
<SideNavMenuItem
href={config.serverBaseUrl + "/UnifiedSystemUserMenu"}
>
<FormattedMessage id="sidenav.label.admin.usermgt" />
</SideNavMenuItem>
</SideNavMenu> */}
{/* <SideNavMenu
title={intl.formatMessage({
id: "sidenav.label.admin.organizationmgt",
})}
>
<SideNavMenuItem href={config.serverBaseUrl + "/OrganizationMenu"}>
<FormattedMessage id="sidenav.label.admin.organizationmgt" />
</SideNavMenuItem>
</SideNavMenu> */}
<SideNavMenuItem href="#program">
<FormattedMessage id="sidenav.label.admin.program" />
</SideNavMenuItem>
Expand Down
187 changes: 103 additions & 84 deletions frontend/src/components/modifyOrder/ModifyOrder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import React, { useContext, useEffect, useState, useRef } from "react";
import { useParams } from 'react-router-dom';
import { Button, ProgressIndicator, ProgressStep, Stack ,Breadcrumb ,BreadcrumbItem ,Grid,Column ,Section ,Tag} from "@carbon/react";
import { useParams } from "react-router-dom";
import {
Button,
ProgressIndicator,
ProgressStep,
Stack,
Breadcrumb,
BreadcrumbItem,
Grid,
Column,
Section,
Tag,
} from "@carbon/react";
import EditSample from "./EditSample";
import AddOrder from "../addOrder/AddOrder";
import "../addOrder/add-order.scss";
Expand All @@ -10,7 +21,7 @@ import { AlertDialog, NotificationKinds } from "../common/CustomNotification";
import { postToOpenElisServer, getFromOpenElisServer } from "../utils/Utils";
import EditOrderEntryAdditionalQuestions from "./EditOrderEntryAdditionalQuestions";
import OrderSuccessMessage from "../addOrder/OrderSuccessMessage";
import { FormattedMessage ,useIntl} from "react-intl";
import { FormattedMessage, useIntl } from "react-intl";

export let sampleObject = {
index: 0,
Expand Down Expand Up @@ -45,25 +56,25 @@ const ModifyOrder = () => {
let accessionNumber = new URLSearchParams(window.location.search).get(
"accessionNumber",
);
accessionNumber = accessionNumber?accessionNumber:"" ;
patientId =patientId?patientId:"";
accessionNumber = accessionNumber ? accessionNumber : "";
patientId = patientId ? patientId : "";
getFromOpenElisServer(
"/rest/SampleEdit?patientId=" +
patientId +
"&accessionNumber=" +
accessionNumber,
loadOrderValues,
loadOrderValues,
);
return () => {
componentMounted.current = false;
}
};
}, []);

const loadOrderValues = (data) => {
if (componentMounted.current) {
setOrderFormValues(data);
}
}
};

const { notificationVisible, setNotificationVisible, setNotificationBody } =
useContext(NotificationContext);
Expand Down Expand Up @@ -93,7 +104,7 @@ const ModifyOrder = () => {
const handleSubmitOrderForm = (e) => {
e.preventDefault();
setPage(page + 1);
console.log(JSON.stringify(orderFormValues))
console.log(JSON.stringify(orderFormValues));
// postToOpenElisServer(
// "/rest/SamplePatientEntry",
// JSON.stringify(orderFormValues),
Expand Down Expand Up @@ -183,19 +194,23 @@ const ModifyOrder = () => {
};
const intl = useIntl();


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

<Grid fullWidth={true}>
<Column lg={16}>
<Section>
<Section>
{orderFormValues?.patientName ? (<div className="patient-header">
<Section>
{orderFormValues?.sampleOrderItems ? (
<div className="patient-header">
<div className="patient-name">
<Tag type="blue">
<FormattedMessage id="patient.label.name" /> :
Expand Down Expand Up @@ -234,7 +249,7 @@ const ModifyOrder = () => {
<div className="patient-header">
<div className="patient-name">
{" "}
<FormattedMessage id="patient.label.nopatientid" />{" "}
<FormattedMessage id="sample.label.noorder" />{" "}
</div>
</div>
)}
Expand All @@ -245,81 +260,85 @@ const ModifyOrder = () => {
<Stack gap={10}>
<div className="pageContent">
{notificationVisible === true ? <AlertDialog /> : ""}
<div className="orderWorkFlowDiv">
<h2>
<FormattedMessage id="order.test.request.heading" />
</h2>
{page <= orderPageNumber && (
<ProgressIndicator
currentIndex={page}
className="ProgressIndicator"
spaceEqually={true}
onChange={(e) => handleTabClickHandler(e)}
>
<ProgressStep
label={<FormattedMessage id="order.step.program.selection" />}
/>
<ProgressStep
label={<FormattedMessage id="sample.add.action" />}
{orderFormValues?.sampleOrderItems && (
<div className="orderWorkFlowDiv">
<h2>
<FormattedMessage id="order.test.request.heading" />
</h2>
{page <= orderPageNumber && (
<ProgressIndicator
currentIndex={page}
className="ProgressIndicator"
spaceEqually={true}
onChange={(e) => handleTabClickHandler(e)}
>
<ProgressStep
label={
<FormattedMessage id="order.step.program.selection" />
}
/>
<ProgressStep
label={<FormattedMessage id="sample.add.action" />}
/>
<ProgressStep
label={<FormattedMessage id="order.label.add" />}
/>
</ProgressIndicator>
)}
{page === programPageNumber && (
<EditOrderEntryAdditionalQuestions
orderFormValues={orderFormValues}
setOrderFormValues={setOrderFormValues}
/>
<ProgressStep
label={<FormattedMessage id="order.label.add" />}
)}
{page === samplePageNumber && (
<EditSample setSamples={setSamples} samples={samples} />
)}
{page === orderPageNumber && (
<AddOrder
orderFormValues={orderFormValues}
setOrderFormValues={setOrderFormValues}
samples={samples}
/>
</ProgressIndicator>
)}
{page === programPageNumber && (
<EditOrderEntryAdditionalQuestions
orderFormValues={orderFormValues}
setOrderFormValues={setOrderFormValues}
/>
)}
{page === samplePageNumber && (
<EditSample setSamples={setSamples} samples={samples} />
)}
{page === orderPageNumber && (
<AddOrder
orderFormValues={orderFormValues}
setOrderFormValues={setOrderFormValues}
samples={samples}
/>
)}

{page === successMsgPageNumber && (
<OrderSuccessMessage
orderFormValues={orderFormValues}
setOrderFormValues={setOrderFormValues}
setSamples={setSamples}
setPage={setPage}
/>
)}
<div className="navigationButtonsLayout">
{page !== firstPageNumber && page <= orderPageNumber && (
<Button kind="tertiary" onClick={() => navigateBackWards()}>
<FormattedMessage id="back.action.button" />
</Button>
)}

{page < orderPageNumber && (
<Button
kind="primary"
className="forwardButton"
onClick={() => navigateForward()}
>
{<FormattedMessage id="next.action.button" />}
</Button>
{page === successMsgPageNumber && (
<OrderSuccessMessage
orderFormValues={orderFormValues}
setOrderFormValues={setOrderFormValues}
setSamples={setSamples}
setPage={setPage}
/>
)}
<div className="navigationButtonsLayout">
{page !== firstPageNumber && page <= orderPageNumber && (
<Button kind="tertiary" onClick={() => navigateBackWards()}>
<FormattedMessage id="back.action.button" />
</Button>
)}

{page === orderPageNumber && (
<Button
kind="primary"
className="forwardButton"
onClick={handleSubmitOrderForm}
>
{<FormattedMessage id="label.button.submit" />}
</Button>
)}
{page < orderPageNumber && (
<Button
kind="primary"
className="forwardButton"
onClick={() => navigateForward()}
>
{<FormattedMessage id="next.action.button" />}
</Button>
)}

{page === orderPageNumber && (
<Button
kind="primary"
className="forwardButton"
onClick={handleSubmitOrderForm}
>
{<FormattedMessage id="label.button.submit" />}
</Button>
)}
</div>
</div>
</div>
)}
</div>
</Stack>
</>
Expand Down
7 changes: 2 additions & 5 deletions frontend/src/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,6 @@
"search.label.sample" : "Select Sample Status" ,
"pathology.label.report" : "Pathology Report",
"patient.natioanalid":"National ID",
"sample.label.orderpanel":"Order Panels"




"sample.label.orderpanel":"Order Panels",
"sample.label.noorder":"Order Doesnt Exist"
}
4 changes: 3 additions & 1 deletion frontend/src/languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,5 +289,7 @@
"search.label.test" : "Sélectionnez le nom du test",
"search.label.sample" : "Sélectionnez l'état de l'échantillon",
"pathology.label.report": "Rapport de Pathologie",
"patient.nationalid": "Identifiant National"
"patient.nationalid": "Identifiant National",
"sample.label.orderpanel": "Panels de commande",
"sample.label.noorder": "La commande n'existe pas"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,30 @@
@Component
@Transactional
public class ProgramSampleDAOImpl extends BaseDAOImpl<ProgramSample, Integer> implements ProgramSampleDAO {

ProgramSampleDAOImpl() {
super(ProgramSample.class);
}

@Override
public ProgramSample getProgrammeSampleBySample(Integer sampleId , String programName) {
String className;
switch (programName.toLowerCase()) {
case "pathology":
public ProgramSample getProgrammeSampleBySample(Integer sampleId, String programName) {

String className = "PathologySample";
if (programName != null) {
if (programName.toLowerCase().contains("pathology")) {
className = "PathologySample";
break;
case "immunohistochemistry":
} else if (programName.toLowerCase().contains("immunohistochemistry")) {
className = "ImmunohistochemistrySample";
break;
case "cytology":
} else if (programName.toLowerCase().contains("cytology")) {
className = "CytologySample";
break;
default:
className = "PathologySample";
break;
}
}

String sql = "from "+ className +" ps where ps.sample.id = :sampleId";
String sql = "from " + className + " ps where ps.sample.id = :sampleId";
Query<ProgramSample> query = entityManager.unwrap(Session.class).createQuery(sql, ProgramSample.class);
query.setParameter("sampleId", sampleId);
query.setMaxResults(1);
ProgramSample programme = (ProgramSample)query.uniqueResult();
ProgramSample programme = (ProgramSample) query.uniqueResult();
return programme;
}
}

0 comments on commit a182ac4

Please sign in to comment.