浏览代码

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

yeshijie 4 年之前
父节点
当前提交
e5aae3342e
共有 21 个文件被更改,包括 692 次插入60 次删除
  1. 23 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionExpressageService.java
  2. 167 14
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  3. 1 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/TnPrescriptionService.java
  4. 2 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  5. 2 3
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  6. 14 7
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/TnyyEntranceService.java
  7. 19 7
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  8. 7 4
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  9. 35 3
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  10. 14 2
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java
  11. 51 0
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxAccessTokenService.java
  12. 1 1
      business/base-service/src/mqConfig/mqdata/MS53001.json
  13. 94 0
      business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java
  14. 9 0
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  15. 26 0
      business/sms-service/src/main/java/com/yihu/jw/sms/dao/HospitalSysDictDao.java
  16. 105 0
      business/sms-service/src/main/java/com/yihu/jw/sms/service/ZBSmsService.java
  17. 72 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  18. 8 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  19. 1 1
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/OverdueJob.java
  20. 5 9
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  21. 36 7
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java

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

@ -88,6 +88,8 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    @Autowired
    PrescriptionService prescriptionService;
    @Autowired
    private SfConfigDao sfConfigDao;
@ -591,7 +593,8 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
            if(!newroutinfolist.isEmpty()){
                prescriptionExpressageLogDao.save(newroutinfolist);
            }
            //向患者微信推送模板写消息
            pushRouteLogToPatient(newroutinfolist);
            //如果路由信息节点包含了"已收件"节点,则修改处方状态为完成,增加物流派送日志为完成
            if(isContainEndRoutInfo){
                //修改处方状态为完成
@ -643,7 +646,26 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
    }
    //发送微信模板消息
    public void pushRouteLogToPatient(List<WlyyPrescriptionExpressageLogDO> routinfolist){
        boolean isSend = true;//防止80和8000同时存在多向患者端多发一条消息
        for (WlyyPrescriptionExpressageLogDO wlyyPrescriptionExpressageLogDO:routinfolist){
            if ("50".equalsIgnoreCase(wlyyPrescriptionExpressageLogDO.getOpCode())||
                    "204".equalsIgnoreCase(wlyyPrescriptionExpressageLogDO.getOpCode())||
            "80".equalsIgnoreCase(wlyyPrescriptionExpressageLogDO.getOpCode())||"8000".equalsIgnoreCase(wlyyPrescriptionExpressageLogDO.getOpCode())){
                if ("80".equalsIgnoreCase(wlyyPrescriptionExpressageLogDO.getOpCode())||"8000".equalsIgnoreCase(wlyyPrescriptionExpressageLogDO.getOpCode())){
                    if (isSend){
                        prescriptionService.sendSFWxTemplate(wlyyPrescriptionExpressageLogDO.getOutpatientId(),wlyyPrescriptionExpressageLogDO.getPrescriptionId(),wlyyPrescriptionExpressageLogDO.getOpCode());
                        isSend= false;
                    }
                }else {
                    prescriptionService.sendSFWxTemplate(wlyyPrescriptionExpressageLogDO.getOutpatientId(),wlyyPrescriptionExpressageLogDO.getPrescriptionId(),wlyyPrescriptionExpressageLogDO.getOpCode());
                }
            }
        }
    }
    /**
     * 根据收寄地址获取快递费用
     * @param d_province 省份名称

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

@ -3036,13 +3036,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String sql = "SELECT  ";
        if ("xm_ykyy_wx".equals(wxId)) {
            if (flag){
                sql = sql + "date_format(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
                sql = sql + "date_format(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"expressCreateTime\",";
            }else {
                sql = sql + "to_char(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
                sql = sql + "to_char(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"expressCreateTime\",";
            }
        } else {
            sql = sql + "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
            sql = sql + "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"expressCreateTime\",";
        }
        if ("xm_ykyy_wx".equals(wxId)) {
            if (flag){
                sql = sql + "date_format(p.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
            }else {
                sql = sql + "to_char(p.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
            }
        } else {
            sql = sql + "date_format(p.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
        }
        if ("xm_ykyy_wx".equals(wxId)) {
            if (flag){
@ -4347,7 +4357,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
        if ("xm_ykyy_wx".equalsIgnoreCase(wxId)||"sd_tnzyy_wx".equalsIgnoreCase(wxId)) {
            List<BasePatientWechatDo> ps = new ArrayList<BasePatientWechatDo>();
            if (StringUtils.isNotEmpty(outpatientId)){
                ps = basePatientWechatDao.findByWechatIdAndPatientId(wxId, outpatientDO.getConsumer());
@ -4453,22 +4463,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
            } else if ("outpatientMsgRemind".equalsIgnoreCase(titelType)) {
                scene = "mzxxtx";
                scene = "spthtx";
                if (StringUtils.isNotEmpty(outpatientId)){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_msg_notice_jz", scene, 1);
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_consult_notice", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getDoctorName()).replace("key2", StringUtils.isNoneBlank(doctorDO.getJobTitleName())?doctorDO.getJobTitleName():""));
                    String jobtitleCode = StringUtils.isNoneBlank(doctorDO.getJobTitleName())?doctorDO.getJobTitleName():"";
                    newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getDoctorName()+jobtitleCode));
                    newConfig.setKeyword1( outpatientDO.getDoctorName());
                    newConfig.setKeyword2(DateUtil.dateToStrLong(outpatientDO.getAdmDate()));
                    newConfig.setKeyword2(DateUtil.dateToStrLong(outpatientDO.getCreateTime()));
                    newConfig.setKeyword3(outpatientDO.getDeptName());
                    newConfig.setKeyword4( outpatientDO.getIcd10Name());
                    newConfig.setKeyword4( outpatientDO.getDescription());
                    if ("16".equals(type)) {
                        newConfig.setRemark(config.getRemark().replace("key1", "视频复诊"));
                        newConfig.setRemark(config.getRemark());
                        newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                    } else if ("17".equals(type)) {
                        newConfig.setRemark(config.getRemark().replace("key1", "视频咨询"));
                        newConfig.setRemark(config.getRemark());
                        newConfig.setUrl(newConfig.getUrl().replace("type=16","type=17") + "" + outpatientDO.getId());
                    }
                    //发起微信消息模板推送
@ -4550,6 +4559,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "图文复诊"));
                } else if ("16".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊"));
                }else if ("1".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询"));
                } else if ("17".equals(type)) {
                    newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询"));
                }
                newConfig.setKeyword1( outpatientDO.getHospitalName());
                newConfig.setKeyword2(outpatientDO.getDoctorName());
@ -4647,6 +4660,147 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
    }
    /**
     * 发送顺丰物流提醒模板消息
     * @param outpatientId
     */
    public void sendSFWxTemplate(String outpatientId,String prescriptionId,String routeCode){
        String contentMsg = "";
        String first = "";
        String remark = "";
        String patientId = "";
        String drugName = "";
        String remindMsg="";
        String patienName = "";
        String mailNo ="";
        String msgUrl ="";
        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();
        }
        switch (routeCode) {
            case "50":
                remindMsg = "已发出";
                break;
            case "204":
                remindMsg = "已在派件";
                break;
            case "80":
                remindMsg = "已签收";
                break;
            case "8000":
                remindMsg = "已签收";
                break;
        }
        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());
            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);
            }
        }else {
            first = "您好,您的处方订单物流"+remindMsg;
            contentMsg = "患者"+patienName+"的处方药品订单,"+drugName+"等,当前"+remindMsg+"。物流方:「顺丰快递」,物流单号:"+mailNo+"。";
            logger.info("推送物流模板消息参数first:"+first+"====contentMsg:"+contentMsg);
            msgUrl="/ims-wx/index.html#/returnVisit/logistics?outpatientId="+outpatientId+"&prescriptionCode="+prescriptionId;
            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 List<WlyyHospitalSysDictDO> findCancelReasonList() {
        return sysDictDao.findByDictName("PatientCancel");
@ -10297,7 +10451,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
               }
           }
       }catch (Exception e){
           e.printStackTrace();
           return doorServiceCount;
       }
       return doorServiceCount;

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

