ソースを参照

Merge branch 'dev' of wangjun/wlyy2.0 into dev

wangzhinan 4 年 前
コミット
adf834b4a1

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

@ -1,11 +1,11 @@
package com.yihu.jw.hospital.prescription.service;
import cn.jiguang.common.ClientConfig;
import cn.jiguang.common.resp.APIConnectionException;
import cn.jiguang.common.resp.APIRequestException;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.PushResult;
import cn.jpush.api.push.model.Message;
import cn.jpush.api.push.model.Platform;
import cn.jpush.api.push.model.PushPayload;
import cn.jpush.api.push.model.audience.Audience;
@ -2635,19 +2635,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        } else {
                            ykyyService.updateDrugorderInfo(businessOrderDO.getOrderNo(), wlyyPrescriptionDO.getOrderId(), wlyyPrescriptionDO.getRealOrder());
                        }
                        ykyySMSService.sendSmsByTempcode("prescription_remind", outpatientDO, wlyyPrescriptionDO, "");
                        List<WlyyPrescriptionInfoDO> list = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                        if (list!=null&&list.size()>0){
                            ykyySMSService.sendSmsByTempcode("prescription_remind", outpatientDO, wlyyPrescriptionDO, "");
                        }
                    }
                }
                if (StringUtils.isNotBlank(inspectionJson)) {
                    if (StringUtils.isNotBlank(infoJsons)) {
                        List<WlyyPrescriptionInfoDO> infoDOs = (List<WlyyPrescriptionInfoDO>) com.alibaba.fastjson.JSONArray.parseArray(infoJsons, WlyyPrescriptionInfoDO.class);
                        if (infoDOs != null && infoDOs.size() > 0) {
                if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                    if (StringUtils.isNotBlank(inspectionJson)) {
                        if (StringUtils.isNotBlank(infoJsons)) {
                            List<WlyyPrescriptionInfoDO> infoDOs = (List<WlyyPrescriptionInfoDO>) com.alibaba.fastjson.JSONArray.parseArray(infoJsons, WlyyPrescriptionInfoDO.class);
                            if (infoDOs != null && infoDOs.size() > 0) {
                            } else {
                                prescription.setStatus(20);
                            }
                        } else {
                            prescription.setStatus(20);
                            sendWxTemplateMsg(wechatId, outpatientDO.getId(), null, "", "prescriptionPayRemind", prescription.getId());
                        }
                    } else {
                        prescription.setStatus(20);
                    }
                }
                prescriptionDao.save(prescription);
@ -4417,7 +4424,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("眼科微信消息模板推送 医生拒诊开始");
                logger.info("极光消息推送 医生拒诊开始");
                //wxTempalteJPush("cancel_remind",outpatientDO,null,"","","","");
                wxTempalteJPush("cancel_remind",outpatientDO,null,"","","","");
                /*String res = wxTempalteJPush(outpatientDO.getConsumer(),newConfig.getFirst(),"医生拒绝了你的问诊",type,outpatientDO.getId());
                logger.info("JPUSH res==="+res);*/
            }else if("outPatientTimeOutRemind".equals(titelType)){
@ -4454,7 +4461,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("眼科微信消息模板推送 就诊支付提醒开始");
                logger.info("极光消息推送 就诊支付提醒开始");
                //wxTempalteJPush("outpatient_pay",outpatientDO,null,"","","","");
                wxTempalteJPush("outpatient_pay",outpatientDO,null,"","","","");
            } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
                //处方开具支付提醒
                scene = "cfzfts";
@ -4468,7 +4475,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("眼科微信消息模板推送 处方支付提醒开始");
                logger.info("极光消息推送 医生拒诊开始");
                //wxTempalteJPush("prescription_pay",outpatientDO,null,"","","","");
                wxTempalteJPush("prescription_pay",outpatientDO,null,"","","",remindMsg);
            }else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
                //视频问诊预约提醒
                scene = "spwzyytx";
