Browse Source

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

yeshijie 3 years ago
parent
commit
7482e04a75

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

@ -11695,105 +11695,124 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                natFee= Double.parseDouble(chargeAmount)*100;
            }
            BasePatientDO  basePatientDO = basePatientDao.findById(patientId);
            net.sf.json.JSONObject jsondate = new JSONObject();
            jsondate.put("checkPart",checkPart);
            jsondate.put("cardNo",mediaCard);
            jsondate.put("chargeFlag",chargeFlag);
            jsondate.put("chargeCode",chargeCode);
            jsondate.put("icdCode",icdCode);
            jsondate.put("socialNo",cardNo);
            jsondate.put("tellPhone",mobile);
            jsondate.put("address1",provinceName);
            jsondate.put("address2",cityName);
            jsondate.put("address3",townName);
            jsondate.put("address4",streetName);
            jsondate.put("address5",address);
            jsondate.put("area",townName);
            jsondate.put("winNo",winNo);
            jsondate.put("targetChild",secondJobName);
            jsondate.put("target",firstJobName);
            jsondate.put("quantity",1);
            Map<String,Object> map = findRandomDoctor();
            if (map!=null){
                //先进行核算检测预约
                String realOrder="";
                String result = tasyNatService.initNatParams(preNo,name,cardNo);
                if (StringUtils.isNoneBlank(result)){
                    com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
                    logger.info("核酸检测预约结束"+result);
                    Boolean flag = false;
                    if (object!=null){
                        String returnCode = object.getString("returnCode");
                        if ("0".equalsIgnoreCase(returnCode)){
                            returnMap.put("msg",object.getString("returnMsg"));
                            returnMap.put("status","-1");
                            return  returnMap;
                        }else {
                            flag = true;
                            realOrder=object.getString("hisTradeNo");
                        }
            List<WlyyHospitalSysDictDO> tasyList = wlyyHospitalSysDictDao.findByDictName("natConfigList");
            String deptCode = "0001";
            String staffNo = "0001";
            for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:tasyList){
                if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"deptCode".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                    deptCode = wlyyHospitalSysDictDO.getDictValue();
                }
                if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"staffNo".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                    staffNo = wlyyHospitalSysDictDO.getDictValue();
                }
            }
            //先进行核算检测预约
            String realOrder="";
            String result = tasyNatService.initNatParams(preNo,name,cardNo);
            Boolean flag = false;
            if (StringUtils.isNoneBlank(result)){
                com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
                logger.info("核酸检测预约结束"+result);
                if (object!=null){
                    String returnCode = object.getString("returnCode");
                    if ("0".equalsIgnoreCase(returnCode)){
                        returnMap.put("msg",object.getString("returnMsg"));
                        returnMap.put("status","-1");
                        return  returnMap;
                    }else {
                        flag = true;
                        realOrder=object.getString("hisTradeNo");
                    }
                }
                if (flag){
                    BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
                    baseNatAppointmentDO.setChargeAmount(chargeAmount);
                    baseNatAppointmentDO.setMedicare(mediaCard);
                    baseNatAppointmentDO.setName(name);
                    baseNatAppointmentDO.setCardNo(cardNo);
                    baseNatAppointmentDO.setCardType(cardType);
                    baseNatAppointmentDO.setAddress(address);
                    baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
                    baseNatAppointmentDO.setCityName(cityName);
                    baseNatAppointmentDO.setFirstJobCode(firstJobCode);
                    baseNatAppointmentDO.setFirstJobName(firstJobName);
                    baseNatAppointmentDO.setSecondJobCode(secondJobCode);
                    baseNatAppointmentDO.setSecondJobName(secondJobName);
                    baseNatAppointmentDO.setProvinceName(provinceName);
                    baseNatAppointmentDO.setTownName(townName);
                    baseNatAppointmentDO.setStreetName(streetName);
                    baseNatAppointmentDO.setPatientId(patientId);
                    baseNatAppointmentDO.setIsSuccess("0");
                    baseNatAppointmentDO.setCardNoType(cardNoType);
                    baseNatAppointmentDO.setPayStatus("0");
                    baseNatAppointmentDO.setCreateTime(new Date());
                    baseNatAppointmentDO.setMobile(mobile);
                    baseNatAppointmentDO.setInspectionCode(chargeCode);
                    baseNatAppointmentDO.setInspectionName(inspectionName);
                    baseNatAppointmentDO.setIcdCode(icdCode);
                    baseNatAppointmentDO.setChargeCode(chargeCode);
                    baseNatAppointmentDO.setWinNo(String.valueOf(winNo));
                    baseNatAppointmentDO.setDept("3150000");
                    baseNatAppointmentDO.setDeptName("感染疾病科");
                    baseNatAppointmentDO.setRealOrder(realOrder);
                    baseNatAppointmentDO.setAmpm(pm);
                    baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
                    baseNatAppointmentDO.setDoctorName(map.get("doctorName").toString());
                    baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
                    //添加订单
                    BusinessOrderDO businessDO = new BusinessOrderDO();
                    businessDO.setPatient(consumer);
                    businessDO.setPatientName(basePatientDO.getName());
                    businessDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
                    businessDO.setCreateTime(new Date());
                    businessDO.setStatus(0);
                    businessDO.setRelationCode(baseNatAppointmentDO.getId()+"");
                    businessDO.setRelationName("核酸检测订单");
                    businessDO.setOrderCategory("6");
                    businessDO.setOrderType(12);
                    businessDO.setPayPrice(natFee);
                    businessDO.setRematk("核酸检测订单");
                    businessDO.setDescription("核酸检测订单");
                    businessDO.setPayType(1);
                    businessDO.setUpdateTime(new Date());
                    businessOrderDao.save(businessDO);
                    logger.info("开单结束");
                    logger.info("saveNatAppointment params:"+jsondate.toString());
                    returnMap.put("msg","预约成功");
                    returnMap.put("status","200");
                    returnMap.put("id",baseNatAppointmentDO.getId());
                    returnMap.put("realOrder",baseNatAppointmentDO.getRealOrder());
            }
            if (flag){
                BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
                baseNatAppointmentDO.setChargeAmount(chargeAmount);
                baseNatAppointmentDO.setMedicare(mediaCard);
                baseNatAppointmentDO.setName(name);
                baseNatAppointmentDO.setCardNo(cardNo);
                baseNatAppointmentDO.setCardType(cardType);
                baseNatAppointmentDO.setAddress(address);
                baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
                baseNatAppointmentDO.setCityName(cityName);
                baseNatAppointmentDO.setFirstJobCode(firstJobCode);
                baseNatAppointmentDO.setFirstJobName(firstJobName);
                baseNatAppointmentDO.setSecondJobCode(secondJobCode);
                baseNatAppointmentDO.setSecondJobName(secondJobName);
                baseNatAppointmentDO.setProvinceName(provinceName);
                baseNatAppointmentDO.setTownName(townName);
                baseNatAppointmentDO.setStreetName(streetName);
                baseNatAppointmentDO.setPatientId(patientId);
                baseNatAppointmentDO.setIsSuccess("0");
                baseNatAppointmentDO.setCardNoType(cardNoType);
                baseNatAppointmentDO.setPayStatus("0");
                baseNatAppointmentDO.setCreateTime(new Date());
                baseNatAppointmentDO.setMobile(mobile);
                baseNatAppointmentDO.setInspectionCode(chargeCode);
                baseNatAppointmentDO.setInspectionName(inspectionName);
                baseNatAppointmentDO.setIcdCode(icdCode);
                baseNatAppointmentDO.setChargeCode(chargeCode);
                baseNatAppointmentDO.setWinNo(String.valueOf(winNo));
                baseNatAppointmentDO.setDept(deptCode);
                baseNatAppointmentDO.setDeptName("感染疾病科");
                baseNatAppointmentDO.setRealOrder(realOrder);
                baseNatAppointmentDO.setAmpm(pm);
                baseNatAppointmentDO.setDoctorId(staffNo);
                baseNatAppointmentDO.setConsumer(consumer);
                //baseNatAppointmentDO.setDoctorName(map.get("doctorName").toString());
                baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
                //添加订单
                BusinessOrderDO businessDO = new BusinessOrderDO();
                businessDO.setPatient(consumer);
                businessDO.setPatientName(basePatientDO.getName());
                businessDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
                businessDO.setCreateTime(new Date());
                businessDO.setStatus(0);
                businessDO.setRelationCode(baseNatAppointmentDO.getId()+"");
                businessDO.setRelationName("核酸检测订单");
                businessDO.setOrderCategory("6");
                businessDO.setOrderType(12);
                businessDO.setPayPrice(natFee);
                businessDO.setRematk("核酸检测订单");
                businessDO.setDescription("核酸检测订单");
                businessDO.setPayType(1);
                businessDO.setUpdateTime(new Date());
                businessDO=businessOrderDao.save(businessDO);
                String openId="";
                List<BasePatientWechatDo> basePatientWechatDo = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,consumer);
                if (basePatientWechatDo!=null&&basePatientWechatDo.size()>0){
                    openId=basePatientWechatDo.get(0).getOpenid();
                }
                //亿同支付创建订单
                com.alibaba.fastjson.JSONObject orderObj= new com.alibaba.fastjson.JSONObject();
                orderObj.put("payType",1);
                orderObj.put("tradeNo",businessDO.getOrderNo());
                orderObj.put("openId",openId);
                orderObj.put("name",name);
                orderObj.put("idNo",cardNo);
                orderObj.put("amount",chargeAmount);
                String orderRes=tasyNatService.placeOrder(orderObj);
                if (StringUtils.isNoneBlank(orderRes)){
                    com.alibaba.fastjson.JSONObject jsonObject= JSON.parseObject(orderRes);
                    if (jsonObject!=null){
                        if("0".equalsIgnoreCase(jsonObject.getString("code"))){
                            com.alibaba.fastjson.JSONObject dataObj= com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("data"));
                            businessDO.setTraceNo(dataObj.getString("orderNo"));
                            businessDO=businessOrderDao.save(businessDO);
                        }
                    }
                }
                tasyNatService.sendWxtemplateMessaeg(baseNatAppointmentDO.getConsumer(),"hszftx",baseNatAppointmentDO.getName(),baseNatAppointmentDO.getId().toString());
                logger.info("开单结束");
                returnMap.put("msg","预约成功");
                returnMap.put("status","200");
                returnMap.put("id",baseNatAppointmentDO.getId());
                returnMap.put("realOrder",baseNatAppointmentDO.getRealOrder());
            }else {
                returnMap.put("msg","核酸开方失败");
                returnMap.put("status","-1");
                return returnMap;
            }
            return returnMap;
        }
