-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
632 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,234 @@ | ||
import { openmrsFetch } from "@openmrs/esm-framework"; | ||
import useSWR from "swr"; | ||
|
||
export interface LaboratoryResponse { | ||
results: Result[]; | ||
} | ||
|
||
export interface Result { | ||
uuid: string; | ||
display: string; | ||
encounterDatetime: string; | ||
patient: Patient; | ||
location: Location; | ||
form: Form; | ||
encounterType: EncounterType; | ||
obs: Ob[]; | ||
orders: any[]; | ||
voided: boolean; | ||
auditInfo: AuditInfo; | ||
visit: Visit; | ||
encounterProviders: EncounterProvider[]; | ||
diagnoses: any[]; | ||
links: Link[]; | ||
resourceVersion: string; | ||
} | ||
|
||
export interface Patient { | ||
uuid: string; | ||
display: string; | ||
links: Link[]; | ||
} | ||
|
||
export interface Link { | ||
rel: string; | ||
uri: string; | ||
resourceAlias: string; | ||
} | ||
|
||
export interface Location { | ||
uuid: string; | ||
display: string; | ||
name: string; | ||
description: any; | ||
address1: any; | ||
address2: any; | ||
cityVillage: any; | ||
stateProvince: any; | ||
country: string; | ||
postalCode: any; | ||
latitude: any; | ||
longitude: any; | ||
countyDistrict: any; | ||
address3: any; | ||
address4: any; | ||
address5: any; | ||
address6: any; | ||
tags: Tag[]; | ||
parentLocation: ParentLocation; | ||
childLocations: ChildLocation[]; | ||
retired: boolean; | ||
attributes: any[]; | ||
address7: any; | ||
address8: any; | ||
address9: any; | ||
address10: any; | ||
address11: any; | ||
address12: any; | ||
address13: any; | ||
address14: any; | ||
address15: any; | ||
links: Link[]; | ||
resourceVersion: string; | ||
} | ||
|
||
export interface Tag { | ||
uuid: string; | ||
display: string; | ||
links: Link[]; | ||
} | ||
|
||
export interface ParentLocation { | ||
uuid: string; | ||
display: string; | ||
links: Link[]; | ||
} | ||
|
||
export interface ChildLocation { | ||
uuid: string; | ||
display: string; | ||
links: Link[]; | ||
} | ||
|
||
export interface Form { | ||
uuid: string; | ||
display: string; | ||
name: string; | ||
description: string; | ||
encounterType: EncounterType; | ||
version: string; | ||
build: any; | ||
published: boolean; | ||
formFields: any[]; | ||
retired: boolean; | ||
resources: Resource[]; | ||
links: Link[]; | ||
resourceVersion: string; | ||
} | ||
|
||
export interface Resource { | ||
uuid: string; | ||
display: string; | ||
links: Link[]; | ||
} | ||
|
||
export interface EncounterType { | ||
uuid: string; | ||
display: string; | ||
name: string; | ||
description: string; | ||
retired: boolean; | ||
links: Link[]; | ||
resourceVersion: string; | ||
} | ||
|
||
export interface Ob { | ||
uuid: string; | ||
display: string; | ||
concept: Concept; | ||
person: Person; | ||
obsDatetime: string; | ||
accessionNumber: any; | ||
obsGroup: any; | ||
valueCodedName: any; | ||
groupMembers: any; | ||
comment: any; | ||
location: Location; | ||
order: any; | ||
encounter: Encounter; | ||
voided: boolean; | ||
value: any; | ||
valueModifier: any; | ||
formFieldPath: string; | ||
formFieldNamespace: string; | ||
links: Link[]; | ||
resourceVersion: string; | ||
} | ||
|
||
export interface Concept { | ||
uuid: string; | ||
display: string; | ||
links: Link[]; | ||
} | ||
|
||
export interface Person { | ||
uuid: string; | ||
display: string; | ||
links: Link[]; | ||
} | ||
|
||
export interface Encounter { | ||
uuid: string; | ||
display: string; | ||
links: Link[]; | ||
} | ||
|
||
export interface AuditInfo { | ||
creator: Creator; | ||
dateCreated: string; | ||
changedBy: any; | ||
dateChanged: any; | ||
} | ||
|
||
export interface Creator { | ||
uuid: string; | ||
display: string; | ||
links: Link[]; | ||
} | ||
|
||
export interface Visit { | ||
uuid: string; | ||
display: string; | ||
patient: Patient; | ||
visitType: VisitType; | ||
indication: any; | ||
location: Location; | ||
startDatetime: string; | ||
stopDatetime: any; | ||
encounters: Encounter[]; | ||
attributes: any[]; | ||
voided: boolean; | ||
links: Link[]; | ||
resourceVersion: string; | ||
} | ||
|
||
export interface VisitType { | ||
uuid: string; | ||
display: string; | ||
links: Link[]; | ||
} | ||
|
||
export interface EncounterRole { | ||
uuid: string; | ||
display: string; | ||
links: Link[]; | ||
} | ||
|
||
export interface EncounterProvider { | ||
uuid: string; | ||
provider: Provider; | ||
encounterRole: EncounterRole; | ||
voided: boolean; | ||
links: Link[]; | ||
resourceVersion: string; | ||
} | ||
|
||
export interface Provider { | ||
uuid: string; | ||
display: string; | ||
links: Link[]; | ||
} | ||
|
||
export function useLabOrders(patientUuid: string, encounterTypeUuid: string) { | ||
const apiUrl = `encounter?patient=${patientUuid}&encounterType=${encounterTypeUuid}&v=full`; | ||
const { data, error, isLoading } = useSWR< | ||
{ data: LaboratoryResponse }, | ||
Error | ||
>(apiUrl, openmrsFetch); | ||
|
||
return { | ||
visitNumber: data.data.results, | ||
isLoading, | ||
isError: error, | ||
}; | ||
} |
120 changes: 118 additions & 2 deletions
120
src/patient-chart/results-summary/results-summary.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,123 @@ | ||
import React from "react"; | ||
import React, { Children } from "react"; | ||
import { | ||
Button, | ||
DataTable, | ||
DataTableHeader, | ||
DataTableSkeleton, | ||
DefinitionTooltip, | ||
Layer, | ||
Pagination, | ||
Tab, | ||
Table, | ||
TableBody, | ||
TableCell, | ||
TableContainer, | ||
TableExpandedRow, | ||
TableExpandHeader, | ||
TableExpandRow, | ||
TableHead, | ||
TableHeader, | ||
TableRow, | ||
TableToolbar, | ||
TableToolbarContent, | ||
TableToolbarSearch, | ||
TabList, | ||
TabPanel, | ||
TabPanels, | ||
Tabs, | ||
Tag, | ||
Tile, | ||
} from "@carbon/react"; | ||
import { Printer, MailAll, Edit } from "@carbon/react/icons"; | ||
import styles from "./results-summary.scss"; | ||
import TestsResults from "./test-results-table.component"; | ||
|
||
const ResultsSummary = () => { | ||
return <span>Laboratory Results</span>; | ||
const PrintButtonAction: React.FC = () => { | ||
const handleButtonClick = (event: MouseEvent) => { | ||
event.preventDefault(); | ||
}; | ||
return ( | ||
<Button | ||
kind="ghost" | ||
size="sm" | ||
onClick={(e) => handleButtonClick(e)} | ||
renderIcon={(props) => <Printer size={16} {...props} />} | ||
> | ||
{/* {children} */} | ||
</Button> | ||
); | ||
}; | ||
|
||
const EmailButtonAction: React.FC = () => { | ||
const handleButtonClick = (event: MouseEvent) => { | ||
event.preventDefault(); | ||
}; | ||
return ( | ||
<Button | ||
kind="ghost" | ||
size="sm" | ||
onClick={(e) => handleButtonClick(e)} | ||
renderIcon={(props) => <Edit size={16} {...props} />} | ||
> | ||
{/* {children} */} | ||
</Button> | ||
); | ||
}; | ||
|
||
const EditButtonAction: React.FC = () => { | ||
const handleButtonClick = (event: MouseEvent) => { | ||
event.preventDefault(); | ||
}; | ||
return ( | ||
<Button | ||
kind="ghost" | ||
size="sm" | ||
onClick={(e) => handleButtonClick(e)} | ||
renderIcon={(props) => <MailAll size={16} {...props} />} | ||
> | ||
{/* {children} */} | ||
</Button> | ||
); | ||
}; | ||
return ( | ||
<> | ||
<section className={styles.section}> | ||
<div style={{ display: "flex", justifyContent: "space-between" }}> | ||
<div></div> | ||
<div> | ||
<PrintButtonAction /> | ||
<EmailButtonAction /> | ||
</div> | ||
</div> | ||
</section> | ||
<section className={styles.section}> | ||
<div> | ||
<span>Date : </span> | ||
<span> Ordered By :</span> | ||
</div> | ||
</section> | ||
<section className={styles.section}> | ||
<div | ||
style={{ | ||
display: "flex", | ||
justifyContent: "space-between", | ||
alignItems: "center", | ||
}} | ||
> | ||
<div> | ||
<span> Results Ordered</span> | ||
</div> | ||
<div> | ||
<EditButtonAction /> | ||
</div> | ||
</div> | ||
</section> | ||
<section className={styles.section}> | ||
<TestsResults /> | ||
</section> | ||
</> | ||
); | ||
}; | ||
|
||
export default ResultsSummary; |
Oops, something went wrong.