Browse Source

Merge branch 'dev' of trick9191/patient-co-management into dev

trick9191 8 years ago
parent
commit
f51e104de8

+ 26 - 27
patient-co-wlyy/src/main/java/com/yihu/wlyy/job/RenewToSignJob.java

@ -22,39 +22,38 @@ public class RenewToSignJob implements Job {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            System.out.println("RenewToSign start");
            Calendar cal = Calendar.getInstance();
            int year = cal.get(Calendar.YEAR)-1;
            int month = cal.get(Calendar.MONTH)+1;
            if(month >=7){
                //设置已过期
                String sql = "UPDATE wlyy_sign_family t SET t.status = -4,t.apply_unsign_date='"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss")+"' WHERE t.status>=0 AND t.sign_year='"+year+"'";
                //数据迁移
//                String sql2 ="INSERT INTO wlyy_sign_family(" +
//                        "code,lw_code,type,patient,openid,name,idcard,ssc," +
//                        "mobile,emer_mobile,hospital,hospital_name,doctor," +
//                        "doctor_name,begin,end,images,group_code,status,reason," +
//                        "czrq,team_code,sign_type,apply_date,release_speak," +
//                        "doctor_health_name,doctor_health,family_code,patient_apply_date," +
//                        "expenses,expenses_status,sign_source,sign_doctor_code,sign_doctor_name," +
//                        "sign_doctor_level,patient_apply_unsgin_date,apply_unsign_date,expenses_type," +
//                        "sign_year,medical_insurance_num,agent_doctor_code,agent_doctor_name," +
//                        "agent_doctor_level,admin_team_code,expenses_time,server_type,server_type_name,special_population,special_population_name) " +
//                        "SELECT code,lw_code,type,patient,openid,name,idcard,ssc," +
//                        "mobile,emer_mobile,hospital,hospital_name,doctor,doctor_name," +
//                        "begin,end,images,group_code,status,reason,czrq,team_code," +
//                        "sign_type,apply_date,release_speak,doctor_health_name," +
//                        "doctor_health,family_code,patient_apply_date,expenses," +
//                        "expenses_status,sign_source,sign_doctor_code,sign_doctor_name," +
//                        "sign_doctor_level,patient_apply_unsgin_date,apply_unsign_date," +
//                        "expenses_type,sign_year,medical_insurance_num,agent_doctor_code," +
//                        "agent_doctor_name,agent_doctor_level,admin_team_code,expenses_time,server_type,server_type_name,special_population,special_population_name " +
//                        "FROM wlyy_sign_family_renew t WHERE t.is_valid =0 AND t.status =1 AND t.sign_year='"+(year+1)+"' AND t.expenses_status='1'";
//                //更改迁移状态
//                String sql3 = "UPDATE wlyy_sign_family_renew t SET t.is_valid =1 WHERE t.is_valid =0 AND t.status =1 AND t.sign_year='"+(year+1)+"' AND t.expenses_status='1'";
                String sql = "UPDATE wlyy_sign_family t SET t.status = -4,t.apply_unsign_date='"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss")+"'  WHERE t.status>=0 AND t.sign_year='"+year+"'";
//                //数据迁移
                String sql2 ="INSERT INTO wlyy_sign_family(" +
                        "code,lw_code,type,patient,openid,name,idcard,ssc," +
                        "mobile,emer_mobile,hospital,hospital_name,doctor," +
                        "doctor_name,begin,end,images,group_code,status,reason," +
                        "czrq,team_code,sign_type,apply_date,release_speak," +
                        "doctor_health_name,doctor_health,family_code,patient_apply_date," +
                        "expenses,expenses_status,sign_source,sign_doctor_code,sign_doctor_name," +
                        "sign_doctor_level,patient_apply_unsgin_date,apply_unsign_date,expenses_type," +
                        "sign_year,medical_insurance_num,agent_doctor_code,agent_doctor_name," +
                        "agent_doctor_level,admin_team_code,expenses_time,server_type,server_type_name,special_population,special_population_name,renew_flag,renew_change_reason) " +
                        "SELECT code,lw_code,type,patient,openid,name,idcard,ssc," +
                        "mobile,emer_mobile,hospital,hospital_name,doctor,doctor_name," +
                        "begin,end,images,group_code,status,reason,czrq,team_code," +
                        "sign_type,apply_date,release_speak,doctor_health_name," +
                        "doctor_health,family_code,patient_apply_date,expenses," +
                        "expenses_status,sign_source,sign_doctor_code,sign_doctor_name," +
                        "sign_doctor_level,patient_apply_unsgin_date,apply_unsign_date," +
                        "expenses_type,sign_year,medical_insurance_num,agent_doctor_code," +
                        "agent_doctor_name,agent_doctor_level,admin_team_code,expenses_time,server_type,server_type_name,special_population,special_population_name,renew_flag,renew_change_reason " +
                        "FROM wlyy_sign_family_renew t WHERE t.is_valid =0 AND t.sign_year='"+(year+1)+"'";
                //更改迁移状态
                String sql3 = "UPDATE wlyy_sign_family_renew t SET t.is_valid =1 WHERE t.is_valid =0 AND t.sign_year='"+(year+1)+"'";
                jdbcTemplate.execute(sql);
//                jdbcTemplate.execute(sql2);
//                jdbcTemplate.execute(sql3);
                jdbcTemplate.execute(sql2);
                jdbcTemplate.execute(sql3);
            }
            System.out.println("RenewToSign end");

+ 4 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/job/SignEndJob.java

@ -53,7 +53,7 @@ public class SignEndJob implements Job {
                        "expenses,expenses_status,sign_source,sign_doctor_code,sign_doctor_name," +
                        "sign_doctor_level,patient_apply_unsgin_date,apply_unsign_date,expenses_type," +
                        "sign_year,medical_insurance_num,agent_doctor_code,agent_doctor_name," +
                        "agent_doctor_level,admin_team_code,expenses_time,server_type,server_type_name,special_population,special_population_name) " +
                        "agent_doctor_level,admin_team_code,expenses_time,server_type,server_type_name,special_population,special_population_name,renew_flag,renew_change_reason) " +
                        "SELECT code,lw_code,type,patient,openid,name,idcard,ssc," +
                        "mobile,emer_mobile,hospital,hospital_name,doctor,doctor_name," +
                        "begin,end,images,group_code,status,reason,czrq,team_code," +
@ -62,10 +62,10 @@ public class SignEndJob implements Job {
                        "expenses_status,sign_source,sign_doctor_code,sign_doctor_name," +
                        "sign_doctor_level,patient_apply_unsgin_date,apply_unsign_date," +
                        "expenses_type,sign_year,medical_insurance_num,agent_doctor_code," +
                        "agent_doctor_name,agent_doctor_level,admin_team_code,expenses_time,server_type,server_type_name,special_population,special_population_name " +
                        "FROM wlyy_sign_family_renew t WHERE t.is_valid =0 AND t.status =1 AND t.sign_year='"+(year+1)+"' AND t.expenses_status='1'";
                        "agent_doctor_name,agent_doctor_level,admin_team_code,expenses_time,server_type,server_type_name,special_population,special_population_name,renew_flag,renew_change_reason " +
                        "FROM wlyy_sign_family_renew t WHERE t.is_valid =0 AND t.sign_year='"+(year+1)+"'";
                //更改迁移状态
                String sql3 = "UPDATE wlyy_sign_family_renew t SET t.is_valid =1 WHERE t.is_valid =0 AND t.status =1 AND t.sign_year='"+(year+1)+"' AND t.expenses_status='1'";
                String sql3 = "UPDATE wlyy_sign_family_renew t SET t.is_valid =1 WHERE t.is_valid =0 AND t.sign_year='"+(year+1)+"'";
                jdbcTemplate.execute(sql);
                jdbcTemplate.execute(sql2);
                jdbcTemplate.execute(sql3);

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java

@ -1173,7 +1173,7 @@ public class FamilyMemberService extends BaseService {
    }
    public boolean isMobileNO(String number){
        Pattern pattern = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");
        Pattern pattern = Pattern.compile("^1(3|4|5|7|8)[0-9]\\d{8}$");
        Matcher m = pattern.matcher(number);
        return m.matches();
    }

+ 3 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -3228,11 +3228,13 @@ public class FamilyContractService extends BaseService {
        //判断续签医生是否一致
        if(doctor.equals((String)sign.get("doctor"))){
            //如果一致保存团队信息
            sf.setRenewFlag("1");
            sf.setTeamCode((String)sign.get("teamCode"));
            Integer c=(Integer)sign.get("adminTeamCode");
            sf.setAdminTeamId(c.longValue());
        }else {
            //如果不一致 查看医生团队
            sf.setRenewFlag("2");
//            String tcSql = "SELECT t.id FROM wlyy_admin_team t WHERE t.leader_code ='"+doctor+"'";
//            List<Map<String ,Object>> ids = jdbcTemplate.queryForList(tcSql);
//            if(ids!=null&&ids.size()>0){
@ -3340,7 +3342,7 @@ public class FamilyContractService extends BaseService {
            Message message = new Message();
            message.setCzrq(new Date());
            message.setCreateTime(new Date());
            message.setContent("您有一条新的家庭医生签约申请!");
            message.setContent("您有一条新的家庭医生续签申请!");
            message.setRead(1);//设置未读
            message.setReceiver(doctor);//设置接受医生的code
            message.setSender(patient);//设置发送的用户

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

@ -112,8 +112,9 @@ public class SignWebService extends BaseService {
                "    ,b.street_name as streetName" +
                "    ,b.sex" +
                "    ,b.openid" +
                "    ,a.renew_flag as renewFlag" +
                " from " +
                " ( select 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" +
                " ( 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 a.begin desc limit " + page * pageSize + "," + pageSize;
@ -137,8 +138,9 @@ public class SignWebService extends BaseService {
                "    ,b.street_name as streetName" +
                "    ,b.sex" +
                "    ,b.openid" +
                "    ,a.renew_flag as renewFlag" +
                " from " +
                " ( select 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 " +
                " ( select 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 = ?  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 limit " + page * pageSize + "," + pageSize;
@ -161,8 +163,9 @@ public class SignWebService extends BaseService {
                "    ,b.street_name as streetName" +
                "    ,b.sex" +
                "    ,b.openid" +
                "    ,a.renew_flag as renewFlag" +
                " from " +
                " ( select code,patient,doctor,status,id,apply_date,apply_unsign_date,reason,begin from wlyy_sign_family where (doctor = ? or doctor_health = ?) and ( status = ? or status = ? ) and type = 2 order by begin desc ) a " +
                " ( select renew_flag,code,patient,doctor,status,id,apply_date,apply_unsign_date,reason,begin from wlyy_sign_family where doctor = ?  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 limit " + page * pageSize + "," + pageSize;
@ -173,19 +176,19 @@ public class SignWebService extends BaseService {
        List<Map<String, Object>> patients = null;
        switch (status) {
            case 1:// 待签约
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, doctor, 0});
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 0});
                break;
            case 2:// 待解约
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, doctor, 2});
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 2});
                break;
            case 3:// 已签约
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, doctor, 1});
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 1});
                break;
            case 4:// 4已经解约
                patients = jdbcTemplate.queryForList(surrSql, new Object[]{doctor, doctor, -3, -4});
                patients = jdbcTemplate.queryForList(surrSql, new Object[]{doctor, -3, -4});
                break;
            case 5: // 未缴费
                patients = jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, doctor, 0});
                patients = jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, 0});
        }
        return patients;