@ -4499,7 +4506,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
                logger.info("极光消息推送 医生拒诊开始");
                //wxTempalteJPush("give_score",outpatientDO,consultTeam,"","","","");
                wxTempalteJPush("give_score",outpatientDO,consultTeam,"","","","");
                logger.info("眼科微信消息模板推送 服务评价提醒开始");
            } else if ("systemCancelRemind".equalsIgnoreCase(titelType)) {
                //系统24小时取消复诊提醒
@ -4696,7 +4703,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                wxPushLogDao.save(wxPushLogDO);
            }
            //发送极光消息推送
           // wxTempalteJPush("logistics_remind",wlyyOutpatientDO,null,drugName,mailNo,remindMsg,prescriptionId);
           wxTempalteJPush("logistics_remind",wlyyOutpatientDO,null,drugName,mailNo,remindMsg,prescriptionId);
        }else {
            first = "您好,您的处方订单物流"+remindMsg;
            contentMsg = "患者"+patienName+"的处方药品订单,"+drugName+"等,当前"+remindMsg+"。物流方:「顺丰快递」,物流单号:"+mailNo+"。";
@ -8523,7 +8530,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                List<WlyyPrescriptionInfoDO> list = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                if (list!=null&&list.size()>0){
                    wlyyPrescriptionDO.setStatus(10);
                }else {
                    if(inspectionDOS!=null&&inspectionDOS.size()>0){
                        wlyyPrescriptionDO.setStatus(20);
                    }
@ -9370,12 +9377,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        for (WlyyPrescriptionVO singlePre:list){
            List<WlyyPrescriptionInfoDO> infoDOs = prescriptionInfoDao.findByPrescriptionId(singlePre.getId(),1);
            logger.info("singlePreId===="+singlePre.getId());
            logger.info("infoDOs"+infoDOs);
            List<WlyyPrescriptionInfoVO> infoVOS = new ArrayList<>();
            BeanUtils.copyProperties(infoDOs,infoVOS);
            convertToModels(infoDOs, infoVOS, WlyyPrescriptionInfoVO.class);
            logger.info("infoVOS"+infoVOS);
            singlePre.setInfoVOs(infoVOS);
            List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(singlePre.getId(),1);
            List<WlyyInspectionVO> inspectionVOS = new ArrayList<>();
            BeanUtils.copyProperties(inspectionDOS,inspectionVOS);
            convertToModels(inspectionDOS, inspectionVOS, WlyyInspectionVO.class);
            //BeanUtils.copyProperties(inspectionDOS,inspectionVOS);
            singlePre.setInspectionVOs(inspectionVOS);
        }
//        List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
@ -11480,16 +11491,25 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param extras 扩展参数 {"type","","id":""}
     * @return
     */
    public String jPushMessage(String userId, String alert, String title, com.alibaba.fastjson.JSONObject extras){
    public String jPushMessage(String isDoctor,String userId, String alert, String title, com.alibaba.fastjson.JSONObject extras){
        List<WlyyHospitalSysDictDO> hospitalSysDictDOList = hospitalSysDictDao.findByDictName("JPUSH");
        String appKey = null;
        String masterSecret =null;
        for (WlyyHospitalSysDictDO hospitalSysDictDO:hospitalSysDictDOList){
            if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("appKey")){
                appKey=hospitalSysDictDO.getDictValue();
            }
            if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("masterSecret")){
                masterSecret = hospitalSysDictDO.getDictValue();
            if ("1".equalsIgnoreCase(isDoctor)){
                if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("appKey")){
                    appKey=hospitalSysDictDO.getDictValue();
                }
                if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("masterSecret")){
                    masterSecret = hospitalSysDictDO.getDictValue();
                }
            }else {
                if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("appKeyPatient")){
                    appKey=hospitalSysDictDO.getDictValue();
                }
                if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("masterSecretPatient")){
                    masterSecret = hospitalSysDictDO.getDictValue();
                }
            }
        }
        logger.info("appKey"+appKey+"======"+"masterSecret"+masterSecret);
