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-08-19 17:28:03 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
72a856af5ed5667b44603e5add5c07a109795ad7
72a856af
1 parent
f7d8d4f0
feat. api return type change
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
91 additions
and
18 deletions
server/src/api/bottle/bottle.ctrl.js
server/src/api/doctor/doctor.ctrl.js
server/src/api/hub/hub.ctrl.js
server/src/api/manage/manage.ctrl.js
server/src/api/medicine/medicine.ctrl.js
server/src/api/user/user.ctrl.js
server/src/api/bottle/bottle.ctrl.js
View file @
72a856a
...
...
@@ -155,7 +155,9 @@ exports.getBottleInfo = async(ctx) => {
.
populate
(
'bmId'
);
ctx
.
status
=
200
;
ctx
.
body
=
takeMedicineHist
;
ctx
.
body
=
{
takeMedicineHist
,
};
}
else
{
ctx
.
status
=
404
;
...
...
@@ -371,7 +373,9 @@ exports.getHubsBottleList = async(ctx) => {
}
ctx
.
status
=
200
;
ctx
.
body
=
bottleList
;
ctx
.
body
=
{
bottleList
,
};
};
...
...
@@ -399,6 +403,8 @@ exports.getAllBottleList = async ctx => {
}));
ctx
.
status
=
200
;
ctx
.
body
=
bottleList
;
ctx
.
body
=
{
bottleList
};
};
\ No newline at end of file
...
...
server/src/api/doctor/doctor.ctrl.js
View file @
72a856a
...
...
@@ -47,7 +47,9 @@ exports.getDoctorsInfo = async ctx => {
}
ctx
.
status
=
200
;
ctx
.
body
=
doctorInfo
.
info
;
ctx
.
body
=
{
doctorInfo
:
doctorInfo
.
info
};
};
...
...
@@ -68,19 +70,24 @@ exports.getPatientList = async ctx => {
const
user
=
await
User
.
findByUserId
(
userId
);
if
(
!
user
||
user
.
userTypeCd
!==
'DOCTOR'
||
user
.
useYn
!==
'Y'
)
{
ctx
.
status
=
403
;
ctx
.
body
=
{
error
:
'권한 없는 유저'
,
};
return
;
}
const
managePatientIdList
=
await
PatientInfo
.
findAllByDoctorIdAndUseYn
(
userId
,
'Y'
);
const
resul
t
=
[];
const
patientLis
t
=
[];
await
Promise
.
all
(
managePatientIdList
.
map
(
async
patient
=>
{
const
patientProfile
=
await
Profile
.
findByUserId
(
patient
.
patientId
);
resul
t
.
push
(
patientProfile
);
patientLis
t
.
push
(
patientProfile
);
}));
ctx
.
status
=
200
;
ctx
.
body
=
result
;
ctx
.
body
=
{
patientList
,
};
};
...
...
@@ -101,6 +108,9 @@ exports.getPatientDetail = async ctx => {
const
user
=
await
User
.
findByUserId
(
userId
);
if
(
!
user
||
user
.
userTypeCd
!==
'DOCTOR'
||
user
.
useYn
!==
'Y'
)
{
ctx
.
status
=
403
;
ctx
.
body
=
{
error
:
'권한 없는 사용자'
,
};
return
;
}
...
...
@@ -108,12 +118,18 @@ exports.getPatientDetail = async ctx => {
const
patient
=
await
User
.
findByUserId
(
patientId
);
if
(
!
patient
||
patient
.
useYn
!==
'Y'
)
{
ctx
.
status
=
404
;
ctx
.
body
=
{
error
:
'존재하지 않는 유저'
,
};
return
;
}
const
isDoctorsPatient
=
await
PatientInfo
.
findByPatientIdAndDoctorIdAndUseYn
(
patientId
,
userId
,
'Y'
);
if
(
!
isDoctorsPatient
)
{
ctx
.
status
=
403
;
ctx
.
body
=
{
error
:
'접근 권한 없는 환자'
,
};
return
;
}
...
...
@@ -137,9 +153,10 @@ exports.getPatientDetail = async ctx => {
}));
const
bottleList
=
await
Promise
.
all
(
reqUserBmList
.
map
(
async
bottleMedicine
=>
{
const
{
dosage
,
regDtm
,
medicineId
}
=
bottleMedicine
;
const
{
bottleId
,
dosage
,
regDtm
,
medicineId
}
=
bottleMedicine
;
const
medicine
=
await
Medicine
.
findOne
({
medicineId
});
return
{
bottleId
,
dosage
,
regDtm
,
medicine
,
...
...
@@ -208,6 +225,7 @@ exports.getBottleDetail = async ctx => {
}).
sort
({
fdbDtm
:
'desc'
});
const
result
=
{
bottleId
,
medicine
,
takeMedicineHist
,
feedbackList
,
...
...
@@ -235,6 +253,9 @@ exports.writeReqPatientReport = async ctx => {
const
user
=
await
User
.
findByUserId
(
userId
);
if
(
!
user
||
user
.
userTypeCd
!==
'DOCTOR'
||
user
.
useYn
!==
'Y'
)
{
ctx
.
status
=
403
;
ctx
.
body
=
{
error
:
'권한 없는 유저'
,
};
return
;
}
...
...
@@ -242,12 +263,18 @@ exports.writeReqPatientReport = async ctx => {
const
patient
=
await
User
.
findByUserId
(
patientId
);
if
(
!
patient
||
patient
.
useYn
!==
'Y'
)
{
ctx
.
status
=
404
;
ctx
.
body
=
{
error
:
'존재하지 않는 유자'
,
};
return
;
}
const
patientInfo
=
await
PatientInfo
.
findByPatientIdAndDoctorIdAndUseYn
(
patientId
,
userId
,
'Y'
);
if
(
!
patientInfo
)
{
ctx
.
status
=
404
;
ctx
.
body
=
{
error
:
'접근 권한 없는 환자'
,
};
return
;
}
...
...
@@ -327,6 +354,9 @@ exports.searchPatientById = async ctx => {
const
user
=
await
User
.
findByUserId
(
userId
);
if
(
!
user
||
user
.
userTypeCd
!==
'DOCTOR'
)
{
ctx
.
status
=
403
;
ctx
.
body
=
{
error
:
'권한 없는 유저'
,
};
return
;
}
...
...
@@ -334,6 +364,9 @@ exports.searchPatientById = async ctx => {
const
patient
=
await
User
.
findByUserId
(
patientId
);
if
(
!
patient
||
patient
.
useYn
!==
'Y'
)
{
ctx
.
status
=
404
;
ctx
.
body
=
{
error
:
'존재하지 않는 회원'
,
};
return
;
}
...
...
@@ -363,6 +396,9 @@ exports.registerNewPatient = async ctx => {
const
user
=
await
User
.
findByUserId
(
userId
);
if
(
!
user
||
user
.
userTypeCd
!==
'DOCTOR'
)
{
ctx
.
status
=
403
;
ctx
.
body
=
{
error
:
'권한 없는 유저'
,
};
return
;
}
...
...
@@ -370,12 +406,18 @@ exports.registerNewPatient = async ctx => {
const
patient
=
await
User
.
findByUserId
(
patientId
);
if
(
!
patient
||
patient
.
useYn
!==
'Y'
)
{
ctx
.
status
=
404
;
ctx
.
body
=
{
error
:
'존재하지 않는 유저'
,
};
return
;
}
const
isExistPatientInfo
=
await
PatientInfo
.
findByPatientIdAndDoctorId
(
patientId
,
userId
);
if
(
isExistPatientInfo
)
{
ctx
.
status
=
403
;
ctx
.
body
=
{
error
:
'이미 등록된 환자이거나, 등록 요청 대기중인 환자'
,
};
return
;
}
...
...
@@ -410,6 +452,9 @@ exports.removeReqPatient = async ctx => {
const
user
=
await
User
.
findByUserId
(
userId
);
if
(
!
user
||
user
.
userTypeCd
!==
'DOCTOR'
)
{
ctx
.
status
=
403
;
ctx
.
body
=
{
error
:
'권한 없는 유저'
,
};
return
;
}
...
...
@@ -417,12 +462,18 @@ exports.removeReqPatient = async ctx => {
const
patient
=
await
User
.
findByUserId
(
patientId
);
if
(
!
patient
||
patient
.
useYn
!==
'Y'
)
{
ctx
.
status
=
404
;
ctx
.
body
=
{
error
:
'존재하지 않는 회원'
,
};
return
;
}
const
patientInfo
=
await
PatientInfo
.
findByPatientIdAndDoctorIdAndUseYn
(
patientId
,
userId
,
'Y'
);
if
(
!
patientInfo
)
{
ctx
.
status
=
404
;
ctx
.
body
=
{
error
:
'등록되지 않은 환자'
,
};
return
;
}
...
...
server/src/api/hub/hub.ctrl.js
View file @
72a856a
...
...
@@ -44,7 +44,7 @@ exports.hubConnect = async (ctx) => {
await
hub
.
save
();
ctx
.
status
=
201
;
ctx
.
body
=
hub
;
};
exports
.
getHubList
=
async
(
ctx
)
=>
{
...
...
@@ -69,7 +69,9 @@ exports.getHubList = async(ctx) => {
}
ctx
.
status
=
200
;
ctx
.
body
=
hubList
;
ctx
.
body
=
{
hubList
};
};
exports
.
hubDisconnect
=
async
(
ctx
)
=>
{
...
...
server/src/api/manage/manage.ctrl.js
View file @
72a856a
...
...
@@ -30,7 +30,9 @@ exports.getDoctorRegReqList = async ctx => {
});
ctx
.
status
=
200
;
ctx
.
body
=
doctorRegReqList
;
ctx
.
body
=
{
doctorRegReqList
};
}
catch
(
e
)
{
ctx
.
status
=
500
;
...
...
@@ -107,7 +109,9 @@ exports.getDoctorRegReqDetail = async ctx => {
}
ctx
.
status
=
200
;
ctx
.
body
=
doctorInfo
;
ctx
.
body
=
{
doctorInfo
,
};
}
catch
(
e
)
{
ctx
.
status
=
500
;
...
...
server/src/api/medicine/medicine.ctrl.js
View file @
72a856a
...
...
@@ -10,10 +10,12 @@ exports.medicineSearch = async(ctx) => {
const
{
keyword
}
=
ctx
.
request
.
body
;
const
resul
t
=
await
Medicine
.
findByKeyword
(
keyword
);
const
medicineLis
t
=
await
Medicine
.
findByKeyword
(
keyword
);
ctx
.
status
=
200
;
ctx
.
body
=
result
;
ctx
.
body
=
{
medicineList
,
};
}
exports
.
medicineGet
=
async
(
ctx
)
=>
{
...
...
@@ -31,6 +33,8 @@ exports.medicineGet = async(ctx) => {
}
ctx
.
status
=
200
;
ctx
.
body
=
medicine
;
ctx
.
body
=
{
medicine
,
};
}
\ No newline at end of file
...
...
server/src/api/user/user.ctrl.js
View file @
72a856a
...
...
@@ -29,7 +29,9 @@ exports.getMyDetail = async ctx => {
const
profile
=
await
Profile
.
findByUserId
(
userId
);
ctx
.
status
=
200
;
ctx
.
body
=
profile
;
ctx
.
body
=
{
profile
,
};
}
...
...
@@ -78,7 +80,9 @@ exports.getMyDoctorList = async ctx => {
}));
ctx
.
status
=
200
;
ctx
.
body
=
doctorList
;
ctx
.
body
=
{
doctorList
,
};
};
...
...
@@ -105,7 +109,9 @@ exports.viewAllDoctorRegisterReq = async ctx => {
const
patientInfoList
=
await
PatientInfo
.
findAllByPatientIdAndUseYn
(
userId
,
'W'
);
ctx
.
status
=
200
;
ctx
.
body
=
patientInfoList
;
ctx
.
body
=
{
patientInfoList
,
};
};
...
...
Please
register
or
login
to post a comment