ソースを参照

nologin代码解决冲突

wangjun 4 年 前
コミット
aadb2b725f

+ 5 - 4
business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java

@ -2,20 +2,20 @@ package com.yihu.jw.hospital.mapping.service;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import net.sf.json.JSONArray;
import net.sf.json.JSONArray;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import net.sf.json.JSONObject;
import net.sf.json.JSONObject;
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.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.Date;
@ -24,6 +24,7 @@ import java.util.Date;
 * 互联网医院居民信息映射
 * 互联网医院居民信息映射
 */
 */
@Service
@Service
@Transactional
public class PatientMappingService {
public class PatientMappingService {
    private static final Logger logger = LoggerFactory.getLogger(PatientMappingService.class);
    private static final Logger logger = LoggerFactory.getLogger(PatientMappingService.class);

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

@ -6048,7 +6048,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "AND consult.relation_code=outpatient.id " +
                "AND consult.relation_code=outpatient.id " +
                "AND outpatient.pay_status=1 " +
                "AND outpatient.pay_status=1 " +
                "AND outpatient.type =2 " +
                "AND outpatient.type =2 " +
                "AND outpatient.outpatient_type !=2 " +
                "AND consult.status = 0 ";
                "AND consult.status = 0 ";
        if (StringUtils.isNoneBlank(doctor)) {
        if (StringUtils.isNoneBlank(doctor)) {
            sql = sql + "AND room.doctor='" + doctor + "' " +
            sql = sql + "AND room.doctor='" + doctor + "' " +

+ 38 - 8
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.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
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.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
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.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
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 com.yihu.utils.security.MD5;
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;
@ -844,7 +845,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     * @return
     * @return
     * @throws Exception
     * @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);
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        Map<String,Object> map = new HashedMap();
        Map<String,Object> map = new HashedMap();
        if(wxWechatDO==null){
        if(wxWechatDO==null){
@ -854,20 +855,49 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        if (businessOrderDO!=null){
        if (businessOrderDO!=null){
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            String openId = "";
            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 url = wxWechatDO.getBaseUrl();
            String notifyUrl =url;
            String notifyUrl =url;
            String totalFee =businessOrderDO.getPayPrice().intValue()+"";
            String totalFee =businessOrderDO.getPayPrice().intValue()+"";
            map = businessOrderService.unifiedorder(wechatId,businessOrderDO.getDescription(),totalFee, tradeType,openId,businessOrderDO.getOrderNo(),notifyUrl);
            map = businessOrderService.unifiedorder(wechatId,businessOrderDO.getDescription(),totalFee, tradeType,openId,businessOrderDO.getOrderNo(),notifyUrl,businessOrderDO.getPatient());
        }
        }
        return map;
        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;
    }
    /**
    /**
     * 获取诊断
     * 获取诊断

+ 62 - 18
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -47,12 +47,13 @@ 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.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.ByteToInputStream;
import com.yihu.jw.utils.ByteToInputStream;
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.enterprise.EnterpriseService;
import com.yihu.jw.wechat.enterprise.EnterpriseService;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
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.slf4j.Logger;
import org.slf4j.Logger;
@ -385,7 +386,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        String url = wxWechatDO.getBaseUrl();
        String url = wxWechatDO.getBaseUrl();
        String notifyUrl =url;
        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,patient);
        String doctorId = "";
        String doctorId = "";
        if (doctorMappingDO!=null){
        if (doctorMappingDO!=null){
            doctorId = doctorMappingDO.getMappingCode();
            doctorId = doctorMappingDO.getMappingCode();
@ -433,30 +434,57 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        return HttpUtil.doRefund("https://api.mch.weixin.qq.com/secapi/pay/refund",xml,hospitalSysDictDO.getDictCode(),hospitalSysDictDO.getDictValue());
        return HttpUtil.doRefund("https://api.mch.weixin.qq.com/secapi/pay/refund",xml,hospitalSysDictDO.getDictCode(),hospitalSysDictDO.getDictValue());
    }
    }
    public Map<String,Object> selectOrderByRelationCode(String relationCode,String tradeType,String wechatId,boolean payFlag) throws Exception {
    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;
    }
    public Map<String,Object> selectOrderByRelationCode(String relationCode,String tradeType,String wechatId,boolean payFlag,String appletCode) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        String body = businessOrderDO.getDescription();
        String body = businessOrderDO.getDescription();
        String totalFee = businessOrderDO.getPayPrice().intValue()+"";
        String totalFee = businessOrderDO.getPayPrice().intValue()+"";
        String patient = businessOrderDO.getPatient();
        String patient = businessOrderDO.getPatient();
        String openid = "";
        String openid = "";
        if (StringUtils.isNoneBlank(patient)){
            List<BasePatientWechatDo> patientWechatDo = patientWechatDao.findByWechatIdAndPatientId(wechatId,patient);
            if (patientWechatDo!=null&&patientWechatDo.size()!=0){
                openid = patientWechatDo.get(0).getOpenid();
        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);
            if (StringUtils.isNoneBlank(patient)){
                List<BasePatientWechatDo> patientWechatDo = patientWechatDao.findByWechatIdAndPatientId(wechatId,patient);
                if (patientWechatDo!=null&&patientWechatDo.size()!=0){
                    openid = patientWechatDo.get(0).getOpenid();
                }
            }
            }
        }
        }
        String ourTradeNo = businessOrderDO.getOrderNo();
        String ourTradeNo = businessOrderDO.getOrderNo();
        if (!StringUtils.isNoneBlank(tradeType)){
        if (!StringUtils.isNoneBlank(tradeType)){
            tradeType=WeChatConfig.TRADE_TYPE_JSAPI;
            tradeType=WeChatConfig.TRADE_TYPE_JSAPI;
        }
        }
        String url = wxWechatDO.getBaseUrl();
        String url = wxWechatDO.getBaseUrl();
        String notifyUrl =url;
        String notifyUrl =url;
        Map<String,Object> map = new HashedMap();
        Map<String,Object> map = new HashedMap();
        if (payFlag){
        if (payFlag){
            map = unifiedorder(wechatId,body,totalFee,tradeType,openid,ourTradeNo,notifyUrl);
            map = unifiedorder(wechatId,body,totalFee,tradeType,openid,ourTradeNo,notifyUrl,patient);
        }else {
        }else {
            updatePayStatusByRelation(relationCode,wechatId);
            updatePayStatusByRelation(relationCode,wechatId);
        }
        }
@ -475,7 +503,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    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,String code) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        if(wxWechatDO==null){
        if(wxWechatDO==null){
            throw new Exception("can't find wechat:the wxId is "+wechatId);
            throw new Exception("can't find wechat:the wxId is "+wechatId);
@ -498,7 +526,14 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            throw new Exception("ourTradeNo is null :the ourTradeNo is "+ourTradeNo);
            throw new Exception("ourTradeNo is null :the ourTradeNo is "+ourTradeNo);
        }
        }
        HashMap<String, String> map = new HashMap<>();
        HashMap<String, String> map = new HashMap<>();
        map.put("appid",wxWechatDO.getAppId());
        if (tradeType.equalsIgnoreCase("APPLETS")){
            map.put("appid",wxWechatDO.getApplets());
            map.put("trade_type", "JSAPI");
        }else {
            map.put("appid",wxWechatDO.getAppId());
            map.put("trade_type", tradeType);
        }
        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);
@ -506,10 +541,17 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        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);
        map.put("trade_type", tradeType);
        if (tradeType.equalsIgnoreCase("JSAPI")){
        if (tradeType.equalsIgnoreCase("JSAPI")){
            map.put("openid", openId);
            map.put("openid", openId);
        }
        }
        if (tradeType.equalsIgnoreCase("APPLETS")){
            /*BasePatientDO patientDO = patientDao.findById(code);
            if (patientDO!=null){
                map.put("openid",patientDO.getOpenid());
            }*/
            map.put("openid", openId);
        }
        String wapUrl = "";
        String wapUrl = "";
        String wapName = "";
        String wapName = "";
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
@ -789,6 +831,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                        wlyyOutpatientDO.setPayStatus(1);
                        wlyyOutpatientDO.setPayStatus(1);
                        outpatientDao.save(wlyyOutpatientDO);
                        outpatientDao.save(wlyyOutpatientDO);
                    }
                    }
                }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")||businessOrderDO.getOrderCategory().equalsIgnoreCase("3")){
                }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")||businessOrderDO.getOrderCategory().equalsIgnoreCase("3")){
                    WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                    WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