@ -11506,6 +11526,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                                .setSound("default")
                                .addExtra("type", extras.getString("type"))
                                .addExtra("id", extras.getString("id"))
                                .addExtra("outpatientId", extras.getString("outpatientId"))
                                .addExtra("consultType", extras.getString("consultType"))
                                .addExtra("patientName", extras.getString("patientName"))
                                .setBadge(1)
                                .build())
                        .addPlatformNotification(AndroidNotification.newBuilder()
@ -11513,12 +11536,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                                .setTitle(title)
                                .setBuilderId(1)
                                .addExtra("type", extras.getString("type"))
                                .addExtra("outpatientId", extras.getString("outpatientId"))
                                .addExtra("id", extras.getString("id"))
                                .addExtra("consultType", extras.getString("consultType"))
                                .addExtra("patientName", extras.getString("patientName"))
                                .build())
                        .build())
                .build();
        try {
            PushResult result = jPushClient.sendPush(payload);
            logger.info("极光推送返回日志==="+result);
            WlyyHttpLogDO httpLogDO = new WlyyHttpLogDO();
            httpLogDO.setCode("JPUSH");
            httpLogDO.setCreateTime(new Date());
            /*httpLogDO.setRequest(jsonObject.toJSONString());
            httpLogDO.setResponse(result);*/
            wlyyHttpLogDao.save(httpLogDO);
            logger.info("Got result - " + result);
        } catch (APIConnectionException e) {
            // Connection error, should retry later
@ -11530,13 +11563,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            logger.info("Error Code: " + e.getErrorCode());
            logger.info("Error Message: " + e.getErrorMessage());
        }
        /*logger.info("极光推送返回日志==="+response);*/
       /* WlyyHttpLogDO httpLogDO = new WlyyHttpLogDO();
        httpLogDO.setCode("JPUSH");
        httpLogDO.setCreateTime(new Date());
        httpLogDO.setRequest(jsonObject.toJSONString());
        httpLogDO.setResponse(response);
        wlyyHttpLogDao.save(httpLogDO);*/
        return null;
@ -11545,6 +11572,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String userId = "";
        String content = "";
        String title="";
        String isDoctor="0";//0患者 1医生
        com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
        if("give_score".equalsIgnoreCase(templateCode)){
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
@ -11586,6 +11614,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            userId = wlyyOutpatientDO.getConsumer();
            jsonObject.put("type",31);
            jsonObject.put("id",wlyyOutpatientDO.getId());
            isDoctor="1";
        } else if("prescription_pay".equalsIgnoreCase(templateCode)){
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
            if(baseJpushTemplateDO!=null){
@ -11595,28 +11624,35 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
            userId = wlyyOutpatientDO.getConsumer();
            jsonObject.put("type",6);
            jsonObject.put("id",wlyyOutpatientDO.getId());
            jsonObject.put("id",prescriptionId);
            jsonObject.put("outpatientId",wlyyOutpatientDO.getId());
        } else if("outpatient_pay".equalsIgnoreCase(templateCode)){
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
            if(baseJpushTemplateDO!=null){
                if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文复诊");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文复诊");
                    jsonObject.put("consultType",9);
                }else if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频复诊");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频复诊");
                    jsonObject.put("consultType",16);
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文咨询");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文咨询");
                    jsonObject.put("consultType",1);
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频咨询");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频咨询");
                    jsonObject.put("consultType",17);
                }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","协同复诊");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","协同复诊");
                    jsonObject.put("consultType",12);
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","家医咨询");
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","家医咨询");
                    jsonObject.put("consultType",15);
                }
            }
            userId = wlyyOutpatientDO.getConsumer();
