Преглед на файлове

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

LAPTOP-KB9HII50\70708 преди 2 години
родител
ревизия
c48b2db8f7
променени са 29 файла, в които са добавени 1408 реда и са изтрити 529 реда
  1. 3 0
      business/base-service/src/main/java/com/yihu/jw/healthUpload/dao/BaseDoctorHealthUploadDao.java
  2. 656 494
      business/base-service/src/main/java/com/yihu/jw/healthUpload/service/BaseDoctorHealthUploadService.java
  3. 20 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/BaseAppointmentLogDao.java
  4. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java
  5. 11 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PayInfoNoticeService.java
  6. 34 5
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  7. 97 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  8. 7 9
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  9. 3 2
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  10. 7 4
      business/base-service/src/main/java/com/yihu/jw/wechat/enterprise/EnterpriseService.java
  11. 2 0
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  12. 3 1
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  13. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  14. 109 0
      common/common-entity/src/main/java/com/yihu/jw/entity/healthUpload/BaseDoctorHealthUploadDO.java
  15. 169 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseAppointmentLogDO.java
  16. 1 1
      gateway/ag-basic/pom.xml
  17. 4 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java
  18. 7 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  19. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java
  20. 31 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/SendDoctorHealthUploadMessageJob.java
  21. 123 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/HealthUploadService.java
  22. 6 2
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java
  23. 25 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java
  24. 2 0
      svr/svr-internet-hospital-job/src/main/resources/system.properties
  25. 9 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  26. 26 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/healthUpload/HealthUploadPoint.java
  27. 8 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  28. 32 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java
  29. 1 1
      svr/svr-internet-hospital/src/main/resources/application.yml

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/healthUpload/dao/BaseDoctorHealthUploadDao.java

@ -45,4 +45,7 @@ public interface BaseDoctorHealthUploadDao extends PagingAndSortingRepository<Ba
    @Query("select a from BaseDoctorHealthUploadDO a where a.doctorId=?1 and a.createTime>=?2 and a.createTime<=?3 order by a.createTime desc")
    @Query("select a from BaseDoctorHealthUploadDO a where a.doctorId=?1 and a.createTime>=?2 and a.createTime<=?3 order by a.createTime desc")
    List<BaseDoctorHealthUploadDO> selectHealthUploadInfoByDoctorIdAndDate(String doctorId, Date startDate,Date endDate,Pageable pageRequest);
    List<BaseDoctorHealthUploadDO> selectHealthUploadInfoByDoctorIdAndDate(String doctorId, Date startDate,Date endDate,Pageable pageRequest);
    @Query("select a from BaseDoctorHealthUploadDO a where a.doctorId=?1 and a.createTime>=?2 and a.createTime<=?3 order by a.createTime desc")
    List<BaseDoctorHealthUploadDO> selectHealthUploadInfoByDoctorIdAndStartAndEnd(String doctorId, Date startDate,Date endDate);
}
}

+ 656 - 494
business/base-service/src/main/java/com/yihu/jw/healthUpload/service/BaseDoctorHealthUploadService.java

