Jelajahi Sumber

验证码开关修改

wangjun 4 tahun lalu
induk
melakukan
e85a3f39a4

+ 148 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -10022,4 +10022,152 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        List<WlyyHospitalSysDictDO> isWork=sysDictDao.findByDictCode(dictCode);
        return isWork;
    }
    /**
     * 上门复诊
     *
     * @param outpatientJson
     * @param expressageJson
     * @return
     * @throws Exception
     */
    @Transactional
    public WlyyOutpatientDO appointmentRevisitOnDoor(String outpatientJson, String expressageJson, String registerJson, String chargeType) throws Exception {
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class);
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
        BaseDoctorDO doctorDO = baseDoctorDao.findById(outpatientDO.getDoctor());
        outpatientDO.setMjz("mz");
        outpatientDO.setStatus("1");
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setIdcard(patientDO.getIdcard());
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setOutpatientType("4");//4为上门复诊
        outpatientDO.setType("1");//1为图文复诊(上门默认图文复诊)
        if (outpatientDO.getRegisterDate() == null) {
            outpatientDO.setRegisterDate(new Date());
        }
        outpatientDO.setPayStatus(1);
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        if (StringUtils.isNoneBlank(expressageJson)){
            WlyyPrescriptionExpressageDO expressageDO = new WlyyPrescriptionExpressageDO();
            expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class);
            System.out.println("写入自取信息");
            String drugStoreCode = expressageDO.getHospitalCode();
            BaseDrugStoreDO baseDrugStoreDO = baseDrugStoreDao.findDrugByid(drugStoreCode);
            if (null!=baseDrugStoreDO){
                expressageDO.setCityCode(baseDrugStoreDO.getCityCode());
                expressageDO.setCityName(baseDrugStoreDO.getCityName());
                expressageDO.setProvinceCode(baseDrugStoreDO.getProvinceCode());
                expressageDO.setProvinceName(baseDrugStoreDO.getProvinceName());
                expressageDO.setTownCode(baseDrugStoreDO.getTownCode());
                expressageDO.setTownName(baseDrugStoreDO.getTownName());
                expressageDO.setHospitalCode(baseDrugStoreDO.getDrugStoreCode());
                expressageDO.setHospitalName(baseDrugStoreDO.getHospitalName());
                expressageDO.setHospitalAddress(baseDrugStoreDO.getAddress());
            }
            expressageDO.setDel(1);
            expressageDO.setCreateTime(new Date());
            expressageDO.setOutpatientId(outpatient.getId());
            prescriptionExpressageDao.save(expressageDO);
        }
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("WX_MONEY");
        Double price = 0.0;
        String chargeType1 = null;
        if (doctorDO!=null){
            if (outpatient.getOutpatientType().equalsIgnoreCase("1")){
                if(outpatientDO.getType().equalsIgnoreCase("1")){
                    chargeType1 = doctorDO.getTwfzChargeType();
                }else if(outpatientDO.getType().equalsIgnoreCase("2")){
                    chargeType1 = doctorDO.getSpfzChargeType();
                }
            }else if (outpatient.getOutpatientType().equalsIgnoreCase("3")){
                if(outpatientDO.getType().equalsIgnoreCase("1")){
                    chargeType1 = doctorDO.getTwzxChargeType();
                }else if(outpatientDO.getType().equalsIgnoreCase("2")){
                    chargeType1 = doctorDO.getSpzxChargeType();
                }
            }else if (outpatient.getOutpatientType().equalsIgnoreCase("2")){
                chargeType1 = doctorDO.getXtfzChargeType();
            }else if (outpatient.getOutpatientType().equalsIgnoreCase("4")){
                chargeType1 = "on_door_type";
            }
            if(doctorDO!=null){
                if (StringUtils.isNoneBlank(chargeType1)){
                    WlyyChargeDictDO chargeDictDO = wlyyChargeDictDao.findByChargeType(chargeType1);
                    if (chargeDictDO!=null){
                        price = chargeDictDO.getReqFee();
                    }else {
                        price = Double.parseDouble(hospitalSysDictDO.getDictValue());
                    }
                }
            }else {
                price = Double.parseDouble(hospitalSysDictDO.getDictValue());
            }
        }else {
            if (StringUtils.isNoneBlank(chargeType)){
                WlyyChargeDictDO chargeDictDO = wlyyChargeDictDao.findByChargeType(chargeType);
                if (chargeDictDO!=null){
                    price = chargeDictDO.getReqFee();
                }else {
                    price = Double.parseDouble(hospitalSysDictDO.getDictValue());
                }
            }
        }
        outpatient.setFee(price);
        outpatientDao.save(outpatient);
        /*if (doctorDO != null && StringUtils.isNoneBlank(doctorDO.getFee())) {
            price = Double.parseDouble(doctorDO.getFee());
        }else {
            price = Double.parseDouble(hospitalSysDictDO.getDictValue());
        }*/
        /*if (price == 0.0) {
        } else {
            outpatientDO.setPayStatus(0);
        }*/
        if (outpatient.getOutpatientType().equalsIgnoreCase("1")){
            if (outpatient.getType().equalsIgnoreCase("1")){
                businessOrderService.recharge(outpatient.getId(), "图文复诊-诊查费", "2", "图文复诊-诊查费", outpatient.getConsumer(), outpatient.getConsumerName(), outpatient.getDoctor(), price);
            }else if (outpatient.getType().equalsIgnoreCase("2")){
                businessOrderService.recharge(outpatient.getId(), "视频复诊-诊查费", "3", "视频复诊-诊查费", outpatient.getConsumer(), outpatient.getConsumerName(), outpatient.getDoctor(), price);
            }
        }else if (outpatient.getOutpatientType().equalsIgnoreCase("2")){
            businessOrderService.recharge(outpatient.getId(), "协同复诊-诊查费", "5", "协同复诊-诊查费", outpatient.getConsumer(), outpatient.getConsumerName(), outpatient.getDoctor(), price);
        }else if ("3".equalsIgnoreCase(outpatient.getOutpatientType())){
            BusinessOrderDO businessOrderDO = businessOrderService.recharge(outpatient.getId(), "专家咨询费", "1", "专家咨询费", outpatient.getConsumer(), outpatient.getConsumerName(), outpatient.getDoctor(), price);
        }
        WlyyPatientRegisterTimeDO registerTimeDO = null;
        WlyyPatientRegisterTimeDO wlyyPatientRegisterTimeDO =new WlyyPatientRegisterTimeDO();
        try {
            //如果是视频预约咨询
            if (StringUtils.isNotBlank(registerJson)) {
                registerTimeDO = objectMapper.readValue(registerJson, WlyyPatientRegisterTimeDO.class);
                registerTimeDO.setOutpatientId(outpatient.getId());
                registerTimeDO.setCreateTime(new Date());
                wlyyPatientRegisterTimeDO = patientRegisterTimeDao.save(registerTimeDO);
            }
        } catch (Exception e) {
            throw new RuntimeException("号源已经被预约,请选择其他号源");
        }
        if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
            logger.info("心脏中心同步患者开始");
            xzzxEntranceService.updatePatientMapping(outpatient.getConsumer(),outpatient.getCardNo());
            logger.info("同步患者id成功");
        }
        //3.创建候诊室
        //createRoom(outpatient, chargeType);
        String content = "向您发起了图文复诊,点击查看";
        return outpatient;
    }
}

