From 9a7a57578223164fd276c4fad87006aa9eae09e3 Mon Sep 17 00:00:00 2001 From: Silevester Dongmo <58907550+SilverD3@users.noreply.github.com> Date: Thu, 21 Sep 2023 16:45:36 +0100 Subject: [PATCH] OHCS-73 OHCS-100 OH2-232 OHCS-107 | Remove material field all over the app and fix patient without picture (#519) * Remove material field form lab form * Fix the year field in visits filter form * Remove material in the entire app * Remove material field from patient summary * Fix patient blob photo to null if not provided * Fix error being displayed in patient visit even if nothing has been submitted * Fix CSS issues in patient activities, admission and summary --- src/components/accessories/currentAdmission/styles.scss | 4 ++++ .../accessories/laboratory/examForm/ExamForm.tsx | 9 +++++---- .../laboratory/examRequestForm/ExamRequestForm.tsx | 2 +- src/components/accessories/opds/filter/OpdFilterForm.tsx | 4 +++- .../accessories/patientDataForm/PatientDataForm.tsx | 4 ++++ .../accessories/patientExams/ExamForm/ExamForm.tsx | 4 ++-- src/components/accessories/patientExams/PatientExams.tsx | 2 +- .../PatientExamRequestsTable.tsx | 4 ++-- .../patientExams/patientExamsTable/PatientExamsTable.tsx | 8 ++++---- .../accessories/patientSummary/useSummaryMetaData.tsx | 2 +- src/components/accessories/table/styles.scss | 3 +++ .../editPatientActivity/EditPatientActivity.tsx | 9 +++++++++ 12 files changed, 39 insertions(+), 16 deletions(-) diff --git a/src/components/accessories/currentAdmission/styles.scss b/src/components/accessories/currentAdmission/styles.scss index ddd65ea28..dde59bf36 100644 --- a/src/components/accessories/currentAdmission/styles.scss +++ b/src/components/accessories/currentAdmission/styles.scss @@ -36,6 +36,10 @@ &.fullWidth { width: 100%; } + + .item_content { + word-break: break-word; + } } .item_label { font-size: 0.85em; diff --git a/src/components/accessories/laboratory/examForm/ExamForm.tsx b/src/components/accessories/laboratory/examForm/ExamForm.tsx index 4220c11dc..e478cfd2e 100644 --- a/src/components/accessories/laboratory/examForm/ExamForm.tsx +++ b/src/components/accessories/laboratory/examForm/ExamForm.tsx @@ -130,6 +130,7 @@ const ExamForm: FC = ({ } else { lab.status = LaboratoryDTOStatusEnum.OPEN; } + lab.material = "Undefined"; if (!creationMode && labToEdit.code) { dispatch(updateLab(labToEdit.code, labWithRowsDTO)); @@ -165,7 +166,7 @@ const ExamForm: FC = ({ }, }), exam: string().required(t("common.required")), - material: string().required(t("common.required")), + ///material: string().required(t("common.required")), result: string(), note: string().test({ name: "maxLength", @@ -392,7 +393,7 @@ const ExamForm: FC = ({ disabled={false} /> -
+ {/*
= ({ options={materialsOptionsSelector(materialsList)} disabled={isLoading} /> -
-
+
*/} +
= ({ ? LaboratoryDTOInOutPatientEnum.O : LaboratoryDTOInOutPatientEnum.I : LaboratoryDTOInOutPatientEnum.O; - lab.material = ""; // material needs to be removed from backend env + lab.material = "Undefined"; lab.result = ""; lab.status = LaboratoryDTOStatusEnum.DRAFT; diff --git a/src/components/accessories/opds/filter/OpdFilterForm.tsx b/src/components/accessories/opds/filter/OpdFilterForm.tsx index 832d382b6..a520d8f3f 100644 --- a/src/components/accessories/opds/filter/OpdFilterForm.tsx +++ b/src/components/accessories/opds/filter/OpdFilterForm.tsx @@ -221,7 +221,9 @@ export const OpdFilterForm: FC = ({ fields, onSubmit }) => { } if (fieldName === "year") { - const year = val?.getUTCFullYear() ?? new Date().getUTCFullYear(); + // Use getUTCFullYear() can result to wrong year as timezone can + // differ from one user to another, get the year as input instead + const year = val?.getFullYear() ?? new Date().getFullYear(); let startMonth = 0; let endMonth = 11; diff --git a/src/components/accessories/patientDataForm/PatientDataForm.tsx b/src/components/accessories/patientDataForm/PatientDataForm.tsx index c37cd61ac..3d4725b91 100644 --- a/src/components/accessories/patientDataForm/PatientDataForm.tsx +++ b/src/components/accessories/patientDataForm/PatientDataForm.tsx @@ -1,6 +1,7 @@ import { useFormik } from "formik"; import get from "lodash.get"; import has from "lodash.has"; +import isEmpty from "lodash.isempty"; import React, { FunctionComponent, useCallback, @@ -127,6 +128,9 @@ const PatientDataForm: FunctionComponent = ({ onSubmit({ ...formattedValues, + blobPhoto: isEmpty(formattedValues.blobPhoto) + ? null + : formattedValues.blobPhoto, birthDate: birthDate, age: age, agetype: "", diff --git a/src/components/accessories/patientExams/ExamForm/ExamForm.tsx b/src/components/accessories/patientExams/ExamForm/ExamForm.tsx index f164dedec..35113be7e 100644 --- a/src/components/accessories/patientExams/ExamForm/ExamForm.tsx +++ b/src/components/accessories/patientExams/ExamForm/ExamForm.tsx @@ -263,7 +263,7 @@ const ExamForm: FC = ({ disabled={isLoading} />
-
+ {/*
= ({ options={materialsOptionsSelector(materialsList)} disabled={isLoading} /> -
+
*/}
{ ? LaboratoryDTOInOutPatientEnum.O : LaboratoryDTOInOutPatientEnum.I : LaboratoryDTOInOutPatientEnum.O; - lab.material = "angal.lab.urine"; + lab.material = "Undefined"; if (!creationMode && labToEdit.code) { lab.code = labToEdit.code; lab.lock = labToEdit.lock; diff --git a/src/components/accessories/patientExams/patientExamRequestsTable/PatientExamRequestsTable.tsx b/src/components/accessories/patientExams/patientExamRequestsTable/PatientExamRequestsTable.tsx index 1428b694e..d5d0c92f8 100644 --- a/src/components/accessories/patientExams/patientExamRequestsTable/PatientExamRequestsTable.tsx +++ b/src/components/accessories/patientExams/patientExamRequestsTable/PatientExamRequestsTable.tsx @@ -36,7 +36,7 @@ const PatientExamRequestsTable: FunctionComponent = ({ exam: t("lab.exam"), status: t("lab.status"), note: t("lab.note"), - material: t("lab.material"), + //material: t("lab.material"), }; const order = ["date", "exam", "status"]; @@ -63,7 +63,7 @@ const PatientExamRequestsTable: FunctionComponent = ({ date: item.labDate ? renderDate(item.labDate) : "", status: item.status ? statusLabel(item.status) : "", exam: item.exam?.description ?? "", - material: item.material ? t(item.material) : "", + //material: item.material ? t(item.material) : "", note: item.note ?? "", }; }); diff --git a/src/components/accessories/patientExams/patientExamsTable/PatientExamsTable.tsx b/src/components/accessories/patientExams/patientExamsTable/PatientExamsTable.tsx index 5d046883d..ce02b26f8 100644 --- a/src/components/accessories/patientExams/patientExamsTable/PatientExamsTable.tsx +++ b/src/components/accessories/patientExams/patientExamsTable/PatientExamsTable.tsx @@ -37,7 +37,7 @@ const PatientExamsTable: FunctionComponent = ({ result: t("lab.result"), note: t("lab.note"), status: t("lab.status"), - material: t("lab.material"), + //material: t("lab.material"), }; const order = ["date", "exam", "status"]; @@ -74,9 +74,9 @@ const PatientExamsTable: FunctionComponent = ({ status: item.laboratoryDTO?.status ? statusLabel(item.laboratoryDTO.status) : "", - material: item.laboratoryDTO?.material - ? t(item.laboratoryDTO.material) - : "", + // material: item.laboratoryDTO?.material + // ? t(item.laboratoryDTO.material) + // : "", }; }); // .sort(dateComparator("desc", "date")); diff --git a/src/components/accessories/patientSummary/useSummaryMetaData.tsx b/src/components/accessories/patientSummary/useSummaryMetaData.tsx index e5c9b3fca..d58e6f48d 100644 --- a/src/components/accessories/patientSummary/useSummaryMetaData.tsx +++ b/src/components/accessories/patientSummary/useSummaryMetaData.tsx @@ -39,7 +39,7 @@ const useSummaryMetaData = () => { pex_auscultation: t("examination.auscultation"), pex_note: t("examination.note"), exam: t("lab.exam"), - material: t("lab.material"), + //material: t("lab.material"), labDate: t("lab.date"), startDate: t("therapy.startDate"), endDate: t("therapy.endDate"), diff --git a/src/components/accessories/table/styles.scss b/src/components/accessories/table/styles.scss index 62062175f..928a491f2 100644 --- a/src/components/accessories/table/styles.scss +++ b/src/components/accessories/table/styles.scss @@ -43,5 +43,8 @@ } } } + .collapseItem_row { + word-break: break-all; + } } } diff --git a/src/components/activities/editPatientActivity/EditPatientActivity.tsx b/src/components/activities/editPatientActivity/EditPatientActivity.tsx index 3d9c691b8..a3e4e4115 100644 --- a/src/components/activities/editPatientActivity/EditPatientActivity.tsx +++ b/src/components/activities/editPatientActivity/EditPatientActivity.tsx @@ -42,6 +42,15 @@ const EditPatientActivity: FunctionComponent = ({ const { id } = useParams<{ id: string }>(); const { t } = useTranslation(); + // Reset patient update state to avoid error displaying + // in patient details activity. + // See issue [OHCS-107](https://openhospital.atlassian.net/browse/OHCS-107) + useEffect(() => { + return () => { + updatePatientReset(); + }; + }, []); + useEffect(() => { if (isEmpty(patient.data) && patient.status === "IDLE" && id) { getPatientThunk(id);