Browse Source

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

# Conflicts:
#	common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
wangzhinan 2 years ago
parent
commit
9ba730a571

+ 294 - 30
business/base-service/src/main/java/com/yihu/jw/healthUpload/service/BaseDoctorHealthUploadService.java

@ -1,4 +1,5 @@
package com.yihu.jw.healthUpload.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.sun.org.apache.bcel.internal.generic.NEW;
@ -16,9 +17,11 @@ import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
import com.yihu.jw.entity.healthUpload.BaseDoctorHealthUploadDO;
import com.yihu.jw.entity.healthUpload.BaseDoctorMemberDO;
import com.yihu.jw.entity.hospital.DmHospitalDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.dict.BaseDeptDict;
import com.yihu.jw.healthUpload.dao.BaseDoctorHealthUploadDao;
import com.yihu.jw.healthUpload.dao.BaseDoctorMemberDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.util.common.PwdUtil;
@ -78,6 +81,8 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
    private HibenateUtils hibenateUtils;
    @Value("${wechat.id}")
    private String wechatId;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    /**
     * 新增医生成员关系
@ -201,36 +206,94 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
                for (BaseDoctorRoleDO roleDO : roleDOS) {
                    BaseDoctorDO doctorDO = baseDoctorDao.findById(roleDO.getDoctorCode());
                    if (doctorDO != null) {
                        if (!StringUtils.isNoneBlank(doctorDO.getOpenid())) {
                            logger.info("该用户" + doctorDO.getName() + "没有openid,无法推送模版消息,用户ID:" + doctorDO.getId() + "wechatId:xm_mlwyy_wx");
                        } else {
                            WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus("xm_mlwyy_wx", "template_unusual_notice", "jkzlyctxtz", 1);
                            WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
                            BeanUtils.copyProperties(config, newConfig);
                            if (doctorHospitalDOS != null && doctorHospitalDOS.size() != 0) {
                                newConfig.setFirst(config.getFirst().replace("key1", doctorHospitalDOS.get(0).getDeptName()).replace("key2", baseDoctorHealthUploadDO.getDoctorName()));
                        WlyyHospitalSysDictDO hospitalSysDictDO  = hospitalSysDictDao.findById("isYichangRemind");
                        if (hospitalSysDictDO!=null){
                            String value = hospitalSysDictDO.getDictValue();
                            if (StringUtils.isNoneBlank(value)){
                                JSONObject object = JSONObject.parseObject(value);
                                String close = object.getString("close");
                                String time = object.getString("time");
                                String count =object.getString("count");
                                if (!close.equalsIgnoreCase("1")){
                                    String startEnd = DateUtil.getPreTime(DateUtil.getStringDate(),time);
                                    String sql = "select count(1) as total from wx_push_log where create_time >='"+startEnd+"' ";
                                    Map<String,Object> map = jdbcTemplate.queryForMap(sql);
                                    Integer total = 0;
                                    if (map!=null){
                                        if (map.get("total")!=null){
                                            total = Integer.parseInt(map.get("total").toString());
                                        }
                                    }
                                    logger.info("startEnd:"+startEnd+total);
                                    if (StringUtils.isNoneBlank(count)){
                                        if (total<Integer.parseInt(count)){
                                            if (!StringUtils.isNoneBlank(doctorDO.getOpenid())) {
                                                logger.info("该用户" + doctorDO.getName() + "没有openid,无法推送模版消息,用户ID:" + doctorDO.getId() + "wechatId:xm_mlwyy_wx");
                                            } else {
                                                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus("xm_mlwyy_wx", "template_unusual_notice", "jkzlyctxtz", 1);
                                                WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
                                                BeanUtils.copyProperties(config, newConfig);
                                                if (doctorHospitalDOS != null && doctorHospitalDOS.size() != 0) {
                                                    newConfig.setFirst(config.getFirst().replace("key1", doctorHospitalDOS.get(0).getDeptName()).replace("key2", baseDoctorHealthUploadDO.getDoctorName()));
                                                } else {
                                                    newConfig.setFirst(config.getFirst().replace("key1的", "").replace("key2", baseDoctorHealthUploadDO.getDoctorName()));
                                                }
                                                newConfig.setKeyword2(baseDoctorHealthUploadDO.getDoctorName());
                                                newConfig.setKeyword3(DateUtil.getStringDate());
                                                newConfig.setUrl("https://ehr.yihu.com/hlwyy/healthMonitoring/#/health/commit?id=" + baseDoctorHealthUploadDO.getId() + "&docCode=" + baseDoctorHealthUploadDO.getDoctorId() + "");
                                                WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById("xm_mlwyy_wx");
                                                logger.info("=======setUrl========" + newConfig.getUrl());
                                                weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), doctorDO.getOpenid(), newConfig);
                                            }
                                            //保存发送模板记录,
                                            WxPushLogDO wxPushLogDO = new WxPushLogDO();
                                            wxPushLogDO.setCreateTime(new Date());
                                            wxPushLogDO.setOpenid(doctorDO.getOpenid());
                                            wxPushLogDO.setReceiver(doctorDO.getId());
                                            wxPushLogDO.setWechatId("xm_mlwyy_wx");
                                            wxPushLogDO.setReceiverName(doctorDO.getName());
                                            wxPushLogDO.setScene("jkzlyctxtz");
                                            wxPushLogDao.save(wxPushLogDO);
                                        }
                                    }
                                }
                            }
                        }else {
                            if (!StringUtils.isNoneBlank(doctorDO.getOpenid())) {
                                logger.info("该用户" + doctorDO.getName() + "没有openid,无法推送模版消息,用户ID:" + doctorDO.getId() + "wechatId:xm_mlwyy_wx");
                            } else {
                                newConfig.setFirst(config.getFirst().replace("key1的", "").replace("key2", baseDoctorHealthUploadDO.getDoctorName()));
                                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus("xm_mlwyy_wx", "template_unusual_notice", "jkzlyctxtz", 1);
                                WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
                                BeanUtils.copyProperties(config, newConfig);
                                if (doctorHospitalDOS != null && doctorHospitalDOS.size() != 0) {
                                    newConfig.setFirst(config.getFirst().replace("key1", doctorHospitalDOS.get(0).getDeptName()).replace("key2", baseDoctorHealthUploadDO.getDoctorName()));
                                } else {
                                    newConfig.setFirst(config.getFirst().replace("key1的", "").replace("key2", baseDoctorHealthUploadDO.getDoctorName()));
                                }
                                newConfig.setKeyword2(baseDoctorHealthUploadDO.getDoctorName());
                                newConfig.setKeyword3(DateUtil.getStringDate());
                                newConfig.setUrl("https://ehr.yihu.com/hlwyy/healthMonitoring/#/health/commit?id=" + baseDoctorHealthUploadDO.getId() + "&docCode=" + baseDoctorHealthUploadDO.getDoctorId() + "");
                                WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById("xm_mlwyy_wx");
                                logger.info("=======setUrl========" + newConfig.getUrl());
                                weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), doctorDO.getOpenid(), newConfig);
                            }
                            newConfig.setKeyword2(baseDoctorHealthUploadDO.getDoctorName());
                            newConfig.setKeyword3(DateUtil.getStringDate());
                            newConfig.setUrl("https://ehr.yihu.com/hlwyy/healthMonitoring/#/health/commit?id=" + baseDoctorHealthUploadDO.getId() + "&docCode=" + baseDoctorHealthUploadDO.getDoctorId() + "");
                            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById("xm_mlwyy_wx");
                            logger.info("=======setUrl========" + newConfig.getUrl());
                            weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), doctorDO.getOpenid(), newConfig);
                            //保存发送模板记录,
                            WxPushLogDO wxPushLogDO = new WxPushLogDO();
                            wxPushLogDO.setCreateTime(new Date());
                            wxPushLogDO.setOpenid(doctorDO.getOpenid());
                            wxPushLogDO.setReceiver(doctorDO.getId());
                            wxPushLogDO.setWechatId("xm_mlwyy_wx");
                            wxPushLogDO.setReceiverName(doctorDO.getName());
                            wxPushLogDO.setScene("jkzlyctxtz");
                            wxPushLogDao.save(wxPushLogDO);
                        }
                        //保存发送模板记录,
                        WxPushLogDO wxPushLogDO = new WxPushLogDO();
                        wxPushLogDO.setCreateTime(new Date());
                        wxPushLogDO.setOpenid(doctorDO.getOpenid());
                        wxPushLogDO.setReceiver(doctorDO.getId());
                        wxPushLogDO.setWechatId("xm_mlwyy_wx");
                        wxPushLogDO.setReceiverName(doctorDO.getName());
                        wxPushLogDO.setScene("jkzlyctxtz");
                        wxPushLogDao.save(wxPushLogDO);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
@ -414,14 +477,24 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
            //今日上报人次
            sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' ";
            //今日异常人次
            yichangSql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)";
            yichangSql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from ( SELECT\n" +
                    "\td3.*\n" +
                    "FROM\n" +
                    "\t( SELECT *,MAX(d1.create_time) as createTime FROM base_doctor_health_upload d1 GROUP BY\n" +
                    "\td1.doctor_id ) d2\n" +
                    "LEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id=d3.doctor_id AND  d2.createTime = d3.create_time  ) d where 1=1 and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)";
        } else if (level == 2) {
            //总人次
            doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 and id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )";
            //今日上报人次
            sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59'";
            //今日异常人次
            yichangSql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)";
            yichangSql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from ( SELECT\n" +
                    "\td3.*\n" +
                    "FROM\n" +
                    "\t( SELECT *,MAX(d1.create_time) as createTime FROM base_doctor_health_upload d1 GROUP BY\n" +
                    "\td1.doctor_id ) d2\n" +
                    "LEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id=d3.doctor_id AND  d2.createTime = d3.create_time  ) d where 1=1 and doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)";
        }
        //今日提交
        int personTotal = 0;
@ -670,7 +743,137 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
     * @return
     */
    public List<Map<String, Object>> selectHeaderList(String dept, String idType, String status, String state, String startDate, String endDate, String name) {
        String deptSql = " select code,name from dict_hospital_dept hd where hd.consult_dept_flag=1 ";
        String condition = "";
        if (StringUtils.isNoneBlank(startDate)) {
            condition += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' ";
        }
        String doctorSql = "";
        if (StringUtils.isNoneBlank(idType)) {
            doctorSql += " and d.id_type = '" + idType + "' ";
        }
        if (StringUtils.isNoneBlank(name)) {
            doctorSql += " and d.name like '%" + name + "%' ";
        }
        String sql = "";
        if (StringUtils.isNoneBlank(state)) {
            if (state.equalsIgnoreCase("1")) {
                sql += " and (d.health_code not in(2,3) and CAST(d.temperature as DECIMAL)<37.3 and  d.is_symptoms=2 and d.is_epidemic=2) ";
            } else if (state.equalsIgnoreCase("2")) {
                sql += " and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1) ";
            }
        }
        String idTypeCondition = " ";
        if (StringUtils.isNoneBlank(idType)) {
            idTypeCondition += "  (select d1.id from base_doctor d1 where 1=1 and d1.id_type = '" + idType + "')";
        }
        if (StringUtils.isNoneBlank(idTypeCondition)) {
            sql += " and d.doctor_id IN " + idTypeCondition;
        }
        if (StringUtils.isNoneBlank(name)) {
            sql += " and d.doctor_name like '%" + name + "%'";
        }
        String ycandzcSql = "";
        if (StringUtils.isNoneBlank(idTypeCondition)) {
            ycandzcSql += " and d.doctor_id IN " + idTypeCondition;
        }
        if (StringUtils.isNoneBlank(name)) {
            ycandzcSql += " and d.doctor_name like '%" + name + "%'";
        }
        String deptSql = "SELECT\n" +
                "\tcode,\n" +
                "\tname,\n" +
                "\tdh1.total,\n" +
                "\tdh2.total as yishangbaoTotal,\n" +
                "\tdh3.total as shangchuanTotal,\n" +
                "\tdh4.total as zhengchangTotal,\n" +
                "\tdh5.total as yichangTotal,\n" +
                "\tdh6.total as yichangPersonTotal\n" +
                "FROM\n" +
                "\tdict_hospital_dept hd\n" +
                "LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tdh.dept_code,\n" +
                "\t\tCOUNT(1) AS \"total\"\n" +
                "\tFROM\n" +
                "\t\tbase_doctor d\n" +
                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id\n" +
                "\tWHERE\n" +
                "\t\td.del = 1\n" +
                "\tAND dh.del = 1\n" +
                doctorSql+
                "\tGROUP BY\n" +
                "\t\tdh.dept_code\n" +
                ") dh1 ON hd. CODE = dh1.dept_code\n" +
                "LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tdh.dept_code,\n" +
                "\t\tCOUNT(DISTINCT d.doctor_id) AS total\n" +
                "\tFROM\n" +
                "\t\tbase_doctor_health_upload d\n" +
                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" +
                "\tWHERE\n" +
                "\t\t1 = 1\n" +
              condition+ sql+
                "\tGROUP BY\n" +
                "\t\tdh.dept_code\n" +
                ")dh2 ON dh2.dept_code=hd.code\n" +
                "LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tdh.dept_code,\n" +
                "\t\tCOUNT(1) AS total\n" +
                "\tFROM\n" +
                "\t\tbase_doctor_health_upload d\n" +
                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" +
                "\tWHERE\n" +
                "\t\t1 = 1\n" +
                condition+ sql+
                "\tGROUP BY\n" +
                "\t\tdh.dept_code\n" +
                ")dh3 ON dh3.dept_code=hd.code\n" +
                "LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tdh.dept_code,\n" +
                "\t\tCOUNT(1) AS total\n" +
                "\tFROM\n" +
                "\t\tbase_doctor_health_upload d\n" +
                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" +
                "\tWHERE\n" +
                "\t\t1 = 1\n" +
                "\tand (d.health_code not in(2,3) AND CAST(d.temperature as DECIMAL)<37.3 AND  d.is_symptoms=2 and  d.is_epidemic=2)\n" +
                condition+ycandzcSql+
                "\tGROUP BY\n" +
                "\t\tdh.dept_code\n" +
                ")dh4 ON dh4.dept_code=hd.code\n" +
                "LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tdh.dept_code,\n" +
                "\t\tCOUNT(1) AS total\n" +
                "\tFROM\n" +
                "\t\tbase_doctor_health_upload d\n" +
                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" +
                "\tWHERE\n" +
                "\t\t1 = 1\n" +
                "\tand (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)\n" +
                condition+ycandzcSql+
                "\tGROUP BY\n" +
                "\t\tdh.dept_code\n" +
                ")dh5 ON dh5.dept_code=hd.code\n" +
                "LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tdh.dept_code,\n" +
                "\t\tCOUNT(DISTINCT d.doctor_id) AS total\n" +
                "\tFROM\n" +
                "\t\tbase_doctor_health_upload d\n" +
                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" +
                "\tWHERE\n" +
                "\t\t1 = 1\n" +
                "\tand (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)\n" +
                condition+ycandzcSql+
                "\tGROUP BY\n" +
                "\t\tdh.dept_code\n" +
                ")dh6 ON dh6.dept_code=hd.code\n" +
                "WHERE\n" +
                "\thd.consult_dept_flag = 1 ";
        if (StringUtils.isNoneBlank(name)) {
            deptSql += " and hd.code IN(SELECT dha.dept_code FROM base_doctor_hospital dha LEFT JOIN base_doctor da ON da.id=dha.doctor_code where da.name LIKE '%" + name + "%') ";
        }
@ -678,6 +881,62 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
            deptSql += " and hd.code = '" + dept + "' ";
        }
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(deptSql);
        for (Map<String,Object> deptMap:mapList){
            String day = DateUtil.getTwoDay(endDate, startDate);
            Integer total = 0;
            Integer yishangbaoTotal = 0;
            Integer weishangbaoTotal = 0;
            Integer zhengchangTotal = 0;
            Integer yichangTotal = 0;
            Integer shangchuanTotal = 0;
            Integer yichangPersonTotal = 0;
            if (deptMap.get("total")!=null){
                String doctorTotal = deptMap.get("total").toString();
                //总人次
                if (!day.equalsIgnoreCase("0")) {
                    total = Integer.parseInt(doctorTotal) * Integer.parseInt(day);
                } else {
                    total = Integer.parseInt(doctorTotal);
                }
            }
            if (deptMap.get("yishangbaoTotal")!=null){
                yishangbaoTotal = Integer.parseInt(deptMap.get("yishangbaoTotal").toString());
            }
            //未上报
            weishangbaoTotal = total - yishangbaoTotal;
            if (deptMap.get("zhengchangTotal")!=null){
                zhengchangTotal = Integer.parseInt(deptMap.get("zhengchangTotal").toString());
            }
            if (deptMap.get("yichangTotal")!=null){
                yichangTotal = Integer.parseInt(deptMap.get("yichangTotal").toString());
            }
            if (deptMap.get("yichangPersonTotal")!=null){
                yichangPersonTotal = Integer.parseInt(deptMap.get("yichangPersonTotal").toString());
            }
            if (deptMap.get("shangchuanTotal")!=null){
                shangchuanTotal = Integer.parseInt(deptMap.get("shangchuanTotal").toString());
            }
            JSONObject object = new JSONObject();
            object.put("total", total);//总人次
            object.put("yishangbaoTotal", yishangbaoTotal);//已上报
            object.put("weishangbaoTotal", weishangbaoTotal);//未上报
            object.put("zhengchangTotal", zhengchangTotal);//上报正常
            object.put("yichangTotal", yichangTotal);//上报异常
            object.put("yichangPersonTotal", yichangPersonTotal);//上报人异常
            object.put("shangchuanTotal", shangchuanTotal);//上传总次数
            deptMap.put("tongyishuju", object);
        }
        /*  String deptSql = " select code,name from dict_hospital_dept hd where hd.consult_dept_flag=1 ";
        if (StringUtils.isNoneBlank(name)) {
            deptSql += " and hd.code IN(SELECT dha.dept_code FROM base_doctor_hospital dha LEFT JOIN base_doctor da ON da.id=dha.doctor_code where da.name LIKE '%" + name + "%') ";
        }
        if (StringUtils.isNoneBlank(dept)) {
            deptSql += " and hd.code = '" + dept + "' ";
        }*/
       /* List<Map<String, Object>> mapList = jdbcTemplate.queryForList(deptSql);
        for (Map<String, Object> deptmap : mapList) {
            String deptCode = deptmap.get("code").toString();
            JSONObject object = new JSONObject();
@ -818,7 +1077,12 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
                }
            }
            String sqlDistintYichang = "select COUNT(DISTINCT doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)  ";
            String sqlDistintYichang = "select COUNT(DISTINCT doctor_id) as \"total\" from (SELECT\n" +
                    "\td3.*\n" +
                    "FROM\n" +
                    "\t( SELECT *,MAX(d1.create_time) as createTime FROM base_doctor_health_upload d1 GROUP BY\n" +
                    "\td1.doctor_id ) d2\n" +
                    "LEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id=d3.doctor_id AND  d2.createTime = d3.create_time  ) d where 1=1 and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)  ";
            if (StringUtils.isNoneBlank(startDate)) {
                sqlDistintYichang += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' ";
            }
@ -847,7 +1111,7 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
            object.put("yichangPersonTotal", yichangPersonTotal);//上报人异常
            object.put("shangchuanTotal", shangchuanTotal);//上传总次数
            deptmap.put("tongyishuju", object);
        }
        }*/
        return mapList;
    }

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