+ 4 - 3
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java

@ -163,14 +163,15 @@ public class WxTemplateService {
                            wlyyOutpatientDO = outpatientDao.findById(consultDo.getRelationCode());
                        }
                        if (wlyyOutpatientDO!=null){
                            config.setKeyword2(config.getKeyword2()+DateUtil.dateToStrLong(wlyyOutpatientDO.getCreateTime()));
                            config.setKeyword3(config.getKeyword3()+wlyyOutpatientDO.getIcd10Name());
                            config.setKeyword2(DateUtil.dateToStrLong(wlyyOutpatientDO.getCreateTime()));
                            config.setKeyword3(wlyyOutpatientDO.getDeptName());
                            config.setKeyword4(wlyyOutpatientDO.getDescription());
                        }
                        WxWechatDO wechatDO = wechatDao.findById(wechatId);
                        if (wechatDO!=null){
                            config.setAppid(wechatDO.getApplets());
                        }
                        config.setKeyword1(config.getKeyword1()+doctorDO.getName());
                        config.setKeyword1(doctorDO.getName());
                        weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),basePatientWechatDo.getOpenid(),config);
                    }
                }

+ 4 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -103,6 +103,10 @@ public class BaseHospitalRequestMapping {
         * 居民发起复诊
         */
        public static final String appointmentRevisit = "/appointmentRevisit";
        /**
         * 上门复诊
         */
        public static final String appointmentRevisitOnDoor = "/appointmentRevisitOnDoor";
        /**
         * 查询所有机构

+ 14 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/core/redis/WlyyRedisVerifyCodeService.java

@ -1,5 +1,9 @@
package com.yihu.jw.security.oauth2.core.redis;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.security.dao.patient.WlyyHospitalSysDictDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.StringUtils;
@ -10,6 +14,8 @@ import java.util.concurrent.TimeUnit;
 * Created by progr1mmer on 2018/4/18.
 */
public class WlyyRedisVerifyCodeService {
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    private final String KEY_SUFFIX = ":code";
    private final RedisTemplate redisTemplate;
@ -44,6 +50,14 @@ public class WlyyRedisVerifyCodeService {
        if (StringUtils.isEmpty(code)) {
            return false;
        }
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findDictById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            if (code.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
                return true;
            }else {
                return false;
            }
        }
        String key = client_id + ":" + username + KEY_SUFFIX;
        String _code = (String) redisTemplate.opsForValue().get(key);
        if (null == _code) {

+ 155 - 97
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -499,22 +499,37 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
            throw new IllegalAccessException("SMS request frequency is too fast");
        }
        //发送短信获取验证码
        String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
        int result =  zhongShanSMSService.ZhongShangSendSMS(username,"您好,你的手机登录短信验证码是:"+captcha+",5分钟内有效。");
        if (0 == result) {
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            String captcha = wlyyHospitalSysDictDO.getDictValue();
            Captcha _captcha = new Captcha();
            _captcha.setCode(captcha);
            _captcha.setExpiresIn(300);
            wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, null);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("success", 200);
            HttpHeaders headers = new HttpHeaders();
            headers.set("Cache-Control", "no-store");
            headers.set("Pragma", "no-cache");
            return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
        }else {
            //发送短信获取验证码
            String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
            int result =  zhongShanSMSService.ZhongShangSendSMS(username,"您好,你的手机登录短信验证码是:"+captcha+",5分钟内有效。");
            if (0 == result) {
                Captcha _captcha = new Captcha();
                _captcha.setCode(captcha);
                _captcha.setExpiresIn(300);
                wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, null);
                HttpHeaders headers = new HttpHeaders();
                headers.set("Cache-Control", "no-store");
                headers.set("Pragma", "no-cache");
                return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
            }
        }
        throw new IllegalStateException("验证码发送失败!");
    }
