From 783e4164c019b8249d3f6ce932a4b4a7395f4e2a Mon Sep 17 00:00:00 2001 From: mogoodrich Date: Mon, 7 Oct 2024 16:46:29 -0400 Subject: [PATCH] (feat) O3-4063: Ward App - update encounter types to use for Inpatient Notes and Transfer Request --- __mocks__/emr-configuration.mock.ts | 2 ++ packages/esm-ward-app/src/hooks/useEmrConfiguration.ts | 4 ++++ .../patient-transfer-request-form.component.tsx | 3 +-- .../ward-patient-notes/form/notes-form.component.tsx | 2 +- .../ward-patient-notes/form/notes-form.test.tsx | 2 +- .../ward-patient-notes/history/notes-container.component.tsx | 4 ++-- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/__mocks__/emr-configuration.mock.ts b/__mocks__/emr-configuration.mock.ts index 3eff29364..c1e8dddfb 100644 --- a/__mocks__/emr-configuration.mock.ts +++ b/__mocks__/emr-configuration.mock.ts @@ -3,4 +3,6 @@ export const emrConfigurationMock = { consultFreeTextCommentsConcept: { uuid: '162169AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' }, visitNoteEncounterType: { uuid: 'd7151f82-c1f3-4152-a605-2f9ea7414a79' }, admissionEncounterType: { uuid: 'e8151f82-c1f3-4152-a605-2f9ea7414a79' }, + inpatientNoteEncounterType: { uuid: 'f8151f82-c1f3-4152-a605-2f9ea7414a79' }, + transferRequestEncounterType: { uuid: 'g8151f82-c1f3-4152-a605-2f9ea7414a79' }, }; diff --git a/packages/esm-ward-app/src/hooks/useEmrConfiguration.ts b/packages/esm-ward-app/src/hooks/useEmrConfiguration.ts index daa1ad2f6..2e2ba95ba 100644 --- a/packages/esm-ward-app/src/hooks/useEmrConfiguration.ts +++ b/packages/esm-ward-app/src/hooks/useEmrConfiguration.ts @@ -12,6 +12,8 @@ interface EmrApiConfigurationResponse { clinicianEncounterRole: OpenmrsResource; consultFreeTextCommentsConcept: OpenmrsResource; visitNoteEncounterType: OpenmrsResource; + inpatientNoteEncounterType: OpenmrsResource; + transferRequestEncounterType: OpenmrsResource; transferWithinHospitalEncounterType: OpenmrsResource; exitFromInpatientEncounterType: OpenmrsResource; supportsTransferLocationTag: LocationTag; @@ -65,6 +67,8 @@ const customRepProps = [ ['diagnosisSets', 'ref'], ['personImageDirectory', 'ref'], ['visitNoteEncounterType', 'ref'], + ['inpatientNoteEncounterType', 'ref'], + ['transferRequestEncounterType', 'ref'], ['consultEncounterType', 'ref'], ['diagnosisMetadata', 'ref'], ['narrowerThanConceptMapType', 'ref'], diff --git a/packages/esm-ward-app/src/ward-workspace/patient-transfer-bed-swap/patient-transfer-request-form.component.tsx b/packages/esm-ward-app/src/ward-workspace/patient-transfer-bed-swap/patient-transfer-request-form.component.tsx index ef5ec74a5..918acdddc 100644 --- a/packages/esm-ward-app/src/ward-workspace/patient-transfer-bed-swap/patient-transfer-request-form.component.tsx +++ b/packages/esm-ward-app/src/ward-workspace/patient-transfer-bed-swap/patient-transfer-request-form.component.tsx @@ -65,7 +65,6 @@ export default function PatientTransferForm({ formState: { errors, isDirty }, control, handleSubmit, - getValues, setValue, } = useForm({ resolver: zodResolver(zodSchema), defaultValues: formDefaultValues }); @@ -104,7 +103,7 @@ export default function PatientTransferForm({ createEncounter({ patient: patient?.uuid, - encounterType: emrConfiguration.visitNoteEncounterType.uuid, + encounterType: emrConfiguration.transferRequestEncounterType.uuid, location: location.uuid, encounterProviders: [ { diff --git a/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/form/notes-form.component.tsx b/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/form/notes-form.component.tsx index beceb7988..ede900b9e 100644 --- a/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/form/notes-form.component.tsx +++ b/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/form/notes-form.component.tsx @@ -69,7 +69,7 @@ const PatientNotesForm: React.FC = ({ const notePayload = { patient: patientUuid, location: locationUuid, - encounterType: emrConfiguration?.visitNoteEncounterType.uuid, + encounterType: emrConfiguration?.inpatientNoteEncounterType.uuid, encounterProviders: [ { encounterRole: emrConfiguration?.clinicianEncounterRole.uuid, diff --git a/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/form/notes-form.test.tsx b/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/form/notes-form.test.tsx index 4b06d16f8..1df781207 100644 --- a/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/form/notes-form.test.tsx +++ b/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/form/notes-form.test.tsx @@ -54,7 +54,7 @@ test('renders a success snackbar upon successfully recording a visit note', asyn provider: undefined, }, ]), - encounterType: emrConfigurationMock.visitNoteEncounterType.uuid, + encounterType: emrConfigurationMock.inpatientNoteEncounterType.uuid, location: undefined, obs: expect.arrayContaining([ { diff --git a/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/history/notes-container.component.tsx b/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/history/notes-container.component.tsx index 79208fac7..e4f8a596a 100644 --- a/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/history/notes-container.component.tsx +++ b/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/history/notes-container.component.tsx @@ -14,12 +14,12 @@ interface PatientNotesHistoryProps { const PatientNotesHistory: React.FC = ({ patientUuid, visitUuid }) => { const { t } = useTranslation(); - const { emrConfiguration, isLoadingEmrConfiguration, errorFetchingEmrConfiguration } = useEmrConfiguration(); + const { emrConfiguration, isLoadingEmrConfiguration } = useEmrConfiguration(); const { patientNotes, isLoadingPatientNotes, errorFetchingPatientNotes } = usePatientNotes( patientUuid, visitUuid, - emrConfiguration?.visitNoteEncounterType?.uuid, + emrConfiguration?.inpatientNoteEncounterType?.uuid, emrConfiguration?.consultFreeTextCommentsConcept.uuid, );