Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

huangwenjie 5 years ago
parent
commit
cabd2a0c7c

+ 31 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java

@ -5,13 +5,13 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.idcard.IdCardUtil;
import com.yihu.jw.util.idcard.IdCardUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.charts.LineChartSeries;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
@ -26,6 +26,8 @@ import java.util.Map;
@Service
@Service
public class YkyyService {
public class YkyyService {
    private Logger logger = LoggerFactory.getLogger(YkyyService.class);
    @Autowired
    @Autowired
    private HttpClientUtil httpClientUtil;
    private HttpClientUtil httpClientUtil;
    @Autowired
    @Autowired
@ -102,6 +104,7 @@ public class YkyyService {
        String response="";
        String response="";
        String url = yktUrl+"verification_code/short_message?type="+type+"&telephone="+phone;
        String url = yktUrl+"verification_code/short_message?type="+type+"&telephone="+phone;
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通验证码:"+response);
        return response;
        return response;
    }
    }
@ -120,6 +123,7 @@ public class YkyyService {
        String url = yktUrl+"user_center/patient_register01?telephone="+telephone+"&patient_pwd="+patientPwd+"&code="+code+"&invite_code="+inviteCode+"&equipment_type="+equipmentType+
        String url = yktUrl+"user_center/patient_register01?telephone="+telephone+"&patient_pwd="+patientPwd+"&code="+code+"&invite_code="+inviteCode+"&equipment_type="+equipmentType+
                "&equipment_guid="+equipmentGuid;
                "&equipment_guid="+equipmentGuid;
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通用户注册:"+response);
        return response;
        return response;
    }
    }
@ -135,6 +139,7 @@ public class YkyyService {
        param.put("user_id",userId);
        param.put("user_id",userId);
        String url = yktUrl+"patient/get_patient_card_list?user_id="+userId;
        String url = yktUrl+"patient/get_patient_card_list?user_id="+userId;
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取就诊卡数据接口:"+response);
        return response;
        return response;
    }
    }
@ -151,6 +156,7 @@ public class YkyyService {
        String url = yktUrl+"patient/add_card?user_id="+userId+"&patient_name="+patientName+"&card="+card+"&hospital_id="+hospitalId+
        String url = yktUrl+"patient/add_card?user_id="+userId+"&patient_name="+patientName+"&card="+card+"&hospital_id="+hospitalId+
                "&hospital_name="+hospitalName+"&type="+type+"&hos_num="+hosNum;
                "&hospital_name="+hospitalName+"&type="+type+"&hos_num="+hosNum;
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("添加就诊卡接口:"+response);
        return response;
        return response;
    }
    }
@ -184,6 +190,7 @@ public class YkyyService {
            url+="&app_callback_url="+appCallbackUrl;
            url+="&app_callback_url="+appCallbackUrl;
        }
        }
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通新增订单接口:"+response);
        return response;
        return response;
    }
    }
@ -198,6 +205,7 @@ public class YkyyService {
        String response="";
        String response="";
        String url = yktUrl+"doc_jkzl/update_order_state?order_no="+orderNo+"&state="+state;
        String url = yktUrl+"doc_jkzl/update_order_state?order_no="+orderNo+"&state="+state;
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("更新订单支付状态:"+response);
        return response;
        return response;
    }
    }
@ -218,14 +226,34 @@ public class YkyyService {
        String url = yktUrl+"doc_jkzl/add_family?ass_user_id="+userId+"&id_card="+idcard+"&name="+name+"&sex="+sex
        String url = yktUrl+"doc_jkzl/add_family?ass_user_id="+userId+"&id_card="+idcard+"&name="+name+"&sex="+sex
                +"&birth="+birth+"&age="+age+"&tel="+tel+"&medical_card=&illness=本人&clinic_id=";
                +"&birth="+birth+"&age="+age+"&tel="+tel+"&medical_card=&illness=本人&clinic_id=";
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("增加家庭成员:"+response);
        return response;
        return response;
    }
    }
    /**
     * 获取userId
     * @param tel
     * @return
     */
    public String getUserId(String tel){
    public String getUserId(String tel){
        String response="";
        String response="";
        String url = yktUrl+"doc_jkzl/get_user_id_by_tel?tel="+tel;
        String url = yktUrl+"doc_jkzl/get_user_id_by_tel?tel="+tel;
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取userId:"+response);
        return response;
    }
    /**
     * 获取医生code
     * @param doctorMapping
     * @return
     */
    public String getYktDoctor(String doctorMapping){
        String response="";
        String url = yktUrl+"doc_jkzl/get_ykt_doctorid_by_doctorcode?doctor_code="+doctorMapping;
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取userId:"+response);
        return response;
        return response;
    }
    }