@ -1,40 +1,53 @@
package com.yihu.jw.healthUpload.service;
package com.yihu.jw.healthUpload.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.sun.org.apache.bcel.internal.generic.NEW;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
import com.yihu.jw.entity.base.wx.WxPushLogDO;
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
import com.yihu.jw.entity.healthUpload.BaseDoctorHealthUploadDO;
import com.yihu.jw.entity.healthUpload.BaseDoctorHealthUploadDO;
import com.yihu.jw.entity.healthUpload.BaseDoctorMemberDO;
import com.yihu.jw.entity.healthUpload.BaseDoctorMemberDO;
import com.yihu.jw.entity.hospital.DmHospitalDO;
import com.yihu.jw.entity.hospital.DmHospitalDO;
import com.yihu.jw.entity.hospital.dict.BaseDeptDict;
import com.yihu.jw.entity.hospital.dict.BaseDeptDict;
import com.yihu.jw.healthUpload.dao.BaseDoctorHealthUploadDao;
import com.yihu.jw.healthUpload.dao.BaseDoctorHealthUploadDao;
import com.yihu.jw.healthUpload.dao.BaseDoctorMemberDao;
import com.yihu.jw.healthUpload.dao.BaseDoctorMemberDao;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.util.common.PwdUtil;
import com.yihu.jw.util.common.PwdUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.idcard.IdCardUtil;
import com.yihu.jw.util.idcard.IdCardUtil;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.WxPushLogDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
import jxl.format.*;
import jxl.format.*;
import jxl.write.*;
import jxl.write.*;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import javax.print.DocFlavor;
import javax.transaction.Transactional;
import javax.transaction.Transactional;
import java.io.IOException;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStream;
import java.text.DecimalFormat;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
@Service
@Service
@Transactional
@Transactional
@ -50,26 +63,40 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    private DictHospitalDeptDao dictHospitalDeptDao;
    @Autowired
    private BaseDoctorRoleDao doctorRoleDao;
    @Autowired
    private WeixinMessagePushUtils weixinMessagePushUtils;
    @Autowired
    private WxTemplateConfigDao wxTemplateConfigDao;
    @Autowired
    private WxAccessTokenService wxAccessTokenService;
    @Autowired
    private WxPushLogDao wxPushLogDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    /**
    /**
     * 新增医生成员关系
     * 新增医生成员关系
     *
     * @param doctorId
     * @param doctorId
     * @param ids 逗号隔开
     * @param ids      逗号隔开
     * @return
     * @return
     */
     */
    public List<BaseDoctorMemberDO> saveAndCreateMember(String doctorId,String ids){
        String str[] =ids.split(",");
    public List<BaseDoctorMemberDO> saveAndCreateMember(String doctorId, String ids) {
        String str[] = ids.split(",");
        List<BaseDoctorMemberDO> baseDoctorMemberDOList = new ArrayList<>();
        List<BaseDoctorMemberDO> baseDoctorMemberDOList = new ArrayList<>();
        for (int i=0;i<str.length;i++){
        for (int i = 0; i < str.length; i++) {
            String memberId = str[i];
            String memberId = str[i];
            BaseDoctorMemberDO memberDO = doctorMemberDao.findByDoctorIdAndMemberIdAndDel(doctorId,memberId);
            if (memberDO==null){
            BaseDoctorMemberDO memberDO = doctorMemberDao.findByDoctorIdAndMemberIdAndDel(doctorId, memberId);
            if (memberDO == null) {
                BaseDoctorMemberDO baseDoctorMemberDO = new BaseDoctorMemberDO();
                BaseDoctorMemberDO baseDoctorMemberDO = new BaseDoctorMemberDO();
                baseDoctorMemberDO.setDel(1);
                baseDoctorMemberDO.setDel(1);
                baseDoctorMemberDO.setDoctorId(doctorId);
                baseDoctorMemberDO.setDoctorId(doctorId);
                baseDoctorMemberDO.setMemberId(memberId);
                baseDoctorMemberDO.setMemberId(memberId);
                baseDoctorMemberDO.setCreateTime(new Date());
                baseDoctorMemberDO.setCreateTime(new Date());
                baseDoctorMemberDO.setUpdateTime(new Date());
                baseDoctorMemberDO.setUpdateTime(new Date());
                baseDoctorMemberDO= doctorMemberDao.save(baseDoctorMemberDO);
                baseDoctorMemberDO = doctorMemberDao.save(baseDoctorMemberDO);
                baseDoctorMemberDOList.add(baseDoctorMemberDO);
                baseDoctorMemberDOList.add(baseDoctorMemberDO);
            }
            }
        }
        }
@ -78,60 +105,62 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
    /**
    /**
     * 查询医生的成员列表
     * 查询医生的成员列表
     *
     * @param doctorId
     * @param doctorId
     * @return
     * @return
     */
     */
    public List<BaseDoctorMemberDO> selectByDoctorId(String doctorId){
       List<BaseDoctorMemberDO> baseDoctorMemberDOList = doctorMemberDao.findByDoctorIdAndDel(doctorId);
        BaseDoctorMemberDO memberDO1 = doctorMemberDao.findByDoctorIdAndMemberIdAndDel(doctorId,doctorId);
    public List<BaseDoctorMemberDO> selectByDoctorId(String doctorId) {
        List<BaseDoctorMemberDO> baseDoctorMemberDOList = doctorMemberDao.findByDoctorIdAndDel(doctorId);
        BaseDoctorMemberDO memberDO1 = doctorMemberDao.findByDoctorIdAndMemberIdAndDel(doctorId, doctorId);
        //添加本人
        //添加本人
        if (memberDO1==null){
        if (memberDO1 == null) {
            BaseDoctorMemberDO baseDoctorMemberDO = new BaseDoctorMemberDO();
            BaseDoctorMemberDO baseDoctorMemberDO = new BaseDoctorMemberDO();
            baseDoctorMemberDO.setDel(1);
            baseDoctorMemberDO.setDel(1);
            baseDoctorMemberDO.setDoctorId(doctorId);
            baseDoctorMemberDO.setDoctorId(doctorId);
            baseDoctorMemberDO.setMemberId(doctorId);
            baseDoctorMemberDO.setMemberId(doctorId);
            baseDoctorMemberDO.setCreateTime(new Date());
            baseDoctorMemberDO.setCreateTime(new Date());
            baseDoctorMemberDO.setUpdateTime(new Date());
            baseDoctorMemberDO.setUpdateTime(new Date());
            baseDoctorMemberDO= doctorMemberDao.save(baseDoctorMemberDO);
            baseDoctorMemberDO = doctorMemberDao.save(baseDoctorMemberDO);
        }
        for (BaseDoctorMemberDO memberDO : baseDoctorMemberDOList) {
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(memberDO.getMemberId());
            if (baseDoctorDO != null) {
                memberDO.setBaseDoctorDO(baseDoctorDO);
            }
        }
        }
       for (BaseDoctorMemberDO memberDO:baseDoctorMemberDOList){
           BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(memberDO.getMemberId());
           if (baseDoctorDO!=null){
               memberDO.setBaseDoctorDO(baseDoctorDO);
           }
       }
       return baseDoctorMemberDOList;
        return baseDoctorMemberDOList;
    }
    }
    /**
    /**
     * 查询医生的成员列表带有已上报次数
     * 查询医生的成员列表带有已上报次数
     *
     * @param doctorId
     * @param doctorId
     * @return
     * @return
     */
     */
    public List<BaseDoctorMemberDO> selectCountByDoctorId(String doctorId){
    public List<BaseDoctorMemberDO> selectCountByDoctorId(String doctorId) {
        List<BaseDoctorMemberDO> baseDoctorMemberDOList = doctorMemberDao.findByDoctorIdAndDel(doctorId);
        List<BaseDoctorMemberDO> baseDoctorMemberDOList = doctorMemberDao.findByDoctorIdAndDel(doctorId);
        for (BaseDoctorMemberDO memberDO:baseDoctorMemberDOList){
        for (BaseDoctorMemberDO memberDO : baseDoctorMemberDOList) {
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(memberDO.getMemberId());
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(memberDO.getMemberId());
            if (baseDoctorDO!=null){
            if (baseDoctorDO != null) {
                memberDO.setBaseDoctorDO(baseDoctorDO);
                memberDO.setBaseDoctorDO(baseDoctorDO);
            }
            }
            List<BaseDoctorHealthUploadDO> baseDoctorHealthUploadDOList = baseDoctorHealthUploadDao.findByDoctorIdAndConsumer(memberDO.getMemberId(),doctorId);
            memberDO.setCount(baseDoctorHealthUploadDOList.size()+"");
            List<BaseDoctorHealthUploadDO> baseDoctorHealthUploadDOList = baseDoctorHealthUploadDao.findByDoctorIdAndConsumer(memberDO.getMemberId(), doctorId);
            memberDO.setCount(baseDoctorHealthUploadDOList.size() + "");
        }
        }
        return baseDoctorMemberDOList;
        return baseDoctorMemberDOList;
    }
    }
    /**
    /**
     * 查询某一个成员id
     * 查询某一个成员id
     *
     * @param id 成员id
     * @param id 成员id
     * @return
     * @return
     */
     */
    public BaseDoctorMemberDO selectById(String id){
    public BaseDoctorMemberDO selectById(String id) {
        BaseDoctorMemberDO baseDoctorMemberDO = doctorMemberDao.findById(id);
        BaseDoctorMemberDO baseDoctorMemberDO = doctorMemberDao.findById(id);
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(baseDoctorMemberDO.getMemberId());
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(baseDoctorMemberDO.getMemberId());
        if (baseDoctorDO!=null){
        if (baseDoctorDO != null) {
            baseDoctorMemberDO.setBaseDoctorDO(baseDoctorDO);
            baseDoctorMemberDO.setBaseDoctorDO(baseDoctorDO);
        }
        }
        List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(baseDoctorMemberDO.getMemberId());
        List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(baseDoctorMemberDO.getMemberId());
@ -141,10 +170,11 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
    /**
    /**
     * 删除某个成员
     * 删除某个成员
     *
     * @param id 成员id
     * @param id 成员id
     * @return
     * @return
     */
     */
    public BaseDoctorMemberDO delDoctorMember(String id){
    public BaseDoctorMemberDO delDoctorMember(String id) {
        BaseDoctorMemberDO baseDoctorMemberDO = doctorMemberDao.findById(id);
        BaseDoctorMemberDO baseDoctorMemberDO = doctorMemberDao.findById(id);
        baseDoctorMemberDO.setDel(0);
        baseDoctorMemberDO.setDel(0);
        baseDoctorMemberDO = doctorMemberDao.save(baseDoctorMemberDO);
        baseDoctorMemberDO = doctorMemberDao.save(baseDoctorMemberDO);
@ -153,12 +183,56 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
    /**
    /**
     * 提交健康信息
     * 提交健康信息
     *
     * @param baseDoctorHealthUploadDO 健康信息实体类
     * @param baseDoctorHealthUploadDO 健康信息实体类
     * @return
     * @return
     */
     */
    public BaseDoctorHealthUploadDO createHealthUploadInfo(BaseDoctorHealthUploadDO baseDoctorHealthUploadDO){
    public BaseDoctorHealthUploadDO createHealthUploadInfo(BaseDoctorHealthUploadDO baseDoctorHealthUploadDO) {
        baseDoctorHealthUploadDO.setCreateTime(new Date());
        baseDoctorHealthUploadDO.setCreateTime(new Date());
        return baseDoctorHealthUploadDao.save(baseDoctorHealthUploadDO);
        baseDoctorHealthUploadDO = baseDoctorHealthUploadDao.save(baseDoctorHealthUploadDO);
        List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(baseDoctorHealthUploadDO.getDoctorId());
        try {
            if (baseDoctorHealthUploadDO.getHealthCode() == 2 || baseDoctorHealthUploadDO.getHealthCode() == 3 || Double.parseDouble(baseDoctorHealthUploadDO.getTemperature()) >= 37.3
                    || baseDoctorHealthUploadDO.getIsSymptoms() == 1 || baseDoctorHealthUploadDO.getIsEpidemic() == 1) {
                List<BaseDoctorRoleDO> roleDOS = doctorRoleDao.findByRoleCode("admin");
                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()));
                            } else {
                                newConfig.setFirst(config.getFirst().replace("key1的", "").replace("key2", baseDoctorHealthUploadDO.getDoctorName()));
                            }
                            newConfig.setKeyword2(baseDoctorHealthUploadDO.getDoctorName());
                            newConfig.setKeyword3(DateUtil.getStringDate());
                            newConfig.setUrl("https://www.cityihealth.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);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return baseDoctorHealthUploadDO;
    }
    }
    /**
    /**
@ -167,31 +241,32 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
     * @param doctorId 医生id
     * @param doctorId 医生id
     * @return
     * @return
     */
     */
    public MixEnvelop selectHealthUploadInfoByDoctorId(String doctorId,String startDate,String endDate,Integer page,Integer pageSize){
        PageRequest pageRequest = new PageRequest(page-1,pageSize);
    public MixEnvelop selectHealthUploadInfoByDoctorId(String doctorId, String startDate, String endDate, Integer page, Integer pageSize) {
        PageRequest pageRequest = new PageRequest(page - 1, pageSize);
        MixEnvelop mixEnvelop = new MixEnvelop();
        MixEnvelop mixEnvelop = new MixEnvelop();
        List<BaseDoctorHealthUploadDO> list = new ArrayList<>();
        List<BaseDoctorHealthUploadDO> list = new ArrayList<>();
        if (StringUtils.isNoneBlank(startDate)) {
        if (StringUtils.isNoneBlank(startDate)) {
            Date startTime = DateUtil.strToDateLong(startDate);
            Date startTime = DateUtil.strToDateLong(startDate);
            Date endTime = DateUtil.strToDateLong(endDate);
            Date endTime = DateUtil.strToDateLong(endDate);
            list = baseDoctorHealthUploadDao.selectHealthUploadInfoByDoctorIdAndDate(doctorId,startTime,endTime,pageRequest);
        }else {
            list =baseDoctorHealthUploadDao.selectHealthUploadInfoByDoctorId(doctorId,pageRequest);
            list = baseDoctorHealthUploadDao.selectHealthUploadInfoByDoctorIdAndDate(doctorId, startTime, endTime, pageRequest);
        } else {
            list = baseDoctorHealthUploadDao.selectHealthUploadInfoByDoctorId(doctorId, pageRequest);
        }
        }
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setTotalCount(list==null?0:list.size());
        mixEnvelop.setTotalCount(list == null ? 0 : list.size());
        return mixEnvelop;
        return mixEnvelop;
    }
    }
    public BaseDoctorHealthUploadDO selectHealthInfoById(String id){
    public BaseDoctorHealthUploadDO selectHealthInfoById(String id) {
        BaseDoctorHealthUploadDO baseDoctorHealthUploadDO = baseDoctorHealthUploadDao.findById(id);
        BaseDoctorHealthUploadDO baseDoctorHealthUploadDO = baseDoctorHealthUploadDao.findById(id);
        return baseDoctorHealthUploadDO;
        return baseDoctorHealthUploadDO;
    }
    }
    /**
    /**
     * 新增加医生信息
     * 新增加医生信息
     *
     * @param photo
     * @param photo
     * @param name
     * @param name
     * @param idcard
     * @param idcard
@ -203,7 +278,7 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
     * @param idType
     * @param idType
     * @return
     * @return
     */
     */
    public BaseDoctorDO  saveDoctorInfo(String id,String photo,String name,String idcard,String sex,String mobile,String dept,String deptName,String idCardType,String idType) throws Exception {
    public BaseDoctorDO saveDoctorInfo(String id, String photo, String name, String idcard, String sex, String mobile, String dept, String deptName, String idCardType, String idType, Integer mark) throws Exception {
        BaseDoctorDO baseDoctorDO = new BaseDoctorDO();
        BaseDoctorDO baseDoctorDO = new BaseDoctorDO();
        if (StringUtils.isNoneBlank(id)) {
        if (StringUtils.isNoneBlank(id)) {
            baseDoctorDO = baseDoctorDao.findById(id);
            baseDoctorDO = baseDoctorDao.findById(id);
@ -214,6 +289,7 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
            baseDoctorDO.setIdcard(idcard);
            baseDoctorDO.setIdcard(idcard);
            baseDoctorDO.setSex(Integer.parseInt(sex));
            baseDoctorDO.setSex(Integer.parseInt(sex));
            baseDoctorDO.setMobile(mobile);
            baseDoctorDO.setMobile(mobile);
            baseDoctorDO.setMark(mark);
            String deptCode = dept;
            String deptCode = dept;
            baseDoctorDO.setChargeType("1");
            baseDoctorDO.setChargeType("1");
            baseDoctorDO = baseDoctorDao.save(baseDoctorDO);
            baseDoctorDO = baseDoctorDao.save(baseDoctorDO);
@ -229,7 +305,7 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
                baseDoctorHospitalDO.setDel("1");
                baseDoctorHospitalDO.setDel("1");
                baseDoctorHospitalDO.setCreateTime(new Date());
                baseDoctorHospitalDO.setCreateTime(new Date());
                baseDoctorHospitalDao.save(baseDoctorHospitalDO);
                baseDoctorHospitalDao.save(baseDoctorHospitalDO);
            }else {
            } else {
                BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
                BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
                baseDoctorHospitalDO.setOrgCode("350211A1002");
                baseDoctorHospitalDO.setOrgCode("350211A1002");
                baseDoctorHospitalDO.setOrgName("马銮湾医院");
                baseDoctorHospitalDO.setOrgName("马銮湾医院");
@ -246,6 +322,7 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
            baseDoctorDO.setSex(Integer.parseInt(sex));
            baseDoctorDO.setSex(Integer.parseInt(sex));
            baseDoctorDO.setLocked(0);
            baseDoctorDO.setLocked(0);
            baseDoctorDO.setEnabled(1);
            baseDoctorDO.setEnabled(1);
            baseDoctorDO.setMark(mark);
            String disableFlag = "0";
            String disableFlag = "0";
            //互联网医院:1停用,0使用  转 i健康:1正常,0作废
            //互联网医院:1停用,0使用  转 i健康:1正常,0作废
            baseDoctorDO.setDel("1".equals(disableFlag) ? "0" : "1");
            baseDoctorDO.setDel("1".equals(disableFlag) ? "0" : "1");
@ -285,7 +362,7 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
                baseDoctorHospitalDO.setDel("1");
                baseDoctorHospitalDO.setDel("1");
                baseDoctorHospitalDO.setCreateTime(new Date());
                baseDoctorHospitalDO.setCreateTime(new Date());
                baseDoctorHospitalDao.save(baseDoctorHospitalDO);
                baseDoctorHospitalDao.save(baseDoctorHospitalDO);
            }else {
            } else {
                BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
                BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
                baseDoctorHospitalDO.setOrgCode("350211A1002");
                baseDoctorHospitalDO.setOrgCode("350211A1002");
                baseDoctorHospitalDO.setOrgName("马銮湾医院");
                baseDoctorHospitalDO.setOrgName("马銮湾医院");
@ -302,34 +379,33 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
    }
    }
    /**
    /**
     *
     * @param dept
     * @param dept
     * @param level 1院级管理员,2科室管理员
     * @param level    1院级管理员,2科室管理员
     * @param doctorId
     * @param doctorId
     * @return
     * @return
     */
     */
    public JSONObject selectHealthByRole(String dept,int level,String doctorId){
    public JSONObject selectHealthByRole(String dept, int level, String doctorId) {
        String nowDate = DateUtil.getStringDateShort();
        String nowDate = DateUtil.getStringDateShort();
        //今日本人提交
        //今日本人提交
        String benrenSql = "select count(1) as total from base_doctor_health_upload where consumer='"+doctorId+"' and consumer in(doctor_id) and  create_time >='"+nowDate+" 00:00:00' and create_time<='"+nowDate+" 23:59:59'";
        String benrenSql = "select count(1) as total from base_doctor_health_upload where consumer='" + doctorId + "' and consumer in(doctor_id) and  create_time >='" + nowDate + " 00:00:00' and create_time<='" + nowDate + " 23:59:59'";
        //今日提交
        //今日提交
        String personSql = "select count(1) as total from base_doctor_health_upload where consumer='"+doctorId+"' and  create_time >='"+nowDate+" 00:00:00' and create_time<='"+nowDate+" 23:59:59'";
        String personSql = "select count(1) as total from base_doctor_health_upload where consumer='" + doctorId + "' and  create_time >='" + nowDate + " 00:00:00' and create_time<='" + nowDate + " 23:59:59'";
        //代上报
        //代上报
        String daishangbaoSql = "select count(1) as total from base_doctor_health_upload where consumer='"+doctorId+"' and consumer not in(doctor_id)";
        String daishangbaoSql = "select count(1) as total from base_doctor_health_upload where consumer='" + doctorId + "' and consumer not in(doctor_id)";
        //本人上报
        //本人上报
        String benrenshangbaoSql = "select count(1) as total from base_doctor_health_upload where consumer='"+doctorId+"' and consumer in(doctor_id)";
        String doctorSql ="";
        String benrenshangbaoSql = "select count(1) as total from base_doctor_health_upload where consumer='" + doctorId + "' and consumer in(doctor_id)";
        String doctorSql = "";
        String sql = "";
        String sql = "";
        if (level==1){
        if (level == 1) {
            //总人次
            //总人次
            doctorSql =" select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
            doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
            //今日上报人次
            //今日上报人次
            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'";
        }else if (level==2){
            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'";
        } 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 )";
            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'";
            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'";
        }
        }
        //今日提交
        //今日提交
        int personTotal = 0;
        int personTotal = 0;
@ -343,56 +419,56 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
        int sqlTotal = 0;
        int sqlTotal = 0;
        //今日未上报人次
        //今日未上报人次
        int notUploadTotal = 0;
        int notUploadTotal = 0;
        Map<String,Object> personMap = jdbcTemplate.queryForMap(personSql);
        if (personMap!=null){
            if (personMap.get("total")!=null){
        Map<String, Object> personMap = jdbcTemplate.queryForMap(personSql);
        if (personMap != null) {
            if (personMap.get("total") != null) {
                personTotal = Integer.parseInt(personMap.get("total").toString());
                personTotal = Integer.parseInt(personMap.get("total").toString());
            }
            }
        }
        }
        Map<String,Object> daishangbaoMap = jdbcTemplate.queryForMap(daishangbaoSql);
        if (daishangbaoMap!=null){
            if (daishangbaoMap.get("total")!=null){
        Map<String, Object> daishangbaoMap = jdbcTemplate.queryForMap(daishangbaoSql);
        if (daishangbaoMap != null) {
            if (daishangbaoMap.get("total") != null) {
                daishangbaoTotal = Integer.parseInt(daishangbaoMap.get("total").toString());
                daishangbaoTotal = Integer.parseInt(daishangbaoMap.get("total").toString());
            }
            }
        }
        }
        Map<String,Object> benrenshangbaoMap = jdbcTemplate.queryForMap(benrenshangbaoSql);
        if (benrenshangbaoMap!=null){
            if (benrenshangbaoMap.get("total")!=null){
        Map<String, Object> benrenshangbaoMap = jdbcTemplate.queryForMap(benrenshangbaoSql);
        if (benrenshangbaoMap != null) {
            if (benrenshangbaoMap.get("total") != null) {
                benrenshangbaoTotal = Integer.parseInt(benrenshangbaoMap.get("total").toString());
                benrenshangbaoTotal = Integer.parseInt(benrenshangbaoMap.get("total").toString());
            }
            }
        }
        }
        Map<String,Object> doctorMap = jdbcTemplate.queryForMap(doctorSql);
        if (doctorMap!=null){
            if (doctorMap.get("total")!=null){
        Map<String, Object> doctorMap = jdbcTemplate.queryForMap(doctorSql);
        if (doctorMap != null) {
            if (doctorMap.get("total") != null) {
                doctorTotal = Integer.parseInt(doctorMap.get("total").toString());
                doctorTotal = Integer.parseInt(doctorMap.get("total").toString());
            }
            }
        }
        }
        Map<String,Object> sqlMap = jdbcTemplate.queryForMap(sql);
        if (sqlMap!=null){
            if (sqlMap.get("total")!=null){
        Map<String, Object> sqlMap = jdbcTemplate.queryForMap(sql);
        if (sqlMap != null) {
            if (sqlMap.get("total") != null) {
                sqlTotal = Integer.parseInt(sqlMap.get("total").toString());
                sqlTotal = Integer.parseInt(sqlMap.get("total").toString());
            }
            }
        }
        }
        int benrenTotal=0;
        Map<String,Object> benrenMap = jdbcTemplate.queryForMap(benrenSql);
        if (benrenMap!=null){
            if (benrenMap.get("total")!=null){
        int benrenTotal = 0;
        Map<String, Object> benrenMap = jdbcTemplate.queryForMap(benrenSql);
        if (benrenMap != null) {
            if (benrenMap.get("total") != null) {
                benrenTotal = Integer.parseInt(benrenMap.get("total").toString());
                benrenTotal = Integer.parseInt(benrenMap.get("total").toString());
            }
            }
        }
        }
        JSONObject object = new JSONObject();
        JSONObject object = new JSONObject();
        object.put("personTotal",personTotal);//今日上报人数
        object.put("daishangbaoTotal",daishangbaoTotal);//代上报
        object.put("benrenshangbaoTotal",benrenshangbaoTotal);//已上报
        object.put("doctorTotal",doctorTotal);//总人次
        object.put("sqlTotal",sqlTotal);//今日上报人数
        object.put("notUploadTotal",doctorTotal-sqlTotal);//今日未上报人数
        object.put("benrenTotal",benrenTotal);//今日本人提交
        object.put("personTotal", personTotal);//今日上报人数
        object.put("daishangbaoTotal", daishangbaoTotal);//代上报
        object.put("benrenshangbaoTotal", benrenshangbaoTotal);//已上报
        object.put("doctorTotal", doctorTotal);//总人次
        object.put("sqlTotal", sqlTotal);//今日上报人数
        object.put("notUploadTotal", doctorTotal - sqlTotal);//今日未上报人数
        object.put("benrenTotal", benrenTotal);//今日本人提交
        return object;
        return object;
    }
    }
@ -401,103 +477,102 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
     *
     *
     * @param dept
     * @param dept
     * @param idType
     * @param idType
     * @param status 上报状态
     * @param state 健康状态
     * @param status    上报状态
     * @param state     健康状态
     * @param startDate
     * @param startDate
     * @param endDate
     * @param endDate
     * @return
     * @return
     */
     */
    public JSONObject selectHeaderTotal(String dept,String idType,String status,String state,String startDate,String endDate,String name){
        JSONObject object =new JSONObject();
        String day = DateUtil.getTwoDay(endDate,startDate);
        String doctorSql =" select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
    public JSONObject selectHeaderTotal(String dept, String idType, String status, String state, String startDate, String endDate, String name) {
        JSONObject object = new JSONObject();
        String day = DateUtil.getTwoDay(endDate, startDate);
        String doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
        Integer total = 0;//总人次
        Integer total = 0;//总人次
        String sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 ";
        String sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 ";
        String deptCondition = "";
        String deptCondition = "";
        if (StringUtils.isNoneBlank(dept)){
            deptCondition +=" (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '"+dept+"' and dh.del=1 )";
        if (StringUtils.isNoneBlank(dept)) {
            deptCondition += " (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )";
        }
        }
        String idTypeCondition = " ";
        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(idType)) {
            idTypeCondition += "  (select d1.id from base_doctor d1 where 1=1 and d1.id_type = '" + idType + "')";
        }
        }
        if (StringUtils.isNoneBlank(deptCondition)){
            doctorSql+=" and d.id IN "+deptCondition;
        if (StringUtils.isNoneBlank(deptCondition)) {
            doctorSql += " and d.id IN " + deptCondition;
        }
        }
        if (StringUtils.isNoneBlank(idTypeCondition)){
            doctorSql+=" and d.id IN "+idTypeCondition ;
        if (StringUtils.isNoneBlank(idTypeCondition)) {
            doctorSql += " and d.id IN " + idTypeCondition;
        }
        }
        if (StringUtils.isNoneBlank(name)){
            doctorSql+=" and d.name like '%"+name+"%' " ;
        if (StringUtils.isNoneBlank(name)) {
            doctorSql += " and d.name like '%" + name + "%' ";
        }
        }
        Map<String,Object> map = jdbcTemplate.queryForMap(doctorSql);
        Map<String, Object> map = jdbcTemplate.queryForMap(doctorSql);
        String doctorTotal = "";
        String doctorTotal = "";
        if (map!=null){
             doctorTotal = map.get("total").toString();
        if (map != null) {
            doctorTotal = map.get("total").toString();
        }
        }
        if (StringUtils.isNoneBlank(doctorTotal)){
        if (StringUtils.isNoneBlank(doctorTotal)) {
            //总人次
            //总人次
            if (!day.equalsIgnoreCase("0")){
                total = Integer.parseInt(doctorTotal)*Integer.parseInt(day);
            }else {
                total= Integer.parseInt(doctorTotal);
            if (!day.equalsIgnoreCase("0")) {
                total = Integer.parseInt(doctorTotal) * Integer.parseInt(day);
            } else {
                total = Integer.parseInt(doctorTotal);
            }
            }
        }
        }
        Integer yishangbaoTotal = 0;
        Integer yishangbaoTotal = 0;
        Integer weishangbaoTotal =0;
        Integer weishangbaoTotal = 0;
        Integer zhengchangTotal = 0;
        Integer zhengchangTotal = 0;
        Integer yichangTotal = 0;
        Integer yichangTotal = 0;
        if (StringUtils.isNoneBlank(startDate)){
            sql +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
        if (StringUtils.isNoneBlank(startDate)) {
            sql += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' ";
        }
        }
        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) ";
        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) ";
            }
            }
        }
        }
        if (StringUtils.isNoneBlank(deptCondition)){
            sql+=" and d.doctor_id IN "+deptCondition;
        if (StringUtils.isNoneBlank(deptCondition)) {
            sql += " and d.doctor_id IN " + deptCondition;
        }
        }
        if (StringUtils.isNoneBlank(idTypeCondition)){
            sql+=" and d.doctor_id IN "+idTypeCondition ;
        if (StringUtils.isNoneBlank(idTypeCondition)) {
            sql += " and d.doctor_id IN " + idTypeCondition;
        }
        }
        if (StringUtils.isNoneBlank(name)){
            sql+=" and d.doctor_name like '%"+name+"%'" ;
        if (StringUtils.isNoneBlank(name)) {
            sql += " and d.doctor_name like '%" + name + "%'";
        }
        }
        //已上传
        //已上传
        Map<String,Object> yishangchaungMap = jdbcTemplate.queryForMap(sql);
        if (yishangchaungMap!=null){
            if (yishangchaungMap.get("total")!=null){
        Map<String, Object> yishangchaungMap = jdbcTemplate.queryForMap(sql);
        if (yishangchaungMap != null) {
            if (yishangchaungMap.get("total") != null) {
                yishangbaoTotal = Integer.parseInt(yishangchaungMap.get("total").toString());
                yishangbaoTotal = Integer.parseInt(yishangchaungMap.get("total").toString());
            }
            }
        }
        }
        //未上报
        //未上报
        weishangbaoTotal=total-yishangbaoTotal;
        weishangbaoTotal = total - yishangbaoTotal;
        //上传总次数
        //上传总次数
        Integer shangchuanTotal= 0;
        Integer shangchuanTotal = 0;
        String shangchuanTotalSql = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1  ";
        String shangchuanTotalSql = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1  ";
        if (StringUtils.isNoneBlank(startDate)){
            shangchuanTotalSql +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
        if (StringUtils.isNoneBlank(startDate)) {
            shangchuanTotalSql += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' ";
        }
        }
        if (StringUtils.isNoneBlank(deptCondition)){
            shangchuanTotalSql +=" and d.doctor_id IN "+deptCondition;
        if (StringUtils.isNoneBlank(deptCondition)) {
            shangchuanTotalSql += " and d.doctor_id IN " + deptCondition;
        }
        }
        if (StringUtils.isNoneBlank(idTypeCondition)){
            shangchuanTotalSql +=" and d.doctor_id IN "+idTypeCondition ;
        if (StringUtils.isNoneBlank(idTypeCondition)) {
            shangchuanTotalSql += " and d.doctor_id IN " + idTypeCondition;
        }
        }
        if (StringUtils.isNoneBlank(name)){
            shangchuanTotalSql+=" and d.doctor_name like '%"+name+"%'" ;
        if (StringUtils.isNoneBlank(name)) {
            shangchuanTotalSql += " and d.doctor_name like '%" + name + "%'";
        }
        }
        Map<String,Object> shangchuanMap = jdbcTemplate.queryForMap(shangchuanTotalSql);
        if (shangchuanMap!=null){
            if (shangchuanMap.get("total")!=null){
        Map<String, Object> shangchuanMap = jdbcTemplate.queryForMap(shangchuanTotalSql);
        if (shangchuanMap != null) {
            if (shangchuanMap.get("total") != null) {
                shangchuanTotal = Integer.parseInt(shangchuanMap.get("total").toString());
                shangchuanTotal = Integer.parseInt(shangchuanMap.get("total").toString());
            }
            }
        }
        }
