|  | @ -12,7 +12,10 @@ import com.yihu.wlyy.repository.patient.PatientDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.patient.PatientFamilyMemberDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.patient.SignFamilyDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.statistics.WlyySignFamilyCodeDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.task.PushMsgTask;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.util.HttpClientUtil;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
	
		
			
				|  | @ -57,7 +60,12 @@ public class TaskService {
 | 
	
		
			
				|  |  |     private SignFamilyDao signFamilyDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private WlyySignFamilyCodeDao signFamilyCodeDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private WechatTemplateConfigDao templateConfigDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PushMsgTask pushMsgTask;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private WeiXinAccessTokenUtils weiXinAccessTokenUtils;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取url
 | 
	
	
		
			
				|  | @ -84,14 +92,14 @@ public class TaskService {
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject selectActivity(JSONObject object,Integer page,Integer size){
 | 
	
		
			
				|  |  |         String response = null;
 | 
	
		
			
				|  |  | 	    if(object.containsKey("patientid")){
 | 
	
		
			
				|  |  | 		    Patient patient = patientDao.findByCode(object.getString("patientId"));
 | 
	
		
			
				|  |  | 		    if (patient != null){
 | 
	
		
			
				|  |  | 			    object.put("patientIdcard",patient.getIdcard());
 | 
	
		
			
				|  |  | 			    object.put("unionId",patient.getUnionid());
 | 
	
		
			
				|  |  | 			    object.remove("patientId");
 | 
	
		
			
				|  |  | 		    }
 | 
	
		
			
				|  |  | 	    }
 | 
	
		
			
				|  |  |         if(object.containsKey("patientId")){
 | 
	
		
			
				|  |  |             Patient patient = patientDao.findByCode(object.getString("patientId"));
 | 
	
		
			
				|  |  |             if (patient != null){
 | 
	
		
			
				|  |  |                 object.put("patientIdcard",patient.getIdcard());
 | 
	
		
			
				|  |  |                 object.put("unionId",patient.getUnionid());
 | 
	
		
			
				|  |  |                 object.remove("patientId");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String url =getBaseUrl() + "findActivity";
 | 
	
		
			
				|  |  |         Map<String,String> params = new HashMap<>();
 | 
	
	
		
			
				|  | @ -99,10 +107,7 @@ public class TaskService {
 | 
	
		
			
				|  |  |         params.put("activity",object.toJSONString());
 | 
	
		
			
				|  |  |         params.put("page",page.toString());
 | 
	
		
			
				|  |  |         params.put("size",size.toString());
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         params.put("activity",object.toJSONString());
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             response = httpClientUtil.httpPost(url,params);
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -170,11 +175,15 @@ public class TaskService {
 | 
	
		
			
				|  |  |         object.put("unionId",unionId);
 | 
	
		
			
				|  |  |         object.put("patientIdcard",patient.getIdcard());
 | 
	
		
			
				|  |  |         object.put("patientOpenid",patient.getOpenid());
 | 
	
		
			
				|  |  |         object.put("name",patient.getName());
 | 
	
		
			
				|  |  |         object.put("hospital",signFamily.getHospital());
 | 
	
		
			
				|  |  |         object.put("hospitalName",signFamily.getHospitalName());
 | 
	
		
			
				|  |  |         String url =getBaseUrl() + "attendTask";
 | 
	
		
			
				|  |  |         Map<String,String> params = new HashMap<>();
 | 
	
		
			
				|  |  |         params.put("taskPatientDetail",object.toJSONString());
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             response = httpClientUtil.httpPost(url,params);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             logger.error(e.getMessage());
 | 
	
	
		
			
				|  | @ -277,4 +286,62 @@ public class TaskService {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /*public JSONObject sendTemplateMessage(String patientId,String activityId){
 | 
	
		
			
				|  |  |         String response = null;
 | 
	
		
			
				|  |  |         Patient patient = patientDao.findByCode(patientId);
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |             if (patient != null){
 | 
	
		
			
				|  |  |                 object.put("patientIdcard",patient.getIdcard());
 | 
	
		
			
				|  |  |                 object.put("unionId",patient.getUnionid());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             String url =getBaseUrl() + "findActivity";
 | 
	
		
			
				|  |  |             Map<String,String> params = new HashMap<>();
 | 
	
		
			
				|  |  |             params.put("activity",object.toJSONString());
 | 
	
		
			
				|  |  |             params.put("page","1");
 | 
	
		
			
				|  |  |             params.put("size","1");
 | 
	
		
			
				|  |  |             String response1 = httpClientUtil.httpPost(url,params);
 | 
	
		
			
				|  |  |             JSONObject response2 = JSONObject.parseObject(response1);
 | 
	
		
			
				|  |  |             String openId = patient.getOpenid();
 | 
	
		
			
				|  |  |             String name = patient.getName();
 | 
	
		
			
				|  |  |             org.json.JSONObject sendJson = new org.json.JSONObject();
 | 
	
		
			
				|  |  |             String first = "";
 | 
	
		
			
				|  |  |             String remark = "";
 | 
	
		
			
				|  |  |             WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_healthbank_activity","bmcgtx");
 | 
	
		
			
				|  |  |             first = templateConfig.getFirst();
 | 
	
		
			
				|  |  |             remark = templateConfig.getRemark();
 | 
	
		
			
				|  |  |             sendJson.put("keyword1", integrate);
 | 
	
		
			
				|  |  |             sendJson.put("keyword2", DateUtil.getStringDate());
 | 
	
		
			
				|  |  |             sendJson.put("keyword3", total);
 | 
	
		
			
				|  |  |             sendJson.put("first", first);
 | 
	
		
			
				|  |  |             sendJson.put("remark", remark);
 | 
	
		
			
				|  |  |             sendJson.put("appId","wx0e663ce069b5170c");
 | 
	
		
			
				|  |  |             sendJson.put("pagePath","pages/index/index");
 | 
	
		
			
				|  |  |             System.out.println(sendJson.toString());
 | 
	
		
			
				|  |  |             pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 23, openId, name, sendJson);
 | 
	
		
			
				|  |  | //	                    //发送代理人
 | 
	
		
			
				|  |  | //	                    jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
 | 
	
		
			
				|  |  | //	                    if (jsonArray != null && jsonArray.length() > 0) {
 | 
	
		
			
				|  |  | //		                    for (int i = 0; i < jsonArray.length(); i++) {
 | 
	
		
			
				|  |  | //			                    org.json.JSONObject j = jsonArray.getJSONObject(i);
 | 
	
		
			
				|  |  | //			                    Patient member = (Patient) j.get("member");
 | 
	
		
			
				|  |  | //			                    int start = url.indexOf("&toUser=");
 | 
	
		
			
				|  |  | //			                    int end = url.indexOf("&", start + 1);
 | 
	
		
			
				|  |  | //			                    String touser = url.substring(start, end);
 | 
	
		
			
				|  |  | //			                    url = url.replace(touser, "&toUser=" + member.getCode());
 | 
	
		
			
				|  |  | //			                    //name患者姓名
 | 
	
		
			
				|  |  | //			                    sendJson.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
 | 
	
		
			
				|  |  | //			                    sendJson.put("url", url);
 | 
	
		
			
				|  |  | //			                    pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 19, member.getOpenid(), name, sendJson);
 | 
	
		
			
				|  |  | //		                    }
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             logger.error(e.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |     }*/
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |