Showing
4 changed files
with
75 additions
and
42 deletions
... | @@ -44,8 +44,8 @@ export default { | ... | @@ -44,8 +44,8 @@ export default { |
44 | }, | 44 | }, |
45 | }); | 45 | }); |
46 | }, | 46 | }, |
47 | - searchPatientById : (token : RecoilState<any>, patientId : string) => { | 47 | + searchPatientByContact : (token : RecoilState<any>, contact : string) => { |
48 | - return client.get(`/doctor/patient/search/${patientId}`, { | 48 | + return client.get(`/doctor/patient/search/${contact}`, { |
49 | headers : { | 49 | headers : { |
50 | Authorization : token, | 50 | Authorization : token, |
51 | }, | 51 | }, | ... | ... |
... | @@ -48,7 +48,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { | ... | @@ -48,7 +48,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { |
48 | const [editPatientInfo, setEditPatientInfo] = useState<string>(''); | 48 | const [editPatientInfo, setEditPatientInfo] = useState<string>(''); |
49 | 49 | ||
50 | const [newPatientRegisterModal, setNewPatientRegisterModal] = useState<boolean>(false); | 50 | const [newPatientRegisterModal, setNewPatientRegisterModal] = useState<boolean>(false); |
51 | - const [newPatientSearchId, setNewPatientSearchId] = useState<string>(''); | 51 | + const [newPatientSearchContact, setNewPatientSearchContact] = useState<string>(''); |
52 | const [newPatientSearchResult, setNewPatientSearchResult] = useState<any | null>(null); | 52 | const [newPatientSearchResult, setNewPatientSearchResult] = useState<any | null>(null); |
53 | 53 | ||
54 | const [prescribeModal, setPrescribeModal] = useState<boolean>(false); | 54 | const [prescribeModal, setPrescribeModal] = useState<boolean>(false); |
... | @@ -56,7 +56,8 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { | ... | @@ -56,7 +56,8 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { |
56 | const [searchMedicineKeyword, setSearchMedicineKeyword] = useState<string>(''); | 56 | const [searchMedicineKeyword, setSearchMedicineKeyword] = useState<string>(''); |
57 | const [medicineList, setMedicineList] = useState<any>([]); | 57 | const [medicineList, setMedicineList] = useState<any>([]); |
58 | const [prescribeMedicine, setPrescribeMedicine] = useState<any>(null); | 58 | const [prescribeMedicine, setPrescribeMedicine] = useState<any>(null); |
59 | - const [dosage, setDosage] = useState<string>('1'); | 59 | + const [dailyDosage, setDailyDosage] = useState<string>('1'); |
60 | + const [totalDay, setTotalDay] = useState<string>('1'); | ||
60 | 61 | ||
61 | const [qrcodeUrl, setQrcodeUrl] = useState<string | null>(null); | 62 | const [qrcodeUrl, setQrcodeUrl] = useState<string | null>(null); |
62 | 63 | ||
... | @@ -99,7 +100,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { | ... | @@ -99,7 +100,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { |
99 | await doctorApi.getPatientDetail(token, patientId).then(res => { | 100 | await doctorApi.getPatientDetail(token, patientId).then(res => { |
100 | setPatientDetail(res.data); | 101 | setPatientDetail(res.data); |
101 | 102 | ||
102 | - const birth = res.data.profile.birth.split('/'); | 103 | + const birth = res.data.profile.birth.split('-'); |
103 | setInfo({ | 104 | setInfo({ |
104 | infoType : 'PATIENT', | 105 | infoType : 'PATIENT', |
105 | userNm : res.data.profile.userNm, | 106 | userNm : res.data.profile.userNm, |
... | @@ -164,15 +165,15 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { | ... | @@ -164,15 +165,15 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { |
164 | }; | 165 | }; |
165 | 166 | ||
166 | 167 | ||
167 | - const onSetNewPatientSearchId = (e : React.ChangeEvent<HTMLInputElement>) => { | 168 | + const onSetNewPatientSearchContact = (e : React.ChangeEvent<HTMLInputElement>) => { |
168 | - setNewPatientSearchId(e.target.value); | 169 | + setNewPatientSearchContact(e.target.value); |
169 | }; | 170 | }; |
170 | 171 | ||
171 | - const onSearchNewPatientByEmail = async () => { | 172 | + const onSearchNewPatientByContact = async () => { |
172 | try { | 173 | try { |
173 | setLoading(true); | 174 | setLoading(true); |
174 | - await doctorApi.searchPatientById(token, newPatientSearchId).then(res => { | 175 | + await doctorApi.searchPatientByContact(token, newPatientSearchContact).then(res => { |
175 | - setNewPatientSearchResult(res.data); | 176 | + setNewPatientSearchResult(res.data.patientInfo); |
176 | setLoading(false); | 177 | setLoading(false); |
177 | }).catch(err => { | 178 | }).catch(err => { |
178 | console.log(err); | 179 | console.log(err); |
... | @@ -188,11 +189,11 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { | ... | @@ -188,11 +189,11 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { |
188 | 189 | ||
189 | const onRegisterNewPatient = () => { | 190 | const onRegisterNewPatient = () => { |
190 | if(newPatientSearchResult) { | 191 | if(newPatientSearchResult) { |
191 | - const { patientId, patientNm } = newPatientSearchResult; | 192 | + const { userId, userNm } = newPatientSearchResult; |
192 | const onRegisterReq = async () => { | 193 | const onRegisterReq = async () => { |
193 | try { | 194 | try { |
194 | const result = await doctorApi.registerPatient(token, { | 195 | const result = await doctorApi.registerPatient(token, { |
195 | - patientId, | 196 | + patientId : userId, |
196 | }); | 197 | }); |
197 | if(result.statusText === 'OK') { | 198 | if(result.statusText === 'OK') { |
198 | Alert.onSuccess('환자에게 담당의 등록 요청을 전송했습니다.', () => null); | 199 | Alert.onSuccess('환자에게 담당의 등록 요청을 전송했습니다.', () => null); |
... | @@ -204,7 +205,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { | ... | @@ -204,7 +205,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { |
204 | } | 205 | } |
205 | }; | 206 | }; |
206 | 207 | ||
207 | - Alert.onCheck(`${patientNm} 환자에게 담당의 등록 요청을 전송하시겠습니까?`, onRegisterReq, () => null); | 208 | + Alert.onCheck(`${userNm} 환자에게 담당의 등록 요청을 전송하시겠습니까?`, onRegisterReq, () => null); |
208 | } else { | 209 | } else { |
209 | Alert.onError('환자를 먼저 검색해주세요.', () => null); | 210 | Alert.onError('환자를 먼저 검색해주세요.', () => null); |
210 | } | 211 | } |
... | @@ -212,7 +213,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { | ... | @@ -212,7 +213,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { |
212 | 213 | ||
213 | const onCloseModal = async () => { | 214 | const onCloseModal = async () => { |
214 | setNewPatientRegisterModal(false); | 215 | setNewPatientRegisterModal(false); |
215 | - setNewPatientSearchId(''); | 216 | + setNewPatientSearchContact(''); |
216 | setNewPatientSearchResult(null); | 217 | setNewPatientSearchResult(null); |
217 | setEditModal(false); | 218 | setEditModal(false); |
218 | setEditPatientInfo(''); | 219 | setEditPatientInfo(''); |
... | @@ -221,7 +222,8 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { | ... | @@ -221,7 +222,8 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { |
221 | setSearchMedicineKeyword(''); | 222 | setSearchMedicineKeyword(''); |
222 | setMedicineList([]); | 223 | setMedicineList([]); |
223 | setPrescribeMedicine(null); | 224 | setPrescribeMedicine(null); |
224 | - setDosage('1'); | 225 | + setDailyDosage('1'); |
226 | + setTotalDay('1'); | ||
225 | }; | 227 | }; |
226 | 228 | ||
227 | const onGoBottleDetail = (bottleId : number) => { | 229 | const onGoBottleDetail = (bottleId : number) => { |
... | @@ -247,8 +249,12 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { | ... | @@ -247,8 +249,12 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { |
247 | } | 249 | } |
248 | }; | 250 | }; |
249 | 251 | ||
250 | - const onSetDosage = (e : React.ChangeEvent<HTMLInputElement>) => { | 252 | + const onSetDailyDosage = (e : React.ChangeEvent<HTMLInputElement>) => { |
251 | - setDosage(e.target.value); | 253 | + setDailyDosage(e.target.value); |
254 | + }; | ||
255 | + | ||
256 | + const onSetTotalDay = (e : React.ChangeEvent<HTMLInputElement>) => { | ||
257 | + setTotalDay(e.target.value); | ||
252 | }; | 258 | }; |
253 | 259 | ||
254 | const onSetNextStepPrescribe = () => { | 260 | const onSetNextStepPrescribe = () => { |
... | @@ -267,12 +273,14 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { | ... | @@ -267,12 +273,14 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { |
267 | const res = await doctorApi.prescribeMedicine(token, { | 273 | const res = await doctorApi.prescribeMedicine(token, { |
268 | patientId : patientDetail.profile.userId, | 274 | patientId : patientDetail.profile.userId, |
269 | medicineId : prescribeMedicine.medicineId, | 275 | medicineId : prescribeMedicine.medicineId, |
270 | - dosage, | 276 | + dailyDosage, |
277 | + totalDosage : String(parseInt(totalDay) * parseInt(dailyDosage)), | ||
271 | }); | 278 | }); |
272 | 279 | ||
273 | if(res.statusText === 'OK') { | 280 | if(res.statusText === 'OK') { |
274 | setQrcodeUrl(res.data.qrCode); | 281 | setQrcodeUrl(res.data.qrCode); |
275 | setLoading(false); | 282 | setLoading(false); |
283 | + Alert.onSuccess('처방 정보가 생성 되었습니다.', () => onSetNextStepPrescribe()); | ||
276 | } | 284 | } |
277 | } catch(e : any) { | 285 | } catch(e : any) { |
278 | setLoading(false); | 286 | setLoading(false); |
... | @@ -280,9 +288,8 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { | ... | @@ -280,9 +288,8 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { |
280 | } | 288 | } |
281 | }; | 289 | }; |
282 | 290 | ||
283 | - Alert.onCheck(`${prescribeMedicine.name}(일 복용량:${dosage})\n을 처방하시겠습니까?`, async () => { | 291 | + Alert.onCheck(`${prescribeMedicine.name}(일 복용량:${dailyDosage})\n을 ${totalDay}일동안 처방하시겠습니까?`, async () => { |
284 | await onPrescribeMedicine(); | 292 | await onPrescribeMedicine(); |
285 | - Alert.onSuccess('처방 정보가 생성 되었습니다.', () => onSetNextStepPrescribe()); | ||
286 | }, () => null); | 293 | }, () => null); |
287 | }; | 294 | }; |
288 | 295 | ||
... | @@ -342,9 +349,9 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { | ... | @@ -342,9 +349,9 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { |
342 | 349 | ||
343 | newPatientRegisterModal = {newPatientRegisterModal} | 350 | newPatientRegisterModal = {newPatientRegisterModal} |
344 | setNewPatientRegisterModal = {setNewPatientRegisterModal} | 351 | setNewPatientRegisterModal = {setNewPatientRegisterModal} |
345 | - newPatientSearchId = {newPatientSearchId} | 352 | + newPatientSearchContact = {newPatientSearchContact} |
346 | - onSetNewPatientSearchId = {onSetNewPatientSearchId} | 353 | + onSetNewPatientSearchContact = {onSetNewPatientSearchContact} |
347 | - onSearchNewPatientByEmail = {onSearchNewPatientByEmail} | 354 | + onSearchNewPatientByContact = {onSearchNewPatientByContact} |
348 | onRegisterNewPatient = {onRegisterNewPatient} | 355 | onRegisterNewPatient = {onRegisterNewPatient} |
349 | onCloseModal = {onCloseModal} | 356 | onCloseModal = {onCloseModal} |
350 | 357 | ||
... | @@ -358,8 +365,10 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { | ... | @@ -358,8 +365,10 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { |
358 | medicineList = {medicineList} | 365 | medicineList = {medicineList} |
359 | searchMedicine = {searchMedicine} | 366 | searchMedicine = {searchMedicine} |
360 | prescribeMedicine = {prescribeMedicine} | 367 | prescribeMedicine = {prescribeMedicine} |
361 | - dosage = {dosage} | 368 | + dailyDosage = {dailyDosage} |
362 | - onSetDosage = {onSetDosage} | 369 | + onSetDailyDosage = {onSetDailyDosage} |
370 | + totalDay = {totalDay} | ||
371 | + onSetTotalDay = {onSetTotalDay} | ||
363 | qrcodeUrl = {qrcodeUrl} | 372 | qrcodeUrl = {qrcodeUrl} |
364 | setPrescribeMedicine = {setPrescribeMedicine} | 373 | setPrescribeMedicine = {setPrescribeMedicine} |
365 | onPrescribeSubmit = {onPrescribeSubmit} | 374 | onPrescribeSubmit = {onPrescribeSubmit} | ... | ... |
... | @@ -39,9 +39,9 @@ interface DoctorMenuProps { | ... | @@ -39,9 +39,9 @@ interface DoctorMenuProps { |
39 | 39 | ||
40 | newPatientRegisterModal : boolean; | 40 | newPatientRegisterModal : boolean; |
41 | setNewPatientRegisterModal : any; | 41 | setNewPatientRegisterModal : any; |
42 | - newPatientSearchId: string; | 42 | + newPatientSearchContact: string; |
43 | - onSetNewPatientSearchId : React.ChangeEventHandler<HTMLInputElement>; | 43 | + onSetNewPatientSearchContact : React.ChangeEventHandler<HTMLInputElement>; |
44 | - onSearchNewPatientByEmail : () => void; | 44 | + onSearchNewPatientByContact : () => void; |
45 | onRegisterNewPatient : () => void; | 45 | onRegisterNewPatient : () => void; |
46 | onCloseModal : () => void; | 46 | onCloseModal : () => void; |
47 | 47 | ||
... | @@ -62,8 +62,10 @@ interface DoctorMenuProps { | ... | @@ -62,8 +62,10 @@ interface DoctorMenuProps { |
62 | prescribeMedicine : any; | 62 | prescribeMedicine : any; |
63 | setPrescribeMedicine : (arg0 : any) => void; | 63 | setPrescribeMedicine : (arg0 : any) => void; |
64 | 64 | ||
65 | - dosage : string; | 65 | + dailyDosage : string; |
66 | - onSetDosage : React.ChangeEventHandler<HTMLInputElement>; | 66 | + onSetDailyDosage : React.ChangeEventHandler<HTMLInputElement>; |
67 | + totalDay : string; | ||
68 | + onSetTotalDay : React.ChangeEventHandler<HTMLInputElement>; | ||
67 | 69 | ||
68 | qrcodeUrl : string | null; | 70 | qrcodeUrl : string | null; |
69 | 71 | ||
... | @@ -82,12 +84,12 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => { | ... | @@ -82,12 +84,12 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => { |
82 | <styled.NewPatientRegisterTitle>새 환자 등록</styled.NewPatientRegisterTitle> | 84 | <styled.NewPatientRegisterTitle>새 환자 등록</styled.NewPatientRegisterTitle> |
83 | <styled.NewPatientSearchWrapper> | 85 | <styled.NewPatientSearchWrapper> |
84 | <styled.NewPatientSearchInput | 86 | <styled.NewPatientSearchInput |
85 | - placeholder = '환자 이메일을 입력하세요.' | 87 | + placeholder = '환자의 연락처를 입력하세요.' |
86 | - value = {props.newPatientSearchId} | 88 | + value = {props.newPatientSearchContact} |
87 | - onChange = {props.onSetNewPatientSearchId} | 89 | + onChange = {props.onSetNewPatientSearchContact} |
88 | /> | 90 | /> |
89 | <styled.NewPatientSearchButton | 91 | <styled.NewPatientSearchButton |
90 | - onClick = {props.onSearchNewPatientByEmail} | 92 | + onClick = {props.onSearchNewPatientByContact} |
91 | > | 93 | > |
92 | <styled.NewPatientSearchButtonImg src = {lensImg}/> | 94 | <styled.NewPatientSearchButtonImg src = {lensImg}/> |
93 | </styled.NewPatientSearchButton> | 95 | </styled.NewPatientSearchButton> |
... | @@ -97,10 +99,18 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => { | ... | @@ -97,10 +99,18 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => { |
97 | props.newPatientSearchResult ? | 99 | props.newPatientSearchResult ? |
98 | <styled.NewPatientSearchResult> | 100 | <styled.NewPatientSearchResult> |
99 | <styled.NewPatientSearchResultInfoWrapper> | 101 | <styled.NewPatientSearchResultInfoWrapper> |
100 | - <styled.NewPatientSearchResultInfo>이름 : </styled.NewPatientSearchResultInfo> | 102 | + <styled.NewPatientSearchResultInfo> |
103 | + 이름 : | ||
101 | <styled.NewPatientSearchResultInfoText> | 104 | <styled.NewPatientSearchResultInfoText> |
102 | - {props.newPatientSearchResult.patientNm} | 105 | + {props.newPatientSearchResult.userNm} |
103 | </styled.NewPatientSearchResultInfoText> | 106 | </styled.NewPatientSearchResultInfoText> |
107 | + </styled.NewPatientSearchResultInfo> | ||
108 | + <styled.NewPatientSearchResultInfo> | ||
109 | + 생년월일 : | ||
110 | + <styled.NewPatientSearchResultInfoText> | ||
111 | + {props.newPatientSearchResult.birth} | ||
112 | + </styled.NewPatientSearchResultInfoText> | ||
113 | + </styled.NewPatientSearchResultInfo> | ||
104 | </styled.NewPatientSearchResultInfoWrapper> | 114 | </styled.NewPatientSearchResultInfoWrapper> |
105 | </styled.NewPatientSearchResult> : | 115 | </styled.NewPatientSearchResult> : |
106 | '🤔검색 결과가 없습니다.' | 116 | '🤔검색 결과가 없습니다.' |
... | @@ -229,8 +239,17 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => { | ... | @@ -229,8 +239,17 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => { |
229 | *하루 복용량을 입력하세요. | 239 | *하루 복용량을 입력하세요. |
230 | </styled.MedicineDosageInfo> | 240 | </styled.MedicineDosageInfo> |
231 | <styled.MedicineDosageInput | 241 | <styled.MedicineDosageInput |
232 | - value = {props.dosage} | 242 | + value = {props.dailyDosage} |
233 | - onChange = {props.onSetDosage} | 243 | + onChange = {props.onSetDailyDosage} |
244 | + min = {1} | ||
245 | + max = {3} | ||
246 | + /> | ||
247 | + <styled.MedicineDosageInfo> | ||
248 | + *총 며칠 분량인지 입력하세요. | ||
249 | + </styled.MedicineDosageInfo> | ||
250 | + <styled.MedicineDosageInput | ||
251 | + value = {props.totalDay} | ||
252 | + onChange = {props.onSetTotalDay} | ||
234 | /> | 253 | /> |
235 | </styled.MedicineDosageSetWrapper> | 254 | </styled.MedicineDosageSetWrapper> |
236 | : | 255 | : | ... | ... |
... | @@ -89,14 +89,18 @@ export const NewPatientSearchResult = styled.div ` | ... | @@ -89,14 +89,18 @@ export const NewPatientSearchResult = styled.div ` |
89 | 89 | ||
90 | export const NewPatientSearchResultInfoWrapper = styled.div ` | 90 | export const NewPatientSearchResultInfoWrapper = styled.div ` |
91 | display : flex; | 91 | display : flex; |
92 | + flex-direction : column; | ||
92 | `; | 93 | `; |
93 | 94 | ||
94 | export const NewPatientSearchResultInfo = styled.div ` | 95 | export const NewPatientSearchResultInfo = styled.div ` |
96 | + display : flex; | ||
97 | + flex-direction : row; | ||
98 | + | ||
95 | font-size : 13px; | 99 | font-size : 13px; |
96 | font-weight : 600; | 100 | font-weight : 600; |
97 | color : #a0a0a0; | 101 | color : #a0a0a0; |
98 | 102 | ||
99 | - margin : 0 5px 0 0; | 103 | + margin : 0 5px 0 5px; |
100 | `; | 104 | `; |
101 | 105 | ||
102 | export const NewPatientSearchResultInfoText = styled.div ` | 106 | export const NewPatientSearchResultInfoText = styled.div ` |
... | @@ -104,6 +108,8 @@ export const NewPatientSearchResultInfoText = styled.div ` | ... | @@ -104,6 +108,8 @@ export const NewPatientSearchResultInfoText = styled.div ` |
104 | color : #343434; | 108 | color : #343434; |
105 | font-weight : 600; | 109 | font-weight : 600; |
106 | letter-spacing : 1px; | 110 | letter-spacing : 1px; |
111 | + | ||
112 | + margin : 0 0 0 5px; | ||
107 | `; | 113 | `; |
108 | 114 | ||
109 | export const NewPatientRegisterButtonWrapper = styled.div ` | 115 | export const NewPatientRegisterButtonWrapper = styled.div ` |
... | @@ -413,7 +419,7 @@ export const MedicineDosageInfo = styled.div ` | ... | @@ -413,7 +419,7 @@ export const MedicineDosageInfo = styled.div ` |
413 | color : #a0a0a0; | 419 | color : #a0a0a0; |
414 | 420 | ||
415 | width : 100%; | 421 | width : 100%; |
416 | - margin : 0 0 20px 0; | 422 | + margin : 10px 0 10px 0; |
417 | 423 | ||
418 | border : none; | 424 | border : none; |
419 | background-color : transparent; | 425 | background-color : transparent; |
... | @@ -423,9 +429,8 @@ export const MedicineDosageInfo = styled.div ` | ... | @@ -423,9 +429,8 @@ export const MedicineDosageInfo = styled.div ` |
423 | 429 | ||
424 | export const MedicineDosageInput = styled.input.attrs({ | 430 | export const MedicineDosageInput = styled.input.attrs({ |
425 | type : 'number', | 431 | type : 'number', |
426 | - min : '1', | ||
427 | - max : '3', | ||
428 | }) ` | 432 | }) ` |
433 | + margin : 0 0 10px 0; | ||
429 | width : 40%; | 434 | width : 40%; |
430 | 435 | ||
431 | padding : 10px 20px; | 436 | padding : 10px 20px; | ... | ... |
-
Please register or login to post a comment