@ -506,52 +581,52 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
        //正常、异常
        //正常、异常
        String sqlZhengchang = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1 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) ";
        String sqlZhengchang = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1 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) ";
        if (StringUtils.isNoneBlank(startDate)){
            sqlZhengchang +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
        if (StringUtils.isNoneBlank(startDate)) {
            sqlZhengchang += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' ";
        }
        }
        if (StringUtils.isNoneBlank(deptCondition)){
            sqlZhengchang +=" and d.doctor_id IN "+deptCondition;
        if (StringUtils.isNoneBlank(deptCondition)) {
            sqlZhengchang += " and d.doctor_id IN " + deptCondition;
        }
        }
        if (StringUtils.isNoneBlank(idTypeCondition)){
            sqlZhengchang +=" and d.doctor_id IN "+idTypeCondition ;
        if (StringUtils.isNoneBlank(idTypeCondition)) {
            sqlZhengchang += " and d.doctor_id IN " + idTypeCondition;
        }
        }
        if (StringUtils.isNoneBlank(name)){
            sqlZhengchang+=" and d.doctor_name like '%"+name+"%'" ;
        if (StringUtils.isNoneBlank(name)) {
            sqlZhengchang += " and d.doctor_name like '%" + name + "%'";
        }
        }
        //正常
        //正常
        Map<String,Object> zhengchangMap = jdbcTemplate.queryForMap(sqlZhengchang);
        if (zhengchangMap!=null){
            if (zhengchangMap.get("total")!=null){
        Map<String, Object> zhengchangMap = jdbcTemplate.queryForMap(sqlZhengchang);
        if (zhengchangMap != null) {
            if (zhengchangMap.get("total") != null) {
                zhengchangTotal = Integer.parseInt(zhengchangMap.get("total").toString());
                zhengchangTotal = Integer.parseInt(zhengchangMap.get("total").toString());
            }
            }
        }
        }
        String sqlYichang = "select COUNT(1) 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 sqlYichang = "select COUNT(1) 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)  ";
        if (StringUtils.isNoneBlank(startDate)){
            sqlYichang +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
        if (StringUtils.isNoneBlank(startDate)) {
            sqlYichang += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' ";
        }
        }
        if (StringUtils.isNoneBlank(deptCondition)){
            sqlYichang +=" and d.doctor_id IN "+deptCondition;
        if (StringUtils.isNoneBlank(deptCondition)) {
            sqlYichang += " and d.doctor_id IN " + deptCondition;
        }
        }
        if (StringUtils.isNoneBlank(idTypeCondition)){
            sqlYichang +=" and d.doctor_id IN "+idTypeCondition ;
        if (StringUtils.isNoneBlank(idTypeCondition)) {
            sqlYichang += " and d.doctor_id IN " + idTypeCondition;
        }
        }
        if (StringUtils.isNoneBlank(name)){
            sqlYichang+=" and d.doctor_name like '%"+name+"%'" ;
        if (StringUtils.isNoneBlank(name)) {
            sqlYichang += " and d.doctor_name like '%" + name + "%'";
        }
        }
        //正常
        //正常
        Map<String,Object> yichangMap = jdbcTemplate.queryForMap(sqlYichang);
        if (yichangMap!=null){
            if (yichangMap.get("total")!=null){
        Map<String, Object> yichangMap = jdbcTemplate.queryForMap(sqlYichang);
        if (yichangMap != null) {
            if (yichangMap.get("total") != null) {
                yichangTotal = Integer.parseInt(yichangMap.get("total").toString());
                yichangTotal = Integer.parseInt(yichangMap.get("total").toString());
            }
            }
        }
        }
        object.put("total",total);//总人次
        object.put("yishangbaoTotal",yishangbaoTotal);//已上报
        object.put("weishangbaoTotal",weishangbaoTotal);//未上报
        object.put("zhengchangTotal",zhengchangTotal);//上报正常
        object.put("yichangTotal",yichangTotal);//上报异常
        object.put("shangchuanTotal",shangchuanTotal);//上传总次数
        object.put("total", total);//总人次
        object.put("yishangbaoTotal", yishangbaoTotal);//已上报
        object.put("weishangbaoTotal", weishangbaoTotal);//未上报
        object.put("zhengchangTotal", zhengchangTotal);//上报正常
        object.put("yichangTotal", yichangTotal);//上报异常
        object.put("shangchuanTotal", shangchuanTotal);//上传总次数
        return object;
        return object;
    }
    }
@ -561,113 +636,115 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
     *
     *
     * @param dept
     * @param dept
     * @param idType
     * @param idType
     * @param status 上报状态
     * @param state 健康状态
     * @param status    上报状态
     * @param state     健康状态
     * @param startDate
     * @param startDate
     * @param endDate
     * @param endDate
     * @return
     * @return
     */
     */
    public List<Map<String,Object>> selectHeaderList(String dept,String idType,String status,String state,String startDate,String endDate,String name){
    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 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(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+"' ";
        if (StringUtils.isNoneBlank(dept)) {
            deptSql += " and hd.code = '" + dept + "' ";
        }
        }
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(deptSql);
        for (Map<String,Object> deptmap:mapList){
        if (StringUtils.isNoneBlank(status)){
        }
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(deptSql);
        for (Map<String, Object> deptmap : mapList) {
            String deptCode = deptmap.get("code").toString();
            String deptCode = deptmap.get("code").toString();
            JSONObject object =new JSONObject();
            String day = DateUtil.getTwoDay(endDate,startDate);
            String doctorSql =" select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
            JSONObject object = new JSONObject();
            String day = DateUtil.getTwoDay(endDate, startDate);
            String doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
            Integer total = 0;//总人次
            Integer total = 0;//总人次
            String sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 ";
            String sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 ";
            String deptCondition = "";
            String deptCondition = "";
            if (StringUtils.isNoneBlank(deptCode)){
                deptCondition +=" (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '"+deptCode+"' and dh.del=1 )";
            if (StringUtils.isNoneBlank(deptCode)) {
                deptCondition += " (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + deptCode + "' and dh.del=1 )";
            }
            }
            String idTypeCondition = " ";
            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(idType)) {
                idTypeCondition += "  (select d1.id from base_doctor d1 where 1=1 and d1.id_type = '" + idType + "')";
            }
            }
            if (StringUtils.isNoneBlank(deptCondition)){
                doctorSql+=" and d.id IN "+deptCondition;
            if (StringUtils.isNoneBlank(deptCondition)) {
                doctorSql += " and d.id IN " + deptCondition;
            }
            }
            if (StringUtils.isNoneBlank(idTypeCondition)){
                doctorSql+=" and d.id IN "+idTypeCondition ;
            if (StringUtils.isNoneBlank(idTypeCondition)) {
                doctorSql += " and d.id IN " + idTypeCondition;
            }
            }
            if (StringUtils.isNoneBlank(name)){
                doctorSql+=" and d.name like '%"+name+"%' " ;
            if (StringUtils.isNoneBlank(name)) {
                doctorSql += " and d.name like '%" + name + "%' ";
            }
            }
            Map<String,Object> map = jdbcTemplate.queryForMap(doctorSql);
            Map<String, Object> map = jdbcTemplate.queryForMap(doctorSql);
            String doctorTotal = "";
            String doctorTotal = "";
            if (map!=null){
            if (map != null) {
                doctorTotal = map.get("total").toString();
                doctorTotal = map.get("total").toString();
            }
            }
            if (StringUtils.isNoneBlank(doctorTotal)){
            if (StringUtils.isNoneBlank(doctorTotal)) {
                //总人次
                //总人次
                if (!day.equalsIgnoreCase("0")){
                    total = Integer.parseInt(doctorTotal)*Integer.parseInt(day);
                }else {
                    total= Integer.parseInt(doctorTotal);
                if (!day.equalsIgnoreCase("0")) {
                    total = Integer.parseInt(doctorTotal) * Integer.parseInt(day);
                } else {
                    total = Integer.parseInt(doctorTotal);
                }
                }
            }
            }
            Integer yishangbaoTotal = 0;
            Integer yishangbaoTotal = 0;
            Integer weishangbaoTotal =0;
            Integer weishangbaoTotal = 0;
            Integer zhengchangTotal = 0;
            Integer zhengchangTotal = 0;
            Integer yichangTotal = 0;
            Integer yichangTotal = 0;
            if (StringUtils.isNoneBlank(startDate)){
                sql +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
            }
            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) ";
            if (StringUtils.isNoneBlank(startDate)) {
                sql += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' ";
            }
            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) ";
                }
                }
            }
            }
            if (StringUtils.isNoneBlank(deptCondition)){
                sql+=" and d.doctor_id IN "+deptCondition;
            if (StringUtils.isNoneBlank(deptCondition)) {
                sql += " and d.doctor_id IN " + deptCondition;
            }
            }
            if (StringUtils.isNoneBlank(idTypeCondition)){
                sql+=" and d.doctor_id IN "+idTypeCondition ;
            if (StringUtils.isNoneBlank(idTypeCondition)) {
                sql += " and d.doctor_id IN " + idTypeCondition;
            }
            }
            if (StringUtils.isNoneBlank(name)){
                sql+=" and d.doctor_name like '%"+name+"%'" ;
            if (StringUtils.isNoneBlank(name)) {
                sql += " and d.doctor_name like '%" + name + "%'";
            }
            }
            //已上传
            //已上传
            Map<String,Object> yishangchaungMap = jdbcTemplate.queryForMap(sql);
            if (yishangchaungMap!=null){
                if (yishangchaungMap.get("total")!=null){
            Map<String, Object> yishangchaungMap = jdbcTemplate.queryForMap(sql);
            if (yishangchaungMap != null) {
                if (yishangchaungMap.get("total") != null) {
                    yishangbaoTotal = Integer.parseInt(yishangchaungMap.get("total").toString());
                    yishangbaoTotal = Integer.parseInt(yishangchaungMap.get("total").toString());
                }
                }
            }
            }
            //未上报
            //未上报
            weishangbaoTotal=total-yishangbaoTotal;
            weishangbaoTotal = total - yishangbaoTotal;
            //上传总次数
            //上传总次数
            Integer shangchuanTotal= 0;
            Integer shangchuanTotal = 0;
            String shangchuanTotalSql = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1  ";
            String shangchuanTotalSql = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1  ";
            if (StringUtils.isNoneBlank(startDate)){
                shangchuanTotalSql +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
            if (StringUtils.isNoneBlank(startDate)) {
                shangchuanTotalSql += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' ";
            }
            }
            if (StringUtils.isNoneBlank(deptCondition)){
                shangchuanTotalSql +=" and d.doctor_id IN "+deptCondition;
            if (StringUtils.isNoneBlank(deptCondition)) {
                shangchuanTotalSql += " and d.doctor_id IN " + deptCondition;
            }
            }
            if (StringUtils.isNoneBlank(idTypeCondition)){
                shangchuanTotalSql +=" and d.doctor_id IN "+idTypeCondition ;
            if (StringUtils.isNoneBlank(idTypeCondition)) {
                shangchuanTotalSql += " and d.doctor_id IN " + idTypeCondition;
            }
            }
            if (StringUtils.isNoneBlank(name)){
                shangchuanTotalSql+=" and d.doctor_name like '%"+name+"%'" ;
            if (StringUtils.isNoneBlank(name)) {
                shangchuanTotalSql += " and d.doctor_name like '%" + name + "%'";
            }
            }
            Map<String,Object> shangchuanMap = jdbcTemplate.queryForMap(shangchuanTotalSql);
            if (shangchuanMap!=null){
                if (shangchuanMap.get("total")!=null){
            Map<String, Object> shangchuanMap = jdbcTemplate.queryForMap(shangchuanTotalSql);
            if (shangchuanMap != null) {
                if (shangchuanMap.get("total") != null) {
                    shangchuanTotal = Integer.parseInt(shangchuanMap.get("total").toString());
                    shangchuanTotal = Integer.parseInt(shangchuanMap.get("total").toString());
                }
                }
            }
            }
@ -676,53 +753,53 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
            //正常、异常
            //正常、异常
            String sqlZhengchang = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1 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) ";
            String sqlZhengchang = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1 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) ";
            if (StringUtils.isNoneBlank(startDate)){
                sqlZhengchang +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
            if (StringUtils.isNoneBlank(startDate)) {
                sqlZhengchang += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' ";
            }
            }
            if (StringUtils.isNoneBlank(deptCondition)){
                sqlZhengchang +=" and d.doctor_id IN "+deptCondition;
            if (StringUtils.isNoneBlank(deptCondition)) {
                sqlZhengchang += " and d.doctor_id IN " + deptCondition;
            }
            }
            if (StringUtils.isNoneBlank(idTypeCondition)){
                sqlZhengchang +=" and d.doctor_id IN "+idTypeCondition ;
            if (StringUtils.isNoneBlank(idTypeCondition)) {
                sqlZhengchang += " and d.doctor_id IN " + idTypeCondition;
            }
            }
            if (StringUtils.isNoneBlank(name)){
                sqlZhengchang+=" and d.doctor_name like '%"+name+"%'" ;
            if (StringUtils.isNoneBlank(name)) {
                sqlZhengchang += " and d.doctor_name like '%" + name + "%'";
            }
            }
            //正常
            //正常
            Map<String,Object> zhengchangMap = jdbcTemplate.queryForMap(sqlZhengchang);
            if (zhengchangMap!=null){
                if (zhengchangMap.get("total")!=null){
            Map<String, Object> zhengchangMap = jdbcTemplate.queryForMap(sqlZhengchang);
            if (zhengchangMap != null) {
                if (zhengchangMap.get("total") != null) {
                    zhengchangTotal = Integer.parseInt(zhengchangMap.get("total").toString());
                    zhengchangTotal = Integer.parseInt(zhengchangMap.get("total").toString());
                }
                }
            }
            }
            String sqlYichang = "select COUNT(1) 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 sqlYichang = "select COUNT(1) 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)  ";
            if (StringUtils.isNoneBlank(startDate)){
                sqlYichang +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
            if (StringUtils.isNoneBlank(startDate)) {
                sqlYichang += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' ";
            }
            }
            if (StringUtils.isNoneBlank(deptCondition)){
                sqlYichang +=" and d.doctor_id IN "+deptCondition;
            if (StringUtils.isNoneBlank(deptCondition)) {
                sqlYichang += " and d.doctor_id IN " + deptCondition;
            }
            }
            if (StringUtils.isNoneBlank(idTypeCondition)){
                sqlYichang +=" and d.doctor_id IN "+idTypeCondition ;
            if (StringUtils.isNoneBlank(idTypeCondition)) {
                sqlYichang += " and d.doctor_id IN " + idTypeCondition;
            }
            }
            if (StringUtils.isNoneBlank(name)){
                sqlYichang+=" and d.doctor_name like '%"+name+"%'" ;
            if (StringUtils.isNoneBlank(name)) {
                sqlYichang += " and d.doctor_name like '%" + name + "%'";
            }
            }
            //正常
            //正常
            Map<String,Object> yichangMap = jdbcTemplate.queryForMap(sqlYichang);
            if (yichangMap!=null){
                if (yichangMap.get("total")!=null){
            Map<String, Object> yichangMap = jdbcTemplate.queryForMap(sqlYichang);
            if (yichangMap != null) {
                if (yichangMap.get("total") != null) {
                    yichangTotal = Integer.parseInt(yichangMap.get("total").toString());
                    yichangTotal = Integer.parseInt(yichangMap.get("total").toString());
                }
                }
            }
            }
            object.put("total",total);//总人次
            object.put("yishangbaoTotal",yishangbaoTotal);//已上报
            object.put("weishangbaoTotal",weishangbaoTotal);//未上报
            object.put("zhengchangTotal",zhengchangTotal);//上报正常
            object.put("yichangTotal",yichangTotal);//上报异常
            object.put("shangchuanTotal",shangchuanTotal);//上传总次数
            deptmap.put("tongyishuju",object);
            object.put("total", total);//总人次
            object.put("yishangbaoTotal", yishangbaoTotal);//已上报
            object.put("weishangbaoTotal", weishangbaoTotal);//未上报
            object.put("zhengchangTotal", zhengchangTotal);//上报正常
            object.put("yichangTotal", yichangTotal);//上报异常
            object.put("shangchuanTotal", shangchuanTotal);//上传总次数
            deptmap.put("tongyishuju", object);
        }
        }
        return mapList;
        return mapList;
@ -739,60 +816,60 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
     * @param endDate
     * @param endDate
     * @return
     * @return
     */
     */
    public JSONArray selectListByTotal(String dept,String idType,String status,String state,String startDate,String endDate,String name){
        long days = DateUtil.getDays(endDate,startDate);
    public JSONArray selectListByTotal(String dept, String idType, String status, String state, String startDate, String endDate, String name) {
        long days = DateUtil.getDays(endDate, startDate);
        List<String> list = new ArrayList<>();
        List<String> list = new ArrayList<>();
        Date startTime = DateUtil.strToDateShort(startDate);
        Date startTime = DateUtil.strToDateShort(startDate);
        for (int i=0;i<=days;i++){
            Date date = DateUtil.getPreDays(startTime,i);
        for (int i = 0; i <= days; i++) {
            Date date = DateUtil.getPreDays(startTime, i);
            String str = DateUtil.dateToStrShort(date);
            String str = DateUtil.dateToStrShort(date);
            list.add(str);
            list.add(str);
        }
        }
        JSONArray array = new JSONArray();
        JSONArray array = new JSONArray();
        for (int i=0;i<list.size();i++){
        for (int i = 0; i < list.size(); i++) {
            String date = list.get(i);
            String date = list.get(i);
            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 ";
            String deptCondition = "";
            String deptCondition = "";
            if (StringUtils.isNoneBlank(dept)){
                deptCondition +=" (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '"+dept+"' and dh.del=1 )";
            if (StringUtils.isNoneBlank(dept)) {
                deptCondition += " (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )";
            }
            }
            String idTypeCondition = " ";
            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(idType)) {
                idTypeCondition += "  (select d1.id from base_doctor d1 where 1=1 and d1.id_type = '" + idType + "')";
            }
            }
            if (StringUtils.isNoneBlank(deptCondition)){
                doctorSql+=" and d.id IN "+deptCondition;
            if (StringUtils.isNoneBlank(deptCondition)) {
                doctorSql += " and d.id IN " + deptCondition;
            }
            }
            if (StringUtils.isNoneBlank(idTypeCondition)){
                doctorSql+=" and d.id IN "+idTypeCondition ;
            if (StringUtils.isNoneBlank(idTypeCondition)) {
                doctorSql += " and d.id IN " + idTypeCondition;
            }
            }
            if (StringUtils.isNoneBlank(status)){
                if (status.equalsIgnoreCase("1")){
                    doctorSql +=" and d.id in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59' )";
                }else if (status.equalsIgnoreCase("2")){
                    doctorSql +=" and d.id not in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59' )";
            if (StringUtils.isNoneBlank(status)) {
                if (status.equalsIgnoreCase("1")) {
                    doctorSql += " and d.id in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='" + date + " 00:00:00' and d1.create_time<='" + date + " 23:59:59' )";
                } else if (status.equalsIgnoreCase("2")) {
                    doctorSql += " and d.id not in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='" + date + " 00:00:00' and d1.create_time<='" + date + " 23:59:59' )";
                }
                }
            }
            }
            if (StringUtils.isNoneBlank(state)){
                if (state.equalsIgnoreCase("1")){
                    doctorSql +=" and d.id in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59' and (d1.health_code not in(2,3) and CAST(d1.temperature as DECIMAL)<37.3 and  d1.is_symptoms=2 and d1.is_epidemic=2))  ";
                }else if (state.equalsIgnoreCase("2")){
                    doctorSql +=" and d.id in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59' and (d1.health_code in(2,3) OR CAST(d1.temperature as DECIMAL)>=37.3 OR  d1.is_symptoms=1 OR d1.is_epidemic=1)) ";
            if (StringUtils.isNoneBlank(state)) {
                if (state.equalsIgnoreCase("1")) {
                    doctorSql += " and d.id in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='" + date + " 00:00:00' and d1.create_time<='" + date + " 23:59:59' and (d1.health_code not in(2,3) and CAST(d1.temperature as DECIMAL)<37.3 and  d1.is_symptoms=2 and d1.is_epidemic=2))  ";
                } else if (state.equalsIgnoreCase("2")) {
                    doctorSql += " and d.id in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='" + date + " 00:00:00' and d1.create_time<='" + date + " 23:59:59' and (d1.health_code in(2,3) OR CAST(d1.temperature as DECIMAL)>=37.3 OR  d1.is_symptoms=1 OR d1.is_epidemic=1)) ";
                }
                }
            }
            }
            if (StringUtils.isNoneBlank(name)){
                doctorSql +=" and d.name LIKE  '%"+name+"%' ";
            if (StringUtils.isNoneBlank(name)) {
                doctorSql += " and d.name LIKE  '%" + name + "%' ";
            }
            }
            Map<String,Object> map = jdbcTemplate.queryForMap(doctorSql);
            Map<String, Object> map = jdbcTemplate.queryForMap(doctorSql);
            Integer total = 0;
            Integer total = 0;
            if (map!=null){
                if (map.get("total")!=null){
            if (map != null) {
                if (map.get("total") != null) {
                    total = Integer.parseInt(map.get("total").toString());
                    total = Integer.parseInt(map.get("total").toString());
                }
                }
            }
            }
            JSONObject object = new JSONObject();
            JSONObject object = new JSONObject();
            object.put("time",date);
            object.put("total",total);
            object.put("time", date);
            object.put("total", total);
            array.add(object);
            array.add(object);
        }
        }
        return array;
        return array;
