|
@ -2,8 +2,8 @@ package com.yihu.jw.dailyReport.service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.jw.dailyReport.dao.BaseDailyReportDetailDao;
|
|
|
import com.yihu.jw.dailyReport.dao.BaseDailyReportUploadDao;
|
|
|
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
|
|
|
import com.yihu.jw.dailyReport.dao.*;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
|
|
@ -13,15 +13,16 @@ 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.dailyReport.BaseDailyReportDetailDO;
|
|
|
import com.yihu.jw.entity.dailyReport.BaseDailyReportUploadDO;
|
|
|
import com.yihu.jw.entity.dailyReport.*;
|
|
|
import com.yihu.jw.entity.healthUpload.BaseDoctorMemberDO;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
|
import com.yihu.jw.entity.hospital.enterprise.WxEnterpriseUserDO;
|
|
|
import com.yihu.jw.healthUpload.dao.BaseDoctorMemberDao;
|
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
|
import com.yihu.jw.util.common.PwdUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.util.file.FileUtil;
|
|
|
import com.yihu.jw.util.idcard.IdCardUtil;
|
|
|
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
|
|
|
import com.yihu.jw.utils.StringUtil;
|
|
@ -30,8 +31,13 @@ import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
|
|
|
import com.yihu.jw.wechat.enterprise.EnterpriseService;
|
|
|
import com.yihu.jw.wechat.enterprise.dao.WxEnterpriseUserDao;
|
|
|
import com.yihu.jw.wechat.service.WxAccessTokenService;
|
|
|
import jxl.Workbook;
|
|
|
import jxl.write.*;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.ss.util.WorkbookUtil;
|
|
|
import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@ -39,12 +45,18 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.OutputStream;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.*;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* Created by Bing on 2022/7/25.
|
|
@ -55,6 +67,8 @@ public class DailyReportUploadService {
|
|
|
@Autowired
|
|
|
private BaseDailyReportUploadDao dailyReportUploadDao;
|
|
|
@Autowired
|
|
|
private BaseDailyReportLogDao dailyReportLogDao;
|
|
|
@Autowired
|
|
|
private BaseDailyReportDetailDao reportDetailDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorMemberDao doctorMemberDao;
|
|
@ -82,6 +96,10 @@ public class DailyReportUploadService {
|
|
|
private String wechatId;
|
|
|
@Autowired
|
|
|
private EnterpriseService enterpriseService;
|
|
|
@Autowired
|
|
|
private BaseDailyReportItemDao reportItemDao;
|
|
|
@Autowired
|
|
|
private BaseDailyReportItemMembersDao reportItemMembersDao;
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(DailyReportUploadService.class);
|
|
|
|
|
@ -317,7 +335,7 @@ public class DailyReportUploadService {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public BaseDailyReportUploadDO createDailyReport(String doctorId,String report_date,Integer leaveState,String leaveHour,String week_name, List<BaseDailyReportDetailDO> detailDOList) throws Exception {
|
|
|
public BaseDailyReportUploadDO createDailyReport(String doctorId,String report_date,Integer leaveState,String leaveHour,String week_name,String totalHour, List<BaseDailyReportDetailDO> detailDOList) throws Exception {
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(doctorId);
|
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(doctorId);
|
|
|
if (null==doctorDO){
|
|
@ -325,7 +343,7 @@ public class DailyReportUploadService {
|
|
|
}
|
|
|
if (1==leaveState){
|
|
|
if (StringUtils.isNotBlank(leaveHour)){
|
|
|
if (Integer.parseInt(leaveHour)<8&&detailDOList.size()==0){
|
|
|
if (Double.parseDouble(leaveHour)<8&&detailDOList.size()==0){
|
|
|
throw new Exception("上传失败,请假未满8小时需要提交完成内容");
|
|
|
}
|
|
|
}
|
|
@ -348,9 +366,33 @@ public class DailyReportUploadService {
|
|
|
dailyReportUploadDO.setWeekName(week_name);
|
|
|
dailyReportUploadDO.setLeaveState(leaveState);
|
|
|
dailyReportUploadDO.setLeaveHour(leaveHour);
|
|
|
dailyReportUploadDO.setTotalHour(totalHour);
|
|
|
dailyReportUploadDO = dailyReportUploadDao.save(dailyReportUploadDO);
|
|
|
for (BaseDailyReportDetailDO tmp :detailDOList){
|
|
|
tmp.setReportId(dailyReportUploadDO.getId());
|
|
|
if (tmp.getReportItemFlag()==true){//新则自建关联项目
|
|
|
String title = tmp.getReportItemTitle();
|
|
|
BaseDailyReportItemDO reportItemDO = new BaseDailyReportItemDO();
|
|
|
reportItemDO.setState(0);
|
|
|
reportItemDO.setDel(1);
|
|
|
reportItemDO.setTitle(title);
|
|
|
reportItemDO.setContent(tmp.getReportContent());
|
|
|
reportItemDO.setBeginTime(null);
|
|
|
reportItemDO.setEndTime(null);
|
|
|
reportItemDO.setCreateTime(new Date());
|
|
|
reportItemDO.setCreateUser(doctorId);
|
|
|
reportItemDO.setCreateUserName(doctorDO.getName());
|
|
|
reportItemDO = reportItemDao.save(reportItemDO);
|
|
|
|
|
|
BaseDailyReportItemMembersDO membersDOTmp = new BaseDailyReportItemMembersDO();
|
|
|
membersDOTmp.setReportItemId(reportItemDO.getId());
|
|
|
membersDOTmp.setUserId(doctorId);
|
|
|
membersDOTmp.setUserName(doctorDO.getName());
|
|
|
membersDOTmp.setDel(1);
|
|
|
reportItemMembersDao.save(membersDOTmp);
|
|
|
tmp.setReportItemId(reportItemDO.getId());
|
|
|
tmp.setReportItemName(title);
|
|
|
}
|
|
|
}
|
|
|
if (detailDOList.size()>0){
|
|
|
reportDetailDao.save(detailDOList);
|
|
@ -405,7 +447,15 @@ public class DailyReportUploadService {
|
|
|
}
|
|
|
dailyReportUploadDao.save(dailyReportUploadDO);
|
|
|
dailyReportUploadDO.setDetailDOList(detailDOS);
|
|
|
|
|
|
BaseDailyReportLogDO baseDailyReportLogDO = new BaseDailyReportLogDO();
|
|
|
baseDailyReportLogDO.setCreateTime(new Date());
|
|
|
baseDailyReportLogDO.setReportId(dailyReportUploadDO.getId());
|
|
|
baseDailyReportLogDO.setContent("日报提交");
|
|
|
baseDailyReportLogDO.setOperateUser(dailyReportUploadDO.getDoctorId());
|
|
|
baseDailyReportLogDO.setOperateUserName(dailyReportUploadDO.getDoctorName());
|
|
|
baseDailyReportLogDO.setType(1);
|
|
|
baseDailyReportLogDO.setTypeName("日报提交");
|
|
|
dailyReportLogDao.save(baseDailyReportLogDO);
|
|
|
return dailyReportUploadDO;
|
|
|
}
|
|
|
|
|
@ -431,6 +481,8 @@ public class DailyReportUploadService {
|
|
|
doubt = true;
|
|
|
}
|
|
|
tmp.setVerificationTime(new Date());
|
|
|
tmp.setVerificationUser(doctorId);
|
|
|
tmp.setVerificationUserName(doctorDO.getName());
|
|
|
}
|
|
|
reportDetailDao.save(detailDOList);
|
|
|
List<BaseDailyReportDetailDO> detailDOS = reportDetailDao.findByReportId(dailyReportUploadDO.getId());
|
|
@ -439,7 +491,15 @@ public class DailyReportUploadService {
|
|
|
dailyReportUploadDO.setState(1);
|
|
|
dailyReportUploadDao.save(dailyReportUploadDO);
|
|
|
}
|
|
|
BaseDailyReportLogDO baseDailyReportLogDO = new BaseDailyReportLogDO();
|
|
|
baseDailyReportLogDO.setCreateTime(new Date());
|
|
|
baseDailyReportLogDO.setReportId(dailyReportUploadDO.getId());
|
|
|
baseDailyReportLogDO.setOperateUser(doctorDO.getId());
|
|
|
baseDailyReportLogDO.setOperateUserName(doctorDO.getName());
|
|
|
if (doubt==true){//有疑惑,推送给总经办"0592181"和老板"0592008";//老板id
|
|
|
baseDailyReportLogDO.setType(3);
|
|
|
baseDailyReportLogDO.setTypeName("上级核实存疑");
|
|
|
baseDailyReportLogDO.setContent("上级核实存疑");
|
|
|
String sql = " select dict_value from wlyy_hospital_sys_dict where dict_name='MRRB_DOUBT_SENDER' ";
|
|
|
List<String> doubtSendUser = jdbcTemplate.queryForList(sql,String.class);
|
|
|
for (String senderUser:doubtSendUser){
|
|
@ -464,7 +524,12 @@ public class DailyReportUploadService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
baseDailyReportLogDO.setType(2);
|
|
|
baseDailyReportLogDO.setTypeName("上级核实未存疑");
|
|
|
baseDailyReportLogDO.setContent("上级核实未存疑");
|
|
|
}
|
|
|
dailyReportLogDao.save(baseDailyReportLogDO);
|
|
|
|
|
|
}else {
|
|
|
dailyReportUploadDO.setState(1);
|
|
@ -496,6 +561,36 @@ public class DailyReportUploadService {
|
|
|
}
|
|
|
reportDetailDao.save(detailDOList);
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
BaseDoctorDO remindDoctorDO = baseDoctorDao.findById(dailyReportUploadDO.getDoctorId());
|
|
|
if (remindDoctorDO != null) {
|
|
|
try {
|
|
|
WxEnterpriseUserDO enterpriseUserDO = wxEnterpriseUserDao.findByEnterpriseIdAndMobile(wechatId,remindDoctorDO.getMobile());
|
|
|
if(enterpriseUserDO==null){
|
|
|
logger.info("该用户"+doctorDO.getName()+"没有企业微信手机号,无法推送模版消息,用户ID:"+doctorDO.getId()+"wechatId:"+wechatId);
|
|
|
}else{
|
|
|
String title = "日报反馈";
|
|
|
String des = "您好,您上报的日报有新的反馈,请点击前往查看。";
|
|
|
String url = "https://ehr.yihu.com/hlwyy/zjxl/dailyReport/#/workSummary/commit?id="+dailyReportUploadDO.getId();
|
|
|
String res = enterpriseService.sendTWMesByDoctor(wechatId,remindDoctorDO.getId(),title,des,url);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
BaseDailyReportLogDO baseDailyReportLogDO = new BaseDailyReportLogDO();
|
|
|
baseDailyReportLogDO.setCreateTime(new Date());
|
|
|
baseDailyReportLogDO.setReportId(dailyReportUploadDO.getId());
|
|
|
baseDailyReportLogDO.setOperateUser(doctorDO.getId());
|
|
|
baseDailyReportLogDO.setOperateUserName(doctorDO.getName());
|
|
|
baseDailyReportLogDO.setType(4);
|
|
|
baseDailyReportLogDO.setTypeName("存疑核实");
|
|
|
baseDailyReportLogDO.setContent("存疑核实");
|
|
|
dailyReportLogDao.save(baseDailyReportLogDO);
|
|
|
return dailyReportUploadDO;
|
|
|
}
|
|
|
|
|
@ -512,6 +607,8 @@ public class DailyReportUploadService {
|
|
|
}else{
|
|
|
List<BaseDailyReportDetailDO> detailDOS = reportDetailDao.findByReportId(dailyReportUploadDO.getId());
|
|
|
dailyReportUploadDO.setDetailDOList(detailDOS);
|
|
|
List<BaseDailyReportLogDO> dailyReportLogDOList = dailyReportLogDao.findByReportId(dailyReportUploadDO.getId());
|
|
|
dailyReportUploadDO.setDailyReportLogDOList(dailyReportLogDOList);
|
|
|
}
|
|
|
return dailyReportUploadDO;
|
|
|
}
|
|
@ -519,25 +616,38 @@ public class DailyReportUploadService {
|
|
|
/**
|
|
|
* 查询成员的日报上传记录
|
|
|
* @param doctorId
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @param page
|
|
|
* @param pageSize
|
|
|
* @param startDateStr
|
|
|
* @param endDateStr
|
|
|
* @return
|
|
|
*/
|
|
|
public Page<BaseDailyReportUploadDO> selectReportByDoctorId(String doctorId,String startDate,String endDate,Integer page,Integer pageSize){
|
|
|
PageRequest pageRequest = new PageRequest(page - 1, pageSize);
|
|
|
Page<BaseDailyReportUploadDO> list = null;
|
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
|
list = dailyReportUploadDao.selectDailyReportByDoctorAndDateAndPage(doctorId, startDate, endDate, pageRequest);
|
|
|
}else {
|
|
|
list = dailyReportUploadDao.selectDailyReportByDoctor(doctorId, pageRequest);
|
|
|
}
|
|
|
public List<Map<String,List<BaseDailyReportUploadDO>>> selectReportByDoctorId(String doctorId,String startDateStr,String endDateStr){
|
|
|
List<BaseDailyReportUploadDO> list = null;
|
|
|
list = dailyReportUploadDao.selectDailyReportByDoctorAndDate(doctorId, startDateStr, endDateStr);
|
|
|
for (BaseDailyReportUploadDO tmp:list){
|
|
|
List<BaseDailyReportDetailDO> detailDOS = reportDetailDao.findByReportId(tmp.getId());
|
|
|
tmp.setDetailDOList(detailDOS);
|
|
|
List<BaseDailyReportLogDO> dailyReportLogDOList = dailyReportLogDao.findByReportId(tmp.getId());
|
|
|
tmp.setDailyReportLogDOList(dailyReportLogDOList);
|
|
|
}
|
|
|
Map<String,List<BaseDailyReportUploadDO>> reportList = list.stream().collect(Collectors.groupingBy(BaseDailyReportUploadDO::getReportDate));
|
|
|
Date endDate =DateUtil.strToDate(endDateStr);
|
|
|
Date startDate =DateUtil.strToDate(startDateStr);
|
|
|
List<Map<String,List<BaseDailyReportUploadDO>>> result = new ArrayList<>();
|
|
|
for (;;){
|
|
|
Map<String,List<BaseDailyReportUploadDO>> tmp = new HashMap<>();
|
|
|
String timeStr = DateUtil.dateToStrShort(endDate);
|
|
|
if (reportList.get(timeStr)!=null){
|
|
|
tmp.put(timeStr,reportList.get(timeStr));
|
|
|
}else {
|
|
|
tmp.put(timeStr,new ArrayList<>());
|
|
|
}
|
|
|
result.add(tmp);
|
|
|
if (!startDate.before(endDate)){
|
|
|
break;
|
|
|
}
|
|
|
endDate = DateUtil.getPreDays(endDate,-1);
|
|
|
}
|
|
|
return list;
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -553,6 +663,8 @@ public class DailyReportUploadService {
|
|
|
}else {
|
|
|
List<BaseDailyReportDetailDO> detailDOS = reportDetailDao.findByReportId(reportUploadDO.getId());
|
|
|
reportUploadDO.setDetailDOList(detailDOS);
|
|
|
List<BaseDailyReportLogDO> dailyReportLogDOList = dailyReportLogDao.findByReportId(reportUploadDO.getId());
|
|
|
reportUploadDO.setDailyReportLogDOList(dailyReportLogDOList);
|
|
|
}
|
|
|
return reportUploadDO;
|
|
|
}
|
|
@ -661,7 +773,7 @@ public class DailyReportUploadService {
|
|
|
reportCondition += " and up.state ='"+state+"' ";
|
|
|
}
|
|
|
|
|
|
String doctorSqlCondition = "";//医生过滤条件
|
|
|
String doctorSqlCondition = " and d.identity=0 ";//医生过滤条件
|
|
|
if (StringUtils.isNoneBlank(idType)) {
|
|
|
doctorSqlCondition += " and d.id_type = '" + idType + "' ";
|
|
|
}
|
|
@ -676,16 +788,16 @@ public class DailyReportUploadService {
|
|
|
"WHERE d.del = 1 AND dh.del = 1 "+doctorSqlCondition+" GROUP BY dh.dept_code)dh1 ON hd.CODE = dh1.dept_code " +
|
|
|
"LEFT JOIN(select dh.dept_code,count(up.id) 'yishangbaoTotal' from base_doctor_daily_report_upload up INNER JOIN base_doctor d on up.doctor_id = d.id " +
|
|
|
"LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
|
"where 1=1 "+doctorSqlCondition+reportCondition+")dh2 ON hd.CODE = dh2.dept_code " +
|
|
|
"where 1=1 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code)dh2 ON hd.CODE = dh2.dept_code " +
|
|
|
"LEFT JOIN(select dh.dept_code,count(distinct up.id) 'verified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " +
|
|
|
"INNER JOIN base_doctor d on up.doctor_id = d.id LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
|
"where 1=1 and de.state=1 "+doctorSqlCondition+reportCondition+" )dh3 ON hd.CODE = dh3.dept_code " +
|
|
|
"where 1=1 and de.state=1 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code)dh3 ON hd.CODE = dh3.dept_code " +
|
|
|
"LEFT JOIN(select dh.dept_code,count(distinct up.id) 'notVerified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " +
|
|
|
"INNER JOIN base_doctor d on up.doctor_id = d.id LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
|
"where 1=1 and de.state=0 "+doctorSqlCondition+reportCondition+")dh4 ON hd.CODE = dh4.dept_code " +
|
|
|
"where 1=1 and de.state=0 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code)dh4 ON hd.CODE = dh4.dept_code " +
|
|
|
"LEFT JOIN(select dh.dept_code,count(up.id) 'shangchuanTotal' from base_doctor_daily_report_upload up INNER JOIN base_doctor d on up.doctor_id = d.id " +
|
|
|
"LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
|
"where 1=1 "+reportCondition+")dh5 ON hd.CODE = dh2.dept_code " +
|
|
|
"where 1=1 "+doctorSqlCondition+reportCondition+")dh5 ON hd.CODE = dh5.dept_code " +
|
|
|
" 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 + "%') ";
|
|
@ -737,6 +849,131 @@ public class DailyReportUploadService {
|
|
|
return mapList;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 首页按照科室列表统计核实
|
|
|
*
|
|
|
* @param dept
|
|
|
* @param idType
|
|
|
* @param state 核实状态
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String, Object>> selectHeaderListHeshi(String doctor,String dept, String idType, String state, String startDate, String endDate, String name) {
|
|
|
String reportCondition = "";
|
|
|
|
|
|
if (StringUtils.isNoneBlank(startDate)) {//上传过滤条件
|
|
|
reportCondition += " and up.report_date >='" + startDate + "' and up.report_date<='" + endDate + "' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(state)){
|
|
|
reportCondition += " and up.state ='"+state+"' ";
|
|
|
}
|
|
|
|
|
|
String doctorSqlCondition = " and d.identity=0 ";//医生过滤条件
|
|
|
if (StringUtils.isNoneBlank(idType)) {
|
|
|
doctorSqlCondition += " and d.id_type = '" + idType + "' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
|
doctorSqlCondition += " and d.name like '%" + name + "%' ";
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNoneBlank(doctor)){
|
|
|
WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("dailyHeshiConfig");
|
|
|
String buffer = "";
|
|
|
if (hospitalSysDictDO!=null){
|
|
|
JSONArray array = JSONArray.parseArray(hospitalSysDictDO.getDictValue());
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject object = array.getJSONObject(i);
|
|
|
String header = object.getString("header");
|
|
|
if (header.equalsIgnoreCase(doctor)){
|
|
|
JSONArray jsonArray = object.getJSONArray("data");
|
|
|
for (int j=0;j<jsonArray.size();j++){
|
|
|
String str = jsonArray.getString(j);
|
|
|
buffer +="'"+str+"',";
|
|
|
}
|
|
|
buffer =buffer.substring(0,buffer.length()-1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(buffer)){
|
|
|
doctorSqlCondition += " and d.id IN ("+buffer+")";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
//填报人数、未填报人数、上级已核实、未核实
|
|
|
String deptSql = " select code,name,dh1.doctorTotal,dh2.yishangbaoTotal,dh3.verified,dh4.notVerified,dh5.shangchuanTotal from dict_hospital_dept hd " +
|
|
|
"LEFT JOIN (select count(1) as 'doctorTotal',dh.dept_code from base_doctor d LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
|
"WHERE d.del = 1 AND dh.del = 1 "+doctorSqlCondition+" GROUP BY dh.dept_code)dh1 ON hd.CODE = dh1.dept_code " +
|
|
|
"LEFT JOIN(select dh.dept_code,count(up.id) 'yishangbaoTotal' from base_doctor_daily_report_upload up INNER JOIN base_doctor d on up.doctor_id = d.id " +
|
|
|
"LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
|
"where 1=1 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code )dh2 ON hd.CODE = dh2.dept_code " +
|
|
|
"LEFT JOIN(select dh.dept_code,count(distinct up.id) 'verified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " +
|
|
|
"INNER JOIN base_doctor d on up.doctor_id = d.id LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
|
"where 1=1 and de.state=1 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code )dh3 ON hd.CODE = dh3.dept_code " +
|
|
|
"LEFT JOIN(select dh.dept_code,count(distinct up.id) 'notVerified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " +
|
|
|
"INNER JOIN base_doctor d on up.doctor_id = d.id LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
|
"where 1=1 and de.state=0 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code )dh4 ON hd.CODE = dh4.dept_code " +
|
|
|
"LEFT JOIN(select dh.dept_code,count(up.id) 'shangchuanTotal' from base_doctor_daily_report_upload up INNER JOIN base_doctor d on up.doctor_id = d.id " +
|
|
|
"LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
|
"where 1=1 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code )dh5 ON hd.CODE = dh5.dept_code " +
|
|
|
" 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(doctor)){
|
|
|
if (StringUtils.isNoneBlank(dept)) {
|
|
|
deptSql += " and hd.code = '" + dept + "' ";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
logger.info("deptSql=="+deptSql);
|
|
|
List<Map<String, Object>> mapList = jdbcTemplate.queryForList(deptSql);
|
|
|
for (Map<String,Object> deptMap:mapList){
|
|
|
String day = DateUtil.getTwoDay(endDate, startDate);
|
|
|
Integer doctorTotal = 0;
|
|
|
Integer total=0;
|
|
|
Integer yishangbaoTotal=0;
|
|
|
Integer weishangbaoTotal=0;
|
|
|
Integer notVerified=0;
|
|
|
Integer verified=0;
|
|
|
Integer shangchuanTotal=0;
|
|
|
|
|
|
if (deptMap.get("doctorTotal")!=null){
|
|
|
doctorTotal = Integer.parseInt(deptMap.get("doctorTotal").toString());
|
|
|
//总人次
|
|
|
if (!day.equalsIgnoreCase("0")) {
|
|
|
total = doctorTotal * (Integer.parseInt(day)+1);
|
|
|
} else {
|
|
|
total = doctorTotal;
|
|
|
}
|
|
|
}
|
|
|
if (deptMap.get("yishangbaoTotal")!=null) {
|
|
|
yishangbaoTotal = Integer.parseInt(deptMap.get("yishangbaoTotal").toString());
|
|
|
}
|
|
|
weishangbaoTotal = total-yishangbaoTotal;
|
|
|
if (deptMap.get("notVerified")!=null) {
|
|
|
notVerified = Integer.parseInt(deptMap.get("notVerified").toString());
|
|
|
}
|
|
|
if (deptMap.get("verified")!=null) {
|
|
|
verified = Integer.parseInt(deptMap.get("verified").toString());
|
|
|
}
|
|
|
if (deptMap.get("shangchuanTotal")!=null) {
|
|
|
shangchuanTotal = Integer.parseInt(deptMap.get("shangchuanTotal").toString());
|
|
|
}
|
|
|
|
|
|
deptMap.put("total", total);//总人次
|
|
|
deptMap.put("yishangbaoTotal", yishangbaoTotal);//已上报
|
|
|
deptMap.put("weishangbaoTotal", weishangbaoTotal);//未上报
|
|
|
deptMap.put("notVerified", notVerified);//未核实数量
|
|
|
deptMap.put("verified", verified);//已核实数量
|
|
|
deptMap.put("shangchuanTotal", shangchuanTotal);//上传总次数
|
|
|
}
|
|
|
return mapList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 具体每一个统计时间列表
|
|
|
*
|
|
@ -762,7 +999,7 @@ public class DailyReportUploadService {
|
|
|
JSONArray array = new JSONArray();
|
|
|
for ( 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 doctorSql = " select COUNT(1) as 'total' from base_doctor d where d.del=1 and d.identity=0 ";
|
|
|
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 )";
|
|
@ -831,7 +1068,7 @@ public class DailyReportUploadService {
|
|
|
JSONArray array = new JSONArray();
|
|
|
for (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 doctorSql = " select d.name,d.id,d.job_title_name as jobTitleName,d.photo from base_doctor d where d.del=1 and d.identity=0 ";
|
|
|
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 )";
|
|
@ -869,7 +1106,7 @@ public class DailyReportUploadService {
|
|
|
stateCondition += " and d1.state='"+state+"' ";
|
|
|
|
|
|
}
|
|
|
String sql = " select d1.id,d1.state from base_doctor_daily_report_upload d1 where d1.doctor_id='"+id+"' and d1.report_date>='"+date+"' and d1.report_date<='"+date+"' ORDER BY report_date desc ";
|
|
|
String sql = " select d1.id,d1.state,total_hour from base_doctor_daily_report_upload d1 where d1.doctor_id='"+id+"' and d1.report_date>='"+date+"' and d1.report_date<='"+date+"' ORDER BY report_date desc ";
|
|
|
List<Map<String, Object>> mapList1 = jdbcTemplate.queryForList(sql);
|
|
|
if (mapList1 != null && mapList1.size() != 0) {
|
|
|
for (Map<String, Object> map1 : mapList1) {
|
|
@ -881,6 +1118,8 @@ public class DailyReportUploadService {
|
|
|
}
|
|
|
map.put("uploadState", "已上报");
|
|
|
map.put("uploadId", map1.get("id").toString());
|
|
|
map.put("totalHour", map1.get("total_hour"));
|
|
|
|
|
|
}
|
|
|
map.put("recordList", mapList1);
|
|
|
} else {
|
|
@ -899,50 +1138,6 @@ public class DailyReportUploadService {
|
|
|
return array;
|
|
|
}
|
|
|
|
|
|
// /**
|
|
|
// * 报表导出
|
|
|
// *
|
|
|
// * @param startDate
|
|
|
// * @param endDate
|
|
|
// * @return
|
|
|
// */
|
|
|
// public JSONArray pushListWriteDailyReport(OutputStream os, String startDate, String endDate, String dept) throws Exception {
|
|
|
// List<String> list = new ArrayList<>();
|
|
|
// Date startTime = DateUtil.strToDateShort(startDate);
|
|
|
// Date endDateTime = DateUtil.strToDateShort(endDate);
|
|
|
// int i=0;
|
|
|
// do{
|
|
|
// startTime = DateUtil.getPreDays(startTime, i);
|
|
|
// String str = DateUtil.dateToStrShort(startTime);
|
|
|
// list.add(str);
|
|
|
// i++;
|
|
|
// }while (startTime.before(endDateTime));
|
|
|
// JSONArray array = new JSONArray();
|
|
|
// for (i = 0; i < list.size(); i++) {
|
|
|
// String date = list.get(i);
|
|
|
// String doctorSql = " select id,name,job_title_name from base_doctor d where d.del=1 ";
|
|
|
// 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();
|
|
|
// List<BaseDoctorHospitalDO> baseDoctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(id);
|
|
|
// if (baseDoctorHospitalDOS != null && baseDoctorHospitalDOS.size() != 0) {
|
|
|
// map.put("deptName", baseDoctorHospitalDOS.get(0).getDeptName());
|
|
|
// }
|
|
|
// }
|
|
|
// JSONObject object = new JSONObject();
|
|
|
// object.put("time", date);
|
|
|
// object.put("list", mapList);
|
|
|
// array.add(object);
|
|
|
// }
|
|
|
// pushListWritePriceTotal(os, array, startDate, endDate);
|
|
|
// return array;
|
|
|
// }
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查下上报最新一次记录
|
|
|
* @param doctor
|
|
@ -996,7 +1191,7 @@ public class DailyReportUploadService {
|
|
|
" 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 ";
|
|
|
" 1=1 and d.del=1 and d.identity=0 ";
|
|
|
if (StringUtils.isNotBlank(dept)) {
|
|
|
sql += " AND h.dept_code = '" + dept + "'";
|
|
|
}
|
|
@ -1014,6 +1209,111 @@ public class DailyReportUploadService {
|
|
|
if (dailyReportUploadDOS!=null&&dailyReportUploadDOS.size()!=0){
|
|
|
BaseDailyReportUploadDO dailyReportUploadDO = dailyReportUploadDOS.get(0);
|
|
|
List<BaseDailyReportDetailDO> detailDOList = reportDetailDao.findByReportId(dailyReportUploadDO.getId());
|
|
|
List<BaseDailyReportLogDO> reportLogDOS = dailyReportLogDao.findByReportId(dailyReportUploadDO.getId());
|
|
|
dailyReportUploadDO.setDailyReportLogDOList(reportLogDOS);
|
|
|
dailyReportUploadDO.setDetailDOList(detailDOList);
|
|
|
String verifiedName = "";
|
|
|
if ("1".equals(dailyReportUploadDO.getState())) {
|
|
|
verifiedName = "已核实";
|
|
|
} else {
|
|
|
verifiedName = "未核实";
|
|
|
}
|
|
|
map.put("verifiedName",verifiedName);
|
|
|
map.put("reportUploadDO",dailyReportUploadDO);
|
|
|
}else {
|
|
|
map.put("reportUploadDO",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;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param orgCode
|
|
|
* @param dept
|
|
|
* @param doctorCode
|
|
|
* @param key
|
|
|
* @param flag 是否核实1是0否
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String, Object>> findDoctorByHospitalAndDeptHeshi(String doctor,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 and d.identity=0 ";
|
|
|
if (StringUtils.isNotBlank(dept)) {
|
|
|
sql += " AND h.dept_code = '" + dept + "'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(doctor)){
|
|
|
WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("dailyHeshiConfig");
|
|
|
String buffer = "";
|
|
|
if (hospitalSysDictDO!=null){
|
|
|
JSONArray array = JSONArray.parseArray(hospitalSysDictDO.getDictValue());
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject object = array.getJSONObject(i);
|
|
|
String header = object.getString("header");
|
|
|
if (header.equalsIgnoreCase(doctor)){
|
|
|
JSONArray jsonArray = object.getJSONArray("data");
|
|
|
for (int j=0;j<jsonArray.size();j++){
|
|
|
String str = jsonArray.getString(j);
|
|
|
buffer +="'"+str+"',";
|
|
|
}
|
|
|
buffer =buffer.substring(0,buffer.length()-1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(buffer)){
|
|
|
sql += " and d.id IN ("+buffer+")";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
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 + "%') ";
|
|
|
}
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
for (Map<String,Object> map:list){
|
|
|
|
|
|
String id = map.get("id").toString();
|
|
|
List<BaseDailyReportUploadDO> dailyReportUploadDOS = dailyReportUploadDao.selectDailyReportByDoctorAndDate(id,DateUtil.getStringDateShort(),DateUtil.getStringDateShort());
|
|
|
if (dailyReportUploadDOS!=null&&dailyReportUploadDOS.size()!=0){
|
|
|
BaseDailyReportUploadDO dailyReportUploadDO = dailyReportUploadDOS.get(0);
|
|
|
List<BaseDailyReportDetailDO> detailDOList = reportDetailDao.findByReportId(dailyReportUploadDO.getId());
|
|
|
List<BaseDailyReportLogDO> reportLogDOS = dailyReportLogDao.findByReportId(dailyReportUploadDO.getId());
|
|
|
dailyReportUploadDO.setDailyReportLogDOList(reportLogDOS);
|
|
|
dailyReportUploadDO.setDetailDOList(detailDOList);
|
|
|
String verifiedName = "";
|
|
|
if ("1".equals(dailyReportUploadDO.getState())) {
|
|
@ -1060,7 +1360,7 @@ public class DailyReportUploadService {
|
|
|
endDate = DateUtil.getLastDayOfMonth();
|
|
|
}
|
|
|
String day = DateUtil.getTwoDay(endDate, startDate);
|
|
|
String doctorSql = " select COUNT(1) as 'total' from base_doctor d where d.del=1 ";
|
|
|
String doctorSql = " select COUNT(1) as 'total' from base_doctor d where d.del=1 and d.identity=0 ";
|
|
|
Integer total = 0;//总人次
|
|
|
String sqlCondition = "";
|
|
|
if (level==2){
|
|
@ -1174,7 +1474,7 @@ public class DailyReportUploadService {
|
|
|
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 ";
|
|
|
String doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 and d.identity=0 ";
|
|
|
Integer total = 0;//总人次
|
|
|
String sql = "select COUNT(DISTINCT d.id) as \"total\" from base_doctor_daily_report_upload d inner join base_daily_report_detail de " +
|
|
|
" on d.id = de.report_id where 1=1 ";
|
|
@ -1184,7 +1484,7 @@ public class DailyReportUploadService {
|
|
|
}
|
|
|
String idTypeCondition = " ";
|
|
|
if (StringUtils.isNoneBlank(idType)) {
|
|
|
idTypeCondition += " (select d1.id from base_doctor d1 where 1=1 and d1.id_type = '" + idType + "')";
|
|
|
idTypeCondition += " (select d1.id from base_doctor d1 where 1=1 and d1.identity=0 and d1.id_type = '" + idType + "')";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(deptCondition)) {
|
|
|
doctorSql += " and d.id IN " + deptCondition;
|
|
@ -1291,4 +1591,860 @@ public class DailyReportUploadService {
|
|
|
return object;
|
|
|
}
|
|
|
|
|
|
/*************************************日报项目相关******************************************/
|
|
|
|
|
|
/**
|
|
|
* 新增日报项目
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public BaseDailyReportItemDO newReportItem(String user,String title,String content,String begin_time,String end_time,Integer member_type,String members) throws Exception {
|
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
|
if (userRoles.size()==0){
|
|
|
throw new Exception("您无权限操作");
|
|
|
}
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(user);
|
|
|
if (null==doctorDO){
|
|
|
throw new Exception("用户不存在无权操作");
|
|
|
}
|
|
|
BaseDailyReportItemDO reportItemDO = new BaseDailyReportItemDO();
|
|
|
reportItemDO.setState(0);
|
|
|
reportItemDO.setDel(1);
|
|
|
reportItemDO.setTitle(title);
|
|
|
reportItemDO.setContent(content);
|
|
|
reportItemDO.setBeginTime(begin_time);
|
|
|
reportItemDO.setEndTime(end_time);
|
|
|
reportItemDO.setCreateTime(new Date());
|
|
|
reportItemDO.setCreateUser(user);
|
|
|
reportItemDO.setCreateUserName(doctorDO.getName());
|
|
|
reportItemDO = reportItemDao.save(reportItemDO);
|
|
|
List<BaseDailyReportItemMembersDO> membersDOS = new ArrayList<>();
|
|
|
if (1==member_type){//指定成员
|
|
|
List<String> membersList = Arrays.asList(members.split(","));
|
|
|
for (String tmp:membersList){
|
|
|
BaseDoctorDO docMemberTmp = baseDoctorDao.findById(tmp);
|
|
|
if (null!=docMemberTmp){
|
|
|
BaseDailyReportItemMembersDO membersDOTmp = new BaseDailyReportItemMembersDO();
|
|
|
membersDOTmp.setReportItemId(reportItemDO.getId());
|
|
|
membersDOTmp.setUserId(tmp);
|
|
|
membersDOTmp.setUserName(docMemberTmp.getName());
|
|
|
membersDOTmp.setDel(1);
|
|
|
membersDOS.add(membersDOTmp);
|
|
|
}
|
|
|
}
|
|
|
}else if (2==member_type){
|
|
|
List<String> depts = Arrays.asList(members.split(","));
|
|
|
for (String dept:depts){
|
|
|
sql = " select distinct doc.id,doc.name from base_doctor doc inner join base_doctor_hospital dh " +
|
|
|
"on doc.id = dh.doctor_code and doc.del=1 and dh.del=1 " +
|
|
|
"where dh.dept_code='"+dept+"' ";
|
|
|
List<Map<String,Object>> membersList = jdbcTemplate.queryForList(sql);
|
|
|
for (Map<String,Object> tmp:membersList){
|
|
|
String docTmp = tmp.get("id").toString();
|
|
|
String docNameTmp = tmp.get("name").toString();
|
|
|
BaseDailyReportItemMembersDO membersDOTmp = new BaseDailyReportItemMembersDO();
|
|
|
membersDOTmp.setReportItemId(reportItemDO.getId());
|
|
|
membersDOTmp.setUserId(docTmp);
|
|
|
membersDOTmp.setUserName(docNameTmp);
|
|
|
membersDOTmp.setDel(1);
|
|
|
membersDOS.add(membersDOTmp);
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
throw new Exception("系统异常,请稍后重试");
|
|
|
}
|
|
|
if (membersDOS.size()>0){
|
|
|
reportItemMembersDao.save(membersDOS);
|
|
|
}
|
|
|
reportItemDO.setItemMembersDOList(membersDOS);
|
|
|
return reportItemDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 编辑日报项目
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public BaseDailyReportItemDO modifyReportItem(String user,String item_id,String title,String content,Integer state,String begin_time,String end_time,String members) throws Exception {
|
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
|
if (userRoles.size()==0){
|
|
|
throw new Exception("您无权限操作");
|
|
|
}
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(user);
|
|
|
if (null==doctorDO){
|
|
|
throw new Exception("用户不存在无权操作");
|
|
|
}
|
|
|
BaseDailyReportItemDO reportItemDO = reportItemDao.findOne(item_id);
|
|
|
if (null==reportItemDO){
|
|
|
throw new Exception("日报项目不存在");
|
|
|
}
|
|
|
if (1==reportItemDO.getState()){
|
|
|
throw new Exception("日报项目已完成无法修改");
|
|
|
}
|
|
|
reportItemDO.setState(state);
|
|
|
reportItemDO.setDel(1);
|
|
|
reportItemDO.setTitle(title);
|
|
|
reportItemDO.setContent(content);
|
|
|
reportItemDO.setBeginTime(begin_time);
|
|
|
reportItemDO.setEndTime(end_time);
|
|
|
reportItemDO.setUpdateTime(new Date());
|
|
|
reportItemDO.setUpdateUser(user);
|
|
|
reportItemDO.setUpdateUserName(doctorDO.getName());
|
|
|
reportItemDao.save(reportItemDO);
|
|
|
List<BaseDailyReportItemMembersDO> membersDOS = new ArrayList<>();
|
|
|
reportItemMembersDao.deleteAllByReportItemId(reportItemDO.getId());
|
|
|
List<String> membersList = Arrays.asList(members.split(","));
|
|
|
for (String tmp:membersList){
|
|
|
BaseDoctorDO docMemberTmp = baseDoctorDao.findById(tmp);
|
|
|
if (null!=docMemberTmp){
|
|
|
BaseDailyReportItemMembersDO membersDOTmp = new BaseDailyReportItemMembersDO();
|
|
|
membersDOTmp.setReportItemId(reportItemDO.getId());
|
|
|
membersDOTmp.setUserId(tmp);
|
|
|
membersDOTmp.setUserName(docMemberTmp.getName());
|
|
|
membersDOTmp.setDel(1);
|
|
|
membersDOS.add(membersDOTmp);
|
|
|
}
|
|
|
}
|
|
|
if (membersDOS.size()>0){
|
|
|
reportItemMembersDao.save(membersDOS);
|
|
|
}
|
|
|
reportItemDO.setItemMembersDOList(membersDOS);
|
|
|
return reportItemDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*管理员完成日报项目
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public BaseDailyReportItemDO completeReportItem(String user,String item_id,String completionUser,String completionHour,String completionTime) throws Exception {
|
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
|
if (userRoles.size()==0){
|
|
|
throw new Exception("您无权限操作");
|
|
|
}
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(user);
|
|
|
if (null==doctorDO){
|
|
|
throw new Exception("用户不存在无权操作");
|
|
|
}
|
|
|
BaseDailyReportItemDO reportItemDO = reportItemDao.findOne(item_id);
|
|
|
if (null==reportItemDO){
|
|
|
throw new Exception("日报项目不存在");
|
|
|
}
|
|
|
reportItemDO.setState(1);
|
|
|
if (StringUtils.isNoneBlank(completionUser)){
|
|
|
BaseDoctorDO completionUserDO = baseDoctorDao.findById(completionUser);
|
|
|
if (null!=completionUserDO){
|
|
|
reportItemDO.setCompletionUser(completionUser);
|
|
|
reportItemDO.setCompletionUserName(completionUserDO.getName());
|
|
|
}else {
|
|
|
throw new Exception("完成人不存在");
|
|
|
}
|
|
|
}else {
|
|
|
reportItemDO.setCompletionUser(user);
|
|
|
reportItemDO.setCompletionUserName(doctorDO.getName());
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(completionHour)){
|
|
|
reportItemDO.setCompletionHour(completionHour);
|
|
|
}else {
|
|
|
//查询出关联的日报详情,计算完成时间
|
|
|
sql = " select IFNULL(sum(actual_completion_hour),'0') from base_daily_report_detail " +
|
|
|
" where report_item_id='"+item_id+"' ";
|
|
|
String completionHoursql = jdbcTemplate.queryForObject(sql,String.class);
|
|
|
reportItemDO.setCompletionHour(completionHoursql);
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(completionTime)){
|
|
|
reportItemDO.setCompletionTime(DateUtil.strToDate(completionTime));
|
|
|
}
|
|
|
reportItemDO.setUpdateUser(user);
|
|
|
reportItemDO.setUpdateUserName(doctorDO.getName());
|
|
|
reportItemDO.setUpdateTime(new Date());
|
|
|
reportItemDao.save(reportItemDO);
|
|
|
List<BaseDailyReportItemMembersDO> membersDOS = reportItemMembersDao.findMembersByItemId(reportItemDO.getId());
|
|
|
reportItemDO.setItemMembersDOList(membersDOS);
|
|
|
return reportItemDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 管理员删除日报项目
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean delReportItem(String user,String item_id) throws Exception {
|
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
|
if (userRoles.size()==0){
|
|
|
throw new Exception("您无权限操作");
|
|
|
}
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(user);
|
|
|
if (null==doctorDO){
|
|
|
throw new Exception("用户不存在无权操作");
|
|
|
}
|
|
|
BaseDailyReportItemDO reportItemDO = reportItemDao.findOne(item_id);
|
|
|
if (null==reportItemDO){
|
|
|
throw new Exception("日报项目不存在");
|
|
|
}
|
|
|
reportItemDO.setDel(0);
|
|
|
reportItemDO.setUpdateUser(user);
|
|
|
reportItemDO.setUpdateUserName(doctorDO.getName());
|
|
|
reportItemDO.setUpdateTime(new Date());
|
|
|
reportItemDao.save(reportItemDO);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询日报项目详情
|
|
|
*/
|
|
|
public BaseDailyReportItemDO findReportItemById(String item_id) throws Exception {
|
|
|
BaseDailyReportItemDO reportItemDO = reportItemDao.findOne(item_id);
|
|
|
if (null==reportItemDO){
|
|
|
throw new Exception("日报项目不存在");
|
|
|
}
|
|
|
String sql = " select m.*,IFNULL(A.completion_hour,0) completion_hour,dh.dept_code,dh.dept_name from base_daily_report_item_members m " +
|
|
|
"LEFT JOIN ( " +
|
|
|
"select up.doctor_id,SUM(IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0))) completion_hour " +
|
|
|
" from base_doctor_daily_report_upload up " +
|
|
|
"INNER JOIN base_daily_report_detail rd on up.id = rd.report_id and rd.report_item_id='"+item_id+"' )A on m.user_id = A.doctor_id " +
|
|
|
"INNER JOIN base_doctor_hospital dh on m.user_id = dh.doctor_code and dh.del=1 " +
|
|
|
" where m.del=1 and m.report_item_id='"+item_id+"' ";
|
|
|
List<BaseDailyReportItemMembersDO> membersDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(BaseDailyReportItemMembersDO.class));
|
|
|
reportItemDO.setItemMembersDOList(membersDOS);
|
|
|
return reportItemDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 管理员获取所有日报项目
|
|
|
*/
|
|
|
public List<BaseDailyReportItemDO> findReportItemListAdmin(String user,String title,String content,Integer state,String begin_time,String end_time,String createUser,String createUserName) throws Exception {
|
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
|
if (userRoles.size()==0){
|
|
|
throw new Exception("您无权限操作");
|
|
|
}
|
|
|
List<BaseDailyReportItemDO> itemDOS = new ArrayList<>();
|
|
|
sql = " select i.* from base_daily_report_item i where 1=1 and i.del=1 ";
|
|
|
if (StringUtils.isNotBlank(title)){
|
|
|
sql +=" and i.title like '%"+title+"%' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(content)){
|
|
|
sql +=" and i.content like '%"+content+"%' ";
|
|
|
}
|
|
|
if (null!=state){
|
|
|
sql += " and i.state='"+state+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(begin_time)){
|
|
|
sql += " and i.begin_time>='"+begin_time+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(end_time)){
|
|
|
sql += " and i.end_time<='"+end_time+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(createUser)){
|
|
|
sql += " and i.create_user = '"+createUser+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(createUserName)){
|
|
|
sql += " and i.create_user_name like '%"+createUserName+"%' ";
|
|
|
}
|
|
|
itemDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(BaseDailyReportItemDO.class));
|
|
|
for (BaseDailyReportItemDO tmp:itemDOS){
|
|
|
List<BaseDailyReportItemMembersDO> membersDOS = reportItemMembersDao.findMembersByItemId(tmp.getId());
|
|
|
tmp.setItemMembersDOList(membersDOS);
|
|
|
}
|
|
|
return itemDOS;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 员工获取所有日报项目
|
|
|
*/
|
|
|
public List<BaseDailyReportItemDO> findReportItemList(String user,String title,String content,Integer state,String begin_time,String end_time,String createUser,String createUserName) throws Exception {
|
|
|
String sql = "select i.* from base_daily_report_item i INNER JOIN base_daily_report_item_members mem on i.id = mem.report_item_id " +
|
|
|
"where i.del=1 and mem.del=1 and mem.user_id='"+user+"' " ;
|
|
|
|
|
|
if (StringUtils.isNotBlank(title)){
|
|
|
sql +=" and i.title like '%"+title+"%' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(content)){
|
|
|
sql +=" and i.content like '%"+content+"%' ";
|
|
|
}
|
|
|
if (null!=state){
|
|
|
sql += " and i.state='"+state+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(begin_time)){
|
|
|
sql += " and i.begin_time>='"+begin_time+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(end_time)){
|
|
|
sql += " and i.end_time<='"+end_time+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(createUser)){
|
|
|
sql += " and i.create_user = '"+createUser+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(createUserName)){
|
|
|
sql += " and i.create_user_name like '%"+createUserName+"%' ";
|
|
|
}
|
|
|
sql += " GROUP BY i.id ";
|
|
|
List<BaseDailyReportItemDO> itemDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(BaseDailyReportItemDO.class));
|
|
|
for (BaseDailyReportItemDO tmp:itemDOS){
|
|
|
List<BaseDailyReportItemMembersDO> membersDOS = reportItemMembersDao.findMembersByItemId(tmp.getId());
|
|
|
tmp.setItemMembersDOList(membersDOS);
|
|
|
}
|
|
|
return itemDOS;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 管理员日报项目统计
|
|
|
*/
|
|
|
public PageEnvelop statisticReportItemList(String user, String title, String content, Integer state,
|
|
|
String begin_time, String end_time, String createUser,String createUserName, Integer page, Integer size) throws Exception {
|
|
|
page = page>0?page-1:0;
|
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
|
if (userRoles.size()==0){
|
|
|
throw new Exception("您无权限操作");
|
|
|
}
|
|
|
List<BaseDailyReportItemDO> itemDOS = new ArrayList<>();
|
|
|
String sqlCondition = " ";
|
|
|
String sqlList = " select i.id,i.title,i.content,i.state,i.begin_time beginTime,i.end_time endTime,i.create_user_name createUserName," +
|
|
|
" CAST(IFNULL(sum(de.actual_completion_hour),'0') as char ) as completionHour " +
|
|
|
" from base_daily_report_item i LEFT JOIN base_daily_report_detail de on i.id = de.report_item_id " +
|
|
|
" where i.del=1 ";
|
|
|
String sqlCount = " select count(distinct i.id) from base_daily_report_item i where i.del=1 ";
|
|
|
if (StringUtils.isNotBlank(title)){
|
|
|
sqlCondition +=" and i.title like '%"+title+"%' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(content)){
|
|
|
sqlCondition +=" and i.content like '%"+content+"%' ";
|
|
|
}
|
|
|
if (null!=state){
|
|
|
sqlCondition += " and i.state='"+state+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(begin_time)){
|
|
|
sqlCondition += " and i.begin_time>='"+begin_time+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(end_time)){
|
|
|
sqlCondition += " and i.end_time<='"+end_time+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(createUser)){
|
|
|
sqlCondition += " and i.create_user = '"+createUser+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(createUserName)){
|
|
|
sqlCondition += " and i.create_user_name like '%"+createUserName+"%' ";
|
|
|
}
|
|
|
sqlList +=sqlCondition+ " group by i.id order by i.create_time,i.id desc limit "+page*size+","+size;
|
|
|
itemDOS = jdbcTemplate.query(sqlList,new BeanPropertyRowMapper<>(BaseDailyReportItemDO.class));
|
|
|
Long count = jdbcTemplate.queryForObject(sqlCount+sqlCondition,Long.class);
|
|
|
return PageEnvelop.getSuccessListWithPage("查询成功",itemDOS,page,size,count);
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> statisticReportItemById(String user,String item_id,Integer type) throws Exception {
|
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
|
if (userRoles.size()==0){
|
|
|
throw new Exception("您无权限操作");
|
|
|
}
|
|
|
if(1==type){//天
|
|
|
sql = " select i.id,i.title,i.content,i.state,i.begin_time beginTime,i.end_time endTime,i.create_user_name createUserName, " +
|
|
|
" CAST(IFNULL(sum(de.actual_completion_hour),'0') as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time' " +
|
|
|
"from base_daily_report_item i LEFT JOIN base_daily_report_detail de " +
|
|
|
"on i.id = de.report_item_id " +
|
|
|
"where 1=1 and i.id='"+item_id+"' " +
|
|
|
"group by i.id,DATE_FORMAT(de.create_time,'%Y-%m-%d') order by time asc ";
|
|
|
}else if (2==type){//按周
|
|
|
sql = " select i.id,i.title,i.content,i.state,i.begin_time beginTime,i.end_time endTime,i.create_user_name createUserName, " +
|
|
|
" CAST(IFNULL(sum(de.actual_completion_hour),'0') as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time' " +
|
|
|
"from base_daily_report_item i LEFT JOIN base_daily_report_detail de " +
|
|
|
"on i.id = de.report_item_id " +
|
|
|
"where 1=1 and i.id='"+item_id+"' " +
|
|
|
"group by i.id,DATE_FORMAT(de.create_time,'%Y%v') order by time asc ";
|
|
|
}else if (3==type){//月
|
|
|
sql = " select i.id,i.title,i.content,i.state,i.begin_time beginTime,i.end_time endTime,i.create_user_name createUserName, " +
|
|
|
" CAST(IFNULL(sum(de.actual_completion_hour),'0') as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m') as 'time' " +
|
|
|
"from base_daily_report_item i LEFT JOIN base_daily_report_detail de " +
|
|
|
"on i.id = de.report_item_id " +
|
|
|
"where 1=1 and i.id='"+item_id+"' " +
|
|
|
"group by i.id,DATE_FORMAT(de.create_time,'%Y-%m') order by time asc ";
|
|
|
}else {
|
|
|
throw new Exception("查询失败,请检查传入参数");
|
|
|
}
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
//计算平均值和占比
|
|
|
if (list.size()>0){
|
|
|
OptionalDouble avg = list.stream().mapToDouble(t -> t.get("completionHour") == null ? 0.0 :Double.parseDouble(t.get("completionHour").toString())).average();
|
|
|
Double totalHour = list.stream().mapToDouble(t -> t.get("completionHour") == null ? 0.0 :Double.parseDouble(t.get("completionHour").toString())).sum();
|
|
|
Double avgValue = avg.getAsDouble();
|
|
|
for (Map<String,Object>tmp :list){
|
|
|
tmp.put("avgValue",avgValue);
|
|
|
Double completionHour = Double.valueOf(tmp.get("completionHour").toString());
|
|
|
tmp.put("timeRange",getRangeDouble(completionHour,totalHour));
|
|
|
}
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> statisticReportItemMembersById(String user,String item_id,Integer type,String member) throws Exception {
|
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
|
if (userRoles.size()==0){
|
|
|
throw new Exception("您无权限操作");
|
|
|
}
|
|
|
String memberSql = " ";
|
|
|
if (StringUtils.isNotBlank(member)){
|
|
|
memberSql = " and up.doctor_id='"+member+"' ";
|
|
|
}
|
|
|
if(0==type){
|
|
|
sql = " select i.id,i.title,i.content,i.state,i.begin_time beginTime,i.end_time endTime,i.create_user_name createUserName,up.doctor_id,up.doctor_name doctorName, " +
|
|
|
" CAST(IFNULL(sum(de.actual_completion_hour),'0') as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time' " +
|
|
|
"from base_daily_report_item i LEFT JOIN base_daily_report_detail de " +
|
|
|
"on i.id = de.report_item_id INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id " +
|
|
|
"where 1=1 and i.id='"+item_id+"' " +memberSql+
|
|
|
"group by i.id,up.doctor_id order by completionHour desc ";
|
|
|
}
|
|
|
else if(1==type){//天
|
|
|
sql = " select i.id,i.title,i.content,i.state,i.begin_time beginTime,i.end_time endTime,i.create_user_name createUserName,up.doctor_id,up.doctor_name doctorName, " +
|
|
|
" CAST(IFNULL(sum(de.actual_completion_hour),'0') as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time' " +
|
|
|
"from base_daily_report_item i LEFT JOIN base_daily_report_detail de " +
|
|
|
"on i.id = de.report_item_id INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id " +
|
|
|
"where 1=1 and i.id='"+item_id+"' " +
|
|
|
"group by i.id,up.doctor_id,DATE_FORMAT(de.create_time,'%Y-%m-%d') order by time asc ";
|
|
|
}else if (2==type){//按周
|
|
|
sql = " select i.id,i.title,i.content,i.state,i.begin_time beginTime,i.end_time endTime,i.create_user_name createUserName,up.doctor_id,up.doctor_name doctorName, " +
|
|
|
" CAST(IFNULL(sum(de.actual_completion_hour),'0') as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time' " +
|
|
|
"from base_daily_report_item i LEFT JOIN base_daily_report_detail de " +
|
|
|
"on i.id = de.report_item_id INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id " +
|
|
|
"where 1=1 and i.id='"+item_id+"' " +memberSql+
|
|
|
"group by i.id,up.doctor_id,DATE_FORMAT(de.create_time,'%Y%v') order by time asc ";
|
|
|
}else if (3==type){//月
|
|
|
sql = " select i.id,i.title,i.content,i.state,i.begin_time beginTime,i.end_time endTime,i.create_user_name createUserName,up.doctor_id,up.doctor_name doctorName, " +
|
|
|
" CAST(IFNULL(sum(de.actual_completion_hour),'0') as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m') as 'time' " +
|
|
|
"from base_daily_report_item i LEFT JOIN base_daily_report_detail de " +
|
|
|
"on i.id = de.report_item_id INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id " +
|
|
|
"where 1=1 and i.id='"+item_id+"' " +memberSql+
|
|
|
"group by i.id,up.doctor_id,DATE_FORMAT(de.create_time,'%Y-%m') order by time asc ";
|
|
|
}else {
|
|
|
throw new Exception("查询失败,请检查传入参数");
|
|
|
}
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
//计算平均值和占比
|
|
|
if (list.size()>0){
|
|
|
OptionalDouble avg = list.stream().mapToDouble(t -> t.get("completionHour") == null ? 0.0 :Double.parseDouble(t.get("completionHour").toString())).average();
|
|
|
Double totalHour = list.stream().mapToDouble(t -> t.get("completionHour") == null ? 0.0 :Double.parseDouble(t.get("completionHour").toString())).sum();
|
|
|
Double avgValue = avg.getAsDouble();
|
|
|
for (Map<String,Object>tmp :list){
|
|
|
tmp.put("avgValue",avgValue);
|
|
|
Double completionHour = Double.valueOf(tmp.get("completionHour").toString());
|
|
|
tmp.put("timeRange",getRangeDouble(completionHour,totalHour));
|
|
|
}
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 导出项目计划周报月报用时情况
|
|
|
* @param user
|
|
|
* @param type 1周报2月报
|
|
|
* @param date
|
|
|
* @return
|
|
|
*/
|
|
|
public void getProjectItemReport(HttpServletResponse response, String user, Integer type, String date) throws Exception {
|
|
|
//判断导出人权限
|
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
|
boolean adminFlag = false;//true 为总管理员 false为部门管理员
|
|
|
String startTime = "";
|
|
|
String endTime = "";
|
|
|
if (userRoles.size()==0){
|
|
|
throw new Exception("您无权限操作");
|
|
|
}else {
|
|
|
String role_code = userRoles.get(0).get("role_code").toString();
|
|
|
if ("admin".equals(role_code)){
|
|
|
adminFlag = true;
|
|
|
} else if ("deptAdmin".equals(role_code)) {
|
|
|
adminFlag = false;
|
|
|
}else {
|
|
|
throw new Exception("您无权限操作");
|
|
|
}
|
|
|
}
|
|
|
if(1==type){//周报
|
|
|
//获取日期对应月、周范围
|
|
|
startTime = DateUtil.getMondayOfThisWeek(DateUtil.strToDate(date))+" 00:00:00";
|
|
|
endTime = DateUtil.getSundayOfThisWeek(DateUtil.strToDate(date))+" 23:59:59";
|
|
|
}else if (2==type){//月报
|
|
|
startTime = DateUtil.getFristDayOfMonthThisDate(new Date())+" 00:00:00";
|
|
|
endTime = DateUtil.getLastDayOfMonthThisDate(new Date())+" 23:59:59";
|
|
|
}else {
|
|
|
throw new Exception("导出失败,请检查传入参数");
|
|
|
}
|
|
|
//项目耗时情况
|
|
|
sql = " select it.title,it.content,sum(IFNULL(pd.actual_completion_hour,IFNULL(pd.completion_hour,0))) 'completion_hour' ," +
|
|
|
" CASE it.state WHEN 1 THEN '已完成' ELSE '未完成' END as 'state',DATE_FORMAT(it.create_time,'%Y-%m-%d %H:%i:%S') create_time,it.create_user_name " +
|
|
|
"from base_daily_report_item it LEFT JOIN base_daily_report_detail pd " +
|
|
|
"on it.id = pd.report_item_id " +
|
|
|
" and it.del=1 and it.state>=0 and pd.create_time>='"+startTime+"' and pd.create_time<='"+endTime+"' " +
|
|
|
" where (it.completion_time is null or it.completion_time>='"+startTime+"') " ;
|
|
|
if (!adminFlag){
|
|
|
sql +=" and i.create_user='"+user+"' ";
|
|
|
}
|
|
|
sql += "GROUP BY it.id ORDER BY it.title,it.create_time desc ";
|
|
|
List<Map<String,Object>> projectlist = jdbcTemplate.queryForList(sql);
|
|
|
sql = " select up.doctor_id,up.doctor_name,doc.job_title_name,dh.dept_name,up.week_name,up.report_date, " +
|
|
|
"CASE up.leave_state WHEN 1 THEN '请假' else '未请假' END as 'leave_state',IFNULL(up.leave_hour,0) leave_hour, " +
|
|
|
"it.title,it.content,rd.sort,rd.report_content,IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0)) 'completion_hour', " +
|
|
|
"DATE_FORMAT(rd.create_time,'%Y-%m-%d %H:%i:%S') create_time,DATE_FORMAT(rd.verification_time,'%Y-%m-%d %H:%i:%S') verification_time,rd.remark " +
|
|
|
"from base_doctor_daily_report_upload up INNER JOIN base_doctor doc on up.doctor_id = doc.id " +
|
|
|
"INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 LEFT JOIN " +
|
|
|
"base_daily_report_detail rd on up.id = rd.report_id " +
|
|
|
"LEFT JOIN base_daily_report_item it on rd.report_item_id = it.id " +
|
|
|
"where 1=1 and rd.create_time>='"+startTime+"' and rd.create_time<='"+endTime+"' " ;
|
|
|
if (!adminFlag){
|
|
|
sql +=" and up.doctor_id in ( select distinct dh2.doctor_code from base_doctor_hospital dh " +
|
|
|
"INNER JOIN base_doctor_hospital dh2 on dh.dept_code = dh2.dept_code " +
|
|
|
"INNER JOIN base_doctor doc on dh2.doctor_code = doc.id " +
|
|
|
"where dh.doctor_code='"+user+"' and dh.del=1 and dh2.del=1 and doc.del=1 ) ";
|
|
|
}
|
|
|
sql += "ORDER BY up.doctor_id, report_date,rd.sort asc ";
|
|
|
List<Map<String,Object>> userCompleteList = jdbcTemplate.queryForList(sql);
|
|
|
//项目对应员工完成情况
|
|
|
projectItemReportToOutStream(response,type,projectlist,userCompleteList,DateUtil.dateToStrFormatShort(DateUtil.strToDate(startTime)),DateUtil.dateToStrFormatShort(DateUtil.strToDate(endTime)));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 导出员工周报月报提交情况
|
|
|
* @param user
|
|
|
* @param type 1周报2月报
|
|
|
* @param date
|
|
|
* @return
|
|
|
*/
|
|
|
public void getUserReportList(HttpServletResponse response,String user,Integer type,String date) throws Exception {
|
|
|
//判断导出人权限
|
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
|
boolean adminFlag = false;//true 为总管理员 false为部门管理员
|
|
|
String startTime = "";
|
|
|
String endTime = "";
|
|
|
if (userRoles.size()==0){
|
|
|
throw new Exception("您无权限操作");
|
|
|
}else {
|
|
|
String role_code = userRoles.get(0).get("role_code").toString();
|
|
|
if ("admin".equals(role_code)){
|
|
|
adminFlag = true;
|
|
|
} else if ("deptAdmin".equals(role_code)) {
|
|
|
adminFlag = false;
|
|
|
}else {
|
|
|
throw new Exception("您无权限操作");
|
|
|
}
|
|
|
}
|
|
|
if(1==type){//周报
|
|
|
//获取日期对应月、周范围
|
|
|
startTime = DateUtil.getMondayOfThisWeek(DateUtil.strToDate(date))+" 00:00:00";
|
|
|
endTime = DateUtil.getSundayOfThisWeek(DateUtil.strToDate(date))+" 23:59:59";
|
|
|
}else if (2==type){//月报
|
|
|
startTime = DateUtil.getFristDayOfMonthThisDate(new Date())+" 00:00:00";
|
|
|
endTime = DateUtil.getLastDayOfMonthThisDate(new Date())+" 23:59:59";
|
|
|
}else {
|
|
|
throw new Exception("导出失败,请检查传入参数");
|
|
|
}
|
|
|
sql = " select up.doctor_id,up.doctor_name,doc.job_title_name,dh.dept_name,up.week_name,up.report_date, " +
|
|
|
"CASE up.leave_state WHEN 1 THEN '请假' else '未请假' END as 'leave_state',IFNULL(up.leave_hour,0) leave_hour, " +
|
|
|
"it.title,it.content,rd.sort,rd.report_content,IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0)) 'completion_hour', " +
|
|
|
"DATE_FORMAT(rd.create_time,'%Y-%m-%d %H:%i:%S') create_time,DATE_FORMAT(rd.verification_time,'%Y-%m-%d %H:%i:%S') verification_time," +
|
|
|
" rd.remark " +
|
|
|
"from base_doctor_daily_report_upload up INNER JOIN base_doctor doc on up.doctor_id = doc.id " +
|
|
|
"INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 LEFT JOIN " +
|
|
|
"base_daily_report_detail rd on up.id = rd.report_id " +
|
|
|
"LEFT JOIN base_daily_report_item it on rd.report_item_id = it.id " +
|
|
|
"where 1=1 and rd.create_time>='"+startTime+"' and rd.create_time<='"+endTime+"' " ;
|
|
|
if (!adminFlag){
|
|
|
sql +=" and up.doctor_id in ( select distinct dh2.doctor_code from base_doctor_hospital dh " +
|
|
|
"INNER JOIN base_doctor_hospital dh2 on dh.dept_code = dh2.dept_code " +
|
|
|
"INNER JOIN base_doctor doc on dh2.doctor_code = doc.id " +
|
|
|
"where dh.doctor_code='"+user+"' and dh.del=1 and dh2.del=1 and doc.del=1 ) ";
|
|
|
}
|
|
|
sql += "ORDER BY up.doctor_id, report_date,rd.sort asc ";
|
|
|
List<Map<String,Object>> userCompleteList = jdbcTemplate.queryForList(sql);
|
|
|
String typeName = 1==type?"周报":"月报";
|
|
|
|
|
|
OutputStream os = response.getOutputStream();
|
|
|
response.setContentType("octets/stream");
|
|
|
response.setHeader("Content-Disposition", "attachment; filename=" + new String(URLEncoder.encode(typeName+"员工完成情况")+".xls"));
|
|
|
UserReportListExcel(userCompleteList,os,DateUtil.dateToStrFormatShort(DateUtil.strToDate(startTime)),DateUtil.dateToStrFormatShort(DateUtil.strToDate(endTime)));
|
|
|
}
|
|
|
|
|
|
public void projectItemReportToOutStream(HttpServletResponse response,Integer type,List<Map<String,Object>> projectList,List<Map<String,Object>> userCompleteList,
|
|
|
String startDate,String endDate) throws Exception {
|
|
|
Map<String,List<Map<String,Object>>> projectMap = projectList.stream().collect(Collectors.groupingBy(e -> e.get("title").toString()));
|
|
|
String typeName = 1==type?"周报":"月报";
|
|
|
String zipFileName = "项目"+typeName+"完成情况"+startDate+"至"+endDate;
|
|
|
|
|
|
long time = System.currentTimeMillis();
|
|
|
String exportConclusionList = time+"exportList";
|
|
|
String path = this.getClass().getResource("/").getPath() + exportConclusionList;
|
|
|
File file = new File(path);
|
|
|
// 删除文件夹、文件
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
|
|
|
System.out.println("创建文件夹时间:"+sdf.format(new Date()));
|
|
|
if (file.exists()) {
|
|
|
if (file != null){
|
|
|
FileUtil.deleteFolder(file);
|
|
|
file.mkdir();
|
|
|
}else {
|
|
|
file.delete();
|
|
|
file.mkdir();
|
|
|
}
|
|
|
}else {
|
|
|
file.mkdir();
|
|
|
}
|
|
|
/**
|
|
|
* 开始创建周报/月报耗时情况
|
|
|
*/
|
|
|
try {
|
|
|
String fileName = typeName+"完成情况"+".xls";;
|
|
|
OutputStream os = new FileOutputStream(path+"/"+fileName);
|
|
|
WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
|
|
|
WritableSheet sheet = wwb.createSheet("sheet", 1);
|
|
|
String header[] = {typeName+"完成情况("+startDate+"至"+endDate+")", "", "","", "", ""};
|
|
|
int i = 0;
|
|
|
for (String h : header) {
|
|
|
addCell(sheet, 0, i, h);
|
|
|
i++;
|
|
|
}
|
|
|
/**
|
|
|
* mergeCells(a,b,c,d) 单元格合并函数
|
|
|
* a 单元格的列号
|
|
|
* b 单元格的行号
|
|
|
* c 从单元格[a,b]起,向“右”合并的列数 注意c不是合并列的数量,而是列的下标数
|
|
|
* d 从单元格[a,b]起,向下合并到d行
|
|
|
*/
|
|
|
sheet.mergeCells(0, 0, header.length-1, 0);
|
|
|
header = new String[]{"项目", "内容", "用时", "是否完成", "创建人", "创建时间"};
|
|
|
i = 0;
|
|
|
for (String h : header) {
|
|
|
addCell(sheet,1 , i, h);
|
|
|
i++;
|
|
|
}
|
|
|
i=2;
|
|
|
//记录所需要合并的信息(项目)
|
|
|
int a=0,b=0,c=0,d=0;
|
|
|
String titleMerge = null;
|
|
|
for (Map<String,Object> projectTmp:projectList){
|
|
|
String title = null==projectTmp.get("title")?"":projectTmp.get("title").toString();
|
|
|
if (null==titleMerge){
|
|
|
titleMerge = title;
|
|
|
a = 0;
|
|
|
b=i;
|
|
|
d=0;
|
|
|
}
|
|
|
if (title.equals(titleMerge)){
|
|
|
d=i;
|
|
|
}else {
|
|
|
titleMerge = title;
|
|
|
sheet.mergeCells(a, b, c, d);
|
|
|
a = 0;
|
|
|
b=i;
|
|
|
d=0;
|
|
|
}
|
|
|
addCell(sheet,i , 0,null==projectTmp.get("title")?"":projectTmp.get("title").toString());
|
|
|
addCell(sheet,i , 1,null==projectTmp.get("content")?"":projectTmp.get("content").toString());
|
|
|
addCell(sheet,i , 2,null==projectTmp.get("completion_hour")?"":projectTmp.get("completion_hour").toString());
|
|
|
addCell(sheet,i , 3,null==projectTmp.get("state")?"":projectTmp.get("state").toString());
|
|
|
addCell(sheet,i , 4,null==projectTmp.get("create_user_name")?"":projectTmp.get("create_user_name").toString());
|
|
|
addCell(sheet,i , 5,null==projectTmp.get("create_time")?"":projectTmp.get("create_time").toString());
|
|
|
i++;
|
|
|
}
|
|
|
sheet.mergeCells(a, b, c, d);
|
|
|
wwb.write();
|
|
|
wwb.close();
|
|
|
File zipFile = new File(path.replace(exportConclusionList, "") + zipFileName + ".zip");
|
|
|
if (zipFile.exists()) {
|
|
|
zipFile.delete();
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
/**
|
|
|
* 开始创建员工用时情况
|
|
|
*/
|
|
|
try {
|
|
|
String fileName = typeName+"员工完成情况"+".xls";;
|
|
|
OutputStream os = new FileOutputStream(path+"/"+fileName);
|
|
|
UserReportListExcel(userCompleteList,os,startDate,endDate);
|
|
|
File zipFile = new File(path.replace(exportConclusionList, "") + zipFileName + ".zip");
|
|
|
if (zipFile.exists()) {
|
|
|
zipFile.delete();
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
// 打包文件夹
|
|
|
if (FileUtil.fileToZip(path, path.replace(exportConclusionList, ""), zipFileName)) {
|
|
|
file = new File(path.replace(exportConclusionList, "") + zipFileName + ".zip");
|
|
|
} else {
|
|
|
file = null;
|
|
|
}
|
|
|
|
|
|
if (file != null) {
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
response.setContentType("multipart/form-data");
|
|
|
response.setHeader("Content-Disposition", "attachment; filename=" + new String(URLEncoder.encode(zipFileName)+".zip"));
|
|
|
InputStream inputStream = new FileInputStream(file);
|
|
|
OutputStream outputStream = response.getOutputStream();
|
|
|
byte[] b = new byte[2048];
|
|
|
int length = 0;
|
|
|
while ((length = inputStream.read(b)) > 0) {
|
|
|
outputStream.write(b, 0, length);
|
|
|
}
|
|
|
outputStream.flush();
|
|
|
outputStream.close();
|
|
|
inputStream.close();
|
|
|
} else {
|
|
|
response.setStatus(500);
|
|
|
}
|
|
|
file.delete();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 员工耗时表格操作
|
|
|
* @param userCompleteList
|
|
|
* @param os
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @throws IOException
|
|
|
* @throws WriteException
|
|
|
*/
|
|
|
public void UserReportListExcel(List<Map<String,Object>> userCompleteList,OutputStream os,String startDate,String endDate) throws IOException, WriteException {
|
|
|
WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
|
|
|
WritableSheet sheet = wwb.createSheet("sheet", 1);
|
|
|
String[] header = {"员工完成情况("+startDate+"至"+endDate+")","","","","","","","","","","","","","","","","",""};//
|
|
|
int k = 0;
|
|
|
for (String h : header) {
|
|
|
addCell(sheet, 0, k, h);//表名,行,列,header
|
|
|
k++;
|
|
|
}
|
|
|
sheet.mergeCells(0, 0, header.length-1, 0);
|
|
|
header = new String[]{"人员", "部门","岗位","日期", "上报日期", "请假状态", "请假时长","关联项目","关联项目内容","事项序号", "事项内容", "用时", "创建时间", "上级核实","核实人员","核实时间","是否存疑","备注"};
|
|
|
int i = 0;
|
|
|
for (String h : header) {
|
|
|
addCell(sheet, 1, i, h);
|
|
|
i++;
|
|
|
}
|
|
|
i=2;
|
|
|
//记录所需要合并的信息 (人员、日期、上报日期)
|
|
|
int a1=0,b1=0,c1=0,d1=0;//姓名
|
|
|
int a2=3,b2=0,c2=0,d2=0;//weekName
|
|
|
int a3=4,b3=0,c3=0,d3=0;//上报日期
|
|
|
String doctorIdMerge =null;
|
|
|
String doctorNameMerge = null;
|
|
|
String weekNameMerge = null;
|
|
|
String reportDateMerge = null;
|
|
|
for (Map<String,Object> completeTmp:userCompleteList){
|
|
|
String doctorName = null==completeTmp.get("doctor_name")?"":completeTmp.get("doctor_name").toString();
|
|
|
String weekName = null==completeTmp.get("week_name")?"":completeTmp.get("week_name").toString();
|
|
|
String reportDate = null==completeTmp.get("report_date")?"":completeTmp.get("report_date").toString();
|
|
|
String doctorId = null==completeTmp.get("doctor_id")?"":completeTmp.get("doctor_id").toString();
|
|
|
if (null==doctorIdMerge){
|
|
|
doctorIdMerge = doctorId;
|
|
|
}
|
|
|
if (!doctorId.equals(doctorIdMerge)){
|
|
|
sheet.mergeCells(a1, b1, c1, d1);
|
|
|
sheet.mergeCells(a1+1, b1, c1, d1);//部门
|
|
|
sheet.mergeCells(a1+2, b1, c1, d1);//岗位
|
|
|
sheet.mergeCells(a2, b2, c2, d2);
|
|
|
sheet.mergeCells(a3, b3, c3, d3);
|
|
|
doctorIdMerge = doctorId;
|
|
|
b1=i;d1=0;
|
|
|
b2=i;d2=0;
|
|
|
b3=i;d3=0;
|
|
|
}else {
|
|
|
if (null==doctorNameMerge){
|
|
|
doctorNameMerge = doctorName;
|
|
|
b1=i;
|
|
|
d1=0;
|
|
|
}
|
|
|
if (doctorName.equals(doctorNameMerge)){
|
|
|
d1=i;
|
|
|
}else {
|
|
|
doctorNameMerge = doctorName;
|
|
|
sheet.mergeCells(a1, b1, c1, d1);
|
|
|
sheet.mergeCells(a1+1, b1, c1, d1);//部门
|
|
|
sheet.mergeCells(a1+2, b1, c1, d1);//岗位
|
|
|
b1=i;
|
|
|
d1=0;
|
|
|
}
|
|
|
|
|
|
if (null==weekNameMerge){
|
|
|
weekNameMerge = weekName;
|
|
|
b2=i;
|
|
|
d2=0;
|
|
|
}
|
|
|
if (weekName.equals(weekNameMerge)){
|
|
|
d2=i;
|
|
|
}else {
|
|
|
weekNameMerge = weekName;
|
|
|
sheet.mergeCells(a2, b2, c2, d2);
|
|
|
b2=i;
|
|
|
d2=0;
|
|
|
}
|
|
|
if (null==reportDateMerge){
|
|
|
reportDateMerge = reportDate;
|
|
|
b3=i;
|
|
|
d3=0;
|
|
|
}
|
|
|
if (reportDate.equals(reportDateMerge)){
|
|
|
d3=i;
|
|
|
}else {
|
|
|
reportDateMerge = reportDate;
|
|
|
sheet.mergeCells(a3, b3, c3, d3);
|
|
|
b3=i;
|
|
|
d3=0;
|
|
|
}
|
|
|
}
|
|
|
addCell(sheet,i, 0,null==completeTmp.get("doctor_name")?"":completeTmp.get("doctor_name").toString());
|
|
|
addCell(sheet,i, 1,null==completeTmp.get("dept_name")?"":completeTmp.get("dept_name").toString());
|
|
|
addCell(sheet,i, 2,null==completeTmp.get("job_title_name")?"":completeTmp.get("job_title_name").toString());
|
|
|
addCell(sheet,i, 3,null==completeTmp.get("week_name")?"":completeTmp.get("week_name").toString());
|
|
|
addCell(sheet,i, 4,null==completeTmp.get("report_date")?"":completeTmp.get("report_date").toString());
|
|
|
addCell(sheet,i, 5,null==completeTmp.get("leave_state")?"":completeTmp.get("leave_state").toString());
|
|
|
addCell(sheet,i, 6,null==completeTmp.get("leave_hour")?"":completeTmp.get("leave_hour").toString());
|
|
|
addCell(sheet,i ,7,null==completeTmp.get("title")?"":completeTmp.get("title").toString());
|
|
|
addCell(sheet,i, 8,null==completeTmp.get("content")?"":completeTmp.get("content").toString());
|
|
|
addCell(sheet,i, 9,null==completeTmp.get("sort")?"":completeTmp.get("sort").toString());
|
|
|
addCell(sheet,i, 10,null==completeTmp.get("report_content")?"":completeTmp.get("report_content").toString());
|
|
|
addCell(sheet,i , 11,null==completeTmp.get("completion_hour")?"":completeTmp.get("completion_hour").toString());
|
|
|
addCell(sheet,i , 12,null==completeTmp.get("create_time")?"":completeTmp.get("create_time").toString());
|
|
|
addCell(sheet,i , 13,null==completeTmp.get("verification_state")?"":completeTmp.get("verification_state").toString());
|
|
|
addCell(sheet,i , 14,null==completeTmp.get("verification_user_name")?"":completeTmp.get("verification_user_name").toString());
|
|
|
addCell(sheet,i , 15,null==completeTmp.get("verification_time")?"":completeTmp.get("verification_time").toString());
|
|
|
addCell(sheet,i , 16,null==completeTmp.get("doubt")?"":completeTmp.get("doubt").toString());
|
|
|
addCell(sheet,i , 17,null==completeTmp.get("remark")?"":completeTmp.get("remark").toString());
|
|
|
i++;
|
|
|
}
|
|
|
sheet.mergeCells(a1, b1, c1, d1);
|
|
|
sheet.mergeCells(a1+1, b1, c1, d1);//部门
|
|
|
sheet.mergeCells(a1+2, b1, c1, d1);//岗位
|
|
|
sheet.mergeCells(a2, b2, c2, d2);
|
|
|
sheet.mergeCells(a3, b3, c3, d3);
|
|
|
wwb.write();
|
|
|
wwb.close();
|
|
|
}
|
|
|
|
|
|
|
|
|
public double getRangeDouble(Double first, Double second) {
|
|
|
if (second == 0 && first > 0) {
|
|
|
//如果分母为0 分子不为0 返回100%
|
|
|
return 100;
|
|
|
} else if (second == 0 && first == 0) {
|
|
|
//如果分母为0 分子为0 返回0%
|
|
|
return 0;
|
|
|
}
|
|
|
double result = (first * 100.0) / second;
|
|
|
DecimalFormat df = new DecimalFormat("0.00");//格式化小数,不足的补0
|
|
|
String filesize = df.format(result);
|
|
|
return Double.parseDouble(filesize);
|
|
|
}
|
|
|
|
|
|
private 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);
|
|
|
}
|
|
|
}
|