Prechádzať zdrojové kódy

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

trick9191 7 rokov pred
rodič
commit
46eed9970d

+ 31 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/physicalExamination/PhysicalExaminationRemindService.java

@ -322,11 +322,13 @@ public class PhysicalExaminationRemindService extends BaseService {
        String mobile = patient.getMobile();
        Boolean flag = true;
        // 推送消息给微信端
        String url = "huanzhe/html/jiankangtijian.html?openid=" + patient.getOpenid() +"&toUser="+patient.getCode()+"&toName=" + patient.getName();
        String first = "您的家庭医生" + doctName + "提醒,您可以到签约社区进行免费的健康体检啦~";
        JSONObject json = new org.json.JSONObject();
        json.put("first", "您的家庭医生" + doctName + "提醒,您可以到签约社区进行免费的健康体检啦~");
        json.put("first",first);
        json.put("url",url);
        json.put("keyword1", "健康体检");
        json.put("keyword2", format.format(new Date()));
        json.put("url", "");
        json.put("remark", "为了您和您的家庭医生了解您近期的健康状况,请及时到您签约的社区体检哟~");
        if (StringUtils.isNotBlank(patient.getOpenid())) {
            pushMsgTask.putWxMsg(accessToken, 11, patient.getOpenid(), patient.getName(), json);
@ -338,11 +340,14 @@ public class PhysicalExaminationRemindService extends BaseService {
            for (int i = 0; i < jsonArray.length(); i++) {
                org.json.JSONObject j = jsonArray.getJSONObject(i);
                Patient member = (Patient) j.get("member");
                json.remove("toUser");
                json.put("toUser", member.getCode());
                int start = url.indexOf("&toUser=");
                int end = url.indexOf("&", start + 1);
                String touser = url.substring(start, end);
                url = url.replace(touser, "&toUser=" + member.getCode());
                json.remove("first");
                try {
                    json.put("first", openIdUtils.getTitleMes(patient, j.isNull("relation") ? 1 : j.getInt("relation"), patient.getName()));
                    json.put("first", openIdUtils.getTitleMes(patient, j.isNull("relation") ? 1 : j.getInt("relation"), patient.getName())+first);
                    json.put("url", url);
                } catch (Exception e) {
                    e.printStackTrace();
                }
@ -354,7 +359,7 @@ public class PhysicalExaminationRemindService extends BaseService {
        }
//        微信发送失败发送短信
        if (flag && StringUtils.isNotEmpty(mobile)) {
            smsService.sendMsg(mobile, "您的家庭医生" + doctName + "提醒,您可以到签约社区进行免费的健康体检啦~");
            smsService.sendMsg(mobile, "厦门i健康家庭医生温馨提醒,您已经超过一年没有到社区进行健康体检啦,为了您和您的家庭医生了解您近期的健康状况,请及时到签约社区进行免费的健康体检");
        }
        //保存发送提醒
@ -381,15 +386,25 @@ public class PhysicalExaminationRemindService extends BaseService {
        Boolean flag = true;
        // 推送消息给微信端
        JSONObject json = new org.json.JSONObject();
        json.put("first", "您的家庭医生" + doctName + "提醒,您可以到签约社区进行免费的健康体检啦~");
        json.put("keyword1", "健康体检");
        json.put("keyword2", format.format(new Date()));
        json.put("url", "");
        json.put("remark", "为了您和您的家庭医生了解您近期的健康状况,请及时到您签约的社区体检哟~");
        List<Patient> patients = patientDao.findExaminationRemind(teamId, new Date());
        Calendar c = Calendar.getInstance();
        c.setTime(new Date());
        c.add(Calendar.YEAR, -1);
        Date yesteryear = c.getTime();
        List<Patient> patients = patientDao.findExaminationRemind(teamId, yesteryear);
        for (Patient patient : patients) {
            String url = "huanzhe/html/jiankangtijian.html?openid=" + patient.getOpenid() +"&toUser="+patient.getCode()+"&toName=" + patient.getName();
            String first = "您的家庭医生" + doctName + "提醒,您可以到签约社区进行免费的健康体检啦~";
            json.put("first",first);
            json.put("url",url);
            String mobile = patient.getMobile();
            List<PatientRemindRecords> records = patientRemindRecordsDao.findByPatientAndType(patient.getCode(), 1);
            if (records != null && records.size() > 0) {
                continue;
            }
            if (StringUtils.isNotBlank(patient.getOpenid())) {
                pushMsgTask.putWxMsg(accessToken, 11, patient.getOpenid(), patient.getName(), json);
                flag = false;
@ -400,11 +415,14 @@ public class PhysicalExaminationRemindService extends BaseService {
                for (int i = 0; i < jsonArray.length(); i++) {
                    org.json.JSONObject j = jsonArray.getJSONObject(i);
                    Patient member = (Patient) j.get("member");
                    json.remove("toUser");
                    json.put("toUser", member.getCode());
                    int start = url.indexOf("&toUser=");
                    int end = url.indexOf("&", start + 1);
                    String touser = url.substring(start, end);
                    url = url.replace(touser, "&toUser=" + member.getCode());
                    json.remove("first");
                    try {
                        json.put("first", openIdUtils.getTitleMes(patient, j.isNull("relation") ? 1 : j.getInt("relation"), patient.getName()));
                        json.put("first", openIdUtils.getTitleMes(patient, j.isNull("relation") ? 1 : j.getInt("relation"), patient.getName())+first);
                        json.put("url", url);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
@ -416,7 +434,7 @@ public class PhysicalExaminationRemindService extends BaseService {
            }
            //        微信发送失败发送短信
            if (flag && StringUtils.isNotEmpty(mobile)) {
                smsService.sendMsg(mobile, "您的家庭医生" + doctName + "提醒,您可以到签约社区进行免费的健康体检啦~");
                smsService.sendMsg(mobile, "厦门i健康家庭医生温馨提醒,您已经超过一年没有到社区进行健康体检啦,为了您和您的家庭医生了解您近期的健康状况,请及时到签约社区进行免费的健康体检");
            }
            flag = true;
            //保存发送提醒