+ {specimen ? (
+
+ {/* Barcode Success Message */}
+
+
+
+
+
+ {specimen.accession_identifier ??
+ specimen.identifier ??
+ specimen.id.slice(0, 8)}
+
+
+ In Process
+
+
+
+
+
+
+
+
+
+
+ Success
+
+
+ Barcode Scanned Successfully
+
+
+
+
+
+
+
+
+
+ {specimen.type.display ?? specimen.type.code}
+
+
+
+
+
+ {specimen.collected_at}
+
+
+
+
+
+ {specimen.subject.name}
+
+
+ T105690908240017
+
+
+
+
+
+ {specimen.request.id.slice(0, 8)}
+
+
+
+
+
+ Not Specified
+
+
+
+
+
+ {specimen.request.code.display ?? specimen.request.code.code}
+
+
+
+
+
+ {specimen.request.priority ?? "Routine"}
+
+
+
+
+ {/* Footer Buttons */}
+ {!specimen?.processing.length && (
+
+
+
+
+ )}
+
+ ) : (
+
+
+ {
+ if (e.key === "Enter") {
+ const barcode = e.currentTarget.value;
+
+ const { res, data } = await request(
+ routes.labs.specimen.get,
+ {
+ pathParams: {
+ id: barcode,
+ },
+ },
+ );
+
+ if (!res?.ok || !data) {
+ return;
+ }
+
+ setSpecimen(data);
+ }
+ }}
+ />
+
+ )}
+
+ {/* Todo: Extra this into a separate component if not done already at some where else*/}
+
+
+ {/* Label */}
+
+
+
+
setShowOptions(true)}
+ className={`border ${!showOptions && "divide-y-0"}`}
+ >
+
+ {showOptions && (
+
+ No results found.
+
+ {analyzers.map((analyzer) => (
+ {
+ setQuery(analyzer.name);
+ setShowOptions(false);
+ }}
+ className="cursor-pointer"
+ >
+
+
+
+ {analyzer.name}
+
+
+
+ {analyzer.description}
+
+
+
+
+ ))}
+
+
+ )}
+
+
+
+
+ {/* Buttons */}
+
+
+
+
+
+
+
+
+ Specimen Type:
+
+
+ Number of samples
+
+
+
+
+
+
+
+ Serum
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+ Aliquot 1:
+
+
+ {2 / 2 != 1 ? "Collected" : "Not Collected"}
+
+
+
+
+
+
+ Barcode
+
+
+ {false && (
+
+ )}
+
+ {false ? (
+
+
+ {/* Success Badge */}
+
+
+ Success
+
+ {/* Success Message */}
+
+ Barcode scanned successfully
+
+
+
+ {/* Barcode */}
+
+
+
+ 123456700
+
+
+
+
+
+
Tube Type
+
+ Not Available
+
+
+
+
Test
+
+ Not Available
+
+
+
+
+ Collection Date/Time
+
+
+ 11-Dec-2021 12:00 PM
+
+
+
+
+ ) : (
+
+
+
+
+
OR
+
+
+
+
+ )}
+
+
+
+
+
+
+ {observations.map((observation, i) => (
+
+ {/* Header Section */}
+
+ {
+ setObservations((observations) =>
+ observations.map((obs, index) =>
+ index === i ? { ...obs, code: observation } : obs,
+ ),
+ );
+ }}
+ />
+
+
+
+
+ {/* Input Section */}
+
+ {/* Unit */}
+
+
+
+
+
+ {/* Result */}
+
+
+ {
+ setObservations((observations) =>
+ observations.map((obs, index) =>
+ index === i
+ ? { ...obs, result: e.currentTarget.value }
+ : obs,
+ ),
+ );
+ }}
+ />
+
+
+ {/* Badge */}
+
+
+ Normal
+
+
+
+
+ {/* Note Section */}
+
+
+
+
+ ))}
+ {/* Add another result button */}
+
+
+ {/* Footer Buttons */}
+
+
+
+
+
+
+ Test Results:
+
+
+
+
+
+ Parameter
+
+
+ Result
+
+ Unit
+
+ Reference Range
+
+ Remark
+
+
+
+ {diagnosticReport.result.map((observation) => (
+
+
+ {observation.main_code?.display ??
+ observation.main_code?.code}
+
+ {observation.value}
+ {observation.reference_range?.unit}
+ Dummy Ref range
+ {observation.note}
+
+ ))}
+
+
+ {diagnosticReport.status !== "preliminary" && (
+
+
+
+
+ )}
+