Browse Source

更新了推送链接为新版报告链接,更新了二维码生成规则

刘韬 3 years ago
parent
commit
8a5301dbf0

+ 2 - 2
PacsOnline_Wechat_Patient/src/main/java/com/zskk/controller/WeixinApiController.java

@@ -231,8 +231,8 @@ public class WeixinApiController extends ApiController {
 			return;
 		}
 //		if (reports.getQrCode() == null || reports.getQrCode().isEmpty()) {		
-		String str = "{\"expire_seconds\": 2592000, \"action_name\": \"QR_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"ExamQR_"
-				+ reports.getExamId() + "\"}}}";
+		String str = "{\"expire_seconds\": 2592000, \"action_name\": \"QR_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"ReportQR_"
+				+ reportId + "\"}}}";
 		ApiResult apiResult = QrcodeApi.create(str);
 		String url = apiResult.getStr("url");
 		reports.setQrCode(url);

+ 44 - 25
PacsOnline_Wechat_Patient/src/main/java/com/zskk/controller/WeixinMsgController.java

@@ -17,6 +17,7 @@ import com.jfinal.weixin.sdk.msg.in.speech_recognition.InSpeechRecognitionResult
 import com.jfinal.weixin.sdk.msg.out.OutCustomMsg;
 import com.jfinal.weixin.sdk.msg.out.OutTextMsg;
 import com.zskk.model.Exams;
+import com.zskk.model.Report;
 import com.zskk.model.UserWechat;
 import com.zskk.model.WechatBind;
 import com.zskk.service.ServiceFactory;