@ -303,16 +303,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private PayInfoNoticeService payInfoNoticeService;
    @Autowired
    private BaseJobCategoryDao jobCategoryDao;
    @Autowired
    private BaseSmsTemplateDao smsTemplateDao;
    @Autowired
    private YkyySMSService ykyySMSService;
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
    @Autowired
    private BaseJpushTemplateDao baseJpushTemplateDao;
    /*@Autowired
    HikariDataSource dataSource;*/
    @Autowired
    private BaseSensitiveDao baseSensitiveDao;
    @Autowired
@ -332,8 +329,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private YlzMedicailMxDao ylzMedicailMxDao;
    @Autowired
    private WlyyNatPatientFamilyMemberDao natPatientFamilyMemberDao;
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    @Autowired
    private HcyyEntranceService hcyyEntranceService;
@ -3390,6 +3385,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " e.oneself_pickup_flg AS \"oneselfPickupFlg\", " +
                " o.id AS \"outpatientId\", " +
                " o.icd10_name AS \"icd10Name\", " +
                " o.medical_state AS \"medicalState\", " +
                " p.status as \"status\", " +
                " p.id AS \"prescriptionId\" ," +
                " e.id AS \"expressageId\" ," +
@ -3555,6 +3551,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " e.oneself_pickup_flg AS \"oneselfPickupFlg\", " +
                " o.id AS \"outpatientId\", " +
                " o.icd10_name AS \"icd10Name\", " +
                " o.medical_state AS \"medicalState\", " +
                " p.status as \"status\", " +
                " p.id AS \"prescriptionId\" ," +
                " e.id AS \"expressageId\" ,"+
