Explorar el Código

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

trick9191 hace 7 años
padre
commit
59e580a267

+ 2 - 0
patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/web/common/qrcode/QrCodeController.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -345,6 +346,7 @@ public class QrCodeController extends WeixinBaseController {
        }
    }
    /**
     * 下载所有医生的二维码图片
     *

+ 5 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -47,6 +47,7 @@ import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
@ -1530,7 +1531,7 @@ public class SignWebService extends BaseService {
                    //发送短信
                    String mobile = (String) signFamily.get("mobile");
                    if (StringUtils.isNotBlank(mobile)) {
                        smsService.sendMsg(mobile, name + "您好!您的家庭医生将于6月30日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
                        smsService.sendMsg(mobile, name + "您好!您的家庭医生签约到期时间为"+ DateUtil.getNowYear()+"年6月30号,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
                    }
                }
@ -1592,7 +1593,7 @@ public class SignWebService extends BaseService {
                "  wlyy_sign_family a " +
                " WHERE " +
                "  a.patient = t.patient " +
                " AND a.status>0  " +
                " AND a.status>=0  " +
                " AND a.sign_year = '" + DateUtil.getSignYear() + "' " +
                ")";
@ -1651,7 +1652,7 @@ public class SignWebService extends BaseService {
                    //发送短信
                    String mobile = (String) signFamily.get("mobile");
                    if (StringUtils.isNotBlank(mobile)) {
                        smsService.sendMsg(mobile, name + "您好!您的家庭医生将于6月30日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
                        smsService.sendMsg(mobile, name + "您好!您的家庭医生签约到期时间为"+ DateUtil.getNowYear()+"年6月30号,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
                    }
                }
@ -2296,7 +2297,7 @@ public class SignWebService extends BaseService {
            //发送短信
            String mobile = p.getMobile();
            if (StringUtils.isNotBlank(mobile)) {
                smsService.sendMsg(mobile, name + "您好!您的家庭医生将于6月30日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
                smsService.sendMsg(mobile, name + "您好!您的家庭医生签约到期时间为"+ DateUtil.getNowYear()+"年6月30号,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
                patientSetReminFlag(patientCode);
                return 2;
            }

+ 47 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/qrcode/QrCodeController.java

@ -7,6 +7,7 @@ import com.yihu.wlyy.service.common.QrcodeService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -355,6 +356,52 @@ public class QrCodeController extends WeixinBaseController {
        }
    }
    /**
     * 根据场景值获取公众号永久二维码
     *
     * @param scene 场景值
     * @return 返回服务器二维码地址
     * @throws Exception
     */
    @RequestMapping(value = "/getQrcode_Img", method =  {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation(value = "获取公众号二维码接口")
    public void getQrcodeImg(@ApiParam(name = "scene", defaultValue = "") @RequestParam(value = "scene", required = true) String scene,
                             HttpServletResponse response) throws Exception {
        try {
            // 二维码内容
            String content = "jkzl_" +scene;
            // 二维码图片文件名
            String fileName = "jkzl_"+scene;
            String path = QrCodeController.class.getResource("/").getPath().replace("/WEB-INF/classes/", "")
                    + File.separator + "qrcode";
            // 通过微信接口生成医生二维码
            qrcodeService.makeQrcodeFromWeiXin(content, fileName.replaceAll("\r\n", ""), path, getAccessToken());
            String pathFile = request.getSession().getServletContext().getRealPath("/")
                    + File.separator + "qrcode" + File.separator + fileName.replaceAll("\r\n", "")+".png";
            InputStream inputStream = new FileInputStream(pathFile);
            response.setCharacterEncoding("utf-8");
            response.setContentType("multipart/form-data");
            response.setHeader("Content-Disposition", "attachment;fileName=" + fileName.replaceAll("\r\n", "")+".png");
            OutputStream outputStream = response.getOutputStream();
            byte[] b = new byte[2048];
            int length = 0;
            while ((length = inputStream.read(b)) > 0) {
                outputStream.write(b, 0, length);
            }
            outputStream.flush();
            outputStream.close();
            inputStream.close();
        } catch (Exception e) {
            error(e);
        }
    }
    /**
     * 下载所有医生的二维码图片
     *

+ 41 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/ylzpay/ThirdQrcodeController.java

@ -17,6 +17,9 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;
/**
 * Created by Reece on 2017/8/30/030.
@ -54,4 +57,42 @@ public class ThirdQrcodeController extends WeixinBaseController {
        }
    }
    /**
     * 根据场景值获取公众号永久二维码
     *
     * @param scene 场景值
     * @return 返回服务器二维码地址
     * @throws Exception
     */
    @RequestMapping(value = "/getQrcodeImg", method = RequestMethod.POST)
    @ApiOperation(value = "获取公众号二维码接口")
    public void getQrcodeImg(@ApiParam(name = "scene", defaultValue = "") @RequestParam(value = "scene", required = true) String scene,
                             HttpServletResponse response) throws Exception {
        try {
            String content = "wechat_" + scene;
            String p = ThirdQrcodeController.class.getResource("/").getPath().replace("/WEB-INF/classes/", "");
            // 通过微信接口生成医生二维码
            String result = qrcodeService.getQrcodeFromWeiXin(content, content.replaceAll("\r\n", ""), p, getAccessToken());
            String path = request.getSession().getServletContext().getRealPath("/")
                    + File.separator + "qrcode" + File.separator + content.replaceAll("\r\n", "") + ".png";
            InputStream inputStream = new FileInputStream(path);
            response.setCharacterEncoding("utf-8");
            response.setContentType("multipart/form-data");
            response.setHeader("Content-Disposition", "attachment;fileName=" + content.replaceAll("\r\n", ""));
            OutputStream outputStream = response.getOutputStream();
            byte[] b = new byte[2048];
            int length = 0;
            while ((length = inputStream.read(b)) > 0) {
                outputStream.write(b, 0, length);
            }
            outputStream.flush();
            outputStream.close();
            inputStream.close();
        } catch (Exception e) {
            error(e);
        }
    }
}

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

@ -451,6 +451,17 @@ public class WeiXinEventProcess {
            setSpDisease(articles,keys[0],keys[1],systemConf);
            // 构建回复消息XMLs
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        }else if (StringUtils.isNotEmpty(eventKey) && (eventKey.startsWith("jkzl_")||eventKey.startsWith("qrscene_jkzl_"))){
            // 配置信息
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            // 图文信息
            List<Map<String, String>> articles = new ArrayList<>();
            // 二维码参数
//            String[] keys = eventKey.replace("qrscene_","").replace("sp_disease_", "").split("_");
            //设置图文消息
            setCurrency(articles,systemConf);
            // 构建回复消息XMLs
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        }else {
            // 配置信息
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
@ -545,7 +556,7 @@ public class WeiXinEventProcess {
        picUrlConsult = picUrlConsult.replace("{server}", serverUrl);
        articleConsult.put("Url", urlConsult);
        articleConsult.put("Title", "把健康带回家,流动人口网上回访问卷赢电影票");
        articleConsult.put("Title", "新市民健康城市行,网上回访问卷赢电影票");
        articleConsult.put("Description", "数量有限,小伙伴们千万不要错过!");
        articleConsult.put("PicUrl", picUrlConsult);
@ -824,6 +835,17 @@ public class WeiXinEventProcess {
            setSpDisease(articles,keys[0],keys[1],systemConf);
            // 构建回复消息XMLs
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        }else if (StringUtils.isNotEmpty(eventKey) && (eventKey.startsWith("jkzl_")||eventKey.startsWith("qrscene_jkzl_"))){
            // 配置信息
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            // 图文信息
            List<Map<String, String>> articles = new ArrayList<>();
            // 二维码参数
//            String[] keys = eventKey.replace("qrscene_","").replace("sp_disease_", "").split("_");
            //设置图文消息
            setCurrency(articles,systemConf);
            // 构建回复消息XMLs
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        }
        return result;
@ -850,6 +872,28 @@ public class WeiXinEventProcess {
        articles.add(articleConsult);
    }
    public void setCurrency(List<Map<String, String>> articles,Properties systemConf){
        String url = systemDictDao.findByDictName("WX_CURRENCY_QR_PATH").get(0).getCode();
        String title = systemDictDao.findByDictName("WX_CURRENCY_QR_TITLE").get(0).getCode();
        String content = systemDictDao.findByDictName("WX_CURRENCY_QR_CONTENT").get(0).getCode();
        url = url.replace("{appId}", appId);
        logger.info("setCurrency:"+url);
        // 图文消息图片URL
        String picUrlConsult = systemConf.getProperty("currency_url");
        picUrlConsult = picUrlConsult.replace("{server}", serverUrl);
        Map<String, String> articleConsult = new HashMap<>();
        articleConsult.put("Url", url);
        articleConsult.put("Title", title);
        articleConsult.put("Description", content);
        articleConsult.put("PicUrl", picUrlConsult);
        logger.info("setCurrency:"+url+"_"+picUrlConsult+"_"+content+"_"+title);
        articles.add(articleConsult);
    }
    /**
     * 构建单个图文消息工具类
     *

+ 1 - 1
patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

@ -36,7 +36,7 @@ im:
#专病配置
specialist:
  #url: http://172.19.103.33:9797/svr-wlyy-specialist
  url: http://localhost:10051/svr-wlyy-specialist
  url: http://localhost:8070/
#物联网配置
iot:
#  url: http://192.168.131.24:8088/svr-iot/

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

@ -38,6 +38,8 @@ patient_wifi_pic_url = {server}/images/wifi.png
patient_draw_pic_url = {server}/images/banner01.png
#专科医生签约图片地址
specialist_sign_url = {server}/images/SpBanner.png
#通用活动图片地址
currency_url = {server}/images/currency.png
#居民wifi链接
patient_wifi_url =http://freewifi.mobcb.com/Portal/Wx/login
#就诊记录

BIN
patient-co/patient-co-wlyy/src/main/webapp/images/currency.png