@ -881,11 +924,11 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            wxPayLogDO.setPayTime(new Date());
            wxPayLogDO.setPayTime(new Date());
            wxPayLogDO.setPayStatus(1);
            wxPayLogDO.setPayStatus(1);
            wxPayLogDao.save(wxPayLogDO);
            wxPayLogDao.save(wxPayLogDO);
            rs.put("code","1");
            rs.put("message","支付成功");
            rs.put("return_code","SUCCESS");
            rs.put("return_msg","OK");
        }else{
        }else{
            rs.put("code","-1");
            rs.put("return_msg","FAIL");
            rs.put("return_code","FAIL");
            rs.put("return_msg","OK");
        }
        }
        return rs;
        return rs;
    }
    }
@ -1660,9 +1703,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        String url = wxWechatDO.getBaseUrl();
        String url = wxWechatDO.getBaseUrl();
        String notifyUrl =url;
        String notifyUrl =url;
        String price = (int)(businessOrderDO.getPayPrice()*100)+"";
        String price = (int)(businessOrderDO.getPayPrice()*100)+"";
        map = unifiedorder(wechatId,businessOrderDO.getDescription(),price,wxPayType,patientWechatDoList.get(0).getOpenid(),businessOrderDO.getOrderNo(),notifyUrl);
        map = unifiedorder(wechatId,businessOrderDO.getDescription(),price,wxPayType,patientWechatDoList.get(0).getOpenid(),businessOrderDO.getOrderNo(),notifyUrl,patientId);
        logger.info("success="+JSONObject.toJSONString(map));
        logger.info("success="+JSONObject.toJSONString(map));
        return map;
        return map;
    }
    }
}
}

