Skip to content

Commit

Permalink
OHCS-73 OHCS-100 OH2-232 OHCS-107 | Remove material field all over th…
Browse files Browse the repository at this point in the history
…e 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
  • Loading branch information
SilverD3 authored Sep 21, 2023
1 parent b8b7d07 commit 9a7a575
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 16 deletions.
4 changes: 4 additions & 0 deletions src/components/accessories/currentAdmission/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
&.fullWidth {
width: 100%;
}

.item_content {
word-break: break-word;
}
}
.item_label {
font-size: 0.85em;
Expand Down
9 changes: 5 additions & 4 deletions src/components/accessories/laboratory/examForm/ExamForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const ExamForm: FC<ExamProps> = ({
} else {
lab.status = LaboratoryDTOStatusEnum.OPEN;
}
lab.material = "Undefined";

if (!creationMode && labToEdit.code) {
dispatch(updateLab(labToEdit.code, labWithRowsDTO));
Expand Down Expand Up @@ -165,7 +166,7 @@ const ExamForm: FC<ExamProps> = ({
},
}),
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",
Expand Down Expand Up @@ -392,7 +393,7 @@ const ExamForm: FC<ExamProps> = ({
disabled={false}
/>
</div>
<div className="patientExamForm__item">
{/* <div className="patientExamForm__item">
<AutocompleteField
fieldName="material"
fieldValue={formik.values.material}
Expand All @@ -404,8 +405,8 @@ const ExamForm: FC<ExamProps> = ({
options={materialsOptionsSelector(materialsList)}
disabled={isLoading}
/>
</div>
<div className="patientExamForm__item fullWidth">
</div> */}
<div className="patientExamForm__item">
<AutocompleteField
fieldName="exam"
fieldValue={formik.values.exam}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const ExamRequestForm: FC<ExamRequestProps> = ({
? 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;

Expand Down
4 changes: 3 additions & 1 deletion src/components/accessories/opds/filter/OpdFilterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ export const OpdFilterForm: FC<IOpdFilterProps> = ({ 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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -127,6 +128,9 @@ const PatientDataForm: FunctionComponent<TProps> = ({

onSubmit({
...formattedValues,
blobPhoto: isEmpty(formattedValues.blobPhoto)
? null
: formattedValues.blobPhoto,
birthDate: birthDate,
age: age,
agetype: "",
Expand Down
4 changes: 2 additions & 2 deletions src/components/accessories/patientExams/ExamForm/ExamForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ const ExamForm: FC<ExamProps> = ({
disabled={isLoading}
/>
</div>
<div className="patientExamForm__item">
{/* <div className="patientExamForm__item">
<AutocompleteField
fieldName="material"
fieldValue={formik.values.material}
Expand All @@ -275,7 +275,7 @@ const ExamForm: FC<ExamProps> = ({
options={materialsOptionsSelector(materialsList)}
disabled={isLoading}
/>
</div>
</div> */}
<div className="patientExamForm__item fullWidth">
<AutocompleteField
fieldName="exam"
Expand Down
2 changes: 1 addition & 1 deletion src/components/accessories/patientExams/PatientExams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const PatientExams: FC = () => {
? 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const PatientExamRequestsTable: FunctionComponent<IOwnProps> = ({
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"];

Expand All @@ -63,7 +63,7 @@ const PatientExamRequestsTable: FunctionComponent<IOwnProps> = ({
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 ?? "",
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const PatientExamsTable: FunctionComponent<IOwnProps> = ({
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"];

Expand Down Expand Up @@ -74,9 +74,9 @@ const PatientExamsTable: FunctionComponent<IOwnProps> = ({
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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
3 changes: 3 additions & 0 deletions src/components/accessories/table/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,8 @@
}
}
}
.collapseItem_row {
word-break: break-all;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ const EditPatientActivity: FunctionComponent<TProps> = ({
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);
Expand Down

0 comments on commit 9a7a575

Please sign in to comment.