@ -249,6 +277,7 @@ public class YkyyService {
            url+="user_id="+userId;
            url+="user_id="+userId;
        }
        }
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取家庭成员信息:"+response);
        return response;
        return response;
    }
    }

+ 32 - 20
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -1,8 +1,9 @@
package com.yihu.jw.order;
package com.yihu.jw.order;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxPayLogDO;
import com.yihu.jw.entity.base.wx.WxPayLogDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
@ -17,24 +18,18 @@ import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeiXinPayUtils;
import com.yihu.jw.util.wechat.WeiXinPayUtils;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxPayLogDao;
import com.yihu.jw.wechat.dao.WxPayLogDao;
import com.yihu.jw.wechat.service.WxPayLogService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
@ -49,6 +44,8 @@ import java.util.*;
@Service
@Service
public class BusinessOrderService {
public class BusinessOrderService {
    private Logger logger = LoggerFactory.getLogger(BusinessOrderService.class);
    @Autowired
    @Autowired
    private BusinessOrderDao businessOrderDao;
    private BusinessOrderDao businessOrderDao;
    @Autowired
    @Autowired
@ -79,6 +76,7 @@ public class BusinessOrderService {
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setStatus(0);
        businessOrderDO.setStatus(0);
        businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis());
        businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis());
        businessOrderDO.setUploadStatus(0);
        businessOrderDO = businessOrderDao.save(businessOrderDO);
        businessOrderDO = businessOrderDao.save(businessOrderDO);
        String patient = businessOrderDO.getPatient();
        String patient = businessOrderDO.getPatient();
        BasePatientDO basePatientDO = patientDao.findById(patient);
        BasePatientDO basePatientDO = patientDao.findById(patient);
@ -94,7 +92,21 @@ public class BusinessOrderService {
        String orderCatagrate = businessOrderDO.getOrderCategory();
        String orderCatagrate = businessOrderDO.getOrderCategory();
        String pcCallBack=businessOrderDO.getPcCallbackUrl();
        String pcCallBack=businessOrderDO.getPcCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,doctorMappingDO.getMappingCode(),payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
        String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode());
        String yktDoctor ="";
        JSONObject jsonObject = JSONObject.parseObject(doctorResponse);
        if (jsonObject.getInteger("code")==200){
            JSONArray array = jsonObject.getJSONArray("data");
            if (array!=null&&array.size()!=0){
                yktDoctor=array.getJSONObject(0).getString("DOCTORUSERID");
            }
        }
        String response=ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,yktDoctor,payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
        JSONObject object = JSONObject.parseObject(response);
        if (object.getInteger("code")==200){
            businessOrderDO.setUploadStatus(1);
            businessOrderDao.save(businessOrderDO);
        }
        return businessOrderDO;
        return businessOrderDO;
    }
    }
