Selaa lähdekoodia

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

# Conflicts:
#	svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/wechat/WechatMenuController.java
wangzhinan 4 vuotta sitten
vanhempi
commit
46b2da4c4d

+ 37 - 7
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java

@ -42,7 +42,6 @@ import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
@ -51,6 +50,8 @@ import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.security.MD5;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
@ -844,7 +845,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     * @return
     * @throws Exception
     */
    public Map<String,Object> savePrescriptionOrder(String code,Double price,String tradeType,String wechatId) throws Exception {
    public Map<String,Object> savePrescriptionOrder(String code,Double price,String tradeType,String wechatId,String appletCode) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        Map<String,Object> map = new HashedMap();
        if(wxWechatDO==null){
@ -854,12 +855,22 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        if (businessOrderDO!=null){
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            String openId = "";
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                openId = patientWechatDos.get(0).getOpenid();
            }
            if (!StringUtils.isNoneBlank(tradeType)){
                tradeType=WeChatConfig.TRADE_TYPE_JSAPI;
            if (StringUtils.isNotBlank(appletCode)){
                logger.info("appletCode不为空"+appletCode);
                Map<String,Object> objectMap = checkApplets(appletCode,wxWechatDO.getApplets(),wxWechatDO.getAppletsSecret());
                if (objectMap!=null){
                    openId = objectMap.get("openid").toString();
                    logger.info("appletCode"+appletCode);
                    logger.info("openid"+openId);
                }
            }else {
                logger.info("appletCode为空"+appletCode);
                List<BasePatientWechatDo> patientWechatDo = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
                if (patientWechatDo!=null&&patientWechatDo.size()!=0){
                    openId = patientWechatDo.get(0).getOpenid();
                }
            }
            String url = wxWechatDO.getBaseUrl();
            String notifyUrl =url;
            String totalFee =businessOrderDO.getPayPrice().intValue()+"";
@ -868,6 +879,25 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        return map;
    }
    public Map<String, Object> checkApplets(String code,String appid,String appSecret) throws Exception {
        HttpUtils httpUtils = new HttpUtils();
        Map<String, Object> param = new HashedMap();
        param.put("appid", appid);
        param.put("secret", appSecret);
        param.put("js_code", code);
        param.put("grant_type", "authorization_code");
        HttpResponse response = httpUtils.doGet("https://api.weixin.qq.com/sns/jscode2session", param);
        org.json.JSONObject rs = new org.json.JSONObject(response.getContent());
        Map<String, Object> res = new HashedMap();
        logger.info("checkApplets:"+response.getContent());
        if (rs.has("openid")){
            res.put("openid", rs.getString("openid"));
            res.put("sessionKey", rs.getString("session_key"));
        }
        return res;
    }
    /**
     * 获取诊断

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

@ -1206,9 +1206,11 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                      @ApiParam(name = "price", value = "支付费用")
                                      @RequestParam(value = "price", required = false)Double price,
                                      @ApiParam(name = "tradeType", value = "支付方式")
                                      @RequestParam(value = "tradeType", required = false)String tradeType)throws Exception {
                                      @RequestParam(value = "tradeType", required = false)String tradeType,
                                      @ApiParam(name = "appletCode", value = "appletCode", required = false)
                                          @RequestParam(value = "appletCode",required = false)String appletCode)throws Exception {
        try {
            return success("ok",ykyyPrescriptionService.savePrescriptionOrder(code,price,tradeType,wxId));
            return success("ok",ykyyPrescriptionService.savePrescriptionOrder(code,price,tradeType,wxId,appletCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }

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

@ -258,9 +258,11 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                       @ApiParam(name = "price", value = "支付费用")
                                       @RequestParam(value = "price", required = false)Double price,
                                      @ApiParam(name = "tradeType", value = "支付方式")
                                          @RequestParam(value = "tradeType", required = false)String tradeType)throws Exception {
                                          @RequestParam(value = "tradeType", required = false)String tradeType,
                                      @ApiParam(name = "appletCode", value = "appletCode", required = false)
                                          @RequestParam(value = "appletCode",required = false)String appletCode)throws Exception {
        try {
            return success("ok",prescriptionService.savePrescriptionOrder(code,price,tradeType,wxId));
            return success("ok",prescriptionService.savePrescriptionOrder(code,price,tradeType,wxId,appletCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }