Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ft : lab module integration #7

Merged
merged 19 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"main": "src/index.ts",
"source": true,
"scripts": {
"start": "openmrs develop --backend http://167.71.32.250:8080",
"start": "openmrs develop --backend http://194.163.171.253:8282",
"serve": "webpack serve --mode=development",
"build": "webpack --mode production",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down Expand Up @@ -46,7 +46,8 @@
},
"dependencies": {
"@carbon/react": "^1.14.0",
"lodash-es": "^4.17.21"
"lodash-es": "^4.17.21",
"react-to-print": "^2.14.15"
},
"peerDependencies": {
"@openmrs/esm-framework": "*",
Expand Down
6 changes: 6 additions & 0 deletions src/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ export const configSchema = {
_default: "159959AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
_description: "Concept UUID for laboratory specimen types",
},
laboratoryEncounterTypeUuid: {
_type: Type.String,
_default: "214e27a1-606a-4b1e-a96e-d736c87069d5",
_description: "Concept uuid for the laboratory tool encounter type.",
},
};

export type Config = {
laboratoryQueueConcept: string;
laboratoryLocationTag: string;
laboratorySpecimenTypeConcept: string;
laboratoryEncounterTypeUuid: string;
};
13 changes: 13 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ export const addToWorklistDialog = getAsyncLifecycle(
options
);

export const resultsSummaryWorkSpace = getAsyncLifecycle(
() => import("./patient-chart/results-summary/results-summary.component"),
options
);

export const editResultsDialog = getAsyncLifecycle(
() =>
import(
"./patient-chart/results-summary/results-dialog/edit-results-dialog.component"
),
options
);

export function startupApp() {
defineConfigSchema(moduleName, configSchema);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React, { useCallback } from "react";
import { useTranslation } from "react-i18next";
import { Button, Tooltip } from "@carbon/react";
import { View } from "@carbon/react/icons";
import { launchPatientWorkspace } from "@openmrs/esm-patient-common-lib";

interface ViewLaboratoryItemActionMenuProps {
closeModal: () => void;
encounterUuid: string;
}

const ViewLaboratoryItemActionMenu: React.FC<
ViewLaboratoryItemActionMenuProps
> = ({ encounterUuid }) => {
const { t } = useTranslation();

const handleClick = useCallback(
() =>
launchPatientWorkspace("results-summary", {
workspaceTitle: `Results Summary Form`,
encounterUuid,
}),
[encounterUuid]
);

return (
<Tooltip align="bottom" label="View Results">
<Button
kind="ghost"
onClick={handleClick}
iconDescription={t("viewResults", "View Results ")}
renderIcon={(props) => <View size={16} {...props} />}
></Button>
</Tooltip>
);
};

export default ViewLaboratoryItemActionMenu;
290 changes: 290 additions & 0 deletions src/patient-chart/laboratory-item/view-laboratory-item.resource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,290 @@
import { openmrsFetch } from "@openmrs/esm-framework";
import useSWR from "swr";

export interface EncounterResponse {
uuid: string;
display: string;
encounterDatetime: string;
patient: Patient;
location: Location;
form: Form;
encounterType: EncounterType2;
obs: Ob[];
orders: Order[];
voided: boolean;
auditInfo: AuditInfo;
visit: Visit;
encounterProviders: any[];
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 EncounterType {
uuid: string;
display: string;
links: Link[];
}

export interface Resource {
uuid: string;
display: string;
links: Link[];
}

export interface EncounterType2 {
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: Location2;
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 Location2 {
uuid: string;
display: string;
links: Link[];
}

export interface Encounter {
uuid: string;
display: string;
links: Link[];
}

export interface Order {
uuid: string;
orderNumber: string;
accessionNumber: any;
patient: Patient;
concept: Concept;
action: string;
careSetting: CareSetting;
previousOrder: any;
dateActivated: string;
scheduledDate: any;
dateStopped: any;
autoExpireDate: any;
encounter: Encounter;
orderer: Orderer;
orderReason: any;
orderReasonNonCoded: any;
orderType: OrderType;
urgency: string;
instructions: any;
commentToFulfiller: any;
display: string;
specimenSource: any;
laterality: any;
clinicalHistory: any;
frequency: any;
numberOfRepeats: any;
links: Link[];
type: string;
resourceVersion: string;
}

export interface CareSetting {
uuid: string;
display: string;
links: Link[];
}

export interface Encounter {
uuid: string;
display: string;
links: Link[];
}

export interface Orderer {
uuid: string;
display: string;
links: Link[];
}

export interface OrderType {
uuid: string;
display: string;
name: string;
javaClassName: string;
retired: boolean;
description: string;
conceptClasses: any[];
parent: any;
links: Link[];
resourceVersion: string;
}

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 Encounter {
uuid: string;
display: string;
links: Link[];
}

export function useGetEncounterById(encounterUuid: string) {
const apiUrl = `/ws/rest/v1/encounter/${encounterUuid}?v=full`;
const { data, error, isLoading } = useSWR<{ data: EncounterResponse }, Error>(
apiUrl,
openmrsFetch
);

return {
encounter: data?.data,
isLoading,
isError: error,
};
}
Empty file.
Loading
Loading