From c3ee151bbeb2e50cda0a344719f52ef1512b0649 Mon Sep 17 00:00:00 2001 From: jabahum Date: Mon, 22 Jan 2024 15:29:34 +0300 Subject: [PATCH 1/4] set up barcode reading --- .../add-to-worklist-dialog.component.tsx | 101 +++++++++++++----- 1 file changed, 77 insertions(+), 24 deletions(-) diff --git a/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx b/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx index a0366208..a4150ab3 100644 --- a/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx +++ b/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx @@ -279,30 +279,83 @@ const AddToWorklistDialog: React.FC = ({ /> {preferred && ( -
-
- -
-
+ <> +
+
+ +
+ +
+
+
+ {t("locationName", "Enter Name")} +
+ +
+ +
+
+
+
+ {t("barcode", "Enter Barcode")} +
+ +
+ +
+
+
+
+ {t("confirmBarcode", "Confirm Barcode")} +
+ +
+ +
+
+
+
+ )} From 1174f4f7731ebf68b002825af45421d4e2195c03 Mon Sep 17 00:00:00 2001 From: jabahum Date: Mon, 22 Jan 2024 15:43:43 +0300 Subject: [PATCH 2/4] disable specimen Id on Check --- .../lab-dialogs/add-to-worklist-dialog.component.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx b/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx index a4150ab3..a0bcd359 100644 --- a/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx +++ b/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx @@ -209,6 +209,8 @@ const AddToWorklistDialog: React.FC = ({ type="text" id="specimentID" value={specimenID} + readOnly={preferred} + hideReadOnly={preferred} />
@@ -216,6 +218,7 @@ const AddToWorklistDialog: React.FC = ({ hasIconOnly onClick={(e) => generateId(e)} renderIcon={(props) => } + disabled={preferred} />
From 41786d24e46e3b4e258996bbee9ccf59bd67311f Mon Sep 17 00:00:00 2001 From: jabahum Date: Mon, 22 Jan 2024 16:09:21 +0300 Subject: [PATCH 3/4] add barcode input fields --- .../add-to-worklist-dialog.component.tsx | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx b/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx index a0bcd359..c97b73c8 100644 --- a/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx +++ b/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx @@ -316,12 +316,12 @@ const AddToWorklistDialog: React.FC = ({ alignContent: "stretch", }} > -
- {t("locationName", "Enter Name")} -
- -
- +
+
= ({ alignContent: "stretch", }} > -
- {t("barcode", "Enter Barcode")} -
- -
- +
+
= ({ alignContent: "stretch", }} > -
- {t("confirmBarcode", "Confirm Barcode")} -
- -
- +
+
From 8871834fd6a996e245729fb0b39ecb05ec1e77b5 Mon Sep 17 00:00:00 2001 From: jabahum Date: Thu, 25 Jan 2024 12:47:50 +0300 Subject: [PATCH 4/4] add qr code / auto serial sample ID capture --- src/config-schema.ts | 7 +- .../add-to-worklist-dialog.component.tsx | 195 ++++++++---------- .../add-to-worklist-dialog.resource.ts | 18 +- 3 files changed, 109 insertions(+), 111 deletions(-) diff --git a/src/config-schema.ts b/src/config-schema.ts index d000a457..e008d16f 100644 --- a/src/config-schema.ts +++ b/src/config-schema.ts @@ -13,7 +13,7 @@ export const configSchema = { }, laboratorySpecimenTypeConcept: { _type: Type.ConceptUuid, - _default: "159959AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + _default: "162476AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", _description: "Concept UUID for laboratory specimen types", }, laboratoryEncounterTypeUuid: { @@ -26,6 +26,11 @@ export const configSchema = { _default: "52a447d3-a64a-11e3-9aeb-50e549534c5e", _description: "Uuid for orderType", }, + laboratoryReferalDestinationUuid: { + _type: Type.String, + _default: "b1f8b6c8-c255-4518-89f5-4236ab76025b", + _description: "Concept uuid for laboratory referals destinations", + }, }; export type Config = { diff --git a/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx b/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx index c97b73c8..df2011d7 100644 --- a/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx +++ b/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx @@ -32,82 +32,41 @@ import { GetOrderByUuid, UpdateOrder, useQueueRoomLocations, + useReferralLocations, useSpecimenTypes, } from "./add-to-worklist-dialog.resource"; import { Encounter, Order } from "../../types/patient-queues"; interface AddToWorklistDialogProps { queueId; - encounter: Encounter; order: Order; closeModal: () => void; } const AddToWorklistDialog: React.FC = ({ queueId, - encounter, order, closeModal, }) => { const { t } = useTranslation(); - const locations = useLocations(); - - const sessionUser = useSession(); - - const [selectedLocation, setSelectedLocation] = useState(""); - const [preferred, setPreferred] = useState(false); - const [specimenID, setSpecimenID] = useState(); + const [specimenID, setSpecimenID] = useState(""); const { specimenTypes } = useSpecimenTypes(); - const [orderer, setOrderer] = useState(""); - - const [concept, setConcept] = useState(""); - - const [patient, setPatient] = useState(""); - - const [encounterUuid, setEncounterUuid] = useState(""); - - const { queueRoomLocations } = useQueueRoomLocations( - sessionUser?.sessionLocation?.uuid - ); + const { referrals } = useReferralLocations(); const [specimenType, setSpecimenType] = useState(); - const [selectedNextQueueLocation, setSelectedNextQueueLocation] = useState( - queueRoomLocations[0]?.uuid - ); + const [selectedReferral, setSelectedReferral] = useState(""); - const filteredlocations = queueRoomLocations?.filter( - (location) => location.uuid != selectedLocation - ); + const [barcode, setBarcode] = useState(""); - useEffect(() => { - if (locations?.length && sessionUser) { - setSelectedLocation(sessionUser?.sessionLocation?.uuid); - } - }, [locations, sessionUser]); + const [confirmBarcode, setConfirmBarcode] = useState(""); - // GetOrderByUuid - GetOrderByUuid(order.uuid).then( - (resp) => { - setOrderer(resp.data?.orderer?.uuid); - setConcept(resp.data?.concept?.uuid); - setPatient(resp.data?.patient?.uuid); - setEncounterUuid(resp.data?.encounter.uuid); - }, - (err) => { - showNotification({ - title: t(`errorGettingOrder', 'Error Getting Order Id`), - kind: "error", - critical: true, - description: err?.message, - }); - } - ); + const [externalReferralName, setExternalReferralName] = useState(""); const pickLabRequestQueue = async (event) => { event.preventDefault(); @@ -174,6 +133,12 @@ const AddToWorklistDialog: React.FC = ({ ); }; + useEffect(() => { + if (barcode !== "" && confirmBarcode !== "" && barcode == confirmBarcode) { + setSpecimenID(barcode); + } + }, [barcode, confirmBarcode]); + return (
@@ -193,7 +158,9 @@ const AddToWorklistDialog: React.FC = ({ }} >
- {t("specimenID", "Specimen ID")} + {preferred + ? t("barcode", "Barcode") + : t("specimenID", "Specimen ID")}
= ({ />
{preferred && ( - <> -
-
- -
+
+
+ +
-
+
+ {selectedReferral === + "3476fd97-71da-4e9c-bf57-2b6318dc0c9f" && (
@@ -321,44 +287,55 @@ const AddToWorklistDialog: React.FC = ({ type="text" id="locationName" labelText={"Enter Name"} + value={externalReferralName} + required={true} + onChange={(e) => + setExternalReferralName(e.target.value) + } />
-
-
- -
+ )} +
+
+ { + setBarcode(e.target.value); + }} + />
-
-
- -
+
+
+
+ { + setConfirmBarcode(e.target.value); + }} + />
-
-
- +
+ +
)}
diff --git a/src/queue-list/lab-dialogs/add-to-worklist-dialog.resource.ts b/src/queue-list/lab-dialogs/add-to-worklist-dialog.resource.ts index 947ad520..5d8a42ad 100644 --- a/src/queue-list/lab-dialogs/add-to-worklist-dialog.resource.ts +++ b/src/queue-list/lab-dialogs/add-to-worklist-dialog.resource.ts @@ -102,6 +102,22 @@ export function useQueueRoomLocations(currentQueueLocation: string) { }; } +// get referral locations +export function useReferralLocations() { + const config = useConfig(); + const { laboratoryReferalDestinationUuid } = config; + const apiUrl = `/ws/rest/v1/concept/${laboratoryReferalDestinationUuid}`; + const { data, error, isLoading } = useSWRImmutable( + apiUrl, + openmrsFetch + ); + + return { + referrals: data ? data?.data?.answers : [], + isLoading, + }; +} + // get specimen types export function useSpecimenTypes() { const config = useConfig(); @@ -114,7 +130,7 @@ export function useSpecimenTypes() { ); return { - specimenTypes: data ? data?.data?.answers : [], + specimenTypes: data ? data?.data?.setMembers : [], isLoading, }; }