@ -539,6 +539,7 @@ public class TnPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pr
/*            object.put("ybfl",map.get("ybfl"));//医保分类*/
            object.put("retprice",map.get("LSJG"));//零售价格
            object.put("kcsl",map.get("KCSL"));//库存
            object.put("stock_amount",map.get("KCSL"));//库存
            object.put("ypcd",map.get("YPCD"));//产地
            object.put("zfpb",map.get("ZFPB"));//作废判别
            object.put("jbywbz",map.get("jbywbz"));//基本药物标志

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

@ -277,7 +277,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     *
     */
    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn,String patient,String realOrder,String admNo,boolean demoFlag)throws Exception{
        String patNo =patientMappingService.findHisPatNoByPatient(patient,null);
        String patNo =patientMappingService.findYkyyPatNoByPatient(patient,demoFlag);
        if(StringUtils.isBlank(patNo)){
            return null;
        }
@ -635,6 +635,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            object.put("ydyp",map.get("ydyp"));//药店药品
            object.put("ypmc2",map.get("ypmc2"));//药品名称2
            object.put("t",map.get("pzwh"));//药品批文
            object.put("stock_amount",map.get("kcsl"));//库存
            array.add(object);
        }
        return array;

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

@ -596,6 +596,7 @@ public class EntranceService {
            if (StringUtils.isNotBlank(ksdm)) {
                sbs.append("<query compy=\"=\" item=\"ADM_SPEC\" splice=\"and\" value=\"'" + ksdm + "'\"/>");
            }
            sbs.append("<query compy=\"\" item=\"icd_name\" splice=\"and\" value=\"is not null\"/>");
            sbs.append("<order item=\"CON_DATE\" sort=\"desc\"/>");
            //查询信息结束
            sbs.append("</MsgInfo></ESBEntry>");
@ -1479,9 +1480,7 @@ public class EntranceService {
            if (StringUtils.isNotBlank(now)) {
                sbs.append("<query compy=\"&lt;\" item=\"ADM_DAT\" splice=\"and\" value=\"'" + now + "'\"/>");
            }
            if (StringUtils.isNotBlank(preday)) {
                sbs.append("<query compy=\"\" item=\"icd_name\" splice=\"and\" value=\"is not null\"/>");
            }
            sbs.append("<query compy=\"\" item=\"icd_name\" splice=\"and\" value=\"is not null\"/>");
            sbs.append("<order item=\"ADM_DAT\" sort=\"desc\"/>");
            //查询信息结束
            sbs.append("</MsgInfo></ESBEntry>");

+ 14 - 7
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/TnyyEntranceService.java

@ -174,12 +174,12 @@ public class TnyyEntranceService {
                            doctor.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(idcard)));
                            doctor.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
                            doctor.setProvinceCode("350000");
                            doctor.setProvinceName("福建省");
                            doctor.setTownCode("350203");
                            doctor.setTownName("思明区");
                            doctor.setCityCode("350200");
                            doctor.setCityName("厦门市");
                            doctor.setProvinceCode("370000");
                            doctor.setProvinceName("山东省");
                            doctor.setTownCode("370902");
                            doctor.setTownName("泰山区");
                            doctor.setCityCode("370900");
                            doctor.setCityName("泰安市");
//                            doctor.setExpertise(doctorJson.getString("expertise"));
//                            doctor.setIntroduce(doctorJson.getString("introduce"));
//                            doctor.setMobile(doctorJson.getString("mobile"));
@ -869,7 +869,14 @@ public class TnyyEntranceService {
    public JSONObject getAccessToken() throws Exception {
        String url = "http://tazhongyi.519e.com.cn/Api/ApiReport/GetAccessToken";
        HttpResponse httpResponse = HttpUtils.doPost(url,null);
        String content = httpResponse.getContent();
        logger.info("getAccessToken:"+content);
        JSONObject rs = JSON.parseObject(content);
        return rs;
    }

+ 19 - 7
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -340,9 +340,15 @@ public class XzzxEntranceService{
                            doctor.setTownName("思明区");
                            doctor.setCityCode("350200");
                            doctor.setCityName("厦门市");
                            doctor.setExpertise(doctorJson.getString("expertise"));
                            doctor.setIntroduce(doctorJson.getString("introduce"));
                            doctor.setPhoto(doctorJson.getString("photo"));
                            if (!"[]".equalsIgnoreCase(doctorJson.getString("expertise"))&&StringUtils.isNoneBlank(doctorJson.getString("expertise"))){
                                doctor.setExpertise(doctorJson.getString("expertise"));
                            }
                            if (!"[]".equalsIgnoreCase(doctorJson.getString("introduce"))&&StringUtils.isNoneBlank(doctorJson.getString("introduce"))){
                                doctor.setIntroduce(doctorJson.getString("introduce"));
                            }
                            if (!"[]".equalsIgnoreCase(doctorJson.getString("photo"))&&StringUtils.isNoneBlank(doctorJson.getString("photo"))){
                                doctor.setPhoto(doctorJson.getString("photo"));
                            }
                            doctor.setIscertified(doctorJson.getString("iscertified"));
                            doctor.setSpell(doctorJson.getString("spell"));
//                                String salt = randomString(5);
@ -415,9 +421,15 @@ public class XzzxEntranceService{
                            doctor.setTownName("思明区");
                            doctor.setCityCode("350200");
                            doctor.setCityName("厦门市");
                            doctor.setExpertise(doctorJson.getString("expertise"));
                            doctor.setIntroduce(doctorJson.getString("introduce"));
                            doctor.setPhoto(doctorJson.getString("photo"));
                            if (!"[]".equalsIgnoreCase(doctorJson.getString("expertise"))&&StringUtils.isNoneBlank(doctorJson.getString("expertise"))){
                                doctor.setExpertise(doctorJson.getString("expertise"));
                            }
                            if (!"[]".equalsIgnoreCase(doctorJson.getString("introduce"))&&StringUtils.isNoneBlank(doctorJson.getString("introduce"))){
                                doctor.setIntroduce(doctorJson.getString("introduce"));
                            }
                            if (!"[]".equalsIgnoreCase(doctorJson.getString("photo"))&&StringUtils.isNoneBlank(doctorJson.getString("photo"))){
                                doctor.setPhoto(doctorJson.getString("photo"));
                            }
                            doctor.setIscertified(doctorJson.getString("iscertified"));
                            doctor.setSpell(doctorJson.getString("spell"));
                            doctor.setOutpatientType("zj");
@ -3055,7 +3067,7 @@ public class XzzxEntranceService{
                object1.put("retprice",jsonObject.getString("RETAIL_PRICE"));
                object1.put("specification",jsonObject.getString("PHYSIC_SPEC"));
                object1.put("pack_retprice",jsonObject.getString("RETAIL_PRICE"));
                object1.put("stock_amount","");
                object1.put("stock_amount",jsonObject.getString("QUANTITY"));
                object1.put("visible_flag",jsonObject.getString("VALID_FLAG"));
                object1.put("drug_flag",jsonObject.getString("OTC_FLAG"));
                object1.put("py_code",jsonObject.getString("SPELL_CODE"));

+ 7 - 4
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -1544,8 +1544,9 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                " base_evaluate_score a " +
                " JOIN base_evaluate e ON a.id = e.relation_code " +
                " JOIN base_doctor d ON d.id = a.doctor " +
                " WHERE " +
                " e.score_type = '4'";
                " JOIN wlyy_consult m ON m.id = a.relation_code  " +
                "WHERE " +
                " e.score_type = '4' and m.id != '' and m.id is not null ";
        if(StringUtils.isNotBlank(startDate)){
            yypjSql =  yypjSql + "  and a.create_time >=:startDate ";
@ -1596,7 +1597,9 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                "      join base_doctor b on b.id = a.doctor" +
                "      join base_patient c on c.id = a.patient" +
                " where a.register_no is NOT NULL and a.dept is not null " +
                " and a.register_date is not null " ;
                " and a.register_date is not null " +
                " and a.doctor not in ('402803816babc778016babd0dee21112')" +
                " and a.patient not in ('2c9081aa6c2f1892016c6a26a8c102ca','39686349deff487d8f3372fc253b8417') " ;
        if(StringUtils.isNotBlank(startDate)){
            wlzlSql =  wlzlSql + "  and a.create_time >=:startDate ";
        }
@ -1640,7 +1643,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                "  from wlyy_prescription_info a " +
                "     JOIN wlyy_prescription b " +
                "     on b.id = a.prescription_id" +
                "  where  a.dosage is not null and b.real_order is not null";
                "  where  a.dosage is not null and b.real_order is not null and a.del=1 ";
        if(StringUtils.isNotBlank(startDate)){
            infosql =  infosql + "  and b.create_time >=:startDate ";

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

@ -476,6 +476,12 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                }
            }
        }
        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);
        }
        businessOrderDao.save(businessOrderDO);
        String ourTradeNo = businessOrderDO.getOrderNo();
        if (!StringUtils.isNoneBlank(tradeType)){
            tradeType=WeChatConfig.TRADE_TYPE_JSAPI;
@ -1076,6 +1082,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                openId = patientWechatDo.getOpenid();
            }
            String price = businessOrderDO.getPayPrice().toString();
            businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            String notifyUrl = hospitalSysDictDO.getDictCode();
            response = ylzPayService.rechargeConsume("123456",businessOrderDO.getPatientName(),"01",ssc,"01",idcard,depositType,
                    price,price,businessOrderDO.getOrderNo(),idcard,"0",businessOrderDO.getPatientName(),businessOrderDO.getRematk(),openId,notifyUrl,notifyUrl,null);
@ -1503,6 +1510,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        }
        WlyyHospitalSysDictDO hospitalSysDictDO =hospitalSysDictDao.findById("YLZ_NOTIFY_URL");
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(code);
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(code);
        if (businessOrderDO!=null){
            BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient());
            String idcard = "";
@ -1515,9 +1523,32 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            if (StringUtils.isNoneBlank(businessOrderDO.getDoctor())){
                BaseDoctorDO doctorDO = doctorDao.findById(businessOrderDO.getDoctor());
                String fee = null;
                if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                    WlyyChargeDictDO chargeDictDO = chargeDictDao.findByChargeTypeAndDeptTypeCode(doctorDO.getChargeType(),"6");
                    fee = chargeDictDO.getReqFee()+"";
                if (wechatId.equalsIgnoreCase("xm_zsyy_wx")||wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                    if (wlyyOutpatientDO!=null){
                        if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                            WlyyChargeDictDO chargeDictDO = chargeDictDao.findByChargeTypeAndDeptTypeCode(doctorDO.getTwfzChargeType(),"6");
                            fee = chargeDictDO.getReqFee()+"";
                        }else if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                            WlyyChargeDictDO chargeDictDO = chargeDictDao.findByChargeTypeAndDeptTypeCode(doctorDO.getSpfzChargeType(),"6");
                            fee = chargeDictDO.getReqFee()+"";
                        }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                            WlyyChargeDictDO chargeDictDO = chargeDictDao.findByChargeTypeAndDeptTypeCode(doctorDO.getTwzxChargeType(),"6");
                            fee = chargeDictDO.getReqFee()+"";
                        }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                            WlyyChargeDictDO chargeDictDO = chargeDictDao.findByChargeTypeAndDeptTypeCode(doctorDO.getSpzxChargeType(),"6");
                            fee = chargeDictDO.getReqFee()+"";
                        }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                            WlyyChargeDictDO chargeDictDO = chargeDictDao.findByChargeTypeAndDeptTypeCode(doctorDO.getXtfzChargeType(),"6");
                            fee = chargeDictDO.getReqFee()+"";
                        }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                            WlyyChargeDictDO chargeDictDO = chargeDictDao.findByChargeTypeAndDeptTypeCode(doctorDO.getJyzxChargeType(),"6");
                            fee = chargeDictDO.getReqFee()+"";
                        }else {
                            WlyyChargeDictDO chargeDictDO = chargeDictDao.findByChargeTypeAndDeptTypeCode(doctorDO.getChargeType(),"6");
                            fee = chargeDictDO.getReqFee()+"";
                        }
                    }
                }else {
                    WlyyChargeDictDO chargeDictDO = chargeDictDao.findByChargeType(doctorDO.getChargeType());
                    fee = chargeDictDO.getReqFee()+"";
@ -1553,6 +1584,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            }
            businessOrderDO.setPayType(4);
            businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            businessOrderDao.save(businessOrderDO);
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){

+ 14 - 2
business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java

@ -3,6 +3,7 @@ package com.yihu.jw.wechat.service;
import com.yihu.jw.entity.base.wx.JsApiTicket;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.TnyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.wechat.dao.WechatDao;
@ -22,6 +23,8 @@ public class WechatInfoService {
    private EntranceService entranceService;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
    /**
     * 通过code获取判断openid
@ -66,7 +69,7 @@ public class WechatInfoService {
            WxWechatDO wxWechat = null;
            
            //中山医院互联网医院
            if("xm_zsyy_wx".equals(wxId) || "xm_xzzx_wx".equals(wxId) || "xm_ykyy_wx".equals(wxId)){
            if("xm_zsyy_wx".equals(wxId) || "xm_xzzx_wx".equals(wxId) || "xm_ykyy_wx".equals(wxId)||"sd_tnzyy_wx".equals(wxId)){
                jsapiTickets = wxAccessTokenService.findJsapiTicket(wxId);
            }else{
                wxWechat = wxAccessTokenService.getWxInfo(wxId);
@ -97,6 +100,15 @@ public class WechatInfoService {
            }else if("xm_xzzx_wx".equals(wxId)){
                token = xzzxEntranceService.getXzToken();
            }else if("xm_xzzx_wx".equals(wxId)){
                token = xzzxEntranceService.getXzToken();
            }else if("sd_tnzyy_wx".equals(wxId)){
                com.alibaba.fastjson.JSONObject jsonObject = tnyyEntranceService.getAccessToken();
                if (jsonObject.getString("ResultCode")!=null&&jsonObject.getString("ResultCode").equalsIgnoreCase("0")){
                    token = jsonObject.getString("AccessToken");
                }else {
                    throw new Exception("获取ACCESSTOKEN失败");
                }
            }else{
                token = wxAccessTokenService.getWxAccessTokenById(wxId).getAccessToken();
            }
@ -114,7 +126,7 @@ public class WechatInfoService {
                    JsApiTicket newJsApiTicket = new JsApiTicket();
                    newJsApiTicket.setJsapi_ticket(ticket);
                    newJsApiTicket.setExpires_in(Long.parseLong(expires_in));
                    if("xm_zsyy_wx".equals(wxId) || "xm_xzzx_wx".equals(wxId) || "xm_ykyy_wx".equals(wxId)){
                    if("xm_zsyy_wx".equals(wxId) || "xm_xzzx_wx".equals(wxId) || "xm_ykyy_wx".equals(wxId)||"sd_tnzyy_wx".equals(wxId)){
                        newJsApiTicket.setAcc_id(wxId);
                    }else{
                        newJsApiTicket.setAcc_id(wxWechat.getAppOriginId());

+ 51 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxAccessTokenService.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.exception.code.ExceptionCode;
import com.yihu.jw.hospital.prescription.service.entrance.TnyyEntranceService;
import com.yihu.jw.rm.base.WechatRequestMapping;
import com.yihu.jw.wechat.dao.JsapiTicketDao;
import com.yihu.jw.wechat.dao.WechatDao;
@ -38,6 +39,8 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessTokenDO, WxAcce
    @Autowired
    private JsapiTicketDao jsapiTicketDao;
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
    public WxWechatDO getWxInfo(String wxId){
@ -183,6 +186,9 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessTokenDO, WxAcce
                    }
                }
            }
            if (wechatId.equalsIgnoreCase("sd_tnzyy_wx")){
                return  getAccessTokenById(wechatId);
            }
            String token_url = "https://api.weixin.qq.com/cgi-bin/token";
            String appId="";
            String appSecret="";
@ -222,6 +228,51 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessTokenDO, WxAcce
        }
    }
    /**
     * 泰安获取token
     * @param wechatId
     * @return
     */
    public WxAccessTokenDO getAccessTokenById(String wechatId) {
        try {
            //根据wechatCode查找出appid和appSecret
            WxWechatDO wxWechat = wechatDao.findById(wechatId);
            List<WxAccessTokenDO> wxAccessTokens =  wxAccessTokenDao.getWxAccessTokenById(wechatId);
            if(wxWechat==null){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
            }
            if(wxAccessTokens!=null&&wxAccessTokens.size()>0){
                for (WxAccessTokenDO accessToken : wxAccessTokens) {
                    if ((System.currentTimeMillis() - accessToken.getAddTimestamp()) < (accessToken.getExpiresIn() * 500)) {
                        return accessToken;
                    } else {
                        wxAccessTokenDao.delete(accessToken);
                        break;
                    }
                }
            }
            com.alibaba.fastjson.JSONObject json = tnyyEntranceService.getAccessToken();
            if (json.containsKey("AccessToken")) {
                String token = json.get("AccessToken").toString();
                WxAccessTokenDO newaccessToken = new WxAccessTokenDO();
                newaccessToken.setAccessToken(token);
                newaccessToken.setExpiresIn(7200);
                newaccessToken.setAddTimestamp(System.currentTimeMillis());
                newaccessToken.setCzrq(new Date());
                newaccessToken.setCode(UUID.randomUUID().toString().replace("-",""));
                newaccessToken.setWechatId(wechatId);
                wxAccessTokenDao.save(newaccessToken);
                return newaccessToken;
            } else {
                return null;
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    /**
     * 获取凭证
     * @param accId 微信原始id

+ 1 - 1
business/base-service/src/mqConfig/mqdata/MS53001.json

@ -22,7 +22,7 @@
				"specification": "10mgx10片/盒",
				"retprice": "1.5726",
				"pack_retprice": "15.726",
				"stock_amount": "0",
				"stock_amount": "1",
				"visible_flag": "0",
				"drug_flag": "0",
				"py_code": "BNPLP   ",

+ 94 - 0
business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java

@ -4478,6 +4478,7 @@ public class StatisticsEsService {
    public JSONObject getPrescriptionLineBy(String startDate, String endDate, String area, int level, String index,int interval, String level2_type) throws Exception {
        logger.info("service index:"+index+" and level2_type:"+level2_type+" and level:"+level);
        String[] indexes = index.split(",");
        String index3 = indexes.length>=3?indexes[2]:"20";
        JSONArray resultArray = new JSONArray();
        //问诊量
        JSONObject object = new JSONObject();
@ -4511,8 +4512,11 @@ public class StatisticsEsService {
            //开具处方数量
            Double preNum = 0.0;
            Double outNum = 0.0;
            Double isPayNum = 0.0;//已支付的处方数量
            String prescriptionRate ="";
            String prescriptionPayRate = "";
            List<SaveModel> precriptionList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL,"","",level2_type);
            List<SaveModel> precriptionIsPayList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, index3, SaveModel.timeLevel_ZL,"1","",level2_type);
            if(SaveModel.OrgLevel.equals(level2_type)){
                for(SaveModel saveModel:precriptionList){
@ -4531,6 +4535,16 @@ public class StatisticsEsService {
                            break;
                        }
                    }
                    for (SaveModel saveModel2:precriptionIsPayList){
                        String isPay=saveModel2.getHospital()==null?"":saveModel2.getHospital();
                        String pre=saveModel.getHospital()==null?"":saveModel.getHospital();
                        if(isPay.equalsIgnoreCase(pre)){
                            isPayNum = saveModel2.getResult1();
                            prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                            jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                            break;
                        }
                    }
                    if(null==saveModel.getHospital()){
                        resultArray =new JSONArray();
                    }else {
@ -4565,6 +4579,16 @@ public class StatisticsEsService {
                            break;
                        }
                    }
                    for (SaveModel saveModel2:precriptionIsPayList){
                        String isPay=saveModel2.getDoctor()==null?"":saveModel2.getDoctor();
                        String pre=saveModel.getDoctor()==null?"":saveModel.getDoctor();
                        if(isPay.equalsIgnoreCase(pre)){
                            isPayNum = saveModel2.getResult1();
                            prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                            jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                            break;
                        }
                    }
                    if(null==saveModel.getDoctor()){
                        resultArray =new JSONArray();
                    }else {
@ -4592,6 +4616,16 @@ public class StatisticsEsService {
                            break;
                        }
                    }
                    for (SaveModel saveModel2:precriptionIsPayList){
                        String isPay=saveModel2.getDept()==null?"":saveModel2.getDept();
                        String pre=saveModel.getDept()==null?"":saveModel.getDept();
                        if(isPay.equalsIgnoreCase(pre)){
                            isPayNum = saveModel2.getResult1();
                            prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                            jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                            break;
                        }
                    }
                    if(null==saveModel.getDept()){
                        resultArray =new JSONArray();
                    }else {
@ -4606,8 +4640,11 @@ public class StatisticsEsService {
            //开具处方数量
            Double preNum = 0.0;
            Double outNum = 0.0;
            Double isPayNum = 0.0;//已支付的处方数量
            String prescriptionRate ="";
            String prescriptionPayRate = "";
            List<SaveModel> precriptionList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL,"","","4");
            List<SaveModel> precriptionIsPayList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, index3, SaveModel.timeLevel_ZL,"1","","4");
            for(SaveModel saveModel:precriptionList){
                preNum = saveModel.getResult1();
                JSONObject jsonObject = new JSONObject();
@ -4628,6 +4665,16 @@ public class StatisticsEsService {
                        break;
                    }
                }
                for (SaveModel saveModel2:precriptionIsPayList){
                    String isPay=saveModel2.getHospital()==null?"":saveModel2.getHospital();
                    String pre=saveModel.getHospital()==null?"":saveModel.getHospital();
                    if(isPay.equalsIgnoreCase(pre)){
                        isPayNum = saveModel2.getResult1();
                        prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                        jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                        break;
                    }
                }
                if(null==saveModel.getHospital()){
                    resultArray =new JSONArray();
                }else {
@ -4670,6 +4717,7 @@ public class StatisticsEsService {
    public JSONObject getPrescriptionLineByType(String startDate, String endDate, String area, int level, String index,int interval, String level2_type) throws Exception {
        logger.info("service index:"+index+" and level2_type:"+level2_type+" and level:"+level);
        String[] indexes = index.split(",");
        String index3 = indexes.length>=3?indexes[2]:"20";
        JSONArray resultArray = new JSONArray();
        //问诊量
        JSONObject object = new JSONObject();
@ -4702,8 +4750,11 @@ public class StatisticsEsService {
            //开具处方数量
            Double preNum = 0.0;
            Double outNum = 0.0;
            Double isPayNum = 0.0;//已支付的处方数量
            String prescriptionRate = "";
            String prescriptionPayRate = "";
            List<SaveModel> precriptionList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL, "", "", level2_type);
            List<SaveModel> precriptionIsPayList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, index3, SaveModel.timeLevel_ZL,"1","",level2_type);
            if (SaveModel.OrgLevel.equals(level2_type)) {
                //问诊量表格
                for (SaveModel saveModel : precriptionList) {
@ -4722,6 +4773,16 @@ public class StatisticsEsService {
                            break;
                        }
                    }
                    for (SaveModel saveModel2:precriptionIsPayList){
                        String isPay=saveModel2.getHospital()==null?"":saveModel2.getHospital();
                        String pre=saveModel.getHospital()==null?"":saveModel.getHospital();
                        if(isPay.equalsIgnoreCase(pre)){
                            isPayNum = saveModel2.getResult1();
                            prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                            jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                            break;
                        }
                    }
                    if(null==saveModel.getHospital()){
                        resultArray =new JSONArray();
                    }else {
@ -4750,6 +4811,16 @@ public class StatisticsEsService {
                            break;
                        }
                    }
                    for (SaveModel saveModel2:precriptionIsPayList){
                        String isPay=saveModel2.getDoctor()==null?"":saveModel2.getDoctor();
                        String pre=saveModel.getDoctor()==null?"":saveModel.getDoctor();
                        if(isPay.equalsIgnoreCase(pre)){
                            isPayNum = saveModel2.getResult1();
                            prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                            jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                            break;
                        }
                    }
                    if(null==saveModel.getDoctor()){
                        resultArray =new JSONArray();
                    }else {
@ -4778,6 +4849,16 @@ public class StatisticsEsService {
                            break;
                        }
                    }
                    for (SaveModel saveModel2:precriptionIsPayList){
                        String isPay=saveModel2.getDept()==null?"":saveModel2.getDept();
                        String pre=saveModel.getDept()==null?"":saveModel.getDept();
                        if(isPay.equalsIgnoreCase(pre)){
                            isPayNum = saveModel2.getResult1();
                            prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                            jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                            break;
                        }
                    }
                    if(null==saveModel.getDept()){
                        resultArray =new JSONArray();
                    }else {
@ -4791,8 +4872,11 @@ public class StatisticsEsService {
            //开具处方数量
            Double preNum = 0.0;
            Double outNum = 0.0;
            Double isPayNum = 0.0;//已支付的处方数量
            String prescriptionRate = "";
            String prescriptionPayRate = "";
            List<SaveModel> precriptionList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL, "", "", "4");
            List<SaveModel> precriptionIsPayList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, index3, SaveModel.timeLevel_ZL,"1","","4");
            for (SaveModel saveModel : precriptionList) {
                preNum = saveModel.getResult1();
                JSONObject jsonObject = new JSONObject();
@ -4813,6 +4897,16 @@ public class StatisticsEsService {
                        break;
                    }
                }
                for (SaveModel saveModel2:precriptionIsPayList){
                    String isPay=saveModel2.getHospital()==null?"":saveModel2.getHospital();
                    String pre=saveModel.getHospital()==null?"":saveModel.getHospital();
                    if(isPay.equalsIgnoreCase(pre)){
                        isPayNum = saveModel2.getResult1();
                        prescriptionPayRate = getRange(isPayNum.intValue(),preNum.intValue(),0);
                        jsonObject.put("prescriptionPayRate",prescriptionPayRate);
                        break;
                    }
                }
                if(null==saveModel.getHospital()){
                    resultArray =new JSONArray();
                }else {

+ 9 - 0
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -55,6 +55,7 @@ import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.jw.wechat.service.WxTemplateService;
import com.ylzinfo.onepay.sdk.domain.ext.WaitPayDetailVO;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import org.slf4j.LoggerFactory;
@ -151,6 +152,8 @@ public class ImService {
	@Value("${demo.flag}")
	private boolean demoFlag;
	@Autowired
	private WxTemplateService wxTemplateService;
	@Autowired
	private JdbcTemplate jdbcTemplate;
@ -1360,6 +1363,10 @@ public class ImService {
				// 添加咨询转发记录
				// 添加医生咨询日志
				addLogs(ct);
				//只有勾选同同时发起视频邀请的时候才发送模板消息
				if("2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
					wxTemplateService.sendWeTempMesMiniProgram(wlyyOutpatientDO.getDoctor(),wlyyOutpatientDO.getDoctorName(),wlyyOutpatientDO.getConsumer(),wlyyOutpatientDO.getConsumerName(),consult.getId());
				}
			}
			String sessionIds = patient + "_" + outpatientCode + "_" + ct.getType();
			JSONObject result = imUtil.getSingleSessionInfo(sessionIds,doctorCode);
@ -1380,6 +1387,8 @@ public class ImService {
				}
			}
			//发送外层SOCKET消息 在线复诊
			if("1".equals(wlyyOutpatientDO.getOutpatientType())){
				System.out.println("发送外层SOCKET消息:在线复诊");

+ 26 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/dao/HospitalSysDictDao.java

@ -0,0 +1,26 @@
package com.yihu.jw.sms.dao;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/6/17.
 */
public interface HospitalSysDictDao extends PagingAndSortingRepository<WlyyHospitalSysDictDO, String>, JpaSpecificationExecutor<WlyyHospitalSysDictDO> {
    WlyyHospitalSysDictDO findByHospitalAndDictCode(String hospital, String dictCode);
    List<WlyyHospitalSysDictDO> findByHospitalAndDictNameOrderBySortAsc(String hospital, String dictName);
    WlyyHospitalSysDictDO findById(String id);
    List<WlyyHospitalSysDictDO> findByDictName(String dictName);
    @Query("from WlyyHospitalSysDictDO where 1=1")
    List<WlyyHospitalSysDictDO> findAlldict();
    @Query("from WlyyHospitalSysDictDO where dictCode = ?1")
    List<WlyyHospitalSysDictDO> findByDictCode(String dictCode);
}

+ 105 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/service/ZBSmsService.java

@ -0,0 +1,105 @@
package com.yihu.jw.sms.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.sms.dao.HospitalSysDictDao;
import com.yihu.jw.util.http.HttpClientUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 福州总部的短信接口
 */
@Service
public class ZBSmsService {
    private Logger logger= LoggerFactory.getLogger(ZBSmsService.class);
    private String smsHandlerId;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private HospitalSysDictDao sysDictDao;
    private String appId;
    private String secret;//正式参数
    private String prixUrl;//正式参数
    /**
     * 初始化总部接口参数
     */
    private void init(){
        List<WlyyHospitalSysDictDO> dictDOList = sysDictDao.findByDictName("zbSms");
        for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:dictDOList){
            if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase("smsHandlerId")){
                smsHandlerId=wlyyHospitalSysDictDO.getDictValue();
            }else if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase("appId")){
                appId=wlyyHospitalSysDictDO.getDictValue();
            }else if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase("secret")){
                secret=wlyyHospitalSysDictDO.getDictValue();
            }else if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase("prixUrl")){
                prixUrl=wlyyHospitalSysDictDO.getDictValue();
            }
        }
    }
    /**
     * 发送短信
     * @return
     */
    public Integer sendMessage(String mobile,String code) throws Exception {
        try{
            //初始化参数
            init();
            String apiUrl = prixUrl+"MsgGW/Sms/send";
            String timestamp =
                    Long.toString(System.currentTimeMillis());//timestamp必须与服务器时间相差在5分钟以内,否则调用将失败;
            Map<String, String> paramMap = new HashMap<>();
            JSONObject object = new JSONObject();
            object.put("code",code);
            paramMap.put("mobile", mobile);
            paramMap.put("templateParam", object.toJSONString());
            paramMap.put("handlerId", smsHandlerId);
            paramMap.put("timestamp", timestamp);
            StringBuilder stringBuilder = new StringBuilder();
            // 对参数名进行字典排序
            String[] keyArray = paramMap.keySet().toArray(new String[0]);
            Arrays.sort(keyArray);
            // 拼接有序的参数名-值串
            stringBuilder.append(appId);
            for (String key : keyArray)
            {
                stringBuilder.append(key).append(paramMap.get(key));
            }
            String codes = stringBuilder.append(secret).toString();
            String sign = org.apache.commons.codec.digest.DigestUtils.shaHex(codes).toUpperCase();
            // 添加签名,并发送请求
            paramMap.put("appId", appId);
            paramMap.put("sign", sign);
            String rep = httpClientUtil.httpPost(apiUrl, paramMap);
            logger.info("总部短信接口请求返回值:"+rep);
            if (!StringUtils.isEmpty(rep)){
                com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(rep);
                if ( jsonObject.getInteger("Code")==10000){
                    return 0;
                }
            }
            return 1;
        }catch (Exception e){
            logger.error(e.getMessage());
        }
        return null;
    }
}

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

