Skip to content

Commit

Permalink
fix(daily_round): added recommend_discharge as action
Browse files Browse the repository at this point in the history
  • Loading branch information
aeswibon committed Sep 27, 2023
1 parent 9bc19ed commit 560119e
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 53 deletions.
1 change: 1 addition & 0 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ export const TELEMEDICINE_ACTIONS = [
{ id: 60, text: "COMPLETE", desc: "Complete" },
{ id: 70, text: "REVIEW", desc: "Review" },
{ id: 80, text: "NOT_REACHABLE", desc: "Not Reachable" },
{ id: 90, text: "DISCHARGE_RECOMMENDED", desc: "Discharge Recommended" },
];

export const FRONTLINE_WORKER = [
Expand Down
38 changes: 18 additions & 20 deletions src/Components/Patient/DailyRounds.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
import { navigate } from "raviger";

import { useCallback, useState, useEffect, lazy } from "react";
import dayjs from "dayjs";
import { lazy, useCallback, useEffect, useState } from "react";
import { useDispatch } from "react-redux";
import {
TELEMEDICINE_ACTIONS,
PATIENT_CATEGORIES,
REVIEW_AT_CHOICES,
RHYTHM_CHOICES,
PATIENT_CATEGORIES,
TELEMEDICINE_ACTIONS,
} from "../../Common/constants";
import useAppHistory from "../../Common/hooks/useAppHistory";
import { statusType, useAbortableEffect } from "../../Common/utils";
import {
createDailyReport,
getConsultationDailyRoundsDetails,
getDailyReport,
updateDailyReport,
getPatient,
updateDailyReport,
} from "../../Redux/actions";
import { DraftSection, useAutoSaveReducer } from "../../Utils/AutoSave";
import * as Notification from "../../Utils/Notifications";
import { formatDateTime } from "../../Utils/utils";
import TextAreaFormField from "../Form/FormFields/TextAreaFormField";
import { Cancel, Submit } from "../Common/components/ButtonV2";
import useAppHistory from "../../Common/hooks/useAppHistory";
import { DraftSection, useAutoSaveReducer } from "../../Utils/AutoSave";
import Page from "../Common/components/Page";
import { FieldChangeEvent } from "../Form/FormFields/Utils";
import TextFormField from "../Form/FormFields/TextFormField";
import { SelectFormField } from "../Form/FormFields/SelectFormField";
import PatientCategorySelect from "./PatientCategorySelect";
import CheckBoxFormField from "../Form/FormFields/CheckBoxFormField";
import { SymptomsSelect } from "../Common/SymptomsSelect";
import RangeAutocompleteFormField from "../Form/FormFields/RangeAutocompleteFormField";
import BloodPressureFormField, {
meanArterialPressure,
} from "../Common/BloodPressureFormField";
import { SymptomsSelect } from "../Common/SymptomsSelect";
import TemperatureFormField from "../Common/TemperatureFormField";
import dayjs from "dayjs";
import { Cancel, Submit } from "../Common/components/ButtonV2";
import Page from "../Common/components/Page";
import CheckBoxFormField from "../Form/FormFields/CheckBoxFormField";
import RangeAutocompleteFormField from "../Form/FormFields/RangeAutocompleteFormField";
import { SelectFormField } from "../Form/FormFields/SelectFormField";
import TextAreaFormField from "../Form/FormFields/TextAreaFormField";
import TextFormField from "../Form/FormFields/TextFormField";
import { FieldChangeEvent } from "../Form/FormFields/Utils";
import PatientCategorySelect from "./PatientCategorySelect";
const Loading = lazy(() => import("../Common/Loading"));

const initForm: any = {
Expand All @@ -44,8 +44,7 @@ const initForm: any = {
other_details: "",
patient_category: "Comfort",
current_health: 0,
recommend_discharge: false,
action: null,
actions: null,
review_interval: 0,
admitted_to: "",
taken_at: null,
Expand Down Expand Up @@ -268,7 +267,6 @@ export const DailyRounds = (props: any) => {
physical_examination_info: state.form.physical_examination_info,
other_details: state.form.other_details,
consultation: consultationId,
recommend_discharge: JSON.parse(state.form.recommend_discharge),
action: prevAction,
review_interval: Number(prevReviewInterval),
};
Expand Down
82 changes: 49 additions & 33 deletions src/Components/Patient/PatientInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,24 @@ import {
DISCHARGE_REASONS,
PATIENT_CATEGORIES,
RESPIRATORY_SUPPORT,
TELEMEDICINE_ACTIONS,
} from "../../Common/constants";
import { ConsultationModel, PatientCategory } from "../Facility/models";

import ABHAProfileModal from "../ABDM/ABHAProfileModal";
import Beds from "../Facility/Consultations/Beds";
import ButtonV2 from "../Common/components/ButtonV2";
import CareIcon from "../../CAREUI/icons/CareIcon";
import DialogModal from "../Common/Dialog";
import { Link } from "raviger";
import { useState } from "react";
import CareIcon from "../../CAREUI/icons/CareIcon";
import useConfig from "../../Common/hooks/useConfig";
import { getDimensionOrDash } from "../../Common/utils";
import dayjs from "../../Utils/dayjs";
import { formatDate, formatDateTime } from "../../Utils/utils.js";
import ABHAProfileModal from "../ABDM/ABHAProfileModal";
import LinkABHANumberModal from "../ABDM/LinkABHANumberModal";
import LinkCareContextModal from "../ABDM/LinkCareContextModal";
import DialogModal from "../Common/Dialog";
import ButtonV2 from "../Common/components/ButtonV2";
import Beds from "../Facility/Consultations/Beds";
import { PatientModel } from "./models";
import { getDimensionOrDash } from "../../Common/utils";
import useConfig from "../../Common/hooks/useConfig";
import { useState } from "react";
import { formatAge, formatDate, formatDateTime } from "../../Utils/utils.js";
import dayjs from "../../Utils/dayjs";

export default function PatientInfoCard(props: {
patient: PatientModel;
Expand Down Expand Up @@ -170,29 +171,44 @@ export default function PatientInfoCard(props: {
Discharged from CARE
</p>
)}
<p className="text-sm text-gray-900 sm:text-sm">
<span>{formatAge(patient.age, patient.date_of_birth, true)}</span>
<span className="mx-2"></span>
<span>{patient.gender}</span>
{consultation?.suggestion === "DC" && (
<>
<span className="mx-2"></span>
<span>
<CareIcon icon="l-estate" className="mr-1 text-gray-700" />
Domiciliary Care
</span>
</>
)}
{consultation?.is_readmission && (
<>
<span className="mx-2"></span>
<span>
<CareIcon icon="l-repeat" className="mr-1 text-gray-600" />
Readmitted
</span>
</>
)}
</p>
<div className="flex flex-col items-center gap-2 text-sm sm:flex-row lg:mt-4">
<div className="flex flex-col items-center gap-2 text-sm text-gray-900 sm:flex-row sm:text-sm">
{patient.action && patient.action != 10 && (
<div>
<div className="inline-flex w-full items-center justify-start rounded-lg border border-gray-500 bg-blue-700 p-1 px-3 text-xs font-semibold leading-4">
<span className="font-semibold text-white">
{" "}
{
TELEMEDICINE_ACTIONS.find(
(i) => i.id === patient.action
)?.desc
}
</span>
</div>
</div>
)}
<div>
<div className="inline-flex w-full items-center justify-start rounded-lg border border-gray-500 bg-gray-200 p-1 px-3 text-xs font-semibold leading-4">
<b>Age</b>: {patient.age} years
</div>
</div>
<div>
<div className="inline-flex w-full items-center justify-start rounded-lg border border-gray-500 bg-gray-200 p-1 px-3 text-xs font-semibold leading-4">
<b>Gender</b>: {patient.gender}
</div>
</div>
{consultation?.suggestion === "DC" && (
<div>
<div>
<div className="inline-flex w-full items-center justify-start rounded-lg border border-gray-500 bg-gray-200 p-1 px-3 text-xs font-semibold leading-4">
<span>Domiciliary Care</span>
<CareIcon className="care-l-estate text-base text-gray-700" />
</div>
</div>
</div>
)}
</div>
</div>
<div className="flex flex-col items-center gap-2 text-sm sm:flex-row lg:mt-4">
{[
["Blood Group", patient.blood_group, patient.blood_group],
Expand Down
1 change: 1 addition & 0 deletions src/Components/Patient/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface AbhaObject {
export interface PatientModel {
test_id?: string;
id?: string;
action?: number;
name?: string;
age?: number;
allow_transfer?: boolean;
Expand Down

0 comments on commit 560119e

Please sign in to comment.