|
@ -884,16 +884,16 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查找签约老人
|
|
|
* 查找签约老人 + 名单800
|
|
|
* @param name
|
|
|
* @param residentialArea
|
|
|
* @param limit
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> findOld(String name,String residentialArea,String area,Integer level,String limit,String filter1){
|
|
|
String sql = "SELECT a.id,a.name,a.photo,a.idcard,CAST(IFNULL(a.birthday,'') AS char ) birthday,a.residential_area residentialArea,a.sex " +
|
|
|
String sql = "SELECT DISTINCT a.id,a.name,a.photo,a.idcard,CAST(IFNULL(a.birthday,'') AS char ) birthday,a.residential_area residentialArea,a.sex " +
|
|
|
",a.ykt_id yktId, case 1 WHEN openid is not null then 1 WHEN a.on_line = '1' then 1 ELSE 0 end as online,IFNULL(sign_status,0) signStatus from base_patient a " +
|
|
|
" WHERE a.archive_type = 1 and a.del = '1' and a.sign_status=1 ";
|
|
|
" WHERE a.archive_type = 1 and a.del = '1' and (a.sign_status=1 or a.register = '1') ";
|
|
|
|
|
|
//case 1 WHEN openid is not null then 1 WHEN a.on_line = '1' then 1 ELSE 0 end as online
|
|
|
//if(openid is null,0,1) onlineWx,IFNULL(a.on_line,0) onlinePad
|
|
@ -907,7 +907,18 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
|
|
|
sql += " and EXISTS ( select 1 from " +
|
|
|
"base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack " +
|
|
|
" where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id " +
|
|
|
" and i.del = 1 and sr.`status`=1 and CONVERT(sr.patient USING utf8) = a.id and r.team_code='"+area+"') ";
|
|
|
" and i.del = 1 and sr.`status`=1 and CONVERT(sr.patient USING utf8) = a.id and r.team_code='"+area+"') ";
|
|
|
|
|
|
sql += " OR (a.saas_id = '"+area+"' ";
|
|
|
|
|
|
if (StringUtils.isNotBlank(name)){
|
|
|
sql+= " and a.name like '%"+name+"%' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(residentialArea)){
|
|
|
sql+= " and a.residential_area = '"+residentialArea+"' ";
|
|
|
}
|
|
|
sql +=" )";
|
|
|
|
|
|
}
|
|
|
sql += filter1;
|
|
|
sql += " GROUP BY a.id,a.name,a.photo,a.idcard,a.birthday,a.residential_area,a.sex,a.ykt_id,online,signStatus ";
|
|
@ -956,7 +967,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
|
|
|
}
|
|
|
|
|
|
public Integer findOldTotal(String name,String residentialArea,String area,Integer level,String filter){
|
|
|
String sql = "SELECT count(a.id) from base_patient a WHERE a.archive_type = 1 and a.del = '1' and a.sign_status=1 ";
|
|
|
String sql = "SELECT count(DISTINCT a.id) from base_patient a WHERE a.archive_type = 1 and a.del = '1' and (a.sign_status=1 or a.register = 1)";
|
|
|
if(!StringUtil.isBlank(name)){
|
|
|
sql+= " and name like '%"+name+"%' ";
|
|
|
}
|
|
@ -967,7 +978,16 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
|
|
|
sql += " and EXISTS ( select 1 from " +
|
|
|
"base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack " +
|
|
|
" where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id " +
|
|
|
" and i.del = 1 and sr.`status`=1 and CONVERT(sr.patient USING utf8) = a.id and r.team_code='"+area+"' ) ";
|
|
|
" and i.del = 1 and sr.`status`=1 and CONVERT(sr.patient USING utf8) = a.id and r.team_code='"+area+"' ) ";
|
|
|
|
|
|
sql += "OR (a.saas_id = '"+area+"' ";
|
|
|
if (StringUtils.isNotBlank(name)){
|
|
|
sql+= " and a.name like '%"+name+"%' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(residentialArea)){
|
|
|
sql+= " and a.residential_area = '"+residentialArea+"' ";
|
|
|
}
|
|
|
sql +=" )";
|
|
|
}
|
|
|
sql += filter;
|
|
|
return jdbcTemplate.queryForObject(sql,Integer.class);
|