박권수

feat. api수정으로 인한 field 변수 변경

......@@ -44,8 +44,8 @@ export default {
},
});
},
searchPatientById : (token : RecoilState<any>, patientId : string) => {
return client.get(`/doctor/patient/search/${patientId}`, {
searchPatientByContact : (token : RecoilState<any>, contact : string) => {
return client.get(`/doctor/patient/search/${contact}`, {
headers : {
Authorization : token,
},
......
......@@ -48,7 +48,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
const [editPatientInfo, setEditPatientInfo] = useState<string>('');
const [newPatientRegisterModal, setNewPatientRegisterModal] = useState<boolean>(false);
const [newPatientSearchId, setNewPatientSearchId] = useState<string>('');
const [newPatientSearchContact, setNewPatientSearchContact] = useState<string>('');
const [newPatientSearchResult, setNewPatientSearchResult] = useState<any | null>(null);
const [prescribeModal, setPrescribeModal] = useState<boolean>(false);
......@@ -56,7 +56,8 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
const [searchMedicineKeyword, setSearchMedicineKeyword] = useState<string>('');
const [medicineList, setMedicineList] = useState<any>([]);
const [prescribeMedicine, setPrescribeMedicine] = useState<any>(null);
const [dosage, setDosage] = useState<string>('1');
const [dailyDosage, setDailyDosage] = useState<string>('1');
const [totalDay, setTotalDay] = useState<string>('1');
const [qrcodeUrl, setQrcodeUrl] = useState<string | null>(null);
......@@ -99,7 +100,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
await doctorApi.getPatientDetail(token, patientId).then(res => {
setPatientDetail(res.data);
const birth = res.data.profile.birth.split('/');
const birth = res.data.profile.birth.split('-');
setInfo({
infoType : 'PATIENT',
userNm : res.data.profile.userNm,
......@@ -164,15 +165,15 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
};
const onSetNewPatientSearchId = (e : React.ChangeEvent<HTMLInputElement>) => {
setNewPatientSearchId(e.target.value);
const onSetNewPatientSearchContact = (e : React.ChangeEvent<HTMLInputElement>) => {
setNewPatientSearchContact(e.target.value);
};
const onSearchNewPatientByEmail = async () => {
const onSearchNewPatientByContact = async () => {
try {
setLoading(true);
await doctorApi.searchPatientById(token, newPatientSearchId).then(res => {
setNewPatientSearchResult(res.data);
await doctorApi.searchPatientByContact(token, newPatientSearchContact).then(res => {
setNewPatientSearchResult(res.data.patientInfo);
setLoading(false);
}).catch(err => {
console.log(err);
......@@ -188,11 +189,11 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
const onRegisterNewPatient = () => {
if(newPatientSearchResult) {
const { patientId, patientNm } = newPatientSearchResult;
const { userId, userNm } = newPatientSearchResult;
const onRegisterReq = async () => {
try {
const result = await doctorApi.registerPatient(token, {
patientId,
patientId : userId,
});
if(result.statusText === 'OK') {
Alert.onSuccess('환자에게 담당의 등록 요청을 전송했습니다.', () => null);
......@@ -204,7 +205,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
}
};
Alert.onCheck(`${patientNm} 환자에게 담당의 등록 요청을 전송하시겠습니까?`, onRegisterReq, () => null);
Alert.onCheck(`${userNm} 환자에게 담당의 등록 요청을 전송하시겠습니까?`, onRegisterReq, () => null);
} else {
Alert.onError('환자를 먼저 검색해주세요.', () => null);
}
......@@ -212,7 +213,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
const onCloseModal = async () => {
setNewPatientRegisterModal(false);
setNewPatientSearchId('');
setNewPatientSearchContact('');
setNewPatientSearchResult(null);
setEditModal(false);
setEditPatientInfo('');
......@@ -221,7 +222,8 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
setSearchMedicineKeyword('');
setMedicineList([]);
setPrescribeMedicine(null);
setDosage('1');
setDailyDosage('1');
setTotalDay('1');
};
const onGoBottleDetail = (bottleId : number) => {
......@@ -247,8 +249,12 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
}
};
const onSetDosage = (e : React.ChangeEvent<HTMLInputElement>) => {
setDosage(e.target.value);
const onSetDailyDosage = (e : React.ChangeEvent<HTMLInputElement>) => {
setDailyDosage(e.target.value);
};
const onSetTotalDay = (e : React.ChangeEvent<HTMLInputElement>) => {
setTotalDay(e.target.value);
};
const onSetNextStepPrescribe = () => {
......@@ -267,12 +273,14 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
const res = await doctorApi.prescribeMedicine(token, {
patientId : patientDetail.profile.userId,
medicineId : prescribeMedicine.medicineId,
dosage,
dailyDosage,
totalDosage : String(parseInt(totalDay) * parseInt(dailyDosage)),
});
if(res.statusText === 'OK') {
setQrcodeUrl(res.data.qrCode);
setLoading(false);
Alert.onSuccess('처방 정보가 생성 되었습니다.', () => onSetNextStepPrescribe());
}
} catch(e : any) {
setLoading(false);
......@@ -280,9 +288,8 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
}
};
Alert.onCheck(`${prescribeMedicine.name}(일 복용량:${dosage})\n을 처방하시겠습니까?`, async () => {
Alert.onCheck(`${prescribeMedicine.name}(일 복용량:${dailyDosage})\n을 ${totalDay}일동안 처방하시겠습니까?`, async () => {
await onPrescribeMedicine();
Alert.onSuccess('처방 정보가 생성 되었습니다.', () => onSetNextStepPrescribe());
}, () => null);
};
......@@ -342,9 +349,9 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
newPatientRegisterModal = {newPatientRegisterModal}
setNewPatientRegisterModal = {setNewPatientRegisterModal}
newPatientSearchId = {newPatientSearchId}
onSetNewPatientSearchId = {onSetNewPatientSearchId}
onSearchNewPatientByEmail = {onSearchNewPatientByEmail}
newPatientSearchContact = {newPatientSearchContact}
onSetNewPatientSearchContact = {onSetNewPatientSearchContact}
onSearchNewPatientByContact = {onSearchNewPatientByContact}
onRegisterNewPatient = {onRegisterNewPatient}
onCloseModal = {onCloseModal}
......@@ -358,8 +365,10 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
medicineList = {medicineList}
searchMedicine = {searchMedicine}
prescribeMedicine = {prescribeMedicine}
dosage = {dosage}
onSetDosage = {onSetDosage}
dailyDosage = {dailyDosage}
onSetDailyDosage = {onSetDailyDosage}
totalDay = {totalDay}
onSetTotalDay = {onSetTotalDay}
qrcodeUrl = {qrcodeUrl}
setPrescribeMedicine = {setPrescribeMedicine}
onPrescribeSubmit = {onPrescribeSubmit}
......
......@@ -39,9 +39,9 @@ interface DoctorMenuProps {
newPatientRegisterModal : boolean;
setNewPatientRegisterModal : any;
newPatientSearchId: string;
onSetNewPatientSearchId : React.ChangeEventHandler<HTMLInputElement>;
onSearchNewPatientByEmail : () => void;
newPatientSearchContact: string;
onSetNewPatientSearchContact : React.ChangeEventHandler<HTMLInputElement>;
onSearchNewPatientByContact : () => void;
onRegisterNewPatient : () => void;
onCloseModal : () => void;
......@@ -62,8 +62,10 @@ interface DoctorMenuProps {
prescribeMedicine : any;
setPrescribeMedicine : (arg0 : any) => void;
dosage : string;
onSetDosage : React.ChangeEventHandler<HTMLInputElement>;
dailyDosage : string;
onSetDailyDosage : React.ChangeEventHandler<HTMLInputElement>;
totalDay : string;
onSetTotalDay : React.ChangeEventHandler<HTMLInputElement>;
qrcodeUrl : string | null;
......@@ -82,12 +84,12 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => {
<styled.NewPatientRegisterTitle>새 환자 등록</styled.NewPatientRegisterTitle>
<styled.NewPatientSearchWrapper>
<styled.NewPatientSearchInput
placeholder = '환자 이메일을 입력하세요.'
value = {props.newPatientSearchId}
onChange = {props.onSetNewPatientSearchId}
placeholder = '환자의 연락처를 입력하세요.'
value = {props.newPatientSearchContact}
onChange = {props.onSetNewPatientSearchContact}
/>
<styled.NewPatientSearchButton
onClick = {props.onSearchNewPatientByEmail}
onClick = {props.onSearchNewPatientByContact}
>
<styled.NewPatientSearchButtonImg src = {lensImg}/>
</styled.NewPatientSearchButton>
......@@ -97,10 +99,18 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => {
props.newPatientSearchResult ?
<styled.NewPatientSearchResult>
<styled.NewPatientSearchResultInfoWrapper>
<styled.NewPatientSearchResultInfo>이름 : </styled.NewPatientSearchResultInfo>
<styled.NewPatientSearchResultInfo>
이름 :
<styled.NewPatientSearchResultInfoText>
{props.newPatientSearchResult.patientNm}
{props.newPatientSearchResult.userNm}
</styled.NewPatientSearchResultInfoText>
</styled.NewPatientSearchResultInfo>
<styled.NewPatientSearchResultInfo>
생년월일 :
<styled.NewPatientSearchResultInfoText>
{props.newPatientSearchResult.birth}
</styled.NewPatientSearchResultInfoText>
</styled.NewPatientSearchResultInfo>
</styled.NewPatientSearchResultInfoWrapper>
</styled.NewPatientSearchResult> :
'🤔검색 결과가 없습니다.'
......@@ -229,8 +239,17 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => {
*하루 복용량을 입력하세요.
</styled.MedicineDosageInfo>
<styled.MedicineDosageInput
value = {props.dosage}
onChange = {props.onSetDosage}
value = {props.dailyDosage}
onChange = {props.onSetDailyDosage}
min = {1}
max = {3}
/>
<styled.MedicineDosageInfo>
*총 며칠 분량인지 입력하세요.
</styled.MedicineDosageInfo>
<styled.MedicineDosageInput
value = {props.totalDay}
onChange = {props.onSetTotalDay}
/>
</styled.MedicineDosageSetWrapper>
:
......
......@@ -89,14 +89,18 @@ export const NewPatientSearchResult = styled.div `
export const NewPatientSearchResultInfoWrapper = styled.div `
display : flex;
flex-direction : column;
`;
export const NewPatientSearchResultInfo = styled.div `
display : flex;
flex-direction : row;
font-size : 13px;
font-weight : 600;
color : #a0a0a0;
margin : 0 5px 0 0;
margin : 0 5px 0 5px;
`;
export const NewPatientSearchResultInfoText = styled.div `
......@@ -104,6 +108,8 @@ export const NewPatientSearchResultInfoText = styled.div `
color : #343434;
font-weight : 600;
letter-spacing : 1px;
margin : 0 0 0 5px;
`;
export const NewPatientRegisterButtonWrapper = styled.div `
......@@ -413,7 +419,7 @@ export const MedicineDosageInfo = styled.div `
color : #a0a0a0;
width : 100%;
margin : 0 0 20px 0;
margin : 10px 0 10px 0;
border : none;
background-color : transparent;
......@@ -423,9 +429,8 @@ export const MedicineDosageInfo = styled.div `
export const MedicineDosageInput = styled.input.attrs({
type : 'number',
min : '1',
max : '3',
}) `
margin : 0 0 10px 0;
width : 40%;
padding : 10px 20px;
......