|
@@ -32,9 +32,23 @@ public class WeixinMsgController extends MsgControllerAdapter {
|
|
|
|
|
|
@Override
|
|
|
protected void processInTextMsg(InTextMsg inTextMsg) {
|
|
|
- OutTextMsg outMsg = new OutTextMsg(inTextMsg);
|
|
|
- outMsg.setContent("文本消息~"+inTextMsg.getToUserName());
|
|
|
- render(outMsg);
|
|
|
+ String msgContent = inTextMsg.getContent().trim();
|
|
|
+
|
|
|
+ if ("演示".equalsIgnoreCase(msgContent)) {
|
|
|
+ String toUrlString = String.format("http://wechat.client.pacsonline.cn/#/reportInfo/report?openid=%s&exam_id=%s&study_id=%s","test","8f0d2411134615e9","0c803a0934dfa1d8");
|
|
|
+
|
|
|
+ List<Articles> list = new ArrayList<Articles>();
|
|
|
+ Articles articles1 = new Articles();
|
|
|
+ articles1.setTitle("【演示】点击查看本次影像和报告");
|
|
|
+ articles1.setDescription("欢迎使用中世康恺PacsOnline!\n点击进入查看详情,您可以分享给家属或医生,日后还可以在“我的报告”中查看本次影像和报告");
|
|
|
+ articles1.setPicurl("http://work.pacsonline.cn/static/img/banner.e8ee043.png");
|
|
|
+ articles1.setUrl(toUrlString);
|
|
|
+ list.add(articles1);
|
|
|
+ CustomServiceApi.sendNews(inTextMsg.getFromUserName(), list);
|
|
|
+ renderNull();
|
|
|
+ }else {
|
|
|
+ renderNull();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -94,14 +108,34 @@ public class WeixinMsgController extends MsgControllerAdapter {
|
|
|
if (InFollowEvent.EVENT_INFOLLOW_SUBSCRIBE.equals(inFollowEvent.getEvent()))
|
|
|
{
|
|
|
log.debug("关注:" + inFollowEvent.getFromUserName());
|
|
|
- OutTextMsg outMsg = new OutTextMsg(inFollowEvent);
|
|
|
- outMsg.setContent("欢迎关注电子胶片平台");
|
|
|
- render(outMsg);
|
|
|
+ User findUserWechats = User.dao.findFirst("select * from user where wx_openid = ?",inFollowEvent.getFromUserName());
|
|
|
+ if (findUserWechats == null) {
|
|
|
+ UserService aService = ServiceFactory.getService(UserService.class);
|
|
|
+ User users = aService.createWxUserByGH(inFollowEvent.getFromUserName(), inFollowEvent.getToUserName());
|
|
|
+
|
|
|
+ List<Articles> list = new ArrayList<Articles>();
|
|
|
+ Articles articles1 = new Articles();
|
|
|
+ articles1.setTitle("欢迎关注中世康恺电子胶片平台,点此进入");
|
|
|
+ articles1.setDescription("点击页面绑定手机号或检查信息,立即查看电子胶片");
|
|
|
+ articles1.setUrl("http://wechat.client.pacsonline.cn/#/bind?openid=" + inFollowEvent.getFromUserName());
|
|
|
+ articles1.setPicurl("http://work.pacsonline.cn/static/img/banner.e8ee043.png");
|
|
|
+ list.add(articles1);
|
|
|
+ CustomServiceApi.sendNews(inFollowEvent.getFromUserName(), list);
|
|
|
+ }else {
|
|
|
+ findUserWechats.setSubscribeStatus(2);
|
|
|
+ findUserWechats.update();
|
|
|
+ OutTextMsg outMsgs = new OutTextMsg(inFollowEvent);
|
|
|
+ outMsgs.setContent("欢迎关注中世康恺电子胶片平台!\n使用微信或者本公众号内的“扫一扫”,扫描报告上的二维码,即可查看电子影像和报告");
|
|
|
+ render(outMsgs);
|
|
|
+ }
|
|
|
}
|
|
|
// 如果为取消关注事件,将无法接收到传回的信息
|
|
|
if (InFollowEvent.EVENT_INFOLLOW_UNSUBSCRIBE.equals(inFollowEvent.getEvent()))
|
|
|
{
|
|
|
log.debug("取消关注:" + inFollowEvent.getFromUserName());
|
|
|
+ User findUserWechats = User.dao.findFirst("select * from user where wx_openid = ?",inFollowEvent.getFromUserName());
|
|
|
+ findUserWechats.setSubscribeStatus(1);
|
|
|
+ findUserWechats.update();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -121,7 +155,7 @@ public class WeixinMsgController extends MsgControllerAdapter {
|
|
|
String toUrlString = String.format("http://wechat.client.pacsonline.cn/#/reportInfo/report?openid=%s&exam_id=%s&study_id=%s",inQrCodeEvent.getFromUserName(),exams.getId(),exams.getStudyId());
|
|
|
if (findUserWechats == null) {
|
|
|
UserService aService = ServiceFactory.getService(UserService.class);
|
|
|
- User users = aService.createWxUser(inQrCodeEvent.getFromUserName());
|
|
|
+ User users = aService.createWxUserByGH(inQrCodeEvent.getFromUserName(), inQrCodeEvent.getToUserName());
|
|
|
UserBind userBind = UserBind.dao.findFirst("select * from user_bind where user_id=? and exam_id=?",users.getId(),exams.getId());
|
|
|
if (userBind == null) {
|
|
|
aService.bindUserReport(users.getId(), exams);
|
|
@@ -134,13 +168,16 @@ public class WeixinMsgController extends MsgControllerAdapter {
|
|
|
articles.setUrl("http://wechat.client.pacsonline.cn/#/bind?openid=" + inQrCodeEvent.getFromUserName());
|
|
|
articles.setPicurl("http://work.pacsonline.cn/static/img/banner.e8ee043.png");
|
|
|
listgz.add(articles);
|
|
|
+ CustomServiceApi.sendNews(inQrCodeEvent.getFromUserName(), listgz);
|
|
|
+
|
|
|
+ List<Articles> list = new ArrayList<Articles>();
|
|
|
Articles articles1 = new Articles();
|
|
|
articles1.setTitle("点击查看本次影像和报告");
|
|
|
articles1.setDescription("欢迎使用中世康恺PacsOnline!\n点击进入查看详情,您可以分享给家属或医生,日后还可以在“我的报告”中查看本次影像和报告");
|
|
|
articles1.setUrl(toUrlString);
|
|
|
articles1.setPicurl("http://work.pacsonline.cn/static/img/banner.e8ee043.png");
|
|
|
- listgz.add(articles1);
|
|
|
- CustomServiceApi.sendNews(inQrCodeEvent.getFromUserName(), listgz);
|
|
|
+ list.add(articles1);
|
|
|
+ CustomServiceApi.sendNews(inQrCodeEvent.getFromUserName(), list);
|
|
|
renderNull();
|
|
|
}else {
|
|
|
UserService aService = ServiceFactory.getService(UserService.class);
|
|
@@ -176,7 +213,7 @@ public class WeixinMsgController extends MsgControllerAdapter {
|
|
|
UserService uService = ServiceFactory.getService(UserService.class);
|
|
|
|
|
|
if (userWechats == null) {
|
|
|
- userWechats = uService.createWxUser(inQrCodeEvent.getFromUserName());
|
|
|
+ userWechats = uService.createWxUserByGH(inQrCodeEvent.getFromUserName(), inQrCodeEvent.getToUserName());
|
|
|
}
|
|
|
|
|
|
Exams exams = Exams.dao.findById(arr[1]);
|