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