@ -542,35 +557,50 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
            throw new IllegalAccessException("SMS request frequency is too fast");
        }
        //发送短信获取验证码
        String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
        JSONObject object = new JSONObject();
        object.put("operatetel","18788888888");
        object.put("interfaceid","jcpt");
        object.put("interfacepwd","jcpt");
        object.put("operator","xxgwxgzh");
        object.put("operateid","xxgwxgzh");
        JSONArray array = new JSONArray();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("content","您好,你的手机登录短信验证码是:"+captcha+",5分钟内有效。");
        jsonObject.put("sendtel",username);
        jsonObject.put("sendtime",DateUtil.dateToStrLong(new Date()));
        array.add(jsonObject);
        object.put("messageinfo",array);
        int result =  xzzxService.SendSms(object.toJSONString());
        if (0 == result) {
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            String captcha = wlyyHospitalSysDictDO.getDictValue();
            Captcha _captcha = new Captcha();
            _captcha.setCode(captcha);
            _captcha.setExpiresIn(300);
            wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, null);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("success", 200);
            HttpHeaders headers = new HttpHeaders();
            headers.set("Cache-Control", "no-store");
            headers.set("Pragma", "no-cache");
            return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
        }else {
            //发送短信获取验证码
            String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
            JSONObject object = new JSONObject();
            object.put("operatetel","18788888888");
            object.put("interfaceid","jcpt");
            object.put("interfacepwd","jcpt");
            object.put("operator","xxgwxgzh");
            object.put("operateid","xxgwxgzh");
            JSONArray array = new JSONArray();
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("content","您好,你的手机登录短信验证码是:"+captcha+",5分钟内有效。");
            jsonObject.put("sendtel",username);
            jsonObject.put("sendtime",DateUtil.dateToStrLong(new Date()));
            array.add(jsonObject);
            object.put("messageinfo",array);
            int result =  xzzxService.SendSms(object.toJSONString());
            if (0 == result) {
                Captcha _captcha = new Captcha();
                _captcha.setCode(captcha);
                _captcha.setExpiresIn(300);
                wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, null);
                HttpHeaders headers = new HttpHeaders();
                headers.set("Cache-Control", "no-store");
                headers.set("Pragma", "no-cache");
                return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
            }
        }
        throw new IllegalStateException("验证码发送失败!");
    }
