From bdbe3002ed3015b2c756d64aab9e465b7a0d7748 Mon Sep 17 00:00:00 2001 From: sonika <> Date: Fri, 15 Sep 2023 09:29:06 +0530 Subject: [PATCH] type cleanup --- src/Components/Helper/AddNewTable.tsx | 16 +- src/Components/Interface/Patient.tsx | 110 ++++++++- .../PatientForm/FamilyInformationSection.tsx | 48 +--- .../PatientForm/MedicalHistorySection.tsx | 45 +--- .../PatientForm/OtherDetailsSection.tsx | 37 +-- .../PatientForm/PainAnalysisSection.tsx | 44 +--- src/Components/PatientForm/PastTreatment.tsx | 48 +--- src/Components/PatientForm/PatientForm.tsx | 222 ++---------------- .../PersonalInformationSection.tsx | 6 +- .../RecreationalHobbiesSection.tsx | 66 +----- .../PatientForm/SyestemReviewSection.tsx | 63 +---- 11 files changed, 163 insertions(+), 542 deletions(-) diff --git a/src/Components/Helper/AddNewTable.tsx b/src/Components/Helper/AddNewTable.tsx index b1dd1bc..af418f6 100644 --- a/src/Components/Helper/AddNewTable.tsx +++ b/src/Components/Helper/AddNewTable.tsx @@ -13,6 +13,7 @@ import { FormControl, } from '@mui/material'; import * as React from 'react'; +import { PastTreatmentInterface } from '../Interface/Patient'; interface RowData { date: string; @@ -27,20 +28,7 @@ interface DataTableProps { } type Props = { - handlePastTreatmentFormData: ( - generalHealth: string | undefined, - presentProblemBefore: string | undefined, - ifYespresentProblemBefore: string | undefined, - ifYestreatmentProvided: string | undefined, - ifYesOutcome: string | undefined, - strokeBloodclotting: string | undefined, - ifYesstrokeBloodclotting: string | undefined, - dizzinessFetigue: string | undefined, - ifyesdizzinessFetigue: string | undefined, - antiColligent: string | undefined, - injuriesHospitalization: string | undefined, - supplementsOrDrugs: string | undefined - ) => void; + handlePastTreatmentFormData: (patient:PastTreatmentInterface) => void; patientDataDiplay: any; type: string; }; diff --git a/src/Components/Interface/Patient.tsx b/src/Components/Interface/Patient.tsx index a566837..e171d83 100644 --- a/src/Components/Interface/Patient.tsx +++ b/src/Components/Interface/Patient.tsx @@ -1,4 +1,4 @@ -export interface Patient { +export interface PersonalInformationInterface { fullName: string; homePhone: string; cellPhone: string; @@ -12,3 +12,111 @@ export interface Patient { zipCode: string; gender: string; } + +export interface FamilyInformationInterface { + maritalStatus: string | undefined; + numberOfChildren: string | undefined; + occupation: string | undefined; + hoursPerWeek: number | string | undefined; + employer: string | undefined; + businessPhone: string | undefined; + spouseName: string | undefined; + spouseEmployer: string | undefined; + spouseBusinessPhone: string | undefined; + emergencyContact: string | undefined; + relationship: string | undefined; + spousePhone: string | undefined; +} + +export interface MedicalHistoryInterface { + physicianname: string |undefined; + physiciancity: string |undefined; + physicianstate: string |undefined; + physicianphone: string |undefined; + chiropractorName: string |undefined; + chiropractorState: string |undefined; + xray: string|undefined; + haveChiropractor: string|undefined; + reference: string|undefined; + visitDetails: string |undefined; + cellPhoneProvider: string |undefined; +} + +export interface InjuryDetailsInterface { + chiefComplaint: string; + painWorse: string[]; + painBetter: string[]; + painQuality: string[]; + painWorstTime: string[]; + currentComplaintIssues: string[]; + painDuration: string; + currentTreatment: string; + treatmentGoal: string; + selfTreatment: string; +} + +export interface PastTreatmentInterface { + generalHealth: string; + presentProblemBefore: string; + ifYespresentProblemBefore: string; + ifYestreatmentProvided: string; + ifYesOutcome: string; + strokeBloodclotting: string; + ifYesstrokeBloodclotting: string; + dizzinessFetigue: string; + ifyesdizzinessFetigue: string; + antiColligent: string; + injuriesHospitalization: string; + supplementsOrDrugs: string; +} + +export interface SystemReviewInterface { + eyes: string; + IntestinesBowls: string; + jointsBones: string; + allergies: string; + earsNoseMouth: string; + urinary: string; + skin: string; + psychological: string; + heart: string; + muscles: string; + internalOrgans: string; + gynecological: string; + lungsBreathing: string; + nerves: string; + blood: string; + prostate: string; + explanation: string; +} + +export interface RecreationalHobbieInterface { + hobbies: string; + educationLevel: string; + excercise: string; + excerciseExplanation: string; + tobacco: string; + tobaccoExplanation: string; + alcohol: string; + alcoholExplanation: string; + healthyDiet: string; + healthyDietExplanation: string; + sleep: string; + sleepExplanation: string; + workSchool: string; + workSchoolExplanation: string; + familyLife: string; + familyLifeExplanation: string; + drugs: string; + drugsExplanation:string; +} + +export interface OtherDetailsInterface { + familyHistory: string; + sleep: string; + pillow: string; + orthotics: string; + brestExam: any; + pregnancy: string; + menstralCycle: any; +} diff --git a/src/Components/PatientForm/FamilyInformationSection.tsx b/src/Components/PatientForm/FamilyInformationSection.tsx index 9fcc665..c4feb69 100644 --- a/src/Components/PatientForm/FamilyInformationSection.tsx +++ b/src/Components/PatientForm/FamilyInformationSection.tsx @@ -15,37 +15,10 @@ import { useFormik } from 'formik'; import * as yup from 'yup'; import { LocalizationProvider, DatePicker } from '@mui/x-date-pickers'; import React, { useEffect } from 'react'; - -interface Patient { - maritalStatus: string | undefined; - numberOfChildren: string | undefined; - occupation: string | undefined; - hoursPerWeek: number | string | undefined; - employer: string | undefined; - businessPhone: string | undefined; - spouseName: string | undefined; - spouseEmployer: string | undefined; - spouseBusinessPhone: string | undefined; - emergencyContact: string | undefined; - relationship: string | undefined; - spousePhone: string | undefined; -} +import { FamilyInformationInterface } from '../Interface/Patient'; type Props = { - handleFamilyInformationFormData: ( - maritalStatus: string | undefined, - numberOfChildren: string | undefined, - occupation: string | undefined, - hoursPerWeek: number | string | undefined, - employer: string | undefined, - businessPhone: string | undefined, - spouseName: string | undefined, - spouseEmployer: string | undefined, - spouseBusinessPhone: string | undefined, - emergencyContact: string | undefined, - relationship: string | undefined, - spousePhone: string | undefined - ) => void; + handleFamilyInformationFormData: (patient:FamilyInformationInterface ) => void; patientDataDiplay: any; type: string; }; @@ -55,7 +28,7 @@ export default function FamilyInformationForm({ patientDataDiplay, type, }: Props) { - const [patient, setPatient] = React.useState({ + const [patient, setPatient] = React.useState({ maritalStatus: '', numberOfChildren: '', occupation: '', @@ -71,20 +44,7 @@ export default function FamilyInformationForm({ }); useEffect(() => { - handleFamilyInformationFormData( - patient.maritalStatus, - patient.numberOfChildren, - patient.occupation, - patient.hoursPerWeek, - patient.employer, - patient.businessPhone, - patient.spouseName, - patient.spouseEmployer, - patient.spouseBusinessPhone, - patient.emergencyContact, - patient.relationship, - patient.spousePhone - ); + handleFamilyInformationFormData(patient); }, [patient]); return ( diff --git a/src/Components/PatientForm/MedicalHistorySection.tsx b/src/Components/PatientForm/MedicalHistorySection.tsx index 0c58104..433d0f6 100644 --- a/src/Components/PatientForm/MedicalHistorySection.tsx +++ b/src/Components/PatientForm/MedicalHistorySection.tsx @@ -3,42 +3,17 @@ import { Checkbox, FormControlLabel, TextField, FormGroup, Grid, FormControl, Fo import { useFormik } from 'formik'; import * as Yup from 'yup'; import { useEffect } from 'react'; - -interface Patient { - physicianname: string |undefined; - physiciancity: string |undefined; - physicianstate: string |undefined; - physicianphone: string |undefined; - chiropractorName: string |undefined; - chiropractorState: string |undefined; - xray: string|undefined; - haveChiropractor: string|undefined; - reference: string|undefined; - visitDetails: string |undefined; - cellPhoneProvider: string |undefined; -} +import { MedicalHistoryInterface } from '../Interface/Patient'; type Props = { - handleMedicalHistoryFormData:( - physicianname?: string |undefined, - physiciancity?: string |undefined, - physicianstate?: string |undefined, - physicianphone?: string |undefined, - chiropractorName?: string |undefined, - chiropractorState?: string |undefined, - xray?: string|undefined, - haveChiropractor?: string|undefined, - reference?: string|undefined, - visitDetails?: string |undefined, - cellPhoneProvider?: string |undefined, - )=> void + handleMedicalHistoryFormData:(patient:MedicalHistoryInterface)=> void patientDataDiplay:any; type:string; } export default function MedicalHistoryForm({handleMedicalHistoryFormData,patientDataDiplay,type}:Props){ - const [patient, setPatient] = React.useState({ + const [patient, setPatient] = React.useState({ physicianname: '', physiciancity: '', physicianstate: '', @@ -53,19 +28,7 @@ export default function MedicalHistoryForm({handleMedicalHistoryFormData,patient }); useEffect(()=>{ - handleMedicalHistoryFormData( - patient.physicianname, - patient.physiciancity, - patient.physicianstate, - patient.physicianphone, - patient.chiropractorName, - patient.chiropractorState, - patient.xray, - patient.haveChiropractor, - patient.reference, - patient.visitDetails, - patient.cellPhoneProvider, - ) + handleMedicalHistoryFormData(patient) },[patient]) return( diff --git a/src/Components/PatientForm/OtherDetailsSection.tsx b/src/Components/PatientForm/OtherDetailsSection.tsx index 2566523..a0efb76 100644 --- a/src/Components/PatientForm/OtherDetailsSection.tsx +++ b/src/Components/PatientForm/OtherDetailsSection.tsx @@ -11,27 +11,10 @@ import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; import React, { useEffect } from 'react'; import { LocalizationProvider, DatePicker } from '@mui/x-date-pickers'; import dayjs from 'dayjs'; - -interface Patient { - familyHistory: string; - sleep: string; - pillow: string; - orthotics: string; - brestExam: any; - pregnancy: string; - menstralCycle: any; -} +import { OtherDetailsInterface } from '../Interface/Patient'; type Props = { - handleOtherDetailsFormData: ( - familyHistory: string | undefined, - sleep: string | undefined, - pillow: string | undefined, - orthotics: string | undefined, - brestExam: any, - pregnancy: string | undefined, - menstralCycle: any - ) => void; + handleOtherDetailsFormData: (patient:OtherDetailsInterface) => void; patientDataDiplay: any; type: string; }; @@ -41,7 +24,7 @@ export default function OtherDetailsForm({ patientDataDiplay, type, }: Props) { - const [patient, setPatient] = React.useState({ + const [patient, setPatient] = React.useState({ familyHistory: '', sleep: '', pillow: '', @@ -52,15 +35,7 @@ export default function OtherDetailsForm({ }); useEffect(() => { - handleOtherDetailsFormData( - patient.familyHistory, - patient.sleep, - patient.pillow, - patient.orthotics, - (patient.brestExam = dayjs(patient.brestExam)), - patient.pregnancy, - (patient.menstralCycle = dayjs(patient.menstralCycle)) - ); + handleOtherDetailsFormData(patient); }, [patient]); const formatDate = (inputDate: any) => { @@ -230,7 +205,7 @@ export default function OtherDetailsForm({ const formattedDate = formatDate(event); setPatient((prevValues) => ({ ...prevValues, - brestExam: formattedDate, + brestExam: dayjs(formattedDate), })); }} renderInput={(params) => ( @@ -302,7 +277,7 @@ export default function OtherDetailsForm({ const formattedDate = formatDate(event); setPatient((prevValues) => ({ ...prevValues, - menstralCycle: formattedDate, + menstralCycle: dayjs(formattedDate), })); }} renderInput={(params) => ( diff --git a/src/Components/PatientForm/PainAnalysisSection.tsx b/src/Components/PatientForm/PainAnalysisSection.tsx index 2cbf1e9..06c51d6 100644 --- a/src/Components/PatientForm/PainAnalysisSection.tsx +++ b/src/Components/PatientForm/PainAnalysisSection.tsx @@ -14,43 +14,20 @@ import { useFormik } from 'formik'; import * as Yup from 'yup'; import path from 'path'; import { useEffect } from 'react'; - -interface Patient { - chiefComplaint: string; - painWorse: string[]; - painBetter: string[]; - painQuality: string[]; - painWorstTime: string[]; - currentComplaintIssues: string[]; - painDuration: string; - currentTreatment: string; - treatmentGoal: string; - selfTreatment: string; -} +import { InjuryDetailsInterface } from '../Interface/Patient'; type Props = { - handleInjuryDetailsFormData: ( - chiefComplaint: string | undefined, - painWorse: any, - painBetter: any, - painQuality: any, - painWorstTime: any, - currentComplaintIssues: any, - painDuration: string | undefined, - currentTreatment: string | undefined, - treatmentGoal: string | undefined, - selfTreatment: string | undefined - ) => void; + handleInjuryDetailsFormData: (patient:InjuryDetailsInterface) => void; patientDataDiplay: any; type: string; }; -export default function PainAnalysisForm({ +export default function InjuryDetailsForm({ handleInjuryDetailsFormData, patientDataDiplay, type, }: Props) { - const [patient, setPatient] = React.useState({ + const [patient, setPatient] = React.useState({ chiefComplaint: '', painWorse: [], painBetter: [], @@ -64,18 +41,7 @@ export default function PainAnalysisForm({ }); useEffect(() => { - handleInjuryDetailsFormData( - patient.chiefComplaint, - patient.painWorse, - patient.painBetter, - patient.painQuality, - patient.painWorstTime, - patient.currentComplaintIssues, - patient.painDuration, - patient.currentTreatment, - patient.treatmentGoal, - patient.selfTreatment - ); + handleInjuryDetailsFormData(patient); }, [patient]); const handlePainWorseChange = ( diff --git a/src/Components/PatientForm/PastTreatment.tsx b/src/Components/PatientForm/PastTreatment.tsx index 046724a..3f334e6 100644 --- a/src/Components/PatientForm/PastTreatment.tsx +++ b/src/Components/PatientForm/PastTreatment.tsx @@ -11,37 +11,10 @@ import { import * as React from 'react'; import Table from '../Helper/AddNewTable'; import { useEffect } from 'react'; - -interface Patient { - generalHealth: string; - presentProblemBefore: string; - ifYespresentProblemBefore: string; - ifYestreatmentProvided: string; - ifYesOutcome: string; - strokeBloodclotting: string; - ifYesstrokeBloodclotting: string; - dizzinessFetigue: string; - ifyesdizzinessFetigue: string; - antiColligent: string; - injuriesHospitalization: string; - supplementsOrDrugs: string; -} +import { PastTreatmentInterface } from '../Interface/Patient'; type Props = { - handlePastTreatmentFormData: ( - generalHealth: string | undefined, - presentProblemBefore: string | undefined, - ifYespresentProblemBefore: string | undefined, - ifYestreatmentProvided: string | undefined, - ifYesOutcome: string | undefined, - strokeBloodclotting: string | undefined, - ifYesstrokeBloodclotting: string | undefined, - dizzinessFetigue: string | undefined, - ifyesdizzinessFetigue: string | undefined, - antiColligent: string | undefined, - injuriesHospitalization: string | undefined, - supplementsOrDrugs: string | undefined - ) => void; + handlePastTreatmentFormData: (patient:PastTreatmentInterface) => void; patientDataDiplay: any; type: string; }; @@ -51,7 +24,7 @@ export default function PastTreatmentForm({ patientDataDiplay, type, }: Props) { - const [patient, setPatient] = React.useState({ + const [patient, setPatient] = React.useState({ generalHealth: '', presentProblemBefore: '', ifYespresentProblemBefore: '', @@ -67,20 +40,7 @@ export default function PastTreatmentForm({ }); useEffect(() => { - handlePastTreatmentFormData( - patient.generalHealth, - patient.presentProblemBefore, - patient.ifYespresentProblemBefore, - patient.ifYestreatmentProvided, - patient.ifYesOutcome, - patient.strokeBloodclotting, - patient.ifYesstrokeBloodclotting, - patient.dizzinessFetigue, - patient.ifyesdizzinessFetigue, - patient.antiColligent, - patient.injuriesHospitalization, - patient.supplementsOrDrugs - ); + handlePastTreatmentFormData(patient); }, [patient]); return ( diff --git a/src/Components/PatientForm/PatientForm.tsx b/src/Components/PatientForm/PatientForm.tsx index 13ecc2f..16f5210 100644 --- a/src/Components/PatientForm/PatientForm.tsx +++ b/src/Components/PatientForm/PatientForm.tsx @@ -26,7 +26,7 @@ import MuiAccordionSummary, { import MuiAccordionDetails from '@mui/material/AccordionDetails'; import MedicalHistory from './MedicalHistorySection'; import FamilyInformationForm from './FamilyInformationSection'; -import PainAnalysisForm from './PainAnalysisSection'; +import InjuryDetailsForm from './PainAnalysisSection'; import PastTreatmentForm from './PastTreatment'; import SystemReviewForm from './SyestemReviewSection'; import RecreationalHobbiesForm from './RecreationalHobbiesSection'; @@ -36,7 +36,7 @@ import ViewPatientImageMarker from '../ImageMarker/ViewPatientImageMarker'; import AlertDialog from '../Helper/AlertDialogBox'; import SignatureComponent from '../Helper/SignatureComponent'; import { Link, useLocation } from 'react-router-dom'; -import { Patient } from '../Interface/Patient'; +import { FamilyInformationInterface, InjuryDetailsInterface, MedicalHistoryInterface, OtherDetailsInterface, PastTreatmentInterface, PersonalInformationInterface, RecreationalHobbieInterface, SystemReviewInterface } from '../Interface/Patient'; const Accordion = styled((props: AccordionProps) => ( @@ -95,224 +95,38 @@ export default function PatientForm({ type }: Props) { const [patientDetailsButtonFlag, setPatientDetailsButtonFlag] = React.useState(false); - const handlePersonalInformationFormData = (patient: Patient) => { + const handlePersonalInformationFormData = (patient: PersonalInformationInterface) => { setPersonalInformation(patient); }; const handleFamilyInformationFormData = ( - maritalStatus: string | undefined, - numberOfChildren: string | undefined, - occupation: string | undefined, - hoursPerWeek: number | string | undefined, - employer: string | undefined, - businessPhone: string | undefined, - spouseName: string | undefined, - spouseEmployer: string | undefined, - spouseBusinessPhone: string | undefined, - emergencyContact: string | undefined, - relationship: string | undefined, - spousePhone: string | undefined + patient:FamilyInformationInterface ) => { - setFamilyInformation({ - maritalStatus, - numberOfChildren, - occupation, - hoursPerWeek, - employer, - businessPhone, - spouseName, - spouseEmployer, - spouseBusinessPhone, - emergencyContact, - relationship, - spousePhone, - }); + setFamilyInformation(patient); }; - const handleMedicalHistoryFormData = ( - physicianname: string | undefined, - physiciancity: string | undefined, - physicianstate: string | undefined, - physicianphone: string | undefined, - chiropractorName: string | undefined, - chiropractorState: string | undefined, - xray: string | undefined, - haveChiropractor: string | undefined, - reference: string | undefined, - visitDetails: string | undefined, - cellPhoneProvider: string | undefined - ) => { - setMedicalHistory({ - physicianname, - physiciancity, - physicianstate, - physicianphone, - chiropractorName, - chiropractorState, - xray, - haveChiropractor, - reference, - visitDetails, - cellPhoneProvider, - }); + const handleMedicalHistoryFormData = (patient:MedicalHistoryInterface) => { + setMedicalHistory(patient); }; - const handleInjuryDetailsFormData = ( - chiefComplaint: string | undefined, - painWorse: any, - painBetter: any, - painQuality: any, - painWorstTime: any, - currentComplaintIssues: any, - painDuration: string | undefined, - currentTreatment: string | undefined, - treatmentGoal: string | undefined, - selfTreatment: string | undefined - ) => { - setInjuryDetails({ - chiefComplaint, - painWorse, - painBetter, - painQuality, - painWorstTime, - currentComplaintIssues, - painDuration, - currentTreatment, - treatmentGoal, - selfTreatment, - }); + const handleInjuryDetailsFormData = (patient:InjuryDetailsInterface) => { + setInjuryDetails(patient); }; - const handlePastTreatmentFormData = ( - generalHealth: string | undefined, - presentProblemBefore: string | undefined, - ifYespresentProblemBefore: string | undefined, - ifYestreatmentProvided: string | undefined, - ifYesOutcome: string | undefined, - strokeBloodclotting: string | undefined, - ifYesstrokeBloodclotting: string | undefined, - dizzinessFetigue: string | undefined, - ifyesdizzinessFetigue: string | undefined, - antiColligent: string | undefined, - injuriesHospitalization: string | undefined, - supplementsOrDrugs: string | undefined - ) => { - setPastTreatment({ - generalHealth, - presentProblemBefore, - ifYespresentProblemBefore, - ifYestreatmentProvided, - ifYesOutcome, - strokeBloodclotting, - ifYesstrokeBloodclotting, - dizzinessFetigue, - ifyesdizzinessFetigue, - antiColligent, - injuriesHospitalization, - supplementsOrDrugs, - }); + const handlePastTreatmentFormData = (patient:PastTreatmentInterface) => { + setPastTreatment(patient); }; - const handleSystemReviewFormData = ( - eyes: string | undefined, - IntestinesBowls: string | undefined, - jointsBones: string | undefined, - allergies: string | undefined, - earsNoseMouth: string | undefined, - urinary: string | undefined, - skin: string | undefined, - psychological: string | undefined, - heart: string | undefined, - muscles: string | undefined, - internalOrgans: string | undefined, - gynecological: string | undefined, - lungsBreathing: string | undefined, - nerves: string | undefined, - blood: string | undefined, - prostate: string | undefined, - explanation: string | undefined - ) => { - setSystemReviewQuestions({ - eyes, - IntestinesBowls, - jointsBones, - allergies, - earsNoseMouth, - urinary, - skin, - psychological, - heart, - muscles, - internalOrgans, - gynecological, - lungsBreathing, - nerves, - blood, - prostate, - explanation, - }); + const handleSystemReviewFormData = (patient:SystemReviewInterface) => { + setSystemReviewQuestions(patient); }; - const handleRecreationalActivitiesFormData = ( - hobbies: string | undefined, - educationLevel: string | undefined, - excercise: string | undefined, - excerciseExplanation: string | undefined, - tobacco: string | undefined, - tobaccoExplanation: string | undefined, - alcohol: string | undefined, - alcoholExplanation: string | undefined, - healthyDiet: string | undefined, - healthyDietExplanation: string | undefined, - sleep: string | undefined, - sleepExplanation: string | undefined, - workSchool: string | undefined, - workSchoolExplanation: string | undefined, - familyLife: string | undefined, - familyLifeExplanation: string | undefined, - drugs: string | undefined, - drugsExplanation: string | undefined - ) => { - setRecreationalActivities({ - hobbies, - educationLevel, - excercise, - excerciseExplanation, - tobacco, - tobaccoExplanation, - alcohol, - alcoholExplanation, - healthyDiet, - healthyDietExplanation, - sleep, - sleepExplanation, - workSchool, - workSchoolExplanation, - familyLife, - familyLifeExplanation, - drugs, - drugsExplanation, - }); + const handleRecreationalActivitiesFormData = (patient:RecreationalHobbieInterface) => { + setRecreationalActivities(patient); }; - const handleOtherDetailsFormData = ( - familyHistory: string | undefined, - sleep: string | undefined, - pillow: string | undefined, - orthotics: string | undefined, - brestExam: any, - pregnancy: string | undefined, - menstralCycle: any - ) => { - setOtherDetails({ - familyHistory, - sleep, - pillow, - orthotics, - brestExam, - pregnancy, - menstralCycle, - }); + const handleOtherDetailsFormData = (patient:OtherDetailsInterface) => { + setOtherDetails(patient); }; const handleSubmit = () => { @@ -520,7 +334,7 @@ export default function PatientForm({ type }: Props) { - void; + handlePersonalInformationFormData: (patient: PersonalInformationInterface) => void; patientDataDiplay: any; type: string; }; @@ -27,7 +27,7 @@ export default function PersonalInformationForm({ type, }: Props) { const [birthDateValue, setBirthDateValue] = React.useState(); - const [patient, setPatient] = React.useState({ + const [patient, setPatient] = React.useState({ fullName: '', homePhone: '', cellPhone: '', diff --git a/src/Components/PatientForm/RecreationalHobbiesSection.tsx b/src/Components/PatientForm/RecreationalHobbiesSection.tsx index d1d2153..91401f9 100644 --- a/src/Components/PatientForm/RecreationalHobbiesSection.tsx +++ b/src/Components/PatientForm/RecreationalHobbiesSection.tsx @@ -1,54 +1,15 @@ import { FormControl, FormControlLabel, FormLabel, Grid, Radio, RadioGroup, TextField } from "@mui/material"; import React, { useEffect } from "react"; - -interface Patient { - hobbies: string; - educationLevel: string; - excercise: string; - excerciseExplanation: string; - tobacco: string; - tobaccoExplanation: string; - alcohol: string; - alcoholExplanation: string; - healthyDiet: string; - healthyDietExplanation: string; - sleep: string; - sleepExplanation: string; - workSchool: string; - workSchoolExplanation: string; - familyLife: string; - familyLifeExplanation: string; - drugs: string; - drugsExplanation:string; - } +import { RecreationalHobbieInterface } from "../Interface/Patient"; type Props = { - handleRecreationalActivitiesFormData:( - hobbies: string|undefined, - educationLevel: string|undefined, - excercise: string|undefined, - excerciseExplanation: string|undefined, - tobacco: string|undefined, - tobaccoExplanation: string|undefined, - alcohol: string|undefined, - alcoholExplanation: string|undefined, - healthyDiet: string|undefined, - healthyDietExplanation: string|undefined, - sleep: string|undefined, - sleepExplanation: string|undefined, - workSchool: string|undefined, - workSchoolExplanation: string|undefined, - familyLife: string|undefined, - familyLifeExplanation: string|undefined, - drugs: string|undefined, - drugsExplanation:string|undefined, - )=> void + handleRecreationalActivitiesFormData:(patient:RecreationalHobbieInterface)=> void patientDataDiplay:any; type:string; } export default function RecreationalHobbiesForm({handleRecreationalActivitiesFormData,patientDataDiplay,type}:Props){ - const [patient, setPatient] = React.useState({ + const [patient, setPatient] = React.useState({ hobbies: '', educationLevel: '', excercise:'', @@ -71,26 +32,7 @@ export default function RecreationalHobbiesForm({handleRecreationalActivitiesFor useEffect(()=>{ - handleRecreationalActivitiesFormData( - patient.hobbies, - patient.educationLevel, - patient.excercise, - patient.excerciseExplanation, - patient.tobacco, - patient.tobaccoExplanation, - patient.alcohol, - patient.alcoholExplanation, - patient.healthyDiet, - patient.healthyDietExplanation, - patient.sleep, - patient.sleepExplanation, - patient.workSchool, - patient.workSchoolExplanation, - patient.familyLife, - patient.familyLifeExplanation, - patient.drugs, - patient.drugsExplanation - ) + handleRecreationalActivitiesFormData(patient) },[patient]) return( diff --git a/src/Components/PatientForm/SyestemReviewSection.tsx b/src/Components/PatientForm/SyestemReviewSection.tsx index 8e6e73d..44a86c5 100644 --- a/src/Components/PatientForm/SyestemReviewSection.tsx +++ b/src/Components/PatientForm/SyestemReviewSection.tsx @@ -8,47 +8,10 @@ import { TextField, } from '@mui/material'; import React, { useEffect } from 'react'; - -interface Patient { - eyes: string; - IntestinesBowls: string; - jointsBones: string; - allergies: string; - earsNoseMouth: string; - urinary: string; - skin: string; - psychological: string; - heart: string; - muscles: string; - internalOrgans: string; - gynecological: string; - lungsBreathing: string; - nerves: string; - blood: string; - prostate: string; - explanation: string; -} +import { SystemReviewInterface } from '../Interface/Patient'; type Props = { - handleSystemReviewFormData: ( - eyes: string | undefined, - IntestinesBowls: string | undefined, - jointsBones: string | undefined, - allergies: string | undefined, - earsNoseMouth: string | undefined, - urinary: string | undefined, - skin: string | undefined, - psychological: string | undefined, - heart: string | undefined, - muscles: string | undefined, - internalOrgans: string | undefined, - gynecological: string | undefined, - lungsBreathing: string | undefined, - nerves: string | undefined, - blood: string | undefined, - prostate: string | undefined, - explanation: string | undefined - ) => void; + handleSystemReviewFormData: (patient:SystemReviewInterface) => void; patientDataDiplay: any; type: string; }; @@ -58,7 +21,7 @@ export default function SystemReviewForm({ patientDataDiplay, type, }: Props) { - const [patient, setPatients] = React.useState({ + const [patient, setPatients] = React.useState({ eyes: '', IntestinesBowls: '', jointsBones: '', @@ -79,25 +42,7 @@ export default function SystemReviewForm({ }); useEffect(() => { - handleSystemReviewFormData( - patient.eyes, - patient.IntestinesBowls, - patient.jointsBones, - patient.allergies, - patient.earsNoseMouth, - patient.urinary, - patient.skin, - patient.psychological, - patient.heart, - patient.muscles, - patient.internalOrgans, - patient.gynecological, - patient.lungsBreathing, - patient.nerves, - patient.blood, - patient.prostate, - patient.explanation - ); + handleSystemReviewFormData(patient); }, [patient]); return ( <>