@ -136,7 +148,7 @@ public class BusinessOrderService {
        String pcCallBack=businessOrderDO.getPcCallbackUrl();
        String pcCallBack=businessOrderDO.getPcCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        String url = wxWechatDO.getBaseUrl();
        String url = wxWechatDO.getBaseUrl();
        String notifyUrl =url+"/ykyy"+BaseHospitalRequestMapping.WxPay.Notify;
        String notifyUrl =url;
        Map<String,Object> map = unifiedorder(wechatId,description,businessOrderDO.getPayPrice().toString(),WeChatConfig.TRADE_TYPE_JSAPI,openId,orderNo,notifyUrl);
        Map<String,Object> map = unifiedorder(wechatId,description,businessOrderDO.getPayPrice().toString(),WeChatConfig.TRADE_TYPE_JSAPI,openId,orderNo,notifyUrl);
        String doctorId = "";
        String doctorId = "";
        if (doctorMappingDO!=null){
        if (doctorMappingDO!=null){
@ -197,7 +209,7 @@ public class BusinessOrderService {
        String ourTradeNo = businessOrderDO.getOrderNo();
        String ourTradeNo = businessOrderDO.getOrderNo();
        String url = wxWechatDO.getBaseUrl();
        String url = wxWechatDO.getBaseUrl();
        String notifyUrl =url+"/ykyy"+BaseHospitalRequestMapping.WxPay.Notify;
        String notifyUrl =url;
        Map<String,Object> map = unifiedorder(wechatId,body,totalFee,WeChatConfig.TRADE_TYPE_JSAPI,openid,ourTradeNo,notifyUrl);
        Map<String,Object> map = unifiedorder(wechatId,body,totalFee,WeChatConfig.TRADE_TYPE_JSAPI,openid,ourTradeNo,notifyUrl);
        return map;
        return map;
    }
    }
@ -214,7 +226,6 @@ public class BusinessOrderService {
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    @Transactional(rollbackFor = Exception.class)
    public  Map<String,Object> unifiedorder(String wechatId,String body,String totalFee,String tradeType,String openId,String ourTradeNo,String notifyUrl) throws Exception {
    public  Map<String,Object> unifiedorder(String wechatId,String body,String totalFee,String tradeType,String openId,String ourTradeNo,String notifyUrl) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        if(wxWechatDO==null){
        if(wxWechatDO==null){
@ -240,6 +251,7 @@ public class BusinessOrderService {
        map.put("mch_id",wxWechatDO.getMchId());
        map.put("mch_id",wxWechatDO.getMchId());
        map.put("body",body);
        map.put("body",body);
        map.put("out_trade_no",ourTradeNo);
        map.put("out_trade_no",ourTradeNo);
        map.put("fee_type","CNY");
        map.put("total_fee",totalFee);
        map.put("total_fee",totalFee);
        map.put("spbill_create_ip",getServerIp());
        map.put("spbill_create_ip",getServerIp());
        map.put("notify_url",notifyUrl);
        map.put("notify_url",notifyUrl);
@ -257,6 +269,7 @@ public class BusinessOrderService {
            String result1 = HttpUtil.sendGet(openidList_url, params1);
            String result1 = HttpUtil.sendGet(openidList_url, params1);
            JSONObject json1 = new JSONObject(result1);
            JSONObject json1 = new JSONObject(result1);
        }*/
        }*/
        logger.info("map:"+map.toString());
        Map<String, Object> pay = unifiedorder(map, wxWechatDO.getAppKey());
        Map<String, Object> pay = unifiedorder(map, wxWechatDO.getAppKey());
        String returnCode = pay.get("return_code").toString();
        String returnCode = pay.get("return_code").toString();
@ -267,12 +280,11 @@ public class BusinessOrderService {
            String prepayId = pay.get("prepay_id").toString();
            String prepayId = pay.get("prepay_id").toString();
            Map<String,String> param = new HashedMap();
            Map<String,String> param = new HashedMap();
            param.put("appid",appid);
            param.put("partnerid",mchId);
            param.put("prepayid",prepayId);
            param.put("package","Sign=WXPay");
            param.put("noncestr",nonceStr);
            param.put("timestamp",getTimeStamp());
            param.put("appId",appid);
            param.put("package","prepay_id="+prepayId);
            param.put("nonceStr",nonceStr);
            param.put("signType","MD5");
            param.put("timeStamp",getTimeStamp());
            param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
            param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
            pay.put("jsapi",param);
            pay.put("jsapi",param);
        }
        }

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java

@ -35,6 +35,7 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    private Integer status;//0待支付1支付成功2支付失败3取消
    private Integer status;//0待支付1支付成功2支付失败3取消
    private String pcCallbackUrl;//Pc端查看当前订单的会话信息
    private String pcCallbackUrl;//Pc端查看当前订单的会话信息
    private String appCallbackUrl;//App端查看当前订单的会话信息
    private String appCallbackUrl;//App端查看当前订单的会话信息
    private Integer uploadStatus;//上传状态1上传0未上传
    private Date createTime;
    private Date createTime;
    private String createUser;
    private String createUser;
    private String createUserName;
    private String createUserName;
@ -236,4 +237,13 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    public void setAppCallbackUrl(String appCallbackUrl) {
    public void setAppCallbackUrl(String appCallbackUrl) {
        this.appCallbackUrl = appCallbackUrl;
        this.appCallbackUrl = appCallbackUrl;
    }
    }
    @Column(name = "upload_status")
    public Integer getUploadStatus() {
        return uploadStatus;
    }
    public void setUploadStatus(Integer uploadStatus) {
        this.uploadStatus = uploadStatus;
    }
}
}

+ 4 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java

@ -573,6 +573,10 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
        this.getJdbcTemplate().update("update base_patient p set p.openid = ? where p.id= ?", openid, userId);
        this.getJdbcTemplate().update("update base_patient p set p.openid = ? where p.id= ?", openid, userId);
    }
    }
    public void updateOpenIdAndWechatId(String openid, String userId,String wechatId) {
        this.getJdbcTemplate().update("update base_patient_wechat p set p.openid = ? where p.patient_id= ? and p.wechat_id", openid, userId,wechatId);
    }
    public String getSynPath(String wxId){
    public String getSynPath(String wxId){
        String sql = "SELECT w.syn_path AS sysPath FROM wx_wechat w WHERE w.id ='"+wxId+"'";
        String sql = "SELECT w.syn_path AS sysPath FROM wx_wechat w WHERE w.id ='"+wxId+"'";

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

@ -31,6 +31,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.*;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -50,6 +51,7 @@ import org.springframework.security.oauth2.provider.request.DefaultOAuth2Request
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestValidator;
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestValidator;
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
import org.springframework.util.*;
import org.springframework.util.*;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestContextHolder;
@ -219,11 +221,15 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        wlyyUserSimple.setState(parameters.get("state"));
        wlyyUserSimple.setState(parameters.get("state"));
        String loginType = parameters.get("login_type");
        String loginType = parameters.get("login_type");
        String openid = parameters.get("openid");
        String openid = parameters.get("openid");
        String wechatId = parameters.get("wechatId");
        //更新患者openId
        //更新患者openId
        BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
        BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
        if (!StringUtils.isEmpty(openid) && !"undefined".equalsIgnoreCase(openid) && "3".equals(loginType)) {
        if (!StringUtils.isEmpty(openid) && !"undefined".equalsIgnoreCase(openid) && "3".equals(loginType)) {
            baseLoginLogDO.setOpenid(openid);
            baseLoginLogDO.setOpenid(openid);
            userDetailsService.updateOpenId(openid, wlyyUserSimple.getId());
            userDetailsService.updateOpenId(openid, wlyyUserSimple.getId());
            if (!StringUtils.isEmpty(wechatId)&& !"undefined".equalsIgnoreCase(wechatId)){
                userDetailsService.updateOpenIdAndWechatId(openid,wlyyUserSimple.getId(),wechatId);
            }
        }
        }
        if (parameters.get("password") != null) {
        if (parameters.get("password") != null) {
            //使用密码登录成功后, 更新失败次数为 0
            //使用密码登录成功后, 更新失败次数为 0

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

@ -8,12 +8,17 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.service.consult.SysDictService;
import com.yihu.jw.hospital.service.consult.SysDictService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.service.WechatInfoService;
import com.yihu.jw.wechat.service.WxUrlConfigService;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
@ -21,14 +26,17 @@ import org.apache.axis.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
import java.util.Date;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
/**
 * @author zmk
 * @author zmk
@ -41,6 +49,8 @@ import java.util.Map;
public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private static final Logger logger = LoggerFactory.getLogger(PatientNoLoginEndPoint.class);
    private static final Logger logger = LoggerFactory.getLogger(PatientNoLoginEndPoint.class);
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    @Autowired
@ -54,6 +64,13 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @Autowired
    @Autowired
    private BaseDoctorInfoService baseDoctorService;
    private BaseDoctorInfoService baseDoctorService;
    @Autowired
    private WechatInfoService wechatInfoService;
    @Value("${wechat.id}")
    private String wxId;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
@ -238,4 +255,50 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        return success("请求成功",result);
        return success("请求成功",result);
    }
    }
    /**
     * 获取微信openid
     *
     * @param code
     * @return
     */
    @RequestMapping(value = "/getOpenidByCode", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public Envelop getOpenidByCode(String code) throws Exception {
        //通过redis获取openid, 获取不到,则调用微信接口去取
        String key = wxId+":code";
        String openid = redisTemplate.opsForValue().get(key);
        if(!StringUtils.isEmpty(openid)){
            return success(PatientRequestMapping.Wechat.api_success,openid);
        }
        openid = wechatInfoService.getOpenidByCode(code, wxId);
        redisTemplate.opsForValue().set(key,openid);
        redisTemplate.expire(key,10, TimeUnit.SECONDS);
        return success(PatientRequestMapping.Wechat.api_success,openid);
    }
    /**
     * 微信支付异步回调
     * @param request
     * @param response
     * @return
     * @throws IOException
     */
    @ResponseBody
    @ApiOperation("微信支付结果通知")
    @RequestMapping(value = "/notify", method = {RequestMethod.GET, RequestMethod.POST})
    public Map<String, String> wxPayNotify(HttpServletRequest request, HttpServletResponse response) throws IOException {
        String result = "";
        String inputLine;
        while ((inputLine = request.getReader().readLine()) != null) {
            result += inputLine;
        }
        request.getReader().close();
        Map<String, String> map = businessOrderService.getWxPayResultNotify(result);
        return map;
    }
}
}

+ 2 - 2
svr/svr-internet-hospital/src/main/resources/application.yml

@ -414,8 +414,8 @@ spring:
    user: admin
    user: admin
    password: admin
    password: admin
  redis:
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
    host: 192.168.33.198 # Redis server host.
    port: 6380 # Redis server port.
fastDFS:
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
  fastdfs_file_url: http://172.26.0.110:8888/
fast-dfs:
fast-dfs: