Showing
4 changed files
with
18 additions
and
0 deletions
... | @@ -103,6 +103,7 @@ exports.bottleDisconnect = async(ctx) => { | ... | @@ -103,6 +103,7 @@ exports.bottleDisconnect = async(ctx) => { |
103 | const topic = 'bottle/' + bottleId + '/bts'; | 103 | const topic = 'bottle/' + bottleId + '/bts'; |
104 | Mqtt.mqttUnsubscribe(client, topic); | 104 | Mqtt.mqttUnsubscribe(client, topic); |
105 | 105 | ||
106 | + await BottleMedicine.updateMany({ bottleId }, { useYn : 'N' }); | ||
106 | await Bottle.deleteOne({ bottleId }); | 107 | await Bottle.deleteOne({ bottleId }); |
107 | 108 | ||
108 | ctx.status = 204; | 109 | ctx.status = 204; | ... | ... |
... | @@ -358,6 +358,7 @@ exports.writeReqBottleFeedback = async ctx => { | ... | @@ -358,6 +358,7 @@ exports.writeReqBottleFeedback = async ctx => { |
358 | 358 | ||
359 | ctx.status = 200; | 359 | ctx.status = 200; |
360 | 360 | ||
361 | + | ||
361 | }; | 362 | }; |
362 | 363 | ||
363 | /** | 364 | /** |
... | @@ -451,6 +452,15 @@ exports.registerNewPatient = async ctx => { | ... | @@ -451,6 +452,15 @@ exports.registerNewPatient = async ctx => { |
451 | await patientInfo.updateInfo('환자 등록 요청'); | 452 | await patientInfo.updateInfo('환자 등록 요청'); |
452 | await patientInfo.save(); | 453 | await patientInfo.save(); |
453 | 454 | ||
455 | + const profile = await Profile.findByUserId(patientId); | ||
456 | + const { deviceToken } = profile; | ||
457 | + | ||
458 | + sendPushMessage({ | ||
459 | + deviceToken, | ||
460 | + title : '새로운 의사 등록 요청이 왔습니다.', | ||
461 | + body : '어플리케이션을 실행해 확인하세요.', | ||
462 | + }); | ||
463 | + | ||
454 | ctx.status = 200; | 464 | ctx.status = 200; |
455 | 465 | ||
456 | }; | 466 | }; | ... | ... |
... | @@ -5,6 +5,7 @@ const User = require('../../models/user'); | ... | @@ -5,6 +5,7 @@ const User = require('../../models/user'); |
5 | const Mqtt = require('../../util/MqttModule'); | 5 | const Mqtt = require('../../util/MqttModule'); |
6 | const DataProcess = require('../../util/DataProcess'); | 6 | const DataProcess = require('../../util/DataProcess'); |
7 | const jwt = require('jsonwebtoken'); | 7 | const jwt = require('jsonwebtoken'); |
8 | +const BottleMedicine = require('../../models/bottleMedicine'); | ||
8 | 9 | ||
9 | //허브 연결 | 10 | //허브 연결 |
10 | exports.hubConnect = async (ctx) => { | 11 | exports.hubConnect = async (ctx) => { |
... | @@ -81,6 +82,11 @@ exports.hubDisconnect = async(ctx) => { | ... | @@ -81,6 +82,11 @@ exports.hubDisconnect = async(ctx) => { |
81 | const hosting = await hub.getHubHost(); | 82 | const hosting = await hub.getHubHost(); |
82 | Mqtt.mqttOff(hosting); | 83 | Mqtt.mqttOff(hosting); |
83 | 84 | ||
85 | + const bottleList = await Bottle.find({ hubId }); | ||
86 | + await Promise.all(bottleList.map(async bottle => { | ||
87 | + await BottleMedicine.updateMany({ bottleId : bottle.bottleId }, { useYn : 'N' }); | ||
88 | + })); | ||
89 | + | ||
84 | await Bottle.deleteMany({ hubId }); | 90 | await Bottle.deleteMany({ hubId }); |
85 | await Hub.deleteOne({ hubId }); | 91 | await Hub.deleteOne({ hubId }); |
86 | 92 | ... | ... |
... | @@ -197,6 +197,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { | ... | @@ -197,6 +197,7 @@ const DoctorMenuContainer = (props : DoctorMenuProps) => { |
197 | }); | 197 | }); |
198 | if(result.statusText === 'OK') { | 198 | if(result.statusText === 'OK') { |
199 | Alert.onSuccess('환자에게 담당의 등록 요청을 전송했습니다.', () => null); | 199 | Alert.onSuccess('환자에게 담당의 등록 요청을 전송했습니다.', () => null); |
200 | + setNewPatientRegisterModal(false); | ||
200 | } else { | 201 | } else { |
201 | Alert.onError('환자에게 담당의 등록 요청을 실패했습니다.', () => null); | 202 | Alert.onError('환자에게 담당의 등록 요청을 실패했습니다.', () => null); |
202 | } | 203 | } | ... | ... |
-
Please register or login to post a comment