import * as React from 'react';
import Typography from '@mui/material/Typography';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import Footer from "../Footer";
import Header from "../Header";
import {Button, Checkbox, FormControlLabel, FormGroup, FormLabel, Grid, Paper, Radio, RadioGroup, TextField } from '@mui/material';
import PersonalSection from './PersonalSection1';
import { styled } from '@mui/material/styles';
import ArrowForwardIosSharpIcon from '@mui/icons-material/ArrowForwardIosSharp';
import MuiAccordion, { AccordionProps } from '@mui/material/Accordion';
import MuiAccordionSummary, {
AccordionSummaryProps,
} from '@mui/material/AccordionSummary';
import MuiAccordionDetails from '@mui/material/AccordionDetails';
import MedicalHistory from './MedicalHistorySection3';
import FamilyFormSection from './FamilyFormSection2';
import PainAnalysisSection4 from './PainAnalysisSection4';
import PastTreatment5 from './PastTreatment5';
import SystemReviewSection6 from './SyestemReviewSection6';
import RecreationalHobbiesSection7 from './RecreationalHobbiesSection7';
import OtherDetails8 from './OtherDetails8';
import PatientImageMarker from '../ImageMarker/PatientImageMarker';
const Accordion = styled((props: AccordionProps) => (
))(({ theme }) => ({
border: `1px solid ${theme.palette.divider}`,
'&:not(:last-child)': {
borderBottom: 0,
},
'&:before': {
display: 'none',
},
}));
const AccordionSummary = styled((props: AccordionSummaryProps) => (
}
{...props}
/>
))(({ theme }) => ({
backgroundColor:
theme.palette.mode === 'dark'
? 'rgba(255, 255, 255, .05)'
: 'rgba(0, 0, 0, .03)',
flexDirection: 'row-reverse',
'& .MuiAccordionSummary-expandIconWrapper.Mui-expanded': {
transform: 'rotate(90deg)',
},
'& .MuiAccordionSummary-content': {
marginLeft: theme.spacing(1),
},
}));
const AccordionDetails = styled(MuiAccordionDetails)(({ theme }) => ({
padding: theme.spacing(2),
borderTop: '1px solid rgba(0, 0, 0, .125)',
}));
type Props={
type:any;
}
export default function PatientForm({type}:Props){
const [expanded, setExpanded] = React.useState('panel1');
const [isChecked, setIsChecked] = React.useState(false);
const [signature,setSignature]=React.useState('');
const [section1Data, setSection1Data] = React.useState({});
const [section2Data, setSection2Data] = React.useState({});
const [section3Data, setSection3Data] = React.useState({});
const [section4Data, setSection4Data] = React.useState({});
const [section5Data, setSection5Data] = React.useState({});
const [section6Data, setSection6Data] = React.useState({});
const [section7Data, setSection7Data] = React.useState({});
const [section8Data, setSection8Data] = React.useState({});
const [allPatientData, setAllPatientData] = React.useState([]);
const handleFormSection1Data = (
fullName?: string|undefined,
homePhone?: string|undefined,
cellPhone?: string|undefined,
email?: string|undefined,
age?: number|undefined|string,
dateOfBirth?: string|undefined,
socialSecurityNumber?: string|undefined,
mailingAddress?: string|undefined,
city?: string|undefined,
state?: string|undefined,
zipCode?: string|undefined,
gender?: string|undefined,
) =>{
setSection1Data({
fullName,
homePhone,
cellPhone,
email,
age,
dateOfBirth,
socialSecurityNumber,
mailingAddress,
city,
state,
zipCode,
gender,
})
}
const handleFormSection2Data = (
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,
) =>{
setSection2Data({
maritalStatus,
numberOfChildren,
occupation,
hoursPerWeek,
employer,
businessPhone,
spouseName,
spouseEmployer,
spouseBusinessPhone,
emergencyContact,
relationship,
spousePhone,
})
}
const handleFormSection3Data = (
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,
) =>{
setSection3Data({
physicianname,
physiciancity,
physicianstate,
physicianphone,
chiropractorName,
chiropractorState,
xray,
haveChiropractor,
reference,
visitDetails,
cellPhoneProvider,
})
}
const handleFormSection4Data = (
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,
) =>{
setSection4Data({
chiefComplaint,
painWorse,
painBetter,
painQuality,
painWorstTime,
currentComplaintIssues,
painDuration,
currentTreatment,
treatmentGoal,
selfTreatment,
})
}
const handleFormSection5Data = (
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,
) =>{
setSection5Data({
generalHealth,
presentProblemBefore,
ifYespresentProblemBefore,
ifYestreatmentProvided,
ifYesOutcome,
strokeBloodclotting,
ifYesstrokeBloodclotting,
dizzinessFetigue,
ifyesdizzinessFetigue,
antiColligent,
injuriesHospitalization,
supplementsOrDrugs,
})
}
const handleFormSection6Data = (
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,
) =>{
setSection6Data({
eyes,
IntestinesBowls,
jointsBones,
allergies,
earsNoseMouth,
urinary,
skin,
psychological,
heart,
muscles,
internalOrgans,
gynecological,
lungsBreathing,
nerves,
blood,
prostate,
explanation,
})
}
const handleFormSection7Data = (
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,
) =>{
setSection7Data({
hobbies,
educationLevel,
excercise,
excerciseExplanation,
tobacco,
tobaccoExplanation,
alcohol,
alcoholExplanation,
healthyDiet,
healthyDietExplanation,
sleep,
sleepExplanation,
workSchool,
workSchoolExplanation,
familyLife,
familyLifeExplanation,
drugs,
drugsExplanation,
})
}
const handleFormSection8Data = (
familyHistory: string|undefined,
sleep: string|undefined,
pillow: string|undefined,
orthotics: string|undefined,
brestExam: any,
pregnancy: string|undefined,
menstralCycle: any,
) =>{
setSection8Data({
familyHistory,
sleep,
pillow,
orthotics,
brestExam,
pregnancy,
menstralCycle,
})
}
const handleSubmit = () => {
const newPatientData = {
personalInformation: section1Data,
familyInformation: section2Data,
medicalHistory: section3Data,
injuryDetails: section4Data,
pastTreatment: section5Data,
systemReviewQuestions: section6Data,
recreationalActivities: section7Data,
otherDetails: section8Data,
};
// Create a copy of the existing data array and push the new patient data
const updatedAllPatientData = [...allPatientData, newPatientData];
// Update the state with the new array
setAllPatientData(updatedAllPatientData);
localStorage.setItem('patientData', JSON.stringify(newPatientData));
TextFile();
};
const TextFile = () => {
const element = document.createElement("a");
//@ts-ignore
const textFile = new Blob([localStorage.getItem('patientData')], {type: 'text/json'});
element.href = URL.createObjectURL(textFile);
element.download = "patientData.json";
document.body.appendChild(element);
element.click();
}
const handleExpandChange =
(panel: string) => (event: React.SyntheticEvent, newExpanded: boolean) => {
setExpanded(newExpanded ? panel : false);
};
const handleCheckboxChange = (event:any) => {
setIsChecked(event.target.checked);
};
//@ts-ignore
const patientData = localStorage.getItem('patientData') ? JSON.parse(localStorage.getItem('patientData')) : [];
return(
<>
{/* */}
>
)
}