@ -807,97 +884,97 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
     * @param state
     * @param state
     * @param startDate
     * @param startDate
     * @param endDate
     * @param endDate
     * @param name total
     * @param name      total
     * @return
     * @return
     */
     */
    public JSONArray selectListInfoByTotal(String dept,String idType,String status,String state,String startDate,String endDate,String name){
        long days = DateUtil.getDays(endDate,startDate);
    public JSONArray selectListInfoByTotal(String dept, String idType, String status, String state, String startDate, String endDate, String name) {
        long days = DateUtil.getDays(endDate, startDate);
        List<String> list = new ArrayList<>();
        List<String> list = new ArrayList<>();
        Date startTime = DateUtil.strToDateShort(startDate);
        Date startTime = DateUtil.strToDateShort(startDate);
        for (int i=0;i<=days;i++){
            Date date = DateUtil.getPreDays(startTime,i);
        for (int i = 0; i <= days; i++) {
            Date date = DateUtil.getPreDays(startTime, i);
            String str = DateUtil.dateToStrShort(date);
            String str = DateUtil.dateToStrShort(date);
            list.add(str);
            list.add(str);
        }
        }
        JSONArray array = new JSONArray();
        JSONArray array = new JSONArray();
        for (int i=0;i<list.size();i++){
        for (int i = 0; i < list.size(); i++) {
            String date = list.get(i);
            String date = list.get(i);
            String doctorSql =" select d.name,d.id,d.job_title_name as jobTitleName,d.photo from base_doctor d where d.del=1 ";
            String doctorSql = " select d.name,d.id,d.job_title_name as jobTitleName,d.photo from base_doctor d where d.del=1 ";
            String deptCondition = "";
            String deptCondition = "";
            if (StringUtils.isNoneBlank(dept)){
                deptCondition +=" (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '"+dept+"' and dh.del=1 )";
            if (StringUtils.isNoneBlank(dept)) {
                deptCondition += " (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )";
            }
            }
            String idTypeCondition = " ";
            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(idType)) {
                idTypeCondition += "  (select d1.id from base_doctor d1 where 1=1 and d1.id_type = '" + idType + "')";
            }
            }
            if (StringUtils.isNoneBlank(deptCondition)){
                doctorSql+=" and d.id IN "+deptCondition;
            if (StringUtils.isNoneBlank(deptCondition)) {
                doctorSql += " and d.id IN " + deptCondition;
            }
            }
            if (StringUtils.isNoneBlank(idTypeCondition)){
                doctorSql+=" and d.id IN "+idTypeCondition ;
            if (StringUtils.isNoneBlank(idTypeCondition)) {
                doctorSql += " and d.id IN " + idTypeCondition;
            }
            }
            if (StringUtils.isNoneBlank(status)){
                if (status.equalsIgnoreCase("1")){
                    doctorSql +=" and d.id in (select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59')";
                }else if (status.equalsIgnoreCase("2")){
                    doctorSql +=" and d.id not in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59')";
            if (StringUtils.isNoneBlank(status)) {
                if (status.equalsIgnoreCase("1")) {
                    doctorSql += " and d.id in (select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='" + date + " 00:00:00' and d1.create_time<='" + date + " 23:59:59')";
                } else if (status.equalsIgnoreCase("2")) {
                    doctorSql += " and d.id not in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='" + date + " 00:00:00' and d1.create_time<='" + date + " 23:59:59')";
                }
                }
            }
            }
            if (StringUtils.isNoneBlank(state)){
                if (state.equalsIgnoreCase("1")){
                    doctorSql +=" and d.id in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59' and (d1.health_code not in(2,3) and CAST(d1.temperature as DECIMAL)<37.3 and  d1.is_symptoms=2 and d1.is_epidemic=2) )  ";
                }else if (state.equalsIgnoreCase("2")){
                    doctorSql +=" and d.id in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59' and (d1.health_code in(2,3) OR CAST(d1.temperature as DECIMAL)>=37.3 OR  d1.is_symptoms=1 OR d1.is_epidemic=1)) ";
            if (StringUtils.isNoneBlank(state)) {
                if (state.equalsIgnoreCase("1")) {
                    doctorSql += " and d.id in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='" + date + " 00:00:00' and d1.create_time<='" + date + " 23:59:59' and (d1.health_code not in(2,3) and CAST(d1.temperature as DECIMAL)<37.3 and  d1.is_symptoms=2 and d1.is_epidemic=2) )  ";
                } else if (state.equalsIgnoreCase("2")) {
                    doctorSql += " and d.id in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='" + date + " 00:00:00' and d1.create_time<='" + date + " 23:59:59' and (d1.health_code in(2,3) OR CAST(d1.temperature as DECIMAL)>=37.3 OR  d1.is_symptoms=1 OR d1.is_epidemic=1)) ";
                }
                }
            }
            }
            if (StringUtils.isNoneBlank(name)){
                doctorSql +=" and d.NAME  LIKE '%"+name+"%'";
            if (StringUtils.isNoneBlank(name)) {
                doctorSql += " and d.NAME  LIKE '%" + name + "%'";
            }
            }
            List<Map<String,Object>> mapList = jdbcTemplate.queryForList(doctorSql);
            for (Map<String,Object> map:mapList){
            List<Map<String, Object>> mapList = jdbcTemplate.queryForList(doctorSql);
            for (Map<String, Object> map : mapList) {
                String id = map.get("id").toString();
                String id = map.get("id").toString();
                List<BaseDoctorHospitalDO> hospitalDOList = baseDoctorHospitalDao.findByDoctorCode(id);
                List<BaseDoctorHospitalDO> hospitalDOList = baseDoctorHospitalDao.findByDoctorCode(id);
                map.put("deptInfo",hospitalDOList);
                map.put("deptInfo", hospitalDOList);
                String stateCondition = "";
                String stateCondition = "";
                if (StringUtils.isNoneBlank(state)){
                    if (state.equalsIgnoreCase("1")){
                        stateCondition +=" and (d1.health_code not in(2,3) and CAST(d1.temperature as DECIMAL)<37.3 and  d1.is_symptoms=2 and d1.is_epidemic=2)  ";
                    }else if (state.equalsIgnoreCase("2")){
                        stateCondition +=" and (d1.health_code in(2,3) OR CAST(d1.temperature as DECIMAL)>=37.3 OR  d1.is_symptoms=1 OR d1.is_epidemic=1) ";
                if (StringUtils.isNoneBlank(state)) {
                    if (state.equalsIgnoreCase("1")) {
                        stateCondition += " and (d1.health_code not in(2,3) and CAST(d1.temperature as DECIMAL)<37.3 and  d1.is_symptoms=2 and d1.is_epidemic=2)  ";
                    } else if (state.equalsIgnoreCase("2")) {
                        stateCondition += " and (d1.health_code in(2,3) OR CAST(d1.temperature as DECIMAL)>=37.3 OR  d1.is_symptoms=1 OR d1.is_epidemic=1) ";
                    }
                    }
                }
                }
                String sql = "select d1.health_code,d1.temperature,d1.is_symptoms as isSymptoms,d1.is_epidemic as isEpidemic,d1.id,d1.consumer,d1.consumer_name as consumerName,date_format(d1.create_time ,'%Y-%m-%d %H:%i:%S' ) AS createTime from base_doctor_health_upload d1 where 1=1 "+stateCondition+" and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59' and d1.doctor_id = '"+id+"' order by d1.create_time desc ";
                List<Map<String,Object>> mapList1 = jdbcTemplate.queryForList(sql);
                if (mapList1!=null&&mapList1.size()!=0){
                    for (Map<String,Object> map1:mapList1){
                String sql = "select d1.health_code,d1.temperature,d1.is_symptoms as isSymptoms,d1.is_epidemic as isEpidemic,d1.id,d1.consumer,d1.consumer_name as consumerName,date_format(d1.create_time ,'%Y-%m-%d %H:%i:%S' ) AS createTime from base_doctor_health_upload d1 where 1=1 " + stateCondition + " and d1.create_time >='" + date + " 00:00:00' and d1.create_time<='" + date + " 23:59:59' and d1.doctor_id = '" + id + "' order by d1.create_time desc ";
                List<Map<String, Object>> mapList1 = jdbcTemplate.queryForList(sql);
                if (mapList1 != null && mapList1.size() != 0) {
                    for (Map<String, Object> map1 : mapList1) {
                        String healthCode = map1.get("health_code").toString();
                        String healthCode = map1.get("health_code").toString();
                        Double temperature = Double.parseDouble(map1.get("temperature").toString());
                        Double temperature = Double.parseDouble(map1.get("temperature").toString());
                        String isSymptoms = map1.get("isSymptoms").toString();
                        String isSymptoms = map1.get("isSymptoms").toString();
                        String isEpidemic = map1.get("isEpidemic").toString();
                        String isEpidemic = map1.get("isEpidemic").toString();
                        if (healthCode.equalsIgnoreCase("2")||healthCode.equalsIgnoreCase("3")||
                                temperature>=37.3||isSymptoms.equalsIgnoreCase("1")||isEpidemic.equalsIgnoreCase("1")){
                            map1.put("healthState","异常");
                        }else {
                            map1.put("healthState","正常");
                        if (healthCode.equalsIgnoreCase("2") || healthCode.equalsIgnoreCase("3") ||
                                temperature >= 37.3 || isSymptoms.equalsIgnoreCase("1") || isEpidemic.equalsIgnoreCase("1")) {
                            map1.put("healthState", "异常");
                        } else {
                            map1.put("healthState", "正常");
                        }
                        }
                        map.put("uploadState","已上报");
                        map.put("uploadId",map1.get("id").toString());
                        map.put("uploadState", "已上报");
                        map.put("uploadId", map1.get("id").toString());
                    }
                    }
                    map.put("recordList",mapList1);
                }else {
                    map.put("healthState","未知");
                    map.put("uploadState","未上报");
                    map.put("uploadId","");
                    map.put("consumer","");
                    map.put("consumerName","");
                    map.put("createTime","");
                    map.put("recordList",mapList1);
                    map.put("recordList", mapList1);
                } else {
                    map.put("healthState", "未知");
                    map.put("uploadState", "未上报");
                    map.put("uploadId", "");
                    map.put("consumer", "");
                    map.put("consumerName", "");
                    map.put("createTime", "");
                    map.put("recordList", mapList1);
                }
                }
            }
            }
            JSONObject object = new JSONObject();
            JSONObject object = new JSONObject();
            object.put("time",date);
            object.put("list",mapList);
            object.put("time", date);
            object.put("list", mapList);
            array.add(object);
            array.add(object);
        }
        }
        return array;
        return array;