@ -3634,7 +3631,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            WritableSheet ws;
            ws = wwb.createSheet("sheet", 1);
            String[] header = {"订单日期", "处方编号", "就诊人姓名", "收货人", "订单药品", "配送方式", "支付时间", "是否开方", "订单状态"};//"订单日期", "收货人", "诊断结果", "配送方式", "订单状态"
            String[] header = {"订单日期", "处方编号", "就诊人姓名", "收货人", "订单药品", "配送方式", "支付时间", "是否开方", "订单状态","是否医保"};//"订单日期", "收货人", "诊断结果", "配送方式", "订单状态"
            int k = 0;
            for (String h : header) {
                addCell(ws, 0, k, h);//表名,行,列,header
@ -3651,7 +3648,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }else {
                    createTime = "是";
                }
                String medicalStateName = "";
                if (m.get("medicalState") == null) {
                    medicalStateName = "否";
                }else {
                    String medicalState = m.get("medicalState").toString();
                    if (medicalState.equalsIgnoreCase("1")){
                        medicalStateName = "是";
                    }else {
                        medicalStateName = "否";
                    }
                }
                String opf = "";
                if (m.get("oneselfPickupFlg") == null) {
                    opf = null;
@ -3715,6 +3722,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                addCell(ws, i, 6, m.get("payTime")!=null?m.get("payTime").toString():n);
                addCell(ws, i, 7, createTime!=null?createTime:n);
                addCell(ws, i, 8, status!=null?status:n);
                addCell(ws, i, 9, medicalStateName!=null?medicalStateName:n);
                i++;
            }
            wwb.write();
