Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
RIT_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박권수
2021-09-21 02:11:03 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
588fd6df67aece0c81d458b86a40653c037b87f7
588fd6df
1 parent
35cc21b7
feat. qrcode front -> backend api
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
9 deletions
web/src/api/api-doctor.ts
web/src/views/main/doctor/DoctorMenuContainer.tsx
web/src/views/main/doctor/DoctorMenuPresenter.tsx
web/src/api/api-doctor.ts
View file @
588fd6d
...
...
@@ -65,4 +65,11 @@ export default {
},
});
},
prescribeMedicine
:
(
token
:
RecoilState
<
any
>
,
Data
:
any
)
=>
{
return
client
.
post
(
'/doctor/prescribe'
,
Data
,
{
headers
:
{
Authorization
:
token
,
},
});
},
};
\ No newline at end of file
...
...
web/src/views/main/doctor/DoctorMenuContainer.tsx
View file @
588fd6d
...
...
@@ -10,11 +10,8 @@ import * as Alert from '../../../util/alertMessage';
import { doctorApi, medicineApi } from '../../../api';
import QRCode from 'qrcode';
//toDo : Generate QR Code By Medicine Id
type DoctorMenuProps = RouteComponentProps
const DoctorMenuContainer = (props : DoctorMenuProps) => {
...
...
@@ -264,19 +261,36 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => {
};
const onPrescribeSubmit = async() => {
const onPrescribeMedicine = async () => {
setLoading(true);
try {
const res = await doctorApi.prescribeMedicine(token, {
patientId : patientDetail.profile.userId,
medicineId : prescribeMedicine.medicineId,
dosage,
});
if(res.statusText === 'OK') {
setQrcodeUrl(res.data.qrCode);
setLoading(false);
}
} catch(e : any) {
setLoading(false);
Alert.onError(e.response.data.error, () => null);
}
};
Alert.onCheck(`${prescribeMedicine.name}(일 복용량:${dosage})\n을 처방하시겠습니까?`, async () => {
setQrcodeUrl(await QRCode.toDataURL(`${prescribeMedicine.name}/${prescribeMedicine.medicineId}/${dosage}/${userId}`, {
type : "image/png",
color : { dark : '#337DFF', light : '#FFF' },
}));
await onPrescribeMedicine();
Alert.onSuccess('처방 정보가 생성 되었습니다.', () => onSetNextStepPrescribe());
}, () => null);
};
const onPrintQrcode = async(divId : string) => {
const printContent : any = document.getElementById(divId);
const windowOpen : any = window.open('', '
PrintQRCode
');
const windowOpen : any = window.open('', '
_blank
');
//toDo : 현재 인증되지 않은 사용자(=http)이기 때문에, GCS에서 signed url을 불러와도 만료되어, 이미지가 정상 표시 안됨 : 해결 필요
windowOpen.document.writeln(printContent.innerHTML);
windowOpen.document.close();
windowOpen.focus();
...
...
web/src/views/main/doctor/DoctorMenuPresenter.tsx
View file @
588fd6d
...
...
@@ -242,7 +242,8 @@ const DoctorMenuPresenter = (props : DoctorMenuProps) => {
</styled.MedicineQRCodeInfo>
{
props.qrcodeUrl ?
<styled.MedicineQRCode src = {props.qrcodeUrl}/> : null
<styled.MedicineQRCode
src = {props.qrcodeUrl}/> : null
}
</styled.MedicineQRCodeWrapper>
}
...
...
Please
register
or
login
to post a comment