Skip to content

Commit

Permalink
Merge pull request #510 from mozzy11/2.8
Browse files Browse the repository at this point in the history
More fixes for Pathology and Immunochemistry
  • Loading branch information
mozzy11 authored Aug 17, 2023
2 parents 335c354 + c48049f commit 4c69bd1
Show file tree
Hide file tree
Showing 12 changed files with 255 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ function ImmunohistochemistryCaseView() {
}

const setInitialImmunohistochemistrySampleInfo = (e) => {
if(hasRole(userSessionDetails ,"Pathologist") && !e.assignedPathologistId && e.status === "READY_PATHOLOGIST"){
e.assignedPathologistId = userSessionDetails.userId
e.assignedPathologist = userSessionDetails.lastName +""+ userSessionDetails
}
setImmunohistochemistrySampleInfo(e);
setInitialMount(true);
}
Expand Down Expand Up @@ -174,8 +178,8 @@ function ImmunohistochemistryCaseView() {
<div className="patient-dob"> <Tag type="blue">Sex :</Tag>{immunohistochemistrySampleInfo.sex === 'M' ? "Male" : "Female"}<Tag type="blue">Age :</Tag>{immunohistochemistrySampleInfo.age} </div>
<div className="patient-id"><Tag type="blue">Order Date :</Tag>{immunohistochemistrySampleInfo.requestDate}</div>
<div className="patient-id"><Tag type="blue">Lab Number :</Tag>{immunohistochemistrySampleInfo.labNumber}</div>
<div className="patient-id"><Tag type="blue">Referring Facility:</Tag> <Tag type="blue">Ward/Dept/Unit: :</Tag></div>
<div className="patient-id"><Tag type="blue">Requester: :</Tag>{immunohistochemistrySampleInfo.assignedTechnician}</div>
<div className="patient-id"><Tag type="blue">Referring Facility:</Tag>{immunohistochemistrySampleInfo.referringFacility} <Tag type="blue">Ward/Dept/Unit: :</Tag> {immunohistochemistrySampleInfo.department}</div>
<div className="patient-id"><Tag type="blue">Requester: :</Tag>{immunohistochemistrySampleInfo.requester}</div>
</div>) : (<div className="patient-header">
<div className="patient-name">Patient Id Doest Exist</div>
</div>)}
Expand All @@ -194,26 +198,15 @@ function ImmunohistochemistryCaseView() {
<Grid fullWidth={true} className="gridBoundary">
{notificationVisible === true ? <AlertDialog /> : ""}

{/* <Column lg={16} md={8} sm={4}>
<Heading>
Immunohistochemistry - {immunohistochemistrySampleInfo.labNumber}
</Heading>
</Column>
<Column lg={16} md={8} sm={4}>
Order Date {immunohistochemistrySampleInfo.requestDate}
Name: {immunohistochemistrySampleInfo.lastName}, {immunohistochemistrySampleInfo.firstName}
Age: {immunohistochemistrySampleInfo.age} Sex: {immunohistochemistrySampleInfo.sex}
</Column> */}
{/* <Column lg={16} md={8} sm={4}>
<QuestionnaireResponse questionnaireResponse={immunohistochemistrySampleInfo.programQuestionnaireResponse} />
</Column> */}
<Column lg={16} md={8} sm={4}>
{/* <SearchResults results={this.state.resultForm}/> */}
</Column>
<Column lg={16} md={8} sm={4}>
<Button id="pathology_save" onClick={(e) => { e.preventDefault(); save(e) }}>Save</Button>
</Column>
<Column lg={16} md={8} sm={4}>
<div > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</Column>
<Column lg={4} md={2} sm={2} >
<Select id="report"
name="report"
Expand Down Expand Up @@ -589,12 +582,12 @@ function ImmunohistochemistryCaseView() {
setImmunohistochemistrySampleInfo({ ...immunohistochemistrySampleInfo, release: !immunohistochemistrySampleInfo.release });
}} />
</Column>
<Column lg={16}>
{/* <Column lg={16}>
<Checkbox labelText="Refer to ImmunoHistoChemistry" id="referToImmunoHistoChemistry"
onChange={() => {
setImmunohistochemistrySampleInfo({ ...immunohistochemistrySampleInfo, referToImmunoHistoChemistry: !immunohistochemistrySampleInfo.referToImmunoHistoChemistry });
}} />
</Column>
</Column> */}
<Column><Button id="pathology_save2" onClick={(e) => { e.preventDefault(); save(e) }}>Save</Button></Column>

