From 73203a5234f60d04b41c3c1cebe99641047eb370 Mon Sep 17 00:00:00 2001 From: Akalintha007 <93814531+Akalintha007@users.noreply.github.com> Date: Tue, 27 Sep 2022 10:45:04 +0530 Subject: [PATCH] added filter functionality and integratedn get patients api --- package.json | 11 +- src/HospitalRun.tsx | 64 ++--- src/imagings/requests/NewImagingRequest.tsx | 2 +- src/incidents/report/ReportIncident.tsx | 2 +- src/incidents/view/ViewIncident.tsx | 2 +- src/labs/ViewLab.tsx | 4 +- src/labs/requests/NewLabRequest.tsx | 2 +- src/medications/ViewMedication.tsx | 2 +- src/patients/ContactInfo.tsx | 7 +- src/patients/allergies/NewAllergyModal.tsx | 2 +- src/patients/allergies/ViewAllergy.tsx | 2 +- src/patients/care-goals/AddCareGoalModal.tsx | 2 +- src/patients/care-goals/CareGoalTab.tsx | 2 +- src/patients/care-goals/ViewCareGoal.tsx | 2 +- src/patients/care-goals/ViewCareGoals.tsx | 2 +- src/patients/care-plans/AddCarePlanModal.tsx | 2 +- src/patients/care-plans/CarePlanTab.tsx | 2 +- src/patients/care-plans/ViewCarePlan.tsx | 2 +- src/patients/care-plans/ViewCarePlans.tsx | 2 +- src/patients/diagnoses/AddDiagnosisModal.tsx | 2 +- src/patients/diagnoses/Diagnoses.tsx | 2 +- src/patients/diagnoses/ViewDiagnoses.tsx | 2 +- src/patients/diagnoses/ViewDiagnosis.tsx | 2 +- src/patients/edit/EditPatient.tsx | 2 +- src/patients/hooks/usePatients.tsx | 9 + src/patients/notes/NewNoteModal.tsx | 2 +- src/patients/notes/ViewNote.tsx | 2 +- src/patients/patient-slice.ts | 2 +- .../related-persons/AddRelatedPersonModal.tsx | 2 +- src/patients/search/SearchPatients.tsx | 161 ++++++++++-- src/patients/search/ViewPatients.tsx | 2 +- src/patients/search/ViewPatientsTable.tsx | 12 +- .../search/filter/FormControlLabelCustom.tsx | 57 +++++ src/patients/search/filter/PatientFilter.tsx | 237 ++++++++++++++++++ src/patients/search/filter/theme.tsx | 14 ++ src/patients/util/constants.ts | 18 ++ src/patients/view/ViewPatient.tsx | 2 +- src/patients/visits/AddVisitModal.tsx | 2 +- src/patients/visits/ViewVisit.tsx | 2 +- .../appointments/edit/EditAppointment.tsx | 2 +- .../util/scheduling-appointment.util.ts | 4 +- .../appointments/view/ViewAppointment.tsx | 2 +- src/shared/components/Sidebar.tsx | 1 + src/shared/util/DataHelpers.tsx | 2 +- src/user/user-slice.ts | 2 +- 45 files changed, 574 insertions(+), 89 deletions(-) create mode 100644 src/patients/search/filter/FormControlLabelCustom.tsx create mode 100644 src/patients/search/filter/PatientFilter.tsx create mode 100644 src/patients/search/filter/theme.tsx create mode 100644 src/patients/util/constants.ts diff --git a/package.json b/package.json index 739ab3dbc4..9ec3ae7522 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,11 @@ "private": false, "license": "MIT", "dependencies": { + "@emotion/react": "~11.10.4", + "@emotion/styled": "~11.10.4", "@hospitalrun/components": "~3.4.0", + "@mui/icons-material": "~5.10.6", + "@mui/material": "~5.10.6", "@reduxjs/toolkit": "~1.7.0", "@types/escape-string-regexp": "~2.0.1", "@types/json2csv": "~5.0.1", @@ -39,7 +43,8 @@ "redux-thunk": "~2.4.0", "relational-pouch": "~4.0.0", "shortid": "^2.2.15", - "typescript": "~3.8.3", + "tslib": "~2.4.0", + "typescript": "~4.8.3", "uuid": "^8.0.0", "validator": "^13.0.0" }, @@ -75,7 +80,7 @@ "@types/react": "~17.0.0", "@types/react-dom": "~17.0.0", "@types/react-redux": "~7.1.5", - "@types/react-router": "~5.1.2", + "@types/react-router": "~5.1.19", "@types/react-router-dom": "~5.3.0", "@types/redux-mock-store": "~1.0.1", "@types/shortid": "^0.0.29", @@ -116,7 +121,7 @@ "scripts": { "analyze": "source-map-explorer 'build/static/js/*.js'", "commit": "npx git-cz", - "start": "npm run translation:check && react-scripts start", + "start": "react-scripts start", "build": "react-scripts build", "update": "npx npm-check -u", "prepublishOnly": "npm run build", diff --git a/src/HospitalRun.tsx b/src/HospitalRun.tsx index 4bd60bdd01..7433d82315 100644 --- a/src/HospitalRun.tsx +++ b/src/HospitalRun.tsx @@ -29,38 +29,40 @@ const HospitalRun = () => {
-
- +
+
- -
-
-
-

{title}

- -
- -
- - - - - - - - - - -
- -
-
-
+ + +
+
+
+

{title}

+ +
+ +
+ + + + + + + + + + +
+ +
+
+
+
) diff --git a/src/imagings/requests/NewImagingRequest.tsx b/src/imagings/requests/NewImagingRequest.tsx index f6afe5eeb5..60389519c5 100644 --- a/src/imagings/requests/NewImagingRequest.tsx +++ b/src/imagings/requests/NewImagingRequest.tsx @@ -111,7 +111,7 @@ const NewImagingRequest = () => { try { await mutate(newImagingRequest) history.push(`/imaging`) - } catch (e) { + } catch (e: any) { setError(e) } } diff --git a/src/incidents/report/ReportIncident.tsx b/src/incidents/report/ReportIncident.tsx index 62bee68cf8..cd808ed294 100644 --- a/src/incidents/report/ReportIncident.tsx +++ b/src/incidents/report/ReportIncident.tsx @@ -58,7 +58,7 @@ const ReportIncident = () => { try { const data = await mutate(incident as Incident) history.push(`/incidents/${data?.id}`) - } catch (e) { + } catch (e: any) { setError(e) } } diff --git a/src/incidents/view/ViewIncident.tsx b/src/incidents/view/ViewIncident.tsx index 7862f660c6..7d459e54cf 100644 --- a/src/incidents/view/ViewIncident.tsx +++ b/src/incidents/view/ViewIncident.tsx @@ -9,7 +9,7 @@ import { RootState } from '../../shared/store' import ViewIncidentDetails from './ViewIncidentDetails' const ViewIncident = () => { - const { id } = useParams() + const { id } = useParams() const { permissions } = useSelector((root: RootState) => root.user) const { t } = useTranslator() const updateTitle = useUpdateTitle() diff --git a/src/labs/ViewLab.tsx b/src/labs/ViewLab.tsx index 95b38758da..4cded630b2 100644 --- a/src/labs/ViewLab.tsx +++ b/src/labs/ViewLab.tsx @@ -24,7 +24,7 @@ const getTitle = (patient: Patient | undefined, lab: Lab | undefined) => patient && lab ? `${lab.type} for ${patient.fullName}(${lab.code})` : '' const ViewLab = () => { - const { id } = useParams() + const { id } = useParams() const { t } = useTranslator() const history = useHistory() const { permissions } = useSelector((state: RootState) => state.user) @@ -132,7 +132,7 @@ const ViewLab = () => { ) } setError(undefined) - } catch (e) { + } catch (e: any) { setError(e) } } diff --git a/src/labs/requests/NewLabRequest.tsx b/src/labs/requests/NewLabRequest.tsx index 2e1c1b0e73..0056340203 100644 --- a/src/labs/requests/NewLabRequest.tsx +++ b/src/labs/requests/NewLabRequest.tsx @@ -118,7 +118,7 @@ const NewLabRequest = () => { }`, ) setError(undefined) - } catch (e) { + } catch (e: any) { setError(e) } } diff --git a/src/medications/ViewMedication.tsx b/src/medications/ViewMedication.tsx index 3303aebea2..87c9bf8f9f 100644 --- a/src/medications/ViewMedication.tsx +++ b/src/medications/ViewMedication.tsx @@ -20,7 +20,7 @@ const getTitle = (patient: Patient | undefined, medication: Medication | undefin patient && medication ? `${medication.medication} for ${patient.fullName}` : '' const ViewMedication = () => { - const { id } = useParams() + const { id } = useParams() const { t } = useTranslator() const history = useHistory() const dispatch = useDispatch() diff --git a/src/patients/ContactInfo.tsx b/src/patients/ContactInfo.tsx index 7b1ba4148e..0b7fd78cd5 100644 --- a/src/patients/ContactInfo.tsx +++ b/src/patients/ContactInfo.tsx @@ -38,8 +38,9 @@ const ContactInfo = (props: Props): ReactElement => { const header = ( - {t('patient.contactInfoType.label')} - & {t(label)} + {/* {t('patient.contactInfoType.label')} + & {t(label)} */} + {t(label)} @@ -81,7 +82,7 @@ const ContactInfo = (props: Props): ReactElement => {
-