박권수

feat. 처방 View 작업

This diff could not be displayed because it is too large.
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
18 "license": "ISC", 18 "license": "ISC",
19 "dependencies": { 19 "dependencies": {
20 "@koa/cors": "^3.1.0", 20 "@koa/cors": "^3.1.0",
21 + "firebase-admin": "^9.11.1",
21 "moment": "^2.29.1", 22 "moment": "^2.29.1",
22 "mqtt": "^4.2.6" 23 "mqtt": "^4.2.6"
23 }, 24 },
......
This diff could not be displayed because it is too large.
1 +import { client } from './client';
2 +
3 +export default {
4 + searchMedicine : (token : any, keyword : string) => {
5 + return client.get('/medicine', {
6 + headers : {
7 + Authorization : token,
8 + },
9 + params : {
10 + keyword,
11 + },
12 + });
13 + },
14 +}
...\ No newline at end of file ...\ No newline at end of file
...@@ -2,3 +2,4 @@ export { default as authApi } from './api-auth'; ...@@ -2,3 +2,4 @@ export { default as authApi } from './api-auth';
2 export { default as doctorApi } from './api-doctor'; 2 export { default as doctorApi } from './api-doctor';
3 export { default as managerApi } from './api-manager'; 3 export { default as managerApi } from './api-manager';
4 export { default as userApi } from './api-user'; 4 export { default as userApi } from './api-user';
5 +export { default as medicineApi } from './api-medicine';
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -96,7 +96,7 @@ const BottleInfoContainer = (props : BottleInfoProps) => { ...@@ -96,7 +96,7 @@ const BottleInfoContainer = (props : BottleInfoProps) => {
96 } else { 96 } else {
97 Alert.onError('접근 권한이 없습니다.', () => props.history.push('/')); 97 Alert.onError('접근 권한이 없습니다.', () => props.history.push('/'));
98 } 98 }
99 - } catch(e) { 99 + } catch(e : any) {
100 Alert.onError(e.response.data.error, () => props.history.push('/')); 100 Alert.onError(e.response.data.error, () => props.history.push('/'));
101 101
102 console.log(e); 102 console.log(e);
...@@ -122,7 +122,7 @@ const BottleInfoContainer = (props : BottleInfoProps) => { ...@@ -122,7 +122,7 @@ const BottleInfoContainer = (props : BottleInfoProps) => {
122 console.log(res); 122 console.log(res);
123 Alert.onError('피드백 등록에 실패했습니다.', () => null); 123 Alert.onError('피드백 등록에 실패했습니다.', () => null);
124 } 124 }
125 - } catch(e) { 125 + } catch(e : any) {
126 Alert.onError(e.response.data.error, () => fetchData()); 126 Alert.onError(e.response.data.error, () => fetchData());
127 } 127 }
128 } else { 128 } else {
......
...@@ -8,7 +8,7 @@ import * as recoilUtil from '../../../util/recoilUtil'; ...@@ -8,7 +8,7 @@ import * as recoilUtil from '../../../util/recoilUtil';
8 8
9 import * as Alert from '../../../util/alertMessage'; 9 import * as Alert from '../../../util/alertMessage';
10 10
11 -import { doctorApi, authApi } from '../../../api'; 11 +import { doctorApi, medicineApi } from '../../../api';
12 12
13 13
14 type DoctorMenuProps = RouteComponentProps 14 type DoctorMenuProps = RouteComponentProps
...@@ -48,6 +48,10 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { ...@@ -48,6 +48,10 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
48 const [newPatientSearchId, setNewPatientSearchId] = useState<string>(''); 48 const [newPatientSearchId, setNewPatientSearchId] = useState<string>('');
49 const [newPatientSearchResult, setNewPatientSearchResult] = useState<any | null>(null); 49 const [newPatientSearchResult, setNewPatientSearchResult] = useState<any | null>(null);
50 50
51 + const [prescribeModal, setPrescribeModal] = useState<boolean>(false);
52 + const [searchMedicineKeyword, setSearchMedicineKeyword] = useState<string>('');
53 + const [medicineInfo, setMedicineInfo] = useState<any>();
54 +
51 55
52 const fetchData = async() => { 56 const fetchData = async() => {
53 try { 57 try {
...@@ -134,7 +138,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { ...@@ -134,7 +138,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
134 Alert.onError('특이사항을 기록하는데 실패했습니다.', () => null); 138 Alert.onError('특이사항을 기록하는데 실패했습니다.', () => null);
135 } 139 }
136 140
137 - } catch(e) { 141 + } catch(e : any) {
138 Alert.onError(e.response.data.error, () => null); 142 Alert.onError(e.response.data.error, () => null);
139 } 143 }
140 }; 144 };
...@@ -162,7 +166,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { ...@@ -162,7 +166,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
162 Alert.onError('검색 결과가 없습니다.', () => null); 166 Alert.onError('검색 결과가 없습니다.', () => null);
163 setNewPatientSearchResult(null); 167 setNewPatientSearchResult(null);
164 }); 168 });
165 - } catch(e) { 169 + } catch(e : any) {
166 Alert.onError(e.response.data.error, () => null); 170 Alert.onError(e.response.data.error, () => null);
167 } 171 }
168 }; 172 };
...@@ -180,7 +184,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { ...@@ -180,7 +184,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
180 } else { 184 } else {
181 Alert.onError('환자에게 담당의 등록 요청을 실패했습니다.', () => null); 185 Alert.onError('환자에게 담당의 등록 요청을 실패했습니다.', () => null);
182 } 186 }
183 - } catch(e) { 187 + } catch(e : any) {
184 Alert.onError(e.response.data.error, () => null); 188 Alert.onError(e.response.data.error, () => null);
185 } 189 }
186 }; 190 };
...@@ -197,12 +201,29 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { ...@@ -197,12 +201,29 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
197 setNewPatientSearchResult(null); 201 setNewPatientSearchResult(null);
198 setEditModal(false); 202 setEditModal(false);
199 setEditPatientInfo(''); 203 setEditPatientInfo('');
204 + setPrescribeModal(false);
205 + setSearchMedicineKeyword('');
200 }; 206 };
201 207
202 const onGoBottleDetail = (bottleId : number) => { 208 const onGoBottleDetail = (bottleId : number) => {
203 props.history.push(`/bottle/${bottleId}`); 209 props.history.push(`/bottle/${bottleId}`);
204 }; 210 };
205 211
212 + const onSetSearchMedicineKeyword = (e : React.ChangeEvent<HTMLInputElement>) => {
213 + setSearchMedicineKeyword(e.target.value);
214 + };
215 +
216 + const searchMedicine = async() => {
217 + try {
218 + const res = await medicineApi.searchMedicine(token, searchMedicineKeyword);
219 + if(res.statusText === 'OK') {
220 + setMedicineInfo(res.data);
221 + }
222 + } catch(e : any) {
223 + Alert.onError(e.response.data.error, () => null);
224 + }
225 + };
226 +
206 227
207 useEffect(() => { 228 useEffect(() => {
208 if(!token || !token.length) { 229 if(!token || !token.length) {
...@@ -247,6 +268,13 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { ...@@ -247,6 +268,13 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
247 onRegisterNewPatient = {onRegisterNewPatient} 268 onRegisterNewPatient = {onRegisterNewPatient}
248 onCloseModal = {onCloseModal} 269 onCloseModal = {onCloseModal}
249 270
271 + prescribeModal = {prescribeModal}
272 + setPrescribeModal = {setPrescribeModal}
273 + searchMedicineKeyword = {searchMedicineKeyword}
274 + onSetSearchMedicineKeyword = {onSetSearchMedicineKeyword}
275 + medicineInfo = {medicineInfo}
276 + searchMedicine = {searchMedicine}
277 +
250 newPatientSearchResult = {newPatientSearchResult} 278 newPatientSearchResult = {newPatientSearchResult}
251 /> 279 />
252 ); 280 );
......
...@@ -3,6 +3,7 @@ import React from 'react'; ...@@ -3,6 +3,7 @@ import React from 'react';
3 import * as styled from './DoctorMenuStyled'; 3 import * as styled from './DoctorMenuStyled';
4 4
5 const medicineImg = '/static/img/medicine.png'; 5 const medicineImg = '/static/img/medicine.png';
6 +const addButton = '/static/img/plus.png';
6 const lensImg = '/static/img/lens.png'; 7 const lensImg = '/static/img/lens.png';
7 const closeButton = '/static/img/close.png'; 8 const closeButton = '/static/img/close.png';
8 const edit = '/static/img/edit.png'; 9 const edit = '/static/img/edit.png';
...@@ -42,6 +43,14 @@ interface DoctorMenuProps { ...@@ -42,6 +43,14 @@ interface DoctorMenuProps {
42 onCloseModal : () => void; 43 onCloseModal : () => void;
43 44
44 newPatientSearchResult : any; 45 newPatientSearchResult : any;
46 +
47 + prescribeModal : boolean;
48 + setPrescribeModal : any;
49 + searchMedicineKeyword : string;
50 + onSetSearchMedicineKeyword : React.ChangeEventHandler<HTMLInputElement>;
51 +
52 + medicineInfo : any;
53 + searchMedicine : () => void;
45 } 54 }
46 55
47 const DoctorMenuPresenter = (props : DoctorMenuProps) => { 56 const DoctorMenuPresenter = (props : DoctorMenuProps) => {
...@@ -158,10 +167,30 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => { ...@@ -158,10 +167,30 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => {
158 <styled.ModalClsButtonWrapper/> 167 <styled.ModalClsButtonWrapper/>
159 </styled.ModalContainer> : null 168 </styled.ModalContainer> : null
160 } 169 }
170 + {
171 + props.prescribeModal ?
172 + <styled.ModalContainer>
173 + <styled.ModalClsButtonWrapper>
174 + <styled.ModalClsButton
175 + onClick = {props.onCloseModal}
176 + >
177 + <styled.ModalClsButtonImg src = {closeButton}/>
178 + <styled.ModalClsButtonText>닫기</styled.ModalClsButtonText>
179 + </styled.ModalClsButton>
180 + </styled.ModalClsButtonWrapper>
181 + <styled.ModalContentWrapper>
182 + <styled.ModalContent>
183 +
184 + </styled.ModalContent>
185 + </styled.ModalContentWrapper>
186 + <styled.ModalClsButtonWrapper/>
187 + </styled.ModalContainer> : null
188 + }
161 <styled.InfoAndSearchWrapper> 189 <styled.InfoAndSearchWrapper>
162 <styled.InfoWrapper> 190 <styled.InfoWrapper>
163 { 191 {
164 props.info.infoType === 'DOCTOR' ? 192 props.info.infoType === 'DOCTOR' ?
193 + <>
165 <styled.InfoSquare> 194 <styled.InfoSquare>
166 <styled.InfoEachWrapper> 195 <styled.InfoEachWrapper>
167 <styled.InfoEachTopic>분야</styled.InfoEachTopic> 196 <styled.InfoEachTopic>분야</styled.InfoEachTopic>
...@@ -175,13 +204,20 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => { ...@@ -175,13 +204,20 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => {
175 <styled.InfoEachTopic>연락처</styled.InfoEachTopic> 204 <styled.InfoEachTopic>연락처</styled.InfoEachTopic>
176 <styled.InfoEachText>{props.info.contact}</styled.InfoEachText> 205 <styled.InfoEachText>{props.info.contact}</styled.InfoEachText>
177 </styled.InfoEachWrapper> 206 </styled.InfoEachWrapper>
178 - </styled.InfoSquare> : 207 + </styled.InfoSquare>
208 + <styled.NewPatientButton
209 + disabled = {true}
210 + >
211 + 내 정보
212 + </styled.NewPatientButton>
213 + </> :
214 + <>
179 <styled.InfoSquare> 215 <styled.InfoSquare>
180 <styled.EditPatientInfoButton 216 <styled.EditPatientInfoButton
181 onClick = {() => props.setEditModal(true)} 217 onClick = {() => props.setEditModal(true)}
182 > 218 >
183 <styled.EditPatientInfoButtonImg src = {edit}/> 219 <styled.EditPatientInfoButtonImg src = {edit}/>
184 - <styled.EditPatientInfoButtonText>수정</styled.EditPatientInfoButtonText> 220 + <styled.EditPatientInfoButtonText>특이사항</styled.EditPatientInfoButtonText>
185 </styled.EditPatientInfoButton> 221 </styled.EditPatientInfoButton>
186 <styled.InfoEachWrapper> 222 <styled.InfoEachWrapper>
187 <styled.InfoEachTopic>이름</styled.InfoEachTopic> 223 <styled.InfoEachTopic>이름</styled.InfoEachTopic>
...@@ -212,12 +248,13 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => { ...@@ -212,12 +248,13 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => {
212 </styled.PatientInfo> 248 </styled.PatientInfo>
213 </styled.InfoEachWrapper> 249 </styled.InfoEachWrapper>
214 </styled.InfoSquare> 250 </styled.InfoSquare>
215 - }
216 <styled.NewPatientButton 251 <styled.NewPatientButton
217 - onClick = {() => props.setNewPatientRegisterModal(true)} 252 + onClick = {() => props.setPrescribeModal(true)}
218 > 253 >
219 - 새 환자 등록 254 + 처방 하기
220 </styled.NewPatientButton> 255 </styled.NewPatientButton>
256 + </>
257 + }
221 </styled.InfoWrapper> 258 </styled.InfoWrapper>
222 <styled.SearchAndDetailWrapper> 259 <styled.SearchAndDetailWrapper>
223 <styled.SearchBarWrapper> 260 <styled.SearchBarWrapper>
...@@ -226,8 +263,10 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => { ...@@ -226,8 +263,10 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => {
226 value = {props.searchPatientKeyword} 263 value = {props.searchPatientKeyword}
227 onChange = {props.onSetKeyword} 264 onChange = {props.onSetKeyword}
228 /> 265 />
229 - <styled.SearchButton> 266 + <styled.SearchButton
230 - <styled.SearchButtonImg src = {lensImg}/> 267 + onClick = {() => props.setNewPatientRegisterModal(true)}
268 + >
269 + <styled.SearchButtonImg src = {addButton}/>
231 </styled.SearchButton> 270 </styled.SearchButton>
232 <styled.SearchButton 271 <styled.SearchButton
233 onClick = {props.onInitialize} 272 onClick = {props.onInitialize}
......