|
@ -66,6 +66,7 @@ public class ChildVaccinImmuneService extends BaseService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public int getChildImmuneVaccinEveryDay()throws Exception{
|
|
|
int result = 0;
|
|
|
String nowShotDay = DateUtil.dateToStrShort(new Date());
|
|
|
try {
|
|
|
/*String sql ="SELECT" +
|
|
|
" DISTINCT ci.`code`," +
|
|
@ -83,7 +84,6 @@ public class ChildVaccinImmuneService extends BaseService {
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
for (Map<String,Object> map : list){
|
|
|
String barcode = String.valueOf(map.get("barcode"));
|
|
|
System.out.println("===============barcode=============="+barcode);
|
|
|
String deptStr = immuneService.findDept(barcode);
|
|
|
if (StringUtils.isNotBlank(deptStr)){
|
|
|
JSONObject jsonObject = new JSONObject(deptStr);
|
|
@ -108,19 +108,19 @@ public class ChildVaccinImmuneService extends BaseService {
|
|
|
count++;
|
|
|
}
|
|
|
}
|
|
|
//原来有的疫苗要判断是否有超过预约时间的7天,并且看提醒是否超过7天,超过7天可以重新提醒
|
|
|
if (count>0 && childImmuneVaccin.getIsOut()==1){
|
|
|
if (DateUtil.getPreDays(childImmuneVaccin.getJzrq(),7).before(new Date())){
|
|
|
//过了预约时间7天,更新为isOut=0,则不能预约了
|
|
|
//childImmuneVaccinDao.updateIsOutByCode(childImmuneVaccin.getCode());
|
|
|
String uSql ="UPDATE wlyy_child_immune_vaccin SET is_out=0 AND `code`='"+childImmuneVaccin.getCode()+"'";
|
|
|
jdbcTemplate.update(uSql);
|
|
|
}else {
|
|
|
//判断是否过了7天提醒时间
|
|
|
String afterAlertSevenDay = DateUtil.dateToStr(DateUtil.getPreDays(childImmuneVaccin.getAlert_time(),7),DateUtil.YYYY_MM_DD);
|
|
|
String nowShotDay = DateUtil.dateToStrShort(new Date());
|
|
|
//原来有的疫苗要判断是否有超过预约时间的7天,并且看提醒是否超过7天,超过7天可以重新提醒
|
|
|
if (count>0 && childImmuneVaccin.getIsOut()==1){
|
|
|
String afterJzrqSevenDay = DateUtil.dateToStr(DateUtil.getPreDays(childImmuneVaccin.getJzrq(),7),DateUtil.YYYY_MM_DD);
|
|
|
String afterAlertSevenDay = DateUtil.dateToStr(DateUtil.getPreDays(childImmuneVaccin.getAlert_time(),7),DateUtil.YYYY_MM_DD);
|
|
|
if ( DateUtil.strToDate(afterJzrqSevenDay,DateUtil.YYYY_MM_DD).before(DateUtil.strToDate(nowShotDay,DateUtil.YYYY_MM_DD))){
|
|
|
//过了预约时间7天,更新为isOut=0,则不能预约了
|
|
|
//childImmuneVaccinDao.updateIsOutByCode(childImmuneVaccin.getCode());
|
|
|
String uSql ="UPDATE wlyy_child_immune_vaccin SET is_out=0 where `code`='"+childImmuneVaccin.getCode()+"'";
|
|
|
jdbcTemplate.update(uSql);
|
|
|
}else {
|
|
|
//判断是否过了7天提醒时间
|
|
|
if (childImmuneVaccin.getAlert_tag()==1 && DateUtil.strToDate(afterAlertSevenDay,DateUtil.YYYY_MM_DD).before(DateUtil.strToDate(nowShotDay,DateUtil.YYYY_MM_DD))) {
|
|
|
String updateSql = "UPDATE wlyy_child_immune_vaccin SET alert_tag=0 AND `code`='" + childImmuneVaccin.getCode() + "'";
|
|
|
String updateSql = "UPDATE wlyy_child_immune_vaccin SET alert_tag=0 where `code`='" + childImmuneVaccin.getCode() + "'";
|
|
|
jdbcTemplate.update(updateSql);
|
|
|
}
|
|
|
}
|
|
@ -158,8 +158,8 @@ public class ChildVaccinImmuneService extends BaseService {
|
|
|
childImmuneVaccin.setAlert_tag(0);
|
|
|
childImmuneVaccin.setDel(0);
|
|
|
childImmuneVaccin.setCreate_time(new Date());
|
|
|
if (DateUtil.getPreDays(DateUtil.strToDate(vaccinJsonJSONArray.getJSONObject(j).getString("jzRq")),7).before(new Date())){
|
|
|
//过了预约时间7天,更新为isOut=0,则不能预约了
|
|
|
String afterJzrqSevenDay = DateUtil.dateToStr(DateUtil.getPreDays(childImmuneVaccin.getJzrq(),7),DateUtil.YYYY_MM_DD);
|
|
|
if ( DateUtil.strToDate(afterJzrqSevenDay,DateUtil.YYYY_MM_DD).before(DateUtil.strToDate(nowShotDay,DateUtil.YYYY_MM_DD))){ //过了预约时间7天,更新为isOut=0,则不能预约了
|
|
|
childImmuneVaccin.setIsOut(0);
|
|
|
}else {
|
|
|
childImmuneVaccin.setIsOut(1);
|
|
@ -236,6 +236,8 @@ public class ChildVaccinImmuneService extends BaseService {
|
|
|
jsonObject.put("childName", map.get("name"));//儿童姓名
|
|
|
jsonObject.put("childCode", map.get("child_info_code"));//儿童code
|
|
|
jsonObject.put("vaccinName", map.get("ymmc"));//疫苗名称
|
|
|
jsonObject.put("jzrq",map.get("jzrq"));//接种日期
|
|
|
jsonObject.put("jzzc",map.get("jzzc"));//接种针次
|
|
|
jsonArray.put(jsonObject);
|
|
|
}
|
|
|
}
|
|
@ -260,7 +262,9 @@ public class ChildVaccinImmuneService extends BaseService {
|
|
|
String childName = jsonObject.getString("childName");
|
|
|
String vaccinName = jsonObject.getString("vaccinName");
|
|
|
String vaccinCode = jsonObject.getString("vaccinCode");
|
|
|
String sql ="SELECT" +
|
|
|
String jzrq = jsonObject.getString("jzrq");
|
|
|
String jzzc = jsonObject.getString("jzzc");
|
|
|
String sql ="SELECT" +
|
|
|
" cfi.relation," +
|
|
|
" p.`code`," +
|
|
|
" p.`name`," +
|
|
@ -270,7 +274,7 @@ public class ChildVaccinImmuneService extends BaseService {
|
|
|
" LEFT JOIN wlyy_patient p ON cfi.family_code = p.`code`" +
|
|
|
" WHERE" +
|
|
|
" cfi.child_code = '"+childCode+"'" +
|
|
|
" AND cfi.del = 0 and (p.openid is not null or p.openid !='')";
|
|
|
" AND cfi.del = 0 and (p.openid is not null or p.openid !='') AND p.`code`='0fab4dd67e074e16ac86db6b6c15233e'";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if (list.size()==0){
|
|
|
return -10000;
|
|
@ -285,10 +289,10 @@ public class ChildVaccinImmuneService extends BaseService {
|
|
|
WechatTemplateConfig temp = templateConfigDao.findByScene("template_doctor_survey", "dsymjztx");
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("toUser",String.valueOf(map.get("code")));
|
|
|
json.put("keyword1", temp.getKeyword1());
|
|
|
json.put("keyword1", temp.getKeyword1().replace("key1",vaccinName).replace("key2",jzzc));
|
|
|
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));
|
|
|
json.put("first", temp.getFirst().replace("key1",String.valueOf(map.get("name"))).replace("key2", childName).replace("key3",jzrq));
|
|
|
json.put("url",temp.getUrl().replace("key1",childCode));
|
|
|
logger.info("weiTempJOSN:"+json.toString());
|
|
|
pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11,String.valueOf(map.get("openid")) , String.valueOf(map.get("name")), json);
|