+ 21 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/wx/WxWechatDO.java

@ -7,7 +7,6 @@ import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
@ -36,6 +35,8 @@ public class WxWechatDO extends UuidIdentityEntityWithOperator implements java.i
    private String mchId;//商户id
    private String mchId;//商户id
    private String cerfiticate;//商户证书(预留字段,保存证书路径??) 目前暂未使用到
    private String cerfiticate;//商户证书(预留字段,保存证书路径??) 目前暂未使用到
    private String appKey;//appKey
    private String appKey;//appKey
    private String applets;//小程序id
    private String appletsSecret;//小程序秘钥
    @Transient
    @Transient
@ -218,4 +219,23 @@ public class WxWechatDO extends UuidIdentityEntityWithOperator implements java.i
    public void setAppKey(String appKey) {
    public void setAppKey(String appKey) {
        this.appKey = appKey;
        this.appKey = appKey;
    }
    }
    @Column(name = "applets")
    public String getApplets() {
        return applets;
    }
    public void setApplets(String applets) {
        this.applets = applets;
    }
    @Column(name = "applets_secret")
    public String getAppletsSecret() {
        return appletsSecret;
    }
    public void setAppletsSecret(String appletsSecret) {
        this.appletsSecret = appletsSecret;
    }
}
}

+ 31 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/dao/patient/WechatDao.java

@ -0,0 +1,31 @@
package com.yihu.jw.security.dao.patient;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Administrator on 2017/5/20 0020.
 */