@ -911,19 +988,19 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
     * @param endDate
     * @param endDate
     * @return
     * @return
     */
     */
    public JSONArray selectListInfoExcelByTotal(OutputStream os,String startDate,String endDate) throws Exception {
        long days = DateUtil.getDays(endDate,startDate);
    public JSONArray selectListInfoExcelByTotal(OutputStream os, String startDate, String endDate, String dept) throws Exception {
        long days = DateUtil.getDays(endDate, startDate);
        List<String> list = new ArrayList<>();
        List<String> list = new ArrayList<>();
        Date startTime = DateUtil.strToDateShort(startDate);
        Date startTime = DateUtil.strToDateShort(startDate);
        for (int i=0;i<=days;i++){
            Date date = DateUtil.getPreDays(startTime,i);
        for (int i = 0; i <= days; i++) {
            Date date = DateUtil.getPreDays(startTime, i);
            String str = DateUtil.dateToStrShort(date);
            String str = DateUtil.dateToStrShort(date);
            list.add(str);
            list.add(str);
        }
        }
        JSONArray array = new JSONArray();
        JSONArray array = new JSONArray();
        for (int i=0;i<list.size();i++){
        for (int i = 0; i < list.size(); i++) {
            String date = list.get(i);
            String date = list.get(i);
            String doctorSql ="SELECT\n" +
            String doctorSql = "SELECT\n" +
                    "\td.idcard as idcard,\n" +
                    "\td.idcard as idcard,\n" +
                    "\td.name as name,\n" +
                    "\td.name as name,\n" +
                    "\td.mobile as mobile,\n" +
                    "\td.mobile as mobile,\n" +
@ -942,177 +1019,180 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
                    "\tdhu.is_outside as isOutside,\n" +
                    "\tdhu.is_outside as isOutside,\n" +
                    "\tdhu.is_nucleate as isNucleate,\n" +
                    "\tdhu.is_nucleate as isNucleate,\n" +
                    "\tdhu.is_outside_high as isOutsideHigh, \n" +
                    "\tdhu.is_outside_high as isOutsideHigh, \n" +
                    "date_format(dhu.create_time ,'%Y-%m-%d %H:%i:%S' ) AS createTime "+
                    "date_format(dhu.create_time ,'%Y-%m-%d %H:%i:%S' ) AS createTime " +
                    " FROM\n" +
                    " FROM\n" +
                    "\tbase_doctor d\n" +
                    "\tbase_doctor d\n" +
                    "LEFT JOIN /* (SELECT * FROM base_doctor_health_upload dhu1*/ base_doctor_health_upload dhu ON dhu.doctor_id = d.id WHERE dhu.create_time >= '"+date+" 00:00:00' AND dhu.create_time <= '"+date+" 23:59:59'   ";
            List<Map<String,Object>> mapList = jdbcTemplate.queryForList(doctorSql);
            for (Map<String,Object> map:mapList){
                    "LEFT JOIN /* (SELECT * FROM base_doctor_health_upload dhu1*/ base_doctor_health_upload dhu ON dhu.doctor_id = d.id WHERE dhu.create_time >= '" + date + " 00:00:00' AND dhu.create_time <= '" + date + " 23:59:59'  ";
            if (StringUtils.isNoneBlank(dept)) {
                doctorSql += " and d.id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )";
            }
            List<Map<String, Object>> mapList = jdbcTemplate.queryForList(doctorSql);
            for (Map<String, Object> map : mapList) {
                String id = map.get("id").toString();
                String id = map.get("id").toString();
                List<BaseDoctorHospitalDO> baseDoctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(id);
                List<BaseDoctorHospitalDO> baseDoctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(id);
                if (baseDoctorHospitalDOS!=null&&baseDoctorHospitalDOS.size()!=0){
                    map.put("deptName",baseDoctorHospitalDOS.get(0).getDeptName());
                if (baseDoctorHospitalDOS != null && baseDoctorHospitalDOS.size() != 0) {
                    map.put("deptName", baseDoctorHospitalDOS.get(0).getDeptName());
                }
                }
            }
            }
            JSONObject object = new JSONObject();
            JSONObject object = new JSONObject();
            object.put("time",date);
            object.put("list",mapList);
            object.put("time", date);
            object.put("list", mapList);
            array.add(object);
            array.add(object);
        }
        }
        pushListWritePriceTotal(os,array,startDate,endDate);
        pushListWritePriceTotal(os, array, startDate, endDate);
        return array;
        return array;
    }
    }
    /**
    /**
     *
     * mergeCells(a,b,c,d)
     * mergeCells(a,b,c,d)
     * a 单元格的列号
     * a 单元格的列号
     b 单元格的行号
     c 从单元格[a,b]起,向左合并到c列
     d 从单元格[a,b]起,向下合并到d行
     * <p>
     * b 单元格的行号
     * <p>
     * c 从单元格[a,b]起,向左合并到c列
     * <p>
     * d 从单元格[a,b]起,向下合并到d行
     * 收入日报导出
     * 收入日报导出
     *
     * @param os
     * @param os
     * @param ls
     * @param ls
     * @param startTime
     * @param startTime
     * @param endTime
     * @param endTime
     * @throws Exception
     * @throws Exception
     */
     */
    public void pushListWritePriceTotal(OutputStream os,JSONArray ls,String startTime, String endTime) throws Exception {
    public void pushListWritePriceTotal(OutputStream os, JSONArray ls, String startTime, String endTime) throws Exception {
        WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
        WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
        try {
        try {
        for (int i=0;i<ls.size();i++){
            JSONObject jsonObject = ls.getJSONObject(i);
            String time = jsonObject.getString("time");
            WritableSheet ws;
            ws = wwb.createSheet(time, i+1);
            String[] header = {"互联网综合服务平台健康上报情况","","","","","","","","","","","","","",""};//
            int k = 0;
            for (String h : header) {
                addCell(ws, 0, k, h);//表名,行,列,header
                k++;
            }
            for (int i = 0; i < ls.size(); i++) {
                JSONObject jsonObject = ls.getJSONObject(i);
                String time = jsonObject.getString("time");
                WritableSheet ws;
                ws = wwb.createSheet(time, i + 1);
                String[] header = {"互联网综合服务平台健康上报情况", "", "", "", "", "", "", "", "", "", "", "", "", "", ""};//
                int k = 0;
                for (String h : header) {
                    addCell(ws, 0, k, h);//表名,行,列,header
                    k++;
                }
            String[] header2 = {"科室","姓名","电话","身份类别","上报状态","所在地","体温","健康码","行程码","异常症状","涉疫人员","14天内从外地返","核酸检测","14天内有同往人从中高风险返厦","健康状态","上报时间"};//
            int k2 = 0;
            for (String h : header2) {
                addCell(ws, 1, k2, h);//表名,行,列,header
                k2++;
            }
            int j= 1;
            JSONArray array = jsonObject.getJSONArray("list");
            for (int z=0;z<array.size();z++){
                j=j+1;
                JSONObject object = array.getJSONObject(z);
                addCell(ws, j, 0, object.getString("deptName"));//表名,行,列,header
                addCell(ws, j, 1, object.getString("name"));//表名,行,列,header
                addCell(ws, j, 2, object.getString("mobile"));//表名,行,列,header
                if (StringUtils.isNoneBlank(object.getString("idType"))){
                    addCell(ws, j, 3, object.getString("idType"));//表名,行,列,header
                }else {
                    addCell(ws, j, 3, "");//表名,行,列,header
                String[] header2 = {"科室", "姓名", "电话", "身份类别", "上报状态", "所在地", "体温", "健康码", "行程码", "异常症状", "涉疫人员", "14天内从外地返", "核酸检测", "14天内有同往人从中高风险返厦", "健康状态", "上报时间"};//
                int k2 = 0;
                for (String h : header2) {
                    addCell(ws, 1, k2, h);//表名,行,列,header
                    k2++;
                }
                }
                if (StringUtils.isNoneBlank(object.getString("temperature"))){
                    String address = "";
                    if ( StringUtils.isNoneBlank(object.getString("provinceName"))){
                        address +=object.getString("provinceName");
                    }
                    if ( StringUtils.isNoneBlank(object.getString("cityName"))){
                        address +=object.getString("cityName");
                    }
                    if ( StringUtils.isNoneBlank(object.getString("townName"))){
                        address +=object.getString("townName");
                    }
                    addCell(ws, j, 4, "已上报");//表名,行,列,header
                    addCell(ws, j, 5,address);//表名,行,列,header
                    addCell(ws, j, 6, object.getString("temperature"));//表名,行,列,header
                    String healthCodeName="";
                    String healthStateName= "";
                    if (object.getString("healthCode").equalsIgnoreCase("1")){
                        healthCodeName="绿码";
                    }else if (object.getString("healthCode").equalsIgnoreCase("2")){
                        healthCodeName="红码";
                    }else if (object.getString("healthCode").equalsIgnoreCase("3")){
                        healthCodeName="黄码";
                    }
                    if (object.getString("healthCode").equalsIgnoreCase("2")||object.getString("healthCode").equalsIgnoreCase("3")||
                            object.getDouble("temperature")>=37.3||object.getString("isSymtoms").equalsIgnoreCase("1")||object.getString("isEpidemic").equalsIgnoreCase("1")){
                        healthStateName="异常";
                    }else {
                        healthStateName="正常";
                    }
                    String tourCodeName = "";
                    if (object.getString("tourCode").equalsIgnoreCase("1")){
                        tourCodeName="带星";
                    }else if (object.getString("tourCode").equalsIgnoreCase("2")){
                        tourCodeName="不带星";
                    }
                    String isSymtomsName="";
                    if (object.getString("isSymtoms").equalsIgnoreCase("1")){
                        isSymtomsName="是";
                    }else if (object.getString("isSymtoms").equalsIgnoreCase("2")){
                        isSymtomsName="否";
                    }
                    String isEpidemicName="";
                    if (object.getString("isEpidemic").equalsIgnoreCase("1")){
                        isEpidemicName="是";
                    }else if (object.getString("isEpidemic").equalsIgnoreCase("2")){
                        isEpidemicName="否";
                    }
                    String isOutsideName="";
                    if (object.getString("isOutside").equalsIgnoreCase("1")){
                        isOutsideName="是";
                    }else if (object.getString("isOutside").equalsIgnoreCase("2")){
                        isOutsideName="否";
                    }
                    String isNucleateName="";
                    if (object.getString("isNucleate").equalsIgnoreCase("1")){
                        isNucleateName="未做";
                    }else if (object.getString("isNucleate").equalsIgnoreCase("2")){
                        isNucleateName="已做(院内)";
                    }else if (object.getString("isNucleate").equalsIgnoreCase("3")){
                        isNucleateName="已做(院外)";
                    }
                    String isOutsideHighName="";
                    if (object.getString("isOutsideHigh").equalsIgnoreCase("1")){
                        isOutsideHighName="是";
                    }else if (object.getString("isOutsideHigh").equalsIgnoreCase("2")){
                        isOutsideHighName="否";
                    }
                    String createTime= "";
                    if (object.get("createTime")!=null){
                        createTime = object.getString("createTime");
                int j = 1;
                JSONArray array = jsonObject.getJSONArray("list");
                for (int z = 0; z < array.size(); z++) {
                    j = j + 1;
                    JSONObject object = array.getJSONObject(z);
                    addCell(ws, j, 0, object.getString("deptName"));//表名,行,列,header
                    addCell(ws, j, 1, object.getString("name"));//表名,行,列,header
                    addCell(ws, j, 2, object.getString("mobile"));//表名,行,列,header
                    if (StringUtils.isNoneBlank(object.getString("idType"))) {
                        addCell(ws, j, 3, object.getString("idType"));//表名,行,列,header
                    } else {
                        addCell(ws, j, 3, "");//表名,行,列,header
                    }
                    }
                    if (StringUtils.isNoneBlank(object.getString("temperature"))) {
                        String address = "";
                        if (StringUtils.isNoneBlank(object.getString("provinceName"))) {
                            address += object.getString("provinceName");
                        }
                        if (StringUtils.isNoneBlank(object.getString("cityName"))) {
                            address += object.getString("cityName");
                        }
                        if (StringUtils.isNoneBlank(object.getString("townName"))) {
                            address += object.getString("townName");
                        }
                        addCell(ws, j, 4, "已上报");//表名,行,列,header
                        addCell(ws, j, 5, address);//表名,行,列,header
                        addCell(ws, j, 6, object.getString("temperature"));//表名,行,列,header
                        String healthCodeName = "";
                        String healthStateName = "";
                        if (object.getString("healthCode").equalsIgnoreCase("1")) {
                            healthCodeName = "绿码";
                        } else if (object.getString("healthCode").equalsIgnoreCase("2")) {
                            healthCodeName = "红码";
                        } else if (object.getString("healthCode").equalsIgnoreCase("3")) {
                            healthCodeName = "黄码";
                        }
                        if (object.getString("healthCode").equalsIgnoreCase("2") || object.getString("healthCode").equalsIgnoreCase("3") ||
                                object.getDouble("temperature") >= 37.3 || object.getString("isSymtoms").equalsIgnoreCase("1") || object.getString("isEpidemic").equalsIgnoreCase("1")) {
                            healthStateName = "异常";
                        } else {
                            healthStateName = "正常";
                        }
                        String tourCodeName = "";
                        if (object.getString("tourCode").equalsIgnoreCase("1")) {
                            tourCodeName = "带星";
                        } else if (object.getString("tourCode").equalsIgnoreCase("2")) {
                            tourCodeName = "不带星";
                        }
                        String isSymtomsName = "";
                        if (object.getString("isSymtoms").equalsIgnoreCase("1")) {
                            isSymtomsName = "是";
                        } else if (object.getString("isSymtoms").equalsIgnoreCase("2")) {
                            isSymtomsName = "否";
                        }
                        String isEpidemicName = "";
                        if (object.getString("isEpidemic").equalsIgnoreCase("1")) {
                            isEpidemicName = "是";
                        } else if (object.getString("isEpidemic").equalsIgnoreCase("2")) {
                            isEpidemicName = "否";
                        }
                        String isOutsideName = "";
                        if (object.getString("isOutside").equalsIgnoreCase("1")) {
                            isOutsideName = "是";
                        } else if (object.getString("isOutside").equalsIgnoreCase("2")) {
                            isOutsideName = "否";
                        }
                        String isNucleateName = "";
                        if (object.getString("isNucleate").equalsIgnoreCase("1")) {
                            isNucleateName = "未做";
                        } else if (object.getString("isNucleate").equalsIgnoreCase("2")) {
                            isNucleateName = "已做(院内)";
                        } else if (object.getString("isNucleate").equalsIgnoreCase("3")) {
                            isNucleateName = "已做(院外)";
                        }
                        String isOutsideHighName = "";
                        if (object.getString("isOutsideHigh").equalsIgnoreCase("1")) {
                            isOutsideHighName = "是";
                        } else if (object.getString("isOutsideHigh").equalsIgnoreCase("2")) {
                            isOutsideHighName = "否";
                        }
                        String createTime = "";
                        if (object.get("createTime") != null) {
                            createTime = object.getString("createTime");
                        }
                    addCell(ws, j, 7, healthCodeName);//表名,行,列,header
                    addCell(ws, j, 8, tourCodeName);//表名,行,列,header
                    addCell(ws, j, 9, isSymtomsName);//表名,行,列,header
                    addCell(ws, j, 10, isEpidemicName);//表名,行,列,header
                    addCell(ws, j, 11, isOutsideName);//表名,行,列,header
                    addCell(ws, j, 12, isNucleateName);//表名,行,列,header
                    addCell(ws, j, 13, isOutsideHighName);//表名,行,列,header
                    addCell(ws, j, 14, healthStateName);//表名,行,列,header
                    addCell(ws, j, 15, createTime);//表名,行,列,header
                }else {
                    addCell(ws, j, 4, "未上报");//表名,行,列,header
                    addCell(ws, j, 5, "");//表名,行,列,header
                    addCell(ws, j, 6, "");//表名,行,列,header
                    addCell(ws, j, 7, "");//表名,行,列,header
                    addCell(ws, j, 8, "");//表名,行,列,header
                    addCell(ws, j, 9, "");//表名,行,列,header
                    addCell(ws, j, 10, "");//表名,行,列,header
                    addCell(ws, j, 11, "");//表名,行,列,header
                    addCell(ws, j, 12, "");//表名,行,列,header
                    addCell(ws, j, 13, "");//表名,行,列,header
                    addCell(ws, j, 14, "");//表名,行,列,header
                    addCell(ws, j, 15, "");//表名,行,列,header
                        addCell(ws, j, 7, healthCodeName);//表名,行,列,header
                        addCell(ws, j, 8, tourCodeName);//表名,行,列,header
                        addCell(ws, j, 9, isSymtomsName);//表名,行,列,header
                        addCell(ws, j, 10, isEpidemicName);//表名,行,列,header
                        addCell(ws, j, 11, isOutsideName);//表名,行,列,header
                        addCell(ws, j, 12, isNucleateName);//表名,行,列,header
                        addCell(ws, j, 13, isOutsideHighName);//表名,行,列,header
                        addCell(ws, j, 14, healthStateName);//表名,行,列,header
                        addCell(ws, j, 15, createTime);//表名,行,列,header
                    } else {
                        addCell(ws, j, 4, "未上报");//表名,行,列,header
                        addCell(ws, j, 5, "");//表名,行,列,header
                        addCell(ws, j, 6, "");//表名,行,列,header
                        addCell(ws, j, 7, "");//表名,行,列,header
                        addCell(ws, j, 8, "");//表名,行,列,header
                        addCell(ws, j, 9, "");//表名,行,列,header
                        addCell(ws, j, 10, "");//表名,行,列,header
                        addCell(ws, j, 11, "");//表名,行,列,header
                        addCell(ws, j, 12, "");//表名,行,列,header
                        addCell(ws, j, 13, "");//表名,行,列,header
                        addCell(ws, j, 14, "");//表名,行,列,header
                        addCell(ws, j, 15, "");//表名,行,列,header
                    }
                }
                }
                ws.mergeCells(0, 0, 15, 0);
            }
            }
            ws.mergeCells(0,0,15,0);
        }
            wwb.write();
            wwb.write();
            wwb.close();
            wwb.close();
        } catch (IOException e) {
        } catch (IOException e) {
@ -1121,6 +1201,7 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
            throw e;
            throw e;
        }
        }
    }
    }
    //添加单元格内容
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data) throws WriteException {
    public void addCell(WritableSheet ws, int row, int column, String data) throws WriteException {
        Label label = new Label(column, row, data);
        Label label = new Label(column, row, data);
@ -1134,16 +1215,97 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
    /**
    /**
     * 查下最新一次记录
     * 查下最新一次记录
     *
     * @param doctorId
     * @param doctorId
     * @param consumer
     * @param consumer
     * @return
     * @return
     */
     */
    public BaseDoctorHealthUploadDO selectRecordByDoctorIdAndConsumer(String doctorId,String consumer){
    public BaseDoctorHealthUploadDO selectRecordByDoctorIdAndConsumer(String doctorId, String consumer) {
        BaseDoctorHealthUploadDO baseDoctorHealthUploadDO = null;
        BaseDoctorHealthUploadDO baseDoctorHealthUploadDO = null;
        List<BaseDoctorHealthUploadDO> doctorHealthUploadDOList = baseDoctorHealthUploadDao.findByDoctorIdAndConsumer(doctorId,consumer);
        if (doctorHealthUploadDOList!=null&&doctorHealthUploadDOList.size()!=0){
        List<BaseDoctorHealthUploadDO> doctorHealthUploadDOList = baseDoctorHealthUploadDao.findByDoctorIdAndConsumer(doctorId, consumer);
        if (doctorHealthUploadDOList != null && doctorHealthUploadDOList.size() != 0) {
            baseDoctorHealthUploadDO = doctorHealthUploadDOList.get(0);
            baseDoctorHealthUploadDO = doctorHealthUploadDOList.get(0);
        }
        }
        return baseDoctorHealthUploadDO;
        return baseDoctorHealthUploadDO;
    }
    }
    /**
     *
     * @param orgCode
     * @param dept
     * @param doctorCode
     * @param key
     * @param flag 是否异常1是0否
     * @return
     */
    public List<Map<String, Object>> findDoctorByHospitalAndDept(String orgCode, String dept, String doctorCode,String key, Integer flag) {
        String sql = "SELECT " +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
                " d.name AS \"name\", " +
                " d.expertise AS \"expertise\"," +
                " d.introduce AS \"introduce\"," +
                " d.job_title_code AS \"jobTitleCode\", " +
                " d.job_title_name AS \"jobTitleName\"," +
                " d.charge_type AS \"chargeType\"," +
                " d.outpatient_type AS \"outpatientType\"," +
                " d.consult_status AS \"consultStatus\"," +
                " h.dept_code AS \"deptCode\","+
                " h.dept_name AS \"deptName\","+
                " h.org_code AS \"orgCode\","+
                " h.org_name AS \"orgName\","+
                " t.photo AS \"hosptialphoto\","+
                " d.id_type AS \"idType\","+
                " d.id_card_type AS \"idCardType\" "+
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " left join base_org t on t.id = h.org_code" +
                " WHERE  " +
                " 1=1 and d.del=1 ";
        Map<String, Object> params = new HashedMap();
        if (StringUtils.isNotBlank(dept)) {
            sql += " AND h.dept_code = '" + dept + "'";
        }
        if (StringUtils.isNotBlank(orgCode)) {
            sql += " AND h.org_code = '" + orgCode + "'";
        }
        if (StringUtils.isNotBlank(key)) {
            sql += " AND (h.dept_name like '%" + key + "%' OR d.name like '%" + key + "%' OR d.expertise like '%" + key + "%') ";
        }
        if (flag!=null){
            if (flag==1){
                sql += " and d.id IN (select d.doctor_id from base_doctor_health_upload d1 where 1=1 and (d1.health_code in(2,3) OR CAST(d1.temperature as DECIMAL)>=37.3 OR  d1.is_symptoms=1 OR d1.is_epidemic=1) and d1.create_time >='"+DateUtil.getStringDateShort()+" 00:00:00"+"' and d1.create_time <='"+DateUtil.getStringDateShort()+" 23:59:59"+"')";
            }
        }
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params);
        for (Map<String,Object> map:list){
            String id = map.get("id").toString();
            Date startTime = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" 00:00:00");
            Date endTime = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" 23:59:59");
            List<BaseDoctorHealthUploadDO> healthUploadDOS = baseDoctorHealthUploadDao.selectHealthUploadInfoByDoctorIdAndStartAndEnd(id,startTime,endTime);
            if (healthUploadDOS!=null&&healthUploadDOS.size()!=0){
                map.put("healthUpload",healthUploadDOS.get(0));
            }else {
                map.put("healthUpload",null);
            }
        }
        if (list != null && list.size() > 0 && StringUtils.isNotBlank(doctorCode)) {
            //排序
            for (int i = 0; i < list.size(); i++) {
                String id = (String) list.get(i).get("id");
                if (doctorCode.equals(id)) {
                    Collections.swap(list, 0, i);
                }
            }
        }
        return list;
    }
}
}

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

@ -0,0 +1,20 @@
package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.BaseAppointmentLogDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionLogDO;
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/5/17.
 */
public interface BaseAppointmentLogDao extends PagingAndSortingRepository<BaseAppointmentLogDO, String>, JpaSpecificationExecutor<BaseAppointmentLogDO> {
    @Query("from BaseAppointmentLogDO a where a.orderCode = ?1 ")
    BaseAppointmentLogDO findOrderCode(String orderCode);
}

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