@@ -48,7 +49,7 @@ public class WeixinMsgController extends MsgControllerAdapter {
 			List<Articles> list = new ArrayList<Articles>();
 			Articles articles1 = new Articles();
 			articles1.setTitle("【数字影像示例】点击查看本次影像和报告");
-			articles1.setDescription("欢迎使用中世康恺PacsOnline!\n点击进入查看详情,您可以分享给家属或医生,日后还可以在\"我的报告\"中查看本次影像和报告");
+			articles1.setDescription("欢迎使用冠医云-数字影像服务!\n点击进入查看详情,您可以分享给家属或医生,日后还可以在\"个人中心-我的检查列表\"中查看本次影像和报告");
 			articles1.setPicurl("http://work.pacsonline.cn/static/img/banner.e8ee043.png");
 			articles1.setUrl(toUrlString);
 			list.add(articles1);
@@ -171,6 +172,7 @@ public class WeixinMsgController extends MsgControllerAdapter {
 					inQrCodeEvent.getFromUserName());
 			String rid = inQrCodeEvent.getEventKey();
 			String[] arr = rid.split("_");
+			//DEMO示例
 			if (arr[2].equals("DEMOCT")) {
 				if (findUser == null) {
 					UserService uService = ServiceFactory.getService(UserService.class);
@@ -190,22 +192,31 @@ public class WeixinMsgController extends MsgControllerAdapter {
 				List<Articles> list = new ArrayList<Articles>();
 				Articles articles1 = new Articles();
 				articles1.setTitle("【数字影像示例】点击查看本次影像和报告");
-				articles1.setDescription("欢迎使用中世康恺PacsOnline!\n点击进入查看详情,您可以分享给家属或医生,日后还可以在\"我的报告\"中查看本次影像和报告");
+				articles1.setDescription("欢迎使用冠医云-数字影像服务!\n点击进入查看详情,您可以分享给家属或医生,日后还可以在\"个人中心-我的检查列表\"中查看本次影像和报告");
 				articles1.setPicurl("http://work.pacsonline.cn/static/img/banner.e8ee043.png");
 				articles1.setUrl(toUrlString);
 				list.add(articles1);
 				CustomServiceApi.sendNews(inQrCodeEvent.getFromUserName(), list);
 				return;
 			}
-			CustomServiceApi.sendText(inQrCodeEvent.getFromUserName(), "t");
-
-			Exams exams = Exams.dao.findById(arr[2]);
-			if (exams == null) {
-				return;
+			String toUrlString = "";
+			Exams exams = null;
+			if (arr[1].equals("ReportQR")) {
+				Report reports = Report.dao.findById(arr[2]);
+				exams = Exams.dao.findById(reports.getExamId());
+				toUrlString = String.format(
+						"https://wc4.pacsonline.cn/#/reportInfo/report?report_id=%s&exam_id=%s",
+						arr[2], reports.getExamId());
+			}else {
+				exams = Exams.dao.findById(arr[2]);
+				if (exams == null) {
+					return;
+				}
+				toUrlString = String.format(
+						"https://wechatclient3.pacsonline.cn/#/reportInfo/report?openid=%s&exam_id=%s&study_id=%s",
+						inQrCodeEvent.getFromUserName(), exams.getId(), exams.getStudyId());
 			}
-			String toUrlString = String.format(
-					"https://wechatclient3.pacsonline.cn/#/reportInfo/report?openid=%s&exam_id=%s&study_id=%s",
-					inQrCodeEvent.getFromUserName(), exams.getId(), exams.getStudyId());
+			
 			if (findUser == null) {
 				UserService uService = ServiceFactory.getService(UserService.class);
 				UserWechat users = uService.createWxUserByGH(inQrCodeEvent.getFromUserName(),
@@ -228,7 +239,7 @@ public class WeixinMsgController extends MsgControllerAdapter {
 				List<Articles> list = new ArrayList<Articles>();
 				Articles articles1 = new Articles();
 				articles1.setTitle("点击查看本次影像和报告");
-				articles1.setDescription("欢迎使用中世康恺PacsOnline!\n点击进入查看详情,您可以分享给家属或医生,日后还可以在\"我的报告\"中查看本次影像和报告");
+				articles1.setDescription("欢迎使用冠医云-数字影像服务!\n点击进入查看详情,您可以分享给家属或医生,日后还可以在\"个人中心-我的检查列表\"中查看本次影像和报告");
 				articles1.setUrl(toUrlString);
 				articles1.setPicurl("http://work.pacsonline.cn/static/img/banner.e8ee043.png");
 				list.add(articles1);
@@ -250,7 +261,7 @@ public class WeixinMsgController extends MsgControllerAdapter {
 				List<Articles> list = new ArrayList<Articles>();
 				Articles articles1 = new Articles();
 				articles1.setTitle("点击查看本次影像和报告");
-				articles1.setDescription("欢迎使用中世康恺PacsOnline!\n点击进入查看详情,您可以分享给家属或医生,日后还可以在\"我的报告\"中查看本次影像和报告");
+				articles1.setDescription("欢迎使用冠医云-数字影像服务!\n点击进入查看详情,您可以分享给家属或医生,日后还可以在\"个人中心-我的检查列表\"中查看本次影像和报告");
 				articles1.setUrl(toUrlString);
 				articles1.setPicurl("http://work.pacsonline.cn/static/img/banner.e8ee043.png");
 				list.add(articles1);
@@ -261,29 +272,42 @@ public class WeixinMsgController extends MsgControllerAdapter {
 			log.debug("扫码已关注:" + inQrCodeEvent.getFromUserName());
 			String rid = inQrCodeEvent.getEventKey();
 			String[] arr = rid.split("_");
-//			CustomServiceApi.sendText(inQrCodeEvent.getFromUserName(),
-//					rid);
 			if (arr[1].equals("DEMOCT")) {
 				CustomServiceApi.sendText(inQrCodeEvent.getFromUserName(),
 						"【声明】为保证客户数据隐私安全,数字影像示例涉及检查信息、用户信息、医疗机构信息等均已经过数据脱敏处理。\n通过以下途径了解更多或联系我们:\n官方网站:<a href=\"http://www.pacsonline.cn\">点击进入</a>\n咨询热线:010-53675656\n电子邮箱:company@pacsonline.cn\n您即将收到数字影像示例,请点击下方消息查看,谢谢您的使用!");
-
 				String toUrlString = String.format(
 						"https://wechatclient3.pacsonline.cn/#/reportInfo/report?openid=%s&exam_id=%s&study_id=%s",
 						"test", "cnb5089c8jadjdlv", "9427e19e4a5687a811f79eca24e6128d");
-
 				List<Articles> list = new ArrayList<Articles>();
 				Articles articles1 = new Articles();
 				articles1.setTitle("【数字影像示例】点击查看本次影像和报告");
-				articles1.setDescription("欢迎使用中世康恺PacsOnline!\n点击进入查看详情,您可以分享给家属或医生,日后还可以在\"我的报告\"中查看本次影像和报告");
+				articles1.setDescription("欢迎使用冠医云-数字影像服务!\n点击进入查看详情,您可以分享给家属或医生,日后还可以在\"个人中心-我的检查列表\"中查看本次影像和报告");
 				articles1.setPicurl("http://work.pacsonline.cn/static/img/banner.e8ee043.png");
 				articles1.setUrl(toUrlString);
 				list.add(articles1);
 				CustomServiceApi.sendNews(inQrCodeEvent.getFromUserName(), list);
 				renderNull();
 				return;
-
 			}
-
+			
+			String toUrlString = "";
+			Exams exams = null;
+			if (arr[0].equals("ReportQR")) {
+				Report reports = Report.dao.findById(arr[1]);
+				exams = Exams.dao.findById(reports.getExamId());
+				toUrlString = String.format(
+						"https://wc4.pacsonline.cn/#/reportInfo/report?report_id=%s&exam_id=%s",
+						arr[1], reports.getExamId());
+			}else {
+				exams = Exams.dao.findById(arr[1]);
+				if (exams == null) {
+					return;
+				}
+				toUrlString = String.format(
+						"https://wechatclient3.pacsonline.cn/#/reportInfo/report?openid=%s&exam_id=%s&study_id=%s",
+						inQrCodeEvent.getFromUserName(), exams.getId(), exams.getStudyId());
+			}
+			
 			UserWechat user = UserWechat.dao.findFirst("select * from user_wechat where wx_openid = ?",
 					inQrCodeEvent.getFromUserName());
 
@@ -293,8 +317,6 @@ public class WeixinMsgController extends MsgControllerAdapter {
 				user = uService.createWxUserByGH(inQrCodeEvent.getFromUserName(), inQrCodeEvent.getToUserName());
 			}
 
-			Exams exams = Exams.dao.findById(arr[1]);
-
 			WechatBind userBind = WechatBind.dao.findFirst("select * from wechat_bind where user_id=? and exam_id=?",
 					user.getId(), exams.getId());
 
@@ -302,13 +324,10 @@ public class WeixinMsgController extends MsgControllerAdapter {
 				uService.bindUserReport(user.getId(), exams);
 			}
 
-			String toUrlString = String.format(
-					"https://wechatclient3.pacsonline.cn/#/reportInfo/report?openid=%s&exam_id=%s&study_id=%s",
-					inQrCodeEvent.getFromUserName(), exams.getId(), exams.getStudyId());
 			List<Articles> list = new ArrayList<Articles>();
 			Articles articles1 = new Articles();
 			articles1.setTitle("点击查看本次影像和报告");
-			articles1.setDescription("欢迎使用中世康恺PacsOnline!\n点击进入查看详情,您可以分享给家属或医生,日后还可以在\"我的报告\"中查看本次影像和报告");
+			articles1.setDescription("欢迎使用冠医云-数字影像服务!\n点击进入查看详情,您可以分享给家属或医生,日后还可以在\"个人中心-我的检查列表\"中查看本次影像和报告");
 			articles1.setUrl(toUrlString);
 			articles1.setPicurl("http://work.pacsonline.cn/static/img/banner.e8ee043.png");
 			list.add(articles1);

+ 8 - 6
PacsOnline_Wechat_Patient/src/main/java/com/zskk/service/WeixinService.java

@@ -65,6 +65,8 @@ public class WeixinService {
 		 put("中世康恺电子胶片平台", "5vu2mo8vwoFFdxQ2nXZJf-lymd3R80gb3JR_B3YpwKI");  
 	 }}; 
 
+	 private static String BASR_URL = "https://wechat.pacsonline.cn/wx_patient/web/";
+
 	
 	/*/
 	 * 微信消息推送类型枚举
@@ -178,7 +180,7 @@ public class WeixinService {
 		switch (type) {
 		case REMOTE_DIAGNOSIS_PATIENT_PAY:
 		{
-			String urlString = "https://wechat.pacsonline.cn/wx_patient/web/remoteDiagnosis?appId=" + ApiConfigKit.getAppId();
+			String urlString = BASR_URL + "remoteDiagnosis?appId=" + ApiConfigKit.getAppId();
 			JSONObject contentJson = JSON.parseObject(content);
 			String out_trade_no = contentJson.getString("out_trade_no");
 			String name = contentJson.getString("name");
@@ -200,7 +202,7 @@ public class WeixinService {
 			
 		case REMOTE_DIAGNOSIS_FINISH:
 		{
-			String urlString = "https://wechat.pacsonline.cn/wx_patient/web/remoteDiagnosis?appId=" + ApiConfigKit.getAppId();
+			String urlString = BASR_URL + "remoteDiagnosis?appId=" + ApiConfigKit.getAppId();
 			JSONObject contentJson = JSON.parseObject(content);
 			String out_trade_no = contentJson.getString("out_trade_no");
 			String name = contentJson.getString("name");
@@ -219,7 +221,7 @@ public class WeixinService {
 			
 		case REMOTE_DIAGNOSIS_CANCEL:
 		{
-			String urlString = "https://wechat.pacsonline.cn/wx_patient/web/remoteDiagnosis?appId=" + ApiConfigKit.getAppId();
+			String urlString = BASR_URL + "remoteDiagnosis?appId=" + ApiConfigKit.getAppId();
 			JSONObject contentJson = JSON.parseObject(content);
 			String out_trade_no = contentJson.getString("out_trade_no");
 			String name = contentJson.getString("name");
@@ -231,7 +233,7 @@ public class WeixinService {
 			
 		case REMOTE_DIAGNOSIS_REFUND:
 		{
-			String urlString = "https://wechat.pacsonline.cn/wx_patient/web/remoteDiagnosis?appId=" + ApiConfigKit.getAppId();
+			String urlString = BASR_URL + "remoteDiagnosis?appId=" + ApiConfigKit.getAppId();
 			JSONObject contentJson = JSON.parseObject(content);
 			String out_trade_no = contentJson.getString("out_trade_no");
 			String name = contentJson.getString("name");
@@ -252,7 +254,7 @@ public class WeixinService {
             String status = contentJson.getString("status");
             String study_id = contentJson.getString("study_id");
             String template_id = LOCAL_EXAM_FINISH_TEMPLATE_ID.get(source);
-			String urlString = "https://wechat.pacsonline.cn/wx_patient/web/examPortrait?study_id=" + study_id;
+			String urlString = BASR_URL + "examPortrait?study_id=" + study_id;
 			apiResult = sendLocalExamFinishMsg(openid, urlString, name, modality, status, template_id);
 		}
 		    break;
@@ -266,7 +268,7 @@ public class WeixinService {
             String report_id = contentJson.getString("report_id");
             String exam_id = contentJson.getString("exam_id");
             String template_id = LOCAL_REPORT_FINISH_TEMPLATE_ID.get(source);
-			String urlString = "https://wechat.pacsonline.cn/wx_patient/web/localReport?report_id=" + report_id + "&exam_id=" + exam_id;
+			String urlString = BASR_URL + "localReport?report_id=" + report_id + "&exam_id=" + exam_id;
 			apiResult = sendLocalReportFinishMsg(openid, urlString, modality, name, eaxmDate, template_id);
 		}
 		    break;