Переглянути джерело

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

LAPTOP-KB9HII50\70708 4 тижнів тому
батько
коміт
f122eeed78
19 змінених файлів з 964 додано та 463 видалено
  1. 0 2
      business/base-service/src/main/java/com/yihu/jw/hospital/healthCare/YlzMedicailRelationRefundDao.java
  2. 3 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionExpressageDao.java
  3. 406 141
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  4. 3 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  5. 25 20
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  6. 136 71
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/util/SFUtils.java
  7. 37 0
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  8. 1 1
      business/sms-service/src/main/java/com/yihu/jw/sms/service/ZhongShanSMSService.java
  9. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionExpressageDO.java
  10. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyHisPrescriptionVO.java
  11. 25 25
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/config/MultipartConfig.java
  12. 35 10
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java
  13. 58 58
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/CORSFilter.java
  14. 122 122
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/CsrfFilter.java
  15. 3 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/PostFilter.java
  16. 2 0
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/third/PrescriptionUpdateController.java
  17. 11 5
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/RemindDoctorService.java
  18. 66 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  19. 20 5
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

+ 0 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/healthCare/YlzMedicailRelationRefundDao.java

@ -1,9 +1,7 @@
package com.yihu.jw.hospital.healthCare;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationRefundDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionExpressageDao.java

@ -14,6 +14,9 @@ import java.util.List;
 */
public interface PrescriptionExpressageDao extends PagingAndSortingRepository<WlyyPrescriptionExpressageDO, String>, JpaSpecificationExecutor<WlyyPrescriptionExpressageDO> {
    @Query("from WlyyPrescriptionExpressageDO p where p.bspOrderNo=?1")
    WlyyPrescriptionExpressageDO findByPrescriptionExpressBspOrderNo(String bspOrderNo);
    @Query("from WlyyPrescriptionExpressageDO p where p.mailno=?1")
    WlyyPrescriptionExpressageDO findByPrescriptionExpressMailno(String mailno);

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

@ -158,9 +158,12 @@ import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
@ -1244,6 +1247,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    expressageDO.setHospitalAddress(baseDrugStoreDO.getAddress());
                }
                expressageDO.setDel(1);
                expressageDO.setType(1);
                expressageDO.setCreateTime(new Date());
                expressageDO.setOutpatientId(outpatient.getId());
                prescriptionExpressageDao.save(expressageDO);
@ -3404,6 +3408,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (StringUtils.isNotBlank(prescriptionDO.getRealOrder())) {
            json.put("realOrder", prescriptionDO.getRealOrder());
        }
        json.put("bqbm",prescriptionDO.getDiseaseCode());
        json.put("cardNo", outpatientDO.getCardNo());
        json.put("doctor", doctorMappingDO.getMappingCode());
        json.put("dept", outpatientDO.getDept());
