|  | @ -19,6 +19,7 @@ import org.quartz.JobExecutionException;
 | 
	
		
			
				|  |  | import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  | import java.util.ArrayList;
 | 
	
	
		
			
				|  | @ -71,16 +72,14 @@ public class PatientConfirmReceiptJob implements Job {
 | 
	
		
			
				|  |  |                         long days = DateUtil.getDays(today,payTime);
 | 
	
		
			
				|  |  |                         if(days == 3){
 | 
	
		
			
				|  |  |                             //支付后第三天发送自动确认预提醒
 | 
	
		
			
				|  |  |                             prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
 | 
	
		
			
				|  |  |                             list.add(prescription);
 | 
	
		
			
				|  |  |                             sendWechatTemplate(1,patient);
 | 
	
		
			
				|  |  |                             sendWechatTemplate(1,patient,prescription.getCode());
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         int result = today.compareTo(confirm);
 | 
	
		
			
				|  |  |                         if (result >= 0) {
 | 
	
		
			
				|  |  |                             prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
 | 
	
		
			
				|  |  |                             list.add(prescription);
 | 
	
		
			
				|  |  |                             //发送自动确认提醒
 | 
	
		
			
				|  |  |                             sendWechatTemplate(2,patient);
 | 
	
		
			
				|  |  |                             sendWechatTemplate(2,patient,prescription.getCode());
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
	
		
			
				|  | @ -101,9 +100,10 @@ public class PatientConfirmReceiptJob implements Job {
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param type    监测类型 2立即提醒,1预提醒
 | 
	
		
			
				|  |  |      * @param patient 居民code
 | 
	
		
			
				|  |  |      * @param patient 续方code
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void sendWechatTemplate(int type, String patient) throws Exception {
 | 
	
		
			
				|  |  |     public void sendWechatTemplate(int type, String patient,String PrescriptionCode) throws Exception {
 | 
	
		
			
				|  |  |         Patient people = patientDao.findByCode(patient);
 | 
	
		
			
				|  |  |         String openId = people.getOpenid();
 | 
	
		
			
				|  |  |         String name = people.getName();
 | 
	
	
		
			
				|  | @ -113,7 +113,7 @@ public class PatientConfirmReceiptJob implements Job {
 | 
	
		
			
				|  |  |         JSONObject sendJson = new JSONObject();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (type == 1) {
 | 
	
		
			
				|  |  |             String url = "prescription/html/order_tracking.html?represented="+patient;
 | 
	
		
			
				|  |  |             String url = "prescription/html/order_tracking.html?code=" + PrescriptionCode +"&represented="+patient;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String first = name + "您好,您的续方订单将在4天后自动确认收药,如您已经取药,请点击本消息完成确认收药操作,结束订单";
 | 
	
		
			
				|  |  |             String remark = "如果您希望延长自动确认收药时间,请点击本消息后进行延长收药操作。";
 | 
	
	
		
			
				|  | @ -124,7 +124,7 @@ public class PatientConfirmReceiptJob implements Job {
 | 
	
		
			
				|  |  |             sendJson.put("remark", remark);
 | 
	
		
			
				|  |  |             sendJson.put("url", url+ "&openid=" + openId +"&toUser=" + patient + "&toName=" +name);//带参数的模板跳转链接
 | 
	
		
			
				|  |  |             sendJson.put("toUser", patient);//带参数的模板跳转链接
 | 
	
		
			
				|  |  |             pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, openId, name, sendJson);
 | 
	
		
			
				|  |  |             pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 10, openId, name, sendJson);
 | 
	
		
			
				|  |  |             //发送代理人
 | 
	
		
			
				|  |  |             if (StringUtils.isEmpty(openId)){
 | 
	
		
			
				|  |  |                 jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
 | 
	
	
		
			
				|  | @ -137,13 +137,13 @@ public class PatientConfirmReceiptJob implements Job {
 | 
	
		
			
				|  |  |                         newJson.put("url", url+ "&openid=" + member.getOpenid() +"&toUser=" + member.getCode() + "&toName=" +name);
 | 
	
		
			
				|  |  |                         //name患者姓名
 | 
	
		
			
				|  |  |                         newJson.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
 | 
	
		
			
				|  |  |                         pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, member.getOpenid(), name, newJson);
 | 
	
		
			
				|  |  |                         pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 10, member.getOpenid(), name, newJson);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             logger.info("sendJson: " + sendJson);
 | 
	
		
			
				|  |  |         }else if (type == 2) {
 | 
	
		
			
				|  |  |             String url = "prescription/html/order_tracking.html?represented="+patient;
 | 
	
		
			
				|  |  |             String url = "prescription/html/order_tracking.html?code=" + PrescriptionCode +"&represented="+patient;
 | 
	
		
			
				|  |  |             String first = name + "您好,您的续方订单已自动确认收药";
 | 
	
		
			
				|  |  |             String remark = "如果您未收到续方药品,请及时与社区药房工作人员联系。";
 | 
	
		
			
				|  |  |             sendJson.put("keyword1", name);
 | 
	
	
		
			
				|  | @ -153,7 +153,7 @@ public class PatientConfirmReceiptJob implements Job {
 | 
	
		
			
				|  |  |             sendJson.put("remark", remark);
 | 
	
		
			
				|  |  |             sendJson.put("url", url+ "&openid=" + openId +"&toUser=" + patient + "&toName=" +name);//带参数的模板跳转链接
 | 
	
		
			
				|  |  |             sendJson.put("toUser", patient);//带参数的模板跳转链接
 | 
	
		
			
				|  |  |             pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, openId, name, sendJson);
 | 
	
		
			
				|  |  |             pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 10, openId, name, sendJson);
 | 
	
		
			
				|  |  |             //发送代理人
 | 
	
		
			
				|  |  |             if (StringUtils.isEmpty(openId)){
 | 
	
		
			
				|  |  |                 jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
 | 
	
	
		
			
				|  | @ -166,7 +166,7 @@ public class PatientConfirmReceiptJob implements Job {
 | 
	
		
			
				|  |  |                         newJson.put("url", url+ "&openid=" + member.getOpenid() +"&toUser=" + member.getCode() + "&toName=" +name);
 | 
	
		
			
				|  |  |                         //name患者姓名
 | 
	
		
			
				|  |  |                         newJson.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
 | 
	
		
			
				|  |  |                         pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, member.getOpenid(), name, newJson);
 | 
	
		
			
				|  |  |                         pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 10, member.getOpenid(), name, newJson);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 |