Skip to content

Commit

Permalink
refactor patient_consultation
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Oct 17, 2023
1 parent 8a67ea5 commit 8be51d1
Show file tree
Hide file tree
Showing 6 changed files with 474 additions and 303 deletions.
4 changes: 2 additions & 2 deletions cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class PatientConsultationPage {
selectConsultationStatus(status: string) {
cy.get("#consultation_status")
cy.get("#route_to_facility")
.click()
.then(() => {
cy.get("[role='option']").contains(status).click();
Expand Down Expand Up @@ -61,7 +61,7 @@ export class PatientConsultationPage {
.click();

cy.get("#consultation_notes").click().type(consulationNotes);
cy.get("#verified_by")
cy.get("#treating_physician")
.click()
.type(verificationBy)
.then(() => {
Expand Down
8 changes: 0 additions & 8 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,6 @@ export const CONSULTATION_SUGGESTION = [
{ id: "DD", text: "Declare Death" },
];

export const CONSULTATION_STATUS = [
{ id: "1", text: "Brought Dead" },
{ id: "2", text: "Transferred from ward" },
{ id: "3", text: "Transferred from ICU" },
{ id: "4", text: "Referred from other hospital" },
{ id: "5", text: "Out-patient (walk in)" },
];

export const ADMITTED_TO = [
{ id: "1", text: "Isolation" },
{ id: "2", text: "ICU" },
Expand Down
31 changes: 31 additions & 0 deletions src/Components/Common/RouteToFacilitySelect.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { SelectFormField } from "../Form/FormFields/SelectFormField";
import {
FormFieldBaseProps,
useFormFieldPropsResolver,
} from "../Form/FormFields/Utils";

export const ROUTE_TO_FACILITY_OPTIONS = {
10: "Outpatient/Emergency Room",
20: "Referred from another facility",
30: "Internal Transfer within the facility",
};

export type RouteToFacility = keyof typeof ROUTE_TO_FACILITY_OPTIONS;

export const keys = Object.keys(ROUTE_TO_FACILITY_OPTIONS).map((key) =>
parseInt(key)
) as RouteToFacility[];

type Props = FormFieldBaseProps<keyof typeof ROUTE_TO_FACILITY_OPTIONS>;

export default function RouteToFacilitySelect(props: Props) {
const field = useFormFieldPropsResolver(props as any);

return (
<SelectFormField
{...field}
options={keys}
optionLabel={(key) => ROUTE_TO_FACILITY_OPTIONS[key]}
/>
);
}
6 changes: 3 additions & 3 deletions src/Components/Facility/ConsultationDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,14 @@ export const ConsultationDetails = (props: any) => {
label="Diagnosis (as per ICD-11 recommended by WHO)"
/>

{(consultationData.verified_by_object ||
{(consultationData.treating_physician_object ||
consultationData.deprecated_verified_by) && (
<div className="mt-2 text-sm">
<span className="font-semibold leading-relaxed">
Treating Physician:{" "}
</span>
{consultationData.verified_by_object
? `${consultationData.verified_by_object.first_name} ${consultationData.verified_by_object.last_name}`
{consultationData.treating_physician_object
? `${consultationData.treating_physician_object.first_name} ${consultationData.treating_physician_object.last_name}`
: consultationData.deprecated_verified_by}
<i className="fas fa-check ml-2 fill-current text-lg text-green-500"></i>
</div>
Expand Down
Loading

0 comments on commit 8be51d1

Please sign in to comment.