humingfen преди 7 години
родител
ревизия
2c3b304b52
променени са 1 файла, в които са добавени 14 реда и са изтрити 17 реда
  1. 14 17
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

+ 14 - 17
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -189,7 +189,7 @@ public class SignWebService extends BaseService {
                    " ( select renew_flag,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin from wlyy_sign_family where doctor_health = ? and doctor is null  and status = ? and type = 2" +
                    (status == 3 ? " and expenses_status = '1'" : "") + " order by begin desc ) a " +
                    " ,wlyy_patient b " +
                    " where a.patient = b.code and (b.`name` like ? or b.mobile LIKE ? ) "+
                    " where a.patient = b.code and (b.`name`  or b.mobile like ? ) "+
                    " order by applyDate desc limit " + page * pageSize + "," + pageSize;
        } else {
            // 查询语句
@ -217,7 +217,7 @@ public class SignWebService extends BaseService {
                    " ( select renew_flag,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin from wlyy_sign_family where doctor = ?  and status = ? and type = 2" +
                    (status == 3 ? " and expenses_status = '1'" : "") + " order by begin desc ) a " +
                    " ,wlyy_patient b " +
                    " where a.patient = b.code  and (b.`name` like ? or b.mobile LIKE ? ) "+
                    " where a.patient = b.code  and (b.`name`  or b.mobile like ? ) "+
                    "order by applyDate desc limit " + page * pageSize + "," + pageSize;
        }
@ -246,7 +246,7 @@ public class SignWebService extends BaseService {
                " ( select renew_flag,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin from wlyy_sign_family where (doctor = ? or 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  and (b.`name` like ? or b.mobile LIKE ? ) "+
                " where a.patient = b.code  and (b.`name`  or b.mobile like ? ) "+
                "order by applyDate desc limit " + page * pageSize + "," + pageSize;
        // 未缴费查询语句
        String sqlExpenses = "select " +
@ -272,7 +272,7 @@ public class SignWebService extends BaseService {
                " from " +
                " ( select patient_apply_date,renew_flag,code,patient,doctor,status,id,apply_date,reason,begin,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len from wlyy_sign_family where (doctor = ? or 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) and (b.`name` like ? or b.mobile LIKE ? ) "+
                " where a.patient = b.code and (a.expenses_status = '0' or a.len < 1) and (b.`name` or b.mobile like ? ) "+
                "order by applyDate desc limit " + page * pageSize + "," + pageSize;
        // 已解约查询语句
@ -309,19 +309,19 @@ public class SignWebService extends BaseService {
        List<Map<String, Object>> patients = null;
        switch (status) {
            case 1:// 待签约
                patients = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(sql, new Object[]{doctor, 0, "%%", "%%"}):jdbcTemplate.queryForList(sql, new Object[]{doctor, 0, "%"+patientInfo + "%", "%"+patientInfo + "%"});
                patients = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(sql, new Object[]{doctor, 0, "%%"}):jdbcTemplate.queryForList(sql, new Object[]{doctor, 0, "%"+patientInfo + "%"});
                break;
            case 2:// 待解约
                patients = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(sql, new Object[]{doctor, 2, "%%", "%%"}) : jdbcTemplate.queryForList(sql, new Object[]{doctor, 2, "%"+patientInfo + "%", "%"+patientInfo + "%"});
                patients = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(sql, new Object[]{doctor, 2, "%%"}) : jdbcTemplate.queryForList(sql, new Object[]{doctor, 2, "%"+patientInfo + "%"});
                break;
            case 3:// 已签约
                patients = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(isSignSql, new Object[]{doctor, doctor, 1, "%%", "%%"}) : jdbcTemplate.queryForList(isSignSql, new Object[]{doctor, doctor, 1, "%"+patientInfo + "%", "%"+patientInfo + "%"});
                patients = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(isSignSql, new Object[]{doctor, doctor, 1, "%%"}) : jdbcTemplate.queryForList(isSignSql, new Object[]{doctor, doctor, 1, "%"+patientInfo + "%"});
                break;
            case 4:// 4已经解约
                patients = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(surrSql, new Object[]{doctor, doctor, -3, -4, "%%", "%%"}) : jdbcTemplate.queryForList(surrSql, new Object[]{doctor, doctor, -3, -4, "%"+patientInfo + "%", "%"+patientInfo + "%"});
                patients = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(surrSql, new Object[]{doctor, doctor, -3, -4, "%%"}) : jdbcTemplate.queryForList(surrSql, new Object[]{doctor, doctor, -3, -4, "%"+patientInfo + "%"});
                break;
            case 5: // 未缴费
                patients = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, doctor, 0, "%%", "%%"}) : jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, doctor, 0, "%"+patientInfo + "%", "%"+patientInfo + "%"});
                patients = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, doctor, 0, "%%"}) : jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, doctor, 0, "%"+patientInfo + "%"});
        }
        return patients;
@ -350,7 +350,6 @@ public class SignWebService extends BaseService {
                    " AND STATUS = 0 " +
                    " AND type = 2 " +
                    " AND expenses_status = '0' " +
                     " AND (`name` or mobile like ? ) " +
                    " ) AS waitSignCount, " +
                    "( " +
                    " SELECT " +
@ -362,7 +361,6 @@ public class SignWebService extends BaseService {
                    " AND STATUS > 0 " +
                    " AND type = 2 " +
                    " AND expenses_status = '0'  " +
                     " AND (`name` or mobile like ? ) " +
                    " ) AS waitPayCount, " +
                    "( " +
                    " SELECT " +
@ -374,7 +372,6 @@ public class SignWebService extends BaseService {
                    " AND STATUS = 1 " +
                    " AND type = 2 " +
                    " AND expenses_status = '1'  " +
                     " AND (`name` or mobile like ? ) " +
                    " ) AS signCount";
        }else{
             sql ="SELECT  " +
@ -388,7 +385,6 @@ public class SignWebService extends BaseService {
                    " AND STATUS = 0 " +
                    " AND type = 2 " +
                    " AND expenses_status = '0' " +
                     " AND (`name` or mobile like ? ) " +
                    " ) AS waitSignCount, " +
                    "( " +
                    " SELECT " +
@ -400,7 +396,6 @@ public class SignWebService extends BaseService {
                    " AND STATUS > 0 " +
                    " AND type = 2 " +
                    " AND expenses_status = '0'  " +
                     " AND (`name` or mobile like ? ) " +
                    " ) AS waitPayCount, " +
                    "( " +
                    " SELECT " +
@ -412,11 +407,13 @@ public class SignWebService extends BaseService {
                    " AND STATUS = 1 " +
                    " AND type = 2 " +
                    " AND expenses_status = '1'  " +
                     " AND (`name` or mobile like ? ) " +
                    " ) AS signCount";
        }
        List<Map<String,Object>> list = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(sql, new Object[]{"%%", "%%", "%%"}) : jdbcTemplate.queryForList(sql, new Object[]{ "%"+patientInfo + "%", "%"+patientInfo + "%", "%"+patientInfo + "%"});
        if(StringUtils.isNotBlank(patientInfo)) {
            sql = sql.replace(") AS", "AND (`name` or mobile like '%" + patientInfo + "%' ) ) AS");
        }
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
//        List<Map<String,Object>> list = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(sql, new Object[]{"%%", "%%", "%%"}) : jdbcTemplate.queryForList(sql, new Object[]{ "%"+patientInfo + "%", "%"+patientInfo + "%", "%"+patientInfo + "%"});
        if(list!=null&&list.size()>0){
            return new JSONObject(list.get(0));