瀏覽代碼

Merge branch 'dev' of wangzhinan/patient-co-management into dev

trick9191 7 年之前
父節點
當前提交
3e4404adfa

+ 27 - 2
common/common-entity/src/main/java/com/yihu/wlyy/entity/wechat/WechatTemplate.java

@ -31,7 +31,17 @@ public class WechatTemplate extends IdEntity {
     * 详细内容
     */
    private Map<String,WechatTemplateData> data;
    
    /**
     * 所需跳转到的小程序appid
     */
    private String appId;
    /**
     * 所需跳转到小程序的具体页面路径,支持带参数
     */
    private String pagePath;
    public String getTemplate_id() {
        return template_id;
    }
@ -62,5 +72,20 @@ public class WechatTemplate extends IdEntity {
    public void setData(Map<String, WechatTemplateData> data) {
        this.data = data;
    }
    
    public String getAppId() {
        return appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    public String getPagePath() {
        return pagePath;
    }
    public void setPagePath(String pagePath) {
        this.pagePath = pagePath;
    }
}

+ 79 - 12
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/bank/TaskService.java

@ -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);
    }*/
}

+ 15 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/bank/TaskController.java

@ -121,4 +121,19 @@ public class TaskController extends BaseController{
    }
    @RequestMapping(value = "/sendTempleMessage",method = RequestMethod.POST)
    @ApiOperation("获取用户信息")
    public String sendTempleMessage(@ApiParam(name = "patientId",value = "居民id")
                                    @RequestParam(name = "patientId")String patientId,
                                    @ApiParam(name = "activityId",value = "活动id")
                                    @RequestParam(name = "activituId")String activityId){
        try {
            return write(200,"查询成功","data",service.selectByOpenId(getOpenid(),getUID()));
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
}