@ -11991,7 +12010,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (StringUtils.isNoneBlank(patientId)){
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                sql+=" and t.consumer ='"+patientId+"'";
            }else {
            }else if (wechatId.equalsIgnoreCase("xm_tasy_wx")){
                sql+=" and t.consumer ='"+patientId+"'";
            } else {
                sql+=" and t.patient_id ='"+patientId+"'";
            }

+ 121 - 12
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/TasyNatService.java

@ -1,20 +1,29 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.sun.org.apache.regexp.internal.RE;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import net.sf.json.xml.XMLSerializer;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -22,6 +31,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -29,13 +39,20 @@ import java.util.Map;
@Transactional
public class TasyNatService {
    private static Logger logger = LoggerFactory.getLogger(TasyNatService.class);
    private static String key="bvvsf3JA0mUXMU+mVnMaOQ==";
    private static String operator="健康之路";
    private static String key="1";
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private WlyyHttpLogDao wlyyHttpLogDao;
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
    @Autowired
    private WxTemplateConfigDao wxTemplateConfigDao;
    public String getOperateUrl(){
@ -63,13 +80,13 @@ public class TasyNatService {
     */
    public String registerPatient(JSONObject jsonObject)throws Exception{
        String api = "SickNocardRegister";
        /*String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <callOperator>"+operator+"</callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";*/
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(jsonObject.getString("IdType"))){
            condition += "<IdType>"+jsonObject.getString("IdType")+"</IdType>";
@ -139,7 +156,7 @@ public class TasyNatService {
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        //params.put("msgHeader",msgHeader);
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("registerPatient params:"+params.toString());
        String xml = getTaszWebServiceInfo("CallInterface",params,getOperateUrl());
@ -158,7 +175,7 @@ public class TasyNatService {
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <callOperator>"+operator+"</callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
@ -195,7 +212,7 @@ public class TasyNatService {
            if (StringUtils.isNoneBlank(itemObject.getString("itemPrice"))){
                itemCoditon += "<itemPrice>"+itemCoditon+"</itemPrice>";
            }
            condition += "<itemList><item>"+jsonObject.getString("clinicFee")+"</item></itemList>";
            condition += "<itemList><item>"+itemCoditon+"</item></itemList>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
@ -220,7 +237,7 @@ public class TasyNatService {
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <callOperator>"+operator+"</callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
@ -257,7 +274,7 @@ public class TasyNatService {
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <callOperator>"+operator+"</callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
@ -334,6 +351,7 @@ public class TasyNatService {
        String res="";
        try {
            res = insertNucleicBill(jsonObject);
            saveHttpLog("insertNucleicBill",jsonObject.toString(),res,"insertNucleicBill");
            if (StringUtils.isNoneBlank(res)){
                return res;
            }
@ -352,6 +370,7 @@ public class TasyNatService {
        String res="";
        try {
            res = cancelNucleicBill(jsonObject);
            saveHttpLog("cancelNat",jsonObject.toString(),res,"cancelNat");
            if (StringUtils.isNoneBlank(res)){
                return res;
            }
@ -370,6 +389,7 @@ public class TasyNatService {
        String res="";
        try {
            res = ChargenucleicBill(jsonObject);
            saveHttpLog("chargeBill",jsonObject.toString(),res,"chargeBill");
            if (StringUtils.isNoneBlank(res)){
                return res;
            }
@ -391,9 +411,18 @@ public class TasyNatService {
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
        System.out.println(url);
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("placeOrder", jsonObject.toJSONString()));
        params.add(new BasicNameValuePair("payType", jsonObject.getString("payType")));
        params.add(new BasicNameValuePair("tradeNo", jsonObject.getString("tradeNo")));
        params.add(new BasicNameValuePair("openId", jsonObject.getString("openId")));
        params.add(new BasicNameValuePair("name", jsonObject.getString("name")));
        params.add(new BasicNameValuePair("idNo", jsonObject.getString("idNo")));
        params.add(new BasicNameValuePair("amount", jsonObject.getString("amount")));
        System.out.println(params.toString());
        String response = httpClientUtil.post(url,params ,"UTF-8");
        System.out.println("res"+response);
        saveHttpLog("placeOrder",params.toString(),response,url);
        return response;
    }
@ -403,9 +432,13 @@ public class TasyNatService {
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
        System.out.println(url);
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("orderStatus", jsonObject.toJSONString()));
        params.add(new BasicNameValuePair("orderNo", jsonObject.getString("orderNo")));
        System.out.println(params.toString());
        String response = httpClientUtil.post(url,params ,"UTF-8");
        System.out.println("res"+response);
        saveHttpLog("orderStatus",params.toString(),response,url);
        return response;
    }
@ -415,10 +448,86 @@ public class TasyNatService {
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
        System.out.println(url);
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("orderStatus", jsonObject.toJSONString()));
        params.add(new BasicNameValuePair("tempateId", jsonObject.getString("tempateId")));
        params.add(new BasicNameValuePair("url", jsonObject.getString("url")));
        params.add(new BasicNameValuePair("openId", jsonObject.getString("openId")));
        params.add(new BasicNameValuePair("data", jsonObject.getJSONObject("data").toString()));
        System.out.println(params.toString());
        String response = httpClientUtil.post(url,params ,"UTF-8");
        System.out.println("res"+response);
        saveHttpLog("tmpPush",params.toString(),response,url);
        return response;
    }
    public void  saveHttpLog(String name,String req,String res,String code){
        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
        wlyyHttpLogDO.setRequest(req);
        wlyyHttpLogDO.setName(name);
        wlyyHttpLogDO.setCode(code);
        wlyyHttpLogDO.setCreateTime(new Date());
        wlyyHttpLogDO.setResponse(res);
        wlyyHttpLogDao.save(wlyyHttpLogDO);
    }
    public String sendWxtemplateMessaeg(String patient,String name,String scene,String relationCode){
        String url="";
        String openId="";
        JSONObject key=new JSONObject();
        JSONObject key1=new JSONObject();
        JSONObject key2=new JSONObject();
        List<BasePatientWechatDo> basePatientWechatDo = basePatientWechatDao.findByWechatIdAndPatientId("xm_tasy_wx",patient);
        if (basePatientWechatDo!=null&&basePatientWechatDo.size()>0){
            openId=basePatientWechatDo.get(0).getOpenid();
        }
        if ("hszfcg".equalsIgnoreCase(scene)){
            //开始发送模板消息
            logger.info("开始发送模板消息");
            List<WxTemplateConfigDO> wxTemplateConfigDO = wxTemplateConfigDao.findByWechatIdAndScene("xm_tasy_wx",scene);
            WxTemplateConfigDO wxTemplateConfigDO1 = new WxTemplateConfigDO();
            if (wxTemplateConfigDO!=null&&wxTemplateConfigDO.size()>0){
                wxTemplateConfigDO1 = wxTemplateConfigDO.get(0);
            }
            url=wxTemplateConfigDO1.getUrl()+relationCode;
            key1.put("value",wxTemplateConfigDO1.getKeyword1().replace("key1",name));
            key1.put("color",wxTemplateConfigDO1.getKeyword6());
            key2.put("value",wxTemplateConfigDO1.getKeyword1().replace("key1",name));
            key2.put("color",wxTemplateConfigDO1.getKeyword6());
            key.put("keyword1",key1);
            key.put("keyword2",key2);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("tempateId",wxTemplateConfigDO1.getTemplateId());//
            jsonObject.put("data",key);
            jsonObject.put("openId",openId);
            jsonObject.put("url",url);
            logger.info("核酸检测支付成功模板消息推送param"+jsonObject.toString());
            String tmResilt= tmpPush(jsonObject);
            return tmResilt;
        } else if ("hszftx".equalsIgnoreCase(scene)) {
            //开始发送模板消息
            logger.info("开始发送模板消息");
            List<WxTemplateConfigDO> wxTemplateConfigDO = wxTemplateConfigDao.findByWechatIdAndScene("xm_tasy_wx",scene);
            WxTemplateConfigDO wxTemplateConfigDO1 = new WxTemplateConfigDO();
            if (wxTemplateConfigDO!=null&&wxTemplateConfigDO.size()>0){
                wxTemplateConfigDO1 = wxTemplateConfigDO.get(0);
            }
            url=wxTemplateConfigDO1.getUrl()+relationCode;
            key1.put("value",wxTemplateConfigDO1.getKeyword1().replace("key1",name));
            key1.put("color",wxTemplateConfigDO1.getKeyword6());
            key2.put("value",wxTemplateConfigDO1.getKeyword1().replace("key1",name));
            key2.put("color",wxTemplateConfigDO1.getKeyword6());
            key.put("keyword1",key1);
            key.put("keyword2",key2);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("tempateId",wxTemplateConfigDO1.getTemplateId());//
            jsonObject.put("data",key);
            jsonObject.put("openId",openId);
            jsonObject.put("url",url);
            logger.info("核酸检测支付提醒模板消息推送param"+jsonObject.toString());
            String tmResilt= tmpPush(jsonObject);
            return tmResilt;
        }
        return "";
    }
}

+ 2 - 1
business/base-service/src/main/java/com/yihu/jw/order/dao/BusinessOrderDao.java

@ -13,7 +13,8 @@ import java.util.List;
public interface BusinessOrderDao extends PagingAndSortingRepository<BusinessOrderDO, Integer>, JpaSpecificationExecutor<BusinessOrderDO>  {
    @Query("from BusinessOrderDO w where w.traceNo = ?1 and w.orderNo=?2")
    BusinessOrderDO selectByTraceNoAndorderNo(String traceNo,String orderNo);
    @Query("from BusinessOrderDO w where w.orderNo = ?1 ")
    BusinessOrderDO selectByOrderNo(String orderNo);

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

@ -14,6 +14,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
@ -65,6 +66,7 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import com.yihu.jw.wechat.service.WechatInfoService;
import com.yihu.jw.wlyy.wlyyhttp.WlyyHttpService;
import com.ylzinfo.onepay.sdk.OnepayClient;
@ -223,6 +225,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private TasyNatService tasyNatService;
    @Autowired
    private WxTemplateConfigDao wxTemplateConfigDao;
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
    @ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
@ -2277,4 +2281,50 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            return  failedException(e);
        }
    }
    /**
     * 亿同支付回调接口
     * @return
     * @throws IOException
     */
    @ResponseBody
    @ApiOperation("亿同支付回调接口")
    @RequestMapping(value = "/ytzfNotify", method = {RequestMethod.GET, RequestMethod.POST})
    public String ytzfNotify(@ApiParam(name = "code", value = "code", required = true)
                                 @RequestParam(value = "code", required = true) String code,
                             @ApiParam(name = "orderNo", value = "支付系统订单号(亿同系统订单号,用于查询订单号状态)", required = true)
                             @RequestParam(value = "orderNo", required = false) String orderNo,
                             @ApiParam(name = "traceNo", value = "互联网医院系统订单号", required = false)
                                 @RequestParam(value = "traceNo", required = false) String traceNo,
                             @ApiParam(name = "msg", value = "msg", required = false)
                                 @RequestParam(value = "msg", required = false) String msg) throws Exception {
        if ("0".equalsIgnoreCase(code)){
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByTraceNoAndorderNo(orderNo,traceNo);
            if (businessOrderDO!=null){
                JSONObject requestObj=new JSONObject();
                requestObj.put("orderNo",orderNo);
                String res = tasyNatService.orderStatus(requestObj);
                JSONObject orderStatus=JSONObject.parseObject(res);
                if ("0".equalsIgnoreCase(orderStatus.getString("code"))){
                    JSONObject data = orderStatus.getJSONObject("data");
                    if ("1".equalsIgnoreCase(data.getString("payOrderStatus"))){
                        businessOrderDO.setStatus(1);
                        businessOrderDao.save(businessOrderDO);
                        BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(Integer.valueOf(businessOrderDO.getRelationCode()));
                        if (baseNatAppointmentDO!=null){
                            if (baseNatAppointmentDO.getPayStatus().equalsIgnoreCase("0")){
                                tasyNatService.sendWxtemplateMessaeg(baseNatAppointmentDO.getConsumer(),"hszfcg",baseNatAppointmentDO.getName(),baseNatAppointmentDO.getId().toString());
                                baseNatAppointmentDO.setPayStatus("1");
                                baseNatAppointmentDao.save(baseNatAppointmentDO);
                            }
                            return "SUCCESS";
                    }
                }
                }
            }
        }
        return  "failed";
    }
}