Skip to content

Commit

Permalink
Patient Consultation: Route to Facility πŸ₯, Admission Date & Time πŸ•š (#…
Browse files Browse the repository at this point in the history
…6458)

* `formatDateTime`: hide time if 12AM

* refactor patient_consultation

* Changes based on QA

* microsecond accuracy

* cypress fix

* fix cypress
  • Loading branch information
rithviknishad authored Nov 22, 2023
1 parent f4275e5 commit c1c4e56
Show file tree
Hide file tree
Showing 10 changed files with 490 additions and 363 deletions.
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

0 comments on commit c1c4e56

Please sign in to comment.