@ -30,6 +30,7 @@ import com.yihu.jw.security.utils.DateUtil;
import com.yihu.jw.security.utils.IdCardUtil;
import com.yihu.jw.security.utils.SerializeUtil;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.sms.service.ZBSmsService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import com.yihu.utils.network.HttpResponse;
@ -130,6 +131,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    @Autowired
    private ZhongShanSMSService zhongShanSMSService;
    @Autowired
    private ZBSmsService zbSmsService;
    @Autowired
    private OauthCaConfigSerivce oauthCaConfigSerivce;
    @Autowired
    private OauthWjwConfigService oauthWjwConfigService;
@ -606,15 +609,84 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        throw new IllegalStateException("验证码发送失败!");
    }
    /**
     * 福州健康之路短信接口
     * @param parameters
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/oauth/sendZBCaptcha", method = RequestMethod.GET)
    public ResponseEntity<Oauth2Envelop<Captcha>> sendZBCaptcha(@RequestParam Map<String, String> parameters) throws Exception {
        String client_id = parameters.get("client_id");
        String username = parameters.get("username");
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id");
        }
        if (StringUtils.isEmpty(username)) {
            throw new InvalidRequestException("username");
        }
        if (username.length()>12){
            throw new InvalidRequestException("请输入正确的手机号!");
        }
        //验证请求间隔超时,防止频繁获取验证码
        if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
            throw new IllegalAccessException("SMS request frequency is too fast");
        }
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            String captcha = wlyyHospitalSysDictDO.getDictValue();
            Captcha _captcha = new Captcha();
            _captcha.setCode(captcha);
            _captcha.setExpiresIn(300);
            wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("success", 200);
            HttpHeaders headers = new HttpHeaders();
            headers.set("Cache-Control", "no-store");
            headers.set("Pragma", "no-cache");
            return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
        }else {
            //发送短信获取验证码
            String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
            int result =  zbSmsService.sendMessage(username,captcha);
            if (0 == result) {
                Captcha _captcha = new Captcha();
                _captcha.setCode(captcha);
                _captcha.setExpiresIn(300);
                wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, null);
                HttpHeaders headers = new HttpHeaders();
                headers.set("Cache-Control", "no-store");
                headers.set("Pragma", "no-cache");
                return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
            }
        }
        throw new IllegalStateException("验证码发送失败!");
    }
    @RequestMapping(value = "/oauth/sendCaptcha", method = RequestMethod.GET)
    public ResponseEntity<Oauth2Envelop<Captcha>> sendCaptcha(@RequestParam Map<String, String> parameters) throws Exception {
        String wxId = parameters.get("wxId");
        String key = parameters.get("key");
        String text = parameters.get("text");
        if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
            if(!verifyCaptcha(key,text)){
                throw new ImgCaptchaException("img_captcha error");
            }
        }
        if("xm_ykyy_wx".equals(wxId)){
           return sendYKCaptcha(parameters);
        }else if("xm_zsyy_wx".equals(wxId)){
           return sendZSCaptcha(parameters);
        }else if ("xm_xzzx_wx".equals(wxId)){
            return sendXZCaptcha(parameters);
        }else if ("sd_tnzyy_wx".equals(wxId)){
            return sendZBCaptcha(parameters);
        }
        throw new IllegalStateException("验证码发送失败");
    }

+ 8 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -562,6 +562,14 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        try {
            baseDoctorDO = objectMapper.readValue(doctor.toJSONString(),BaseDoctorDO.class);
            BaseDoctorDO oldDoctor = baseDoctorDao.findOne(baseDoctorDO.getId());
            if (oldDoctor!=null&&!oldDoctor.getIdcard().equalsIgnoreCase(baseDoctorDO.getIdcard())){
              List<BaseDoctorDO> isExist =  baseDoctorDao.findByIdcard(baseDoctorDO.getIdcard());
              if (isExist!=null&&isExist.size()>0){
                  result.put("msg","当前身份证号已存在,请检查身份证号是否正确");
                  result.put("response", ConstantUtils.FAIL);
                  return result.toJSONString();
              }
            }
            baseDoctorDO.setPassword(oldDoctor.getPassword());
            baseDoctorDO.setEnabled(baseDoctorDO.getDel().equalsIgnoreCase("1")?1:0);
        } catch (IOException e) {

+ 1 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/OverdueJob.java

@ -27,7 +27,7 @@ import java.util.List;
@EnableScheduling
public class OverdueJob implements SchedulingConfigurer {
    private static final Logger logger = LoggerFactory.getLogger(OverdueJob.class);
    private static String cron = "0 */5 * * * ?";//"0 0 0 * * ?";
    private static String cron = "0 */5 * * * ?";//"0 0 0 * * ?";0 */5 * * * ?
    public OverdueJob(){
        cron="0 */5 * * * ?";
        System.out.println("初始化时的corn"+cron);

+ 5 - 9
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -208,9 +208,6 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
				if ("1".equalsIgnoreCase(outpatientDO.getOutpatientType())){
					if("2".equalsIgnoreCase(outpatientDO.getType())){
						consult.setType(16);//视频复诊
						if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
							prescriptionService.sendWxTemplateMsg(wxId,outpatientCode,null,"16","outpatientMsgRemind","");
						}
					}else{
						consult.setType(9);//图文复诊
					}
@ -219,9 +216,6 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
				}else if ("3".equalsIgnoreCase(outpatientDO.getOutpatientType())){
					if("2".equalsIgnoreCase(outpatientDO.getType())){
						consult.setType(17);//视频咨询
						if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
							prescriptionService.sendWxTemplateMsg(wxId,outpatientCode,null,"17","outpatientMsgRemind","");
						}
					}else if ("1".equalsIgnoreCase(outpatientDO.getType())){
						consult.setType(1);//图文咨询
					}
