Skip to content

Commit

Permalink
Added consent form to patient consultation (ohcnetwork#7461)
Browse files Browse the repository at this point in the history
* Added consent form to patient consultation

* reverted vite config

* added keys

* removed undefined titles

* disable on create

* fix vite

* updated as decided on call

* fixed dropdown

* fix

* fix page title

* reverted vite config change

* fix linting issue in constants file

* fix linting errors

---------

Co-authored-by: Mohammed Nihal <[email protected]>
Co-authored-by: khavinshankar <[email protected]>
  • Loading branch information
3 people authored Mar 28, 2024
1 parent b3263bd commit 36ec6a2
Show file tree
Hide file tree
Showing 9 changed files with 451 additions and 163 deletions.
15 changes: 15 additions & 0 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,21 @@ export const IN_LANDLINE_AREA_CODES = [
"891",
"4822",
];

export const CONSENT_TYPE_CHOICES = [
{ id: 1, text: "Consent for admission" },
{ id: 2, text: "Patient Code Status" },
{ id: 3, text: "Consent for procedure" },
{ id: 4, text: "High risk consent" },
{ id: 5, text: "Others" },
];

export const CONSENT_PATIENT_CODE_STATUS_CHOICES = [
{ id: 1, text: "Do Not Hospitalise (DNH)" },
{ id: 2, text: "Do Not Resuscitate (DNR)" },
{ id: 3, text: "Comfort Care Only" },
{ id: 4, text: "Active treatment (Default)" },
];
export const OCCUPATION_TYPES = [
{ id: 1, text: "Student", value: "STUDENT" },
{
Expand Down
4 changes: 3 additions & 1 deletion src/Components/Common/PageTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface PageTitleProps {
};
focusOnLoad?: boolean;
isInsidePage?: boolean;
changePageMetadata?: boolean;
}

export default function PageTitle({
Expand All @@ -40,6 +41,7 @@ export default function PageTitle({
justifyContents = "justify-start",
focusOnLoad = false,
isInsidePage = false,
changePageMetadata = true,
}: PageTitleProps) {
const divRef = useRef<any>();

Expand All @@ -56,7 +58,7 @@ export default function PageTitle({
ref={divRef}
className={isInsidePage ? "" : `mb-2 pt-4 md:mb-4 ${className}`}
>
<PageHeadTitle title={title} />
{changePageMetadata && <PageHeadTitle title={title} />}
<div className={classNames("flex items-center", justifyContents)}>
<div className="flex items-center">
{!hideBack && (
Expand Down
2 changes: 2 additions & 0 deletions src/Components/Common/components/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { SidebarShrinkContext } from "../Sidebar/Sidebar";
interface PageProps extends PageTitleProps {
children: React.ReactNode | React.ReactNode[];
options?: React.ReactNode | React.ReactNode[];
changePageMetadata?: boolean;
className?: string;
noImplicitPadding?: boolean;
ref?: RefObject<HTMLDivElement>;
Expand Down Expand Up @@ -39,6 +40,7 @@ export default function Page(props: PageProps) {
<div className={classNames(padding, props.className)} ref={props.ref}>
<div className="flex flex-col justify-between gap-2 md:flex-row md:items-center md:gap-6">
<PageTitle
changePageMetadata={props.changePageMetadata}
title={props.title}
breadcrumbs={props.breadcrumbs}
backUrl={props.backUrl}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function AddICD11Diagnosis(props: AddICD11DiagnosisProps) {
const { t } = useTranslation();
const [selected, setSelected] = useState<ICD11DiagnosisModel>();
const [adding, setAdding] = useState(false);
const hasError = !!props.disallowed.find((d) => d.id === selected?.id);
const hasError = !!props.disallowed.find((d) => d?.id === selected?.id);

const { fetchOptions, isLoading, options } =
useAsyncOptions<ICD11DiagnosisModel>("id");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ import { BedModel } from "../models";
import HL7PatientVitalsMonitor from "../../VitalsMonitor/HL7PatientVitalsMonitor";
import VentilatorPatientVitalsMonitor from "../../VitalsMonitor/VentilatorPatientVitalsMonitor";
import useVitalsAspectRatioConfig from "../../VitalsMonitor/useVitalsAspectRatioConfig";
import { DISCHARGE_REASONS, SYMPTOM_CHOICES } from "../../../Common/constants";
import {
CONSENT_PATIENT_CODE_STATUS_CHOICES,
CONSENT_TYPE_CHOICES,
DISCHARGE_REASONS,
SYMPTOM_CHOICES,
} from "../../../Common/constants";
import PrescriptionsTable from "../../Medicine/PrescriptionsTable";
import Chip from "../../../CAREUI/display/Chip";
import { formatAge, formatDate, formatDateTime } from "../../../Utils/utils";
Expand All @@ -16,6 +21,7 @@ import DailyRoundsList from "../Consultations/DailyRoundsList";
import EventsList from "./Events/EventsList";
import SwitchTabs from "../../Common/components/SwitchTabs";
import { getVitalsMonitorSocketUrl } from "../../VitalsMonitor/utils";
import { FileUpload } from "../../Patient/FileUpload";

const PageTitle = lazy(() => import("../../Common/PageTitle"));

Expand Down Expand Up @@ -669,6 +675,46 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
</div>
</div>
</div>
{(
props.consultationData.consent_records?.filter(
(record) => record.deleted !== true
) || []
).length > 0 && (
<>
<div className="col-span-1 overflow-hidden rounded-lg bg-white p-4 shadow md:col-span-2">
<h3 className="text-lg font-semibold leading-relaxed text-gray-900">
Consent Records
</h3>
{props.consultationData.consent_records
?.filter((record) => record.deleted !== true)
?.map((record, i) => (
<div className="mt-4 border-b" key={i}>
<div className="font-bold">
{
CONSENT_TYPE_CHOICES.find(
(c) => c.id === record.type
)?.text
}{" "}
{record.patient_code_status &&
`( ${
CONSENT_PATIENT_CODE_STATUS_CHOICES.find(
(c) => c.id === record.patient_code_status
)?.text
} )`}
</div>
<FileUpload
type="CONSENT_RECORD"
hideBack
unspecified
className="w-full"
consentId={record.id}
hideUpload
/>
</div>
))}
</div>
</>
)}
</div>
</div>
<div className="w-full pl-0 md:pl-4 xl:w-1/3">
Expand Down
Loading

0 comments on commit 36ec6a2

Please sign in to comment.