Skip to content

Commit

Permalink
Merge pull request #21 from osohyun0224/master
Browse files Browse the repository at this point in the history
[Feat/FE] 010 전문의가 확인하는 환자 차트 작성 페이지(신규 환자 등록)를 구현한다.
  • Loading branch information
osohyun0224 authored Sep 30, 2023
2 parents e5eca8c + 83df836 commit 9a8cd6c
Show file tree
Hide file tree
Showing 11 changed files with 2,640 additions and 1,907 deletions.
4,178 changes: 2,288 additions & 1,890 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@
"classnames": "^2.3.2",
"dayjs": "^1.11.10",
"js-cookie": "^3.0.5",
"moment": "^2.29.4",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-calendar": "^4.6.0",
"react-datetime": "^3.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.10.1",
"react-paginate": "^8.2.0",
"react-redux": "^8.1.2",
"react-router-dom": "^6.14.2",
"redux": "^4.2.1",
"styled-components": "^6.0.6"
"styled-components": "^6.0.8"
},
"devDependencies": {
"@types/react": "^18.2.14",
Expand Down
2 changes: 2 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import DevelopPage from './pages/DevelopPage.jsx';
import UserUntactReservePage from './pages/User/UserUntactReservePage.jsx';
import UserReservePage from './pages/User/UserReservePage.jsx';
import DoctorDashBoardPage from './pages/Doctor/DoctorDashBoardPage.jsx';
import DoctorChartPage from './pages/Doctor/DoctorChartPage.jsx';
import styled from "styled-components";
import "./App.scss";

Expand All @@ -26,6 +27,7 @@ function App() {
<Route path="/useruntactreserve" element={<UserUntactReservePage/>} />
<Route path="/userreserve" element={<UserReservePage />} />
<Route path="/doctordash" element={<DoctorDashBoardPage />} />
<Route path="/doctorchart" element={<DoctorChartPage />} />
</Routes>
</Container>
</Router>
Expand Down
Binary file added src/assets/icons/iconcalender.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
97 changes: 97 additions & 0 deletions src/components/DoctorDashBoard/DoctorChart.jsx
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;
7 changes: 4 additions & 3 deletions src/components/Dropdown/Dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import dropdownicon from "../../assets/icons/dropdownicon.png";
const Label = styled.div`
font-family: 'Spoqa Han Sans Neo', 'sans-serif';
font-weight: 500;
font-size: 12px;
font-size: 16px;
margin-bottom: 3.75px;
margin-top:-10px;
padding-top: 7.5px;
`;

const DropdownContainer = styled.div`
width: 240px;
width: 250px;
height: 37.5px;
background-color: #FFFFFF;
border: 0.75px solid #BBBBBB;
Expand All @@ -28,7 +29,7 @@ const DropdownText = styled.input`
border: none;
font-family: 'Spoqa Han Sans Neo', 'sans-serif';
font-weight: 500;
font-size: 12px;
font-size: 16px;
padding-left: 7.5px;
&:focus {
outline: none;
Expand Down
172 changes: 172 additions & 0 deletions src/components/Input/DateSelect.jsx
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;
16 changes: 11 additions & 5 deletions src/components/Input/InputTextLong.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ const InputContainer = styled.div`
display: flex;
flex-direction: column;
width: 320px;
margin-top:10px;
`;

const Label = styled.label`
font-family: 'Spoqa Han Sans Neo', 'sans-serif';
font-size: 16px;
font-weight: 500;
margin-bottom: 5px;
`;

const Input = styled.input`
width: 500px;
height: 100px;
width: 550px;
height: 133px;
border-radius: 10px;
background-color: #FAFAFA;
border: 1px solid #BBBBBB;
Expand All @@ -22,13 +27,14 @@ const Input = styled.input`
}
`;

function InputTextLong() {
function InputLongText({ label }) {
return (
<InputContainer>
<Label>{label}</Label>
<Input type="text" />
</InputContainer>
);
}

export { Input };
export default InputTextLong;
export default InputLongText;
8 changes: 1 addition & 7 deletions src/components/UntactReserve/UntactReserveModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ const DateText = styled.p`
margin-top: -10px;
`;

const ReasonText = styled.p`
font-size: 16px;
margin-top: 10px;
`;

const TimeButton = styled.button`
width: 90px;
height: 40px;
Expand Down Expand Up @@ -136,8 +131,7 @@ export const UntactReserveModal = ({ onClose }) => {
</TimeButton>
))}
</TimeButtonContainer>
<ReasonText>진료 희망 사유 *</ReasonText>
<InputTextLong/>
<InputTextLong label="진료 희망 사유*" />
<Button>예약 신청</Button>
</ModalContainer>
</Overlay>
Expand Down
Loading

0 comments on commit 9a8cd6c

Please sign in to comment.