Browse Source

健管师扫描二维码签约入口,

trick9191 7 years ago
parent
commit
ce42d53481

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

@ -123,31 +123,63 @@ public class SignWebService extends BaseService {
     * @return
     */
    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" +
                "    ,b.openid" +
                "    ,a.renew_flag as renewFlag" +
                " from " +
                " ( 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  order by applyDate desc limit " + page * pageSize + "," + pageSize;
        Doctor d =doctorDao.findByCode(doctor);
        String sql ;
        if(d!=null&&d.getLevel()==3){
            // 如果医生是健管师
             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" +
                    "    ,b.openid" +
                    "    ,a.renew_flag as renewFlag" +
                    " from " +
                    " ( 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  order by applyDate desc limit " + page * pageSize + "," + pageSize;
        }else{
            // 查询语句
             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" +
                    "    ,b.openid" +
                    "    ,a.renew_flag as renewFlag" +
                    " from " +
                    " ( 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  order by applyDate desc limit " + page * pageSize + "," + pageSize;
        }
        // 查询已经签约语句
        String isSignSql = "select " +
                "    a.code " +