|
@ -14,10 +14,12 @@ import org.json.JSONObject;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* Created by Reece on 2017/10/19/019.
|
|
@ -96,7 +98,8 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
* @param doctName 医生姓名
|
|
|
* @return
|
|
|
*/
|
|
|
public void sendBatchNotice(String teamId, String doctName) throws Exception {
|
|
|
@Async
|
|
|
public void sendBatchNotice(long teamId, String doctName) throws Exception {
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
|
|
|
String accessToken = accessTokenUtils.getAccessToken();
|
|
|
// 推送消息给微信端
|
|
@ -107,41 +110,41 @@ public class PhysicalExaminationRemindService extends BaseService {
|
|
|
json.put("url", "");
|
|
|
json.put("remark", "为了您和您的家庭医生了解您近期的健康状况,请及时到您签约的社区体检哟~");
|
|
|
|
|
|
String sql = "SELECT DISTINCT\n" +
|
|
|
"\tt1.*\n" +
|
|
|
"FROM\n" +
|
|
|
"\twlyy_sign_family t1\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tt1. STATUS > 0\n" +
|
|
|
"AND t1.admin_team_code = 485\n" +
|
|
|
"AND (\n" +
|
|
|
"\tYEAR (curdate()) -\n" +
|
|
|
"\tIF (\n" +
|
|
|
"\t\tlength(idcard) = 18,\n" +
|
|
|
"\t\tsubstring(idcard, 7, 4),\n" +
|
|
|
"\n" +
|
|
|
"\tIF (\n" +
|
|
|
"\t\tlength(idcard) = 15,\n" +
|
|
|
"\t\tconcat('19', substring(idcard, 7, 2)),\n" +
|
|
|
"\t\tNULL\n" +
|
|
|
"\t)\n" +
|
|
|
"\t)\n" +
|
|
|
") > 65\n" +
|
|
|
"AND t1.idcard NOT IN (\n" +
|
|
|
"\tSELECT DISTINCT\n" +
|
|
|
"\t\ts.idcard\n" +
|
|
|
"\tFROM\n" +
|
|
|
"\t\twlyy_sign_family s,\n" +
|
|
|
"\t\twlyy_old_people_physical_examination o\n" +
|
|
|
"\tWHERE\n" +
|
|
|
"\t\ts.admin_team_code =485\n" +
|
|
|
"\tAND s.`status` > 0\n" +
|
|
|
"\tAND s.idcard = o.id_card\n" +
|
|
|
"\tAND o.medical_time >'2016-10-19 15:12:11'\n" +
|
|
|
")\n" +
|
|
|
"ORDER BY\n" +
|
|
|
"\tt1.openid DESC,\n" +
|
|
|
"\tCONVERT (t1. NAME USING gbk)";
|
|
|
String sql = "SELECT DISTINCT " +
|
|
|
" t1.* " +
|
|
|
" FROM" +
|
|
|
" wlyy_sign_family t1 " +
|
|
|
" WHERE " +
|
|
|
" t1. STATUS > 0 " +
|
|
|
" AND t1.admin_team_code = 485 " +
|
|
|
" AND ( " +
|
|
|
" YEAR (curdate()) - " +
|
|
|
" IF ( " +
|
|
|
" length(idcard) = 18, " +
|
|
|
" substring(idcard, 7, 4), " +
|
|
|
" IF ( " +
|
|
|
" length(idcard) = 15, " +
|
|
|
" concat('19', substring(idcard, 7, 2)), " +
|
|
|
" NULL " +
|
|
|
" ) " +
|
|
|
" ) " +
|
|
|
" ) > 65 " +
|
|
|
" AND t1.idcard NOT IN ( " +
|
|
|
" SELECT DISTINCT " +
|
|
|
" s.idcard " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family s, " +
|
|
|
" wlyy_old_people_physical_examination o " +
|
|
|
" WHERE " +
|
|
|
" s.admin_team_code =485 " +
|
|
|
" AND s.`status` > 0 " +
|
|
|
" AND s.idcard = o.id_card " +
|
|
|
" AND o.medical_time >'2016-10-19 15:12:11' " +
|
|
|
" )" +
|
|
|
" ORDER BY " +
|
|
|
" t1.openid DESC, " +
|
|
|
" CONVERT (t1. NAME USING gbk)";
|
|
|
List<Patient>patients = patientDao.findExaminationRemind(485,new Date());
|
|
|
Patient patient = patientDao.findByCode("");
|
|
|
if (StringUtils.isNotBlank(patient.getOpenid())) {
|
|
|
pushMsgTask.putWxMsg(accessToken, 11, patient.getOpenid(), patient.getName(), json);
|