@ -252,7 +246,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
							rsCode="0";
							mes="已挂号";
						}
						if ("1".equalsIgnoreCase(outpatientDO.getOutpatientType())){
						/*if ("1".equalsIgnoreCase(outpatientDO.getOutpatientType())){
							if ("2".equalsIgnoreCase(outpatientDO.getType())){
								prescriptionService.sendWxTemplateMsg(wxId,outpatientCode,null,"16","outpatientMsgRemind","");
							}
@ -261,7 +255,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
							if ("2".equalsIgnoreCase(outpatientDO.getType())){
								prescriptionService.sendWxTemplateMsg(wxId,outpatientCode,null,"17","outpatientMsgRemind","");
							}
						}
						}*/
					}else {
						if (demoFlag.equalsIgnoreCase("true")){
@ -917,7 +911,9 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		result.put("imgConsultCount",prescriptionService.getWaitVideoCount(doctor,"1","3",wxId));//图文咨询数量
		result.put("videoConsultCount",prescriptionService.getWaitVideoCount(doctor,"2","3",wxId));//视频咨询数量
		result.put("homeConsultCount",prescriptionService.getWaitVideoCount(doctor,"3","3",wxId));//家医咨询数量
		result.put("doorServiceCount",prescriptionService.waitUpdoorCount(doctor));//上门服务数量
		if ("sd_tnzyy_wx".equalsIgnoreCase(wxId)){
            result.put("doorServiceCount",prescriptionService.waitUpdoorCount(doctor));//上门服务数量
        }
		logger.info("action:doctorReviewConsultCount--end:"+DateUtil.dateToStrLong(new Date()));
		return success("请求成功",result);
	}

+ 36 - 7
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java

@ -1,8 +1,6 @@
package com.yihu.jw.hospital.endpoint.hospital;
import com.alibaba.fastjson.JSONObject;
import com.sun.media.jfxmedia.logging.Logger;
import com.yihu.jw.entity.base.doctor.BaseDoctorBackgroundDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
@ -18,9 +16,9 @@ import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.sms.service.ZBSmsService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -29,11 +27,11 @@ import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import java.util.ArrayList;
@ -68,6 +66,8 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
    @Autowired
    private ZBSmsService zbSmsService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Value("${wechat.id}")
    private String wxId;
@ -91,6 +91,15 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
        String medicareType = obj.getString("medicareType");
        String medicare = obj.getString("medicare");
        String clinicId = obj.getString("clinicId");
        /*String key = obj.getString("key");
        String text = obj.getString("text");
        if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
            if(!verifyCaptcha(key,text)){
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("图形验证码输入错误");
                return mixEnvelop;
            }
        }*/
        net.sf.json.JSONArray jsonArray = new JSONArray();
        if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            jsonArray = ykyyEntranceService.findHisPatientBymMedicare(medicare,clinicId,false);
@ -241,6 +250,17 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
                    mixEnvelop.setMessage("验证码发送失败");
                    mixEnvelop.setStatus(500);
                }
            }else if("sd_tnzyy_wx".equalsIgnoreCase(wxId)){
                //发送短信获取验证码
                String content = captcha;
                int result =  zbSmsService.sendMessage(phoneNum,content);
                if (0 == result) {
                    this.store(client_id, phoneNum, captcha, 120);
                    mixEnvelop.setMessage("验证码发送成功");
                } else {
                    mixEnvelop.setMessage("验证码发送失败");
                    mixEnvelop.setStatus(500);
                }
            }
        }
@ -375,4 +395,13 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
                                    @RequestParam(value = "id", required = false) String id) throws ParseException {
        return success(wlyyFamilyMemberService.findMemberById(id));
    }
    public boolean verifyCaptcha(String key,String text){
        boolean pass = false;
        String captcha = redisTemplate.opsForValue().get(key).toString();
        if (org.apache.commons.lang3.StringUtils.isNotBlank(captcha)&& captcha.equals(text.toLowerCase())){
            pass = true;
            redisTemplate.delete(key);
        }
        return pass;
    }
}