Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patient Consultation: Route to Facility 🏥, Admission Date & Time 🕚 #6458

Merged
merged 12 commits into from
Nov 22, 2023
7 changes: 3 additions & 4 deletions cypress/e2e/patient_spec/patient_crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ describe("Patient Creation with consultation", () => {
updatePatientPage.visitConsultationPage();
patientPage.verifyStatusCode();
patientConsultationPage.fillIllnessHistory("history");
patientConsultationPage.selectConsultationStatus("Out-patient (walk in)");
patientConsultationPage.selectConsultationStatus(
"Outpatient/Emergency Room"
);
patientConsultationPage.selectSymptoms("ASYMPTOMATIC");

patientConsultationPage.enterConsultationDetails(
Expand Down Expand Up @@ -140,9 +142,6 @@ describe("Patient Creation with consultation", () => {
updatePatientPage.visitUpdatedPatient();
patientConsultationPage.visitEditConsultationPage();
patientConsultationPage.fillIllnessHistory("editted");
patientConsultationPage.selectConsultationStatus(
"Referred from other hospital"
);
patientConsultationPage.updateSymptoms("FEVER");
patientConsultationPage.setSymptomsDate("01082023");
patientConsultationPage.updateConsultation();
Expand Down
8 changes: 4 additions & 4 deletions cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export class PatientConsultationPage {
selectConsultationStatus(status: string) {
cy.get("#consultation_status").scrollIntoView();
cy.get("#consultation_status").should("be.visible");
cy.get("#consultation_status")
cy.get("#route_to_facility").scrollIntoView();
cy.get("#route_to_facility").should("be.visible");
cy.get("#route_to_facility")
.click()
.then(() => {
cy.get("[role='option']").contains(status).click();
Expand Down Expand Up @@ -60,7 +60,7 @@ export class PatientConsultationPage {
cy.get("#principal-diagnosis-select [role='option']").first().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 @@ -434,14 +434,14 @@ export const ConsultationDetails = (props: any) => {
diagnoses={consultationData.diagnoses || []}
/>

{(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
Loading