feature/view-patient-data #3

Merged
vipeesh.p merged 16 commits from feature/view-patient-data into develop 2023-09-06 14:40:07 +00:00
3 changed files with 37 additions and 46 deletions
Showing only changes of commit 160f98edfb - Show all commits

View File

@ -72,8 +72,6 @@ export default function FamilyFormSection({handleFormSection2Data,patientDataDip
)
},[patient])
console.log(type,"sfsdfsdfsd")
return(
<>
<Grid container direction="row">

View File

@ -18,19 +18,6 @@ interface Patient {
cellPhoneProvider: string |undefined;
}
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'),
haveChiropractor: Yup.boolean().required('Required'),
reference: Yup.boolean().required('Required'),
visitDetails: Yup.string().required('Required'),
cellPhoneProvider: Yup.string().required('Required'),
});
type Props = {
handleFormSection3Data:(
physicianname?: string |undefined,
@ -45,9 +32,11 @@ type Props = {
visitDetails?: string |undefined,
cellPhoneProvider?: string |undefined,
)=> void
patientDataDiplay:any;
type:string;
}
export default function MedicalHistoryForm({handleFormSection3Data}:Props){
export default function MedicalHistoryForm({handleFormSection3Data,patientDataDiplay,type}:Props){
const [patient, setPatient] = React.useState<Patient>({
physicianname: '',
@ -78,6 +67,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
patient.cellPhoneProvider,
)
},[patient])
console.log("patientDataDiplay",patientDataDiplay)
return(
<>
<Grid item xs={12} className='collapsable-form-style '>
@ -96,8 +87,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
physicianname: e.target.value,
}));
}}
value={patient.physicianname}
// onBlur={formik.handleBlur}
value={type=='display'?patientDataDiplay.physicianname:patient.physicianname}
disabled={type=='display'}
/>
</Grid>
<Grid item xs={4} className='collapsable-form-style'>
@ -111,8 +102,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
physiciancity: e.target.value,
}));
}}
value={patient.physiciancity}
// onBlur={formik.handleBlur}
value={type=='display'?patientDataDiplay.physiciancity:patient.physiciancity}
disabled={type=='display'}
/>
</Grid>
<Grid item xs={4} className='collapsable-form-style'>
@ -126,8 +117,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
physicianstate: e.target.value,
}));
}}
value={patient.physicianstate}
// onBlur={formik.handleBlur}
value={type=='display'?patientDataDiplay.physicianstate:patient.physicianstate}
disabled={type=='display'}
/>
</Grid>
<Grid item xs={4} className='collapsable-form-style'>
@ -142,8 +133,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
physicianphone: e.target.value,
}));
}}
value={patient.physicianphone}
// onBlur={formik.handleBlur}
value={type=='display'?patientDataDiplay.physicianphone:patient.physicianphone}
disabled={type=='display'}
/>
</Grid>
@ -158,9 +149,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
<FormControl>
<FormLabel>Previous Chiropractic Care:</FormLabel>
<RadioGroup
// value={patient.gender}
aria-labelledby="demo-radio-buttons-group-label"
// defaultValue="yes"
defaultValue={type=='display'?patientDataDiplay.haveChiropractor:patient.haveChiropractor}
name="radio-buttons-group"
onChange={(e)=>{
setPatient((prevValues) => ({
@ -170,8 +160,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
}}
sx={{display:'flex', flexDirection:'row'}}
>
<FormControlLabel value="yes" control={<Radio />} label="Yes" />
<FormControlLabel value="no" control={<Radio />} label="No" />
<FormControlLabel disabled={type=='display'} value="yes" control={<Radio />} label="Yes" />
<FormControlLabel disabled={type=='display'} value="no" control={<Radio />} label="No" />
</RadioGroup>
</FormControl>
</Grid>
@ -187,8 +177,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
chiropractorName: e.target.value,
}));
}}
value={patient.chiropractorName}
// onBlur={formik.handleBlur}
value={type=='display'?patientDataDiplay.chiropractorName:patient.chiropractorName}
disabled={type=='display'}
/>
</Grid>
@ -203,8 +193,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
chiropractorState: e.target.value,
}));
}}
value={patient.chiropractorState}
// onBlur={formik.handleBlur}
value={type=='display'?patientDataDiplay.chiropractorState:patient.chiropractorState}
disabled={type=='display'}
/>
</Grid>
</Grid>
@ -215,7 +205,7 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
<RadioGroup
// value={patient.gender}
aria-labelledby="demo-radio-buttons-group-label"
// defaultValue="yes"
defaultValue={type=='display'?patientDataDiplay.xray:patient.xray}
name="radio-buttons-group"
onChange={(e)=>{
setPatient((prevValues) => ({
@ -225,8 +215,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
}}
sx={{display:'flex', flexDirection:'row'}}
>
<FormControlLabel value="yes" control={<Radio />} label="Yes" />
<FormControlLabel value="no" control={<Radio />} label="No" />
<FormControlLabel disabled={type=='display'} value="yes" control={<Radio />} label="Yes" />
<FormControlLabel disabled={type=='display'} value="no" control={<Radio />} label="No" />
</RadioGroup>
</FormControl>
</Grid>
@ -237,7 +227,7 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
<RadioGroup
// value={patient.gender}
aria-labelledby="demo-radio-buttons-group-label"
// defaultValue="physician"
defaultValue={type=='display'?patientDataDiplay.reference:patient.reference}
name="radio-buttons-group"
onChange={(e)=>{
setPatient((prevValues) => ({
@ -247,12 +237,12 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
}}
sx={{display:'flex', flexDirection:'row'}}
>
<FormControlLabel value="friend" control={<Radio />} label="Friend" />
<FormControlLabel value="relative" control={<Radio />} label="Relative" />
<FormControlLabel value="physician" control={<Radio />} label="Physician" />
<FormControlLabel value="instagram" control={<Radio />} label="Instagram" />
<FormControlLabel value="google" control={<Radio />} label="Google" />
<FormControlLabel value="others" control={<Radio />} label="Others" />
<FormControlLabel disabled={type=='display'} value="friend" control={<Radio />} label="Friend" />
<FormControlLabel disabled={type=='display'} value="relative" control={<Radio />} label="Relative" />
<FormControlLabel disabled={type=='display'} value="physician" control={<Radio />} label="Physician" />
<FormControlLabel disabled={type=='display'} value="instagram" control={<Radio />} label="Instagram" />
<FormControlLabel disabled={type=='display'} value="google" control={<Radio />} label="Google" />
<FormControlLabel disabled={type=='display'} value="others" control={<Radio />} label="Others" />
</RadioGroup>
</FormControl>
</Grid>
@ -263,7 +253,7 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
<RadioGroup
// value={patient.gender}
aria-labelledby="demo-radio-buttons-group-label"
// defaultValue="email"
defaultValue={type=='display'?patientDataDiplay.cellPhoneProvider:patient.cellPhoneProvider}
name="radio-buttons-group"
onChange={(e)=>{
setPatient((prevValues) => ({
@ -273,8 +263,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
}}
sx={{display:'flex', flexDirection:'row'}}
>
<FormControlLabel value="email" control={<Radio />} label="Email" />
<FormControlLabel value="text" control={<Radio />} label="Text" />
<FormControlLabel disabled={type=='display'} value="email" control={<Radio />} label="Email" />
<FormControlLabel disabled={type=='display'} value="text" control={<Radio />} label="Text" />
</RadioGroup>
</FormControl>
</Grid>

View File

@ -418,7 +418,10 @@ export default function PatientForm({type}:Props){
</AccordionSummary>
<AccordionDetails>
<MedicalHistory handleFormSection3Data={handleFormSection3Data}/>
<MedicalHistory
patientDataDiplay={patientData.medicalHistory}
type={type}
handleFormSection3Data={handleFormSection3Data}/>
</AccordionDetails>
</Accordion>