|
@ -413,6 +413,10 @@ public class CustomerService extends BaseService{
|
|
|
public String saveCallService(String callServiceJson,String user){
|
|
|
net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(callServiceJson);
|
|
|
CallService callService = (CallService)net.sf.json.JSONObject.toBean(jsonObject,CallService.class);
|
|
|
|
|
|
if(!checkCallServiceCount(callService)){
|
|
|
return "-1";
|
|
|
}
|
|
|
callService.setCode(getCallServiceCode(callService.getType()+""));
|
|
|
callService.setUser(user);
|
|
|
User u = userDao.findByCode(user);
|
|
@ -428,9 +432,25 @@ public class CustomerService extends BaseService{
|
|
|
callServiceDao.save(callService);
|
|
|
//待处理发送消息给医生
|
|
|
sendCallServiceMes(callService,u);
|
|
|
//发送消息
|
|
|
sendWxMes(callService,u);
|
|
|
return "1";
|
|
|
}
|
|
|
|
|
|
public boolean checkCallServiceCount(CallService callService ){
|
|
|
String sql = "SELECT count(1) AS total FROM manage_call_service s WHERE s.call_code ='"+callService.getCallCode() +"' AND s.type = "+callService.getType();
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if(list!=null&&list.size()>0){
|
|
|
Map<String,Object> map = list.get(0);
|
|
|
Long total = (Long)map.get("total");
|
|
|
if(total>=5){
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
public String updateCallService(String callServiceJson,String user){
|
|
|
net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(callServiceJson);
|
|
|
CallService callService = (CallService)net.sf.json.JSONObject.toBean(jsonObject,CallService.class);
|
|
@ -440,9 +460,23 @@ public class CustomerService extends BaseService{
|
|
|
callServiceDao.save(callService);
|
|
|
//待处理发送消息给医生
|
|
|
sendCallServiceMes(callService,u);
|
|
|
//发送消息
|
|
|
sendWxMes(callService,u);
|
|
|
return "1";
|
|
|
}
|
|
|
|
|
|
public void sendWxMes(CallService callService,User u){
|
|
|
Doctor d = doctorDao.findByCode(callService.getDoctor());
|
|
|
String mes = u.getName()+"(工号:"+u.getJobNo()+")代居民("+callService.getPatientName()+")发:" ;
|
|
|
if("1".equals(callService.getType())){
|
|
|
mes += u.getName()+"需要预约挂号";
|
|
|
}else{
|
|
|
mes += u.getName()+"发起咨询";
|
|
|
}
|
|
|
mes +="\n请您登录i健康app,进入协同服务管理进行查看处理。";
|
|
|
sendMsg(d,mes,"2");
|
|
|
}
|
|
|
|
|
|
public void sendCallServiceMes(CallService callService,User u){
|
|
|
//待处理发送消息给医生
|
|
|
if(callService.getState()==1){
|