Browse Source

新增体检结果通知

付宇 5 months ago
parent
commit
e02d010cf6

+ 56 - 2
PacsOnline_Wechat_Patient/src/main/java/com/zskk/service/WeixinService.java

@@ -65,6 +65,10 @@ public class WeixinService {
 		 put("中世康恺电子胶片平台", "5vu2mo8vwoFFdxQ2nXZJf-lymd3R80gb3JR_B3YpwKI");  
 	 }}; 
 
+	 private static final Map<String, String> PEIS_REPORT_PUSH_TEMPLATE_ID = new HashMap<String , String>(){{  
+		put("中世康恺电子胶片平台", "WgKYyEWXx1OuSR2tjDdvnyMTwGHVm4-at8ZB3wD7JE8");  
+	}}; 
+
 	 private static String BASR_URL = "https://wechat.pacsonline.cn/wx_patient/web/";
 
 	
@@ -74,7 +78,13 @@ public class WeixinService {
 	public enum PUSH_TYPE {
 		
 		//远程诊断患者支付推送,远程诊断完成,远程诊断取消,远程诊断退款完成
-		REMOTE_DIAGNOSIS_PATIENT_PAY(1),REMOTE_DIAGNOSIS_FINISH(2),REMOTE_DIAGNOSIS_CANCEL(3),REMOTE_DIAGNOSIS_REFUND(4),LOCAL_EXAM_FINISH(5),LOCAL_REPORT_FINISH(6);
+		REMOTE_DIAGNOSIS_PATIENT_PAY(1),
+		REMOTE_DIAGNOSIS_FINISH(2),
+		REMOTE_DIAGNOSIS_CANCEL(3),
+		REMOTE_DIAGNOSIS_REFUND(4),
+		LOCAL_EXAM_FINISH(5),
+		LOCAL_REPORT_FINISH(6),
+		PEIS_REPORT_PUSH(7);
 		
 		private int pushType;
 		
@@ -272,7 +282,19 @@ public class WeixinService {
 			apiResult = sendLocalReportFinishMsg(openid, urlString, modality, name, eaxmDate, template_id);
 		}
 		    break;
-		    
+		case PEIS_REPORT_PUSH: 
+		{
+			JSONObject contentJson = JSON.parseObject(content);
+			String name = contentJson.getString("modality");
+			String modality = contentJson.getString("name");
+            String eaxmDate = contentJson.getString("eaxmDate");
+            String hospital = contentJson.getString("hospital");
+            String report_id = contentJson.getString("report_id");
+            String exam_id = contentJson.getString("exam_id");
+            String template_id = PEIS_REPORT_PUSH_TEMPLATE_ID.get(source);
+			String urlString = BASR_URL + "localReport?report_id=" + report_id + "&exam_id=" + exam_id;
+			apiResult = sendPeisReportPushMsg(openid, urlString, modality, name, eaxmDate, hospital, template_id);
+		}
 		default:
 			break;
 		}
@@ -480,6 +502,38 @@ public class WeixinService {
         ApiResult apiResult = TemplateMsgApi.send(str);
         return apiResult;
 	}
+	public ApiResult sendPeisReportPushMsg(String openid, String url, String modality, String name, String eaxmDate, String hospital, String template_id) {
+		String str = " {\n" +
+                "           \"touser\":\""+openid+"\",\n" +
+                "           \"template_id\":\""+template_id+"\",\n" +
+                "           \"url\":\""+url+"\",\n" +
+                "           \"topcolor\":\"#FF0000\",\n" +
+                "           \"data\":{\n" +
+                "                   \"thing5\":{\n" +
+                "                       \"value\":\""+modality+"\",\n" +
+                "                       \"color\":\"#173177\"\n" +
+                "                   },\n" +
+                "                   \"thing1\":{\n" +
+                "                       \"value\":\""+name+"\",\n" +
+                "                       \"color\":\"#173177\"\n" +
+                "                   },\n" +
+                "                   \"time2\":{\n" +
+                "                       \"value\":\""+eaxmDate+"\",\n" +
+                "                       \"color\":\"#173177\"\n" +
+                "                   },\n" +
+                "                   \"thing3\":{\n" +
+                "                       \"value\":\""+hospital+"\",\n" +
+                "                       \"color\":\"#173177\"\n" +
+                "                   },\n" +
+                "                   \"remark\":{\n" +
+                "                       \"value\":\"点击查看报告详情\",\n" +
+                "                       \"color\":\"#173177\"\n" +
+                "                   }\n" +
+                "           }\n" +
+                "       }";
+        ApiResult apiResult = TemplateMsgApi.send(str);
+        return apiResult;
+	}
 	
 	private String getNowDateString() {
 		SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日  HH:mm:ss");