@ -73,7 +73,7 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    Integer countByTime(String type,String doctor,Date startTime,Date endTime);
    Integer countByTime(String type,String doctor,Date startTime,Date endTime);
    @Query("from WlyyOutpatientDO a where a.status = 0 and a.payStatus = 1 and (a.remindCount<?1 or a.remindCount is null)")
    @Query("from WlyyOutpatientDO a where a.status = 0 and a.payStatus = 1 and (a.remindCount<?1 or a.remindCount is null)")
    List<WlyyOutpatientDO> findWaitingOutpatient(Integer remindCount);
    List<WlyyOutpatientDO> findWaitingOutpatient(Integer remindCount);
    @Query("from WlyyOutpatientDO a where a.status = 0")
    @Query("from WlyyOutpatientDO a where a.status = 0 ")
    List<WlyyOutpatientDO> findAllWaitingOutpatient();
    List<WlyyOutpatientDO> findAllWaitingOutpatient();
    /*@Query("from WlyyOutpatientDO a where a.patient = ?1 and a.outpatientType = 1")
    /*@Query("from WlyyOutpatientDO a where a.patient = ?1 and a.outpatientType = 1")

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

@ -53,6 +53,17 @@ public class PayInfoNoticeService {
        return null;
        return null;
    }
    }
    /**
     *
     * @param title 推送标题 (不能为空)
     * @param url 支付链接   (不能为空)
     * @param doctorName 就诊医生 (不能为空)
     * @param total 总费用 (不能为空)
     * @param mipay 医保支付 (不能为空)
     * @param selfPay 个人支付 (不能为空)
     * @return
     */
    public String pushPrescriptionPayMedicare(String patient,String doctorName,String orderNo,String outpatientId,String prescriptionId,String total,String mipay,String selfPay,String title,String url){
    public String pushPrescriptionPayMedicare(String patient,String doctorName,String orderNo,String outpatientId,String prescriptionId,String total,String mipay,String selfPay,String title,String url){
        BasePatientDO patientDO = patientDao.findById(patient);
        BasePatientDO patientDO = patientDao.findById(patient);
        if (patientDO!=null){
        if (patientDO!=null){

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

@ -140,6 +140,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.CollectionUtils;
import java.beans.Transient;
import java.io.IOException;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStream;
import java.lang.Boolean;
import java.lang.Boolean;
@ -4404,6 +4405,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("idType",doctorDO.getIdType());
            rs.put("idType",doctorDO.getIdType());
            rs.put("idCard",doctorDO.getIdcard());
            rs.put("idCard",doctorDO.getIdcard());
            rs.put("idCardType",doctorDO.getIdCardType());
            rs.put("idCardType",doctorDO.getIdCardType());
            rs.put("mark",doctorDO.getMark());
            List<Map<String,Object>> chargeDictDOLists = new ArrayList<>();
            List<Map<String,Object>> chargeDictDOLists = new ArrayList<>();
            String sqlCharge = "SELECT\n" +
            String sqlCharge = "SELECT\n" +
                    "\tm.req_fee as \"twfzFee\",\n" +
                    "\tm.req_fee as \"twfzFee\",\n" +
@ -5185,6 +5187,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            remark = "点击完成支付,如您已支付请忽略本条信息";
            remark = "点击完成支付,如您已支付请忽略本条信息";
            msgUrl="/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientId+"&id="+remindMsg;
            msgUrl="/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientId+"&id="+remindMsg;
            logger.info("处方支付微信消息模板推送开始");
            logger.info("处方支付微信消息模板推送开始");
        }else if ("diagnoPayRemind".equalsIgnoreCase(titelType)) {
            //开具处方后向患者发送支付提醒
            first = outpatientDO.getConsumerName() + ",您好! 您的问诊已结束,请及时结算费用。";
            contentMsg = "您好! 您的问诊已结束,请及时结算费用。";
            remark = "点击完成支付,如您已支付请忽略本条信息";
            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
            logger.info("诊查费微信消息模板推送开始");
        } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
        } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
            //视频复诊预约提醒
            //视频复诊预约提醒
            if ("16".equals(type)) {
            if ("16".equals(type)) {
@ -5856,7 +5865,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        sql += " outpatient.disease_img AS \"disease_img\"," +
        sql += " outpatient.disease_img AS \"disease_img\"," +
                "outpatient.description AS \"description\"," +
                "outpatient.description AS \"description\"," +
                "room.reservation_type AS \"reservation_type\"," +
                "room.reservation_type AS \"reservation_type\"," +
                "outpatient.origin_con_no AS \"origin_con_no\" " +
                "outpatient.origin_con_no AS \"origin_con_no\", " +
                "outpatient.medical_state AS \"medicalState\" " +
                "FROM " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "wlyy_hospital_waiting_room room," +
                "base_patient patient," +
                "base_patient patient," +
@ -7629,6 +7639,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "outpatient.disease_img AS \"disease_img\"," +
                "outpatient.disease_img AS \"disease_img\"," +
                "outpatient.description AS \"description\"," +
                "outpatient.description AS \"description\"," +
                "outpatient.origin_con_no AS \"origin_con_no\", " +
                "outpatient.origin_con_no AS \"origin_con_no\", " +
                "outpatient.medical_state AS \"medicalState\", " +
                "consult.consult AS \"consult\" " +
                "consult.consult AS \"consult\" " +
                "FROM " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "wlyy_hospital_waiting_room room," +
@ -7780,6 +7791,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "outpatient.consumer as \"consumer\"," +
                "outpatient.consumer as \"consumer\"," +
                "outpatient.consumer_name as \"consumer_name\"," +
                "outpatient.consumer_name as \"consumer_name\"," +
                "outpatient.consumer_mobile as \"consumerMobile\"," +
                "outpatient.consumer_mobile as \"consumerMobile\"," +
                "outpatient.medical_state as \"medicalState\"," +
                "room.reservation_type AS \"reservation_type\" " +
                "room.reservation_type AS \"reservation_type\" " +
                "FROM " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "wlyy_hospital_waiting_room room," +
@ -9823,7 +9835,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        if ("0".equals(rsCode)) {
                        if ("0".equals(rsCode)) {
                            free = res.getString("@total_charge");
                            free = res.getString("@total_charge");
                        }
                        }
                        ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1","WX_PUB");
                        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("isSendYlzMes");
                        if (hospitalSysDictDO==null){
                            ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1","WX_PUB");
                        }else if (hospitalSysDictDO.getDictValue().equalsIgnoreCase("0")){
                            ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1","WX_PUB");
                        }
                        if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
                        if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
                            String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientDO.getId()+"&id="+prescriptionId;
                            String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientDO.getId()+"&id="+prescriptionId;
                            sendZsMsgFlow("OL_JSTX",outpatientDO.getId(),prescriptionId,msgUrl,"结算提醒");
                            sendZsMsgFlow("OL_JSTX",outpatientDO.getId(),prescriptionId,msgUrl,"结算提醒");
@ -14379,8 +14396,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                logger.info("变更医保结算状态成功");
                logger.info("变更医保结算状态成功");
                String realOrder = msgInfoJson.getString("xtgzh0");
                String realOrder = msgInfoJson.getString("xtgzh0");
                List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByRealOrderAndStatusList(realOrder);
                List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByRealOrderAndStatusList(realOrder);
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(ylzMedicalRelationDO.getRelationCode());
                String title = "";
                if (wlyyOutpatientDO.getHisStatus()==null){
                    title="您在厦门大学附属中山医院有一笔诊察/处方费用已支付完成!结算费用包含本次在线问诊的复诊诊查费:"+wlyyOutpatientDO.getFee()+"元。";
                }else {
                    title="您在厦门大学附属中山医院有一笔诊察/处方费用已支付完成!";
                }
                if (hisState){
                    wlyyOutpatientDO.setHisStatus(1);
                    outpatientDao.save(wlyyOutpatientDO);
                }
                for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOS){
                for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOS){
                    WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
                   /* WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
                    String title = "";
                    String title = "";
                    if (wlyyOutpatientDO.getHisStatus()==null){
                    if (wlyyOutpatientDO.getHisStatus()==null){
                        title="您在厦门大学附属中山医院有一笔诊察/处方费用已支付完成!结算费用包含本次在线问诊的复诊诊查费:"+wlyyOutpatientDO.getFee()+"元。";
                        title="您在厦门大学附属中山医院有一笔诊察/处方费用已支付完成!结算费用包含本次在线问诊的复诊诊查费:"+wlyyOutpatientDO.getFee()+"元。";
@ -14390,7 +14418,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    if (hisState){
                    if (hisState){
                        wlyyOutpatientDO.setHisStatus(1);
                        wlyyOutpatientDO.setHisStatus(1);
                        outpatientDao.save(wlyyOutpatientDO);
                        outpatientDao.save(wlyyOutpatientDO);
                    }
                    }*/
                    WlyyPrescriptionLogDO prescriptionLogDO = new WlyyPrescriptionLogDO();
                    WlyyPrescriptionLogDO prescriptionLogDO = new WlyyPrescriptionLogDO();
                    prescriptionLogDO.setCreateTime(new Date());
                    prescriptionLogDO.setCreateTime(new Date());
                    prescriptionLogDO.setStatus(30);
                    prescriptionLogDO.setStatus(30);
@ -14406,7 +14434,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    prescriptionDao.save(prescriptionDO);
                    prescriptionDao.save(prescriptionDO);
                    logger.info("变更处方结算状态成功");
                    logger.info("变更处方结算状态成功");
                    String fee = ylzMedicalRelationDO.getTotalAmount();
                    String fee = ylzMedicalRelationDO.getTotalAmount();
                    String pushPayLog =  payInfoNoticeService.pushPrescriptionPayMedicare(wlyyOutpatientDO.getConsumer(),prescriptionDO.getDoctorName(),prescriptionDO.getVoucherNo(),prescriptionDO.getOutpatientId(),prescriptionDO.getId(),fee,ylzMedicalRelationDO.getMedicalPrice(),ylzMedicalRelationDO.getPersonCash(),title,null);
                    Double medicarePrice = Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice())+Double.parseDouble(ylzMedicalRelationDO.getPersonAccount());
                    String pushPayLog =  payInfoNoticeService.pushPrescriptionPayMedicare(wlyyOutpatientDO.getConsumer(),prescriptionDO.getDoctorName(),prescriptionDO.getVoucherNo(),prescriptionDO.getOutpatientId(),prescriptionDO.getId(),fee,medicarePrice+"",ylzMedicalRelationDO.getPersonCash(),title,null);
                    logger.info("处方结算成功"+pushPayLog+"====="+realOrder);
                    logger.info("处方结算成功"+pushPayLog+"====="+realOrder);
                    //2.6.1	电子处方订单接收
                    //2.6.1	电子处方订单接收
                    logger.info("医保电子处方订单");
                    logger.info("医保电子处方订单");

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

@ -24,6 +24,7 @@ import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.BaseAppointmentLogDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO;
@ -37,6 +38,7 @@ import com.yihu.jw.hospital.family.dao.WlyyPatientFamilyMemberDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.prescription.dao.BaseAppointmentLogDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionExpressageDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionExpressageDao;
@ -54,6 +56,7 @@ import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.CheckSumBuilder;
import com.yihu.jw.utils.CheckSumBuilder;
import com.yihu.jw.utils.FileUtil;
import com.yihu.jw.utils.FileUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
@ -134,6 +137,10 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    @Autowired
    @Autowired
    private HttpClientUtil httpClientUtil;
    private HttpClientUtil httpClientUtil;
    @Autowired
    private BaseAppointmentLogDao appointmentLogDao;
    @Autowired
    private HibenateUtils hibenateUtils;
@ -1135,4 +1142,94 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    }
    }
    /**
     * 保存五缘预约系统的日志
     * @param appointmentLogDO
     * @return
     */
    public BaseAppointmentLogDO saveYkAppointment(BaseAppointmentLogDO appointmentLogDO){
        if (appointmentLogDO.getStatus()==2){
            appointmentLogDO = appointmentLogDao.findOrderCode(appointmentLogDO.getOrderCode());
            appointmentLogDO.setUpdateTime(new Date());
            appointmentLogDO.setStatus(2);
            return appointmentLogDao.save(appointmentLogDO);
        }else {
            appointmentLogDO.setUpdateTime(new Date());
            appointmentLogDO.setCreateTime(new Date());
            return appointmentLogDao.save(appointmentLogDO);
        }
    }
    /**
     * 条件(姓名、科室、医生)
     * @param condition
     * @param page
     * @param pageSize
     * @return
     */
    public List<Map<String, Object>> selectList(String condition,String startTime,String endTime,Integer page,Integer pageSize){
        List<Map<String, Object>> maps = new ArrayList<>();
        String sql = "SELECT\n" +
                "\tid AS \"id\",\n" +
                "\torder_code AS \"orderCode\",\n" +
                "\tcorp_no AS \"corpNo\",\n" +
                "\tdepartment_code AS \"departmentCode\",\n" +
                "\tdepartment_name AS \"departmentName\",\n" +
                "  doctor_code as \"doctorCode\",\n" +
                "  doctor_name as \"doctorName\",\n" +
                "  schedule_code as \"scheduleCode\",\n" +
                "  schedule_item_code as \"scheduleItemCode\",\n" +
                "  to_char(service_start_date,'YYYY-MM-DD hh24:mi:ss') as \"serviceStartDate\",\n" +
                "  to_char(service_end_date,'YYYY-MM-DD hh24:mi:ss') as \"serviceEndDate\",\n" +
                "  patient_name as \"patientName\",\n" +
                "  patient_card as \"patientCard\",\n" +
                "  patient_phone as \"patientPhone\",\n" +
                "  app_source as \"appSource\",\n" +
                "  appoint_way as \"appointWay\",\n" +
                "  status as \"status\"\n" +
                "FROM\n" +
                "\tbase_appointment_log where 1=1  ";
        Map<String, Object> params = new HashedMap();
        if (StringUtils.isNoneBlank(condition)){
            sql += " and  (patient_card like '%"+condition+"%' OR patient_name like '%"+condition+"%' OR patient_phone like '%"+condition+"%' OR doctor_name like '%"+condition+"%' OR department_name like '%"+condition+"%') ";
        }
        if (StringUtils.isNoneBlank(startTime)){
            sql +=" and service_start_date >=:startTime ";
            params.put("startTime",DateUtil.stringToDate(startTime, "yyyy-MM-dd HH:mm:ss"));
        }
        if (StringUtils.isNoneBlank(endTime)){
            sql +=" and service_start_date <=:endTime ";
            params.put("endTime",DateUtil.stringToDate(endTime, "yyyy-MM-dd HH:mm:ss"));
        }
        sql += " order by service_start_date desc ";
        List<Map<String, Object>> mapList = hibenateUtils.createSQLQuery(sql, params, page, pageSize);
        String sqlTotal = "select COUNT(1) AS \"total\" from base_appointment_log where 1=1 ";
        Map<String, Object> params1 = new HashedMap();
        if (StringUtils.isNoneBlank(condition)){
            sqlTotal += " and  (patient_card like '%"+condition+"%' OR patient_name like '%"+condition+"%' OR patient_phone like '%"+condition+"%' OR doctor_name like '%"+condition+"%' OR department_name like '%"+condition+"%') ";
        }
        if (StringUtils.isNoneBlank(startTime)){
            sqlTotal +=" and service_start_date >=:startTime ";
            params1.put("startTime",DateUtil.stringToDate(startTime, "yyyy-MM-dd HH:mm:ss"));
        }
        if (StringUtils.isNoneBlank(endTime)){
            sqlTotal +=" and service_start_date <=:endTime ";
            params1.put("endTime",DateUtil.stringToDate(endTime, "yyyy-MM-dd HH:mm:ss"));
        }
        Long count = 0L;
        List<Map<String, Object>> total = hibenateUtils.createSQLQuery(sqlTotal, params1);
        if (total != null) {
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            count = hibenateUtils.objTransformLong(total.get(0).get("total"));
        }
        Map<String, Object> map = new HashedMap();
        map.put("count", count);
        map.put("list", mapList);
        maps.add(map);
        return maps;
    }
}
}

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

