|
@ -0,0 +1,874 @@
|
|
|
|
package com.yihu.jw.healthUpload.service;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
|
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
|
|
|
|
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
|
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
|
import com.yihu.jw.entity.healthUpload.BaseDoctorHealthUploadDO;
|
|
|
|
import com.yihu.jw.entity.healthUpload.BaseDoctorMemberDO;
|
|
|
|
import com.yihu.jw.entity.hospital.DmHospitalDO;
|
|
|
|
import com.yihu.jw.healthUpload.dao.BaseDoctorHealthUploadDao;
|
|
|
|
import com.yihu.jw.healthUpload.dao.BaseDoctorMemberDao;
|
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
|
|
import com.yihu.jw.util.common.PwdUtil;
|
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
|
import com.yihu.jw.util.idcard.IdCardUtil;
|
|
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
|
|
import jxl.format.*;
|
|
|
|
import jxl.write.*;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import javax.transaction.Transactional;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
import java.text.DecimalFormat;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@Transactional
|
|
|
|
public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHealthUploadDO, BaseDoctorHealthUploadDao> {
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(BaseDoctorHealthUploadService.class);
|
|
|
|
@Autowired
|
|
|
|
private BaseDoctorMemberDao doctorMemberDao;
|
|
|
|
@Autowired
|
|
|
|
private BaseDoctorDao baseDoctorDao;
|
|
|
|
@Autowired
|
|
|
|
private BaseDoctorHealthUploadDao baseDoctorHealthUploadDao;
|
|
|
|
@Autowired
|
|
|
|
private BaseDoctorHospitalDao baseDoctorHospitalDao;
|
|
|
|
@Autowired
|
|
|
|
private DictHospitalDeptDao dictHospitalDeptDao;
|
|
|
|
/**
|
|
|
|
* 新增医生成员关系
|
|
|
|
* @param doctorId
|
|
|
|
* @param ids 逗号隔开
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public List<BaseDoctorMemberDO> saveAndCreateMember(String doctorId,String ids){
|
|
|
|
String str[] =ids.split(",");
|
|
|
|
List<BaseDoctorMemberDO> baseDoctorMemberDOList = new ArrayList<>();
|
|
|
|
for (int i=0;i<str.length;i++){
|
|
|
|
String memberId = str[i];
|
|
|
|
BaseDoctorMemberDO memberDO = doctorMemberDao.findByDoctorIdAndMemberIdAndDel(doctorId,memberId);
|
|
|
|
if (memberDO==null){
|
|
|
|
BaseDoctorMemberDO baseDoctorMemberDO = new BaseDoctorMemberDO();
|
|
|
|
baseDoctorMemberDO.setDel(1);
|
|
|
|
baseDoctorMemberDO.setDoctorId(doctorId);
|
|
|
|
baseDoctorMemberDO.setMemberId(memberId);
|
|
|
|
baseDoctorMemberDO.setCreateTime(new Date());
|
|
|
|
baseDoctorMemberDO.setUpdateTime(new Date());
|
|
|
|
baseDoctorMemberDO= doctorMemberDao.save(baseDoctorMemberDO);
|
|
|
|
baseDoctorMemberDOList.add(baseDoctorMemberDO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return baseDoctorMemberDOList;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询医生的成员列表
|
|
|
|
* @param doctorId
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public List<BaseDoctorMemberDO> selectByDoctorId(String doctorId){
|
|
|
|
List<BaseDoctorMemberDO> baseDoctorMemberDOList = doctorMemberDao.findByDoctorIdAndDel(doctorId);
|
|
|
|
BaseDoctorMemberDO memberDO1 = doctorMemberDao.findByDoctorIdAndMemberIdAndDel(doctorId,doctorId);
|
|
|
|
//添加本人
|
|
|
|
if (memberDO1==null){
|
|
|
|
BaseDoctorMemberDO baseDoctorMemberDO = new BaseDoctorMemberDO();
|
|
|
|
baseDoctorMemberDO.setDel(1);
|
|
|
|
baseDoctorMemberDO.setDoctorId(doctorId);
|
|
|
|
baseDoctorMemberDO.setMemberId(doctorId);
|
|
|
|
baseDoctorMemberDO.setCreateTime(new Date());
|
|
|
|
baseDoctorMemberDO.setUpdateTime(new Date());
|
|
|
|
baseDoctorMemberDO= doctorMemberDao.save(baseDoctorMemberDO);
|
|
|
|
}
|
|
|
|
for (BaseDoctorMemberDO memberDO:baseDoctorMemberDOList){
|
|
|
|
BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(memberDO.getMemberId());
|
|
|
|
if (baseDoctorDO!=null){
|
|
|
|
memberDO.setBaseDoctorDO(baseDoctorDO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return baseDoctorMemberDOList;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询医生的成员列表带有已上报次数
|
|
|
|
* @param doctorId
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public List<BaseDoctorMemberDO> selectCountByDoctorId(String doctorId){
|
|
|
|
List<BaseDoctorMemberDO> baseDoctorMemberDOList = doctorMemberDao.findByDoctorIdAndDel(doctorId);
|
|
|
|
for (BaseDoctorMemberDO memberDO:baseDoctorMemberDOList){
|
|
|
|
BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(memberDO.getMemberId());
|
|
|
|
if (baseDoctorDO!=null){
|
|
|
|
memberDO.setBaseDoctorDO(baseDoctorDO);
|
|
|
|
}
|
|
|
|
List<BaseDoctorHealthUploadDO> baseDoctorHealthUploadDOList = baseDoctorHealthUploadDao.findByDoctorIdAndConsumer(memberDO.getMemberId(),doctorId);
|
|
|
|
memberDO.setCount(baseDoctorHealthUploadDOList.size()+"");
|
|
|
|
}
|
|
|
|
return baseDoctorMemberDOList;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询某一个成员id
|
|
|
|
* @param id 成员id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public BaseDoctorMemberDO selectById(String id){
|
|
|
|
BaseDoctorMemberDO baseDoctorMemberDO = doctorMemberDao.findById(id);
|
|
|
|
BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(baseDoctorMemberDO.getMemberId());
|
|
|
|
if (baseDoctorDO!=null){
|
|
|
|
baseDoctorMemberDO.setBaseDoctorDO(baseDoctorDO);
|
|
|
|
}
|
|
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(baseDoctorMemberDO.getMemberId());
|
|
|
|
baseDoctorMemberDO.setDoctorHospitalDOS(doctorHospitalDOS);
|
|
|
|
return baseDoctorMemberDO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 删除某个成员
|
|
|
|
* @param id 成员id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public BaseDoctorMemberDO delDoctorMember(String id){
|
|
|
|
BaseDoctorMemberDO baseDoctorMemberDO = doctorMemberDao.findById(id);
|
|
|
|
baseDoctorMemberDO.setDel(0);
|
|
|
|
baseDoctorMemberDO = doctorMemberDao.save(baseDoctorMemberDO);
|
|
|
|
return baseDoctorMemberDO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 提交健康信息
|
|
|
|
* @param baseDoctorHealthUploadDO 健康信息实体类
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public BaseDoctorHealthUploadDO createHealthUploadInfo(BaseDoctorHealthUploadDO baseDoctorHealthUploadDO){
|
|
|
|
baseDoctorHealthUploadDO.setCreateTime(new Date());
|
|
|
|
return baseDoctorHealthUploadDao.save(baseDoctorHealthUploadDO);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询成员的健康上报记录
|
|
|
|
*
|
|
|
|
* @param doctorId 医生id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public MixEnvelop selectHealthUploadInfoByDoctorId(String doctorId,String startDate,String endDate,Integer page,Integer pageSize){
|
|
|
|
PageRequest pageRequest = new PageRequest(page-1,pageSize);
|
|
|
|
MixEnvelop mixEnvelop = new MixEnvelop();
|
|
|
|
List<BaseDoctorHealthUploadDO> list = new ArrayList<>();
|
|
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
|
|
Date startTime = DateUtil.strToDateLong(startDate);
|
|
|
|
Date endTime = DateUtil.strToDateLong(endDate);
|
|
|
|
list = baseDoctorHealthUploadDao.selectHealthUploadInfoByDoctorIdAndDate(doctorId,startTime,endTime,pageRequest);
|
|
|
|
}else {
|
|
|
|
list =baseDoctorHealthUploadDao.selectHealthUploadInfoByDoctorId(doctorId,pageRequest);
|
|
|
|
}
|
|
|
|
mixEnvelop.setCurrPage(page);
|
|
|
|
mixEnvelop.setPageSize(pageSize);
|
|
|
|
mixEnvelop.setDetailModelList(list);
|
|
|
|
mixEnvelop.setTotalCount(list==null?0:list.size());
|
|
|
|
return mixEnvelop;
|
|
|
|
}
|
|
|
|
|
|
|
|
public BaseDoctorHealthUploadDO selectHealthInfoById(String id){
|
|
|
|
BaseDoctorHealthUploadDO baseDoctorHealthUploadDO = baseDoctorHealthUploadDao.findById(id);
|
|
|
|
return baseDoctorHealthUploadDO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 新增加医生信息
|
|
|
|
* @param photo
|
|
|
|
* @param name
|
|
|
|
* @param idcard
|
|
|
|
* @param sex
|
|
|
|
* @param mobile
|
|
|
|
* @param dept
|
|
|
|
* @param deptName
|
|
|
|
* @param idCardType
|
|
|
|
* @param idType
|
|
|
|
* @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 {
|
|
|
|
BaseDoctorDO baseDoctorDO = new BaseDoctorDO();
|
|
|
|
if (StringUtils.isNoneBlank(id)) {
|
|
|
|
baseDoctorDO = baseDoctorDao.findById(id);
|
|
|
|
baseDoctorDO.setIdCardType(idCardType);
|
|
|
|
baseDoctorDO.setIdType(idType);
|
|
|
|
baseDoctorDO.setPhoto(photo);
|
|
|
|
baseDoctorDO.setName(name);
|
|
|
|
baseDoctorDO.setIdcard(idcard);
|
|
|
|
baseDoctorDO.setSex(Integer.parseInt(sex));
|
|
|
|
baseDoctorDO.setMobile(mobile);
|
|
|
|
String deptCode = dept;
|
|
|
|
baseDoctorDO.setChargeType("1");
|
|
|
|
baseDoctorDO = baseDoctorDao.save(baseDoctorDO);
|
|
|
|
List<BaseDoctorHospitalDO> baseDoctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(baseDoctorDO.getId());
|
|
|
|
if (!(null != baseDoctorHospitalDOS && baseDoctorHospitalDOS.size() > 0)) {
|
|
|
|
baseDoctorHospitalDao.delete(baseDoctorHospitalDOS);
|
|
|
|
BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
|
|
|
|
baseDoctorHospitalDO.setOrgCode("350211A1002");
|
|
|
|
baseDoctorHospitalDO.setOrgName("马銮湾医院");
|
|
|
|
baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
|
|
|
|
baseDoctorHospitalDO.setDeptCode(deptCode);
|
|
|
|
baseDoctorHospitalDO.setDeptName(deptName);
|
|
|
|
baseDoctorHospitalDO.setDel("1");
|
|
|
|
baseDoctorHospitalDao.save(baseDoctorHospitalDO);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
baseDoctorDO.setIdcard(idcard);
|
|
|
|
baseDoctorDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
|
|
|
|
baseDoctorDO.setSex(Integer.parseInt(sex));
|
|
|
|
baseDoctorDO.setLocked(0);
|
|
|
|
baseDoctorDO.setEnabled(1);
|
|
|
|
String disableFlag = "0";
|
|
|
|
//互联网医院:1停用,0使用 转 i健康:1正常,0作废
|
|
|
|
baseDoctorDO.setDel("1".equals(disableFlag) ? "0" : "1");
|
|
|
|
baseDoctorDO.setMobile("0");
|
|
|
|
baseDoctorDO.setName(name);
|
|
|
|
baseDoctorDO.setIsFamous(0);
|
|
|
|
baseDoctorDO.setCreateTime(new Date());
|
|
|
|
baseDoctorDO.setUpdateTime(new Date());
|
|
|
|
baseDoctorDO.setIdCardType(idCardType);
|
|
|
|
baseDoctorDO.setIdType(idType);
|
|
|
|
baseDoctorDO.setPhoto(photo);
|
|
|
|
baseDoctorDO.setMobile(mobile);
|
|
|
|
baseDoctorDO.setChargeType("1");
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(mobile)) {
|
|
|
|
baseDoctorDO.setSalt(PwdUtil.randomString(5));
|
|
|
|
try {
|
|
|
|
baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex(baseDoctorDO.getMobile().substring(baseDoctorDO.getMobile().length() - 6) + "{" + baseDoctorDO.getSalt() + "}"));
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex("123456" + "{" + baseDoctorDO.getSalt() + "}"));
|
|
|
|
}
|
|
|
|
// 用医生和机构id、部门判断数据是否存在,若不存在则保存医生机构关联关系
|
|
|
|
String deptCode = dept;
|
|
|
|
baseDoctorDO = baseDoctorDao.save(baseDoctorDO);
|
|
|
|
List<BaseDoctorHospitalDO> baseDoctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(baseDoctorDO.getId());
|
|
|
|
if (!(null != baseDoctorHospitalDOS && baseDoctorHospitalDOS.size() > 0)) {
|
|
|
|
baseDoctorHospitalDao.delete(baseDoctorHospitalDOS);
|
|
|
|
BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
|
|
|
|
baseDoctorHospitalDO.setOrgCode("350211A1002");
|
|
|
|
baseDoctorHospitalDO.setOrgName("马銮湾医院");
|
|
|
|
baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
|
|
|
|
baseDoctorHospitalDO.setDeptCode(deptCode);
|
|
|
|
baseDoctorHospitalDO.setDeptName(deptName);
|
|
|
|
baseDoctorHospitalDO.setDel("1");
|
|
|
|
baseDoctorHospitalDao.save(baseDoctorHospitalDO);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return baseDoctorDO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param dept
|
|
|
|
* @param level 1院级管理员,2科室管理员
|
|
|
|
* @param doctorId
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public JSONObject selectHealthByRole(String dept,int level,String doctorId){
|
|
|
|
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 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 benrenshangbaoSql = "select count(1) as total from base_doctor_health_upload where consumer='"+doctorId+"' and consumer in(doctor_id)";
|
|
|
|
String doctorSql ="";
|
|
|
|
String sql = "";
|
|
|
|
if (level==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){
|
|
|
|
//总人次
|
|
|
|
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'";
|
|
|
|
}
|
|
|
|
//今日提交
|
|
|
|
int personTotal = 0;
|
|
|
|
//代上报
|
|
|
|
int daishangbaoTotal = 0;
|
|
|
|
//本人上报
|
|
|
|
int benrenshangbaoTotal = 0;
|
|
|
|
//总人次
|
|
|
|
int doctorTotal = 0;
|
|
|
|
//今日上报人次
|
|
|
|
int sqlTotal = 0;
|
|
|
|
//今日未上报人次
|
|
|
|
int notUploadTotal = 0;
|
|
|
|
Map<String,Object> personMap = jdbcTemplate.queryForMap(personSql);
|
|
|
|
if (personMap!=null){
|
|
|
|
if (personMap.get("total")!=null){
|
|
|
|
personTotal = Integer.parseInt(personMap.get("total").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String,Object> daishangbaoMap = jdbcTemplate.queryForMap(daishangbaoSql);
|
|
|
|
if (daishangbaoMap!=null){
|
|
|
|
if (daishangbaoMap.get("total")!=null){
|
|
|
|
daishangbaoTotal = Integer.parseInt(daishangbaoMap.get("total").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String,Object> benrenshangbaoMap = jdbcTemplate.queryForMap(benrenshangbaoSql);
|
|
|
|
if (benrenshangbaoMap!=null){
|
|
|
|
if (benrenshangbaoMap.get("total")!=null){
|
|
|
|
benrenshangbaoTotal = Integer.parseInt(benrenshangbaoMap.get("total").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String,Object> doctorMap = jdbcTemplate.queryForMap(doctorSql);
|
|
|
|
if (doctorMap!=null){
|
|
|
|
if (doctorMap.get("total")!=null){
|
|
|
|
doctorTotal = Integer.parseInt(doctorMap.get("total").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Map<String,Object> sqlMap = jdbcTemplate.queryForMap(sql);
|
|
|
|
if (sqlMap!=null){
|
|
|
|
if (sqlMap.get("total")!=null){
|
|
|
|
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){
|
|
|
|
benrenTotal = Integer.parseInt(benrenMap.get("total").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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);//今日本人提交
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 首页统计
|
|
|
|
*
|
|
|
|
* @param dept
|
|
|
|
* @param idType
|
|
|
|
* @param status 上报状态
|
|
|
|
* @param state 健康状态
|
|
|
|
* @param startDate
|
|
|
|
* @param endDate
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public JSONObject selectHeaderTotal(String dept,String idType,String status,String state,String startDate,String endDate){
|
|
|
|
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;//总人次
|
|
|
|
String sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 ";
|
|
|
|
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 )";
|
|
|
|
}
|
|
|
|
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(deptCondition)){
|
|
|
|
doctorSql+=" and d.id IN "+deptCondition;
|
|
|
|
}
|
|
|
|
if (StringUtils.isNoneBlank(idTypeCondition)){
|
|
|
|
doctorSql+=" and d.id IN "+idTypeCondition ;
|
|
|
|
}
|
|
|
|
Map<String,Object> map = jdbcTemplate.queryForMap(doctorSql);
|
|
|
|
String doctorTotal = "";
|
|
|
|
if (map!=null){
|
|
|
|
doctorTotal = map.get("total").toString();
|
|
|
|
}
|
|
|
|
if (StringUtils.isNoneBlank(doctorTotal)){
|
|
|
|
//总人次
|
|
|
|
if (!day.equalsIgnoreCase("0")){
|
|
|
|
total = Integer.parseInt(doctorTotal)*Integer.parseInt(day);
|
|
|
|
}else {
|
|
|
|
total= Integer.parseInt(doctorTotal);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Integer yishangbaoTotal = 0;
|
|
|
|
Integer weishangbaoTotal =0;
|
|
|
|
Integer zhengchangTotal = 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=1 ";
|
|
|
|
}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(idTypeCondition)){
|
|
|
|
sql+=" and d.doctor_id IN "+idTypeCondition ;
|
|
|
|
}
|
|
|
|
//已上传
|
|
|
|
Map<String,Object> yishangchaungMap = jdbcTemplate.queryForMap(sql);
|
|
|
|
if (yishangchaungMap!=null){
|
|
|
|
if (yishangchaungMap.get("total")!=null){
|
|
|
|
yishangbaoTotal = Integer.parseInt(yishangchaungMap.get("total").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//未上报
|
|
|
|
weishangbaoTotal=total-yishangbaoTotal;
|
|
|
|
//正常、异常
|
|
|
|
String sqlZhengchang = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and d.health_code=1 ";
|
|
|
|
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(idTypeCondition)){
|
|
|
|
sqlZhengchang +=" and d.doctor_id IN "+idTypeCondition ;
|
|
|
|
}
|
|
|
|
//正常
|
|
|
|
Map<String,Object> zhengchangMap = jdbcTemplate.queryForMap(sqlZhengchang);
|
|
|
|
if (zhengchangMap!=null){
|
|
|
|
if (zhengchangMap.get("total")!=null){
|
|
|
|
zhengchangTotal = Integer.parseInt(zhengchangMap.get("total").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
String sqlYichang = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR d.is_symptoms=1 OR d.is_epidemic=1) ";
|
|
|
|
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(idTypeCondition)){
|
|
|
|
sqlYichang +=" and d.doctor_id IN "+idTypeCondition ;
|
|
|
|
}
|
|
|
|
//正常
|
|
|
|
Map<String,Object> yichangMap = jdbcTemplate.queryForMap(sqlYichang);
|
|
|
|
if (yichangMap!=null){
|
|
|
|
if (yichangMap.get("total")!=null){
|
|
|
|
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);//上报异常
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 具体每一个统计时间列表
|
|
|
|
*
|
|
|
|
* @param dept
|
|
|
|
* @param idType
|
|
|
|
* @param status
|
|
|
|
* @param state
|
|
|
|
* @param startDate
|
|
|
|
* @param endDate
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
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<>();
|
|
|
|
Date startTime = DateUtil.strToDateShort(startDate);
|
|
|
|
for (int i=0;i<=days;i++){
|
|
|
|
Date date = DateUtil.getPreDays(startTime,i);
|
|
|
|
String str = DateUtil.dateToStrShort(date);
|
|
|
|
list.add(str);
|
|
|
|
}
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
|
for (int i=0;i<list.size();i++){
|
|
|
|
String date = list.get(i);
|
|
|
|
String doctorSql =" select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
|
|
|
|
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 )";
|
|
|
|
}
|
|
|
|
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(deptCondition)){
|
|
|
|
doctorSql+=" and d.id IN "+deptCondition;
|
|
|
|
}
|
|
|
|
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(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 =1) ";
|
|
|
|
}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+"' ";
|
|
|
|
}
|
|
|
|
Map<String,Object> map = jdbcTemplate.queryForMap(doctorSql);
|
|
|
|
Integer total = 0;
|
|
|
|
if (map!=null){
|
|
|
|
if (map.get("total")!=null){
|
|
|
|
total = Integer.parseInt(map.get("total").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
object.put("time",date);
|
|
|
|
object.put("total",total);
|
|
|
|
array.add(object);
|
|
|
|
}
|
|
|
|
return array;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 具体每一个统计时间的详情
|
|
|
|
*
|
|
|
|
* @param dept
|
|
|
|
* @param idType
|
|
|
|
* @param status
|
|
|
|
* @param state
|
|
|
|
* @param startDate
|
|
|
|
* @param endDate
|
|
|
|
* @param name total
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
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<>();
|
|
|
|
Date startTime = DateUtil.strToDateShort(startDate);
|
|
|
|
for (int i=0;i<=days;i++){
|
|
|
|
Date date = DateUtil.getPreDays(startTime,i);
|
|
|
|
String str = DateUtil.dateToStrShort(date);
|
|
|
|
list.add(str);
|
|
|
|
}
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
|
for (int i=0;i<list.size();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 deptCondition = "";
|
|
|
|
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 = " ";
|
|
|
|
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(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(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 =1) ";
|
|
|
|
}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+"%'";
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> mapList = jdbcTemplate.queryForList(doctorSql);
|
|
|
|
for (Map<String,Object> map:mapList){
|
|
|
|
String id = map.get("id").toString();
|
|
|
|
List<BaseDoctorHospitalDO> hospitalDOList = baseDoctorHospitalDao.findByDoctorCode(id);
|
|
|
|
map.put("deptInfo",hospitalDOList);
|
|
|
|
String sql = "select d1.health_code,d1.temperature,d1.is_symptoms as isSymptoms,d1.is_epidemic as isEpidemic,d1.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.doctor_id = '"+id+"' order by d1.create_time desc ";
|
|
|
|
List<Map<String,Object>> mapList1 = jdbcTemplate.queryForList(sql);
|
|
|
|
if (mapList1!=null&&mapList1.size()!=0){
|
|
|
|
Map<String,Object> map1 = mapList1.get(0);
|
|
|
|
String healthCode = map1.get("health_code").toString();
|
|
|
|
Double temperature = Double.parseDouble(map1.get("temperature").toString());
|
|
|
|
String isSymptoms = map1.get("isSymptoms").toString();
|
|
|
|
String isEpidemic = map1.get("isEpidemic").toString();
|
|
|
|
if (healthCode.equalsIgnoreCase("2")||healthCode.equalsIgnoreCase("3")||
|
|
|
|
temperature>=37.3||isSymptoms.equalsIgnoreCase("1")||isEpidemic.equalsIgnoreCase("1")){
|
|
|
|
map.put("healthState","异常");
|
|
|
|
}else {
|
|
|
|
map.put("healthState","正常");
|
|
|
|
}
|
|
|
|
map.put("uploadState","已上报");
|
|
|
|
map.put("uploadId",map1.get("id").toString());
|
|
|
|
}else {
|
|
|
|
map.put("healthState","未知");
|
|
|
|
map.put("uploadState","未上报");
|
|
|
|
map.put("uploadId","");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
object.put("time",date);
|
|
|
|
object.put("list",mapList);
|
|
|
|
array.add(object);
|
|
|
|
}
|
|
|
|
return array;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 报表导出
|
|
|
|
*
|
|
|
|
* @param startDate
|
|
|
|
* @param endDate
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public JSONArray selectListInfoExcelByTotal(OutputStream os,String startDate,String endDate) throws Exception {
|
|
|
|
long days = DateUtil.getDays(endDate,startDate);
|
|
|
|
List<String> list = new ArrayList<>();
|
|
|
|
Date startTime = DateUtil.strToDateShort(startDate);
|
|
|
|
for (int i=0;i<=days;i++){
|
|
|
|
Date date = DateUtil.getPreDays(startTime,i);
|
|
|
|
String str = DateUtil.dateToStrShort(date);
|
|
|
|
list.add(str);
|
|
|
|
}
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
|
for (int i=0;i<list.size();i++){
|
|
|
|
String date = list.get(i);
|
|
|
|
String doctorSql ="SELECT\n" +
|
|
|
|
"\td.idcard as idcard,\n" +
|
|
|
|
"\td.name as name,\n" +
|
|
|
|
"\td.mobile as mobile,\n" +
|
|
|
|
"\td.id_type as idType,\n" +
|
|
|
|
"\tdh.dept_name as deptName,\n" +
|
|
|
|
"\tdhu.province_name as provinceName,\n" +
|
|
|
|
"\tdhu.city_name as cityName,\n" +
|
|
|
|
"\tdhu.town_name as townName,\n" +
|
|
|
|
"\tdhu.street_name as streetName,\n" +
|
|
|
|
"\tdhu.address as address,\n" +
|
|
|
|
"\tdhu.temperature as temperature,\n" +
|
|
|
|
"\tdhu.health_code as healthCode,\n" +
|
|
|
|
"\tdhu.tour_code as tourCode,\n" +
|
|
|
|
"\tdhu.is_symptoms as isSymtoms,\n" +
|
|
|
|
"\tdhu.is_epidemic as isEpidemic,\n" +
|
|
|
|
"\tdhu.is_outside as isOutside,\n" +
|
|
|
|
"\tdhu.is_nucleate as isNucleate,\n" +
|
|
|
|
"\tdhu.is_outside_high as isOutsideHigh \n" +
|
|
|
|
"FROM\n" +
|
|
|
|
"\tbase_doctor d\n" +
|
|
|
|
"LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id\n" +
|
|
|
|
"LEFT JOIN /*(SELECT\n" +
|
|
|
|
"\t\t*\n" +
|
|
|
|
"\tFROM\n" +
|
|
|
|
"\t\tbase_doctor_health_upload dhu1\n" +
|
|
|
|
"\tWHERE\n" +
|
|
|
|
"\t\tdhu1.create_time >= '"+date+" 00:00:00'\n" +
|
|
|
|
"\tAND dhu1.create_time <= '"+date+" 23:59:59'\n)*/ 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);
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
object.put("time",date);
|
|
|
|
object.put("list",mapList);
|
|
|
|
array.add(object);
|
|
|
|
}
|
|
|
|
pushListWritePriceTotal(os,array,startDate,endDate);
|
|
|
|
return array;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* mergeCells(a,b,c,d)
|
|
|
|
* a 单元格的列号
|
|
|
|
|
|
|
|
b 单元格的行号
|
|
|
|
|
|
|
|
c 从单元格[a,b]起,向左合并到c列
|
|
|
|
|
|
|
|
d 从单元格[a,b]起,向下合并到d行
|
|
|
|
* 收入日报导出
|
|
|
|
* @param os
|
|
|
|
* @param ls
|
|
|
|
* @param startTime
|
|
|
|
* @param endTime
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public void pushListWritePriceTotal(OutputStream os,JSONArray ls,String startTime, String endTime) throws Exception {
|
|
|
|
WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
|
|
|
|
try {
|
|
|
|
WritableSheet ws;
|
|
|
|
ws = wwb.createSheet("sheet", 1);
|
|
|
|
String[] header = {"互联网综合服务平台健康上报情况","","","","","","","","","","","","","",""};//
|
|
|
|
int k = 0;
|
|
|
|
for (String h : header) {
|
|
|
|
addCell(ws, 0, k, h);//表名,行,列,header
|
|
|
|
k++;
|
|
|
|
}
|
|
|
|
|
|
|
|
String[] header1 = {"汇总日期:"+startTime+"至"+endTime,"","","","","","","","","","","","","",""};//
|
|
|
|
int k1 = 0;
|
|
|
|
for (String h : header1) {
|
|
|
|
addCell(ws, 1, k1, h);//表名,行,列,header
|
|
|
|
k1++;
|
|
|
|
}
|
|
|
|
String[] header2 = {"科室","姓名","电话","身份类别","上报状态","所在地","体温","健康码","行程码","异常症状","涉疫人员","14天内从外地返","核酸检测","14天内有同往人从中高风险返厦","健康状态"};//
|
|
|
|
int k2 = 0;
|
|
|
|
for (String h : header2) {
|
|
|
|
addCell(ws, 2, k2, h);//表名,行,列,header
|
|
|
|
k2++;
|
|
|
|
}
|
|
|
|
int j= 2;
|
|
|
|
for (int i=0;i<ls.size();i++){
|
|
|
|
JSONObject jsonObject = ls.getJSONObject(i);
|
|
|
|
String time = jsonObject.getString("time");
|
|
|
|
j = j+1;
|
|
|
|
addCell(ws, j, 0, time);//表名,行,列,header
|
|
|
|
ws.mergeCells(0,j,14,j);
|
|
|
|
JSONArray array = jsonObject.getJSONArray("list");
|
|
|
|
for (int z=0;z<array.size();z++){
|
|
|
|
j=j+z+1;
|
|
|
|
JSONObject object = array.getJSONObject(z);
|
|
|
|
addCell(ws, j+1, 0, object.getString("deptName"));//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 1, object.getString("name"));//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 2, object.getString("mobile"));//表名,行,列,header
|
|
|
|
if (StringUtils.isNoneBlank(object.getString("idType"))){
|
|
|
|
addCell(ws, j+1, 3, object.getString("idType"));//表名,行,列,header
|
|
|
|
}else {
|
|
|
|
addCell(ws, j+1, 3, "");//表名,行,列,header
|
|
|
|
}
|
|
|
|
if (StringUtils.isNoneBlank(object.getString("temperature"))){
|
|
|
|
addCell(ws, j+1, 4, "已上报");//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 5, object.getString("address"));//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 6, object.getString("temperature"));//表名,行,列,header
|
|
|
|
String healthCodeName="";
|
|
|
|
String healthStateName= "";
|
|
|
|
if (object.getString("healthCode").equalsIgnoreCase("1")){
|
|
|
|
healthCodeName="绿码";
|
|
|
|
healthStateName="正常";
|
|
|
|
}else if (object.getString("healthCode").equalsIgnoreCase("2")){
|
|
|
|
healthCodeName="红码";
|
|
|
|
healthStateName="异常";
|
|
|
|
}else if (object.getString("healthCode").equalsIgnoreCase("3")){
|
|
|
|
healthCodeName="黄码";
|
|
|
|
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="否";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
addCell(ws, j+1, 7, healthCodeName);//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 8, tourCodeName);//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 9, isSymtomsName);//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 10, isEpidemicName);//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 11, isOutsideName);//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 12, isNucleateName);//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 13, isOutsideHighName);//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 14, healthStateName);//表名,行,列,header
|
|
|
|
}else {
|
|
|
|
addCell(ws, j+1, 4, "未上报");//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 5, "");//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 6, "");//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 7, "");//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 8, "");//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 9, "");//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 10, "");//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 11, "");//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 12, "");//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 13, "");//表名,行,列,header
|
|
|
|
addCell(ws, j+1, 14, "");//表名,行,列,header
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
ws.mergeCells(0,0,14,0);
|
|
|
|
ws.mergeCells(0,1,14,1);
|
|
|
|
wwb.write();
|
|
|
|
wwb.close();
|
|
|
|
} catch (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
if (wwb != null) wwb.close();
|
|
|
|
throw e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//添加单元格内容
|
|
|
|
public void addCell(WritableSheet ws, int row, int column, String data) throws WriteException {
|
|
|
|
Label label = new Label(column, row, data);
|
|
|
|
WritableCellFormat cellFormat = new WritableCellFormat();
|
|
|
|
cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
|
|
|
|
cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
|
|
|
|
label.setCellFormat(cellFormat);
|
|
|
|
ws.addCell(label);
|
|
|
|
}
|
|
|
|
}
|