</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { NotificationContext } from "../layout/Layout";
import {AlertDialog} from "../common/CustomNotification";
import { FormattedMessage, injectIntl } from 'react-intl'
import "./../pathology/PathologyDashboard.css"
import UserSessionDetailsContext from "../../UserSessionDetailsContext"

function ImmunohistochemistryDashboard() {

Expand All @@ -19,6 +20,7 @@ function ImmunohistochemistryDashboard() {
const [statuses, setStatuses] = useState([]);
const [immunohistochemistryEntries, setImmunohistochemistryEntries] = useState([])
const [filters, setFilters] = useState({searchTerm: "", myCases: false, statuses: []});
const { userSessionDetails, setUserSessionDetails } = useContext(UserSessionDetailsContext);

function formatDateToDDMMYYYY(date) {
var day = date.getDate();
Expand Down Expand Up @@ -71,15 +73,15 @@ function ImmunohistochemistryDashboard() {
const renderCell = (cell, row) => {
var status = row.cells.find(
(e) => e.info.header === 'status'
).info.header.status;
).value;
var immunohistochemistrySampleId = row.id;

if (cell.info.header === 'assignedTechnician' && !cell.value ) {
return <TableCell key={cell.id}>
<Button type="button" onClick={(e) => {assignCurrentUserAsTechnician(e, immunohistochemistrySampleId)}}>Start</Button>
</TableCell>
}
if (cell.info.header === 'assignedPathologist' && !cell.value && status === 'READY_PATHOLOGIST' && hasRole("Pathologist")) {
if (cell.info.header === 'assignedPathologist' && !cell.value && status === 'READY_PATHOLOGIST' && hasRole(userSessionDetails ,"Pathologist")) {
return <TableCell key={cell.id}>
<Button type="button" onClick={(e) => {assignCurrentUserAsPathologist(e, immunohistochemistrySampleId)}}>Start</Button>
</TableCell>
Expand Down
65 changes: 53 additions & 12 deletions frontend/src/components/pathology/PathologyCaseView.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useParams } from "react-router-dom";
import config from "../../config.json";
import {
IconButton, Heading, TextInput, Select, FilterableMultiSelect, SelectItem, Button, Grid, Column,
Checkbox, Section, FileUploader, Tag, TextArea ,Breadcrumb ,BreadcrumbItem
Checkbox, Section, FileUploader, Tag, TextArea ,Breadcrumb ,BreadcrumbItem ,Row
} from '@carbon/react';
import { Launch, Subtract } from '@carbon/react/icons';
import { getFromOpenElisServer, postToOpenElisServerFullResponse, hasRole } from "../utils/Utils";
Expand Down Expand Up @@ -82,6 +82,7 @@ function PathologyCaseView() {
const [techniques, setTechniques] = useState([]);
const [requests, setRequests] = useState([]);
const [conclusions, setConclusions] = useState([]);
const [immunoHistoChemistryTests, setImmunoHistoChemistryTests] = useState([]);
const [technicianUsers, setTechnicianUsers] = useState([]);
const [pathologistUsers, setPathologistUsers] = useState([]);

Expand Down Expand Up @@ -119,7 +120,8 @@ function PathologyCaseView() {
"microscopyExam": pathologySampleInfo.microscopyExam,
"conclusionText": pathologySampleInfo.conclusionText,
"release": pathologySampleInfo.release != undefined ? pathologySampleInfo.release : false,
"referToImmunoHistoChemistry": pathologySampleInfo.referToImmunoHistoChemistry
"referToImmunoHistoChemistry": pathologySampleInfo.referToImmunoHistoChemistry,
"immunoHistoChemistryTestId": pathologySampleInfo.immunoHistoChemistryTestId
}
if (pathologySampleInfo.techniques) {
submitValues = {
Expand Down Expand Up @@ -150,6 +152,10 @@ function PathologyCaseView() {


const setInitialPathologySampleInfo = (e) => {
if(hasRole(userSessionDetails ,"Pathologist") && !e.assignedPathologistId && e.status === "READY_PATHOLOGIST"){
e.assignedPathologistId = userSessionDetails.userId
e.assignedPathologist = userSessionDetails.lastName +""+ userSessionDetails
}
setPathologySampleInfo(e);
setInitialMount(true);
}
Expand All @@ -160,6 +166,7 @@ function PathologyCaseView() {
getFromOpenElisServer("/rest/displayList/PATHOLOGY_TECHNIQUES", setTechniques);
getFromOpenElisServer("/rest/displayList/PATHOLOGIST_REQUESTS", setRequests);
//TODO make conclusions list instead of reusing pathrequest
getFromOpenElisServer("/rest/displayList/IMMUNOHISTOCHEMISTRY_MARKERS_TESTS", setImmunoHistoChemistryTests);
getFromOpenElisServer("/rest/displayList/PATHOLOGIST_CONCLUSIONS", setConclusions);
getFromOpenElisServer("/rest/users/", setTechnicianUsers);
getFromOpenElisServer("/rest/users/Pathologist", setPathologistUsers);
Expand Down Expand Up @@ -198,8 +205,8 @@ function PathologyCaseView() {
<div className="patient-dob"> <Tag type="blue">Sex :</Tag>{pathologySampleInfo.sex === 'M' ? "Male" : "Female"}<Tag type="blue">Age :</Tag>{pathologySampleInfo.age} </div>
<div className="patient-id"><Tag type="blue">Order Date :</Tag>{pathologySampleInfo.requestDate}</div>
<div className="patient-id"><Tag type="blue">Lab Number :</Tag>{pathologySampleInfo.labNumber}</div>
<div className="patient-id"><Tag type="blue">Referring Facility:</Tag> <Tag type="blue">Ward/Dept/Unit: :</Tag></div>
<div className="patient-id"><Tag type="blue">Requester: :</Tag>{pathologySampleInfo.assignedTechnician}</div>
<div className="patient-id"><Tag type="blue">Referring Facility:</Tag> {pathologySampleInfo.referringFacility}<Tag type="blue">Ward/Dept/Unit: </Tag>{pathologySampleInfo.department}</div>
<div className="patient-id"><Tag type="blue">Requester: </Tag>{pathologySampleInfo.requester}</div>
</div>) : (<div className="patient-header">
<div className="patient-name">Patient Id Doest Exist</div>
</div>)}
Expand All @@ -219,6 +226,9 @@ function PathologyCaseView() {
<Column lg={16} md={8} sm={4}>
<Button id="pathology_save" onClick={(e) => { e.preventDefault(); save(e) }}>Save</Button>
</Column>
<Column lg={16} md={8} sm={4}>
<div > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</Column>
<Column lg={4} md={2} sm={2} >
<Select id="status"
name="status"
Expand Down Expand Up @@ -260,19 +270,24 @@ function PathologyCaseView() {
<Column lg={8} md={4} sm={2} />
<Column lg={16} md={8} sm={4}>
</Column >
<div > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
<Column lg={16} md={8} sm={4}>
<hr style={{width:'100%' , margin: '1rem 0', border: '1px solid #ccc' }} />
<h5>Blocks</h5>
</Column>
<div > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
{pathologySampleInfo.blocks && pathologySampleInfo.blocks.map((block, index) => {
return (
<>

<Column lg={16} md={8} sm={4}>
<IconButton label="remove block" onClick={() => {
var newBlocks = [...pathologySampleInfo.blocks];
newBlocks = newBlocks.splice(index, 1);
setPathologySampleInfo({ ...pathologySampleInfo, blocks: newBlocks });
}} kind='tertiary' size='sm'>
<Subtract size={18} />
<Subtract size={18} /> Block
</IconButton>
Block

</Column>
<Column lg={4} md={2} sm={1} key={index}>
<TextInput
Expand Down Expand Up @@ -318,8 +333,12 @@ function PathologyCaseView() {
Add Block
</Button>
</Column>
<Column lg={16} md={8} sm={4}>
<div > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
<Column lg={16} md={8} sm={4}>
<hr style={{width:'100%' , margin: '1rem 0', border: '1px solid #ccc' }} />
<h5>Slides</h5>
</Column>
<div > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
{pathologySampleInfo.slides && pathologySampleInfo.slides.map((slide, index) => {
return (
<>
Expand All @@ -328,9 +347,9 @@ function PathologyCaseView() {
var newSlides = [...pathologySampleInfo.slides];
setPathologySampleInfo({ ...pathologySampleInfo, slides: newSlides.splice(index, 1) });
}} kind='tertiary' size='sm'>
<Subtract size={18} />
<Subtract size={18} /> Slide
</IconButton>
Slide

</Column>
<Column lg={4} md={2} sm={1} key={index}>
<TextInput
Expand Down Expand Up @@ -413,6 +432,11 @@ function PathologyCaseView() {
}}>
Add Slide
</Button>
<div > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
<Column lg={16} md={8} sm={4}>
<hr style={{width:'100%' , margin: '1rem 0', border: '1px solid #ccc' }} />
</Column>
<div > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</Column>
<Column lg={4} md={2} sm={2}>
<Select id="assignedPathologist"
Expand Down Expand Up @@ -531,13 +555,30 @@ function PathologyCaseView() {
setPathologySampleInfo({ ...pathologySampleInfo, release: !pathologySampleInfo.release });
}} />
</Column>
<Column lg={16}>
<Column lg={8}>
<Checkbox labelText="Refer to ImmunoHistoChemistry" id="referToImmunoHistoChemistry"
onChange={() => {
setPathologySampleInfo({ ...pathologySampleInfo, referToImmunoHistoChemistry: !pathologySampleInfo.referToImmunoHistoChemistry });
}} />
</Column>
<Column><Button id ="pathology_save2"onClick={(e) => { e.preventDefault(); save(e) }}>Save</Button></Column>
{pathologySampleInfo.referToImmunoHistoChemistry && (
<Column lg={8}>
<Select id="immunoHistoChemistryTest"
name="immunoHistoChemistryTest"
labelText="immunoHistoChemistryTest"
onChange={(event) => {
setPathologySampleInfo({ ...pathologySampleInfo, immunoHistoChemistryTestId: event.target.value });
}}>
<SelectItem />
{immunoHistoChemistryTests.map((test, index) => {
return (<SelectItem key={index}
text={test.value}
value={test.id}
/>);
})}
</Select>
</Column>)}
<Column lg={16}><Button id ="pathology_save2"onClick={(e) => { e.preventDefault(); save(e) }}>Save</Button></Column>

</Grid>

Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/pathology/PathologyDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Checkbox, Heading, TextInput, Select, SelectItem, Button, Grid, Column, Section,
DataTable, TableContainer, Table, TableHead, TableRow, TableHeader, TableBody, TableCell, Tile
} from '@carbon/react';
import UserSessionDetailsContext from "../../UserSessionDetailsContext"
import { Search } from '@carbon/react';
import { getFromOpenElisServer, postToOpenElisServerFullResponse, hasRole } from "../utils/Utils";
import { NotificationContext } from "../layout/Layout";
Expand All @@ -15,6 +16,7 @@ function PathologyDashboard() {
const componentMounted = useRef(false);

const { notificationVisible, setNotificationVisible, setNotificationBody } = useContext(NotificationContext);
const { userSessionDetails, setUserSessionDetails } = useContext(UserSessionDetailsContext);
const [statuses, setStatuses] = useState([]);
const [pathologyEntries, setPathologyEntries] = useState([])
const [filters, setFilters] = useState({ searchTerm: "", myCases: false, statuses: [] });
Expand All @@ -37,15 +39,15 @@ function PathologyDashboard() {
const renderCell = (cell, row) => {
var status = row.cells.find(
(e) => e.info.header === 'status'
).info.header.status;
).value;
var pathologySampleId = row.id;

if (cell.info.header === 'assignedTechnician' && !cell.value) {
return <TableCell key={cell.id}>
<Button type="button" onClick={(e) => { assignCurrentUserAsTechnician(e, pathologySampleId) }}>Start</Button>
</TableCell>
}
if (cell.info.header === 'assignedPathologist' && !cell.value && status === 'READY_PATHOLOGIST' && hasRole("Pathologist")) {
if (cell.info.header === 'assignedPathologist' && !cell.value && status === 'READY_PATHOLOGIST' && hasRole(userSessionDetails ,"Pathologist")) {
return <TableCell key={cell.id}>
<Button type="button" onClick={(e) => { assignCurrentUserAsPathologist(e, pathologySampleId) }}>Start</Button>
</TableCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public enum ListType {
SEVERITY_CONSEQUENCES_LIST, SEVERITY_RECURRENCE_LIST, ACTION_TYPE_LIST, LABORATORY_COMPONENT, SAMPLE_NATURE,
ELECTRONIC_ORDER_STATUSES, METHODS, METHODS_INACTIVE, METHOD_BY_NAME, PRACTITIONER_PERSONS, ORDER_PRIORITY,
PROGRAM, IMMUNOHISTOCHEMISTRY_STATUS, PATHOLOGY_STATUS, PATHOLOGY_TECHNIQUES, PATHOLOGIST_REQUESTS,
PATHOLOGIST_CONCLUSIONS ,IMMUNOHISTOCHEMISTRY_REPORT_TYPES
PATHOLOGIST_CONCLUSIONS ,IMMUNOHISTOCHEMISTRY_REPORT_TYPES ,IMMUNOHISTOCHEMISTRY_MARKERS_TESTS
}

private static Map<ListType, List<IdValuePair>> typeToListMap;
Expand Down Expand Up @@ -196,6 +196,7 @@ public void localeChanged(String locale) {

typeToListMap.put(ListType.ORDERABLE_TESTS, createOrderableTestList());
typeToListMap.put(ListType.ALL_TESTS, createTestList());
typeToListMap.put(ListType.IMMUNOHISTOCHEMISTRY_MARKERS_TESTS, createImmunoHistoChemistryTestList());
typeToListMap.put(ListType.TEST_LOCATION_CODE, createDictionaryListForCategory("testLocationCode"));
typeToListMap.put(ListType.PROGRAM, createProgramList());
typeToListMap.put(ListType.DICTIONARY_PROGRAM, createDictionaryListForCategory("programs"));
Expand Down Expand Up @@ -398,6 +399,7 @@ public synchronized void refreshLists() {
typeToListMap.put(ListType.PANELS_INACTIVE, createPanelList(true));
typeToListMap.put(ListType.ORDERABLE_TESTS, createOrderableTestList());
typeToListMap.put(ListType.ALL_TESTS, createTestList());
typeToListMap.put(ListType.IMMUNOHISTOCHEMISTRY_MARKERS_TESTS, createImmunoHistoChemistryTestList());
typeToListMap.put(ListType.REJECTION_REASONS, createDictionaryListForCategory("resultRejectionReasons"));
typeToListMap.put(ListType.REFERRAL_REASONS, createReferralReasonList());
typeToListMap.put(ListType.REFERRAL_ORGANIZATIONS, createReferralOrganizationList());
Expand Down Expand Up @@ -447,6 +449,11 @@ public void refreshList(ListType listType) {
typeToListMap.put(ListType.ALL_TESTS, createTestList());
break;
}
case IMMUNOHISTOCHEMISTRY_MARKERS_TESTS: {
testService.refreshTestNames();
typeToListMap.put(ListType.IMMUNOHISTOCHEMISTRY_MARKERS_TESTS, createImmunoHistoChemistryTestList());
break;
}
case ORDERABLE_TESTS: {
testService.refreshTestNames();
typeToListMap.put(ListType.ORDERABLE_TESTS, createOrderableTestList());
Expand Down Expand Up @@ -640,6 +647,27 @@ public int compare(IdValuePair o1, IdValuePair o2) {
return tests;
}

private List<IdValuePair> createImmunoHistoChemistryTestList() {
ArrayList<IdValuePair> tests = new ArrayList<>();
String id = testSectionService.getTestSectionByName("Immunohistochemistry").getId();
if (id == null) {
return tests;
}
List<Test> testList = testService.getTestsByTestSectionId(id);
for (Test test : testList) {
tests.add(new IdValuePair(test.getId(), TestServiceImpl.getLocalizedTestNameWithType(test)));

Collections.sort(tests, new Comparator<IdValuePair>() {

@Override
public int compare(IdValuePair o1, IdValuePair o2) {
return o1.getValue().compareTo(o2.getValue());
}
});
}
return tests;
}

private List<IdValuePair> createPatientHealthRegions() {
List<IdValuePair> regionList = new ArrayList<>();
List<Organization> orgList = organizationService.getOrganizationsByTypeName("id", "Health Region");
Expand Down
Loading

0 comments on commit 4c69bd1

Please sign in to comment.