@ -11655,32 +11691,39 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文复诊").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文复诊");
                    jsonObject.put("type",1);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频复诊").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                    content+= "视频复诊预约时间为:"+wlyyOutpatientDO.getRegisterDate();
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频复诊");
                    jsonObject.put("type",2);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文咨询").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文咨询");
                    jsonObject.put("type",18);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频咨询").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频咨询");
                    content+= "视频咨询预约时间为:"+wlyyOutpatientDO.getRegisterDate();
                    jsonObject.put("type",17);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","协同复诊").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","协同复诊");
                    jsonObject.put("type",3);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","家医咨询").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","家医咨询");
                    jsonObject.put("type",15);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }
            }
            userId = wlyyOutpatientDO.getDoctor();
            jsonObject.put("id",wlyyOutpatientDO.getId());
            isDoctor="1";
        } else if("prescription_refuse".equalsIgnoreCase(templateCode)){
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
            if(baseJpushTemplateDO!=null){
@ -11691,6 +11734,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            userId = wlyyOutpatientDO.getConsumer();
            jsonObject.put("type",8);
            jsonObject.put("id",prescriptionId);
            isDoctor="1";
        } else if("logistics_remind".equalsIgnoreCase(templateCode)){
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
            if(baseJpushTemplateDO!=null){
@ -11702,8 +11746,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            userId = wlyyOutpatientDO.getConsumer();
            jsonObject.put("type",32);
            jsonObject.put("id",prescriptionId);
            jsonObject.put("outpatientId",wlyyOutpatientDO.getId());
        }
        return jPushMessage(userId,content,title,jsonObject);
        return jPushMessage(isDoctor,userId,content,title,jsonObject);
    }
}

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