@ -606,90 +636,106 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
            throw new IllegalAccessException("SMS request frequency is too fast");
        }
        if ("1".equalsIgnoreCase(isDoctor)){
            String res = ykyyService.getResetCode("4",username);
            String resltCode ="";
            String captcha = "";
            if (!StringUtils.isEmpty(res)){
                JSONObject jsonObject = JSONObject.parseObject(res);
                if ("10000".equalsIgnoreCase(jsonObject.getString("code"))){
                    captcha = jsonObject.getString("value");
                    resltCode = jsonObject.getString("code");
                    msg = "发送成功";
                }
            }
            if ("10000".equalsIgnoreCase(resltCode)) {
                Captcha _captcha = new Captcha();
                _captcha.setCode(captcha);
                _captcha.setExpiresIn(300);
                wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 200);
                HttpHeaders headers = new HttpHeaders();
                headers.set("Cache-Control", "no-store");
                headers.set("Pragma", "no-cache");
                return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
            }
            throw new IllegalStateException("验证码发送失败!");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            String captcha = wlyyHospitalSysDictDO.getDictValue();
            Captcha _captcha = new Captcha();
            _captcha.setCode(captcha);
            _captcha.setExpiresIn(300);
            wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 200);
            HttpHeaders headers = new HttpHeaders();
            headers.set("Cache-Control", "no-store");
            headers.set("Pragma", "no-cache");
            return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
        }else {
            //发送短信获取验证码
            String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
            ResultMsg result= null;
            if(StringUtils.isEmpty(type)){
                String  res = ykyyService.getShortMessage("1",username);
            if ("1".equalsIgnoreCase(isDoctor)){
                String res = ykyyService.getResetCode("4",username);
                String resltCode ="";
                String captcha1 = "";
                String captcha = "";
                if (!StringUtils.isEmpty(res)){
                    JSONObject jsonObject = JSONObject.parseObject(res);
                    if ("10000".equalsIgnoreCase(jsonObject.getString("code"))){
                        captcha1 = jsonObject.getString("value");
                        captcha = jsonObject.getString("value");
                        resltCode = jsonObject.getString("code");
                    }else if("199".equalsIgnoreCase(jsonObject.getString("code"))){
                        msg = jsonObject.getString("msg");
                        Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 199);
                        return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
                    }else {
                        msg="发送失败";
                        Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, -1);
                        return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
                        msg = "发送成功";
                    }
                }
                if ("10000".equalsIgnoreCase(resltCode)) {
                    Captcha _captcha = new Captcha();
                    _captcha.setCode(captcha1);
                    _captcha.setCode(captcha);
                    _captcha.setExpiresIn(300);
                    wlyyRedisVerifyCodeService.store(client_id, username, captcha1, 300);
                    wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                    Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200);
                    Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 200);
                    HttpHeaders headers = new HttpHeaders();
                    headers.set("Cache-Control", "no-store");
                    headers.set("Pragma", "no-cache");
                    return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
                }
            }else if("1".equals(type)){
                result = ykyySMSService.ykyySendSMS(username,"您好,您的手机登录短信验证码是:"+captcha+",5分钟内有效。");
            }else if("2".equals(type)) {
                result = ykyySMSService.ykyySendSMS(username, "您好,您正在进行找回密码操作,您的短信验证码是:" + captcha + ",请勿将验证码告诉他人,5分钟内有效。");
            }
            if (result.isSuccess()) {
                Captcha _captcha = new Captcha();
                _captcha.setCode(captcha);
                _captcha.setExpiresIn(300);
                wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                throw new IllegalStateException("验证码发送失败!");
                Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200);
                HttpHeaders headers = new HttpHeaders();
                headers.set("Cache-Control", "no-store");
                headers.set("Pragma", "no-cache");
                return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
            }else {
                //发送短信获取验证码
                String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
                ResultMsg result= null;
                if(StringUtils.isEmpty(type)){
                    String  res = ykyyService.getShortMessage("1",username);
                    String resltCode ="";
                    String captcha1 = "";
                    if (!StringUtils.isEmpty(res)){
                        JSONObject jsonObject = JSONObject.parseObject(res);
                        if ("10000".equalsIgnoreCase(jsonObject.getString("code"))){
                            captcha1 = jsonObject.getString("value");
                            resltCode = jsonObject.getString("code");
                        }else if("199".equalsIgnoreCase(jsonObject.getString("code"))){
                            msg = jsonObject.getString("msg");
                            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 199);
                            return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
                        }else {
                            msg="发送失败";
                            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, -1);
                            return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
                        }
                    }
                    if ("10000".equalsIgnoreCase(resltCode)) {
                        Captcha _captcha = new Captcha();
                        _captcha.setCode(captcha1);
                        _captcha.setExpiresIn(300);
                        wlyyRedisVerifyCodeService.store(client_id, username, captcha1, 300);
                        Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200);
                        HttpHeaders headers = new HttpHeaders();
                        headers.set("Cache-Control", "no-store");
                        headers.set("Pragma", "no-cache");
                        return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
                    }
                }else if("1".equals(type)){
                    result = ykyySMSService.ykyySendSMS(username,"您好,您的手机登录短信验证码是:"+captcha+",5分钟内有效。");
                }else if("2".equals(type)) {
                    result = ykyySMSService.ykyySendSMS(username, "您好,您正在进行找回密码操作,您的短信验证码是:" + captcha + ",请勿将验证码告诉他人,5分钟内有效。");
                }
                if (result.isSuccess()) {
                    Captcha _captcha = new Captcha();
                    _captcha.setCode(captcha);
                    _captcha.setExpiresIn(300);
                    wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                    Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200);
                    HttpHeaders headers = new HttpHeaders();
                    headers.set("Cache-Control", "no-store");
                    headers.set("Pragma", "no-cache");
                    return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
                }
                Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 200);
                return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
            }
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 200);
            return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
        }
    }
    /**
@ -1642,13 +1688,20 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    @RequestMapping(value = "/oauth/findPatientPw", method = RequestMethod.POST)
    public Envelop findPatientPw(String mobile,String client_id,String login_type,String captcha,String pw)throws Exception {
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            if (captcha.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
        if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
            //验证码正确
        } else {
            return ObjEnvelop.getError("验证码错误!");
            }else {
                return ObjEnvelop.getError("验证码错误!");
            }
        }else {
            if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
                //验证码正确
            } else {
                return ObjEnvelop.getError("验证码错误!");
            }
        }
        String rs = registerService.updatePatientPw(pw,mobile);
        if("ok".equals(rs)){
            return ObjEnvelop.getSuccess("修改成功!");
@ -1671,10 +1724,15 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                return ObjEnvelop.getError("修改失败!");
            }
        }else if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
            if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
                //验证码正确
            } else {
                return ObjEnvelop.getError("验证码错误!");
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
            if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            }else {
                if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
                    //验证码正确
                } else {
                    return ObjEnvelop.getError("验证码错误!");
                }
            }
            String rs = registerService.updateDoctorPw(mobile,pw,wechatId);
            if("ok".equals(rs)){

+ 74 - 53
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java

@ -3,7 +3,9 @@ package com.yihu.jw.hospital.endpoint.hospital;
import com.alibaba.fastjson.JSONObject;
import com.sun.media.jfxmedia.logging.Logger;
import com.yihu.jw.entity.base.doctor.BaseDoctorBackgroundDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.family.dao.WlyyPatientFamilyMemberDao;
import com.yihu.jw.hospital.family.service.PatientMemberDictService;
import com.yihu.jw.hospital.family.service.WlyyFamilyMemberService;
@ -26,6 +28,7 @@ import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
@ -61,6 +64,8 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Value("${wechat.id}")
    private String wxId;
@ -159,68 +164,76 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
            throw new IllegalAccessException("SMS request frequency is too fast");
            //发送短信获取验证码
        }
        String captcha = this.getCodeNumber();
        System.out.println("=====================当前短信验证码============="+captcha+"=====================");
        if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            System.out.println("发送眼科验证码开始");
            ResultMsg result= null;
            if (null!=jsonArray&&jsonArray.size() > 0) {
                result = ykyySMSService.ykyySendSMS(phoneNum, "您好,您的此次操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
                if (result.isSuccess()){
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            String captcha = wlyyHospitalSysDictDO.getDictValue();
            this.store(client_id, phoneNum, captcha, 120);
            mixEnvelop.setMessage("验证码发送成功");
        }else {
            String captcha = this.getCodeNumber();
            System.out.println("=====================当前短信验证码============="+captcha+"=====================");
            if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                System.out.println("发送眼科验证码开始");
                ResultMsg result= null;
                if (null!=jsonArray&&jsonArray.size() > 0) {
                    result = ykyySMSService.ykyySendSMS(phoneNum, "您好,您的此次操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
                    if (result.isSuccess()){
                        this.store(client_id, phoneNum, captcha, 120);
                        mixEnvelop.setMessage("验证码发送成功");
                    } else {
                        mixEnvelop.setMessage("验证码发送失败");
                        mixEnvelop.setStatus(500);
                    }
                }else {
                    mixEnvelop.setStatus(408);
                    mixEnvelop.setMessage("您所添加的家属无就诊记录,无法发送验证码");
                }
            }else if("xm_zsyy_wx".equalsIgnoreCase(wxId)){
                System.out.println("发送中山验证码开始");
                int result = 1;
                if (null!=jsonArray&&jsonArray.size() > 0) {
                    result = zhongShanSMSService.ZhongShangSendSMS(phoneNum, "您好,您当前操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
                } else {
                    result = 2;
                }
                if (0 == result) {
                    this.store(client_id, phoneNum, captcha, 120);
                    mixEnvelop.setMessage("验证码发送成功");
                } else if (2 == result) {
                    mixEnvelop.setStatus(408);
                    mixEnvelop.setMessage("您所添加的家属无就诊记录,无法发送验证码");
                } else {
                    mixEnvelop.setMessage("验证码发送失败");
                    mixEnvelop.setStatus(500);
                }
            }else if("xm_xzzx_wx".equalsIgnoreCase(wxId)){
                //发送短信获取验证码
                JSONObject object = new JSONObject();
                object.put("operatetel","18788888888");
                object.put("interfaceid","jcpt");
                object.put("interfacepwd","jcpt");
                object.put("operator","xxgwxgzh");
                object.put("operateid","xxgwxgzh");
                com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("content","您好,你的手机登录短信验证码是:"+captcha+",5分钟内有效。");
                jsonObject.put("sendtel",phoneNum);
                jsonObject.put("sendtime", DateUtil.dateToStrLong(new Date()));
                array.add(jsonObject);
                object.put("messageinfo",array);
                int result =  xzzxEntranceService.SendSmsToEntrance(object.toJSONString());
                if (0 == result) {
                    this.store(client_id, phoneNum, captcha, 120);
                    mixEnvelop.setMessage("验证码发送成功");
                } else {
                    mixEnvelop.setMessage("验证码发送失败");
                    mixEnvelop.setStatus(500);
                }
            }else {
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("您所添加的家属无就诊记录,无法发送验证码");
            }
        }else if("xm_zsyy_wx".equalsIgnoreCase(wxId)){
            System.out.println("发送中山验证码开始");
            int result = 1;
            if (null!=jsonArray&&jsonArray.size() > 0) {
                result = zhongShanSMSService.ZhongShangSendSMS(phoneNum, "您好,您当前操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
            } else {
                result = 2;
            }
            if (0 == result) {
                this.store(client_id, phoneNum, captcha, 120);
                mixEnvelop.setMessage("验证码发送成功");
            } else if (2 == result) {
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("您所添加的家属无就诊记录,无法发送验证码");
            } else {
                mixEnvelop.setMessage("验证码发送失败");
                mixEnvelop.setStatus(500);
            }
        }else if("xm_xzzx_wx".equalsIgnoreCase(wxId)){
            //发送短信获取验证码
            JSONObject object = new JSONObject();
            object.put("operatetel","18788888888");
            object.put("interfaceid","jcpt");
            object.put("interfacepwd","jcpt");
            object.put("operator","xxgwxgzh");
            object.put("operateid","xxgwxgzh");
            com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("content","您好,你的手机登录短信验证码是:"+captcha+",5分钟内有效。");
            jsonObject.put("sendtel",phoneNum);
            jsonObject.put("sendtime", DateUtil.dateToStrLong(new Date()));
            array.add(jsonObject);
            object.put("messageinfo",array);
            int result =  xzzxEntranceService.SendSmsToEntrance(object.toJSONString());
            if (0 == result) {
                this.store(client_id, phoneNum, captcha, 120);
                mixEnvelop.setMessage("验证码发送成功");
            } else {
                mixEnvelop.setMessage("验证码发送失败");
                mixEnvelop.setStatus(500);
            }
        }
        return mixEnvelop;
    }
@ -253,6 +266,14 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
    //验证验证码
    public boolean verification(String client_id, String username, String code) {
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            if (code.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
                return true;
            }else {
                return false;
            }
        }
        if (StringUtils.isEmpty(code)) {
            return false;
        }

+ 17 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -1405,5 +1405,22 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                       @ApiParam(name = "keyWord", value = "名字关键字")
                                       @RequestParam(value = "keyWord", required = false)String keyWord) {
        return success(prescriptionService.findAllHospital(level,keyWord));
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.appointmentRevisitOnDoor)
    @ApiOperation(value = "上门复诊", notes = "上门复诊")
    public ObjEnvelop appointmentRevisitOnDoor(@ApiParam(name = "outpatientJson", value = "居民门诊json")
                                               @RequestParam(value = "outpatientJson", required = false)String outpatientJson,
                                               @ApiParam(name = "expressageJson", value = "居民物流json")
                                               @RequestParam(value = "expressageJson", required = false)String expressageJson,
                                               @ApiParam(name = "registerJson", value = "预约时间")
                                               @RequestParam(value = "registerJson", required = false)String registerJson,
                                               @ApiParam(name = "chargeType", value = "预约实体json")
                                               @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisitOnDoor(outpatientJson,expressageJson,registerJson,chargeType);
        return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
    }
}

+ 2 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -2355,4 +2355,6 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        }
    }
}