@ -14906,7 +14914,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    /**
     * 药品明细表导出
     * @param osmergeCells(a,b,c,d)
     *
     * @param ls
     * @param startTime
     * @param endTime

+ 41 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java

@ -13,6 +13,8 @@ import com.yihu.jw.util.common.StringUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.idcard.IdCardUtil;
import com.yihu.utils.security.MD5;
import com.ylzinfo.ehc.common.utils.DateUtils;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.collections.map.HashedMap;
@ -906,4 +908,43 @@ public class YkyyService {
        logger.info("获取门诊结算信息:"+response);
        return response;
    }
    public static String key = "HXYKT123!@#";
    /**
     * 根据手机号码获取医生密码
     * @param mobile 手机号
     * @return
     */
    public String getDoctorPhone(String mobile){
        String response="";
        long timespan = System.currentTimeMillis();
        String sceret = MD5.md5Hex(mobile+timespan+key);
        String url=yktUrl+"doctor/get_doctor_pwd_by_tel?tel="+mobile+"&timespan="+timespan+"&token="+sceret;
        logger.info("根据手机号码获取医生密码="+url);
        response = httpClientUtil.get(url,"UTF-8");
        logger.info("根据手机号码获取医生密码"+response);
        return response;
    }
    /**
     * 根据手机号码获取患者密码
     * @param mobile 手机号
     * @return
     */
    public String getPatientPhone(String mobile){
        String response="";
        long timespan = System.currentTimeMillis();
        String sceret = MD5.md5Hex(mobile+timespan+key);
        String url=yktUrl+"api/patient/get_patient_pwd_by_tel?tel="+mobile+"&timespan="+timespan+"&token="+sceret;
        logger.info("根据手机号码获取患者密码="+url);
        response = httpClientUtil.get(url,"UTF-8");
        logger.info("根据手机号码获取患者密码"+response);
        return response;
    }
}

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