@ -3654,7 +3659,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param size
     * @return
     */
    public MixEnvelop findExpressageList(String status, String oneselfPickupFlg, String nameKey, String startTime, String endTime, Integer page, Integer size, String wxId,String patientName) {
    public MixEnvelop findExpressageList(String status, String oneselfPickupFlg, String nameKey, String startTime, String endTime, Integer page, Integer size, String wxId,String patientName,Integer type) {
        String totalSql = "SELECT " +
                " COUNT(1) AS \"total\" " +
                " FROM " +
@ -3672,6 +3677,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (StringUtils.isNotBlank(nameKey)) {
            totalSql += " AND e.name like '%" + nameKey + "%' ";
        }
        if (type!=null)  {
            totalSql += " AND e.sf_type ='"+type+"' ";
        }
        if (StringUtils.isNotBlank(patientName)) {
            totalSql += " AND o.patient_name like '%" + patientName + "%' ";
        }
@ -3738,6 +3746,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        sql = sql + " e.name as \"name\", " +
                " e.oneself_pickup_flg AS \"oneselfPickupFlg\", " +
                " e.sf_type AS \"type\", " +
                " o.id AS \"outpatientId\", " +
                " o.icd10_name AS \"icd10Name\", " +
                " o.medical_state AS \"medicalState\", " +
@ -3768,6 +3777,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (StringUtils.isNotBlank(patientName)) {
            sql += " AND o.patient_name like '%" + patientName + "%' ";
        }
        if (type!=null) {
            sql += " AND e.sf_type ='"+type+"' ";
        }
        if (StringUtils.isNotBlank(startTime)) {
            if ("xm_ykyy_wx".equals(wxId)) {
                if (flag){
@ -6058,6 +6070,142 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
    }
    /**
     * 顺丰同城物流模版消息
     *
     * @param outpatientId
     * @param prescriptionId
     * @param remindMsg
     */
    public void sendSFTcWxTemplate(String outpatientId,String prescriptionId,String remindMsg){
        String contentMsg = "";
        String first = "";
        String remark = "";
        String patientId = "";
        String drugName = "";
        String patienName = "";
        String mailNo ="";
        String msgUrl ="";
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
        List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
        if (wlyyOutpatientDO!=null){
            patientId = wlyyOutpatientDO.getConsumer();
        }
        if (wlyyPrescriptionInfoDOS!=null&&wlyyPrescriptionInfoDOS.size()>0){
            drugName = wlyyPrescriptionInfoDOS.get(0).getDrugName();
        }
        List<WlyyPrescriptionExpressageDO> wlyyPrescriptionExpressageDOS =prescriptionExpressageDao.findByOutpatientId(outpatientId);
        if (wlyyPrescriptionExpressageDOS!=null&&wlyyPrescriptionExpressageDOS.size()>0){
            mailNo = wlyyPrescriptionExpressageDOS.get(0).getMailno();
        }
        BasePatientDO basePatientDO = basePatientDao.findById(patientId);
        if (basePatientDO!=null){
            patienName = basePatientDO.getName();
        }
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)||"sd_tnzyy_wx".equalsIgnoreCase(wechatId)){
            List<BasePatientWechatDo> ps = new ArrayList<BasePatientWechatDo>();
            if (StringUtils.isNotEmpty(outpatientId)){
                ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId, patientId);
            }
            if (ps.isEmpty()) {
                logger.info("该用户" + patienName + "没有openid,无法推送模版消息,用户ID:" + patientId + "wechatId:" + wechatId);
                return;
            }
            WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
            String scene = "sfxxtx";
            WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_sf_msg_notice", scene, 1);
            BeanUtils.copyProperties(config, newConfig);
            newConfig.setFirst(config.getFirst().replace("key1",remindMsg));
            newConfig.setKeyword1(config.getKeyword1().replace("key1",patienName).replace("key2",drugName));
            newConfig.setKeyword2("顺丰快递");
            newConfig.setKeyword3(mailNo);
            newConfig.setKeyword4(remindMsg);
            newConfig.setRemark(config.getRemark());
            String path = "returnVisit/logistics?outpatientId="+outpatientId+"&prescriptionCode="+prescriptionId+"&realOrder="+prescriptionDO.getRealOrder();
            newConfig.setPagepath(newConfig.getPagepath()+ URLEncoder.encode(path));
            newConfig.setUrl(newConfig.getUrl().replace("key1",outpatientId).replace("key2",prescriptionId));
            logger.info("=======setUrl========" + newConfig.getUrl());
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            for (BasePatientWechatDo one : ps) {
                logger.info("发送的消息="+ com.alibaba.fastjson.JSONObject.toJSONString(newConfig));
                try {
                    logger.info("调用眼科微信模板消息接口的入参:AccessToken="+wxAccessTokenDO.getAccessToken()+"---Openid="+one.getOpenid());
                    weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), one.getOpenid(), newConfig);
                    logger.info("发送成功");
                } catch (Exception e) {
                    e.printStackTrace();
                    logger.info("发送失败,error="+e.getMessage());
                }
                //保存发送模板记录,
                WxPushLogDO wxPushLogDO = new WxPushLogDO();
                wxPushLogDO.setCreateTime(new Date());
                wxPushLogDO.setOpenid(one.getOpenid());
                wxPushLogDO.setReceiver(patientId);
                wxPushLogDO.setWechatId(wechatId);
                wxPushLogDO.setReceiverName(patienName);
                wxPushLogDO.setScene(scene);
                wxPushLogDao.save(wxPushLogDO);
            }
            //发送极光消息推送
            wxTempalteJPush("logistics_remind",wlyyOutpatientDO,null,drugName,mailNo,remindMsg,prescriptionId);
        }else {
            first = "您好,您的处方订单物流"+remindMsg;
            contentMsg = "药品订单"+remindMsg;
            logger.info("推送物流模板消息参数first:"+first+"====contentMsg:"+contentMsg);
            msgUrl="/ims-wx/index.html#/returnVisit/logistics?type=2&outpatientId="+outpatientId+"&prescriptionCode="+prescriptionId+"&realOrder="+prescriptionDO.getRealOrder();
            String responseMsg = "";
            if ("xm_xzzx_wx".equalsIgnoreCase(wechatId)) {
                //String prefix="https://www.xmheart.com";
                String prefix = "https://ih.xmheart.com/hlwyy";
                if(StringUtils.isNotEmpty(outpatientId)){
                    responseMsg = xzzxEntranceService.sendMes(wechatId,
                            patientId,
                            basePatientDO.getIdcard(),
                            first,
                            contentMsg,
                            remark,
                            prefix+msgUrl);
                }
                logger.info("url="+prefix+msgUrl);
                String msg="first:"+first+"contentMsg:"+contentMsg+"remark:"+remark;
                logger.info("发送的信息="+msg);
                logger.info("心脏模板消息发送返回结果:"+responseMsg);
            } else if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)) {
                String prefix = "https://hlwyy.xmzsh.com";
                if (StringUtils.isNotEmpty(outpatientId)) {
                    responseMsg = entranceService.ehospitalNotice(
                            patienName,
                            basePatientDO.getIdcard(),
                            basePatientDO.getMobile(),
                            first,
                            prefix + msgUrl,
                            contentMsg,
                            remark
                    );
                    logger.info("中山发送模板消息返回结果="+responseMsg);
                    System.out.println("结束发送模板消息");
                }
            }
            //保存发送模板记录,
            WxPushLogDO wxPushLogDO = new WxPushLogDO();
            wxPushLogDO.setCreateTime(new Date());
            wxPushLogDO.setReceiver(patientId);
            wxPushLogDO.setWechatId(wechatId);
            wxPushLogDO.setReceiverName(patienName);
            wxPushLogDO.setRequest(first+contentMsg+msgUrl);
            wxPushLogDO.setResponse(responseMsg);
            wxPushLogDO.setTempName("顺丰推送的物流消息");
            wxPushLogDao.save(wxPushLogDO);
        }
    }
    //核算检测预约模板消息
    public void sendNatWxTemplat(String name,String idcard,String mobile,String time,String orderNo,String relationName){
        String first = "";
@ -8495,139 +8643,27 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param realOrder 处方号
     * @
     */
    @Transactional(rollbackFor = Exception.class)
    public Object getSFExpressInfo(String admNo, String realOrder, String wxId) throws Exception {
        synchronized(realOrder.intern()){
            List<WlyyPrescriptionDO> wlyyPrescriptionDOList = prescriptionDao.findByRealOrderList(realOrder);
            Object result = "";
        //根据门诊唯一号取就诊记录
//        List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByAdmNo(admNo);
        List<WlyyPrescriptionDO> wlyyPrescriptionDOList = prescriptionDao.findByRealOrderList(realOrder);
        Object result = "";
        System.out.println("获取顺丰物流面单信息:wlyyPrescriptionDOS != null=" + wlyyPrescriptionDOList != null);
        if (wlyyPrescriptionDOList != null&&wlyyPrescriptionDOList.size()!=0) {
            WlyyPrescriptionDO wlyyPrescriptionDOS = wlyyPrescriptionDOList.get(0);
            List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByField("outpatientId", wlyyPrescriptionDOS.getOutpatientId());
            WlyyPrescriptionExpressageDO sfexpress_obj = null;
            System.out.println("获取顺丰物流面单信息:CollectionUtils.isEmpty(expressageDOList)=" + CollectionUtils.isEmpty(expressageDOList));
            if (CollectionUtils.isEmpty(expressageDOList)) {
                throw new Exception("顺丰快递下单失败,未找到该处方的派送地址!");
            } else {
                System.out.println("获取顺丰物流面单信息:1");
                sfexpress_obj = expressageDOList.get(0);
                if (sfexpress_obj.getType() == 2) {
                    com.alibaba.fastjson.JSONObject sfJsonObject = new com.alibaba.fastjson.JSONObject();
                    sfJsonObject.put("mailno", sfexpress_obj.getMailno());
                    sfJsonObject.put("mailtype", "同城快递");
                    if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
                        sfJsonObject.put("j_name", "厦门大学附属中山医院");
                        sfJsonObject.put("j_phone", "4003008888");
                        sfJsonObject.put("j_townName", "思明区");
                        sfJsonObject.put("j_address", "湖滨南路201-209号");
                    } else if (wxId.equalsIgnoreCase("xm_ykyy_wx")) {
                        sfJsonObject.put("j_name", "厦门大学附属中山医院");
                        sfJsonObject.put("j_phone", "4003008888");
                        sfJsonObject.put("j_townName", "思明区");
                        sfJsonObject.put("j_address", "湖滨南路201-209号");
                    }
                    sfJsonObject.put("j_provinceName", "福建省");
                    sfJsonObject.put("j_cityName", "厦门市");
                    sfJsonObject.put("d_name", sfexpress_obj.getName());
                    sfJsonObject.put("d_provinceName", sfexpress_obj.getProvinceName());
                    sfJsonObject.put("d_cityName", sfexpress_obj.getCityName());
                    sfJsonObject.put("d_townName", sfexpress_obj.getTownName());
                    sfJsonObject.put("d_address",sfexpress_obj.getStreetName()+sfexpress_obj.getAddress());
                    sfJsonObject.put("d_phone", sfexpress_obj.getMobile());
                    sfJsonObject.put("express_type", 11);
                    sfJsonObject.put("pay_method", 2);
                    sfJsonObject.put("receive_time", "");
                    sfJsonObject.put("dispensaryType", 2);
                    result = sfJsonObject;
                    System.out.println("获取顺丰物流面单信息:8");
                }else {
                    List<WlyyPrescriptionDO> wlyyPrescriptionDOS1 = prescriptionDao.findByOutpatientId(wlyyPrescriptionDOS.getOutpatientId());
                    if (wlyyPrescriptionDOS.getStatus()<31){
                        if (StringUtils.isNoneBlank(sfexpress_obj.getMailno())&&wlyyPrescriptionDOS1.size()>1){
                            String orderNo = "";
                            for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOS1){
                                if (!prescriptionDO.getRealOrder().equalsIgnoreCase(wlyyPrescriptionDOS.getRealOrder())){
                                    orderNo = prescriptionDO.getRealOrder();
                                }
                            }
                            throw new Exception("已存在地址"+sfexpress_obj.getAddress()+"、电话"+sfexpress_obj.getMobile()+"的快递单(单号"+orderNo+"),请将此处方与其打包一起。");
                        }
                    }
                    String sql = "SELECT\n" +
                            "\tpe.outpatient_id as outpatientId,\n" +
                            "\tpe.mailno as mailno,\n" +
                            "\tpe.address as address,\n" +
                            "\tpe.mobile as mobile\n" +
                            "FROM\n" +
                            "\twlyy_prescription_expressage pe\n" +
                            "WHERE\n" +
                            " pe.create_time >= '"+DateUtil.getStringDateShort()+" 00:00:00'\n" +
                            "AND pe.create_time <= '"+DateUtil.getStringDateShort()+" 23:59:59'\n" +
                            "AND pe.mailno IS NOT NULL\n" +
                            "and pe.address ='"+sfexpress_obj.getAddress()+"'\n" +
                            "and pe.mobile = '"+sfexpress_obj.getMobile()+"' ";
                    List<Map<String,Object>> maps = jdbcTemplate.queryForList(sql);
                    if (maps!=null&&maps.size()!=0){
                        Map<String,Object> map = maps.get(0);
                        if (wlyyPrescriptionDOS.getStatus()<31){
                            if (!map.get("outpatientId").toString().equalsIgnoreCase(wlyyPrescriptionDOS.getOutpatientId())){
                                String mailNo= map.get("mailno").toString();
                                /*       sfexpress_obj.setMailno(mailNo);*/
                                sfexpressService.updatePrescriptionExpressage(sfexpress_obj);
                                List<WlyyPrescriptionDO> wlyyPrescriptionDOS2 = prescriptionDao.findByOutpatientId(map.get("outpatientId").toString());
                                String orderNo = "";
                                for (WlyyPrescriptionDO wlyyPrescriptionDO:wlyyPrescriptionDOS2){
                                    orderNo +=wlyyPrescriptionDO.getRealOrder()+" ";
                                }
                                throw new Exception("已存在地址"+map.get("address")+"、电话"+map.get("mobile")+"的快递单(单号"+orderNo+"),请将此处方与其打包一起。");
                            }
                        }
                    }
                    System.out.println("获取顺丰物流面单信息:2");
                    //如果该处方的快递单号已生成,则说明已经下单成功,不需要重复下单,直接返回面单信息
                    System.out.println("获取顺丰物流面单信息:3");
                    if (org.apache.commons.lang.StringUtils.isNotBlank(sfexpress_obj.getMailno())) {
                        //处方已下单成功
                        System.out.println("获取顺丰物流面单信息:4");
                    } else {
                        //如果该处方的快递单号未生成,则继续下单
                        //根据业务订单号判断是否已经下单成功
                        //--2020.05.20--顺丰V2.0接口已不提供查询接口,直接单下单--START
//                    boolean go_on = sfexpressService.sfOrderSearchService(sfexpress_obj);
//
//                    //如果该业务订单号未下单成功过,则重新下单
//                    if(go_on){
//                        //请求顺丰接口下单,成功下单后,返回快递单号
//                        sfexpress_obj = sfexpressService.postSFOrderService(sfexpress_obj);
//                        //保存快递单号和增加处方物流记录为配送
//                        sfexpressService.updatePrescriptionExpressage(sfexpress_obj);
//                    }
                        //--2020.05.20--顺丰V2.0接口已不提供查询接口,直接单下单--END
                        //请求顺丰接口下单,成功下单后,返回快递单号
                        sfexpress_obj = sfexpressService.postSFOrderService(sfexpress_obj);
                        System.out.println("获取顺丰物流面单信息:5");
                        //保存快递单号和增加处方物流记录为配送
                        sfexpressService.updatePrescriptionExpressage(sfexpress_obj);
                        System.out.println("获取顺丰物流面单信息:6");
                    }
                    for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOList){
                        prescriptionDO.setStatus(31);
                        prescriptionDao.save(prescriptionDO);
                    }
                    if (sfexpress_obj != null && StringUtils.isNoneBlank(sfexpress_obj.getMailno())) {
                        com.alibaba.fastjson.JSONObject object = sfexpressService.postSFOrderQueryService(sfexpress_obj);
                        System.out.println("获取顺丰物流面单信息7-1"+object.toJSONString());
                        System.out.println("获取顺丰物流面单信息:7");
            System.out.println("获取顺丰物流面单信息:wlyyPrescriptionDOS != null=" + wlyyPrescriptionDOList != null);
            if (wlyyPrescriptionDOList != null&&wlyyPrescriptionDOList.size()!=0) {
                WlyyPrescriptionDO wlyyPrescriptionDOS = wlyyPrescriptionDOList.get(0);
                List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByField("outpatientId", wlyyPrescriptionDOS.getOutpatientId());
                WlyyPrescriptionExpressageDO sfexpress_obj = null;
                System.out.println("获取顺丰物流面单信息:CollectionUtils.isEmpty(expressageDOList)=" + CollectionUtils.isEmpty(expressageDOList));
                if (CollectionUtils.isEmpty(expressageDOList)) {
                    throw new Exception("顺丰快递下单失败,未找到该处方的派送地址!");
                } else {
                    System.out.println("获取顺丰物流面单信息:1");
                    sfexpress_obj = expressageDOList.get(0);
                    if (sfexpress_obj.getType()!=null&&sfexpress_obj.getType() == 2) {
                        com.alibaba.fastjson.JSONObject sfJsonObject = new com.alibaba.fastjson.JSONObject();
                        sfJsonObject.put("mailno", sfexpress_obj.getMailno());
                        sfJsonObject.put("mailtype", "标准快递");
                        sfJsonObject.put("destcode", object.getString("destRouteLabel"));
                        sfJsonObject.put("mailtype", "同城快递");
                        if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
                            sfJsonObject.put("j_name", "厦门大学附属中山医院");
                            sfJsonObject.put("j_phone", "4003008888");
@ -8652,16 +8688,134 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        sfJsonObject.put("pay_method", 2);
                        sfJsonObject.put("receive_time", "");
                        sfJsonObject.put("dispensaryType", 2);
                        sfJsonObject.put("destcode","592AH-002A");
                        for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOList){
                            prescriptionDO.setStatus(32);
                            prescriptionDao.save(prescriptionDO);
                        }
                        result = sfJsonObject;
                        System.out.println("获取顺丰物流面单信息:8");
                    }
                    }else {
                        List<WlyyPrescriptionDO> wlyyPrescriptionDOS1 = prescriptionDao.findByOutpatientId(wlyyPrescriptionDOS.getOutpatientId());
                        if (wlyyPrescriptionDOS.getStatus()<31){
                            if (StringUtils.isNoneBlank(sfexpress_obj.getMailno())&&wlyyPrescriptionDOS1.size()>1){
                                String orderNo = "";
                                for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOS1){
                                    if (!prescriptionDO.getRealOrder().equalsIgnoreCase(wlyyPrescriptionDOS.getRealOrder())){
                                        orderNo = prescriptionDO.getRealOrder();
                                    }
                                }
                                throw new Exception("已存在地址"+sfexpress_obj.getAddress()+"、电话"+sfexpress_obj.getMobile()+"的快递单(单号"+orderNo+"),请将此处方与其打包一起。");
                            }
                        }
                        String sql = "SELECT\n" +
                                "\tpe.outpatient_id as outpatientId,\n" +
                                "\tpe.mailno as mailno,\n" +
                                "\tpe.address as address,\n" +
                                "\tpe.mobile as mobile\n" +
                                "FROM\n" +
                                "\twlyy_prescription_expressage pe\n" +
                                "WHERE\n" +
                                " pe.create_time >= '"+DateUtil.getStringDateShort()+" 00:00:00'\n" +
                                "AND pe.create_time <= '"+DateUtil.getStringDateShort()+" 23:59:59'\n" +
                                "AND pe.mailno IS NOT NULL\n" +
                                "and pe.address ='"+sfexpress_obj.getAddress()+"'\n" +
                                "and pe.mobile = '"+sfexpress_obj.getMobile()+"' ";
                        List<Map<String,Object>> maps = jdbcTemplate.queryForList(sql);
                        if (maps!=null&&maps.size()!=0){
                            Map<String,Object> map = maps.get(0);
                            if (wlyyPrescriptionDOS.getStatus()<31){
                                if (!map.get("outpatientId").toString().equalsIgnoreCase(wlyyPrescriptionDOS.getOutpatientId())){
                                    String mailNo= map.get("mailno").toString();
                                    /*       sfexpress_obj.setMailno(mailNo);*/
                                    sfexpressService.updatePrescriptionExpressage(sfexpress_obj);
                                    List<WlyyPrescriptionDO> wlyyPrescriptionDOS2 = prescriptionDao.findByOutpatientId(map.get("outpatientId").toString());
                                    String orderNo = "";
                                    for (WlyyPrescriptionDO wlyyPrescriptionDO:wlyyPrescriptionDOS2){
                                        orderNo +=wlyyPrescriptionDO.getRealOrder()+" ";
                                    }
                                    throw new Exception("已存在地址"+map.get("address")+"、电话"+map.get("mobile")+"的快递单(单号"+orderNo+"),请将此处方与其打包一起。");
                                }
                            }
                        }
                        System.out.println("获取顺丰物流面单信息:2");
                        //如果该处方的快递单号已生成,则说明已经下单成功,不需要重复下单,直接返回面单信息
                        System.out.println("获取顺丰物流面单信息:3");
                        if (org.apache.commons.lang.StringUtils.isNotBlank(sfexpress_obj.getMailno())) {
                            //处方已下单成功
                            System.out.println("获取顺丰物流面单信息:4");
                        } else {
                            //如果该处方的快递单号未生成,则继续下单
                            //根据业务订单号判断是否已经下单成功
                            //--2020.05.20--顺丰V2.0接口已不提供查询接口,直接单下单--START
//                    boolean go_on = sfexpressService.sfOrderSearchService(sfexpress_obj);
//
//                    //如果该业务订单号未下单成功过,则重新下单
//                    if(go_on){
//                        //请求顺丰接口下单,成功下单后,返回快递单号
//                        sfexpress_obj = sfexpressService.postSFOrderService(sfexpress_obj);
//                        //保存快递单号和增加处方物流记录为配送
//                        sfexpressService.updatePrescriptionExpressage(sfexpress_obj);
//                    }
                            //--2020.05.20--顺丰V2.0接口已不提供查询接口,直接单下单--END
                            //请求顺丰接口下单,成功下单后,返回快递单号
                            sfexpress_obj = sfexpressService.postSFOrderService(sfexpress_obj);
                            System.out.println("获取顺丰物流面单信息:5");
                            //保存快递单号和增加处方物流记录为配送
                            sfexpressService.updatePrescriptionExpressage(sfexpress_obj);
                            System.out.println("获取顺丰物流面单信息:6");
                        }
                        for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOList){
                            prescriptionDO.setStatus(31);
                            prescriptionDao.save(prescriptionDO);
                        }
                        if (sfexpress_obj != null && StringUtils.isNoneBlank(sfexpress_obj.getMailno())) {
                            com.alibaba.fastjson.JSONObject object = sfexpressService.postSFOrderQueryService(sfexpress_obj);
                            System.out.println("获取顺丰物流面单信息7-1"+object.toJSONString());
                            System.out.println("获取顺丰物流面单信息:7");
                            com.alibaba.fastjson.JSONObject sfJsonObject = new com.alibaba.fastjson.JSONObject();
                            sfJsonObject.put("mailno", sfexpress_obj.getMailno());
                            sfJsonObject.put("mailtype", "标准快递");
                            sfJsonObject.put("destcode", object.getString("destRouteLabel"));
                            if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
                                sfJsonObject.put("j_name", "厦门大学附属中山医院");
                                sfJsonObject.put("j_phone", "4003008888");
                                sfJsonObject.put("j_townName", "思明区");
                                sfJsonObject.put("j_address", "湖滨南路201-209号");
                            } else if (wxId.equalsIgnoreCase("xm_ykyy_wx")) {
                                sfJsonObject.put("j_name", "厦门大学附属中山医院");
                                sfJsonObject.put("j_phone", "4003008888");
                                sfJsonObject.put("j_townName", "思明区");
                                sfJsonObject.put("j_address", "湖滨南路201-209号");
                            }
                            sfJsonObject.put("j_provinceName", "福建省");
                            sfJsonObject.put("j_cityName", "厦门市");
                            sfJsonObject.put("d_name", sfexpress_obj.getName());
                            sfJsonObject.put("d_provinceName", sfexpress_obj.getProvinceName());
                            sfJsonObject.put("d_cityName", sfexpress_obj.getCityName());
                            sfJsonObject.put("d_townName", sfexpress_obj.getTownName());
                            sfJsonObject.put("d_address",sfexpress_obj.getStreetName()+sfexpress_obj.getAddress());
                            sfJsonObject.put("d_phone", sfexpress_obj.getMobile());
                            sfJsonObject.put("express_type", 11);
                            sfJsonObject.put("pay_method", 2);
                            sfJsonObject.put("receive_time", "");
                            sfJsonObject.put("dispensaryType", 2);
                            result = sfJsonObject;
                            System.out.println("获取顺丰物流面单信息:8");
                        }
                    }
                }
            }
            }
            System.out.println("获取顺丰物流面单信息:9");
            return result;
        }
        System.out.println("获取顺丰物流面单信息:9");
        return result;
    }