public interface WechatDao extends PagingAndSortingRepository<WxWechatDO, String>, JpaSpecificationExecutor<WxWechatDO> {
    @Query("from WxWechatDO w where w.appId = ?1 and w.status!=-1")
    WxWechatDO findByAppId(String appId);
    @Query("from WxWechatDO w where w.appId = ?1 and w.id!= ?2 and w.status!=-1")
    WxWechatDO findByAppIdExcludeId(String appId, String id);
    @Query("from WxWechatDO w where w.id = ?1 and w.status!=-1")
    WxWechatDO findById(String id);
    @Query("from WxWechatDO w where w.status!=-1")
    List<WxWechatDO> findAll();
    @Query("from WxWechatDO w where w.appOriginId = ?1 and w.status!=-1")
    WxWechatDO findByAppOriginId(String appOriginId);
    List<WxWechatDO> findByName(String name);
}

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

@ -7,6 +7,7 @@ import com.google.code.kaptcha.util.Config;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.restmodel.ResultStatus;
import com.yihu.jw.restmodel.ResultStatus;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -14,6 +15,7 @@ import com.yihu.jw.security.core.userdetails.jdbc.WlyyUserDetailsService;
import com.yihu.jw.security.dao.OauthKeypairDao;
import com.yihu.jw.security.dao.OauthKeypairDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.security.dao.patient.WechatDao;
import com.yihu.jw.security.exception.ImgCaptchaException;
import com.yihu.jw.security.exception.ImgCaptchaException;
import com.yihu.jw.security.login.service.BaseLoginLogService;
import com.yihu.jw.security.login.service.BaseLoginLogService;
import com.yihu.jw.security.model.*;
import com.yihu.jw.security.model.*;
@ -28,6 +30,8 @@ import com.yihu.jw.security.utils.SerializeUtil;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.security.MD5;
import com.yihu.utils.security.MD5;
import com.yihu.utils.security.RSAUtils;
import com.yihu.utils.security.RSAUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
@ -143,6 +147,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    private String wechatId;
    private String wechatId;
    @Autowired
    @Autowired
    private XzzxService xzzxService;
    private XzzxService xzzxService;
    @Autowired
    private WechatDao wechatDao;
    @PostConstruct
    @PostConstruct
    private void init() {
    private void init() {
@ -1718,6 +1724,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        String text = parameters.get("text");
        String text = parameters.get("text");
        String captcha = parameters.get("captcha");
        String captcha = parameters.get("captcha");
        String loginType = parameters.get("login_type");
        String loginType = parameters.get("login_type");
        String appletCode = parameters.get("appletCode");
        if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
        if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
            if(!verifyCaptcha(key,text)){
            if(!verifyCaptcha(key,text)){
                throw new ImgCaptchaException("img_captcha error");
                throw new ImgCaptchaException("img_captcha error");
@ -1910,7 +1917,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        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)){
            if (!StringUtils.isEmpty(wechatId)&& !"undefined".equalsIgnoreCase(wechatId)){
                userDetailsService.updateOpenIdAndWechatId(openid,wlyyUserSimple.getId(),wechatId);
                userDetailsService.updateOpenIdAndWechatId(openid,wlyyUserSimple.getId(),wechatId);
            }
            }
@ -1919,6 +1926,16 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
            //使用密码登录成功后, 更新失败次数为 0
            //使用密码登录成功后, 更新失败次数为 0
            userDetailsService.addFailureCount(username, 0);
            userDetailsService.addFailureCount(username, 0);
        }
        }
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        String appletOpenid = null;
        if (!StringUtils.isEmpty(appletCode)){
            Map<String,Object> objectMap = checkApplets(appletCode,wxWechatDO.getApplets(),wxWechatDO.getAppletsSecret());
            if (objectMap!=null){
                appletOpenid = objectMap.get("openid").toString();
                userDetailsService.updateOpenId(appletOpenid, wlyyUserSimple.getId());
            }
        }
        userDetailsService.setRolePhth(loginType, token, wlyyUserSimple.getId(), redisTemplate);
        userDetailsService.setRolePhth(loginType, token, wlyyUserSimple.getId(), redisTemplate);
        baseLoginLogDO.setUserId(wlyyUserSimple.getId());
        baseLoginLogDO.setUserId(wlyyUserSimple.getId());
