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

Expanding medical history [ Comorbidities ] #7852

Closed
wants to merge 16 commits into from
Closed
33 changes: 29 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,39 @@ 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: "Liver Disease" },
{ id: 12, text: "TB" },
{ id: 13, text: "Other Chronic Lung Diseases" },
{ id: 14, text: "Cancer" },
{ id: 15, text: "OTHER" },
AshrafMd-1 marked this conversation as resolved.
Show resolved Hide resolved
];

export const REVIEW_AT_CHOICES: Array<OptionsType> = [
Expand Down
10 changes: 10 additions & 0 deletions src/Components/Patient/PatientHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,16 @@ export const PatientHome = (props: any) => {
<div className="sm:col-span-1" key={`med_his_${idx}`}>
<div className="break-words text-sm font-semibold leading-5 text-zinc-400">
{item.disease}
{item.disease === "Cancer" && item.type && (
<span className="text-sm font-semibold leading-5 text-zinc-400">
{` [ ${item.type} ]`}
</span>
)}
{item.disease === "TB" && (item.duration || item.status) && (
<span className="text-sm font-semibold leading-5 text-zinc-400">
{` [ ${item.status} - ${item.duration} ]`}
</span>
)}
</div>
<div className="mt-1 whitespace-normal break-words text-sm font-medium leading-5">
{item.details}
Expand Down
76 changes: 72 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,
GENDER_TYPES,
MEDICAL_HISTORY_CHOICES,
OCCUPATION_TYPES,
Expand Down Expand Up @@ -77,6 +78,9 @@ interface medicalHistoryModel {
id?: number;
disease: string | number;
details: string;
duration?: number;
status?: string;
type?: string;
}

const medicalHistoryChoices = MEDICAL_HISTORY_CHOICES.reduce(
Expand Down Expand Up @@ -435,6 +439,12 @@ export const PatientRegister = (props: PatientRegisterProps) => {
formData.medical_history.push(Number(medicalHistory.id));
(formData as any)[`medical_history_${medicalHistory.id}`] =
i.details;
if (medicalHistory.id === 12) {
(formData as any)["tb_status"] = i.status;
(formData as any)["tb_duration"] = i.duration;
} else if (medicalHistory.id === 14) {
(formData as any)["cancer_type"] = i.type;
AshrafMd-1 marked this conversation as resolved.
Show resolved Hide resolved
}
}
},
);
Expand Down Expand Up @@ -665,10 +675,25 @@ 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 === 12) {
medical_history.push({
disease: medData.text,
details: details ? details : "",
status: formData["tb_status"] ?? undefined,
duration: Number(formData["tb_duration"]) ?? undefined,
});
} else if (medData.id === 14) {
medical_history.push({
disease: medData.text,
details: details ? details : "",
type: formData["cancer_type"] ?? undefined,
});
} else {
medical_history.push({
disease: medData.text,
details: details ? details : "",
});
}
AshrafMd-1 marked this conversation as resolved.
Show resolved Hide resolved
}
});
const data = {
Expand Down Expand Up @@ -937,6 +962,17 @@ export const PatientRegister = (props: PatientRegisterProps) => {
const renderMedicalHistory = (id: number, title: string, field: any) => {
const checkboxField = `medical_history_check_${id}`;
const textField = `medical_history_${id}`;
const filteredCancerHistoryChoices = CANCER_HISTORY_CHOICES.filter((i) => {
const gender = field("gender").value;
if (gender === 1) {
return i.id !== 1 && i.id !== 5;
} else if (gender === 2) {
return i.id !== 8;
} else {
return true;
}
AshrafMd-1 marked this conversation as resolved.
Show resolved Hide resolved
}).map((i) => i.text);

return (
<div key={textField}>
<div>
Expand All @@ -947,6 +983,38 @@ export const PatientRegister = (props: PatientRegisterProps) => {
label={id !== 1 ? title : "NONE"}
/>
</div>
{/* TB */}
{id === 12 && (field("medical_history").value ?? []).includes(id) && (
<div>
<SelectFormField
{...field("tb_status")}
position="above"
placeholder={"Status"}
options={["Active", "Old"]}
optionLabel={(o: any) => o}
optionValue={(o: any) => o}
AshrafMd-1 marked this conversation as resolved.
Show resolved Hide resolved
/>
<TextFormField
{...field("tb_duration")}
placeholder="Duration"
min={0}
type={"number"}
/>
</div>
)}
{/* Cancer */}
{id === 14 && (field("medical_history").value ?? []).includes(id) && (
<div className="mx-4">
<SelectFormField
{...field("cancer_type")}
position="above"
placeholder="Cancer Type"
options={filteredCancerHistoryChoices}
optionLabel={(o) => o}
optionValue={(o) => o}
/>
</div>
)}
{id !== 1 && (field("medical_history").value ?? []).includes(id) && (
<div className="mx-4">
<TextAreaFormField
Expand Down
10 changes: 9 additions & 1 deletion src/Components/Patient/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ export interface AssignedToObjectModel {
user_type: string;
}

export interface MedicalHistoryModel {
disease: string | number;
details: string;
type?: string;
duration?: number;
status?: string;
}

export interface AbhaObject {
id: number;
created_date: string;
Expand Down Expand Up @@ -61,7 +69,7 @@ export interface PatientModel {
phone_number?: string;
emergency_phone_number?: string;
allergies?: string;
medical_history?: Array<{ disease: string | number; details: string }>;
medical_history?: Array<MedicalHistoryModel>;
facility_object?: {
id: number;
name: string;
Expand Down
Loading