@ -4076,6 +4076,7 @@ public class ImService {
                "op.doctor as \"doctor\" ," +
                "op.source as \"source\"  ," +
                "op.card_no as \"cardNo\"  ," +
                "op.medical_state as \"medicalState\"  ," +
                "op.patient_cancel_value as \"patientCancelValue\" ," +
                "op.patient_cancel_remark as \"patient_cancel_remark\"  " +
                "FROM wlyy_outpatient op LEFT JOIN wlyy_consult a  ON a.relation_code = op.id \n" +

+ 1 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java

@ -25,9 +25,7 @@ public abstract class IntegerIdentityEntity implements Serializable {
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
/*
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
*/
/*   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 11 - 0
gateway/ag-basic/src/main/resources/application.yml

@ -349,3 +349,14 @@ spring:
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
---
spring:
  profiles: jwZnygProdIn
  datasource:
     url: jdbc:mysql://10.95.22.191:3406/medicine?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
     username: wlyy
     password: qY#j2n5O
  redis:
     host: 10.95.22.142
     port: 6380
     password: jkzlehr

+ 9 - 1
gateway/ag-basic/src/main/resources/bootstrap.yml

@ -185,4 +185,12 @@ spring:
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}
      label: ${wlyy.spring.config.label:master}
---
spring:
  profiles: jwZnygProdIn
  cloud:
    config:
      uri: ${wlyy-spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy-spring.config.label:jwdev}

+ 117 - 58
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/HealthUploadService.java

@ -274,13 +274,92 @@ public class HealthUploadService {
        //管理员
        for (BaseDoctorRoleDO adminRole:adminRoleList){
            BaseDoctorDO doctorDO = doctorDao.findById(adminRole.getDoctorCode());
            WxEnterpriseUserDO enterpriseUserDO = wxEnterpriseUserDao.findByEnterpriseIdAndMobile(wechatId,doctorDO.getMobile());
            if(enterpriseUserDO==null){
                logger.info("该用户"+doctorDO.getName()+"没有企业微信手机号,无法推送模版消息,用户ID:"+doctorDO.getId()+"wechatId:"+wechatId);
            //总人数
            Integer doctorTotal=0;
            String doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
            Map<String, Object> doctorMap = jdbcTemplate.queryForMap(doctorSql);
            if (doctorMap != null) {
                if (doctorMap.get("total") != null) {
                    doctorTotal = Integer.parseInt(doctorMap.get("total").toString());
                }
            }
            if (doctorMap != null) {
                if (doctorMap.get("total") != null) {
                    doctorTotal = Integer.parseInt(doctorMap.get("total").toString());
                }
            }
            String nowDate = DateUtil.getStringDateShort();
            //已上报人数
            Integer sqlTotal = 0;
            String sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' ";
            Map<String, Object> sqlMap = jdbcTemplate.queryForMap(sql);
            if (sqlMap != null) {
                if (sqlMap.get("total") != null) {
                    sqlTotal = Integer.parseInt(sqlMap.get("total").toString());
                }
            }
            //异常人数
            //今日异常人次
            String yichangSql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)";
            Integer yichangTotal=0;
            Map<String, Object> yichangMap = jdbcTemplate.queryForMap(yichangSql);
            if (yichangMap != null) {
                if (yichangMap.get("total") != null) {
                    yichangTotal = Integer.parseInt(yichangMap.get("total").toString());
                }
            }
            Integer weishangbaoTotal = doctorTotal-sqlTotal;
            String title = "每日健康上报汇总";
            String des = "今日上报情况:已上报:"+sqlTotal+",未上报:"+weishangbaoTotal+",异常:"+yichangTotal+";点击查看。";
            if(wechatId.equalsIgnoreCase("xm_mlwyy_wx")){
                if (doctorDO!=null){
                    if(!StringUtils.isNoneBlank(doctorDO.getOpenid())){
                        logger.info("该用户"+doctorDO.getName()+"没有openid,无法推送模版消息,用户ID:"+doctorDO.getId()+"wechatId:"+wechatId);
                    }else{
                        String date = DateUtil.getStringDateShort();
                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_tjjg_notice","jksbhztj",1);
                        WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
                        BeanUtils.copyProperties(config,newConfig);
                        String des1 = "今日上报情况:已上报:"+sqlTotal+",未上报:"+weishangbaoTotal+",异常:"+yichangTotal+"。";
                        newConfig.setKeyword1(des1);
                        newConfig.setKeyword2(date);
                        WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
                        logger.info("=======setUrl========"+newConfig.getUrl());
                        weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(),doctorDO.getOpenid(),newConfig);
                    }
                    //保存发送模板记录,
                    WxPushLogDO wxPushLogDO = new WxPushLogDO();
                    wxPushLogDO.setCreateTime(new Date());
                    wxPushLogDO.setOpenid(doctorDO.getOpenid());
                    wxPushLogDO.setReceiver(doctorDO.getId());
                    wxPushLogDO.setWechatId(wechatId);
                    wxPushLogDO.setReceiverName(doctorDO.getName());
                    wxPushLogDO.setScene("jkzldbxmtz");
                    wxPushLogDao.save(wxPushLogDO);
                }
            }else{
                if (doctorDO!=null){
                    WxEnterpriseUserDO enterpriseUserDO = wxEnterpriseUserDao.findByEnterpriseIdAndMobile(wechatId,doctorDO.getMobile());
                    if(enterpriseUserDO==null){
                        logger.info("该用户"+doctorDO.getName()+"没有企业微信手机号,无法推送模版消息,用户ID:"+doctorDO.getId()+"wechatId:"+wechatId);
                    }else{
                        String url = "https://ehr.yihu.com/hlwyy/zjxl/healthMonitoring/#/home/index";
                        String res = enterpriseService.sendTWMesByDoctor(wechatId,doctorDO.getId(),title,des,url);
                    }
                }
            }
        }
        //科室管理员
        for (BaseDoctorRoleDO deptRole:deptAdminRoleList){
            BaseDoctorDO doctorDO = doctorDao.findById(deptRole.getDoctorCode());
            List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(deptRole.getDoctorCode());
            if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
                String dept = doctorHospitalDOS.get(0).getDeptCode();
                //总人数
                Integer doctorTotal=0;
                String doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
                String doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 and id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )";
                Map<String, Object> doctorMap = jdbcTemplate.queryForMap(doctorSql);
                if (doctorMap != null) {
                    if (doctorMap.get("total") != null) {
@ -295,7 +374,7 @@ public class HealthUploadService {
                String nowDate = DateUtil.getStringDateShort();
                //已上报人数
                Integer sqlTotal = 0;
                String sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' ";
                String sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59'";
                Map<String, Object> sqlMap = jdbcTemplate.queryForMap(sql);
                if (sqlMap != null) {
                    if (sqlMap.get("total") != null) {
@ -304,7 +383,7 @@ public class HealthUploadService {
                }
                //异常人数
                //今日异常人次
                String yichangSql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)";
                String yichangSql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)";
                Integer yichangTotal=0;
                Map<String, Object> yichangMap = jdbcTemplate.queryForMap(yichangSql);
                if (yichangMap != null) {
@ -315,62 +394,42 @@ public class HealthUploadService {
                Integer weishangbaoTotal = doctorTotal-sqlTotal;
                String title = "每日健康上报汇总";
                String des = "今日上报情况:已上报:"+sqlTotal+",未上报:"+weishangbaoTotal+",异常:"+yichangTotal+";点击查看。";
                String url = "https://ehr.yihu.com/hlwyy/zjxl/healthMonitoring/#/home/index";
                String res = enterpriseService.sendTWMesByDoctor(wechatId,doctorDO.getId(),title,des,url);
            }
        }
        //科室管理员
        for (BaseDoctorRoleDO deptRole:deptAdminRoleList){
            BaseDoctorDO doctorDO = doctorDao.findById(deptRole.getDoctorCode());
            WxEnterpriseUserDO enterpriseUserDO = wxEnterpriseUserDao.findByEnterpriseIdAndMobile(wechatId,doctorDO.getMobile());
            if(enterpriseUserDO==null){
                logger.info("该用户"+doctorDO.getName()+"没有企业微信手机号,无法推送模版消息,用户ID:"+doctorDO.getId()+"wechatId:"+wechatId);
            }else{
                List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(deptRole.getDoctorCode());
                if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
                    String dept = doctorHospitalDOS.get(0).getDeptCode();
                    //总人数
                    Integer doctorTotal=0;
                    String doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 and id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )";
                    Map<String, Object> doctorMap = jdbcTemplate.queryForMap(doctorSql);
                    if (doctorMap != null) {
                        if (doctorMap.get("total") != null) {
                            doctorTotal = Integer.parseInt(doctorMap.get("total").toString());
                        }
                    }
                    if (doctorMap != null) {
                        if (doctorMap.get("total") != null) {
                            doctorTotal = Integer.parseInt(doctorMap.get("total").toString());
                        }
                if(wechatId.equalsIgnoreCase("xm_mlwyy_wx")){
                    if(!StringUtils.isNoneBlank(doctorDO.getOpenid())){
                        logger.info("该用户"+doctorDO.getName()+"没有openid,无法推送模版消息,用户ID:"+doctorDO.getId()+"wechatId:"+wechatId);
                    }else{
                        String date = DateUtil.getStringDateShort();
                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_tjjg_notice","jksbhztj",1);
                        WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
                        BeanUtils.copyProperties(config,newConfig);
                        String des1 = "今日上报情况:已上报:"+sqlTotal+",未上报:"+weishangbaoTotal+",异常:"+yichangTotal+"。";
                        newConfig.setKeyword1(des1);
                        newConfig.setKeyword2(date);
                        WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
                        logger.info("=======setUrl========"+newConfig.getUrl());
                        weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(),doctorDO.getOpenid(),newConfig);
                    }
                    String nowDate = DateUtil.getStringDateShort();
                    //已上报人数
                    Integer sqlTotal = 0;
                    String sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59'";
                    Map<String, Object> sqlMap = jdbcTemplate.queryForMap(sql);
                    if (sqlMap != null) {
                        if (sqlMap.get("total") != null) {
                            sqlTotal = Integer.parseInt(sqlMap.get("total").toString());
                        }
                    }
                    //异常人数
                    //今日异常人次
                    String yichangSql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)";
                    Integer yichangTotal=0;
                    Map<String, Object> yichangMap = jdbcTemplate.queryForMap(yichangSql);
                    if (yichangMap != null) {
                        if (yichangMap.get("total") != null) {
                            yichangTotal = Integer.parseInt(yichangMap.get("total").toString());
                        }
                    //保存发送模板记录,
                    WxPushLogDO wxPushLogDO = new WxPushLogDO();
                    wxPushLogDO.setCreateTime(new Date());
                    wxPushLogDO.setOpenid(doctorDO.getOpenid());
                    wxPushLogDO.setReceiver(doctorDO.getId());
                    wxPushLogDO.setWechatId(wechatId);
                    wxPushLogDO.setReceiverName(doctorDO.getName());
                    wxPushLogDO.setScene("jkzldbxmtz");
                    wxPushLogDao.save(wxPushLogDO);
                }else{
                    WxEnterpriseUserDO enterpriseUserDO = wxEnterpriseUserDao.findByEnterpriseIdAndMobile(wechatId,doctorDO.getMobile());
                    if(enterpriseUserDO==null){
                        logger.info("该用户"+doctorDO.getName()+"没有企业微信手机号,无法推送模版消息,用户ID:"+doctorDO.getId()+"wechatId:"+wechatId);
                    }else{
                        String url = "https://ehr.yihu.com/hlwyy/zjxl/healthMonitoring/#/home/index";
                        String res = enterpriseService.sendTWMesByDoctor(wechatId,doctorDO.getId(),title,des,url);
                    }
                    Integer weishangbaoTotal = doctorTotal-sqlTotal;
                    String title = "每日健康上报汇总";
                    String des = "今日上报情况:已上报:"+sqlTotal+",未上报:"+weishangbaoTotal+",异常:"+yichangTotal+";点击查看。";
                    String url = "https://ehr.yihu.com/hlwyy/zjxl/healthMonitoring/#/home/index";
                    String res = enterpriseService.sendTWMesByDoctor(wechatId,doctorDO.getId(),title,des,url);
                }
            }
        }
    }

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

@ -530,7 +530,9 @@ public class PrescriptionStatusUpdateService {
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outPatientId);
                try {
                    if (wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
                        businessOrderService.orderRefund(wechatId, wlyyOutpatientDO.getConsumer(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
                        if (businessOrderDO.getStatus()==1) {
                            businessOrderService.orderRefund(wechatId, wlyyOutpatientDO.getConsumer(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
                        }
                        //眼科接诊时更新眼科通状态
                        if (businessOrderDO != null) {
                            ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(), "2");
@ -539,7 +541,10 @@ public class PrescriptionStatusUpdateService {
                        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("isCloseRefund");
                        if (hospitalSysDictDO!=null&&hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
                            try {
                                entranceService.hisRefund(outPatientId);
                                if (businessOrderDO.getStatus()==1){
                                    entranceService.hisRefund(outPatientId);
                                }
                            }catch (Exception e){
                                e.printStackTrace();
                            }
@ -644,8 +649,9 @@ public class PrescriptionStatusUpdateService {
                        }
                        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outPatientId);
                        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
                            businessOrderService.orderRefund(wechatId, wlyyOutpatientDO.getConsumer(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
                            //眼科接诊时更新眼科通状态
                            if (businessOrderDO.getStatus()==1) {
                                businessOrderService.orderRefund(wechatId, wlyyOutpatientDO.getConsumer(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
                            }//眼科接诊时更新眼科通状态
                            if (businessOrderDO!=null){
                                ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"2");
                            }
@ -653,7 +659,9 @@ public class PrescriptionStatusUpdateService {
                            WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("isCloseRefund");
                            if (hospitalSysDictDO!=null&&hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
                                try {
                                    entranceService.hisRefund(outPatientId);
                                    if (businessOrderDO.getStatus()==1){
                                        entranceService.hisRefund(outPatientId);
                                    }
                                }catch (Exception e){
                                    e.printStackTrace();
                                }

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

@ -189,16 +189,20 @@ public class TimeoutOverDueService {
                                }
                                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outPatientId);
                                if (wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
                                    businessOrderService.orderRefund(wechatId, wlyyOutpatientDO.getConsumer(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
                                    //眼科接诊时更新眼科通状态
                                    if (businessOrderDO!=null){
                                        ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"2");
                                    if (businessOrderDO.getStatus()==1){
                                        businessOrderService.orderRefund(wechatId, wlyyOutpatientDO.getConsumer(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
                                        //眼科接诊时更新眼科通状态
                                        if (businessOrderDO!=null){
                                            ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"2");
                                        }
                                    }
                                } else if (wechatId.equalsIgnoreCase("xm_zsyy_wx")) {
                                    WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("isCloseRefund");
                                    if (hospitalSysDictDO!=null&&hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
                                        try {
                                            entranceService.hisRefund(outPatientId);
                                            if (businessOrderDO.getStatus()==1){
                                                entranceService.hisRefund(outPatientId);
                                            }
                                        }catch (Exception e){
                                            e.printStackTrace();
                                        }

+ 21 - 5
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -17,10 +17,7 @@ import com.yihu.jw.job.ykyy.UpdateStatusByPayTimeJob;
import com.yihu.jw.job.ykyy.YkyyDataUploadJob;
import com.yihu.jw.repository.job.QuartzJobConfigDao;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.service.channel.HealthUploadService;
import com.yihu.jw.service.channel.PrescriptionStatusUpdateService;
import com.yihu.jw.service.channel.RemindDoctorService;
import com.yihu.jw.service.channel.SyncWlyyHospitalService;
import com.yihu.jw.service.channel.*;
import com.yihu.jw.service.quota.JobService;
import com.yihu.jw.util.AutoTimeOutRemind;
import com.yihu.jw.util.OverdueJob;
@ -94,6 +91,8 @@ public class JobController extends BaseController {
    private SyncWlyyHospitalService syncWlyyHospitalService;
    @Autowired
    private HealthUploadService healthUploadService;
    @Autowired
    private TimeoutOverDueService timeoutOverDueService;
    @Autowired
    public JobController(JobService jobService, QuartzHelper quartzHelper) {
@ -224,7 +223,7 @@ public class JobController extends BaseController {
                    }
                    break;
                case "send_health_upload_job" :
                    //互联网医院 待结算消息推送
                    //马銮湾健康上报未填写推送
                    if (!quartzHelper.isExistJob("send_health_upload_job")) {
                        String trigger = SystemConf.getInstance().getSystemProperties().getProperty("send_health_upload_job");
                        quartzHelper.addJob(SendDoctorHealthUploadMessageJob.class, trigger, "send_health_upload_job", new HashMap<String, Object>());
@ -273,6 +272,16 @@ public class JobController extends BaseController {
                        logger.info("health_upload_total_remind_job  job exist");
                    }
                    break;
                case "send_health_total_upload_job" :
                    //马銮湾健康上报上报汇总
                    if (!quartzHelper.isExistJob("send_health_total_upload_job")) {
                        String trigger = SystemConf.getInstance().getSystemProperties().getProperty("send_health_total_upload_job");
                        quartzHelper.addJob(HealthUploadTotalRemindMessageJob.class, trigger, "send_health_total_upload_job", new HashMap<String, Object>());
                        logger.info("send_health_total_upload_job  job success");
                    } else {
                        logger.info("send_health_total_upload_job  job exist");
                    }
                    break;
                case "syn_doctor_info_job" :
                    //互联网医院 医生信息同步
                    if (!quartzHelper.isExistJob("syn_doctor_info_job")) {
@ -892,6 +901,13 @@ public class JobController extends BaseController {
        return success("操作成功");
    }
    @RequestMapping(value = "/cancelOutPatientOver", method = RequestMethod.GET)
    @ApiOperation("cancelOutPatientOver")
    public String syncTeamMemberByTime(){
        timeoutOverDueService.cancelOutPatientOver();
        return success("操作成功");
    }
    @RequestMapping(value = "/ykinternetUpload", method = RequestMethod.GET)
    @ApiOperation("眼科监管平台测试")
    public String ykinternetUpload(String taskId,String endDate,String startDate,String keyId) {

+ 1 - 1
svr/svr-internet-hospital-job/src/main/resources/application.yml

@ -125,7 +125,7 @@ fastDFS:
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  id: xm_mlwyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
  ids: xm_zsyy_wx
  url: http://172.16.100.37:8090/hospitalPortal-sms/sms/sendMessage

+ 1 - 1
svr/svr-internet-hospital-job/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: svr-internet-hospital-job
    name: svr-internet-hospital-job-wangzinan
  cloud:
    config:
      failFast: true

+ 3 - 1
svr/svr-internet-hospital-job/src/main/resources/system.properties

@ -29,7 +29,9 @@ uncheck_prescription_notice_job=0 */1 * * * ?
syn_doctor_info_job=0 0 1 * * ?
send_health_upload_job=0 0 10/1 * * ?
send_health_upload_job=0 0 9,11,15 * * ?
send_health_total_upload_job=0 0 16 * * ?
health_upload_remind_job=0 30 8 * * ? *

+ 1 - 1
svr/svr-internet-hospital/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name:  svr-internet-hospital
    name:  svr-internet-hospital-wangzhinan
  cloud:
    config:
      failFast: true