@ -3144,8 +3144,8 @@ public class EntranceService {
        if (result!=null&&result.size()!=0){
        if (result!=null&&result.size()!=0){
            net.sf.json.JSONObject object = result.getJSONObject(0);
            net.sf.json.JSONObject object = result.getJSONObject(0);
            net.sf.json.JSONObject jsonObject = object.getJSONObject("retInfo");
            net.sf.json.JSONObject jsonObject = object.getJSONObject("retInfo");
            net.sf.json.JSONObject msgInfoJson = object.getJSONObject("msgInfo");
            if (jsonObject.getString("retCode").equalsIgnoreCase("00")){
            if (jsonObject.getString("retCode").equalsIgnoreCase("00")){
                net.sf.json.JSONObject msgInfoJson = object.getJSONObject("msgInfo");
                if (msgInfoJson!=null){
                if (msgInfoJson!=null){
                    net.sf.json.JSONObject resultJSON = msgInfoJson.getJSONObject("receipt");
                    net.sf.json.JSONObject resultJSON = msgInfoJson.getJSONObject("receipt");
                    if (resultJSON!=null){
                    if (resultJSON!=null){
@ -3157,7 +3157,7 @@ public class EntranceService {
                            ylzMedicalRelationDO.setLogNo(resultJSON.getString("xtgzh0"));
                            ylzMedicalRelationDO.setLogNo(resultJSON.getString("xtgzh0"));
                            ylzMedicalRelationDO.setOrgCode("3502000303");
                            ylzMedicalRelationDO.setOrgCode("3502000303");
                            ylzMedicalRelationDO.setRegionCode("350200");
                            ylzMedicalRelationDO.setRegionCode("350200");
                            ylzMedicalRelationDO.setIdcard(resultJSON.getString("id0000"));
                            ylzMedicalRelationDO.setIdcard(outpatientDO.getIdcard());
                            ylzMedicalRelationDO.setName(resultJSON.getString("xming0"));
                            ylzMedicalRelationDO.setName(resultJSON.getString("xming0"));
                            ylzMedicalRelationDO.setCertType("01");
                            ylzMedicalRelationDO.setCertType("01");
                            ylzMedicalRelationDO.setMedicalMode("10");
                            ylzMedicalRelationDO.setMedicalMode("10");
@ -3200,9 +3200,8 @@ public class EntranceService {
                                ylzMedicalRelationDO.setMedicalState(Integer.parseInt(outpatientDO.getMedicalState()));
                                ylzMedicalRelationDO.setMedicalState(Integer.parseInt(outpatientDO.getMedicalState()));
                            }
                            }
                            ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                            ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                            net.sf.json.JSONObject zdLists = resultJSON.getJSONObject("zdlists");
                            if (zdLists!=null){
                                Object json = new JSONTokener(zdLists.getString("zdlist")).nextValue();
                            if (resultJSON.get("zdlist")!=null){
                                Object json = new JSONTokener(resultJSON.getString("zdlist")).nextValue();
                                if(json instanceof net.sf.json.JSONObject){
                                if(json instanceof net.sf.json.JSONObject){
                                    net.sf.json.JSONObject icdJSON = (net.sf.json.JSONObject)json;
                                    net.sf.json.JSONObject icdJSON = (net.sf.json.JSONObject)json;
                                    YlzMedicalIcdDO ylzMedicalIcdDO = new YlzMedicalIcdDO();
                                    YlzMedicalIcdDO ylzMedicalIcdDO = new YlzMedicalIcdDO();
@ -3312,7 +3311,7 @@ public class EntranceService {
                        }else {
                        }else {
                            ylzMedicalRelationDO.setOrgCode("3502000303");
                            ylzMedicalRelationDO.setOrgCode("3502000303");
                            ylzMedicalRelationDO.setRegionCode("350200");
                            ylzMedicalRelationDO.setRegionCode("350200");
                            ylzMedicalRelationDO.setIdcard(resultJSON.getString("id0000"));
                            ylzMedicalRelationDO.setIdcard(outpatientDO.getIdcard());
                            ylzMedicalRelationDO.setName(resultJSON.getString("xming0"));
                            ylzMedicalRelationDO.setName(resultJSON.getString("xming0"));
                            ylzMedicalRelationDO.setCertType("01");
                            ylzMedicalRelationDO.setCertType("01");
                            ylzMedicalRelationDO.setMedicalMode("10");
                            ylzMedicalRelationDO.setMedicalMode("10");
@ -3364,9 +3363,8 @@ public class EntranceService {
                            ylzMedicalIcdDO.setDiseaseOrder("01");
                            ylzMedicalIcdDO.setDiseaseOrder("01");
                            ylzMedicalIcdDO = ylzMedicailIcdDao.save(ylzMedicalIcdDO);
                            ylzMedicalIcdDO = ylzMedicailIcdDao.save(ylzMedicalIcdDO);
                            icdDOList.add(ylzMedicalIcdDO);*/
                            icdDOList.add(ylzMedicalIcdDO);*/
                            net.sf.json.JSONObject zdLists = resultJSON.getJSONObject("zdlists");
                            if (zdLists!=null){
                                Object json = new JSONTokener(zdLists.getString("zdlist")).nextValue();
                            if (resultJSON.get("zdlist")!=null){
                                Object json = new JSONTokener(resultJSON.getString("zdlist")).nextValue();
                                if(json instanceof net.sf.json.JSONObject){
                                if(json instanceof net.sf.json.JSONObject){
                                    net.sf.json.JSONObject icdJSON = (net.sf.json.JSONObject)json;
                                    net.sf.json.JSONObject icdJSON = (net.sf.json.JSONObject)json;
                                    YlzMedicalIcdDO ylzMedicalIcdDO = new YlzMedicalIcdDO();
                                    YlzMedicalIcdDO ylzMedicalIcdDO = new YlzMedicalIcdDO();

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

@ -2174,7 +2174,8 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                " t.status as \"status\","+
                " t.status as \"status\","+
                " t.pay_time as \"payTime\","+
                " t.pay_time as \"payTime\","+
                " t.upload_status as \"uploadStatus\","+
                " t.upload_status as \"uploadStatus\","+
                " t.create_time as \"createTime\","+
                " t.update_time as \"createTime\","+
                " t.create_time as \"updateTime\","+
                " t.remark as \"remark\","+
                " t.remark as \"remark\","+
                " t.yk_order_no as \"ykOrderNo\","+
                " t.yk_order_no as \"ykOrderNo\","+
                " t.yk_order_id as \"ykOrderId\","+
                " t.yk_order_id as \"ykOrderId\","+
@ -2287,7 +2288,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                "\tt.description AS \"description\",\n" +
                "\tt.description AS \"description\",\n" +
                "\tt.pay_type AS \"payType\",\n" +
                "\tt.pay_type AS \"payType\",\n" +
                "\tt.pay_price AS \"payPrice\",\n" +
                "\tt.pay_price AS \"payPrice\",\n" +
                "\tt.create_time AS \"payTime\",\n" +
                "\tt.update_time AS \"payTime\",\n" +
                "\tt.upload_status AS \"uploadStatus\",\n" +
                "\tt.upload_status AS \"uploadStatus\",\n" +
                "\tt.create_time AS \"createTime\",\n" +
                "\tt.create_time AS \"createTime\",\n" +
                "\tt.remark AS \"remark\",\n" +
                "\tt.remark AS \"remark\",\n" +

+ 7 - 4
business/base-service/src/main/java/com/yihu/jw/wechat/enterprise/EnterpriseService.java

@ -77,6 +77,9 @@ public class EnterpriseService {
    public String getToken(String enterpriseId)throws Exception{
    public String getToken(String enterpriseId)throws Exception{
        logger.info("getToken");
        logger.info("getToken");
        if (enterpriseId.equalsIgnoreCase("xm_zsyy_wx")){
            enterpriseId ="zsyy";
        }
        WxEnterpriseDO wxEnterpriseDO = wxEnterpriseDao.findOne(enterpriseId);
        WxEnterpriseDO wxEnterpriseDO = wxEnterpriseDao.findOne(enterpriseId);
@ -514,6 +517,7 @@ public class EnterpriseService {
     */
     */
    public String getEnterpriseJsapi_ticketByToken(String wxId) throws Exception {
    public String getEnterpriseJsapi_ticketByToken(String wxId) throws Exception {
        try {
        try {
            System.out.println("getEnterpriseJsapi_ticketByToken="+wxId);
            System.out.println("getEnterpriseJsapi_ticketByToken="+wxId);
            Iterable<EnterpriseJsApiTicket> jsapiTickets = null;
            Iterable<EnterpriseJsApiTicket> jsapiTickets = null;
            WxWechatDO wxWechat = null;
            WxWechatDO wxWechat = null;
@ -543,7 +547,7 @@ public class EnterpriseService {
            token = getToken(wxId);
            token = getToken(wxId);
            System.out.println("getticket_token:"+token);
            System.out.println("getticket_token:"+token);
            if (token != null) {
            if (token != null) {
                String token_url = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?";
                String token_url = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket";
                String params = "access_token=" + token ;
                String params = "access_token=" + token ;
                String result = HttpUtil.sendGet(token_url, params);
                String result = HttpUtil.sendGet(token_url, params);
                System.out.println("result:"+result);
                System.out.println("result:"+result);
@ -570,7 +574,6 @@ public class EnterpriseService {
                return null;
                return null;
            }
            }
        } catch (Exception e) {
        } catch (Exception e) {
            System.out.println(e.getMessage());
            throw new Exception(e.getMessage());
            throw new Exception(e.getMessage());
        }
        }
    }
    }
@ -583,7 +586,7 @@ public class EnterpriseService {
    public InputStream getInputStream(String mediaId, String wechat_appid) throws Exception {
    public InputStream getInputStream(String mediaId, String wechat_appid) throws Exception {
        String accessToken = getToken(wechat_appid);
        String accessToken = getToken(wechat_appid);
        InputStream is = null;
        InputStream is = null;
        String url = "https://qyapi.weixin.qq.com/cgi-bin/media/get/jssdk?access_token=" + accessToken + "&media_id=" + mediaId;
        String url = "https://qyapi.weixin.qq.com/cgi-bin/media/get?access_token=" + accessToken + "&media_id=" + mediaId;
//		String url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=30_OBJbMMPW9TnyGHKf32bcjkXtxWnzBrtqWlSMBnNk8MWpJ6qis2TnsecRYNZImgahdx30WrsI1bGco6K67-j4sT1QkDxYKBrVvjaYF6QgbY8dgBMzuoARKoaxtX3ehiYvdCLSUHvogrpF3n0GANIfCHAHUP&media_id=R_060hnyXAFyHD9HaOLl15xhDIzDvcA61-Wz34GkXmCakdrsFJqxrPEBHewmAEK9";
//		String url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=30_OBJbMMPW9TnyGHKf32bcjkXtxWnzBrtqWlSMBnNk8MWpJ6qis2TnsecRYNZImgahdx30WrsI1bGco6K67-j4sT1QkDxYKBrVvjaYF6QgbY8dgBMzuoARKoaxtX3ehiYvdCLSUHvogrpF3n0GANIfCHAHUP&media_id=R_060hnyXAFyHD9HaOLl15xhDIzDvcA61-Wz34GkXmCakdrsFJqxrPEBHewmAEK9";
        logger.info("media/get" + url);
        logger.info("media/get" + url);
        try {
        try {
@ -626,7 +629,7 @@ public class EnterpriseService {
        logger.info("accessToken 过期时重新下载多媒体文件:wechat_appid:" + wechat_appid);
        logger.info("accessToken 过期时重新下载多媒体文件:wechat_appid:" + wechat_appid);
        logger.info("accessToken 过期时重新下载多媒体文件:mediaId:" + mediaId);
        logger.info("accessToken 过期时重新下载多媒体文件:mediaId:" + mediaId);
        InputStream is = null;
        InputStream is = null;
        String url = "https://qyapi.weixin.qq.com/cgi-bin/media/get/jssdk?access_token=" + accessToken + "&media_id=" + mediaId;
        String url = "https://qyapi.weixin.qq.com/cgi-bin/media/get?access_token=" + accessToken + "&media_id=" + mediaId;
        logger.info("media/get" + url);
        logger.info("media/get" + url);
        try {
        try {
            URL urlGet = new URL(url);
            URL urlGet = new URL(url);

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

@ -4554,6 +4554,7 @@ public class ImService {
                    "patient.id AS \"patientId\"," +
                    "patient.id AS \"patientId\"," +
                    "op.consumer AS \"consumer\"," +
                    "op.consumer AS \"consumer\"," +
                    "op.consumer_name AS \"consumerName\"," +
                    "op.consumer_name AS \"consumerName\"," +
                    "op.medical_state AS \"medicalState\"," +
                    "patient.idcard AS \"patientIdcard\"," +
                    "patient.idcard AS \"patientIdcard\"," +
                    "patient.sex AS \"patientsex\"," +
                    "patient.sex AS \"patientsex\"," +
                    "patient.photo AS \"patientphoto\",";
                    "patient.photo AS \"patientphoto\",";
@ -4639,6 +4640,7 @@ public class ImService {
                    "op.general_doctor AS \"generalDoctor\"," +
                    "op.general_doctor AS \"generalDoctor\"," +
                    "op.consumer AS \"consumer\"," +
                    "op.consumer AS \"consumer\"," +
                    "op.consumer_name AS \"consumerName\"," +
                    "op.consumer_name AS \"consumerName\"," +
                    "op.medical_state AS \"medicalState\"," +
                    "patient.NAME AS \"patientName\"," +
                    "patient.NAME AS \"patientName\"," +
                    "patient.id AS \"patientId\"," +
                    "patient.id AS \"patientId\"," +
                    "patient.idcard AS \"patientIdcard\"," +
                    "patient.idcard AS \"patientIdcard\"," +

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

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

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -304,6 +304,16 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    private String idType;//身份类别
    private String idType;//身份类别
    private Integer mark;//数据导出权限   1是 0否
    public Integer getMark() {
        return mark;
    }
    public void setMark(Integer mark) {
        this.mark = mark;
    }
    public String getIdCardType() {
    public String getIdCardType() {
        return idCardType;
        return idCardType;
    }
    }

+ 109 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/healthUpload/BaseDoctorHealthUploadDO.java

@ -65,6 +65,115 @@ public class BaseDoctorHealthUploadDO extends UuidIdentityEntityWithOperator {
    public String healthCodeDesc;
    public String healthCodeDesc;
    public Integer outsideHighNucleate;
    public Integer outsideHighNucleate;
    public String abnormalSymptomsOther;
    public String abnormalSymptomsOther;
    public Integer scheduleStatus;//1本地2出差3外出
    public String startProvinceName;
    public String startCityName;
    public String startTownName;
    public String startStreetName;//开始市
    public String endProvinceName;//终止省
    public String endCityName;//终止市
    public String endTownName;//终止区
    public String endStreetName;//终止街道
    public Integer transportType;//交通方式(1自驾2火车3飞机)
    public String licenseNumber;//车牌号
    public String number;//座位
    public Integer isHigh;//1是2否
    public String getStartProvinceName() {
        return startProvinceName;
    }
    public void setStartProvinceName(String startProvinceName) {
        this.startProvinceName = startProvinceName;
    }
    public String getStartCityName() {
        return startCityName;
    }
    public void setStartCityName(String startCityName) {
        this.startCityName = startCityName;
    }
    public String getStartTownName() {
        return startTownName;
    }
    public void setStartTownName(String startTownName) {
        this.startTownName = startTownName;
    }
    public String getStartStreetName() {
        return startStreetName;
    }
    public void setStartStreetName(String startStreetName) {
        this.startStreetName = startStreetName;
    }
    public String getEndProvinceName() {
        return endProvinceName;
    }
    public void setEndProvinceName(String endProvinceName) {
        this.endProvinceName = endProvinceName;
    }
    public String getEndCityName() {
        return endCityName;
    }
    public void setEndCityName(String endCityName) {
        this.endCityName = endCityName;
    }
    public String getEndTownName() {
        return endTownName;
    }
    public void setEndTownName(String endTownName) {
        this.endTownName = endTownName;
    }
    public String getEndStreetName() {
        return endStreetName;
    }
    public void setEndStreetName(String endStreetName) {
        this.endStreetName = endStreetName;
    }
    public Integer getTransportType() {
        return transportType;
    }
    public void setTransportType(Integer transportType) {
        this.transportType = transportType;
    }
    public String getLicenseNumber() {
        return licenseNumber;
    }
    public void setLicenseNumber(String licenseNumber) {
        this.licenseNumber = licenseNumber;
    }
    public String getNumber() {
        return number;
    }
    public void setNumber(String number) {
        this.number = number;
    }
    public Integer getIsHigh() {
        return isHigh;
    }
    public void setIsHigh(Integer isHigh) {
        this.isHigh = isHigh;
    }
    public String getAbnormalSymptomsOther() {
    public String getAbnormalSymptomsOther() {
        return abnormalSymptomsOther;
        return abnormalSymptomsOther;

+ 169 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseAppointmentLogDO.java

@ -0,0 +1,169 @@
package com.yihu.jw.entity.hospital.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
* 预约记录 目前对接眼科转线下预约
*
* @author
*
*/
@Entity
@Table(name = "base_appointment_log")
public class BaseAppointmentLogDO extends UuidIdentityEntityWithOperator {
   private String orderCode;
   private String corpNo;
   private String departmentCode;
   private String departmentName;
   private String doctorCode;//院区id
   private String doctorName;
   private String scheduleCode;
   private String scheduleItemCode;
   private Date serviceStartDate;
   private Date serviceEndDate;
   private String patientName;
   private String patientCard;
   private String patientPhone;
   private String appSource;
   private String appointWay;
   private Integer status;//0预约失败1预约成功2取消预约
    public String getOrderCode() {
        return orderCode;
    }
    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    }
    public String getCorpNo() {
        return corpNo;
    }
    public void setCorpNo(String corpNo) {
        this.corpNo = corpNo;
    }
    public String getDepartmentCode() {
        return departmentCode;
    }
    public void setDepartmentCode(String departmentCode) {
        this.departmentCode = departmentCode;
    }
    public String getDepartmentName() {
        return departmentName;
    }
    public void setDepartmentName(String departmentName) {
        this.departmentName = departmentName;
    }
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getScheduleCode() {
        return scheduleCode;
    }
    public void setScheduleCode(String scheduleCode) {
        this.scheduleCode = scheduleCode;
    }
    public String getScheduleItemCode() {
        return scheduleItemCode;
    }
    public void setScheduleItemCode(String scheduleItemCode) {
        this.scheduleItemCode = scheduleItemCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "service_start_date", nullable = false, length = 0,updatable = false)
    public Date getServiceStartDate() {
        return serviceStartDate;
    }
    public void setServiceStartDate(Date serviceStartDate) {
        this.serviceStartDate = serviceStartDate;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "service_end_date", nullable = false, length = 0,updatable = false)
    public Date getServiceEndDate() {
        return serviceEndDate;
    }
    public void setServiceEndDate(Date serviceEndDate) {
        this.serviceEndDate = serviceEndDate;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getPatientCard() {
        return patientCard;
    }
    public void setPatientCard(String patientCard) {
        this.patientCard = patientCard;
    }
    public String getPatientPhone() {
        return patientPhone;
    }
    public void setPatientPhone(String patientPhone) {
        this.patientPhone = patientPhone;
    }
    public String getAppSource() {
        return appSource;
    }
    public void setAppSource(String appSource) {
        this.appSource = appSource;
    }
    public String getAppointWay() {
        return appointWay;
    }
    public void setAppointWay(String appointWay) {
        this.appointWay = appointWay;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

+ 1 - 1
gateway/ag-basic/pom.xml

@ -12,7 +12,7 @@
    <artifactId>ag-basic</artifactId>
    <artifactId>ag-basic</artifactId>
    <version>${parent.version}</version>
    <version>${parent.version}</version>
    <packaging>war</packaging>
    <packaging>jar</packaging>
    <dependencies>
    <dependencies>
        <!-- 支持Tomcat启动 -->
        <!-- 支持Tomcat启动 -->

+ 4 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java

@ -892,6 +892,10 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
        this.getJdbcTemplate().update("update base_patient p set p.openid = ? where p.id= ?", openid, userId);
        this.getJdbcTemplate().update("update base_patient p set p.openid = ? where p.id= ?", openid, userId);
    }
    }
    public void updateDoctorOpenId(String openid, String userId) {
        this.getJdbcTemplate().update("update base_doctor p set p.openid = ? where p.id= ?", openid, userId);
    }
    public void updateOpenIdAndWechatId(String openid, String userId,String wechatId) {
    public void updateOpenIdAndWechatId(String openid, String userId,String wechatId) {
        List<BasePatientWechatDo> patientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,userId);
        List<BasePatientWechatDo> patientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,userId);
        if (patientWechatDos!=null&&patientWechatDos.size()!=0){
        if (patientWechatDos!=null&&patientWechatDos.size()!=0){

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

@ -392,13 +392,19 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                    logger.info("gengxin进入"+wechatId);
                    logger.info("gengxin进入"+wechatId);
                    userDetailsService.updateOpenIdAndWechatId(openid,wlyyUserSimple.getId(),wechatId);
                    userDetailsService.updateOpenIdAndWechatId(openid,wlyyUserSimple.getId(),wechatId);
                }
                }
            }else if (!StringUtils.isEmpty(openid) && !"undefined".equalsIgnoreCase(openid) && ("2".equals(loginType))) {
                if (wechatId.equalsIgnoreCase("xm_mlwyy_wx")){
                    logger.info("gengxin进入"+openid);
                    userDetailsService.updateDoctorOpenId(openid, wlyyUserSimple.getId());
                }
            }
            }
            if (parameters.get("password") != null) {
            if (parameters.get("password") != null) {
                //使用密码登录成功后, 更新失败次数为 0
                //使用密码登录成功后, 更新失败次数为 0
                userDetailsService.addFailureCount(username, 0);
                userDetailsService.addFailureCount(username, 0);
            }
            }
            logger.info("login:登录进入8");
            logger.info("login:登录进入8");
            wlyyUserSimple.setOpenid(openid);
            userDetailsService.setRolePhth(loginType, token, wlyyUserSimple.getId(), redisTemplate);
            userDetailsService.setRolePhth(loginType, token, wlyyUserSimple.getId(), redisTemplate);
            logger.info("login:登录进入9");
            logger.info("login:登录进入9");

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java

@ -138,7 +138,7 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
                " WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id " +
                " WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id " +
                " and i.del = 1 and m.team_code = r.team_code and ar.patient = sr.patient and ar.label_type = 1 " +
                " and i.del = 1 and m.team_code = r.team_code and ar.patient = sr.patient and ar.label_type = 1 " +
                " and m.doctor_code = '"+doctorId+"' and m.del = '1' and sr.`status`=1  " +
                " and m.doctor_code = '"+doctorId+"' and m.del = '1' and sr.`status`=1  " +
                " GROUP BY ar.patient ORDER BY ar.czrq desc)A " +
                " GROUP BY ar.patient ORDER BY ar.czrq desc)A INNER JOIN base_patient p on A.patient = p.id and p.del=1  " +
                " GROUP BY a.level_conclusion " ;
                " GROUP BY a.level_conclusion " ;
        List<Map<String,Object>> countMapList = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> countMapList = jdbcTemplate.queryForList(sql);
        for(Map<String,Object> map:countMapList){
        for(Map<String,Object> map:countMapList){

+ 31 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/SendDoctorHealthUploadMessageJob.java

@ -0,0 +1,31 @@
package com.yihu.jw.job;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.service.channel.HealthUploadService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.Trigger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * Created by Trick on 2019/10/15.
 */
public class SendDoctorHealthUploadMessageJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(SendDoctorHealthUploadMessageJob.class);
    @Autowired
    private HealthUploadService healthUploadService;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("START========SendDoctorHealthUploadMessageJob========");
        try {
            healthUploadService.waitingItem();
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("END===ERROE===SendDoctorHealthUploadMessageJob,message:"+e.getMessage());
        }
    }
}

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

@ -0,0 +1,123 @@
package com.yihu.jw.service.channel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.entity.healthUpload.BaseDoctorHealthUploadDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.healthUpload.dao.BaseDoctorHealthUploadDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.oauth.OauthSsoService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.ConsultOrderDao;
import com.yihu.jw.order.dao.ConsultTeamOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.RSAEncrypt;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.YkyySMSService;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WxPushLogDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import com.yihu.jw.wechat.dao.WxTemplateDao;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.net.URLEncoder;
import java.util.*;
/**
 * Created by Administrator on 2017/5/19 0019.
 */
@Service
public class HealthUploadService {
    private Logger logger= LoggerFactory.getLogger(HealthUploadService.class);
    @Autowired
    private WxTemplateConfigDao wxTemplateConfigDao;
    @Autowired
    private WxTemplateDao wxTemplateDao;
    @Autowired
    private WxAccessTokenService wxAccessTokenService;
    @Autowired
    private WeixinMessagePushUtils weixinMessagePushUtils;
    @Value("${wechat.id}")
    private String wechatId;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private BaseDoctorHealthUploadDao doctorHealthUploadDao;
    @Autowired
    private WxPushLogDao wxPushLogDao;
    public void waitingItem(){
        List<BaseDoctorDO> doctorDOList = doctorDao.findByDel();
        Date startDate = DateUtil.strToDate(DateUtil.getStringDateShort()+" 00:00:00");
        Date endDate = DateUtil.strToDate(DateUtil.getStringDateShort()+" 23:59:59");
        for (BaseDoctorDO doctorDO:doctorDOList){
            List<BaseDoctorHealthUploadDO> healthUploadDOS = doctorHealthUploadDao.selectHealthUploadInfoByDoctorIdAndStartAndEnd(doctorDO.getId(),startDate,endDate);
            if (healthUploadDOS==null||healthUploadDOS.size()==0){
                if(!StringUtils.isNoneBlank(doctorDO.getOpenid())){
                    logger.info("该用户"+doctorDO.getName()+"没有openid,无法推送模版消息,用户ID:"+doctorDO.getId()+"wechatId:"+wechatId);
                }else{
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_waiting_notice","jkzldbxmtz",1);
                    WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
                    BeanUtils.copyProperties(config,newConfig);
                    newConfig.setKeyword3(doctorDO.getName());
                    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);
            }
        }
    }
}

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

@ -849,7 +849,9 @@ public class PrescriptionStatusUpdateService {
                        }
                        }
                        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outPatientId);
                        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outPatientId);
                        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
                        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){
                            if (businessOrderDO!=null){
                                ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"2");
                                ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"2");
@ -858,7 +860,9 @@ public class PrescriptionStatusUpdateService {
                            WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("isCloseRefund");
                            WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("isCloseRefund");
                            if (hospitalSysDictDO!=null&&hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
                            if (hospitalSysDictDO!=null&&hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
                                try {
                                try {
                                    entranceService.hisRefund(outPatientId);
                                    if (businessOrderDO.getStatus()==1){
                                        entranceService.hisRefund(outPatientId);
                                    }
                                }catch (Exception e){
                                }catch (Exception e){
                                    e.printStackTrace();
                                    e.printStackTrace();
                                }
                                }

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

@ -17,6 +17,7 @@ import com.yihu.jw.job.ykyy.UpdateStatusByPayTimeJob;
import com.yihu.jw.job.ykyy.YkyyDataUploadJob;
import com.yihu.jw.job.ykyy.YkyyDataUploadJob;
import com.yihu.jw.repository.job.QuartzJobConfigDao;
import com.yihu.jw.repository.job.QuartzJobConfigDao;
import com.yihu.jw.restmodel.web.ObjEnvelop;
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.PrescriptionStatusUpdateService;
import com.yihu.jw.service.channel.RemindDoctorService;
import com.yihu.jw.service.channel.RemindDoctorService;
import com.yihu.jw.service.channel.SyncWlyyHospitalService;
import com.yihu.jw.service.channel.SyncWlyyHospitalService;
@ -90,6 +91,8 @@ public class JobController extends BaseController {
    private RemindDoctorService remindDoctorService;
    private RemindDoctorService remindDoctorService;
    @Autowired
    @Autowired
    private SyncWlyyHospitalService syncWlyyHospitalService;
    private SyncWlyyHospitalService syncWlyyHospitalService;
    @Autowired
    private HealthUploadService healthUploadService;
    @Autowired
    @Autowired
    public JobController(JobService jobService, QuartzHelper quartzHelper) {
    public JobController(JobService jobService, QuartzHelper quartzHelper) {
@ -219,6 +222,16 @@ public class JobController extends BaseController {
                        logger.info("pay_status_notice_job  job exist");
                        logger.info("pay_status_notice_job  job exist");
                    }
                    }
                    break;
                    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>());
                        logger.info("send_health_upload_job  job success");
                    } else {
                        logger.info("send_health_upload_job  job exist");
                    }
                    break;
                case "syn_doctor_info_job" :
                case "syn_doctor_info_job" :
                    //互联网医院 医生信息同步
                    //互联网医院 医生信息同步
                    if (!quartzHelper.isExistJob("syn_doctor_info_job")) {
                    if (!quartzHelper.isExistJob("syn_doctor_info_job")) {
@ -520,6 +533,18 @@ public class JobController extends BaseController {
        }
        }
    }
    }
    @RequestMapping(value = "/waitingItem", method = RequestMethod.POST)
    @ApiOperation("测试健康上报推送")
    public String waitingItem(String doctor,String date) {
        try {
            healthUploadService.waitingItem();
            return write(200, "测试推送成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "测试推送失败");
        }
    }
    @RequestMapping(value = "/delData", method = RequestMethod.POST)
    @RequestMapping(value = "/delData", method = RequestMethod.POST)
    @ApiOperation("删除数据")
    @ApiOperation("删除数据")
    public String delData(String doctor,String date) {
    public String delData(String doctor,String date) {

+ 2 - 0
svr/svr-internet-hospital-job/src/main/resources/system.properties

@ -29,3 +29,5 @@ uncheck_prescription_notice_job=0 */1 * * * ?
syn_doctor_info_job=0 0 1 * * ?
syn_doctor_info_job=0 0 1 * * ?
send_health_upload_job=0 0 10/1 * * ?

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

@ -743,9 +743,16 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
					}
					}
				}
				}
				if (!free.equalsIgnoreCase("0")){
					ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, outpatientDO.getXtgzh(), outpatientDO.getDeptName(), outpatientDO.getDoctorName(), date, free, "1","WX_PUB");
				List<WlyyOutpatientDO> outpatientDOS = outpatientDao.findByRegisterNoList(outpatientDO.getRegisterNo());
				if (outpatientDOS!=null&&outpatientDOS.size()>1){
					outpatientDO.setHisStatus(1);
				}else {
					prescriptionService.sendWxTemplateMsg(wxId, outpatientDO.getId(), null,"", "diagnoPayRemind", "");
				}
				}
				/*if (!free.equalsIgnoreCase("0")){
					ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, outpatientDO.getXtgzh(), outpatientDO.getDeptName(), outpatientDO.getDoctorName(), date, free, "1","WX_PUB");
				}*/
				logger.info("发送诊查费支付模板消息end");
				logger.info("发送诊查费支付模板消息end");
			}
			}
			outpatientDO.setEndTime(new Date());
			outpatientDO.setEndTime(new Date());

+ 26 - 3
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/healthUpload/HealthUploadPoint.java

@ -171,9 +171,11 @@ public class HealthUploadPoint extends EnvelopRestEndpoint {
                                                         @ApiParam(name = "idType", value = "身份类别")
                                                         @ApiParam(name = "idType", value = "身份类别")
                                                             @RequestParam(value = "idType", required = false) String idType,
                                                             @RequestParam(value = "idType", required = false) String idType,
                                     @ApiParam(name = "id", value = "医生id")
                                     @ApiParam(name = "id", value = "医生id")
                                         @RequestParam(value = "id", required = false) String id) {
                                         @RequestParam(value = "id", required = false) String id,
                                     @ApiParam(name = "mark", value = "数据权限是否")
                                         @RequestParam(value = "mark", required = false) Integer mark) {
        try {
        try {
             BaseDoctorDO baseDoctorDO = baseDoctorHealthUploadService.saveDoctorInfo(id,photo,name,idcard,sex,mobile,dept,deptName,idCardType,idType);
             BaseDoctorDO baseDoctorDO = baseDoctorHealthUploadService.saveDoctorInfo(id,photo,name,idcard,sex,mobile,dept,deptName,idCardType,idType,mark);
            return success(baseDoctorDO);
            return success(baseDoctorDO);
        } catch (Exception e) {
        } catch (Exception e) {
            return failedObjEnvelopException(e);
            return failedObjEnvelopException(e);
@ -304,12 +306,14 @@ public class HealthUploadPoint extends EnvelopRestEndpoint {
                                 @RequestParam(value = "startDate", required = false) String startDate,
                                 @RequestParam(value = "startDate", required = false) String startDate,
                                 @ApiParam(name = "endDate", value = "结束时间")
                                 @ApiParam(name = "endDate", value = "结束时间")
                                 @RequestParam(value = "endDate", required = false) String endDate,
                                 @RequestParam(value = "endDate", required = false) String endDate,
                                 @ApiParam(name = "dept", value = "科室id")
                                     @RequestParam(value = "dept", required = false) String dept,
                                 HttpServletResponse response) throws Exception {
                                 HttpServletResponse response) throws Exception {
        try{
        try{
            response.setContentType("octets/stream");
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename=" + new String(URLEncoder.encode("健康上报报表")+".xls"));
            response.setHeader("Content-Disposition", "attachment; filename=" + new String(URLEncoder.encode("健康上报报表")+".xls"));
            OutputStream os = response.getOutputStream();
            OutputStream os = response.getOutputStream();
            return success(baseDoctorHealthUploadService.selectListInfoExcelByTotal(os, startDate,endDate));
            return success(baseDoctorHealthUploadService.selectListInfoExcelByTotal(os, startDate,endDate,dept));
        }catch (Exception e) {
        }catch (Exception e) {
            return failedMixEnvelopException(e);
            return failedMixEnvelopException(e);
        }
        }
@ -327,4 +331,23 @@ public class HealthUploadPoint extends EnvelopRestEndpoint {
            return failedMixEnvelopException(e);
            return failedMixEnvelopException(e);
        }
        }
    }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorByHospitalAndDept)
    @ApiOperation(value = "查询部门下医生", notes = "查询部门下医生")
    public ListEnvelop findDoctorByHospitalAndDept(@ApiParam(name = "orgCode", value = "机构code")
                                                   @RequestParam(value = "orgCode", required = false) String orgCode,
                                                   @ApiParam(name = "dept", value = "部门code")
                                                   @RequestParam(value = "dept", required = false) String dept,
                                                   @ApiParam(name = "doctorCode", value = "需要置顶医生")
                                                   @RequestParam(value = "doctorCode", required = false) String doctorCode,
                                                   @ApiParam(name = "key", value = "关键字搜索,医生名字/科室名称/专长")
                                                   @RequestParam(value = "key", required = false) String key,
                                                   @ApiParam(name = "flag", value = "是否异常1是0否")
                                                   @RequestParam(value = "flag", required = false) Integer flag) {
        try {
            return success(baseDoctorHealthUploadService.findDoctorByHospitalAndDept(orgCode, dept, doctorCode, key, flag));
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
}
}

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

@ -998,7 +998,11 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        logger.info("pageUrl="+pageUrl);
        logger.info("pageUrl="+pageUrl);
        logger.info("wxId="+wxId);
        logger.info("wxId="+wxId);
        String ticket = enterpriseService.getEnterpriseJsapi_ticketByToken(wxId);
        String ticket = enterpriseService.getEnterpriseJsapi_ticketByToken(wxId);
        WxEnterpriseDO wxEnterpriseDO = wxEnterpriseDao.findOne(wxId);
        String id = "";
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            id = "zsyy";
        }
        WxEnterpriseDO wxEnterpriseDO = wxEnterpriseDao.findOne(id);
        Map<Object, Object> map = new HashMap<Object, Object>();
        Map<Object, Object> map = new HashMap<Object, Object>();
        if (ticket != null) {
        if (ticket != null) {
            String noncestr = UUID.randomUUID().toString();
            String noncestr = UUID.randomUUID().toString();
@ -2261,12 +2265,14 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                 @RequestParam(value = "startDate", required = false) String startDate,
                                 @RequestParam(value = "startDate", required = false) String startDate,
                                 @ApiParam(name = "endDate", value = "结束时间")
                                 @ApiParam(name = "endDate", value = "结束时间")
                                 @RequestParam(value = "endDate", required = false) String endDate,
                                 @RequestParam(value = "endDate", required = false) String endDate,
                                 @ApiParam(name = "dept", value = "科室id")
                                     @RequestParam(value = "dept", required = false) String dept,
                                 HttpServletResponse response) throws Exception {
                                 HttpServletResponse response) throws Exception {
        try{
        try{
            response.setContentType("octets/stream");
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename=" + new String(URLEncoder.encode("健康上报报表")+".xls"));
            response.setHeader("Content-Disposition", "attachment; filename=" + new String(URLEncoder.encode("健康上报报表")+".xls"));
            OutputStream os = response.getOutputStream();
            OutputStream os = response.getOutputStream();
            return success(baseDoctorHealthUploadService.selectListInfoExcelByTotal(os, startDate,endDate));
            return success(baseDoctorHealthUploadService.selectListInfoExcelByTotal(os, startDate,endDate,dept));
        }catch (Exception e) {
        }catch (Exception e) {
            return failedMixEnvelopException(e);
            return failedMixEnvelopException(e);
        }
        }

+ 32 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java

@ -3,6 +3,7 @@ package com.yihu.jw.hospital.endpoint.prescription;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.BaseAppointmentLogDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.YkyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.YkyyPrescriptionService;
@ -468,4 +469,35 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    @GetMapping(value = "saveYkAppointment")
    @ApiOperation(value = "保存预约记录", notes = "保存预约记录")
    public Envelop GetFYQD(@ApiParam(name = "jsonData", value = "json格式")
                           @RequestParam(value = "jsonData", required = false)String jsonData)throws Exception {
        try {
            BaseAppointmentLogDO baseAppointmentLogDO = toEntity(jsonData,BaseAppointmentLogDO.class);
            return success("ok",prescriptionService.saveYkAppointment(baseAppointmentLogDO));
        }catch (Exception e) {
            return  failedListEnvelopException(e);
        }
    }
    @GetMapping(value = "selectList")
    @ApiOperation(value = "查询预约记录", notes = "查询预约记录")
    public ListEnvelop selectList(@ApiParam(name = "condition", value = "姓名、科室、医生")
                           @RequestParam(value = "condition", required = false)String condition,
                              @ApiParam(name = "startTime", value = "开始时间")
                              @RequestParam(value = "startTime", required = false)String startTime,
                              @ApiParam(name = "endTime", value = "结束时间")
                                  @RequestParam(value = "endTime", required = false)String endTime,
                              @ApiParam(name = "page", value = "页码")
                                  @RequestParam(value = "page", required = false)Integer page,
                              @ApiParam(name = "pageSize", value = "页大小")
                                  @RequestParam(value = "pageSize", required = false)Integer pageSize)throws Exception {
        try {
            return success("ok",prescriptionService.selectList(condition,startTime,endTime,page,pageSize));
        }catch (Exception e) {
            return  failedListEnvelopException(e);
        }
    }
}
}

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

@ -200,7 +200,7 @@ fastDFS:
fast-dfs:
fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
  tracker-server: 172.26.0.110:22122 #服务器地址
wechat:
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  id: xm_mlwyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
  flag: false #演示环境  true走Mysql数据库  false走Oracle
  url: http://172.16.100.37:8090/hospitalPortal-sms/sms/sendMessage
  url: http://172.16.100.37:8090/hospitalPortal-sms/sms/sendMessage
# 短信验证码发送的客户端标识,居民端
# 短信验证码发送的客户端标识,居民端