@ -881,7 +881,12 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
                    openId = patientWechatDo.get(0).getOpenid();
                }
            }
            if (businessOrderDO.getOrderNo()!=null&&businessOrderDO.getOrderNo().contains("HLWYYQD")){
                businessOrderDO.setOrderNo("HLWYYQD"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            }else {
                businessOrderDO.setOrderNo("HLWYY"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            }
            businessOrderDO= businessOrderDao.save(businessOrderDO);
            String url = wxWechatDO.getBaseUrl();
            String notifyUrl =url;
            String totalFee =businessOrderDO.getPayPrice().intValue()+"";

+ 9 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java

@ -514,10 +514,17 @@ public class YkyyEntranceService {
                    String fyhj = object.getString("fyhj");//金额
                    String jzxh = object.getString("jzxh");//就诊序号
                    String zxks = object.getString("zxks");//执行科室
                    String yqdm = object.getString("yqdm");//执行科室
                    WlyyInspectionVO wlyyInspectionVO = new WlyyInspectionVO();
                    wlyyInspectionVO.setName(fymc);
                    wlyyInspectionVO.setDeptName(zxks);
                    wlyyInspectionVO.setDept(ksdm1);
                    wlyyInspectionVO.setOrgCode(yqdm);
                    if ("1001".equalsIgnoreCase(yqdm)){
                        wlyyInspectionVO.setOrgName("思北院区");
                    }else {
                        wlyyInspectionVO.setOrgName("五缘院区");
                    }
                    wlyyInspectionVO.setQuantity(Integer.parseInt(fysl));
                    inspectionVOList.add(wlyyInspectionVO);
                }
@ -655,9 +662,10 @@ public class YkyyEntranceService {
                "\tz.YBLB AS \"yblb\",\n" +
                "\tz.JZXH AS \"jzxh\",\n" +
                "\tz.YJXH AS \"yjxh\",\n" +
                "\tto_char(h.YQDM) AS \"yqdm\",\n" +
                "\tz.ZXKS AS \"zxks\"\n" +
                "FROM\n" +
                "\tV_ZKSG_JCCX z\n" +
                "\tV_ZKSG_JCCX z left join V_HLW_KSXX h on z.ksdm = h.code\n" +
                "WHERE\n" +
                "\tz.JZXH = '"+conNo+"'\n" +
                "AND z.brid = '"+brid+"'";

+ 83 - 3
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -34,6 +34,7 @@ import com.yihu.jw.order.dao.ConsultOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.QrcodeUtil;
@ -43,6 +44,7 @@ import com.yihu.jw.util.wechat.WeiXinPayUtils;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.ByteToInputStream;
import com.yihu.jw.utils.YkyySMSService;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxPayLogDao;
@ -136,6 +138,8 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    private YkyySMSService ykyySMSService;
    @Autowired
    private WlyyInspectionDao inspectionDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    /**
@ -879,14 +883,14 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                        wlyyOutpatientDO.setPayStatus(1);
                        outpatientDao.save(wlyyOutpatientDO);
                        //prescriptionService.wxTempalteJPush("outpatient_remind",wlyyOutpatientDO,null,"","","","");
                        prescriptionService.wxTempalteJPush("outpatient_remind",wlyyOutpatientDO,null,"","","","");
                    }
                }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")||businessOrderDO.getOrderCategory().equalsIgnoreCase("3")){
                    WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                    wlyyOutpatientDO.setPayStatus(1);
                    outpatientDao.save(wlyyOutpatientDO);
                    //prescriptionService.wxTempalteJPush("outpatient_remind",wlyyOutpatientDO,null,"","","","");
                    prescriptionService.wxTempalteJPush("outpatient_remind",wlyyOutpatientDO,null,"","","","");
                    if (StringUtils.isNoneBlank(wlyyOutpatientDO.getDoctor())){
                        BaseDoctorDO baseDoctorDO= doctorDao.findById(wlyyOutpatientDO.getDoctor());
                        if (baseDoctorDO!=null){
@ -1767,7 +1771,83 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        }
    }
    public MixEnvelop findYktCardCharge(String startTime, String endTime, String orderNo, String yktOrderNo, String patientName
                                                    , String idCard, String medicard , Integer status, Integer page, Integer pageSize){
        String sql = " select t.id as \"id\"," +
                " t.patient as \"patient\","+
                " t.patient_name as \"patientName\","+
                " t.order_no as \"orderNo\","+
                " t.order_type as \"orderType\","+
                " t.relation_code as \"relationCode\","+
                " t.relation_name as \"relationName\","+
                " t.description as \"description\","+
                " t.pay_type as \"payType\","+
                " t.pay_price as \"payPrice\","+
                " t.status as \"status\","+
                " t.pay_time as \"payTime\","+
                " t.upload_status as \"uploadStatus\","+
                " t.create_time as \"createTime\","+
                " t.remark as \"remark\","+
                " t.yk_order_no as \"ykOrderNo\","+
                " t.yk_order_id as \"ykOrderId\","+
                " b.idcard as \"idcard\", "+
                " b.mobile as \"mobile\" "+
                " from base_business_order_pay t" +
                " left join base_patient b on t.patient = b.id  where 1=1 and t.relation_name = '就诊卡充值' ";
        if (StringUtils.isNoneBlank(startTime)){
            if("xm_ykyy_wx".equals(wechatId)){
                if (flag){
                    sql+=" and t.create_time > '" + startTime + "'";
                }else {
                    sql+=" and t.create_time > to_date('" + startTime + "', 'yyyy-mm-dd hh24:mi:ss') ";
                }
            }else{
                sql+=" and t.create_time > '" + startTime + "'";
            }
        }
        if (StringUtils.isNoneBlank(endTime)){
            if("xm_ykyy_wx".equals(wechatId)){
                if (flag){
                    sql+=" and t.create_time <= '" + endTime + "'";
                }else {
                    sql+=" and t.create_time <= to_date('" + endTime + "', 'yyyy-mm-dd hh24:mi:ss') ";
                }
            }else{
                sql+=" and t.create_time <= '" + endTime + "'";
            }
        }
        if (StringUtils.isNoneBlank(orderNo)){
            sql+=" and t.order_no ='"+orderNo+"'";
        }
        if (StringUtils.isNoneBlank(yktOrderNo)){
            sql+=" and t.yk_order_no ='"+yktOrderNo+"'";
        }
        if (StringUtils.isNoneBlank(patientName)){
            sql+=" and t.patient_name  like '%"+patientName+"%'";
        }
        if (StringUtils.isNoneBlank(idCard)){
            sql+=" and b.idcard ='"+idCard+"'";
        }
        if (StringUtils.isNoneBlank(medicard)){
            sql+=" and t.relation_code ='"+medicard+"'";
        }
        if (status!=null){
            sql+=" and t.status ="+status+"";
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
        /*for (Map<String,Object> map:list){
            if (map.get("createTime")!=null){
                map.put("createTime",);
            }
        }*/
        List<Map<String,Object>> listCount  = hibenateUtils.createSQLQuery(sql);
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setTotalCount(listCount==null?0:listCount.size());
        return mixEnvelop;
    }
    /**
     * 眼科就诊卡充值

+ 2 - 1
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java

@ -183,6 +183,7 @@ public class WxTemplateService {
                        }
                        config.setKeyword1(doctorDO.getName());
                        weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),basePatientWechatDo.getOpenid(),config);
                        prescriptionService.wxTempalteJPush("video_invite",wlyyOutpatientDO,null,"","","","");
                    }
                }
            }
@ -620,7 +621,7 @@ public class WxTemplateService {
            WlyyOutpatientDO wlyyOutpatientDO = new WlyyOutpatientDO();
            wlyyOutpatientDO.setConsumer(basePatientDO.getId());
            wlyyOutpatientDO.setDoctorName(senderName);
            //prescriptionService.wxTempalteJPush("consult_remind",wlyyOutpatientDO,null,"","","","");
            prescriptionService.wxTempalteJPush("consult_remind",wlyyOutpatientDO,null,"","","","");
        }else{
            throw new Exception("接收者ID错误,无法找到该账号");
        }

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -39,6 +39,7 @@ public class BaseHospitalRequestMapping {
        public static final String PREFIX  = "/prescription";
        public static final String findDoctorByIdCard = "/findDoctorByIdCard";
        public static final String testJpush = "/testJpush";
        public static final String findYkCardCharge = "/findYkCardCharge";
        public static final String updateChannelId = "/updateChannelId";
        //=====================start=======================================

+ 1 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java

@ -216,7 +216,7 @@ public class UnSettledHISPrescriptionService {
                        BaseDoctorDO baseDoctorDO = doctorDao.findById(doctor);
                        ykyySMSService.sendSmsByTempcode("check_failed",wlyyOutpatientDO,prescriptionDO,baseDoctorDO.getMobile());
                        logger.info("极光推送处方驳回消息");
                       //prescriptionService.wxTempalteJPush("prescription_refuse",wlyyOutpatientDO,null,"","","",prescriptionDO.getId());
                       prescriptionService.wxTempalteJPush("prescription_refuse",wlyyOutpatientDO,null,"","","",prescriptionDO.getId());
                    }
                }

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

@ -1697,4 +1697,31 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        return success(prescriptionService.wxTempalteJPush(templateCode,wlyyOutpatientDO,consultTeamDo,drugName,mailNo,mailStatus,prescriptionId));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findYkCardCharge)
    @ApiOperation(value = "查询眼科通充值记录", notes = "")
    public MixEnvelop findYkCardCharge(@ApiParam(name = "startTime", value = "")
                             @RequestParam(value = "startTime", required = false)String startTime,
                             @ApiParam(name = "endTime", value = "")
                             @RequestParam(value = "endTime", required = false)String endTime,
                             @ApiParam(name = "orderNo", value = "")
                             @RequestParam(value = "orderNo", required = false)String orderNo,
                             @ApiParam(name = "yktOrderNo", value = "")
                             @RequestParam(value = "yktOrderNo", required = false)String yktOrderNo,
                             @ApiParam(name = "patientName", value = "")
                             @RequestParam(value = "patientName", required = false)String patientName,
                             @ApiParam(name = "idCard", value = "")
                             @RequestParam(value = "idCard", required = false)String idCard,
                                       @ApiParam(name = "medicard", value = "")
                                           @RequestParam(value = "medicard", required = false)String medicard,
                                       @ApiParam(name = "status", value = "")
                                           @RequestParam(value = "status", required = false)Integer status,
                                       @ApiParam(name = "page", value = "")
                                           @RequestParam(value = "page", required = false)Integer page,
                                       @ApiParam(name = "pageSize", value = "")
                                           @RequestParam(value = "pageSize", required = false)Integer pageSize) {
        return businessOrderService.findYktCardCharge(startTime,endTime,orderNo,yktOrderNo,patientName,idCard,medicard,status,page,pageSize);
    }
}