-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from osohyun0224/master
[Feat/FE] 010 전문의가 확인하는 환자 차트 작성 페이지(신규 환자 등록)를 구현한다.
- Loading branch information
Showing
11 changed files
with
2,640 additions
and
1,907 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import styled from "styled-components"; | ||
import InputText from "../Input/InputText"; | ||
import Dropdown from "../Dropdown/Dropdown"; | ||
import DateSelect from "../Input/DateSelect"; | ||
import InputTextLong from "../Input/InputTextLong"; | ||
|
||
const ChartContainer = styled.div` | ||
width: 800px; | ||
height: 900px; | ||
border-radius: 7.5px; | ||
background-color: #ffffff; | ||
border: 1.5px solid #0064ff; | ||
position: relative; | ||
box-shadow: 0px 9px 18px rgba(0, 0, 0, 0.1); | ||
`; | ||
|
||
const Divider = styled.div` | ||
width: 675px; | ||
height: 0.75px; | ||
background-color: #d9d9d9; | ||
margin-top: 7.5px; | ||
margin-left: 22.5px; | ||
margin-right: auto; | ||
`; | ||
|
||
const Title = styled.h1` | ||
font-size: 27px; | ||
font-family: "Spoqa Han Sans Neo", "sans-serif"; | ||
font-weight: 700; | ||
margin-left: 23px; | ||
margin-top: 18px; | ||
`; | ||
|
||
const InputFieldsContainer = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
margin-top: 23px; | ||
margin-left: 97px; | ||
gap: 15px; | ||
width: 525px; | ||
`; | ||
|
||
const Button = styled.button` | ||
width: 210px; | ||
height: 45px; | ||
background-color: #3592ff; | ||
border-radius: 7.5px; | ||
color: white; | ||
font-size: 16.5px; | ||
border: none; | ||
cursor: pointer; | ||
position: absolute; | ||
font-family: "Spoqa Han Sans Neo", "sans-serif"; | ||
margin-top: 30px; | ||
left: 0; | ||
right: 0; | ||
margin-left: auto; | ||
margin-right: auto; | ||
`; | ||
|
||
const DoctorChart = () => { | ||
|
||
const gender = ["남성", "여성"]; | ||
|
||
const therapist = ["오민혁" , "오민혁", "오민혁"]; | ||
|
||
return ( | ||
<ChartContainer> | ||
<Title>환자 차트 작성</Title> | ||
<Divider /> | ||
<InputFieldsContainer> | ||
<InputText label="질병 분류 번호 *" /> | ||
<Dropdown label="성별 *" items={gender} /> | ||
</InputFieldsContainer> | ||
<InputFieldsContainer> | ||
<InputText label="환자 성함 *" /> | ||
<DateSelect labelText="환자 생년월일 *" /> | ||
</InputFieldsContainer> | ||
<InputFieldsContainer> | ||
<InputText label="환자 전화번호*" /> | ||
<Dropdown label="담당 치료사 *" items={therapist} /> | ||
</InputFieldsContainer> | ||
<InputFieldsContainer> | ||
<DateSelect labelText="다음 외래 일정 *" /> | ||
</InputFieldsContainer> | ||
<InputFieldsContainer> | ||
<InputTextLong label="진료 기록 작성*" /> | ||
</InputFieldsContainer> | ||
<InputFieldsContainer> | ||
<InputTextLong label="재활치료사 재활 운동 요청서 작성*" /> | ||
</InputFieldsContainer> | ||
<Button>작성하기</Button> | ||
</ChartContainer> | ||
); | ||
}; | ||
|
||
export default DoctorChart; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
import styled from 'styled-components'; | ||
import { useState, useRef, useEffect } from 'react'; | ||
import Datetime from 'react-datetime'; | ||
import IconCalender from '../../assets/icons/iconcalender.png'; | ||
import 'react-datetime/css/react-datetime.css'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
`; | ||
|
||
const DateInput = styled.input` | ||
box-sizing: border-box; | ||
width: 200px; | ||
height: 40px; | ||
border-radius: 10px; | ||
background-color: #FAFAFA; | ||
border: 1px solid #BBBBBB; | ||
margin-right: 10px; | ||
`; | ||
|
||
const CalendarButton = styled.button` | ||
width: 40px; | ||
height: 40px; | ||
background-color: #FAFAFA; | ||
cursor: pointer; | ||
border: none; | ||
color: white; | ||
border-radius: 10px; | ||
background-image: url(${IconCalender}); | ||
background-size: 25px 25px; | ||
background-repeat: no-repeat; | ||
background-position: center; | ||
border: 1px solid #BBBBBB; | ||
`; | ||
|
||
const CalendarModal = styled.div` | ||
position: fixed; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
z-index: 1000; | ||
`; | ||
|
||
const Overlay = styled.div` | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
background-color: rgba(0, 0, 0, 0.3); | ||
z-index: 999; | ||
`; | ||
|
||
const InputContainer = styled.div` | ||
display: flex; | ||
align-items: center; | ||
`; | ||
|
||
const Label = styled.label` | ||
font-family: 'Spoqa Han Sans Neo', 'sans-serif'; | ||
font-size: 16px; | ||
font-weight: 500; | ||
margin-bottom: 5px; | ||
`; | ||
|
||
const DateSelect = ({ labelText }) => { | ||
const [date, setDate] = useState(''); | ||
const [open, setOpen] = useState(false); | ||
|
||
const format = 'YYYY-MM-DD'; | ||
|
||
const handleClickButton = () => { | ||
setOpen(!open); | ||
}; | ||
|
||
const handleChangeCalendar = (selected) => { | ||
const formattedDate = selected.format(format); | ||
setDate(formattedDate); | ||
setOpen(false); | ||
}; | ||
|
||
const getSeparator = () => { | ||
const regex = /[^0-9a-zA-Z]+/; | ||
const match = format.match(regex); | ||
|
||
if (match) { | ||
const symbol = match[0]; | ||
const indexes = []; | ||
|
||
for (let i = 0; i < format.length; i++) { | ||
if (format[i] === symbol) { | ||
indexes.push(i); | ||
} | ||
} | ||
|
||
return { symbol, indexes }; | ||
} | ||
return { symbol: undefined, indexes: [] }; | ||
}; | ||
|
||
const separator = getSeparator(); | ||
|
||
const handleChangeDate = (e) => { | ||
let currentDate = e.target.value; | ||
|
||
if (separator.symbol && separator.indexes.length > 0) { | ||
separator.indexes.forEach((index) => { | ||
if (currentDate.length > index) { | ||
currentDate = | ||
currentDate.slice(0, index) + | ||
separator.symbol + | ||
currentDate.slice(index); | ||
} | ||
}); | ||
} | ||
|
||
setDate(currentDate); | ||
}; | ||
|
||
const modalRef = useRef(null); | ||
|
||
useEffect(() => { | ||
const handleClickOutside = (e) => { | ||
if (modalRef.current && !modalRef.current.contains(e.target)) { | ||
setOpen(false); | ||
} | ||
}; | ||
|
||
document.addEventListener("mousedown", handleClickOutside); | ||
return () => { | ||
document.removeEventListener("mousedown", handleClickOutside); | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<Container> | ||
{labelText && <Label>{labelText}</Label>} | ||
<InputContainer> | ||
<DateInput | ||
type='text' | ||
value={date} | ||
placeholder=' 날짜를 선택해주세요.' | ||
onChange={handleChangeDate} | ||
/> | ||
<CalendarButton type='button' onClick={handleClickButton} /> | ||
</InputContainer> | ||
{open && ( | ||
<> | ||
<Overlay onClick={() => setOpen(false)} /> | ||
<CalendarModal ref={modalRef}> | ||
<Datetime | ||
input={false} | ||
timeFormat={false} | ||
dateFormat={format} | ||
value={date} | ||
onChange={handleChangeCalendar} | ||
/> | ||
</CalendarModal> | ||
</> | ||
)} | ||
</Container> | ||
); | ||
}; | ||
|
||
DateSelect.propTypes = { | ||
labelText: PropTypes.string.isRequired | ||
}; | ||
|
||
export default DateSelect; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.