소스 검색

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

yeshijie 7 년 전
부모
커밋
fa79df2a67

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/SMS.java

@ -18,7 +18,7 @@ public class SMS extends IdEntity {
    private String mobile;// 手机号
    private String ip;// ip地址
    private Integer type;// 消息类型:1微信端注册,2微信端找回密码,3医生端找回密码,4患者登录,5医生登录,6代预约(发送给居民)  10患者添加家庭关系,11账号申诉处理完成
    private Integer type;// 消息类型:0:客服系统发送消息 1微信端注册,2微信端找回密码,3医生端找回密码,4患者登录,5医生登录,6代预约(发送给居民)  10患者添加家庭关系,11账号申诉处理完成
    private String captcha;// 验证码
    private String content;// 消息内容
    private Date deadline;// 过期时间

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/user/range/user_role_add_js.jsp

@ -102,7 +102,7 @@
//                            {display: '机构编码', name: 'hospital', width: '0%', align: "center", hide: true},
                            {display: '新增机构', name: 'hospitalName', width: '25%', align: "left",
                                render: function (row) {
                                    var html = '',
                                    var html = '<option value=""></option>',
                                        htmlStr = '';
                                    for(var i=0;i<selectDict.length;i++){
                                        if(row.hospital == selectDict[i].code){

+ 25 - 0
patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcMessageController.java

@ -1,10 +1,14 @@
package com.yihu.wlyy.web.third.gateway.controller.doctor;
import com.yihu.wlyy.entity.message.SMS;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.message.SMSDao;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.NetworkUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.web.third.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultBatchModel;
import com.yihu.wlyy.wechat.util.WeiXinTempMsgSendUtils;
@ -46,6 +50,8 @@ public class GcMessageController {
    private SMSService smsService;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    public SMSDao smsDao;
    @Value("${wechat.message.template_consult_notice}")
    private String templateId;
    @Value("${wechat.message.template_callserver_remind}")
@ -211,6 +217,25 @@ public class GcMessageController {
            for (String mobile : codeArr) {
                try {
                    JSONObject result = smsService.sendMsg(mobile, content);
                    // 保存短信发送记录
                    SMS sms = new SMS();
                    Date date = new Date();
                    // 延后5分钟
                    sms.setContent(content);
                    sms.setDeadline(DateUtil.getNextMin(date, 5));
                    sms.setCzrq(date);
                    sms.setMobile(mobile);
                    sms.setIp("customer");
                    sms.setType(0);
                    // 调用总部发送信息的接口
                    if (result != null && result.getInt("result") == 0) {
                        //发送成功,保存到数据库
                        sms.setStatus(1);
                        smsDao.save(sms);
                    }
                    logger.info("send mobile message param : "+mobile+" ====> "+content);
                    logger.info("send mobile message return : "+result);
                    success++;

+ 11 - 11
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/PatientConfirmReceiptJob.java

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