|
@ -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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|