Procházet zdrojové kódy

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

trick9191 před 7 roky
rodič
revize
81487a2d4c

+ 100 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java

@ -6,8 +6,11 @@ import com.yihu.wlyy.wechat.util.WeiXinMessageReplyUtils;
import com.yihu.wlyy.wechat.util.WeiXinMessageUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
@ -21,6 +24,8 @@ import java.util.*;
@Component
public class WeiXinEventProcess {
    private static Logger logger = LoggerFactory.getLogger(WeiXinEventProcess.class);
    @Value("${wechat.wechat_base_url}")
    private String wechat_base_url;
    @Value("${wechat.appId}")
@ -29,6 +34,9 @@ public class WeiXinEventProcess {
    private String serverUrl;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 微信推送事件处理
@ -313,7 +321,38 @@ public class WeiXinEventProcess {
            json.put("type", 20);
            //模板消息json串
            result = json.toString();
        } else {
        }else if (StringUtils.isNotEmpty(eventKey) && (("wechat_ehc").equals(eventKey)) ||
                eventKey.startsWith("qrscene_wechat_ehc")) {
            // 配置信息
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            // 图文信息
            List<Map<String, String>> articles = new ArrayList<>();
            Map<String, String> article = new HashMap<>();
            // 图文URL
            String url = systemConf.getProperty("doctor_subscribe_url");
            // 图文消息图片URL
            String picUrl = systemConf.getProperty("doctor_qrcode_pic_url");
            // URL设置服务器URL、AppId
            url = url.replace("{server}", wechat_base_url)
                    .replace("{appId}", appId);
            //图片地址
            picUrl = picUrl.replace("{server}", serverUrl);
            article.put("Url", url);
            article.put("Title", "欢迎关注厦门i健康,快来签约家庭医生吧~");
            article.put("Description", "请点击查看家庭签约");
            article.put("PicUrl", picUrl);
            articles.add(article);
            //设置共有的图文消息
            setUrlItems(articles, systemConf);
            setWifi(message.get("FromUserName"),articles,systemConf);
            // 构建回复消息XML
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        }else {
            // 配置信息
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            // 图文信息
@ -346,6 +385,35 @@ public class WeiXinEventProcess {
        return result;
    }
    public void setWifi(String openid,List<Map<String, String>> articles, Properties systemConf){
        try{
            String sql = "SELECT t.id FROM wlyy_patient t WHERE t.openid = '"+openid+"'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            logger.info("setWifi_openid:"+openid+" openid_listSize:"+list.size());
            if(list!=null&&list.size()>0) {
                Map<String, String> articleConsult = new HashMap<>();
                // 图文URL
                String urlConsult = systemConf.getProperty("patient_wifi_url");
                // 图文消息图片URL
                String picUrlConsult = systemConf.getProperty("patient_wifi_pic_url");
                // URL设置服务器URL、AppId
                urlConsult = urlConsult.replace("{server}", wechat_base_url)
                        .replace("{appId}", appId);
                //图片地址
                picUrlConsult = picUrlConsult.replace("{server}", serverUrl);
                articleConsult.put("Url", urlConsult);
                articleConsult.put("Title", "共享wifi");
                articleConsult.put("Description", "共享wifi");
                articleConsult.put("PicUrl", picUrlConsult);
                articles.add(articleConsult);
            }
        }catch (Exception e){
            logger.info(e.getMessage());
        }
    }
    /**
     * 设置微信公共的图文消息
     *
@ -555,6 +623,37 @@ public class WeiXinEventProcess {
            json.put("type", 20);
            //模板消息json串
            result = json.toString();
        }else if (StringUtils.isNotEmpty(eventKey) && (("wechat_hslq").equals(eventKey)) ||
                eventKey.startsWith("qrscene_wechat_hslq")) {
            // 配置信息
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            // 图文信息
            List<Map<String, String>> articles = new ArrayList<>();
            Map<String, String> article = new HashMap<>();
            // 图文URL
            String url = systemConf.getProperty("doctor_subscribe_url");
            // 图文消息图片URL
            String picUrl = systemConf.getProperty("doctor_qrcode_pic_url");
            // URL设置服务器URL、AppId
            url = url.replace("{server}", wechat_base_url)
                    .replace("{appId}", appId);
            //图片地址
            picUrl = picUrl.replace("{server}", serverUrl);
            article.put("Url", url);
            article.put("Title", "欢迎关注厦门i健康,快来签约家庭医生吧~");
            article.put("Description", "请点击查看家庭签约");
            article.put("PicUrl", picUrl);
            articles.add(article);
            //设置共有的图文消息
            setUrlItems(articles, systemConf);
            setWifi(message.get("FromUserName"),articles,systemConf);
            // 构建回复消息XML
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        }
        return result;

+ 4 - 2
patient-co/patient-co-wlyy/src/main/resources/system.properties

@ -28,8 +28,10 @@ patient_examination_url=https://open.weixin.qq.com/connect/oauth2/authorize?appi
patient_prescription_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fprescription%2fhtml%2fprescription_records.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#居民取药码
patient_QRCode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fprescription%2fhtml%2fmy-medicine-code.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#居民wifi图片地址
patient_wifi_pic_url = {server}/images/wifi.png
#居民wifi链接
patient_wifi_url = https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fintroduction%2fhtml%2fyygh.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=code#wechat_redirect
#就诊记录
patient_visit_pic ={server}/images/visit.png
#检查检验

binární
patient-co/patient-co-wlyy/src/main/webapp/images/wifi.png