@ -11684,7 +11838,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (patientDO==null){
            return PageEnvelop.getError("找不到该患者",-1);
        }
        StringBuffer sql = new StringBuffer(" SELECT DISTINCT b.*, c.oneself_pickup_flg,f.job_title_code,f.job_title_name  FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
        StringBuffer sql = new StringBuffer(" SELECT DISTINCT b.*, c.oneself_pickup_flg,c.sf_type as \"type\",f.job_title_code,f.job_title_name  FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
        StringBuffer countSql = new StringBuffer("select COUNT(DISTINCT b.id) count FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
        /*if (consumerflag){
            sql.append(" WHERE o.consumer = '");
@ -16990,18 +17144,129 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param type
     * @return
     */
    public String updateExpressInfo(String realOrder,Integer type){
    @Transactional(rollbackFor = Exception.class)
    public String updateExpressInfo(String realOrder,Integer type) throws Exception {
        String res = "";
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findByRealOrder(realOrder);
        List<WlyyPrescriptionExpressageDO> expressageDOS = prescriptionExpressageDao.findByOutpatientId(prescriptionDO.getOutpatientId());
        WlyyPrescriptionExpressageDO expressageDO = expressageDOS.get(0);
        if(type==1){
            expressageDO.setType(1);
            expressageDO.setUpdateTime(new Date());
        }else {
            res = sfUtils.createorder(realOrder);
        synchronized(realOrder.intern()){
            if (StringUtils.isNoneBlank(expressageDO.getMailno())){
                throw new Exception("已下单,请勿重新下单");
            }else {
                if(type==1){
                    expressageDO.setType(1);
                    expressageDO.setOneselfPickupFlg(0);
                    expressageDO.setUpdateTime(new Date());
                }else {
                    if(!selectTime()){
                        throw new Exception("当前时间段不支持同城配送。");
                    }
                    else {
                        res = sfUtils.createorder(realOrder);
                    }
                }
            }
        }
        return res;
    }
    public void routeInfo(String json,Integer flag){
        com.alibaba.fastjson.JSONObject obj = com.alibaba.fastjson.JSONObject.parseObject(json);
        String orderId = obj.getString("sf_order_id");
        String order_status =obj.getString("order_status");
        String status_desc  =obj.getString("status_desc");
        String msgContent = unicodeToStr(status_desc);
        WlyyPrescriptionExpressageDO expressageDO = prescriptionExpressageDao.findByPrescriptionExpressBspOrderNo(orderId);
        List<WlyyPrescriptionDO> prescriptionDOS = prescriptionDao.findByOutpatientId(expressageDO.getOutpatientId());
        if(flag==1){
        } else if (flag==2) {
            String cancel_reason = obj.getString("cancel_reason");
            String cancel_code = obj.getString("cancel_code");
            msgContent +=unicodeToStr(cancel_reason);
        } else if(flag==3){
            prescriptionDao.updateStatusByOutPatientId( 100,new Date(),expressageDO.getOutpatientId());
            for (WlyyPrescriptionDO prescriptionDO:prescriptionDOS){
                if (prescriptionDO.getStatus()>=32){
                    WlyyPrescriptionLogDO prescriptionLogDO = new WlyyPrescriptionLogDO();
                    prescriptionLogDO.setCreateTime(new Date());
                    prescriptionLogDO.setStatus(100);
                    prescriptionLogDO.setOutpatientId(prescriptionDO.getOutpatientId());
                    prescriptionLogDO.setPrescriptionCode(prescriptionDO.getPatientCode());
                    prescriptionLogDO.setUserCode(prescriptionDO.getPatientCode());
                    prescriptionLogDO.setUserName(prescriptionDO.getPatientName());
                    prescriptionLogDO.setUserType(1);
                    prescriptionLogDO.setDatajson("处方完成");
                    prescriptionLogDao.save(prescriptionLogDO);
                    logger.info("更新处方日志");
                }
            }
        }
        for (WlyyPrescriptionDO prescriptionDO:prescriptionDOS){
            sendSFTcWxTemplate(prescriptionDO.getOutpatientId(),prescriptionDO.getId(),msgContent);
        }
    }
    private String unicodeToStr(String unicodeCodePoints){
        java.util.regex.Pattern pattern = Pattern.compile("(\\\\u(\\p{XDigit}{4}))");
        Matcher matcher = pattern.matcher(unicodeCodePoints);
        char ch;
        while (matcher.find()) {
            ch = (char) Integer.parseInt(matcher.group(2), 16);
            unicodeCodePoints = unicodeCodePoints.replace(matcher.group(1), ch + "");
        }
        return unicodeCodePoints;
    }
    /**
     * 查询是否符合时间内的同城配送标识
     * @return
     */
    public boolean selectTime(){
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("sftcTimeLimit");
        boolean flag =false;
        if (StringUtils.isNoneBlank(sysDictDO.getDictValue())){
            com.alibaba.fastjson.JSONObject obj = com.alibaba.fastjson.JSONObject.parseObject(sysDictDO.getDictValue());
            String amStartStr = DateUtil.getStringDateShort()+" "+obj.getString("amStartDate");
            String sftcFlag = obj.getString("sftcFlag");
            String amEndStr = DateUtil.getStringDateShort()+" "+obj.getString("amEndDate");
            String pmStartStr = DateUtil.getStringDateShort()+" "+obj.getString("pmStartDate");
            String pmEndStr = DateUtil.getStringDateShort()+" "+obj.getString("pmEndDate");
            Date nowDate = new Date();
            Date amStartDate = DateUtil.strToDateLong(amStartStr);
            Date amEndDate = DateUtil.strToDateLong(amEndStr);
            Date pmStartDate = DateUtil.strToDateLong(pmStartStr);
            Date pmEndDate = DateUtil.strToDateLong(pmEndStr);
            if (sftcFlag.equalsIgnoreCase("1")){
                LocalDate today = LocalDate.now();
                int dayOfWeek = today.getDayOfWeek().getValue();
                System.out.println(dayOfWeek+"=====================");
                if (dayOfWeek==6) {
                    if (amStartDate.compareTo(nowDate) < 0 && amEndDate.compareTo(nowDate) > 0) {
                        flag = true;
                    }else{
                        flag=false;
                    }
                }else if(dayOfWeek==7){
                    flag=false;
                }else{
                    if (amStartDate.compareTo(nowDate)<0&&amEndDate.compareTo(nowDate)>0){
                        flag = true;
                    } else if (pmStartDate.compareTo(nowDate)<0&&pmEndDate.compareTo(nowDate)>0) {
                        flag = true;
                    }else {
                        flag = false;
                    }
                }
            }else {
                flag=false;
            }
        }
        return flag;
    }
}

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

@ -1636,8 +1636,9 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            invoice.put("unit", mxDO.getChargeUnit());//单位
            invoice.put("specType", mxDO.getSpecificationType());//规格型号
            invoice.put("tax", 0);//
            invoice.put("favouredPolicyFlag","03");//优惠政策标识:0,不使用;1,使用;数电票时简易征收 02:稀土03:免税04:不征税 05:先征后退 06:100%先征后退 07:50%先征后退 08: 按 3%简易征收09:按5%简易征收 10: 按5% 简易征收减按1.5%计征11: 即征即退 30% 12: 即征即退 50% 13:即征即退 70%14 :即征即退 100%15:超税负 3%即征即退超税负 8%即征即退 17:超6:税负 12%即征即退 18:超税负 6%即征即退
            invoice.put("zeroRateFlag", 3);//
            invoice.put("favouredPolicyFlag","1");//优惠政策标识:0,不使用;1,使用;数电票时简易征收 02:稀土03:免税04:不征税 05:先征后退 06:100%先征后退 07:50%先征后退 08: 按 3%简易征收09:按5%简易征收 10: 按5% 简易征收减按1.5%计征11: 即征即退 30% 12: 即征即退 50% 13:即征即退 70%14 :即征即退 100%15:超税负 3%即征即退超税负 8%即征即退 17:超6:税负 12%即征即退 18:超税负 6%即征即退
            invoice.put("favouredPolicyName","免税");
            invoice.put("zeroRateFlag", 1);//
            invoice.put("deduction", 0);
            array.add(invoice);
        }

+ 25 - 20
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -1174,6 +1174,9 @@ public class EntranceService {
                if (StringUtils.isNotBlank(vo.getRealOrder())) {
                    sbs.append(" real_order=\"" + vo.getRealOrder() + "\"");
                }
                if (StringUtils.isNotBlank(vo.getBqbm())) {
                    sbs.append(" bqbm=\"" + vo.getBqbm() + "\" ");
                }
                if (StringUtils.isNotBlank(vo.getChargeCode())) {
                    sbs.append(" charge_code=\"" + vo.getChargeCode() + "\"");
                }
@ -1417,15 +1420,15 @@ public class EntranceService {
        Map<String, String> orgCodeMap = new HashMap<>();
        //6总部7金榜8夏禾
        orgCodeMap.put("6", orgCode);
        orgCodeMap.put("7", "");
        orgCodeMap.put("8", "");
        //删除旧数据
        List<String> strings = new ArrayList<>(orgCodeMap.values());
        for (String s : strings) {
            if (StringUtils.isNotBlank(s)) {
                dictHospitalDeptDao.deleteByOrgCode(s);
            }
        }
        orgCodeMap.put("7", orgCode);
        orgCodeMap.put("8", orgCode);
//        //删除旧数据
//        List<String> strings = new ArrayList<>(orgCodeMap.values());
//        for (String s : strings) {
//            if (StringUtils.isNotBlank(s)) {
//                dictHospitalDeptDao.deleteByOrgCode(s);
//            }
//        }
        for (Object object : jsonArray) {
            hdmDo = new DictHospitalDeptDO();
            net.sf.json.JSONObject jsonObjectBody = (net.sf.json.JSONObject) object;
@ -1433,17 +1436,19 @@ public class EntranceService {
            //是否为会诊科室
            String consultDeptFlag = null == jsonObjectBody.get("Consult_Dept_Flag") ? "" : jsonObjectBody.get("Consult_Dept_Flag").toString();
            if (StringUtils.isNotBlank(orgCodeMap.get(deptTypeCode))) {
                hdmDo.setOrgCode(orgCode);
                hdmDo.setCode(null == jsonObjectBody.get("Dept_Code") ? "" : jsonObjectBody.get("Dept_Code").toString());
                hdmDo.setName(null == jsonObjectBody.get("Dept_Name") ? "" : jsonObjectBody.get("Dept_Name").toString());
                hdmDo.setDeptTypeCode(deptTypeCode);
                hdmDo.setFatherDeptCode(null == jsonObjectBody.get("Father_Dept_Code") ? "" : jsonObjectBody.get("Father_Dept_Code").toString());
                hdmDo.setFatherDeptName(null == jsonObjectBody.get("Father_Dept_Name") ? "" : jsonObjectBody.get("Father_Dept_Name").toString());
                hdmDo.setCreateTime(new Date());
                hdmDo.setDeptType(null == jsonObjectBody.get("Dept_Type") ? "" : jsonObjectBody.get("Dept_Type").toString());
                hdmDo.setDeptPosition(null == jsonObjectBody.get("Dept_Position") ? "" : jsonObjectBody.get("Dept_Position").toString());
//                DictHospitalDeptDao.save(hdmDo);
                hospitalDeptMappingDOS.add(hdmDo);
                DictHospitalDeptDO hospitalDeptDO = dictHospitalDeptDao.findByCode(jsonObjectBody.get("Dept_Code").toString());
                if (hospitalDeptDO==null){
                    hdmDo.setOrgCode(orgCode);
                    hdmDo.setCode(null == jsonObjectBody.get("Dept_Code") ? "" : jsonObjectBody.get("Dept_Code").toString());
                    hdmDo.setName(null == jsonObjectBody.get("Dept_Name") ? "" : jsonObjectBody.get("Dept_Name").toString());
                    hdmDo.setDeptTypeCode(deptTypeCode);
                    hdmDo.setFatherDeptCode(null == jsonObjectBody.get("Father_Dept_Code") ? "" : jsonObjectBody.get("Father_Dept_Code").toString());
                    hdmDo.setFatherDeptName(null == jsonObjectBody.get("Father_Dept_Name") ? "" : jsonObjectBody.get("Father_Dept_Name").toString());
                    hdmDo.setCreateTime(new Date());
                    hdmDo.setDeptType(null == jsonObjectBody.get("Dept_Type") ? "" : jsonObjectBody.get("Dept_Type").toString());
                    hdmDo.setDeptPosition(null == jsonObjectBody.get("Dept_Position") ? "" : jsonObjectBody.get("Dept_Position").toString());
                    hospitalDeptMappingDOS.add(hdmDo);
                }
            }
        }

Різницю між файлами не показано, бо вона завелика
+ 136 - 71
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/util/SFUtils.java


+ 37 - 0
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -41,6 +41,7 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.QrcodeUtil;
import com.yihu.jw.util.common.XMLUtil;
@ -156,6 +157,8 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    private YlzMedicailRelationDao ylzMedicailRelationDao;
    @Autowired
    private HcyyPrescriptionService hcyyPrescriptionService;
    @Autowired
    private ZhongShanSMSService zhongShanSMSService;
    /**
@ -1662,6 +1665,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                    String url=baseUrl+"/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
                }else if(wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                    String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",outpatientDO.getDoctor(),title,msg,url);
@ -1729,6 +1733,21 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
               if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                   String url=baseUrl+"/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                   enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
                   BaseDoctorDO doctorDO = doctorDao.findById(outpatientDO.getDoctor());
                   if (doctorDO!=null){
                       if (StringUtils.isNoneBlank(doctorDO.getMobile())){
                           String content = doctorDO.getName()+"医生,患者"+outpatientDO.getPatientName()+"向您发起了图文问诊,请您及时打开企业微信,进入在线诊疗查看!";
                           int i= zhongShanSMSService.ZhongShangSendSMS(doctorDO.getMobile(),content);
                           WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
                           wlyyHttpLogDO.setDoctor(outpatientDO.getDoctor());
                           wlyyHttpLogDO.setRequest("");
                           wlyyHttpLogDO.setName(content);
                           wlyyHttpLogDO.setCode(outpatientDO.getId());
                           wlyyHttpLogDO.setCreateTime(new Date());
                           wlyyHttpLogDO.setResponse(i+"");
                           wlyyHttpLogDao.save(wlyyHttpLogDO);
                       }
                   }
               }else if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                   String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                   enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",outpatientDO.getDoctor(),title,msg,url);
@ -1819,6 +1838,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                        String url=baseUrl+"/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                        enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
                    }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
                        String url="https://ih.xmheart.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                        enterpriseService.sendTWMesByDoctor("xm_xzzx_wx",outpatientDO.getDoctor(),title,msg,url);
@ -1879,6 +1899,23 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    logger.info("进入无需支付zs"+relationCode+"=="+wxId);
                    String url=baseUrl+"/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
                    logger.info("进入短信发送====");
                    BaseDoctorDO doctorDO = doctorDao.findById(outpatientDO.getDoctor());
                    if (doctorDO!=null){
                        if (StringUtils.isNoneBlank(doctorDO.getMobile())){
                            String content = doctorDO.getName()+"医生,患者"+outpatientDO.getPatientName()+"向您发起了问诊,请您及时打开企业微信,进入在线诊疗查看!";
                            logger.info("进入短信发送开始===="+content);
                            int i= zhongShanSMSService.ZhongShangSendSMS(doctorDO.getMobile(),content);
                            WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
                            wlyyHttpLogDO.setDoctor(outpatientDO.getDoctor());
                            wlyyHttpLogDO.setRequest("");
                            wlyyHttpLogDO.setName(content);
                            wlyyHttpLogDO.setCode(outpatientDO.getId());
                            wlyyHttpLogDO.setCreateTime(new Date());
                            wlyyHttpLogDO.setResponse(i+"");
                            wlyyHttpLogDao.save(wlyyHttpLogDO);
                        }
                    }
                }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
                    String url="https://ih.xmheart.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    enterpriseService.sendTWMesByDoctor("xm_xzzx_wx",outpatientDO.getDoctor(),title,msg,url);

+ 1 - 1
business/sms-service/src/main/java/com/yihu/jw/sms/service/ZhongShanSMSService.java

@ -125,7 +125,7 @@ public class ZhongShanSMSService {
		params.add(new BasicNameValuePair("salt",salt));
		params.add(new BasicNameValuePair("sign",sign));
		String res = httpClientUtil.get(url,params,"GBK");
		System.out.println("res==="+res);
		System.out.println("短信发送res==="+res);
		if (StringUtils.isNoneBlank(res)){
			JSONObject object = JSONObject.parseObject(res);
			return object.getInteger("smsCode");

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionExpressageDO.java

@ -350,7 +350,7 @@ public class WlyyPrescriptionExpressageDO extends UuidIdentityEntity {
        this.bspOrderNo = bspOrderNo;
    }
    @Column(name = "type")
    @Column(name = "sf_type")
    public Integer getType() {
        return type;
    }

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyHisPrescriptionVO.java

@ -149,6 +149,16 @@ public class WlyyHisPrescriptionVO extends UuidIdentityVOWithOperator {
    private String sfybxm;
    private String bqbm;
    public String getBqbm() {
        return bqbm;
    }
    public void setBqbm(String bqbm) {
        this.bqbm = bqbm;
    }
    public String getSfybxm() {
        return sfybxm;
    }

+ 25 - 25
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/config/MultipartConfig.java

@ -1,7 +1,7 @@
package com.yihu.jw.gateway.config;
import com.yihu.jw.gateway.filter.CORSFilter;
import com.yihu.jw.gateway.filter.CsrfFilter;
//import com.yihu.jw.gateway.filter.CORSFilter;
//import com.yihu.jw.gateway.filter.CsrfFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
@ -18,10 +18,10 @@ import java.io.*;
@Configuration
public class MultipartConfig {
    @Autowired
    CsrfFilter csrfFilter;
    @Autowired
    private CORSFilter corsFilter;
//    @Autowired
//    CsrfFilter csrfFilter;
//    @Autowired
//    private CORSFilter corsFilter;
    @Value("${server.tomcat.basedir}")
    String tomcatLocation;
@ -38,24 +38,24 @@ public class MultipartConfig {
        return factory.createMultipartConfig();
    }
    @Bean
    public FilterRegistrationBean testFilterRegistration3() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(corsFilter);
        registration.addUrlPatterns("/*");
        registration.setName("corsFilter");
        registration.setOrder(-1);
        return registration;
    }
    @Bean
    public FilterRegistrationBean testFilterRegistration4() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(csrfFilter);
        registration.addUrlPatterns("/*");
        registration.setName("CsrfFilter");
        registration.setOrder(3);
        return registration;
    }
//    @Bean
//    public FilterRegistrationBean testFilterRegistration3() {
//        FilterRegistrationBean registration = new FilterRegistrationBean();
//        registration.setFilter(corsFilter);
//        registration.addUrlPatterns("/*");
//        registration.setName("corsFilter");
//        registration.setOrder(-1);
//        return registration;
//    }
//
//    @Bean
//    public FilterRegistrationBean testFilterRegistration4() {
//        FilterRegistrationBean registration = new FilterRegistrationBean();
//        registration.setFilter(csrfFilter);
//        registration.addUrlPatterns("/*");
//        registration.setName("CsrfFilter");
//        registration.setOrder(3);
//        return registration;
//    }
}

+ 35 - 10
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java

@ -131,6 +131,11 @@ public class BasicZuulFilter extends ZuulFilter {
            } catch (Exception e) {
                e.printStackTrace();
            }
//            //防止SQL注入过滤器
//            if(doSqlFilterCtx(ctx)){
//                logger.info("1111111111111111");
//                return this.forbidden(ctx, ResultStatus.ERROR_PARA, "Illegal parameter");
//            }
        }
        //保存操作日志
@ -171,9 +176,13 @@ public class BasicZuulFilter extends ZuulFilter {
                for(String str:object.keySet()){
                    List<String> arrayList = new ArrayList<>();
                    String value = object.getString(str);
              /*  if (sqlValidate(value)){
                    throw new Exception("Illegal parameter");
                }*/
                    if (!StringUtils.isEmpty(value)){
                        if (sqlValidate(value)){
                            logger.info("11111111111111111111"+value);
                            throw new Exception("Illegal parameter");
                        }
                    }
                    arrayList.add(value);
                    map.put(str,arrayList);
                }
@ -199,10 +208,10 @@ public class BasicZuulFilter extends ZuulFilter {
                JSONObject jsonObject = JSONObject.parseObject(jsonobject);
                for(String str:jsonObject.keySet()){
                    String value = jsonObject.getString(str);
                    /*if (sqlValidate(value)){
                        throw new Exception("Illegal parameter");
                    }*/
                    if (!StringUtils.isEmpty(value)){
                        if (sqlValidate(value)){
                            throw new Exception("Illegal parameter");
                        }
                        value = URLEncoder.encode(value);
                    }
                    body+=str+"="+ value+"&";
@ -362,6 +371,20 @@ public class BasicZuulFilter extends ZuulFilter {
        return new RedisTokenStore(jedisConnectionFactory);
    }
    public boolean doSqlFilterCtx(RequestContext ctx){
        Map<String, List<String>> map = ctx.getRequestQueryParams();
        String sql = "";
        if (map!=null&&map.size()!=0){
            for (Map.Entry<String,List<String>> entry:map.entrySet()) {
                sql = sql + entry.getValue();
            }
            if (sqlValidate(sql)) {
                return true;
            }
        }
        return false;
    }
    public boolean doSqlFilter(HttpServletRequest request){
        Enumeration params = request.getParameterNames();
        String sql = "";
@ -370,7 +393,10 @@ public class BasicZuulFilter extends ZuulFilter {
            String name = params.nextElement().toString();
            // 得到参数对应值
            String[] value = request.getParameterValues(name);
            System.out.println("入参"+JSONObject.toJSONString(value));
            System.out.println("11111111111"+name);
            for (int i = 0; i < value.length; i++) {
                sql = sql + value[i];
            }
            if (sqlValidate(sql)) {
@ -419,13 +445,12 @@ public class BasicZuulFilter extends ZuulFilter {
    private static boolean sqlValidate(String str) {
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(str)){
            str = str.toLowerCase();//统一转为小写,比较简单的单词加入右边空格,避免单词中包含字段
            String badStr = "and |exec |execute |insert |select |delete |update |drop |chr |mid |master |truncate |" +
                    "declare | sitename |net user|xp_cmdshell|or |exec |execute |create |" +
                    "table |from |grant |use |group_concat|column_name|" +
                    "information_schema.columns|table_schema|union |where |select |update |order |by |like |" ;//过滤掉的sql关键字,可以手动添加
            String badStr = "exec|execute|insert|select|delete|update|drop|chr"+
                    "information_schema.columns|table_schema|union|where|order|like|" ;//过滤掉的sql关键字,可以手动添加
            String[] badStrs = badStr.split("\\|");
            for (int i = 0; i < badStrs.length; i++) {
                if (str.indexOf(badStrs[i]) >= 0) {
                    logger.info("2222222222222222222"+badStrs[i]);
                    return true;
                }
            }

+ 58 - 58
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/CORSFilter.java

@ -1,58 +1,58 @@
package com.yihu.jw.gateway.filter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
 * Created by yeshijie on 2024/3/26.
 */
//@Order(-1)
//@WebFilter(filterName = "corsFilter", urlPatterns = {"/*"}) 注解的jar启动不生效要tomcat
@Component
public class CORSFilter implements Filter {
    private Logger logger = LoggerFactory.getLogger(CORSFilter.class);
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
    }
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletResponse response = (HttpServletResponse) servletResponse;
        HttpServletRequest request = (HttpServletRequest) servletRequest;
        logger.info(">>>>>>>>>>>>>>>>>来了》》》》》》》》》》》》》》》》"+request.getHeader("Origin"));
        //https://yyfbxt.szhz.hangzhou.gov.cn:8068/web/mgop/gov-open/zj/2002347641/reserved/index.html
//        response.setHeader("Access-Control-Allow-Origin", "https://yyfbxt.szhz.hangzhou.gov.cn:8068");
//        response.setHeader("Access-Control-Allow-Origin", "*");
//        response.setHeader("Access-Control-Allow-Headers", "access-control-allow-origin, authority, content-type, version-info, X-Requested-With");
        response.setHeader("Access-Control-Allow-Headers", "*");
//        response.setHeader("Access-Control-Expose-Headers", "*");
        response.setHeader("Access-Control-Allow-Methods", "*");
        response.setHeader("Access-Control-Max-Age", "3600");
        if(request.getRequestURI().contains("dump")){
            response.setStatus(HttpServletResponse.SC_FORBIDDEN);
            logger.info("SC_FORBIDDEN=======================");
            return;
        }
        //response.setHeader("Access-Control-Allow-Credentials", "true");
        if ("OPTIONS".equals(request.getMethod())) {
            response.setStatus(HttpServletResponse.SC_OK);
            logger.info("OPTIONS=======================");
            return;
        }
        filterChain.doFilter(request, response);
    }
    @Override
    public void destroy() {
    }
}
//package com.yihu.jw.gateway.filter;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.*;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
///**
// * Created by yeshijie on 2024/3/26.
// */
////@Order(-1)
////@WebFilter(filterName = "corsFilter", urlPatterns = {"/*"}) 注解的jar启动不生效要tomcat
//@Component
//public class CORSFilter implements Filter {
//
//    private Logger logger = LoggerFactory.getLogger(CORSFilter.class);
//
//    @Override
//    public void init(FilterConfig filterConfig) throws ServletException {
//
//    }
//
//    @Override
//    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//        HttpServletResponse response = (HttpServletResponse) servletResponse;
//        HttpServletRequest request = (HttpServletRequest) servletRequest;
//        logger.info(">>>>>>>>>>>>>>>>>来了》》》》》》》》》》》》》》》》"+request.getHeader("Origin"));
//        //https://yyfbxt.szhz.hangzhou.gov.cn:8068/web/mgop/gov-open/zj/2002347641/reserved/index.html
////        response.setHeader("Access-Control-Allow-Origin", "https://yyfbxt.szhz.hangzhou.gov.cn:8068");
////        response.setHeader("Access-Control-Allow-Origin", "*");
////        response.setHeader("Access-Control-Allow-Headers", "access-control-allow-origin, authority, content-type, version-info, X-Requested-With");
//        response.setHeader("Access-Control-Allow-Headers", "*");
////        response.setHeader("Access-Control-Expose-Headers", "*");
//        response.setHeader("Access-Control-Allow-Methods", "*");
//        response.setHeader("Access-Control-Max-Age", "3600");
//        if(request.getRequestURI().contains("dump")){
//            response.setStatus(HttpServletResponse.SC_FORBIDDEN);
//            logger.info("SC_FORBIDDEN=======================");
//            return;
//        }
//        //response.setHeader("Access-Control-Allow-Credentials", "true");
//        if ("OPTIONS".equals(request.getMethod())) {
//            response.setStatus(HttpServletResponse.SC_OK);
//            logger.info("OPTIONS=======================");
//            return;
//        }
//        filterChain.doFilter(request, response);
//    }
//
//    @Override
//    public void destroy() {
//
//    }
//}

+ 122 - 122
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/CsrfFilter.java

@ -1,122 +1,122 @@
package com.yihu.jw.gateway.filter;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
 * Created by yeshijie on 2022/3/15.
 */
@Component
public class CsrfFilter implements Filter {
    @Autowired
    private StringRedisTemplate redisTemplate;
    private Logger log = LoggerFactory.getLogger(CsrfFilter.class);
    /**
     * 过滤器配置对象
     */
    FilterConfig filterConfig = null;
    private boolean getEnable(){
        String strEnable = redisTemplate.opsForValue().get("security:csrf:enable");
        if(StringUtils.isNotBlank(strEnable)){
            return "1".equals(strEnable);
        }
        redisTemplate.opsForValue().set("security:csrf:enable","0");
        return false;
    }
    /**
     * 忽略的URL
     */
    private List<String> excludes = new ArrayList<>();
    public void setExcludes(List<String> excludes) {
        this.excludes = excludes;
    }
    /**
     * 初始化
     */
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        this.filterConfig = filterConfig;
    }
    /**
     * 拦截
     */
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
            throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest) servletRequest;
        HttpServletResponse response = (HttpServletResponse) servletResponse;
        String referer = request.getHeader("Referer");
        String host = request.getServerName();
        // 不启用或者已忽略的URL不拦截
        if(!getEnable() ||referer == null||referer.indexOf("http://ehr.yihu.com")==0
                ||referer.indexOf("https://zhyzh.gongshu.gov.cn")==0
                ||referer.indexOf("https://yyfbxt.szhz.hangzhou.gov.cn")==0
                ||referer.indexOf("27.154.233.186")>0
                ||referer.indexOf(host)>0){
            filterChain.doFilter(servletRequest, servletResponse);
            return;
        }
        java.net.URL url = null;
        try {
            url = new java.net.URL(referer);
        } catch (MalformedURLException e) {
            // URL解析异常,也置为404
            response.setStatus(HttpServletResponse.SC_NOT_FOUND);
            return;
        }
        // 判断是否存在外链请求本站
        if (!host.equals(url.getHost())) {
            log.error("CSRF过滤器 => 服务器:{} => 当前域名:{}", host, referer);
            servletResponse.setContentType("text/html; charset=utf-8");
            servletResponse.getWriter().write("系统不支持当前域名的访问!");
        } else {
            filterChain.doFilter(servletRequest, servletResponse);
        }
    }
    /**
     * 销毁
     */
    @Override
    public void destroy() {
        this.filterConfig = null;
    }
    /**
     * 判断是否为忽略的URL
     *
     * @param url URL路径
     * @return true-忽略,false-过滤
     */
    private boolean isExcludeUrl(String url) {
        if (excludes == null || excludes.isEmpty()) {
            return false;
        }
        return excludes.stream().map(pattern -> Pattern.compile("^" + pattern)).map(p -> p.matcher(url))
                .anyMatch(Matcher::find);
    }
}
//package com.yihu.jw.gateway.filter;
//
//import org.apache.commons.lang3.StringUtils;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.core.StringRedisTemplate;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.*;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.net.MalformedURLException;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.regex.Matcher;
//import java.util.regex.Pattern;
//
///**
// * Created by yeshijie on 2022/3/15.
// */
//@Component
//public class CsrfFilter implements Filter {
//
//    @Autowired
//    private StringRedisTemplate redisTemplate;
//
//    private Logger log = LoggerFactory.getLogger(CsrfFilter.class);
//    /**
//     * 过滤器配置对象
//     */
//    FilterConfig filterConfig = null;
//
//    private boolean getEnable(){
//        String strEnable = redisTemplate.opsForValue().get("security:csrf:enable");
//        if(StringUtils.isNotBlank(strEnable)){
//            return "1".equals(strEnable);
//        }
//        redisTemplate.opsForValue().set("security:csrf:enable","0");
//        return false;
//    }
//
//    /**
//     * 忽略的URL
//     */
//    private List<String> excludes = new ArrayList<>();
//
//    public void setExcludes(List<String> excludes) {
//        this.excludes = excludes;
//    }
//
//    /**
//     * 初始化
//     */
//    @Override
//    public void init(FilterConfig filterConfig) throws ServletException {
//        this.filterConfig = filterConfig;
//    }
//
//    /**
//     * 拦截
//     */
//    @Override
//    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
//            throws IOException, ServletException {
//        HttpServletRequest request = (HttpServletRequest) servletRequest;
//        HttpServletResponse response = (HttpServletResponse) servletResponse;
//
//        String referer = request.getHeader("Referer");
//        String host = request.getServerName();
//        // 不启用或者已忽略的URL不拦截
//        if(!getEnable() ||referer == null||referer.indexOf("http://ehr.yihu.com")==0
//                ||referer.indexOf("https://zhyzh.gongshu.gov.cn")==0
//                ||referer.indexOf("https://yyfbxt.szhz.hangzhou.gov.cn")==0
//                ||referer.indexOf("27.154.233.186")>0
//                ||referer.indexOf(host)>0){
//            filterChain.doFilter(servletRequest, servletResponse);
//            return;
//        }
//
//        java.net.URL url = null;
//        try {
//            url = new java.net.URL(referer);
//        } catch (MalformedURLException e) {
//            // URL解析异常,也置为404
//            response.setStatus(HttpServletResponse.SC_NOT_FOUND);
//            return;
//        }
//
//        // 判断是否存在外链请求本站
//        if (!host.equals(url.getHost())) {
//            log.error("CSRF过滤器 => 服务器:{} => 当前域名:{}", host, referer);
//            servletResponse.setContentType("text/html; charset=utf-8");
//            servletResponse.getWriter().write("系统不支持当前域名的访问!");
//        } else {
//            filterChain.doFilter(servletRequest, servletResponse);
//        }
//    }
//
//    /**
//     * 销毁
//     */
//    @Override
//    public void destroy() {
//        this.filterConfig = null;
//    }
//
//    /**
//     * 判断是否为忽略的URL
//     *
//     * @param url URL路径
//     * @return true-忽略,false-过滤
//     */
//    private boolean isExcludeUrl(String url) {
//        if (excludes == null || excludes.isEmpty()) {
//            return false;
//        }
//        return excludes.stream().map(pattern -> Pattern.compile("^" + pattern)).map(p -> p.matcher(url))
//                .anyMatch(Matcher::find);
//    }
//}

+ 3 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/PostFilter.java

@ -138,6 +138,9 @@ public class PostFilter extends ZuulFilter {
            url.contains("/open/noLogin/ylzReceiveNotify")||
            url.contains("/open/noLogin/receiveNotify")||
            url.contains("/open/noLogin/getSFExpressInfoNew")||
            url.contains("/open/noLogin/updateOrderStatus")||
            url.contains("/open/noLogin/sfOrderComplete")||
            url.contains("/open/noLogin/sfOrderCancel")||
            url.contains("/open/noLogin/sfroutepushservice")||
            url.contains("/open/noLogin/ylzSettleRecord")||
                url.contains("/weixin")||url.contains("/oauth/getSsoPublicKey")||

+ 2 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/third/PrescriptionUpdateController.java

@ -185,4 +185,6 @@ public class PrescriptionUpdateController extends EnvelopRestEndpoint {
            return ObjEnvelop.getError("获取面单信息失败,"+e.getMessage());
        }
    }
}

+ 11 - 5
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/RemindDoctorService.java

@ -8,9 +8,11 @@ import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.util.RemindDoctorJob;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
@ -47,6 +49,10 @@ public class RemindDoctorService {
    private PrescriptionService prescriptionService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private ZhongShanSMSService zhongShanSMSService;
    @Autowired
    private WlyyHttpLogDao wlyyHttpLogDao;
@ -135,15 +141,15 @@ public class RemindDoctorService {
                        String url=baseUrl+"/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+wlyyOutpatientDO.getDescription()+"&type=3&id="+wlyyOutpatientDO.getId();
                        enterpriseService.sendTWMesByDoctor("zsyy",wlyyOutpatientDO.getDoctor(),title,msg,url);
                        /*int i= zhongShanSMSService.ZhongShangSendSMS(doctorDO.getMobile(),msg);
                        zhongShanSMSService.ZhongShangSendSMS(doctorDO.getMobile(),msg);
                        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
                        wlyyHttpLogDO.setDoctor(outpatient.getDoctor());
                        wlyyHttpLogDO.setDoctor(wlyyOutpatientDO.getDoctor());
                        wlyyHttpLogDO.setRequest("");
                        wlyyHttpLogDO.setName(content);
                        wlyyHttpLogDO.setCode(outpatient.getId());
                        wlyyHttpLogDO.setName(msg);
                        wlyyHttpLogDO.setCode(wlyyOutpatientDO.getId());
                        wlyyHttpLogDO.setCreateTime(new Date());
                        wlyyHttpLogDO.setResponse(i+"");
                        wlyyHttpLogDao.save(wlyyHttpLogDO);*/
                        wlyyHttpLogDao.save(wlyyHttpLogDO);
                    }else if(wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                        String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+wlyyOutpatientDO.getDescription()+"&type=3&id="+wlyyOutpatientDO.getId();
                        enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",wlyyOutpatientDO.getDoctor(),title,msg,url);

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

@ -265,6 +265,40 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
     * 获取微信小程序openid
     *
     * @param code
     * @return
     */
    @RequestMapping(value = "/getXOpenidByCode", method = {RequestMethod.POST, RequestMethod.GET})
    public Envelop getXOpenidByCode(String code){
        try {
            //通过redis获取openid, 获取不到,则调用微信接口去取
            String key = wxId+":code";
            String openid = redisTemplate.opsForValue().get(key);
            if(!org.apache.commons.lang3.StringUtils.isEmpty(openid)){
                return success(PatientRequestMapping.Wechat.api_success,openid);
            }
            org.json.JSONObject json = wechatInfoService.getXOpenidByCode(code, wxId);
            if(json.has("openid")){
                openid = json.getString("openid");
                JSONObject res = new JSONObject();
                res.put("openid",openid);
                res.put("unionid",json.getString("unionid"));
                res.put("session_key",json.getString("session_key"));
                redisTemplate.opsForValue().set(key,openid);
                redisTemplate.expire(key,10, TimeUnit.SECONDS);
                return success(PatientRequestMapping.Wechat.api_success,res);
            }else {
                return Envelop.getError("获取失败");
            }
        } catch (Exception e){
            return  failedException2(e);
        }
    }
    @GetMapping(value = "findHospitalByZJ")
    @ApiOperation(value = "查找有专家问诊排班的医院", notes = "查找有专家问诊排班的医院")
    public MixEnvelop findHospitalByZJ(@ApiParam(name = "iswork", value = "是否过滤排班,1是")
@ -3076,4 +3110,36 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            return failedObjEnvelopException(e);
        }
    }
    @RequestMapping(value="/updateOrderStatus",method = RequestMethod.POST)
    @ApiOperation("配送状态更改回调")
    public JSONObject updateOrderStatus(@RequestBody String param){
        logger.info("配送状态更改回调,WaybillRoute="+param);
        JSONObject object = new JSONObject();
        prescriptionService.routeInfo(param,1);
        object.put("error_code",0);
        object.put("error_msg","success");
        return object;
    }
    @RequestMapping(value="/sfOrderCancel",method = RequestMethod.POST)
    @ApiOperation("顺丰原因订单取消回调")
    public JSONObject sfOrderCancel(@RequestBody String param){
        logger.info("顺丰原因订单取消回调,WaybillRoute="+param);
        JSONObject object = new JSONObject();
        prescriptionService.routeInfo(param,2);
        object.put("error_code",0);
        object.put("error_msg","success");
        return object;
    }
    @RequestMapping(value="/sfOrderComplete",method = RequestMethod.POST)
    @ApiOperation("订单完成")
    public JSONObject sfOrderComplete(@RequestBody String param){
        logger.info("订单完成,WaybillRoute="+param);
        JSONObject object = new JSONObject();
        prescriptionService.routeInfo(param,3);
        object.put("error_code",0);
        object.put("error_msg","success");
        return object;
    }
}

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

@ -171,6 +171,16 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private SFUtils sfUtils;
    @GetMapping(value = "selectTime")
    @ApiOperation(value = "查询是否符合时间内的同城配送标识")
    public ObjEnvelop selectTime() {
        try {
            return ObjEnvelop.getSuccess("success",prescriptionService.selectTime());
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = "updateExpressInfo")
    @ApiOperation(value = "更新配送方式")
    public ObjEnvelop updateExpressInfo(@ApiParam(name = "realOrder", value = "处方号")
@ -197,9 +207,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = "precreateorder")
    @ApiOperation(value = "顺丰同城配送-预创建订单(店铺)")
    public ObjEnvelop precreateorder(@ApiParam(name = "realOrder", value = "处方号")
                                    @RequestParam(value = "realOrder", required = true) String realOrder) {
                                    @RequestParam(value = "realOrder", required = true) String realOrder,
                                     @ApiParam(name = "json", value = "物流信息")
                                     @RequestParam(value = "json", required = true) String json) {
        try {
            return ObjEnvelop.getSuccess("success",sfUtils.precreateorder(realOrder));
            WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(json, WlyyPrescriptionExpressageDO.class);
            return ObjEnvelop.getSuccess("success",sfUtils.precreateorder(realOrder,expressageDO));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
@ -216,7 +229,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "Sflistorderfeed")
    @PostMapping(value = "sflistorderfeed")
    @ApiOperation(value = "顺丰同城配送-订单状态流查询")
    public ObjEnvelop listorderfeed(@ApiParam(name = "realOrder", value = "处方号")
                                  @RequestParam(value = "realOrder", required = true) String realOrder) {
@ -867,10 +880,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @ApiParam(name = "page", value = "第几页,1开始")
                                         @RequestParam(value = "page", required = false) Integer page,
                                         @ApiParam(name = "size", value = "每页大小")
                                         @RequestParam(value = "size", required = false) Integer size) {
                                         @RequestParam(value = "size", required = false) Integer size,
                                         @ApiParam(name = "type", value = "配送类型1普通快递2同城快递")
                                             @RequestParam(value = "type", required = false) Integer type) {
        try {
            return prescriptionService.findExpressageList(status, oneselfPickupFlg, nameKey, startTime, endTime, page, size, wxId, patientName);
            return prescriptionService.findExpressageList(status, oneselfPickupFlg, nameKey, startTime, endTime, page, size, wxId, patientName,type);
        } catch (Exception e) {
            return failedMixEnvelopException(e);
        }