@ -847,7 +850,7 @@ public class SignWebService extends BaseService {
                "    ,a.czrq" +
                "    ,a.renew_flag as renewFlag "+
                " from " +
                " ( select czrq,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin,renew_flag from wlyy_sign_family_renew where (doctor = ? or doctor_health = ?) and status = ? and type = 2" +
                " ( select czrq,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin,renew_flag from wlyy_sign_family_renew where doctor = ? and status = ? and type = 2" +
                " order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code  order by a.begin desc limit " + page * pageSize + "," + pageSize;
@ -874,7 +877,7 @@ public class SignWebService extends BaseService {
                "    ,a.czrq" +
                "    ,a.renew_flag as renewFlag "+
                " from " +
                " ( select czrq,renew_flag,code,patient,doctor,status,id,apply_date,reason,begin,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len from wlyy_sign_family_renew where (doctor = ? or doctor_health = ?) and status > ? and type = 2 order by begin desc ) a " +
                " ( select czrq,renew_flag,code,patient,doctor,status,id,apply_date,reason,begin,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len from wlyy_sign_family_renew where doctor = ? and status > ? and type = 2 order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code and a.expenses_status = '0' order by a.begin desc limit " + page * pageSize + "," + pageSize;
@ -900,7 +903,7 @@ public class SignWebService extends BaseService {
                "    ,a.czrq" +
                "    ,a.renew_flag as renewFlag "+
                " from " +
                " ( select expenses_status,czrq,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin,renew_flag from wlyy_sign_family_renew where (doctor = ? or doctor_health = ?) and status = ? and type = 2" +
                " ( select expenses_status,czrq,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin,renew_flag from wlyy_sign_family_renew where doctor = ? and status = ? and type = 2" +
                " order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code and a.expenses_status = '1' order by a.begin desc limit " + page * pageSize + "," + pageSize;
@ -911,13 +914,13 @@ public class SignWebService extends BaseService {
        List<Map<String, Object>> patients = null;
        switch (status) {
            case 1:// 待处理
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, doctor, 0});
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 0});
                break;
            case 2:// 待缴费
                patients = jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, doctor, 0});
                patients = jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, 0});
                break;
            case 3:// 已签约
                patients = jdbcTemplate.queryForList(signedSql, new Object[]{doctor, doctor, 1});
                patients = jdbcTemplate.queryForList(signedSql, new Object[]{doctor, 1});
                break;
        }
