Skip to content

Commit

Permalink
add new medical hsitory fields
Browse files Browse the repository at this point in the history
  • Loading branch information
AshrafMd-1 committed May 17, 2024
1 parent aa6d33f commit 04e1c35
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 8 deletions.
32 changes: 28 additions & 4 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const LocalStorageKeys = {
accessToken: "care_access_token",
refreshToken: "care_refresh_token",
};

export interface OptionsType {
id: number | string;
text: string;
Expand Down Expand Up @@ -286,15 +287,38 @@ export const DOCTOR_SPECIALIZATION: Array<OptionsType> = [
{ id: 5, text: "Others" },
];

export const CANCER_HISTORY_CHOICES: Array<OptionsType> = [
{ id: 1, text: "Breast" },
{ id: 2, text: "Lung" },
{ id: 3, text: "Skin" },
{ id: 4, text: "Colorectal" },
{ id: 5, text: "Uterus" },
{ id: 6, text: "Leukaemia" },
{ id: 7, text: "Bladder" },
{ id: 8, text: "Prostate" },
{ id: 9, text: "Melanoma" },
{ id: 10, text: "Lymphoma" },
{ id: 11, text: "Brain" },
{ id: 12, text: "Liver" },
{ id: 13, text: "Thyroid" },
{ id: 14, text: "Others" },
];

export const MEDICAL_HISTORY_CHOICES: Array<OptionsType> = [
{ id: 1, text: "NO" },
{ id: 2, text: "Diabetes" },
{ id: 3, text: "Heart Disease" },
{ id: 4, text: "HyperTension" },
{ id: 5, text: "Kidney Diseases" },
{ id: 6, text: "Lung Diseases/Asthma" },
{ id: 7, text: "Cancer" },
{ id: 8, text: "OTHER" },
{ id: 5, text: "Chronic Renal Disease" },
{ id: 6, text: "Asthma" },
{ id: 7, text: "COPD" },
{ id: 8, text: "Bronchitis" },
{ id: 9, text: "Chronic Neurological Or Neuromuscular Disease" },
{ id: 10, text: "Immunocompromised Condition" },
{ id: 11, text: "TB" },
{ id: 12, text: "Other Chronic Lung Diseases" },
{ id: 13, text: "Cancer" },
{ id: 14, text: "OTHER" },
];

export const REVIEW_AT_CHOICES: Array<OptionsType> = [
Expand Down
63 changes: 59 additions & 4 deletions src/Components/Patient/PatientRegister.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as Notification from "../../Utils/Notifications.js";

import {
BLOOD_GROUPS,
CANCER_HISTORY_CHOICES,
DISEASE_STATUS,
GENDER_TYPES,
MEDICAL_HISTORY_CHOICES,
Expand Down Expand Up @@ -79,6 +80,7 @@ interface medicalHistoryModel {
id?: number;
disease: string | number;
details: string;
extra_info?: object;
}

const medicalHistoryChoices = MEDICAL_HISTORY_CHOICES.reduce(
Expand Down Expand Up @@ -765,10 +767,29 @@ export const PatientRegister = (props: PatientRegisterProps) => {
const medData = MEDICAL_HISTORY_CHOICES.find((i) => i.id === id);
if (medData) {
const details = formData[`medical_history_${medData.id}`];
medical_history.push({
disease: medData.text,
details: details ? details : "",
});
if (medData.id === 11) {
medical_history.push({
disease: medData.text,
details: details ? details : "",
extra_info: {
tb_status: formData["tb_status"] ?? "",
tb_duration: formData["tb_duration"] ?? "",
},
});
} else if (medData.id === 13) {
medical_history.push({
disease: medData.text,
details: details ? details : "",
extra_info: {
cancer_type: formData["cancer_type"] ?? "",
},
});
} else {
medical_history.push({
disease: medData.text,
details: details ? details : "",
});
}
}
});
const data = {
Expand Down Expand Up @@ -1080,6 +1101,40 @@ export const PatientRegister = (props: PatientRegisterProps) => {
label={id !== 1 ? title : "NONE"}
/>
</div>
{/* TB */}
{id === 11 && (field("medical_history").value ?? []).includes(id) && (
<div>
<SelectFormField
{...field("tb_status")}
position="above"
label=""
required
options={["Active", "Old"]}
optionLabel={(o: any) => o}
optionValue={(o: any) => o}
/>
<TextFormField
{...field("tb_duration")}
placeholder="Duration"
min={0}
type={"number"}
/>
</div>
)}
{/* Cancer */}
{id === 13 && (field("medical_history").value ?? []).includes(id) && (
<div className="mx-4">
<SelectFormField
{...field("cancer_type")}
position="above"
label=""
required
options={CANCER_HISTORY_CHOICES.map((i) => i.text)}
optionLabel={(o: any) => o}
optionValue={(o: any) => o}
/>
</div>
)}
{id !== 1 && (field("medical_history").value ?? []).includes(id) && (
<div className="mx-4">
<TextAreaFormField
Expand Down

0 comments on commit 04e1c35

Please sign in to comment.