Skip to content

Commit

Permalink
Feat : add blood number in create patient modal
Browse files Browse the repository at this point in the history
  • Loading branch information
johnny990628 committed May 24, 2023
1 parent 9a9c358 commit 7d65f78
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/Components/CustomForm/usePatientForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import { apiCheckExists } from '../../Axios/Exists'
import { createPatient, updatePatient } from '../../Redux/Slices/Patient'
import { closeDialog } from '../../Redux/Slices/Dialog'
import { openAlert } from '../../Redux/Slices/Alert'
import { addSchedule } from '../../Redux/Slices/Schedule'

const usePatientForm = () => {
const [id, setId] = useState('')
const [name, setName] = useState('')
const [phone, setPhone] = useState('')
const [department, setDepartment] = useState('')
const [birth, setBirth] = useState('')
const [blood, setBlood] = useState('')
const [errorField, setErrorField] = useState([])
const [validID, setValidID] = useState(true)
const [validPhone, setValidPhone] = useState(true)
Expand Down Expand Up @@ -68,13 +70,15 @@ const usePatientForm = () => {
icon: 'error',
})
)

return
}

//身份證字號判斷性別
const gender = id.substring(1, 2) === '1' ? 'm' : 'f'

dispatch(createPatient({ id, name, phone, departmentID: department, birth, gender, creator: user._id }))
if (blood) dispatch(addSchedule({ patientID: id, procedureCode: '19009C', blood }))

dispatch(closeDialog({ type: 'patient' }))
}
Expand All @@ -100,6 +104,7 @@ const usePatientForm = () => {
}

const inputModel = [
{ name: 'blood', label: '抽血編號', type: 'text', value: blood, setValue: setBlood, required: false },
{ name: 'id', label: '身分證字號', type: 'text', value: id, setValue: setId, required: true },
{ name: 'name', label: '姓名', type: 'text', value: name, setValue: setName, required: true },
{ name: 'phone', label: '電話', type: 'text', value: phone, setValue: setPhone, required: true },
Expand Down
6 changes: 4 additions & 2 deletions src/Components/CustomNavbar/CustomNavbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const CustomNavbar = () => {
const { user } = useSelector(state => state.auth)
const { events } = useSelector(state => state.event4List)

useEffect(async () => {
useEffect(() => {
dispatch(fetchEvent4List())
setupEvent()
}, [])
Expand All @@ -39,6 +39,8 @@ const CustomNavbar = () => {
case '/report':
dispatch(scheduleTrigger())
break
default:
break
}
}

Expand Down Expand Up @@ -79,7 +81,7 @@ const CustomNavbar = () => {
<Toolbar className={classes.toolbar} sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<img src="./logo.gif" className={classes.logo} alt="logo" style={{ width: '2.8rem', height: '2.8rem' }} />
<Box sx={{ color: 'primary.main', fontSize: '1.8rem', ml: 1 }}>奇異鳥報告系統</Box>
<Box sx={{ color: 'primary.main', fontSize: '1.4rem', ml: 1 }}>奇異鳥報告系統</Box>
<FormControl sx={{ width: '10rem', ml: 4 }} size="small">
<InputLabel id="event-select-label">選擇活動</InputLabel>
<Select labelId="event-select-label" variant="outlined" value={event} onChange={handleChange} label="選擇活動">
Expand Down
2 changes: 1 addition & 1 deletion src/Components/CustomTable/Style.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const useStyles = makeStyles(theme => ({
},
tableHeader: {
fontSize: '1.1rem',
backgroundColor: 'transparent',
backgroundColor: theme.palette.background.opaque,
borderBottom: `1px solid ${theme.palette.primary.light}`,
[theme.breakpoints.down('lg')]: {
fontSize: '1rem',
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const whiteTheme = createTheme({
main: 'rgb(247, 222, 227)',
default: 'rgba(251, 248, 242,.85)',
secondary: 'rgba(251, 248, 242,.95)',
opaque: 'rgb(248, 240, 235)',
},
text: {
primary: 'rgba(36, 31, 33)',
Expand Down

0 comments on commit 7d65f78

Please sign in to comment.