|
@ -423,4 +423,34 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
public PageEnvelop getArchiveList(Integer type,Integer signStatus,Integer page,Integer size){
|
|
|
page = page>0?page-1:0;
|
|
|
String countSql ="select count(DISTINCT p.id)";
|
|
|
String sql = "select DISTINCT p.id,p.name,p.sex,p.photo,p.idcard from base_patient p ";
|
|
|
String sqlCondition = "";
|
|
|
if (null!=type){
|
|
|
sqlCondition +=" and p.del=1 and p.archive_type="+type+" ";
|
|
|
}
|
|
|
if (null!=signStatus){
|
|
|
if (-1==signStatus){//未签约
|
|
|
sqlCondition +=" and NOT EXISTS(select sr.id from base_service_package_sign_record sr " +
|
|
|
" INNER JOIN base_service_package_record pr on sr.id = pr.sign_id and sr.status=1 " +
|
|
|
" INNER JOIN base_service_package pack on pr.service_package_id = pack.id and pack.del=1 " +
|
|
|
" where sr.patient = p.id) ";
|
|
|
}
|
|
|
if (1==signStatus){//已签约
|
|
|
sqlCondition +=" and EXISTS(select sr.id from base_service_package_sign_record sr " +
|
|
|
" INNER JOIN base_service_package_record pr on sr.id = pr.sign_id and sr.status=1 " +
|
|
|
" INNER JOIN base_service_package pack on pr.service_package_id = pack.id and pack.del=1 " +
|
|
|
" where sr.patient = p.id) ";
|
|
|
}
|
|
|
}
|
|
|
Long count = jdbcTemplate.queryForObject(countSql+sqlCondition,Long.class);
|
|
|
sqlCondition +=" limit "+page*size+","+size;
|
|
|
List<Map<String,Object>> result = jdbcTemplate.queryForList(sql+sqlCondition);
|
|
|
|
|
|
return PageEnvelop.getSuccessListWithPage("查询成功",result,page,size,count);
|
|
|
}
|
|
|
|
|
|
}
|