@ -1932,6 +1949,26 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    }
    }
    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;
    }
    @RequestMapping(value = "/oauth/findYktPatientPw", method = RequestMethod.POST)
    @RequestMapping(value = "/oauth/findYktPatientPw", method = RequestMethod.POST)
    public Envelop findYktPatientPw(String mobile,String client_id,String login_type,String captcha,String pw)throws Exception {
    public Envelop findYktPatientPw(String mobile,String client_id,String login_type,String captcha,String pw)throws Exception {
        if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
        if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {

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

@ -10,6 +10,7 @@ import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
@ -23,10 +24,7 @@ import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.httplog.service.WlyyHttpLogService;
import com.yihu.jw.hospital.httplog.service.WlyyHttpLogService;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.PayInfoNoticeService;
import com.yihu.jw.hospital.prescription.service.PrescriptionExpressageService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.WorkTimeService;
import com.yihu.jw.hospital.prescription.service.*;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
@ -49,6 +47,7 @@ import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
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.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.service.WechatInfoService;
import com.yihu.jw.wechat.service.WechatInfoService;
import com.ylzinfo.onepay.sdk.OnepayClient;
import com.ylzinfo.onepay.sdk.OnepayClient;
@ -64,6 +63,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import net.sf.json.JSONArray;
import org.apache.axis.utils.StringUtils;
import org.apache.axis.utils.StringUtils;
import org.apache.commons.collections.map.HashedMap;
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;
@ -117,6 +117,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private WechatInfoService wechatInfoService;
    private WechatInfoService wechatInfoService;
    @Value("${wechat.id}")
    @Value("${wechat.id}")
    private String wxId;
    private String wxId;
    @Value("${pay.flag}")
    private boolean payFlag;
    @Autowired
    @Autowired
    private StringRedisTemplate redisTemplate;
    private StringRedisTemplate redisTemplate;
    @Autowired
    @Autowired
@ -164,6 +166,11 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private HospitalSystemMessageService hospitalSystemMessageService;
    private HospitalSystemMessageService hospitalSystemMessageService;
    @Autowired
    @Autowired
    private StatisticsEsService statisticsEsService;
    private StatisticsEsService statisticsEsService;
    @Autowired
    private BasePatientWechatDao patientWechatDao;
    @Autowired
    private YkyyPrescriptionService ykyyPrescriptionService;
@ -385,7 +392,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
     */
     */
    @RequestMapping(value = "/getOpenidByCode", method = {RequestMethod.POST, RequestMethod.GET})
    @RequestMapping(value = "/getOpenidByCode", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    @ResponseBody
    public Envelop getOpenidByCode(String code) throws Exception {
    public Envelop getOpenidByCode(String code,String patientId) throws Exception {
        //通过redis获取openid, 获取不到,则调用微信接口去取
        //通过redis获取openid, 获取不到,则调用微信接口去取
        String key = wxId+":code";
        String key = wxId+":code";
        String openid = redisTemplate.opsForValue().get(key);
        String openid = redisTemplate.opsForValue().get(key);
@ -393,6 +400,20 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            return success(PatientRequestMapping.Wechat.api_success,openid);
            return success(PatientRequestMapping.Wechat.api_success,openid);
        }
        }
        openid = wechatInfoService.getOpenidByCode(code, wxId);
        openid = wechatInfoService.getOpenidByCode(code, wxId);
        List<BasePatientWechatDo> patientWechatDoList =  patientWechatDao.findByWechatIdAndPatientId(wxId,patientId);
        if (patientWechatDoList!=null&&patientWechatDoList.size()!=0){
            BasePatientWechatDo patientWechatDo = patientWechatDoList.get(0);
            patientWechatDo.setOpenid(openid);
            patientWechatDao.save(patientWechatDo);
        }else {
            BasePatientWechatDo patientWechatDo = new BasePatientWechatDo();
            patientWechatDo.setCreateTime(new Date());
            patientWechatDo.setOpenid(openid);
            patientWechatDo.setWechatId(wxId);
            patientWechatDo.setPatientId(patientId);
            patientWechatDo.setSaasId("dev");
            patientWechatDao.save(patientWechatDo);
        }
        redisTemplate.opsForValue().set(key,openid);
        redisTemplate.opsForValue().set(key,openid);
        redisTemplate.expire(key,10, TimeUnit.SECONDS);
        redisTemplate.expire(key,10, TimeUnit.SECONDS);
        return success(PatientRequestMapping.Wechat.api_success,openid);
        return success(PatientRequestMapping.Wechat.api_success,openid);
@ -409,7 +430,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @ResponseBody
    @ResponseBody
    @ApiOperation("微信支付结果通知")
    @ApiOperation("微信支付结果通知")
    @RequestMapping(value = "/notify", method = {RequestMethod.GET, RequestMethod.POST})
    @RequestMapping(value = "/notify", method = {RequestMethod.GET, RequestMethod.POST})
    public Map<String, String> wxPayNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
    public String wxPayNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
        String result = "";
        String result = "";
        String inputLine;
        String inputLine;
        while ((inputLine = request.getReader().readLine()) != null) {
        while ((inputLine = request.getReader().readLine()) != null) {
@ -418,11 +439,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        request.getReader().close();
        request.getReader().close();
        //im处方发消息
        //im处方发消息
        Map<String,Object> wxrs =  XMLUtil.xmltoMap(result);
        Map<String,Object> wxrs =  XMLUtil.xmltoMap(result);
        Map<String, String> map = new HashedMap();
        if("SUCCESS".equals(wxrs.get("return_code").toString())){
        if("SUCCESS".equals(wxrs.get("return_code").toString())){
            // 我方 订单号+时间差
            // 我方 订单号+时间差
            String seqNo = wxrs.get("out_trade_no")+"";
            String seqNo = wxrs.get("out_trade_no")+"";
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(seqNo);
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(seqNo);
            if (businessOrderDO.getStatus()!=1){
            if (businessOrderDO.getStatus()!=1&&businessOrderDO.getStatus()!=9){
                if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("4")){
                if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("4")){
                    WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(businessOrderDO.getRelationCode());
                    WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(businessOrderDO.getRelationCode());
                    JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
                    JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
@ -440,10 +462,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                    prescriptionVO.setPayStatus(1);
                    prescriptionVO.setPayStatus(1);
                    imService.pushPrescriptionImMessage(prescriptionVO);
                    imService.pushPrescriptionImMessage(prescriptionVO);
                }
                }
                map= businessOrderService.getWxPayResultNotify(result);
            }
            }
        }
        }
        Map<String, String> map = businessOrderService.getWxPayResultNotify(result);
        return map;
        return XMLUtil.map2xml(map);
    }
    }
@ -1152,6 +1176,46 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        return success(prescriptionService.findOutpatientAndPatient(startTime,endTime));
        return success(prescriptionService.findOutpatientAndPatient(startTime,endTime));
    }
    }
    /**
     * 获取微信支付参数
     *
     * @param relationCode 关联code
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "selectOrderByRelationCode", method = RequestMethod.POST)
    @ApiOperation("获取微信支付参数")
    public ObjEnvelop selectOrderByRelationCode(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true)String relationCode,
            @ApiParam(name = "tradeType", value = "tradeType", required = false)
            @RequestParam(required = false)String tradeType,
            @ApiParam(name = "appletCode", value = "appletCode", required = false)
            @RequestParam(value = "appletCode",required = false)String appletCode) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectOrderByRelationCode(relationCode,tradeType,wxId,payFlag,appletCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.prescriptionPay)
    @ApiOperation(value = "处方支付", notes = "处方支付")
    public ObjEnvelop findPatientCard(@ApiParam(name = "code", value = "处方code")
                                      @RequestParam(value = "code", required = true)String code,
                                      @ApiParam(name = "price", value = "支付费用")
                                      @RequestParam(value = "price", required = false)Double price,
                                      @ApiParam(name = "tradeType", value = "支付方式")
                                      @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,appletCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDictLists)
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDictLists)
    @ApiOperation(value = "查询基础号别字典", notes = "查询基础号别字典")
    @ApiOperation(value = "查询基础号别字典", notes = "查询基础号别字典")
    public ListEnvelop findDictLists() throws Exception{
    public ListEnvelop findDictLists() throws Exception{

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

@ -1464,7 +1464,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(required = true)Integer type,
            @RequestParam(required = true)Integer type,
            @ApiParam(name = "paymentType", value = "1支付宝 2微信", required = true)
            @ApiParam(name = "paymentType", value = "1支付宝 2微信", required = true)
            @RequestParam(required = true)Integer paymentType,
            @RequestParam(required = true)Integer paymentType,
            @ApiParam(name = "patientId", value = "居民Ccode", required = true)
            @ApiParam(name = "patientId", value = "居民code", required = true)
            @RequestParam(required = true)String patientId,
            @RequestParam(required = true)String patientId,
            @ApiParam(name = "hospitalId", value = "医院Ccode", required = true)
            @ApiParam(name = "hospitalId", value = "医院Ccode", required = true)
            @RequestParam(required = true)String hospitalId,
            @RequestParam(required = true)String hospitalId,

+ 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 = "支付费用")
                                       @ApiParam(name = "price", value = "支付费用")
                                       @RequestParam(value = "price", required = false)Double price,
                                       @RequestParam(value = "price", required = false)Double price,
                                      @ApiParam(name = "tradeType", value = "支付方式")
                                      @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 {
        try {
            return success("ok",prescriptionService.savePrescriptionOrder(code,price,tradeType,wxId));
            return success("ok",prescriptionService.savePrescriptionOrder(code,price,tradeType,wxId,appletCode));
        } catch (Exception e) {
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return ObjEnvelop.getError(e.getMessage());
        }
        }

+ 8 - 8
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java

@ -1,21 +1,17 @@
package com.yihu.jw.hospital.endpoint.ykyy;
package com.yihu.jw.hospital.endpoint.ykyy;
import com.yihu.jw.entity.hospital.mapping.HospitalDeptMappingDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.BusinessOrderService;
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.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.wechat.service.WxTemplateService;
import com.yihu.jw.wechat.service.WxTemplateService;
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;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
@ -205,9 +201,11 @@ public class YkyyController extends EnvelopRestEndpoint {
            @ApiParam(name = "outTradeNo", value = "outTradeNo", required = true)
            @ApiParam(name = "outTradeNo", value = "outTradeNo", required = true)
            @RequestParam(required = true)String outTradeNo,
            @RequestParam(required = true)String outTradeNo,
            @ApiParam(name = "notifyUrl", value = "notifyUrl", required = true)
            @ApiParam(name = "notifyUrl", value = "notifyUrl", required = true)
            @RequestParam(required = true)String notifyUrl) throws Exception {
            @RequestParam(required = true)String notifyUrl,
            @ApiParam(name = "patient", value = "patient", required = false)
            @RequestParam(required = false)String patient) throws Exception {
        try {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.unifiedorder(wxId,body,totalFee,tradeType,openId,outTradeNo,notifyUrl));
            return ObjEnvelop.getSuccess("ok",businessOrderService.unifiedorder(wxId,body,totalFee,tradeType,openId,outTradeNo,notifyUrl,patient));
        } catch (Exception e) {
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return ObjEnvelop.getError(e.getMessage());
        }
        }
@ -327,9 +325,11 @@ public class YkyyController extends EnvelopRestEndpoint {
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true)String relationCode,
            @RequestParam(required = true)String relationCode,
            @ApiParam(name = "tradeType", value = "tradeType", required = false)
            @ApiParam(name = "tradeType", value = "tradeType", required = false)
            @RequestParam(required = false)String tradeType) throws Exception {
            @RequestParam(required = false)String tradeType,
            @ApiParam(name = "appletCode", value = "appletCode", required = false)
            @RequestParam(required = false)String appletCode) throws Exception {
        try {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectOrderByRelationCode(relationCode,tradeType,wxId,payFlag));
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectOrderByRelationCode(relationCode,tradeType,wxId,payFlag,appletCode));
        } catch (Exception e) {
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return ObjEnvelop.getError(e.getMessage());
        }
        }