Procházet zdrojové kódy

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

trick9191 před 7 roky
rodič
revize
76391999f0

+ 11 - 11
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/reservation/PatientReservationService.java

@ -111,18 +111,17 @@ public class PatientReservationService extends BaseService {
    }
    /**
     * 客服取消预约
     * 居民取消预约
     */
    @Transactional
    public void userCancelOrder(String code,String user) {
    public void patientCancelOrder(String code,String patient) {
        PatientReservation obj = patientReservationDao.findByCode(code);
        if (obj.getStatus()!=0) {
            obj.setStatus(0);
            User u =userDao.findByCode(user);
            obj.setCancelerName(u.getName());
            obj.setCancelerType(6);
            obj.setCanceler(patient);
            obj.setCancelerName(obj.getName());
            obj.setCancelerType(5);
            obj.setCancelerTime(DateUtil.dateToStrLong(new Date()));
            obj.setCanceler(user);
            patientReservationDao.save(obj);
        }
    }
@ -130,17 +129,18 @@ public class PatientReservationService extends BaseService {
    /**
     * 居民取消预约
     * 客服取消预约
     */
    @Transactional
    public void patientCancelOrder(String code,String patient) {
    public void userCancelOrder(String code,String user) {
        PatientReservation obj = patientReservationDao.findByCode(code);
        if (obj.getStatus()!=0) {
            obj.setStatus(0);
            obj.setCanceler(patient);
            obj.setCancelerName(obj.getName());
            obj.setCancelerType(5);
            User u =userDao.findByCode(user);
            obj.setCancelerName(u.getName());
            obj.setCancelerType(6);
            obj.setCancelerTime(DateUtil.dateToStrLong(new Date()));
            obj.setCanceler(user);
            patientReservationDao.save(obj);
        }
    }

+ 2 - 1
patient-co-manage/wlyy-manage/src/main/resources/application.yml

@ -253,7 +253,8 @@ wlyyService:
image:
  imgUrlDomain: http://www.xmtyw.cn/
sign:
  check_upload: http://59.61.92.90:8072/wlyy_service
  check_upload: http://59.61.92.90:8087/wlyy_service
  #check_upload: http://59.61.92.90:8072/wlyy_service
server:
  server_url: http://www.xmtyw.cn/wlyy/
wechat:

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java

@ -746,7 +746,7 @@ public class PatientInfoService extends BaseService {
        json.put("BLOOD",archive.getBlood());//血型【1.A型 2.3.O型4.AB型 5.不详】
        json.put("BLOOD_RH","1");//RH阴性【1.否 2.是 3.不详】
        json.put("MARRIAGE",archive.getMarry());//婚姻状况【10.未婚 20.已婚 30.丧偶 40.离婚 90.未说明的婚姻状况】
        json.put("INSUR_CARD_NO",p.getSsc());//医保卡号
        //补充参数

+ 84 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/PatientRemindService.java

@ -337,6 +337,70 @@ public class PatientRemindService extends BaseService {
        }
    }
//    /**
//     * 提醒所有患者关注微信
//     *
//     * @param doctor
//     */
//    public void remindPatientWechatFocusAll(String doctor) throws Exception {
//        try {
//            Calendar today = Calendar.getInstance();
//            today.set(Calendar.HOUR, 23);
//            today.set(Calendar.MINUTE, 59);
//            today.set(Calendar.SECOND, 59);
//            today.set(Calendar.MILLISECOND, 999);
//            int page = 0;
//            int start = 0;
//            boolean flag = true;
//            Doctor doc = doctorDao.findByCode(doctor);
//            if (doc == null) {
//                throw new Exception("doctor info can not find");
//            }
//            String sql = "select p.code,p.name,p.mobile" +
//                    "     from " +
//                    "        wlyy_sign_family f join wlyy_patient p on f.patient = p.code" +
//                    "     where " +
//                    "        (f.doctor = ? or f.doctor_health = ?) " +
//                    "        and f.status > 0 " +
//                    "        and f.expenses_status = '1' " +
//                    "        and LENGTH(trim(ifnull(p.openid,''))) < 1 limit ?,3000";
//            List<Map<String, Object>> patients = new ArrayList<>();
//            List<String> redisPatients = new ArrayList<>();
//            Set<String> exist = redisTemplate.opsForSet().members("wechat:focus:remind:set");
//            while (flag) {
//                List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{doctor, doctor, start});
//
//                if (result != null && result.size() > 0) {
//                    patients.addAll(result);
//                    for (Map<String, Object> map : result) {
//                        if (exist != null && exist.contains(map.get("code").toString())) {
//                            continue;
//                        }
//                        redisPatients.add(map.get("code").toString());
//                    }
//                    page = page + 1;
//                    start = page * 3000;
//                } else {
//                    flag = false;
//                }
//            }
//
//            if (patients.size() > 0) {
//                RemindFocusWechatTask task = new RemindFocusWechatTask(patients, doc,sMSService);
//                new Thread(task).start();
//                redisTemplate.opsForSet().add("wechat:focus:remind:set", redisPatients.toArray(new String[]{}));
//                redisTemplate.expire("wechat:focus:remind:set", today.getTimeInMillis() - Calendar.getInstance().getTimeInMillis(), TimeUnit.MILLISECONDS);
//            }
//
//            redisTemplate.opsForValue().set("wechat:focus:remind:doctor:" + doctor, "0");
//            redisTemplate.expire("wechat:focus:remind:doctor:" + doctor, 10, TimeUnit.MINUTES);
//        } catch (Exception e) {
//            redisTemplate.opsForValue().set("wechat:focus:remind:doctor:" + doctor, "0");
//            redisTemplate.expire("wechat:focus:remind:doctor:" + doctor, 10, TimeUnit.MINUTES);
//            e.printStackTrace();
//        }
//    }
    /**
     * 提醒所有患者关注微信
     *
@ -366,14 +430,14 @@ public class PatientRemindService extends BaseService {
                    "        and LENGTH(trim(ifnull(p.openid,''))) < 1 limit ?,3000";
            List<Map<String, Object>> patients = new ArrayList<>();
            List<String> redisPatients = new ArrayList<>();
            Set<String> exist = redisTemplate.opsForSet().members("wechat:focus:remind:set");
            Set<String> exist = redisTemplate.keys("wechat:focus:remind:flag:*");
            while (flag) {
                List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{doctor, doctor, start});
                if (result != null && result.size() > 0) {
                    patients.addAll(result);
                    for (Map<String, Object> map : result) {
                        if (exist != null && exist.contains(map.get("code").toString())) {
                        if (exist != null && exist.size()>0&& isExist(map.get("code").toString(),exist)) {
                            continue;
                        }
                        redisPatients.add(map.get("code").toString());
@ -388,10 +452,11 @@ public class PatientRemindService extends BaseService {
            if (patients.size() > 0) {
                RemindFocusWechatTask task = new RemindFocusWechatTask(patients, doc,sMSService);
                new Thread(task).start();
                redisTemplate.opsForSet().add("wechat:focus:remind:set", redisPatients.toArray(new String[]{}));
                redisTemplate.expire("wechat:focus:remind:set", today.getTimeInMillis() - Calendar.getInstance().getTimeInMillis(), TimeUnit.MILLISECONDS);
                for(String pString:redisPatients){
                    redisTemplate.opsForValue().set("wechat:focus:remind:flag:"+pString, pString,2,TimeUnit.MINUTES);//向redis里存入数据和设置缓存时
                    //redisTemplate.opsForValue().set("wechat:focus:remind:flag:"+pString, pString,today.getTimeInMillis() - Calendar.getInstance().getTimeInMillis(),TimeUnit.MILLISECONDS);//向redis里存入数据和设置缓存时
                }
            }
            redisTemplate.opsForValue().set("wechat:focus:remind:doctor:" + doctor, "0");
            redisTemplate.expire("wechat:focus:remind:doctor:" + doctor, 10, TimeUnit.MINUTES);
        } catch (Exception e) {
@ -401,6 +466,15 @@ public class PatientRemindService extends BaseService {
        }
    }
    public boolean isExist(String code,Set<String> set){
        for(String c :set){
            if(c.contains(code)){
                return true;
            }
        }
        return false;
    }
    /**
     * 微信关注提醒
     *
@ -415,8 +489,11 @@ public class PatientRemindService extends BaseService {
        today.set(Calendar.SECOND, 59);
        today.set(Calendar.MILLISECOND, 59);
        JSONObject result = new JSONObject();
        redisTemplate.opsForSet().add("wechat:focus:remind:set", p.get("code").toString());
        redisTemplate.expireAt("wechat:focus:remind:set", today.getTime());
        redisTemplate.opsForValue().set("wechat:focus:remind:flag:"+ p.get("code").toString(),p.get("code").toString(),today.getTimeInMillis() - Calendar.getInstance().getTimeInMillis(),TimeUnit.MILLISECONDS);//向redis里存入数据和设置缓存时
//        redisTemplate.opsForSet().add("wechat:focus:remind:set", p.get("code").toString());
//        redisTemplate.expireAt("wechat:focus:remind:set", today.getTime());
        if (p.get("mobile") == null || StringUtils.isEmpty(p.get("mobile").toString())) {
            result.put("status", -1);

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

@ -405,10 +405,11 @@ public class SignWebService extends BaseService {
        List<String> result = jdbcTemplate.queryForList(sql, new Object[]{doctor, doctor}, String.class);
        if (result != null && result.size() > 0) {
            Set<String> set = redisTemplate.opsForSet().members("wechat:focus:remind:set");
            //Set<String> set = redisTemplate.opsForSet().members("wechat:focus:remind:set");
            Set<String> set = redisTemplate.keys("wechat:focus:remind:flag:*");
            if (set == null) {
                isAll = false;
            } else if (!set.containsAll(result)) {
            } else if (!isAllRemind(result,set)) {
                isAll = false;
            }
        } else {
@ -418,6 +419,30 @@ public class SignWebService extends BaseService {
        return isAll ? 1 : 0;
    }
    /**
     * 存在未提醒的返回false,全部提醒过返回true
     * @param result
     * @param set
     * @return
     */
    public boolean isAllRemind(List<String> result,Set<String> set){
        for(String code :result){
            //默认未提醒
            boolean flag = false;
            for(String c :set){
                if(c.contains(code)){
                    //提醒过标识
                   flag = true;
                }
            }
            if(!flag){
                //返回未提醒
                return false;
            }
        }
        return true;
    }
    /**
     * 查询家庭签约已缴费未关注人数
     *

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

@ -293,7 +293,7 @@ public class DoctorSignController extends WeixinBaseController {
                    if (status == 3) {
                        boolean epTime = false;
                        try {
                            epTime = redisTemplate.opsForSet().isMember("wechat:focus:remind:set", temp.get("patient"));
                            epTime = redisTemplate.hasKey("wechat:focus:remind:flag:"+temp.get("patient"));
                        } catch (Exception e) {
                            e.printStackTrace();
                        }