Skip to content

Commit

Permalink
Patient Registration: Adds social profile section (#8570)
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad authored Sep 19, 2024
1 parent af014a1 commit 471b2f5
Show file tree
Hide file tree
Showing 12 changed files with 196 additions and 270 deletions.
4 changes: 4 additions & 0 deletions cypress/e2e/patient_spec/PatientRegistration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ describe("Patient Creation with consultation", () => {
facilityPage.selectLocalBody(patientOneLocalbody);
facilityPage.selectWard(patientOneWard);
patientPage.selectPatientOccupation(patientOccupation);
patientPage.selectSocioeconomicStatus("MIDDLE_CLASS");
patientPage.selectDomesticHealthcareSupport("FAMILY_MEMBER");
// Patient Medical History
patientMedicalHistory.typePatientPresentHealth(patientOnePresentHealth);
patientMedicalHistory.typePatientOngoingMedication(
Expand Down Expand Up @@ -130,6 +132,8 @@ describe("Patient Creation with consultation", () => {
yearOfBirth,
patientOneBloodGroup,
patientOccupation,
"Middle Class",
"Family member",
);
patientMedicalHistory.verifyPatientMedicalDetails(
patientOnePresentHealth,
Expand Down
149 changes: 0 additions & 149 deletions cypress/e2e/users_spec/user_manage.cy.ts

This file was deleted.

82 changes: 0 additions & 82 deletions cypress/e2e/users_spec/user_profile.cy.ts

This file was deleted.

13 changes: 13 additions & 0 deletions cypress/pageobject/Patient/PatientCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ export class PatientPage {
cy.searchAndSelectOption("#occupation", occupation);
}

selectSocioeconomicStatus(value: string) {
cy.selectRadioOption("socioeconomic_status", value);
}

selectDomesticHealthcareSupport(value: string) {
cy.selectRadioOption("domestic_healthcare_support", value);
}

clickCreatePatient() {
cy.intercept("POST", "**/api/v1/patient/").as("createPatient");
cy.get("button[data-testid='submit-button']").click();
Expand Down Expand Up @@ -165,6 +173,8 @@ export class PatientPage {
yearOfBirth,
bloodGroup,
occupation,
socioeconomicStatus = null,
domesticHealthcareSupport = null,
isAntenatal = false,
isPostPartum = false,
) {
Expand All @@ -178,6 +188,9 @@ export class PatientPage {
expect($dashboard).to.contain(yearOfBirth);
expect($dashboard).to.contain(bloodGroup);
expect($dashboard).to.contain(occupation);
socioeconomicStatus && expect($dashboard).to.contain(socioeconomicStatus);
domesticHealthcareSupport &&
expect($dashboard).to.contain(domesticHealthcareSupport);

if (isAntenatal) {
expect($dashboard).to.contain("Antenatal");
Expand Down
4 changes: 4 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ Cypress.Commands.add(
},
);

Cypress.Commands.add("selectRadioOption", (name: string, value: string) => {
cy.get(`input[type='radio'][name='${name}'][value=${value}]`).click();
});

Cypress.Commands.add("clickAndTypeDate", (selector: string, date: string) => {
cy.get(selector).scrollIntoView();
cy.get(selector).click();
Expand Down
1 change: 1 addition & 0 deletions cypress/support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ declare global {
selector: string,
symptoms: string | string[],
): Chainable<Element>;
selectRadioOption(name: string, value: string): Chainable<Element>;
typeAndMultiSelectOption(
selector: string,
input: string,
Expand Down
14 changes: 14 additions & 0 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,20 @@ export const CONSENT_PATIENT_CODE_STATUS_CHOICES = [
{ id: 3, text: "Comfort Care Only" },
{ id: 4, text: "Active treatment" },
];

export const SOCIOECONOMIC_STATUS_CHOICES = [
"MIDDLE_CLASS",
"POOR",
"VERY_POOR",
"WELL_OFF",
] as const;

export const DOMESTIC_HEALTHCARE_SUPPORT_CHOICES = [
"FAMILY_MEMBER",
"PAID_CAREGIVER",
"NO_SUPPORT",
] as const;

export const OCCUPATION_TYPES = [
{
id: 27,
Expand Down
54 changes: 40 additions & 14 deletions src/Components/Patient/PatientHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -515,24 +515,50 @@ export const PatientHome = (props: any) => {
</div>
</div>
)}
<div className="sm:col-span-1">
<div className="text-sm font-semibold leading-5 text-zinc-400">
Occupation
{patientData.meta_info?.occupation && (
<div className="sm:col-span-1">
<div className="text-sm font-semibold leading-5 text-zinc-400">
{t("occupation")}
</div>
<div className="mt-1 text-sm font-medium leading-5">
{parseOccupation(patientData.meta_info.occupation)}
</div>
</div>
<div className="mt-1 text-sm font-medium leading-5">
{parseOccupation(patientData.meta_info?.occupation) || "-"}
)}
{patientData.ration_card_category && (
<div className="sm:col-span-1">
<div className="text-sm font-semibold leading-5 text-zinc-400">
{t("ration_card_category")}
</div>
<div className="mt-1 text-sm font-medium leading-5">
{t(`ration_card__${patientData.ration_card_category}`)}
</div>
</div>
</div>
<div className="sm:col-span-1">
<div className="text-sm font-semibold leading-5 text-zinc-400">
Ration Card Category
)}
{patientData.meta_info?.socioeconomic_status && (
<div className="sm:col-span-1">
<div className="text-sm font-semibold leading-5 text-zinc-400">
{t("socioeconomic_status")}
</div>
<div className="mt-1 text-sm font-medium leading-5">
{t(
`SOCIOECONOMIC_STATUS__${patientData.meta_info.socioeconomic_status}`,
)}
</div>
</div>
<div className="mt-1 text-sm font-medium leading-5">
{patientData.ration_card_category
? t(`ration_card__${patientData.ration_card_category}`)
: "-"}
)}
{patientData.meta_info?.domestic_healthcare_support && (
<div className="sm:col-span-1">
<div className="text-sm font-semibold leading-5 text-zinc-400">
{t("domestic_healthcare_support")}
</div>
<div className="mt-1 text-sm font-medium leading-5">
{t(
`DOMESTIC_HEALTHCARE_SUPPORT__${patientData.meta_info.domestic_healthcare_support}`,
)}
</div>
</div>
</div>
)}
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 471b2f5

Please sign in to comment.