박권수

feat. 처방 View 작업

This diff could not be displayed because it is too large.
......@@ -18,6 +18,7 @@
"license": "ISC",
"dependencies": {
"@koa/cors": "^3.1.0",
"firebase-admin": "^9.11.1",
"moment": "^2.29.1",
"mqtt": "^4.2.6"
},
......
This diff could not be displayed because it is too large.
import { client } from './client';
export default {
searchMedicine : (token : any, keyword : string) => {
return client.get('/medicine', {
headers : {
Authorization : token,
},
params : {
keyword,
},
});
},
}
\ No newline at end of file
......@@ -2,3 +2,4 @@ export { default as authApi } from './api-auth';
export { default as doctorApi } from './api-doctor';
export { default as managerApi } from './api-manager';
export { default as userApi } from './api-user';
export { default as medicineApi } from './api-medicine';
\ No newline at end of file
......
......@@ -96,7 +96,7 @@ const BottleInfoContainer = (props : BottleInfoProps) => {
} else {
Alert.onError('접근 권한이 없습니다.', () => props.history.push('/'));
}
} catch(e) {
} catch(e : any) {
Alert.onError(e.response.data.error, () => props.history.push('/'));
console.log(e);
......@@ -122,7 +122,7 @@ const BottleInfoContainer = (props : BottleInfoProps) => {
console.log(res);
Alert.onError('피드백 등록에 실패했습니다.', () => null);
}
} catch(e) {
} catch(e : any) {
Alert.onError(e.response.data.error, () => fetchData());
}
} else {
......
......@@ -8,7 +8,7 @@ import * as recoilUtil from '../../../util/recoilUtil';
import * as Alert from '../../../util/alertMessage';
import { doctorApi, authApi } from '../../../api';
import { doctorApi, medicineApi } from '../../../api';
type DoctorMenuProps = RouteComponentProps
......@@ -48,6 +48,10 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
const [newPatientSearchId, setNewPatientSearchId] = useState<string>('');
const [newPatientSearchResult, setNewPatientSearchResult] = useState<any | null>(null);
const [prescribeModal, setPrescribeModal] = useState<boolean>(false);
const [searchMedicineKeyword, setSearchMedicineKeyword] = useState<string>('');
const [medicineInfo, setMedicineInfo] = useState<any>();
const fetchData = async() => {
try {
......@@ -134,7 +138,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
Alert.onError('특이사항을 기록하는데 실패했습니다.', () => null);
}
} catch(e) {
} catch(e : any) {
Alert.onError(e.response.data.error, () => null);
}
};
......@@ -162,7 +166,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
Alert.onError('검색 결과가 없습니다.', () => null);
setNewPatientSearchResult(null);
});
} catch(e) {
} catch(e : any) {
Alert.onError(e.response.data.error, () => null);
}
};
......@@ -180,7 +184,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
} else {
Alert.onError('환자에게 담당의 등록 요청을 실패했습니다.', () => null);
}
} catch(e) {
} catch(e : any) {
Alert.onError(e.response.data.error, () => null);
}
};
......@@ -197,12 +201,29 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
setNewPatientSearchResult(null);
setEditModal(false);
setEditPatientInfo('');
setPrescribeModal(false);
setSearchMedicineKeyword('');
};
const onGoBottleDetail = (bottleId : number) => {
props.history.push(`/bottle/${bottleId}`);
};
const onSetSearchMedicineKeyword = (e : React.ChangeEvent<HTMLInputElement>) => {
setSearchMedicineKeyword(e.target.value);
};
const searchMedicine = async() => {
try {
const res = await medicineApi.searchMedicine(token, searchMedicineKeyword);
if(res.statusText === 'OK') {
setMedicineInfo(res.data);
}
} catch(e : any) {
Alert.onError(e.response.data.error, () => null);
}
};
useEffect(() => {
if(!token || !token.length) {
......@@ -247,6 +268,13 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
onRegisterNewPatient = {onRegisterNewPatient}
onCloseModal = {onCloseModal}
prescribeModal = {prescribeModal}
setPrescribeModal = {setPrescribeModal}
searchMedicineKeyword = {searchMedicineKeyword}
onSetSearchMedicineKeyword = {onSetSearchMedicineKeyword}
medicineInfo = {medicineInfo}
searchMedicine = {searchMedicine}
newPatientSearchResult = {newPatientSearchResult}
/>
);
......
......@@ -3,6 +3,7 @@ import React from 'react';
import * as styled from './DoctorMenuStyled';
const medicineImg = '/static/img/medicine.png';
const addButton = '/static/img/plus.png';
const lensImg = '/static/img/lens.png';
const closeButton = '/static/img/close.png';
const edit = '/static/img/edit.png';
......@@ -42,6 +43,14 @@ interface DoctorMenuProps {
onCloseModal : () => void;
newPatientSearchResult : any;
prescribeModal : boolean;
setPrescribeModal : any;
searchMedicineKeyword : string;
onSetSearchMedicineKeyword : React.ChangeEventHandler<HTMLInputElement>;
medicineInfo : any;
searchMedicine : () => void;
}
const DoctorMenuPresenter = (props : DoctorMenuProps) => {
......@@ -158,10 +167,30 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => {
<styled.ModalClsButtonWrapper/>
</styled.ModalContainer> : null
}
{
props.prescribeModal ?
<styled.ModalContainer>
<styled.ModalClsButtonWrapper>
<styled.ModalClsButton
onClick = {props.onCloseModal}
>
<styled.ModalClsButtonImg src = {closeButton}/>
<styled.ModalClsButtonText>닫기</styled.ModalClsButtonText>
</styled.ModalClsButton>
</styled.ModalClsButtonWrapper>
<styled.ModalContentWrapper>
<styled.ModalContent>
</styled.ModalContent>
</styled.ModalContentWrapper>
<styled.ModalClsButtonWrapper/>
</styled.ModalContainer> : null
}
<styled.InfoAndSearchWrapper>
<styled.InfoWrapper>
{
props.info.infoType === 'DOCTOR' ?
<>
<styled.InfoSquare>
<styled.InfoEachWrapper>
<styled.InfoEachTopic>분야</styled.InfoEachTopic>
......@@ -175,13 +204,20 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => {
<styled.InfoEachTopic>연락처</styled.InfoEachTopic>
<styled.InfoEachText>{props.info.contact}</styled.InfoEachText>
</styled.InfoEachWrapper>
</styled.InfoSquare> :
</styled.InfoSquare>
<styled.NewPatientButton
disabled = {true}
>
내 정보
</styled.NewPatientButton>
</> :
<>
<styled.InfoSquare>
<styled.EditPatientInfoButton
onClick = {() => props.setEditModal(true)}
>
<styled.EditPatientInfoButtonImg src = {edit}/>
<styled.EditPatientInfoButtonText>수정</styled.EditPatientInfoButtonText>
<styled.EditPatientInfoButtonText>특이사항</styled.EditPatientInfoButtonText>
</styled.EditPatientInfoButton>
<styled.InfoEachWrapper>
<styled.InfoEachTopic>이름</styled.InfoEachTopic>
......@@ -212,12 +248,13 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => {
</styled.PatientInfo>
</styled.InfoEachWrapper>
</styled.InfoSquare>
}
<styled.NewPatientButton
onClick = {() => props.setNewPatientRegisterModal(true)}
onClick = {() => props.setPrescribeModal(true)}
>
새 환자 등록
처방 하기
</styled.NewPatientButton>
</>
}
</styled.InfoWrapper>
<styled.SearchAndDetailWrapper>
<styled.SearchBarWrapper>
......@@ -226,8 +263,10 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => {
value = {props.searchPatientKeyword}
onChange = {props.onSetKeyword}
/>
<styled.SearchButton>
<styled.SearchButtonImg src = {lensImg}/>
<styled.SearchButton
onClick = {() => props.setNewPatientRegisterModal(true)}
>
<styled.SearchButtonImg src = {addButton}/>
</styled.SearchButton>
<styled.SearchButton
onClick = {props.onInitialize}
......