|
@ -42,40 +42,98 @@ class SocketHandler {
|
|
|
if (!data.userId) {
|
|
|
socketServer.sockets.emit('error', {message: 'Missing fields(s): userId.'});
|
|
|
} else {
|
|
|
if("pc_doctor"===data.clientType){//新增pc端医生登录
|
|
|
data.userId = "pc_"+data.userId;
|
|
|
}else if("pcim_doctor"===data.clientType){//用于pcim 消息通知
|
|
|
data.userId = "pcim_"+data.userId;
|
|
|
}else if("pc_patient"===data.clientType){//新增居民PC登陆类型
|
|
|
data.userId= "pcpatient_"+data.userId;
|
|
|
}
|
|
|
|
|
|
if(clientCache.removeByUserId(data.userId)){
|
|
|
log.info("User " + data.userId + " already login");
|
|
|
return;
|
|
|
let mdt_login_tag = data.SYSTEM_TYPE;
|
|
|
|
|
|
//MDT 托盘登陆
|
|
|
if(mdt_login_tag && "MDT" == mdt_login_tag){
|
|
|
//传入手机号,转换成医生CODE
|
|
|
sessions.conversionAarticipant(data.userId, (doctorid) => {
|
|
|
data.userId = "pcim_"+doctorid;
|
|
|
if(clientCache.removeByUserId(data.userId)){
|
|
|
log.info("User " + data.userId + " already loginMDT");
|
|
|
return;
|
|
|
}
|
|
|
log.info('User ' + data.userId + ' loginMDT');
|
|
|
// if("pcim_doctor"===data.clientType){
|
|
|
//用于pcim 消息通知
|
|
|
let pcdoctorClient = new PcDoctorClient(socket, socketServer);
|
|
|
pcdoctorClient.userId = data.userId;
|
|
|
pcdoctorClient.password = data.password;
|
|
|
pcdoctorClient.clientType = data.clientType;
|
|
|
pcdoctorClient.sessionId = "";
|
|
|
clientCache.addClient(pcdoctorClient);
|
|
|
socket.emit('ack', {});
|
|
|
});
|
|
|
}else{
|
|
|
if("pc_doctor"===data.clientType){//新增pc端医生登录
|
|
|
data.userId = "pc_"+data.userId;
|
|
|
}else if("pcim_doctor"===data.clientType){//用于pcim 消息通知
|
|
|
data.userId = "pcim_"+data.userId;
|
|
|
}else if("pc_patient"===data.clientType){//新增居民PC登陆类型
|
|
|
data.userId= "pcpatient_"+data.userId;
|
|
|
}
|
|
|
|
|
|
if(clientCache.removeByUserId(data.userId)){
|
|
|
log.info("User " + data.userId + " already login");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
log.info('User ' + data.userId + ' login');
|
|
|
if(!data.clientType||data.clientType=="patient"){
|
|
|
let patientClient = new PatientClient(socket, socketServer);
|
|
|
patientClient.userId = data.userId;
|
|
|
patientClient.password = data.password;
|
|
|
patientClient.clientType = data.clientType||"patient";
|
|
|
patientClient.sessionId = data.sessionId||"";
|
|
|
clientCache.addClient(patientClient);
|
|
|
users.login(data.userId, 10, '', '');
|
|
|
socket.emit('ack', {});
|
|
|
}else if("pc_patient"===data.clientType){
|
|
|
//用于pcpatient 消息通知
|
|
|
let pcpatientClient = new PcPatientClient(socket, socketServer);
|
|
|
pcpatientClient.userId = data.userId;
|
|
|
pcpatientClient.password = data.password;
|
|
|
pcpatientClient.clientType = data.clientType;
|
|
|
pcpatientClient.sessionId = data.sessionId||"";
|
|
|
clientCache.addClient(pcpatientClient);
|
|
|
users.login(data.userId, 10, '', '');
|
|
|
socket.emit('ack', {});
|
|
|
}else if("pcim_doctor"===data.clientType){
|
|
|
//用于pcim 消息通知
|
|
|
let pcdoctorClient = new PcDoctorClient(socket, socketServer);
|
|
|
pcdoctorClient.userId = data.userId;
|
|
|
pcdoctorClient.password = data.password;
|
|
|
pcdoctorClient.clientType = data.clientType;
|
|
|
pcdoctorClient.sessionId = "";
|
|
|
clientCache.addClient(pcdoctorClient);
|
|
|
socket.emit('ack', {});
|
|
|
}else{
|
|
|
let doctorClient = new DoctorClient(socket, socketServer);
|
|
|
doctorClient.userId = data.userId;
|
|
|
doctorClient.password = data.password;
|
|
|
doctorClient.clientType = data.clientType;
|
|
|
doctorClient.sessionId = data.sessionId||"";
|
|
|
clientCache.addClient(doctorClient);
|
|
|
socket.emit('ack', {});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
log.info('User ' + data.userId + ' login');
|
|
|
if(!data.clientType||data.clientType=="patient"){
|
|
|
let patientClient = new PatientClient(socket, socketServer);
|
|
|
patientClient.userId = data.userId;
|
|
|
patientClient.password = data.password;
|
|
|
patientClient.clientType = data.clientType||"patient";
|
|
|
patientClient.sessionId = data.sessionId||"";
|
|
|
clientCache.addClient(patientClient);
|
|
|
users.login(data.userId, 10, '', '');
|
|
|
socket.emit('ack', {});
|
|
|
}else if("pc_patient"===data.clientType){
|
|
|
//用于pcpatient 消息通知
|
|
|
let pcpatientClient = new PcPatientClient(socket, socketServer);
|
|
|
pcpatientClient.userId = data.userId;
|
|
|
pcpatientClient.password = data.password;
|
|
|
pcpatientClient.clientType = data.clientType;
|
|
|
pcpatientClient.sessionId = data.sessionId||"";
|
|
|
clientCache.addClient(pcpatientClient);
|
|
|
users.login(data.userId, 10, '', '');
|
|
|
socket.emit('ack', {});
|
|
|
}else if("pcim_doctor"===data.clientType){
|
|
|
// 客户端注册
|
|
|
socket.on('loginMDT', function (data) {
|
|
|
if (!data.userId) {
|
|
|
socketServer.sockets.emit('error', {message: 'Missing fields(s): userId.'});
|
|
|
} else {
|
|
|
sessions.conversionAarticipant(j, (doctorid) => {
|
|
|
data.userId = "pcim_"+doctorid;
|
|
|
if(clientCache.removeByUserId(data.userId)){
|
|
|
log.info("User " + data.userId + " already loginMDT");
|
|
|
return;
|
|
|
}
|
|
|
log.info('User ' + data.userId + ' loginMDT');
|
|
|
// if("pcim_doctor"===data.clientType){
|
|
|
//用于pcim 消息通知
|
|
|
let pcdoctorClient = new PcDoctorClient(socket, socketServer);
|
|
|
pcdoctorClient.userId = data.userId;
|
|
@ -84,15 +142,9 @@ class SocketHandler {
|
|
|
pcdoctorClient.sessionId = "";
|
|
|
clientCache.addClient(pcdoctorClient);
|
|
|
socket.emit('ack', {});
|
|
|
}else{
|
|
|
let doctorClient = new DoctorClient(socket, socketServer);
|
|
|
doctorClient.userId = data.userId;
|
|
|
doctorClient.password = data.password;
|
|
|
doctorClient.clientType = data.clientType;
|
|
|
doctorClient.sessionId = data.sessionId||"";
|
|
|
clientCache.addClient(doctorClient);
|
|
|
socket.emit('ack', {});
|
|
|
}
|
|
|
// }
|
|
|
});
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|