Medical history section

This commit is contained in:
sonika 2023-08-20 20:39:44 +05:30
parent 2401d3eea2
commit f3fa5136ec
4 changed files with 178 additions and 19 deletions

View File

@ -16,7 +16,7 @@ interface FormValues {
spouseBusinessPhone: string; spouseBusinessPhone: string;
emergencyContact: string; emergencyContact: string;
relationship: string; relationship: string;
phone: string; spousePhone: string;
} }
const validationSchema = yup.object({ const validationSchema = yup.object({
@ -32,10 +32,10 @@ const validationSchema = yup.object({
// spouseBusinessPhone:yup.string().required("Full name is required"), // spouseBusinessPhone:yup.string().required("Full name is required"),
emergencyContact:yup.string().matches(/^\d{10}$/, "Cell phone must be 10 digits"), emergencyContact:yup.string().matches(/^\d{10}$/, "Cell phone must be 10 digits"),
relationship:yup.string().required("Relationship is required"), relationship:yup.string().required("Relationship is required"),
phone:yup.string().matches(/^\d{10}$/, "Cell phone must be 10 digits"), spousePhone:yup.string().matches(/^\d{10}$/, "Cell phone must be 10 digits"),
}); });
const Form: React.FC = () => { export default function FamilyFormSection(){
const formik = useFormik<FormValues>({ const formik = useFormik<FormValues>({
initialValues:{ initialValues:{
maritalStatus:'', maritalStatus:'',
@ -50,7 +50,7 @@ const Form: React.FC = () => {
spouseBusinessPhone:'', spouseBusinessPhone:'',
emergencyContact:'', emergencyContact:'',
relationship:'', relationship:'',
phone:'' spousePhone:''
}, },
validationSchema, validationSchema,
onSubmit:(values)=>{ onSubmit:(values)=>{
@ -87,6 +87,7 @@ const Form: React.FC = () => {
<Grid item xs={4} className='collapsable-form-style textfield-padding'></Grid> <Grid item xs={4} className='collapsable-form-style textfield-padding'></Grid>
<Grid item xs={4} className='collapsable-form-style textfield-padding'> <Grid item xs={4} className='collapsable-form-style textfield-padding'>
<TextField <TextField
required
variant="filled" variant="filled"
label="Number of Children/Ages" label="Number of Children/Ages"
className='collapsable-form-style' className='collapsable-form-style'
@ -100,6 +101,7 @@ const Form: React.FC = () => {
</Grid> </Grid>
<Grid item xs={4} className='collapsable-form-style textfield-padding'> <Grid item xs={4} className='collapsable-form-style textfield-padding'>
<TextField <TextField
required
variant="filled" variant="filled"
label="Occupation" label="Occupation"
className='collapsable-form-style' className='collapsable-form-style'
@ -207,19 +209,16 @@ const Form: React.FC = () => {
<Grid item xs={4} className='collapsable-form-style textfield-padding'> <Grid item xs={4} className='collapsable-form-style textfield-padding'>
<TextField <TextField
variant="filled" variant="filled"
label="Phone" type="tel" label="Spouse's Phone" type="tel"
className='collapsable-form-style' className='collapsable-form-style'
name='phone' name='phone'
onChange={formik.handleChange} onChange={formik.handleChange}
value={formik.values.phone} value={formik.values.spousePhone}
onBlur={formik.handleBlur} onBlur={formik.handleBlur}
/> />
</Grid> </Grid>
</Grid> </Grid>
</form> </form>
</> </>
) )
}; };
export default Form;

View File

@ -0,0 +1,144 @@
import * as React from 'react';
import { Checkbox, FormControlLabel, TextField, FormGroup, Grid, FormControl, FormLabel, Radio, RadioGroup } from '@mui/material';
import { useFormik } from 'formik';
import * as Yup from 'yup';
interface FormValues {
physicianname: string;
physiciancity: string;
physicianstate: string;
physicianphone: string;
chiropractorName: string;
chiropractorState: string;
xray: boolean;
ctScan: boolean;
cdImages: boolean;
visitDetails: string;
cellPhoneProvider: string;
}
const validationSchema = Yup.object({
familyphysician: Yup.string().required('Required'),
city: Yup.string().required('Required'),
state: Yup.string().required('Required'),
phone: Yup.string().required('Required'),
chiropractorName: Yup.string().required('Required'),
xray: Yup.boolean().required('Required'),
ctScan: Yup.boolean().required('Required'),
cdImages: Yup.boolean().required('Required'),
visitDetails: Yup.string().required('Required'),
cellPhoneProvider: Yup.string().required('Required'),
});
export default function MedicalHistoryForm(){
const formik = useFormik<FormValues>({
initialValues:{
physicianname: '',
physiciancity: '',
physicianstate: '',
physicianphone: '',
chiropractorName: '',
chiropractorState: '',
xray: false,
ctScan: false,
cdImages: false,
visitDetails: '',
cellPhoneProvider: '',
},
validationSchema,
onSubmit:(values)=>{
console.log(values);
}
})
return(
<>
<form onSubmit={formik.handleSubmit}>
<Grid container direction="row">
<Grid item xs={4} className='collapsable-form-style'>
<TextField
variant="filled"
label="Family physician"
name='familyphysician'
onChange={formik.handleChange}
value={formik.values.physicianname}
onBlur={formik.handleBlur}
/>
</Grid>
<Grid item xs={4} className='collapsable-form-style'>
<TextField
variant="filled"
label="City"
name='city'
onChange={formik.handleChange}
value={formik.values.physiciancity}
onBlur={formik.handleBlur}
/>
</Grid>
<Grid item xs={4} className='collapsable-form-style'>
<TextField
variant="filled"
label="State"
name='state'
onChange={formik.handleChange}
value={formik.values.physicianstate}
onBlur={formik.handleBlur}
/>
</Grid>
<Grid item xs={4} className='collapsable-form-style'>
<TextField
variant="filled"
label="Phone"
type="tel"
name='phone'
onChange={formik.handleChange}
value={formik.values.physicianphone}
onBlur={formik.handleBlur}
/>
</Grid>
<Grid item xs={4} className='collapsable-form-style'></Grid>
<Grid item xs={4} className='collapsable-form-style'></Grid>
<Grid item xs={4} sx={{paddingLeft:"14px",marginTop:2}} className='collapsable-form-style'>
<FormControl>
<FormLabel>Previous Chiropractic Care</FormLabel>
<RadioGroup
// value={patient.gender}
aria-labelledby="demo-radio-buttons-group-label"
defaultValue="yes"
name="radio-buttons-group"
onChange={formik.handleChange}
sx={{display:'flex', flexDirection:'row'}}
>
<FormControlLabel value="yes" control={<Radio />} label="Yes" />
<FormControlLabel value="no" control={<Radio />} label="No" />
</RadioGroup>
</FormControl>
</Grid>
<Grid item xs={4} className='collapsable-form-style'>
<TextField
variant="filled"
label="Chiropractor's Name"
name='chiropractorName'
onChange={formik.handleChange}
value={formik.values.chiropractorName}
onBlur={formik.handleBlur}
/>
</Grid>
<Grid item xs={4} className='collapsable-form-style'>
<TextField
variant="filled"
label="City/State"
name='chiropractorState'
onChange={formik.handleChange}
value={formik.values.chiropractorState}
onBlur={formik.handleBlur}
/>
</Grid>
</Grid>
</form>
</>
)}

View File

@ -4,7 +4,7 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import Footer from "../Footer"; import Footer from "../Footer";
import Header from "../Header"; import Header from "../Header";
import {Button, Grid, Paper, Radio, RadioGroup, TextField } from '@mui/material'; import {Button, Grid, Paper, Radio, RadioGroup, TextField } from '@mui/material';
import FormSection1 from './FormSection1'; import PersonalSection from './PersonalSection1';
import { styled } from '@mui/material/styles'; import { styled } from '@mui/material/styles';
import ArrowForwardIosSharpIcon from '@mui/icons-material/ArrowForwardIosSharp'; import ArrowForwardIosSharpIcon from '@mui/icons-material/ArrowForwardIosSharp';
import MuiAccordion, { AccordionProps } from '@mui/material/Accordion'; import MuiAccordion, { AccordionProps } from '@mui/material/Accordion';
@ -12,7 +12,9 @@ import MuiAccordionSummary, {
AccordionSummaryProps, AccordionSummaryProps,
} from '@mui/material/AccordionSummary'; } from '@mui/material/AccordionSummary';
import MuiAccordionDetails from '@mui/material/AccordionDetails'; import MuiAccordionDetails from '@mui/material/AccordionDetails';
import FormSection2 from './FormSection2'; import FormSection2 from './FamilyFormSection2';
import MedicalHistory from './MedicalHistorySection3';
import FamilyFormSection from './FamilyFormSection2';
interface Patient { interface Patient {
fullName: string; fullName: string;
@ -100,34 +102,47 @@ export default function PatientForm(){
<Paper elevation={0} className='app-screen-constants'> <Paper elevation={0} className='app-screen-constants'>
<Header/> <Header/>
<Paper elevation={0} sx={{margin:4, minHeight:700}} > <Paper elevation={0} sx={{margin:4, minHeight:700}} >
<form onSubmit={handleSubmit}>
<Typography variant="h5" gutterBottom> <Typography variant="h5" gutterBottom>
Confidential Patient Information Confidential Patient Information
</Typography> </Typography>
<Grid> <Grid>
<Accordion expanded={expanded === 'panel1'} onChange={handleExpandChange('panel1')}> <Accordion expanded={expanded === 'panel1'} onChange={handleExpandChange('panel1')}>
<form onSubmit={handleSubmit}>
<AccordionSummary <AccordionSummary
expandIcon={<ExpandMoreIcon />} expandIcon={<ExpandMoreIcon />}
aria-controls="panel1a-content" aria-controls="panel1a-content"
id="panel1a-header" id="panel1a-header"
> >
<Typography variant="h6">Basic Patient Information (Part 1)</Typography> <Typography variant="h6">Patient's Personal Information</Typography>
</AccordionSummary> </AccordionSummary>
<AccordionDetails> <AccordionDetails>
<FormSection1/> <PersonalSection/>
</AccordionDetails> </AccordionDetails>
</form>
</Accordion> </Accordion>
<Accordion expanded={expanded === 'panel2'} onChange={handleExpandChange('panel2')}> <Accordion expanded={expanded === 'panel2'} onChange={handleExpandChange('panel2')}>
<AccordionSummary aria-controls="panel2d-content" id="panel2d-header"> <AccordionSummary aria-controls="panel2d-content" id="panel2d-header">
<Typography variant="h6">Basic Patient Information (Part 2)</Typography> <Typography variant="h6">Patient's Family Information</Typography>
</AccordionSummary> </AccordionSummary>
<AccordionDetails> <AccordionDetails>
<FormSection2/> <FamilyFormSection/>
</AccordionDetails> </AccordionDetails>
</Accordion> </Accordion>
<Accordion expanded={expanded === 'panel3'} onChange={handleExpandChange('panel3')}>
<AccordionSummary aria-controls="panel3d-content" id="panel3d-header">
<Typography variant="h6">Patient's Medical History Information</Typography>
</AccordionSummary>
<AccordionDetails>
<MedicalHistory/>
</AccordionDetails>
</Accordion>
<Grid > <Grid >
<Button type="submit" variant="contained" color="primary" sx={{margin:5,left:'40%',width:'200px'}}> <Button type="submit" variant="contained" color="primary" sx={{margin:5,left:'40%',width:'200px'}}>
Submit Submit
@ -135,6 +150,7 @@ export default function PatientForm(){
</Grid> </Grid>
</Grid> </Grid>
</form>
</Paper> </Paper>
<Footer/> <Footer/>
</Paper> </Paper>

View File

@ -35,7 +35,7 @@ interface Patient {
zipCode: yup.string().matches(/^\d{5}$/, "Zip code must be 6 digits").required("Zip code is required") zipCode: yup.string().matches(/^\d{5}$/, "Zip code must be 6 digits").required("Zip code is required")
}); });
export default function FormSection1(){ export default function PersonalSection(){
const [startDateValue, setStartDateValue] = React.useState<any>(); const [startDateValue, setStartDateValue] = React.useState<any>();
const [patient, setPatient] = React.useState<Patient>({ const [patient, setPatient] = React.useState<Patient>({