@ -1879,4 +1882,20 @@ public class SignWebService extends BaseService {
       List<SystemDict> systemDict = systemDictService.getDictByDictName("RENEW_CHANGE_REASON");
        return new JSONArray(systemDict);
    }
    public JSONObject getPatientSignLogInfo(String patient){
        Patient p = patientService.findByCode(patient);
        if(p!=null){
            String sql = "SELECT f.hospital_name as oldHospitalName,t.name AS oldTeamName,d.name as OldLeaderName,f.doctor_name AS OldDoctorName,f.doctor_health_name AS OldHealthDoctorName FROM wlyy_sign_family_renew_log r  " +
                    " LEFT JOIN wlyy_sign_family f ON r.old_sign_code = f.code " +
                    " LEFT JOIN wlyy_admin_team t ON r.old_admin_team_id = t.id " +
                    " LEFt JOIN wlyy_doctor d ON t.leader_code = d.code  " +
                    " WHERE r.idcard ='"+p.getIdcard()+"' AND r.sign_year='"+DateUtil.getSignYear()+"'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            if(list!=null&&list.size()>0){
               return new JSONObject(list.get(0));
            }
        }
        return new JSONObject();
    }
}

+ 12 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -235,6 +235,7 @@ public class DoctorSignController extends WeixinBaseController {
                    json.put("photo", temp.get("photo"));
                    json.put("status", temp.get("status"));
                    json.put("openid", temp.get("openid"));
                    json.put("renewFlag", temp.get("renewFlag"));
                    String statusName = "";
                    switch (Integer.parseInt(temp.get("status").toString())) {
                        case 0:
@ -658,4 +659,15 @@ public class DoctorSignController extends WeixinBaseController {
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "/getPatientSignLogInfo", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String getPatientSignLogInfo(@RequestParam(required = true)String patient){
        try {
            JSONObject result = signWebService.getPatientSignLogInfo(patient);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            return error(-1, "查询失败");
        }
    }
}