|
@ -64,31 +64,34 @@ public class HealthMessageJob implements Job {
|
|
|
String deleteSql="delete from wlyy_message where type=3 and czrq >= '"+yesterday+" 00:00:00'and czrq <= '"+now+" 00:00:00'";
|
|
|
jdbcTemplate.execute(deleteSql);
|
|
|
//生成新的数据
|
|
|
String sql="select doctor,doctor_name from wlyy_sign_family " +
|
|
|
" where status >0 and type='2' and expenses_status='1' " +
|
|
|
" and expenses_time >='"+yesterday+" 00:00:00' and expenses_time<'"+now+" 00:00:00' and (doctor_health is null or doctor_health = '')" ;
|
|
|
String sql="select admin_team_code from wlyy_sign_family " +
|
|
|
" where status >0 and type='2' " +
|
|
|
" and apply_date >='"+yesterday+" 00:00:00' and apply_date<'"+now+" 00:00:00' and (doctor_health is null or doctor_health = '')" ;
|
|
|
String countSql="select count(id) from wlyy_sign_family " +
|
|
|
" where status >0 and type='2' and expenses_status='1' " +
|
|
|
" and expenses_time >='"+yesterday+" 00:00:00' and expenses_time<'"+now+" 00:00:00' and (doctor_health is null or doctor_health = '')" ;
|
|
|
" where status >0 and type='2' " +
|
|
|
" and apply_date >='"+yesterday+" 00:00:00' and apply_date<'"+now+" 00:00:00' and (doctor_health is null or doctor_health = '')" ;
|
|
|
List<SignFamily> signFamilyList=dbExtract.extractByPage(SignFamily.class,sql,countSql,true);
|
|
|
Map<String,List<SignFamily>> signFamilyMap=new HashMap<String,List<SignFamily>>();
|
|
|
Map<Long,List<SignFamily>> signFamilyMap=new HashMap<Long,List<SignFamily>>();
|
|
|
for(int i=0;i<signFamilyList.size();i++){
|
|
|
SignFamily signFamilyTemp=signFamilyList.get(i);
|
|
|
if (signFamilyMap.containsKey(signFamilyTemp.getDoctor())){
|
|
|
signFamilyMap.get(signFamilyTemp.getDoctor()).add(signFamilyTemp);
|
|
|
if (signFamilyMap.containsKey(signFamilyTemp.getAdminTeamCode())){
|
|
|
signFamilyMap.get(signFamilyTemp.getAdminTeamCode()).add(signFamilyTemp);
|
|
|
}else{
|
|
|
List<SignFamily> signFamilies=new ArrayList<>();
|
|
|
signFamilies.add(signFamilyTemp);
|
|
|
signFamilyMap.put(signFamilyTemp.getDoctor(),signFamilies);
|
|
|
signFamilyMap.put(signFamilyTemp.getAdminTeamCode(),signFamilies);
|
|
|
}
|
|
|
}
|
|
|
JSONArray jsonArray=new JSONArray();
|
|
|
for(Map.Entry<String,List<SignFamily>> entry:signFamilyMap.entrySet()){
|
|
|
for(Map.Entry<Long,List<SignFamily>> entry:signFamilyMap.entrySet()){
|
|
|
//得到未分配的所有数目
|
|
|
countSql="select count(id) from wlyy_sign_family " +
|
|
|
" where status >0 and type='2' and expenses_status='1' " +
|
|
|
" and expenses_time<'"+now+" 00:00:00' and (doctor_health is null or doctor_health = '') and doctor='"+entry.getKey()+"'" ;
|
|
|
|
|
|
" where status >0 and type='2' " +
|
|
|
" and apply_date<'"+now+" 00:00:00' and (doctor_health is null or doctor_health = '') and admin_team_code="+entry.getKey()+"" ;
|
|
|
Integer allCount=jdbcTemplate.queryForObject(countSql,Integer.class);
|
|
|
//得到团队的leader
|
|
|
sql="select leader_code from wlyy_admin_team m where m.id= ?";
|
|
|
String teamLeader=jdbcTemplate.queryForObject(sql,String.class,entry.getKey());
|
|
|
Message message=new Message();
|
|
|
message.setType(3);
|
|
|
message.setRead(0);
|
|
@ -104,13 +107,13 @@ public class HealthMessageJob implements Job {
|
|
|
String content=dateFormat2.format(dateFormat1.parse(yesterday))+"新增"+entry.getValue().size()+"个签约居民待分配健管师,目前共"+allCount+"人待处理";
|
|
|
message.setContent(content);
|
|
|
message.setCode(UUID.randomUUID().toString());
|
|
|
message.setReceiver(entry.getKey());
|
|
|
message.setReceiver(teamLeader);
|
|
|
messageDao.save(message);
|
|
|
|
|
|
|
|
|
// 异常通知
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("receiver", entry.getKey());
|
|
|
json.put("receiver", teamLeader);
|
|
|
json.put("type", "D_NH_01");
|
|
|
json.put("title", title);
|
|
|
json.put("msg", content);
|