Skip to content

Commit

Permalink
Add discharge_reason to patient filters (#5843)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 committed Jul 7, 2023
1 parent 473c0b0 commit 3cfe497
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const LocalStorageKeys = {
refreshToken: "care_refresh_token",
};
export interface OptionsType {
id: number;
id: number | string;
text: string;
label?: string;
desc?: string;
Expand Down
21 changes: 19 additions & 2 deletions src/Components/Patient/ManagePatients.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as Notification from "../../Utils/Notifications.js";

import {
ADMITTED_TO,
DISCHARGE_REASONS,
GENDER_TYPES,
PATIENT_CATEGORIES,
PATIENT_SORT_OPTIONS,
Expand Down Expand Up @@ -142,14 +143,19 @@ export const PatientManager = () => {
setEmergencyPhoneNumberError("Enter a valid number");
};

const tabValue = qParams.is_active === "False" ? 1 : 0;
const tabValue =
qParams.last_consultation_discharge_reason || qParams.is_active === "False"
? 1
: 0;

const params = {
page: qParams.page || 1,
limit: resultsPerPage,
name: qParams.name || undefined,
ip_no: qParams.ip_no || undefined,
is_active: qParams.is_active || "True",
is_active:
!qParams.last_consultation_discharge_reason &&
(qParams.is_active || "True"),
disease_status: qParams.disease_status || undefined,
phone_number: qParams.phone_number
? parsePhoneNumberFromString(qParams.phone_number)?.format("E.164")
Expand Down Expand Up @@ -189,6 +195,8 @@ export const PatientManager = () => {
qParams.last_consultation_discharge_date_after || undefined,
last_consultation_admitted_bed_type_list:
qParams.last_consultation_admitted_bed_type_list || undefined,
last_consultation_discharge_reason:
qParams.last_consultation_discharge_reason || undefined,
srf_id: qParams.srf_id || undefined,
number_of_doses: qParams.number_of_doses || undefined,
covin_id: qParams.covin_id || undefined,
Expand Down Expand Up @@ -332,6 +340,7 @@ export const PatientManager = () => {
qParams.age_max,
qParams.age_min,
qParams.last_consultation_admitted_bed_type_list,
qParams.last_consultation_discharge_reason,
qParams.facility,
qParams.facility_type,
qParams.district,
Expand Down Expand Up @@ -932,6 +941,14 @@ export const PatientManager = () => {
name: "Telemedicine",
paramKey: "last_consultation_is_telemedicine",
},
value(
"Discharge Reason",
"last_consultation_discharge_reason",
parseOptionId(
DISCHARGE_REASONS,
qParams.last_consultation_discharge_reason
) || ""
),
]}
children={
qParams.last_consultation_admitted_bed_type_list &&
Expand Down
23 changes: 23 additions & 0 deletions src/Components/Patient/PatientFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
DISEASE_STATUS,
PATIENT_FILTER_CATEGORIES,
ADMITTED_TO,
DISCHARGE_REASONS,
} from "../../Common/constants";
import moment from "moment";
import {
Expand Down Expand Up @@ -75,6 +76,8 @@ export default function PatientFilter(props: any) {
filter.last_consultation_admitted_bed_type_list
? filter.last_consultation_admitted_bed_type_list.split(",")
: [],
last_consultation_discharge_reason:
filter.last_consultation_discharge_reason || null,
srf_id: filter.srf_id || null,
number_of_doses: filter.number_of_doses || null,
covin_id: filter.covin_id || null,
Expand Down Expand Up @@ -230,6 +233,7 @@ export default function PatientFilter(props: any) {
last_consultation_discharge_date_before,
last_consultation_discharge_date_after,
last_consultation_admitted_bed_type_list,
last_consultation_discharge_reason,
number_of_doses,
covin_id,
srf_id,
Expand Down Expand Up @@ -314,6 +318,8 @@ export default function PatientFilter(props: any) {
age_max: age_max || "",
last_consultation_admitted_bed_type_list:
last_consultation_admitted_bed_type_list || [],
last_consultation_discharge_reason:
last_consultation_discharge_reason || "",
srf_id: srf_id || "",
number_of_doses: number_of_doses || "",
covin_id: covin_id || "",
Expand Down Expand Up @@ -452,6 +458,23 @@ export default function PatientFilter(props: any) {
}
/>
</div>
<div className="w-full flex-none" id="discharge-reason-select">
<FieldLabel className="text-sm">Discharge Reason</FieldLabel>
<SelectMenuV2
id="last_consultation_discharge_reason"
placeholder="Select discharge reason"
options={DISCHARGE_REASONS}
value={filterState.last_consultation_discharge_reason}
optionValue={(o) => o.id}
optionLabel={(o) => o.text}
onChange={(o) =>
setFilterState({
...filterState,
last_consultation_discharge_reason: o,
})
}
/>
</div>
<div className="w-full flex-none">
<FieldLabel className="text-sm">Telemedicine</FieldLabel>
<SelectMenuV2
Expand Down

0 comments on commit 3cfe497

Please sign in to comment.