section6 to main

This commit is contained in:
sonika 2023-09-04 22:35:02 +05:30
parent a025a32a7f
commit 9b3444a4f6
2 changed files with 110 additions and 24 deletions

View File

@ -82,6 +82,7 @@ export default function PatientForm(){
const [section3Data, setSection3Data] = React.useState<any>({}); const [section3Data, setSection3Data] = React.useState<any>({});
const [section4Data, setSection4Data] = React.useState<any>({}); const [section4Data, setSection4Data] = React.useState<any>({});
const [section5Data, setSection5Data] = React.useState<any>({}); const [section5Data, setSection5Data] = React.useState<any>({});
const [section6Data, setSection6Data] = React.useState<any>({});
const handleFormSection1Data = ( const handleFormSection1Data = (
fullName?: string|undefined, fullName?: string|undefined,
@ -226,6 +227,46 @@ export default function PatientForm(){
supplementsOrDrugs, 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 handleSubmit = (event: React.FormEvent<HTMLFormElement>) => { const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault(); event.preventDefault();
@ -240,7 +281,7 @@ export default function PatientForm(){
setIsChecked(event.target.checked); setIsChecked(event.target.checked);
}; };
console.log("wyeytweevfde",section4Data) console.log("wyeytweevfde",section6Data)
return( return(
@ -315,7 +356,7 @@ export default function PatientForm(){
</AccordionSummary> </AccordionSummary>
<AccordionDetails> <AccordionDetails>
<SystemReviewSection6/> <SystemReviewSection6 handleFormSection6Data={handleFormSection6Data}/>
</AccordionDetails> </AccordionDetails>
</Accordion> </Accordion>

View File

@ -1,7 +1,7 @@
import { FormControl, FormControlLabel, FormLabel, Grid, Radio, RadioGroup, TextField } from "@mui/material"; import { FormControl, FormControlLabel, FormLabel, Grid, Radio, RadioGroup, TextField } from "@mui/material";
import React from "react"; import React, { useEffect } from "react";
interface FormValues { interface Patient {
eyes: string; eyes: string;
IntestinesBowls: string; IntestinesBowls: string;
jointsBones:string; jointsBones:string;
@ -21,8 +21,30 @@ interface FormValues {
explanation:string; explanation:string;
} }
export default function SystemReviewSection6(){ type Props = {
const [values, setValues] = React.useState<FormValues>({ 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,
)=> void
}
export default function SystemReviewSection6({handleFormSection6Data}:Props){
const [patient, setPatients] = React.useState<Patient>({
eyes: '', eyes: '',
IntestinesBowls: '', IntestinesBowls: '',
jointsBones:'', jointsBones:'',
@ -41,6 +63,28 @@ export default function SystemReviewSection6(){
prostate: '', prostate: '',
explanation:'', explanation:'',
}); });
useEffect(()=>{
handleFormSection6Data(
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,
)
},[patient])
return( return(
<> <>
<Grid item xs={12} className='collapsable-form-style '> <Grid item xs={12} className='collapsable-form-style '>
@ -54,7 +98,7 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
eyes: event.target.value, eyes: event.target.value,
})); }));
@ -72,9 +116,9 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
presentProblemBefore: event.target.value, IntestinesBowls: event.target.value,
})); }));
}} }}
> >
@ -90,7 +134,7 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
jointsBones: event.target.value, jointsBones: event.target.value,
})); }));
@ -108,7 +152,7 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
allergies: event.target.value, allergies: event.target.value,
})); }));
@ -126,7 +170,7 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
earsNoseMouth: event.target.value, earsNoseMouth: event.target.value,
})); }));
@ -144,7 +188,7 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
urinary: event.target.value, urinary: event.target.value,
})); }));
@ -162,7 +206,7 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
skin: event.target.value, skin: event.target.value,
})); }));
@ -180,7 +224,7 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
psychological: event.target.value, psychological: event.target.value,
})); }));
@ -198,7 +242,7 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
heart: event.target.value, heart: event.target.value,
})); }));
@ -216,7 +260,7 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
muscles: event.target.value, muscles: event.target.value,
})); }));
@ -234,7 +278,7 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
internalOrgans: event.target.value, internalOrgans: event.target.value,
})); }));
@ -252,7 +296,7 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
gynecological: event.target.value, gynecological: event.target.value,
})); }));
@ -271,7 +315,7 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
lungsBreathing: event.target.value, lungsBreathing: event.target.value,
})); }));
@ -289,7 +333,7 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
nerves: event.target.value, nerves: event.target.value,
})); }));
@ -307,7 +351,7 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
blood: event.target.value, blood: event.target.value,
})); }));
@ -325,7 +369,7 @@ export default function SystemReviewSection6(){
name="painDuration" name="painDuration"
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
onChange={(event) => { onChange={(event) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
prostate: event.target.value, prostate: event.target.value,
})); }));
@ -343,8 +387,9 @@ export default function SystemReviewSection6(){
variant="outlined" variant="outlined"
label="" label=""
name='explanation' name='explanation'
value={patient.explanation}
onChange={(event:any) => { onChange={(event:any) => {
setValues((prevValues) => ({ setPatients((prevValues) => ({
...prevValues, ...prevValues,
explanation: event.target.value, explanation: event.target.value,
})); }));