|
@ -39,79 +39,90 @@ public class SignWebService extends BaseService {
|
|
|
*
|
|
|
* @param doctor
|
|
|
* @param status
|
|
|
* @param doctorType
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String, Object>> getSignWebByDoctor(String doctor, int status, int doctorType) {
|
|
|
public List<Map<String, Object>> getSignWebByDoctor(String doctor, int status, int page, int pagesize) {
|
|
|
// 查询语句
|
|
|
String sql = "select " +
|
|
|
" a.code " +
|
|
|
" ,a.doctor " +
|
|
|
" ,b.code as patient" +
|
|
|
" ,b.idcard " +
|
|
|
" ,b.name " +
|
|
|
" ,b.province_name as provinceName" +
|
|
|
" ,b.city_name as cityName" +
|
|
|
" ,b.town_name as townName" +
|
|
|
" ,b.address " +
|
|
|
" ,b.photo " +
|
|
|
" ,a.status " +
|
|
|
" ,a.id " +
|
|
|
(status == 1? " ,a.patient_apply_date as applyDate ":" ,a.expenses_time as applyDate ") +
|
|
|
" ,a.reason " +
|
|
|
" ,b.street_name as streetName" +
|
|
|
" ,b.sex" +
|
|
|
" a1.code " +
|
|
|
" ,a1.repdoctor doctor" +
|
|
|
" ,b1.code as patient" +
|
|
|
" ,b1.idcard " +
|
|
|
" ,b1.name " +
|
|
|
" ,b1.province_name as provinceName" +
|
|
|
" ,b1.city_name as cityName" +
|
|
|
" ,b1.town_name as townName" +
|
|
|
" ,b1.address " +
|
|
|
" ,b1.photo " +
|
|
|
" ,a1.status " +
|
|
|
" ,a1.id " +
|
|
|
(status == 1 ? " ,a1.patient_apply_date as applyDate " : " ,a1.expenses_time as applyDate ") +
|
|
|
" ,a1.reason " +
|
|
|
" ,b1.street_name as streetName" +
|
|
|
" ,b1.sex" +
|
|
|
" from " +
|
|
|
" ( select code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin from wlyy_sign_family where " + (doctorType == 2 ? "doctor" : "doctor_health") + " = ? and status = ? and type = 2" +
|
|
|
(status == 3 ? " and expenses_status = '1'" : "") + " order by begin desc ) a " +
|
|
|
" ,wlyy_patient b " +
|
|
|
" where a.patient = b.code order by a.begin desc ";
|
|
|
" ( select code,patient,repdoctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin from wlyy_sign_family where repdoctor = ? and status = ? and type = 2 " +
|
|
|
(status == 3 ? " and expenses_status = '1'" : "") + ") a1 " +
|
|
|
" ,wlyy_patient b1 " +
|
|
|
" where a1.patient = b1.code ";
|
|
|
|
|
|
sql = "select t.* from (" + sql.replaceAll("repdoctor","doctor") + " union all "
|
|
|
+ sql.replaceAll("repdoctor","doctor_health").replaceAll("a1","a2").replaceAll("b1","b2")
|
|
|
+ ") t order by t.begin desc limit " + page * pagesize + "," + pagesize;
|
|
|
|
|
|
// 未缴费查询语句
|
|
|
String sqlExpenses = "select " +
|
|
|
" a.code " +
|
|
|
" ,a.doctor " +
|
|
|
" ,b.code as patient" +
|
|
|
" ,b.name " +
|
|
|
" ,b.idcard " +
|
|
|
" ,b.province_name as provinceName" +
|
|
|
" ,b.city_name as cityName" +
|
|
|
" ,b.town_name as townName" +
|
|
|
" ,b.address " +
|
|
|
" ,b.photo " +
|
|
|
" ,a.status " +
|
|
|
" ,a.id " +
|
|
|
" ,a.apply_date as applyDate " +
|
|
|
" ,a.reason " +
|
|
|
" ,b.street_name as streetName" +
|
|
|
" ,b.sex" +
|
|
|
" a1.code " +
|
|
|
" ,a1.repdoctor doctor" +
|
|
|
" ,b1.code as patient" +
|
|
|
" ,b1.name " +
|
|
|
" ,b1.idcard " +
|
|
|
" ,b1.province_name as provinceName" +
|
|
|
" ,b1.city_name as cityName" +
|
|
|
" ,b1.town_name as townName" +
|
|
|
" ,b1.address " +
|
|
|
" ,b1.photo " +
|
|
|
" ,a1.status " +
|
|
|
" ,a1.id " +
|
|
|
" ,a1.apply_date as applyDate " +
|
|
|
" ,a1.reason " +
|
|
|
" ,b1.street_name as streetName" +
|
|
|
" ,b1.sex" +
|
|
|
" from " +
|
|
|
" ( select code,patient,doctor,status,id,apply_date,reason,begin,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len from wlyy_sign_family where " + (doctorType == 2 ? "doctor" : "doctor_health") + " = ? and status > ? and type = 2 order by begin desc ) a " +
|
|
|
" ,wlyy_patient b " +
|
|
|
" where a.patient = b.code and (a.expenses_status = '0' or a.len < 1) order by a.begin desc ";
|
|
|
" ( select code,patient,repdoctor,status,id,apply_date,reason,begin,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len from wlyy_sign_family where repdoctor = ? and status > ? and type = 2 ) a1 " +
|
|
|
" ,wlyy_patient b1 " +
|
|
|
" where a1.patient = b1.code and (a1.expenses_status = '0' or a1.len < 1) ";
|
|
|
|
|
|
sqlExpenses = "select t.* from (" + sqlExpenses.replaceAll("repdoctor","doctor") + " union all "
|
|
|
+ sqlExpenses.replaceAll("repdoctor","doctor_health").replaceAll("a1","a2").replaceAll("b1","b2")
|
|
|
+ ") t order by t.begin desc limit " + page * pagesize + "," + pagesize;
|
|
|
|
|
|
// 已解约查询语句
|
|
|
String surrSql = "select " +
|
|
|
" a.code " +
|
|
|
" ,a.doctor " +
|
|
|
" ,b.code as patient" +
|
|
|
" ,b.name " +
|
|
|
" ,b.idcard " +
|
|
|
" ,b.province_name as provinceName" +
|
|
|
" ,b.city_name as cityName" +
|
|
|
" ,b.town_name as townName" +
|
|
|
" ,b.address " +
|
|
|
" ,b.photo " +
|
|
|
" ,a.status " +
|
|
|
" ,a.id " +
|
|
|
" ,a.apply_unsign_date as applyDate" +
|
|
|
" ,a.reason " +
|
|
|
" ,b.street_name as streetName" +
|
|
|
" ,b.sex" +
|
|
|
" a1.code " +
|
|
|
" ,a1.repdoctor doctor" +
|
|
|
" ,b1.code as patient" +
|
|
|
" ,b1.name " +
|
|
|
" ,b1.idcard " +
|
|
|
" ,b1.province_name as provinceName" +
|
|
|
" ,b1.city_name as cityName" +
|
|
|
" ,b1.town_name as townName" +
|
|
|
" ,b1.address " +
|
|
|
" ,b1.photo " +
|
|
|
" ,a1.status " +
|
|
|
" ,a1.id " +
|
|
|
" ,a1.apply_unsign_date as applyDate" +
|
|
|
" ,a1.reason " +
|
|
|
" ,b1.street_name as streetName" +
|
|
|
" ,b1.sex" +
|
|
|
" from " +
|
|
|
" ( select code,patient,doctor,status,id,apply_date,apply_unsign_date,reason,begin from wlyy_sign_family where " + (doctorType == 2 ? "doctor" : "doctor_health") + " = ? and ( status = ? or status = ? ) and type = 2 order by begin desc ) a " +
|
|
|
" ,wlyy_patient b " +
|
|
|
" where a.patient = b.code order by a.begin desc ";
|
|
|
" ( select code,patient,repdoctor,status,id,apply_date,apply_unsign_date,reason,begin from wlyy_sign_family where repdoctor = ? and ( status = ? or status = ? ) and type = 2 ) a1 " +
|
|
|
" ,wlyy_patient b1 " +
|
|
|
" where a1.patient = b1.code ";
|
|
|
|
|
|
surrSql = "select t.* from (" + surrSql.replaceAll("repdoctor","doctor") + " union all "
|
|
|
+ surrSql.replaceAll("repdoctor","doctor_health").replaceAll("a1","a2").replaceAll("b1","b2")
|
|
|
+ ") t order by t.begin desc limit " + page * pagesize + "," + pagesize;
|
|
|
|
|
|
// 分页信息
|
|
|
//PageRequest pageRequest = new PageRequest(page - 1, pageSize);
|
|
@ -120,19 +131,19 @@ public class SignWebService extends BaseService {
|
|
|
List<Map<String, Object>> patients = null;
|
|
|
switch (status) {
|
|
|
case 1:// 待签约
|
|
|
patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 0});
|
|
|
patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 0, doctor, 0});
|
|
|
break;
|
|
|
case 2:// 待解约
|
|
|
patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 2});
|
|
|
patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 2, doctor, 2});
|
|
|
break;
|
|
|
case 3:// 已签约
|
|
|
patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 1});
|
|
|
patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 1, doctor, 1});
|
|
|
break;
|
|
|
case 4:// 4已经解约
|
|
|
patients = jdbcTemplate.queryForList(surrSql, new Object[]{doctor, -3, -4});
|
|
|
patients = jdbcTemplate.queryForList(surrSql, new Object[]{doctor, -3, -4, doctor, -3, -4});
|
|
|
break;
|
|
|
case 5: // 未缴费
|
|
|
patients = jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, 0});
|
|
|
patients = jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, 0, doctor, 0});
|
|
|
}
|
|
|
|
|
|
return patients;
|