Skip to content

Commit

Permalink
(fix) O3-3622: Allow saving lab reference number with the lab order (#…
Browse files Browse the repository at this point in the history
…1968)

* Replace instances of labReferenceNumber with accessionNumber

* Update test for lab order form

---------

Co-authored-by: Usama Idriss Kakumba <[email protected]>
Co-authored-by: Dennis Kigen <[email protected]>
  • Loading branch information
3 people authored Aug 30, 2024
1 parent 8858654 commit 1eaec53
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
8 changes: 5 additions & 3 deletions packages/esm-patient-common-lib/src/orders/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export interface OrderBasketItem {
};
extractedOrderError?: ExtractedOrderErrorObject;
isOrderIncomplete?: boolean;
/**
* An optional identifier from the fulfiller (e.g., lab system) for the specimen or record associated with the order.
*/
accessionNumber?: string;
}

export interface OrderPost {
Expand Down Expand Up @@ -68,7 +72,7 @@ export interface OrderPost {
orderReasonNonCoded?: string;
orderReason?: string;
instructions?: string;
labReferenceNumber?: string;
accessionNumber?: string;
}

export interface PatientOrderFetchResponse {
Expand Down Expand Up @@ -146,7 +150,6 @@ export interface Order {
clinicalHistory: string;
numberOfRepeats: string;
type: string;
labReferenceNumber?: string;
}

export interface OrderTypeFetchResponse {
Expand Down Expand Up @@ -204,7 +207,6 @@ export interface LabOrderBasketItem extends OrderBasketItem {
label: string;
conceptUuid: string;
};
labReferenceNumber?: string;
urgency?: string;
instructions?: string;
previousOrder?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

button {
display: flex;
padding-left: 0 !important;
margin: 0 layout.$spacing-05;
margin-left: -(layout.$spacing-03);

svg {
order: 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ describe('AddLabOrder', () => {
display: 'CD4 COUNT',
urgency: 'STAT',
instructions: 'plz do it thx',
labReferenceNumber: 'lba-000124',
accessionNumber: 'lba-000124',
testType: { label: 'CD4 COUNT', conceptUuid: 'test-lab-uuid-2' },
orderer: mockSessionDataResponse.data.currentProvider.uuid,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function LabOrderForm({
urgency: z.string().refine((value) => value !== '', {
message: translateFrom(moduleName, 'addLabOrderPriorityRequired', 'Priority is required'),
}),
labReferenceNumber: z.string().optional(),
accessionNumber: z.string().optional(),
testType: z.object(
{ label: z.string(), conceptUuid: z.string() },
{
Expand Down Expand Up @@ -182,7 +182,7 @@ export function LabOrderForm({
<Column lg={16} md={8} sm={4}>
<InputWrapper>
<Controller
name="labReferenceNumber"
name="accessionNumber"
control={control}
render={({ field: { onChange, onBlur, value } }) => (
<TextInput
Expand All @@ -193,8 +193,8 @@ export function LabOrderForm({
value={value}
onChange={onChange}
onBlur={onBlur}
invalid={errors.labReferenceNumber?.message}
invalidText={errors.labReferenceNumber?.message}
invalid={errors.accessionNumber?.message}
invalidText={errors.accessionNumber?.message}
/>
)}
/>
Expand Down
3 changes: 3 additions & 0 deletions packages/esm-patient-labs-app/src/lab-orders/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export function prepLabOrderPostData(
concept: order.testType.conceptUuid,
instructions: order.instructions,
orderReason: order.orderReason,
accessionNumber: order.accessionNumber,
};
} else if (order.action === 'REVISE') {
return {
Expand All @@ -105,6 +106,7 @@ export function prepLabOrderPostData(
instructions: order.instructions,
orderReason: order.orderReason,
previousOrder: order.previousOrder,
accessionNumber: order.accessionNumber,
};
} else if (order.action === 'DISCONTINUE') {
return {
Expand All @@ -117,6 +119,7 @@ export function prepLabOrderPostData(
concept: order.testType.conceptUuid,
orderReason: order.orderReason,
previousOrder: order.previousOrder,
accessionNumber: order.accessionNumber,
};
} else {
throw new Error(`Unknown order action: ${order.action}.`);
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-patient-orders-app/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function buildLabOrder(order: Order, action?: OrderAction) {
careSetting: order.careSetting.uuid,
instructions: order.instructions,
urgency: order.urgency,
labReferenceNumber: order.labReferenceNumber,
accessionNumber: order.accessionNumber,
testType: {
label: order.concept.display,
conceptUuid: order.concept.uuid,
Expand Down

0 comments on commit 1eaec53

Please sign in to comment.