|
@ -166,7 +166,7 @@ public class ChildFamilyImmuneService extends BaseService {
|
|
|
" type IN (1, 2)" +
|
|
|
" AND `status` = 1" +
|
|
|
" AND expenses_status = 1" +
|
|
|
" AND doctor = '"+doctorcode+"'" +
|
|
|
" AND (doctor = '"+doctorcode+"' or doctor_health='"+doctorcode+"')" +
|
|
|
" ) b ON a.family_code = b.patient" +
|
|
|
" LEFT JOIN wlyy_child_info c ON c.`code` = a.child_code where a.child_code='"+childCode+"'";
|
|
|
List<Map<String,Object>> familyList = jdbcTemplate.queryForList(familySql);
|
|
@ -241,18 +241,19 @@ public class ChildFamilyImmuneService extends BaseService {
|
|
|
for (Map<String,Object> map : list){
|
|
|
//如果父母亲都在就都发
|
|
|
if (!openIdList.contains(String.valueOf(map.get("openid")))){
|
|
|
if (("1".equals(String.valueOf(map.get("relation"))) || "2".equals(String.valueOf(map.get("relation")))) && StringUtils.isNotBlank(String.valueOf(map.get("openid")))){
|
|
|
if ( StringUtils.isNotBlank(String.valueOf(map.get("openid")))){
|
|
|
boolean flag =true;
|
|
|
try {
|
|
|
WechatTemplateConfig temp = templateConfigDao.findByScene("template_deal_with", "ymjztx");
|
|
|
WechatTemplateConfig temp = templateConfigDao.findByScene("template_doctor_survey", "ymjztx");
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("toUser",String.valueOf(map.get("code")));
|
|
|
json.put("keyword1", temp.getKeyword1().replace("key1",DateUtil.dateToStr(new Date(), "yyyy-MM-dd")));
|
|
|
json.put("keyword2", temp.getKeyword2().replace("key1", doctorName+"("+doctorLevel+")"));
|
|
|
json.put("keyword1", temp.getKeyword1());
|
|
|
json.put("keyword2", temp.getKeyword2().replace("key1",DateUtil.dateToStr(new Date(), "yyyy-MM-dd")));
|
|
|
json.put("remark", temp.getRemark());
|
|
|
json.put("first", temp.getFirst().replace("key1",String.valueOf(map.get("name"))).replace("key2", childName).replace("key3",vaccinName));
|
|
|
json.put("first", temp.getFirst().replace("key1",String.valueOf(map.get("name"))).replace("key2", childName));
|
|
|
json.put("url",temp.getUrl().replace("key1",childCode));
|
|
|
logger.info("weiTempJOSN:"+json.toString());
|
|
|
pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 24,String.valueOf(map.get("openid")) , String.valueOf(map.get("name")), json);
|
|
|
pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11,String.valueOf(map.get("openid")) , String.valueOf(map.get("name")), json);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
flag = false;
|
|
@ -515,4 +516,46 @@ public class ChildFamilyImmuneService extends BaseService {
|
|
|
alertJsonStr = jsonArray.toString();
|
|
|
return alertImmVacclinByChildInfoCodes(alertJsonStr,doctor);
|
|
|
}
|
|
|
|
|
|
public int alertBefore()throws Exception{
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
String sql ="SELECT" +
|
|
|
" v.*, i.birthday" +
|
|
|
" FROM" +
|
|
|
" wlyy_child_immune_vaccin v" +
|
|
|
" LEFT JOIN wlyy_child_info i ON v.child_info_code = i.`code`" +
|
|
|
" WHERE" +
|
|
|
" v.del = 0" +
|
|
|
" AND ymkc = 'true'";
|
|
|
List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
|
|
|
String nowDate = DateUtil.dateToStrShort(new Date());
|
|
|
for (Map<String,Object> map : mapList){
|
|
|
Calendar calendar=Calendar.getInstance();
|
|
|
String birthDayStr = String.valueOf(map.get("birthday"));
|
|
|
if (StringUtils.isNotBlank(birthDayStr)){
|
|
|
String[] biStr = birthDayStr.split("-");
|
|
|
int birthdayDate = Integer.valueOf(biStr[biStr.length-1]);
|
|
|
int nowDayDate = calendar.get(GregorianCalendar.DAY_OF_MONTH);
|
|
|
int nowMonthDate = calendar.get(GregorianCalendar.MONTH)+1;
|
|
|
int nowYearDate = calendar.get(GregorianCalendar.YEAR);
|
|
|
//如果生日在今天的日期之前,则取下个月生日的日期的15天的是否是今天.
|
|
|
if (birthdayDate<nowDayDate){
|
|
|
calendar.set(nowYearDate,nowMonthDate+1,birthdayDate);
|
|
|
}else {
|
|
|
//如果生日在今天之前后,则看生日的15天之前是否是今天
|
|
|
calendar.set(nowYearDate,nowMonthDate,birthdayDate);
|
|
|
}
|
|
|
String needAlertDate = DateUtil.dateToStrShort(DateUtil.getPreDays(calendar.getTime(),-15));
|
|
|
if (needAlertDate.equals(nowDate)){
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("vaccinCode",map.get("code"));//待接种疫苗记录code
|
|
|
jsonObject.put("childName", map.get("name"));//儿童姓名
|
|
|
jsonObject.put("childCode", map.get("child_info_code"));//儿童code
|
|
|
jsonObject.put("vaccinName", map.get("ymmc"));//疫苗名称
|
|
|
jsonArray.put(jsonObject);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return alertImmVacclinByChildInfoCodes(jsonArray.toString(),"rll201703150222");
|
|
|
}
|
|
|
}
|